In this chapter, the following content will be discussed: Transistor: building block of computers, simple switch circuit, n-type MOS transistor, logic gates, inverter (NOT Gate),.and other contents. | CSC 221 Computer Organization and Assembly Language Lecture 12: Addressing Modes in Assembly Lecture 11: Review OFFSET Operator OFFSET returns the distance in bytes, of a label from the beginning of its enclosing segment PTR Operator Overrides the default type of a label (variable). Provides the flexibility to access part of a variable. mov esi,OFFSET bVal ;ESI = 00404000 -------------------------------- .data array BYTE 100 DUP(?) .code mov esi,OFFSET array ; ESI is p Data-Related Operators and Directives .data myBytes BYTE 12h,34h,56h,78h .code mov ax,WORD PTR [myBytes] mov ax,WORD PTR [myBytes+2] mov eax,DWORD PTR myBytes Lecture 11: Review TYPE Operator The TYPE operator returns the size, in bytes, of a single element of a data declaration. LENGTHOF Operator The LENGTHOF operator counts the number of elements in a single data declaration. Data-Related Operators and Directives .data var1 BYTE ? var4 QWORD ? .code mov eax,TYPE var1 ; 1 mov eax,TYPE var4 ; 8 .data array1 WORD 30 . | CSC 221 Computer Organization and Assembly Language Lecture 12: Addressing Modes in Assembly Lecture 11: Review OFFSET Operator OFFSET returns the distance in bytes, of a label from the beginning of its enclosing segment PTR Operator Overrides the default type of a label (variable). Provides the flexibility to access part of a variable. mov esi,OFFSET bVal ;ESI = 00404000 -------------------------------- .data array BYTE 100 DUP(?) .code mov esi,OFFSET array ; ESI is p Data-Related Operators and Directives .data myBytes BYTE 12h,34h,56h,78h .code mov ax,WORD PTR [myBytes] mov ax,WORD PTR [myBytes+2] mov eax,DWORD PTR myBytes Lecture 11: Review TYPE Operator The TYPE operator returns the size, in bytes, of a single element of a data declaration. LENGTHOF Operator The LENGTHOF operator counts the number of elements in a single data declaration. Data-Related Operators and Directives .data var1 BYTE ? var4 QWORD ? .code mov eax,TYPE var1 ; 1 mov eax,TYPE var4 ; 8 .data array1 WORD 30 DUP(?),0,0 .code mov ecx,LENGTHOF array1 ;32 (cont.) Lecture 11: Review SIZEOF Operator The SIZEOF operator returns a value that is equivalent to multiplying LENGTHOF by TYPE. LABEL Directive Assigns an alternate label name and type to an existing storage location LABEL does not allocate any storage of its own Removes the need for the PTR operator Data-Related Operators and Directives .data array1 WORD 30 DUP(?),0,0 .code mov ecx,SIZEOF array1 ;64 .data dwList LABEL DWORD wordList LABEL WORD intList BYTE 00h,10h,00h,20h .code mov eax,dwList ; 20001000h mov cx,wordList ; 1000h mov dl,intList ; 00h (cont.) Lecture 11: Review Indirect Operands Indirect Addressing in Assembly .data val1 BYTE 10h,20h,30h .code mov esi,OFFSET val1 mov al,[esi] ; deref. ESI inc esi mov al,[esi] ; AL = 20h inc esi mov al,[esi] ; AL = 30h .data myCount WORD 0 .code mov esi,OFFSET myCount inc [esi] ; error: ambiguous inc WORD PTR [esi] ; ok (cont.) Lecture 11: Review Index Operands An indexed operand adds a .