tailieunhanh - Lecture Computer organization and assembly language - Lecture 27: Dimensional Arrays
In this lecture, students will be able to understand: Binary representation, floating point representation, machine instruction characteristics, instruction cycles, types of operands, pentium and power PC data types, microporessor bus structure, address, data, control buses and registers, memory organization and structure. | CSC 221 Computer Organization and Assembly Language Lecture 27: 2-Dimensional Arrays + Structures Lecture 26: Review Assembly Implementation of: Stack Parameters INVOKE Directive PROC Directive PROTO Directive Passing by Value or by Reference Example: Exchanging Two Integers Lecture 26: Review Assembly Implementation of: Stack Frames Explicit Access to Stack Parameters Passing Arguments by Reference (cont.) Lecture Outline Two Dimensional Arrays Basic Concept 2-D Array Representation Base-Index Operands Row-Sum Example Base-Index Displacement Bubble Sort Algorithm Structures Two-Dimensional Arrays Basic Concept Base-Index Operands Base-Index Displacement Basic Concepts From an assembly language programmer’s perspective, a two-dimensional array is a high-level abstraction of a one-dimensional array. One of two methods of arranging the rows and columns in memory: row-major order and column-major order. Logical Arrangement Row-major: (Most Common) : Order Base-Index Operand A | CSC 221 Computer Organization and Assembly Language Lecture 27: 2-Dimensional Arrays + Structures Lecture 26: Review Assembly Implementation of: Stack Parameters INVOKE Directive PROC Directive PROTO Directive Passing by Value or by Reference Example: Exchanging Two Integers Lecture 26: Review Assembly Implementation of: Stack Frames Explicit Access to Stack Parameters Passing Arguments by Reference (cont.) Lecture Outline Two Dimensional Arrays Basic Concept 2-D Array Representation Base-Index Operands Row-Sum Example Base-Index Displacement Bubble Sort Algorithm Structures Two-Dimensional Arrays Basic Concept Base-Index Operands Base-Index Displacement Basic Concepts From an assembly language programmer’s perspective, a two-dimensional array is a high-level abstraction of a one-dimensional array. One of two methods of arranging the rows and columns in memory: row-major order and column-major order. Logical Arrangement Row-major: (Most Common) : Order Base-Index Operand A base-index operand adds the values of two registers (called base and index), producing an effective address. [base + index] The square brackets are required. In 32-bit mode, any two 32-bit general-purpose registers may be used as base and index registers. In 16-bit mode, the base register must be BX or BP, and the index register must be SI or DI. Base-Index Operand The following are examples of various combinations of base and index operands in 32-bit mode: .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 Structure Application Base-index operands are great for accessing arrays of structures. (A structure groups together data under a single name.) A common application of base-index addressing has to do with addressing arrays of structures. The following defines a structure named COORD containing X and Y screen .
đang nạp các trang xem trước