Đang chuẩn bị liên kết để tải về tài liệu:
Lecture Computer organization and assembly language: Chapter 27 - Dr. Safdar Hussain Bouk
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
After studying this chapter you will be able to understand: Define virtual memory; describe the hardware and control structures that support virtual memory; describe the various OS mechanisms used to implement virtual memory; describe the virtual memory management mechanisms in UNIX, Linux, and Windows 7. | 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) Col.-major: 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 . | 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) Col.-major: Order Base-Index Operand A