Stack Memory H H FFFFF H FFFFE H SS 0105 SP 0008 TOS BOS BOS = FFFF = 1104F H H 1104F H
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
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
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.
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
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
MOD = 11Effective address ( offset ) calculation 000 AL AX000 [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
General Instruction Format Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6
MOV BL,AL Register / memory to/ from register dw Mod reg r/m Displ-lo Displ-hi Machine code c3 H Assembly code
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
Immediate to register 1011 w reg data Data if w=1 MOV AL, 15H Assembly codeMachine code B015 H
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]
μ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
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
MOV AX, [SI] Register / memory to/ from register dw Mod reg r/m Displ-lo Displ-hi Machine code B04 H Assembly code
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 dwMod reg r/mDisp-loDisp-hi A843412
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 dwMod reg r/mDisp-loDisp-hi
Based 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
Indexed 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