Download presentation
Presentation is loading. Please wait.
Published byAndrew Cooke Modified over 11 years ago
1
Stack Memory 00000H 00001H 01058H TOS SS 0105 0008 SP 1104FH BOS
FFFFEH BOS = FFFF = 1104FH FFFFFH
2
PUSH AX After execution Before execution XXH XXH 1055H 1055H 1056H 34H
TOS After execution TOS 1234H AX
3
POP BX After execution Before execution 1058H XXH 34H 12H 1057H 1056H
TOS 34H 12H 1058H XXH TOS XXH XXXXH BX 1234H BX
4
I/O address space FFFFH A separate 64 Kbyte address space is provided where I/O interfaces are implemented. open Certain I/O instructions can only perform operations to I/O devices located in this I/O address space. 00FFH reserved 00F8H open 0000H
5
Addressing modes of the 8086 / 8088 μP
Register addressing mode MOV AX, BX MOV destination operand, source operand Before the execution After the execution AX XXXXH AX 1234H BX 1234H BX 1234H
6
Coding in machine language
mod memory mode no displacement Byte 1 Byte 2 01 Memory mode, 8 bit displacement 10 Memory mode 16 bit displacement opcode D W mod reg R/M 11 Register mode no displacement Except when R/M =110, 16 bit displacement follows W=0 8 bit data w=1 16 bit data D=0 direction is from the register specified in byte 2 D= 1 direction is to the register specified in byte 2 Operation code
7
Effective address ( offset ) calculation
MOD = 11 Effective address ( offset ) calculation AL AX [BX]+[SI] [BX]+[SI]+D [BX]+[SI]+D16 CL CX [BX]+[DI] [BX]+[DI]+D [BX]+[DI]+D16 DL DX [BP]+[SI] [BP]+[SI]+D [BP]+[SI]+D16 BL BX [BP]+[DI] [BP]+[DI]+D [BP]+[DI]+D16 AH SP [SI] [SI]+D [SI]+D16 CH BP [DI] [DI]+D [DI]+D16 DH SI 110 Direct address [BP]+D [BP]+D16 BH DI [BX] [BX]+D [BX]+D16 R/M W=0 W=1 R/M MOD= MOD= MOD=10
8
General Instruction Format
Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 Byte 6
9
MOV BL,AL 10001000 11 000 011 8 c 3 H Machine code
Register / memory to/ from register 100010dw Mod reg r/m Displ-lo Displ-hi Assembly code 8 c 3 H Machine code
10
Immediate addressing mode
MOV AL, 15H MOV destination operand, immediate source operand Immediate operand must begin with 0-9 MOV AL, 0A5H Before the execution After the execution AX XXXXH AX XXA5H
11
1011 w reg Data if w=1 Immediate to register MOV AL, 15H 10110000
Assembly code Machine code B015H
12
The logical address is [DS] : [ 0004]
Direct addressing mode The memory locations following the instruction op code hold an effective memory address MOV AX, [0004] The logical address is [DS] : [ 0004] Register / memory to / from register 100010dw Mod reg r/m Disp-lo Disp-hi 8 b 6 04 00
13
Direct addressing mode
01000 8B μP μP 0000 IP 0100 0200 XXXX CS DS SS ES AX 01000 8B 01001 06 IP 0004 01001 06 01002 04 01002 04 CS 0100 01003 00 01003 00 DS 0200 XX SS ES 02004 ED AX BEED 02004 ED 02005 BE 02005 BE Before execution After execution MOV AX, [0004] Direct addressing mode
14
Register indirect addressing mode
MOV AX, [SI] The logical address is [DS] : [BX] or [DS] : [SI] or [DS] : [DI] μP 0000 IP 0100 0200 1234 XXXX CS DS SI AX 8B 04 XX ED BE 01000 01001 01002 01003 03234 03235 μ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] 10001011 00 000 100 8 B 4 H Machine code
Register / memory to/ from register 100010dw Mod reg r/m Displ-lo Displ-hi Assembly code 8 B 4 H Machine 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]+1234 b f
17
Indexed Relative addressing mode
Logical address = [ DS] : [SI] + direct or indirect displacement or [DS] : [DI] + direct or indirect displacement MOV AL,[SI]+1234H Register / memory to / from register 100010dw Mod reg r/m Disp-lo Disp-hi 8 A 8 4 34 12
18
Based Relative addressing mode
Logical address = [ DS] : [BX] + direct or indirect displacement or [SS] : [BP] + direct or indirect displacement MOV [BX]+1234H,AL Register / memory to / from register 100010dw Mod reg r/m Disp-lo Disp-hi 8 8 8 7 34 12 MOV AX, [BP]+1234H 100010dw Mod reg r/m Disp-lo Disp-hi 8B 86 3 4 12
19
Based Relative addressing mode
MOV [BX]+1234H, AL μP 0000 IP 0100 0200 1234 BEED CS DS SI AX 88 87 34 12 XX 01000 01001 01002 01003 04234 04235 0004 8B 04 ED 1000 BX
20
Indexed Relative addressing mode
MOV AL,[SI]+1234H 01000 8A μP 0004 IP 0100 0200 1234 XXBE CS DS SI AX 8A 84 34 12 BE 01000 01001 01002 01003 05234 μP IP 0000 01001 84 01002 34 CS 0100 01003 12 DS 0200 SI 2000 05234 BE AX XXXX
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.