Addressing Mode System Programing Lab Second Stage Introduction
Addressing Mode System Programing Lab Second Stage
Introduction THE FUNDAMENTAL DATA TYPES OF THE INTEL ARCHITECTURE ARE BYTES, WORDS, AND DOUBLEWORDS, QUADWORDS. BYTE: 8 BITS = 1 BYTE WORD: 2 BYTES = 16 BITS DOUBLE WORD: 4 BYTES = 32 BITS QUAD WORD: 8 BYTES = 64 BITS
Fundamental Data Types in Memory
Specifying an Offset THE OFFSET PART OF A MEMORY ADDRESS CAN BE SPECIFIED EITHER DIRECTLY AS AN STATIC VALUE OR THROUGH AN ADDRESS COMPUTATION MADE UP OF ONE OR MORE OF THE FOLLOWING COMPONENTS: • DISPLACEMENT—AN 8 -, 16 -BIT VALUE. • BASE—THE VALUE IN A GENERAL-PURPOSE REGISTER. • INDEX—THE VALUE IN A GENERAL-PURPOSE REGISTER. DEPEND ON THE EQUATION BELOW:
Examples Instruction Description MOV AL, [0123 H] COPY THE CONTENT OF MEMORY LOCATION 0123 H TO AL MOV AL, [BX] COPY THE CONTENT OF MEMORY LOCATION 1000 H TO AL MOV AL, [SI] COPY THE CONTENT OF MEMORY LOCATION 100 H TO AL MOV AL, [BX+22 H] COPY THE CONTENT OF MEMORY LOCATION 1022 H TO AL MOV AL, [BP+DI] COPY THE CONTENT OF MEMORY LOCATION 2200 H TO AL MOV AL, [BX+DI+30 H] COPY THE CONTENT OF MEMORY LOCATION 1230 H TO AL LET: BX =1000 H, BP=2000 H, SI= 100 H, DI=200 H,
DATA-ADDRESSING MODES SOFTWARE DEVELOPMENT FOR THE MICROPROCESSOR REQUIRES A COMPLETE FAMILIARITY WITH THE ADDRESSING MODES EMPLOYED BY EACH INSTRUCTION. WE USED THE MOV INSTRUCTION TO DESCRIBE THE DATAADDRESSING MODES. NOTE THAT MEMORY-TO-MEMORY ALLOWED BY ANY INSTRUCTION. TRANSFERS ARE NOT
Register addressing transfers a copy of a byte or word from the source to the destination register. MOV REG. , Source Destination INSTRUCTION DISCRIPTION MOV AL, BL Copy The Content Of BL Into AL MOV AX, BX Copy The Content Of BX Into AX MOV CX, SI Copy The Content Of CX Into SI MOV BP, DX Copy The Content Of DX Into BP REG.
Immediate addressing transfers the source ( an immediate byte, word of data ) into the destination register. MOV REG. , Source Destination INSTRUCTION DISCRIPTION MOV AL, 01010011 B Transfers Binary Number 01010011 Into AL MOV AX, 5 F 12 H Transfers Hexadecimal Number 5 F 12 Into AX MOV CX, 1980 Transfers Decimal Number 1980 Into CX MOV BP, 374 O Transfers Octal Number 374 Into BP MOV AL, ‘A’ Transfers ASCII CODE ‘A’ Into AL Immi. Value
Direct Data Addressing transfers a byte or word from or into the content of memory specified by direct address. MOV REG. , [Value] REG. Source Destination INSTRUCTION DISCRIPTION MOV AL, [0123 H] Copy The Content Of Memory Location 0123 H Into AL MOV AX, [0123 H] Copy The Content Of Memory Location 0123 H Into AX MOV [1000 H], DL Copy The Content Of DL into the content of Memory Location 1000 H MOV [1000 H], DX Copy The Content Of DX into the content of Memory Location 1000 H
Register Indirect Addressing Register indirect addressing allows data to be addressed at any memory location through an offset address held in any of the following registers: BP, BX, DI, SI MOV REG. , [REG. ] REG. Source Destination INSTRUCTION DISCRIPTION MOV AL, [BX] Copy The Content Of Memory Location at the address [BX] Into AL MOV AX, [SI] Copy The Content Of Memory Location at the address [SI] Into AX MOV [DI], DL Copy The Content Of DL into the content of Memory Location [DI] MOV [BP], DX Copy The Content Of DX into the content of Memory Location [BP]
Base-Plus-Index Addressing Base-plus-index addressing is similar to indirect addressing because it indirectly addresses memory data. In the 8086, this type of addressing uses one base register (BP or BX) and one index register (DI or SI) to indirectly address memory. INSTRUCTION Addressing Mode Type MOV AL, [BX] Base Addressing Mode MOV AX, [SI] Index Addressing Mode MOV [DI], DL Index Addressing Mode MOV [BP], DX Base Addressing Mode MOV DL, [BX+SI] Base Index Addressing Mode MOV [BP-DI], CL Base index Addressing Mode MOV REG. , [REG. ±REG. ] Source Destination [REG. ±REG. ] REG.
Register relative addressing is similar to base-plus-index addressing with displacement. The data in a segment of memory are addressed by adding the displacement to the contents of a base or an index register (BP, BX, DI, or SI). MOV REG. , [REG. ± Val. ] Source Destination INSTRUCTION Addressing Mode Type MOV AL, [BX+9] Base Relative Addressing Mode MOV AX, [SI-5] Index Relative Addressing Mode MOV CX, [BP+DI+04 H] Base Index Relative Addressing Mode MOV [BP+12], DX Base Relative Addressing Mode MOV DL, [SI+40] Index Relative Addressing Mode MOV [BX-DI+8 H], AL Base Index Relative Addressing Mode [REG. ± Val. ] REG.
EXAMPLES Write the addressing mode for all the following instructions : INSTRUCTION Addressing Mode Type MOV AL, BL Register Addressing Mode MOV AX, 65 D 3 H Immediate Addressing Mode MOV CX, [0564 H] Direct Addressing Mode MOV [BX+SI], DX Base Index Addressing Mode / Register Indirect Addressing MOV DX, [SI+40] Index Relative Addressing Mode/Register Indirect Addressing MOV [DI-SI+8 H], Base Index Relative Addressing Mode/Register Indirect
EXAMPLES Write the addressing mode for all the following instructions : INSTRUCTION Addressing Mode Type MOV AX, 0231 H Immediate Addressing Mode MOV AX, [65 D 3 H] Direct Addressing Mode MOV CX, [BP+DI] Base Index Addressing Mode / Register Indirect Addressing MOV [BX+SI-18], DX Base Index Relative Addressing Mode / Register Indirect Addressing MOV DX, [DI+26] Index Relative Addressing Mode/Register Indirect Addressing MOV DI, AX Register Addressing Mode/Register Indirect Addressing
THE END
- Slides: 15