Understanding Data Addressing Modes in System Programming
Introduction to fundamental data types in Intel architecture including bytes, words, double words, and quad words. Explanation of specifying an offset in memory with examples of instruction descriptions. Overview of data addressing modes such as register addressing and immediate addressing in system programming.
Download Presentation
Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
E N D
Presentation Transcript
Addressing Mode System Programing Lab Second Stage
Introduction THE 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 OF THE INTEL
Fundamental Data Types in Memory
Specifying an Offset THE SPECIFIED THROUGH AN ADDRESS COMPUTATION MADE UP OF ONE OR MORE OF THE FOLLOWING COMPONENTS: OFFSET PART OF DIRECTLY A MEMORY AS ADDRESS STATIC CAN BE OR EITHER AN VALUE 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 MOV AL, [0123H] MOV AL, [BX] MOV AL, [SI] MOV AL, [BX+22H] MOV AL, [BP+DI] MOV AL, [BX+DI+30H] Description COPY THE CONTENT OF MEMORY LOCATION 0123H TO AL COPY THE CONTENT OF MEMORY LOCATION 1000H TO AL COPY THE CONTENT OF MEMORY LOCATION 100H TO AL COPY THE CONTENT OF MEMORY LOCATION 1022H TO AL COPY THE CONTENT OF MEMORY LOCATION 2200H TO AL COPY THE CONTENT OF MEMORY LOCATION 1230H TO AL LET: BX =1000H, BP=2000H, SI= 100H, DI=200H,
DATA-ADDRESSING MODES SOFTWARE REQUIRES ADDRESSING MODES EMPLOYED BY EACH INSTRUCTION. DEVELOPMENT A COMPLETE FOR FAMILIARITY THE MICROPROCESSOR WITH THE WE USED THE MOV INSTRUCTION TO DESCRIBE THE DATA- ADDRESSING MODES. NOTE THAT MEMORY-TO-MEMORY TRANSFERS ARE NOT ALLOWED BY ANY INSTRUCTION.
Register addressing Register addressing Register addressing transfers a copy of a byte or word from the source to the destination register. MOV REG. , 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
Immediate addressing Immediate addressing Immediate addressing transfers the source ( an immediate byte, word of data ) into the destination register. MOV REG. , Immi. Value Source Destination INSTRUCTION DISCRIPTION MOV AL, 01010011B Transfers Binary Number 01010011 Into AL MOV AX, 5F12H Transfers Hexadecimal Number 5F12 Into AX MOV CX, 1980 Transfers Decimal Number 1980 Into CX MOV BP, 374O Transfers Octal Number 374 Into BP MOV AL, A Transfers ASCII CODE A Into AL
Direct Data Addressing Direct Data Addressing Direct Data Addressing transfers a byte or word from or into the content of memory specified by direct address. MOV MOV REG. , [Value] [Value] REG. Source Destination INSTRUCTION DISCRIPTION MOV AL, [0123H] Copy The Content Of Memory Location 0123H Into AL MOV AX, [0123H] Copy The Content Of Memory Location 0123H Into AX MOV [1000H], DL Copy The Content Of DL into the content of Memory Location 1000H MOV [1000H], DX Copy The Content Of DX into the content of Memory Location 1000H
Register Indirect Addressing 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 MOV REG. , [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 Base- -Plus Plus- -Index Addressing 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. MOV MOV REG. , [REG. REG.] [REG. REG.] REG. Source Destination 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
Register relative addressing Register relative addressing 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 MOV REG. , [REG. Val.] [REG. Val.] REG. 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+04H] Base Index Relative Addressing Mode MOV [BP+12], DX Base Relative Addressing Mode MOV DL, [SI+40] Index Relative Addressing Mode MOV [BX-DI+8H], AL Base Index Relative Addressing Mode
EXAMPLES EXAMPLES Write the addressing mode for all the following instructions : INSTRUCTION Addressing Mode Type MOV AL, BL Register Addressing Mode MOV AX, 65D3H Immediate Addressing Mode MOV CX, [0564H] 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+8H], AX Base Index Relative Addressing Mode/Register Indirect Addressing
EXAMPLES EXAMPLES Write the addressing mode for all the following instructions : INSTRUCTION Addressing Mode Type MOV AX, 0231H Immediate Addressing Mode MOV AX, [65D3H] 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 Index Relative Addressing Mode/Register Indirect Addressing MOV DX, [DI+26] MOV DI, AX Register Addressing Mode/Register Indirect Addressing