| ECE291 | Computer Engineering II | J. W. Lockwood, |
== OPCODE type
== 8 bit data
== 8 bit displacement
== 16 bit data
== 16 bit displacement
== MODE Byte
![]() |
No operands. example: No Operation NOP | : | w/8-bit data. | : | w/16-bit data. | : |
w/8-bit disp. example: Relative jump JE +45 |
: |
w/16-bit disp. example: Direct Addressding MOV AX,[1234] |
: |
w/mode. example: Register-to-Register operation: MOV AL,AH |
: :
|
w/mode & disp8. example: Base-relative indexed MOV [BX+12],AX |
:
: |
w/mode & disp16. example: Base-relative indexed direct MOV [BX+1234],AX |
) byte (which is a rather arbitrary value),
you should be able to determine the contents of memory just from
the information above.
| Instruction | Comment | Addressing Mode |
Memory Contents |
|---|---|---|---|
| Op Dest, Source | |||
| MOV AX, BX | Move to AX the 16-bit value in BX | Register | 89 D8
: |
| MOV AX, DI | Move to AX the 16-bit value in DI | Register | 89 F8
: |
| MOV AH, AL | Move to AH the 8-bit value in AL | Register | 88 C4
: |
| MOV AH, 12H | Move to AH the byte value 12H | Immediate | B4 12
: |
| MOV AX, 1234H | Move to AX the value 1234H | Immediate | B8 34 12
: |
| MOV AX, CONST | Move to AX the constant defined as CONST | Immediate | B8 LSB MSB
: |
| MOV AX, OFFSET x | Move to AX the address (offset) of variable x MASM Notation |
Immediate | B8 LSB MSB
: |
| MOV AX, [1234H] | Move to AX the value at memory location 1234H (uses default segment, DS) |
Direct | A1 34 12
: |
| MOV AX, x | Move to AX the value of M[x] (uses default segment, DS) MASM Notation |
Direct | A1 LSB MSB
: |
| MOV x, AX | Move to M[x] the value of AX (uses default segment, DS) MASM Notation |
Direct | A3 LSB MSB
: |
| MOV AX, [DI] | Move to AX the value at M[DI] (uses default segment, DS) |
Indexed | 8B 05
: |
| MOV [DI], AX | Move to M[DI] the value AX (uses default segment, DS) |
Indexed | 89 05
: |
| MOV AX, [BX] | Move to AX the value M[BX] (uses default segment, DS) |
Base-relative | 8B 07
: |
| MOV [BX], AX | Move to M[BX] the value AX (uses default segment, DS) |
Base-relative | 89 07
: |
| MOV AX, [BP] | Move to AX the value of M[BP] (uses stack segment, SS) |
Base-relative | 8B 46
: |
| MOV [BP], AX | Move to M[BP] the value of AX (uses stack segment, SS) |
Base-relative | 89 46
: |
| MOV AX, tab[BX] | Move to AX the value M[tab+BX] (uses default segment, DS) |
Base-relative Direct |
8B 87 LSB MSB
: :
|
| MOV tab[BX], AX | Move to M[tab+BX] the value AX (uses default segment, DS) |
Base-relative Direct |
89 87 LSB MSB
: :
|
| MOV AX, [BX+DI] | Move to AX the value M[BX+DI] (uses default segment, DS) |
Base-relative Indexed |
8B 01
: |
| MOV [BX+DI], AX | Move to M[BX+DI] the value AX (uses default segment, DS) |
Base-relative Indexed |
89 01
: |
| MOV AX, [BX+DI+1234H] | Move to AX the value pointed to by BX+DI+1234H (uses default segment, DS) |
Base-relative Indexed Direct |
8B 81 34 12
: :
|
byte| -7- | -6- | -5- | -4- | -3- | -2- | -1- | -0- |
|---|---|---|---|---|---|---|---|
|
R/M (mmm) |
Mode (oo) | ||||
|---|---|---|---|---|---|
| oo=00 |
oo=01 (8-bit) |
oo=10 (16-bit) |
oo=11 | ||
| 000 | DS:[BX+SI] | DS:[BX+SI+d8] | DS:[BX+SI+d16] | Register to Register Transfer Use register decoding table (below) to determine R/M bits | |
| 001 | DS:[BX+DI] | DS:[BX+DI+d8] | DS:[BX+DI+d16] | ||
| 010 | SS:[BP+SI] | SS:[BP+SI+d8] | SS:[BP+SI+d16] | ||
| 011 | SS:[BP+DI] | SS:[BP+DI+d8] | SS:[BP+DI+d16] | ||
| 100 | DS:[SI] | DS:[SI+d8] | DS:[SI+d16] | ||
| 101 | DS:[DI] | DS:[DI+d8] | DS:[DI+d16] | ||
| 110 | DS:[d16] | SS:[BP+d8] | SS:[BP+d16] | ||
| 111 | DS:[BX] | DS:[BX+d8] | DS:[BX+d16] | ||
| Register (rrr) |
8-bit (w=0) |
16-bit (w=1) |
|---|---|---|
| rrr=000 | AL | AX |
| rrr=001 | CL | CX |
| rrr=010 | DL | DX |
| rrr=011 | BL | BX |
| rrr=100 | AH | SP |
| rrr=101 | CH | BP |
| rrr=110 | DH | SI |
| rrr=111 | BH | DI |