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 00000 H 00001 H FFFFF H FFFFE H SS 0105 SP 0008 TOS BOS BOS = 01050+FFFF = 1104F H 01058 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 AX000 [BX]+[SI] [BX]+[SI]+D8 [BX]+[SI]+D16 001 CL CX001 [BX]+[DI] [BX]+[DI]+D8 [BX]+[DI]+D16 010 DL DX010 [BP]+[SI] [BP]+[SI]+D8 [BP]+[SI]+D16 011 BL BX011 [BP]+[DI] [BP]+[DI]+D8 [BP]+[DI]+D16 100 AH SP100 [SI] [SI]+D8 [SI]+D16 101 CH BP101 [DI] [DI]+D8 [DI]+D16 110 DH SI110 Direct address [BP]+D8 [BP]+D16 111 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 100010dw Mod reg r/m Displ-lo Displ-hi Machine code 1000100011 000 011 88c3 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, 15H1011000000010101 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 100010dwMod reg r/mDisp-loDisp-hi 10001011000001100000010000000000 8b060400 The logical address is [DS] : [ 0004]

13 μPμP 0000 IP 0100 0200 XXXX CS DS SS ES AX μPμP 0004 IP 0100 0200 BEED CS DS SS ES AX 8B 06 04 00 ED BE 8B 06 04 00 ED BE 01000 01001 01002 01003 02004 02005 01000 01001 01002 01003 02004 02005 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 0100 0200 1234 XXXX CS DS SI AX 8B 04 XX ED BE 01000 01001 01002 01003 03234 03235 μPμP 0002 IP 0100 0200 1234 BEED CS DS SI AX 8B 04 XX ED BE 01000 01001 01002 01003 03234 03235

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

16 Indexed 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 100010dwMod reg r/mDisp-loDisp-hi 10001010100001000011010000010010 8A843412

17 Based 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 100010dwMod reg r/mDisp-loDisp-hi 10001000100001110011010000010010 88873412

18 Based addressing mode MOV [BX]+1234 H, AL μPμP 0000 IP 0100 0200 1234 BEED CS DS SI AX 88 87 34 12 XX 01000 01001 01002 01003 04234 04235 μPμP 0004 IP 0100 0200 1234 BEED CS DS SI AX 8B 04 XX ED XX 01000 01001 01002 01003 04234 04235 1000 BX

19 Indexed addressing mode MOV AL,[SI]+1234H μPμP 0000 IP 0100 0200 2000 XXXX CS DS SI AX 8A 84 34 12 BE 01000 01001 01002 01003 05234 μPμP 0004 IP 0100 0200 1234 XXBE CS DS SI AX 8A 84 34 12 BE 01000 01001 01002 01003 05234


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