270 likes | 807 Vues
Memory Addressing. Computer Studies (Advanced Level). Content. Introduction to addressing mode 8088 addressing mode. Addressing mode categorization. Register mode: The data stored in registers are used by the instruction
E N D
Memory Addressing Computer Studies (Advanced Level)
Content • Introduction to addressing mode • 8088 addressing mode
Addressing mode categorization • Register mode: The data stored in registers are used by the instruction • Memory mode: These instructions permits the usage of data directly form memory. The effective address can be specified by the operand directly or may be stored in an address register. The effective address means the actual address pointed by the an addressing mode.
8088 addressing mode • 1. Immediate Addressing mode • The required data by the operation is directly included in the instruction. It can be used as the assignment function to initialize the register. • MOV AX, 1MOV BX, 2
8088 addressing mode • 2. Direct Addressing Mode • The data is stored in the memory. But the effective address for data’s memory location is contained the instruction. The object of the addressing mode is generally label much like a variable such as AA or TABLE, etc. • MOV SUM, 1 • MOV AH, TABLE
8088 Addressing mode • 3. Register Addressing Mode • The operand is fetched from or loaded into a register. Usually the result is stored in AX, because in this way, the execution time is shorter cooperatively. • ADD AX, BX • SUB AX, AX
8088 Addressing mode • 4. Register Indirect Addressing Mode • The effective address of operand is contained in BX, BP, SI or DI. These registers must be placed in square brackets to avoids confusion with normal register addressing mode. • MOV [SI], 0 • MOV AX, [BX]
8088 Addressing Mode • 5. Base Relative Addressing Mode • The effective address for the operand is obtained by adding a displacement to either the BX or BP register. These registers are assumed to contain an offset address. • MOV AX, [BX] +4
Remark • In Some assembler, the following three formats are equivalent: • MOV AX, [BX]+4 • MOV AX, 4[BX] • MOV AX, [BX+4] • You may put the displacement first, or within the brackets
8088 Addressing modes • 6. Direct Indexed Addressing Mode • The effective address of the required is the sum of an index register (SI or DI) and an offset. A typical sequence of instructions would be to load the index register with an address and then combine this with a memory location. • MOV DI, 4 • MOV AX, TABLE[DI]
8088 Addressing Mode • 7. Base Indexed Addressing Mode • The effective address is the sum of a base register (BX), and index register (SI or DI) and an offset (optional) • MOV BX, 100MOV DI, 10MOV AX, TABLE[BX][DI]
Remark • The following descriptions are all correct: • MOV AX, [BX+TABLE+DI]MOV AX, [DI+BX+TABLE]MOV AX, [BX+TABLE][DI]MOV AX, [BX][DI+TABLE]
8088 Implicit (暗示的) Operand • RET • When a subroutine is called, the instruction pointer is saved on the stack and the new address of the branch is get into PC. When the program returns, the instruction returns control to the address pushed by a previous call pointed by the SP. • PUSH AX • The instruction decrements SP by 2, and then transfers a word (16-bit) form the source to the stack. At the position address by SP.
Effective Address • Effective address = Segment address + offset address Offset Address (Where does it come from?) Please refer to 9-1-2 ppt
Question • How to obtain effective address? • Segment + offset • Binary vs hexadecimal • How many bits do the result has?