In this lecture, students will be able to understand: Introducing macros, defining macros, invoking macros, Windows 32 console programming, Background Information, Win32 console programs, API and SDK, windows data types, standard console handles, console input, console output. | CSC 221 Computer Organization and Assembly Language Lecture 28: Macros & Win32 Console Programming Lecture 27: Review Two Dimensional Arrays Basic Concept 2-D Array Representation Row-major: (Most Common) : Order Lecture 27: Review Base-Index Operands A base-index operand adds the values of two registers (called base and index), producing an effective address. [base + index] (cont.) .data array WORD 1000h,2000h,3000h .code mov ebx,OFFSET array mov esi,2 mov ax,[ebx+esi] ; AX = 2000h mov edi,OFFSET array mov ecx,4 mov ax,[edi+ecx] ; AX = 3000h mov ebp,OFFSET array mov esi,0 mov ax,[ebp+esi] ; AX = 1000h Lecture 27: Review Base-Index Displacement A base-index-displacement operand adds base and index registers to a constant, producing an effective address. Displacement can be the name of a variable or a constant expression. (cont.) [ base + index + displacement ] displacement [ base + index ] RowNumber = 1 ColumnNumber = 2 mov ebx,NumCols * RowNumber mov esi,ColumnNumber mov . | CSC 221 Computer Organization and Assembly Language Lecture 28: Macros & Win32 Console Programming Lecture 27: Review Two Dimensional Arrays Basic Concept 2-D Array Representation Row-major: (Most Common) : Order Lecture 27: Review Base-Index Operands A base-index operand adds the values of two registers (called base and index), producing an effective address. [base + index] (cont.) .data array WORD 1000h,2000h,3000h .code mov ebx,OFFSET array mov esi,2 mov ax,[ebx+esi] ; AX = 2000h mov edi,OFFSET array mov ecx,4 mov ax,[edi+ecx] ; AX = 3000h mov ebp,OFFSET array mov esi,0 mov ax,[ebp+esi] ; AX = 1000h Lecture 27: Review Base-Index Displacement A base-index-displacement operand adds base and index registers to a constant, producing an effective address. Displacement can be the name of a variable or a constant expression. (cont.) [ base + index + displacement ] displacement [ base + index ] RowNumber = 1 ColumnNumber = 2 mov ebx,NumCols * RowNumber mov esi,ColumnNumber mov al,table[ebx + esi] Lecture 27: Review Structures (cont.) name STRUCT field-declarations name ENDS Employee STRUCT ; bytes IdNum BYTE "000000000" ; 9 LastName BYTE 30 DUP(0) ; 30 Years WORD 0 ; 2 SalaryHistory DWORD 0,0,0,0 ; 16 Employee ENDS .data worker Employee mov eax,TYPE Employee ; 57 mov eax,SIZEOF Employee ; 57 mov eax,SIZEOF worker ; 57 mov eax,TYPE ; 4 mov eax,LENGTHOF ; 4 mov eax,SIZEOF ; 16 Lecture Outline Macros Introducing Macros Defining Macros Invoking Macros Windows 32 Console Programming Background Information Win32 Console Programs API and SDK Windows Data Types Standard Console Handles Console Input Console Output Introducing Macros A macro1 is a named block of assembly language statements. Once defined, it can be invoked (called) one or more times. During the assembler's preprocessing step, each macro call is expanded into a copy of the macro. The expanded code is passed to the assembly step, .