Presentation is loading. Please wait.

Presentation is loading. Please wait.

Stack Memory 00000 H 00001 H FFFFF H FFFFE H SS 0105 SP 0008 TOS BOS BOS = 01050+FFFF = 1104F H 01058 H 1104F H.

Similar presentations


Presentation on theme: "Stack Memory 00000 H 00001 H FFFFF H FFFFE H SS 0105 SP 0008 TOS BOS BOS = 01050+FFFF = 1104F H 01058 H 1104F H."— Presentation transcript:

1 Stack Memory H H FFFFF H FFFFE H SS 0105 SP 0008 TOS BOS BOS = FFFF = 1104F H H 1104F H

2 PUSH AX TOS 1234 H AX 1058 H XX H 1057 H 1056 H 1055 H Before execution 1058 H XX H 34 H 12 H XX H 1057 H 1056 H 1055 H TOS After execution

3 POP BX 1234 H BX Before execution 1058 H XX H 34 H 12 H XX H 1057 H 1056 H 1055 H TOS After execution 1058 H XX H 34 H 12 H XX H 1057 H 1056 H 1055 H XXXX H BX TOS

4 I/O address space open reserved 00F8 H 00FF H 0000 H FFFF H A separate 64 Kbyte address space is provided where I/O interfaces are implemented. Certain I/O instructions can only perform operations to I/O devices located in this I/O address space.

5 Addressing modes of the 8086 / 8088 μP Register addressing mode MOV AX, BX MOV destination operand, source operand XXXX H AX 1234 H BX Before the execution 1234 H AX 1234 H BX After the execution

6 Coding in machine language opcode D W Operation code D= 1 direction is to the register specified in byte 2 D=0 direction is from the register specified in byte 2 Byte 1Byte 2 mod reg R/M W=0 8 bit data w=1 16 bit data 00 memory mode no displacement 01 Memory mode, 8 bit displacement 10 Memory mode 16 bit displacement 11 Register mode no displacement mod Except when R/M =110, 16 bit displacement follows

7 MOD = 11Effective address ( offset ) calculation 000 AL AX 000 [BX]+[SI] [BX]+[SI]+D8 [BX]+[SI]+D CL CX001 [BX]+[DI] [BX]+[DI]+D8 [BX]+[DI]+D DL DX010 [BP]+[SI] [BP]+[SI]+D8 [BP]+[SI]+D BL BX011 [BP]+[DI] [BP]+[DI]+D8 [BP]+[DI]+D AH SP100 [SI] [SI]+D8 [SI]+D CH BP101 [DI] [DI]+D8 [DI]+D DH SI110 Direct address [BP]+D8 [BP]+D BH DI111 [BX] [BX]+D8 [BX]+D16 R/M W=0 W=1 R/M MOD=00 MOD=01 MOD=10

8 General Instruction Format Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6

9 MOV BL,AL Register / memory to/ from register dw Mod reg r/m Displ-lo Displ-hi Machine code c3 H Assembly code

10 Immediate addressing mode MOV AL, 15H MOV destination operand, immediate source operand XXXX H AX Before the execution XXA5 H AX After the execution Immediate operand must begin with 0-9 MOV AL, 0A5H

11 Immediate to register 1011 w reg data Data if w=1 MOV AL, 15H Assembly codeMachine code B015 H

12 Direct addressing mode The memory locations following the instruction op code hold an effective memory address MOV AX, [0004] Register / memory to / from register dwMod reg r/mDisp-loDisp-hi b The logical address is [DS] : [ 0004]

13 μPμP 0000 IP XXXX CS DS SS ES AX μPμP 0004 IP BEED CS DS SS ES AX 8B ED BE 8B ED BE XX MOV AX, [0004] Before executionAfter execution Direct addressing mode

14 Register indirect addressing mode MOV AX, [SI] The logical address is [DS] : [BX] or [DS] : [SI] or [DS] : [DI] μPμP 0000 IP XXXX CS DS SI AX 8B 04 XX ED BE μPμP 0002 IP BEED CS DS SI AX 8B 04 XX ED BE

15 MOV AX, [SI] Register / memory to/ from register dw Mod reg r/m Displ-lo Displ-hi Machine code B04 H Assembly code

16 Register Indirect Relative The logical address is [DS] : [BX] + 8 bit or 16 bit displacement or [DS] : [SI] + 8 bit or 16 bit displacement or [DS] : [DI] + 8 bit or 16 bit displacement MOV AL,[SI]+1234H A H MOV CX, [BX] b 8 f

17 Indexed Relative addressing mode Logical address = [ DS] : [SI] + direct or indirect displacement [DS] : [DI] + direct or indirect displacement or MOV AL,[SI]+1234H Register / memory to / from register dwMod reg r/mDisp-loDisp-hi A843412

18 Based Relative addressing mode Logical address = [ DS] : [BX] + direct or indirect displacement [SS] : [BP] + direct or indirect displacement or MOV [BX]+1234H,AL Register / memory to / from register dwMod reg r/mDisp-loDisp-hi MOV AX, [BP]+1234 H dwMod reg r/mDisp-loDisp-hi B

19 Based Relative addressing mode MOV [BX]+1234 H, AL μPμP 0000 IP BEED CS DS SI AX XX μPμP 0004 IP BEED CS DS SI AX 8B 04 XX ED XX BX

20 Indexed Relative addressing mode MOV AL,[SI]+1234H μPμP 0000 IP XXXX CS DS SI AX 8A BE μPμP 0004 IP XXBE CS DS SI AX 8A BE


Download ppt "Stack Memory 00000 H 00001 H FFFFF H FFFFE H SS 0105 SP 0008 TOS BOS BOS = 01050+FFFF = 1104F H 01058 H 1104F H."

Similar presentations


Ads by Google