3-12 TRANSLATION OF ASSEMBLER INSTRUCTIONS
The translation from assembler instructions to machine instructions is, in most cases, quite straightforward. All of the 8086 machine instructions consist of 1 or 2 bytes of op code and addressing mode designations with from 0 to 4 bytes of immediate, displacement, or segment address information appended to them.
The number of appended bytes depends on the addressing modes. If the addressing modes call for both an immediate operand and a displacement the displacement will appear first, and if both an offset and a segment address are present, the offset will appear first.
Figure 3-71 Machine code for the 8086/8088 instructions. (Reprinted by permission of Intel Corporation. Copyright 1979.)
AL - 8-bit accumulator
AX - 16-bit accumulator
CX - Count register
DS - Data segment
ES - Extra segment
Above/below refers to unsigned value
Greater = more positive;
Less = less positive (more negative) signed values
if d = 1 then "to" reg; if d = 0 then "from" reg
if w = 1 then word instruction; if w = 0 then byte instruction |
|
if s w = 01 then 16 bits of immediate data form the operand
if s w = 11 then an immediate data byte is sign extended to form the 16-bit operand
if v = 0 then "count" = 1 if v = 1 then "count" in (CL)
x = don't care
z is used for string primitives for comparison with ZF FLAG
SEGMENT OVERRIDE PREFIX    |
|
if mod = 11 then r/m is treated as a REG field
if mod = 00 then DISP = 0* disp-low and disp-high are absent
if mod = 01 then DISP = disp-low sign-extended to 16-bits, disp-high is absent
if mod = 10 then DISP = 0 disp-high disp-low
if r/m = 000 then EA = (BX) + (SI) + DISP
if r/m = 001 then EA = (BX) + (DI) + DISP
if r/m = 010 then EA = (BP) + (SI) + DISP
if r/m = 011 then EA = (BP) + (DI) + DISP
if r/m = 100 then EA = (SI) + DISP
if r/m = 101 then EA = (DI) + DISP
if r/m = 110 then EA = (BP) + DISP
if r/m = 111 then EA = (BX) + DISP
DISP follows 2nd byte of instruction (before data if required)
*except if mod = 00 and r/m = 110 then EA = disp-high disp-low
| |
REG is assigned according to the following table
16-Bit (w 1) | | 8-Bit (w 0) | | Segment |
000 AX | | 000 AL | | 00 ES |
001 CX | | 001 CL | | 01 CS |
010 DX | | 010 DL | | 10 SS |
011 BX | | 011 BL | | 11 DS |
100 SP | | 100 AH |
101 BP | | 101 CH |
110 SI | | 110 DH |
111 DI | | 111 BH |
Instructions which reference the flag register-file as a 16-bit object use the symbol FLAGS to represent the file
FLAGS X X X X (OF) (DF) (IF) (TF) (SF) (ZF) X (AF) X (PF) X (CF)
|
8086/8088 Instruction Encoding
DATA TRANSFER |
|
MOV = Move: |
|
|
|
|
|
|
|
Register/memory to/from register |
|
|
|
|
|
Immediate to register/memory |
|
|
|
|
|
|
|
Immediate to register |
|
|
|
|
Memory to accumulator |
|
|
|
|
Accumulator to memory |
|
|
|
|
Register/memory to segment register |
|
|
|
|
|
Segment register to register/memory |
|
|
|
|
|
PUSH = Push: |
|
Register/memory |
|
|
|
|
|
Register |
|
|
Segment register |
|
|
POP = Pop: |
|
Register/memory |
|
|
|
|
|
Register |
|
|
Segment register |
|
Table of Contents | Next page | Previous page
This is page 55.