Code Machine Instructions I8086 Juillet2015
Code Machine Instructions I8086 Juillet2015
(Extrait de : Microprocesseur Systems : the 8086/8088 family - Architecture, programming and design. - 2e edition.
YU-CHENG LIU et GLENN A. GIBSON. – Prentice Hall International, 1986)
AL = 8-bit accumulator If s:w = 00 then the 8 bits of immediate data form the operand
AX = 16-bit accumulator If s:w = 01 then the 16 bits of immediate data form the operand
CX = count register If s:w = 11 then an immediate data byte is sign-extended to form the 16 bits operand
DS = Data segment If v = 0 then “count” = 1; if v = 1 then “count” is (CL)
ES = Extra data segment X = don’t care
Z is used for string primitives for comparison with ZF FLAG
If mod = 11 then r/m is treated as a REG field REG and SR are assigned according to the following table
If mod = 00 then DISP = 0*; disp-low and disp-high are absent
16-bit (w = 1) 8-bit (w = 0) Segment register (SR)
If mod = 01 then DISP = disp-low sign –extended to 16-bits; disp-high is absent
If mod = 10 then DISP = disp-high:disp-low 000 AX 000 AL 00 ES
If r/m = 000 then EA = (BX) + (SI) + DISP 001 CX 001 CL 01 CS
If r/m = 001 then EA = (BX) + (DI) + DISP 010 DX 010 DL 10 SS
If r/m = 010 then EA = (BP) + (SI) + DISP 011 BX 011 BL 11 DS
If r/m = 011 then EA = (BP) + (DI) + DISP 100 SP 100 AH
If r/m = 100 then EA = (SI) + DISP 101 BP 101 CH
If r/m = 101 then EA = (DI) + DISP 110 SI 110 DH
If r/m = 110 then EA = (BP) + DISP 111 DI 111 BH
If r/m = 111 then EA = (BX) + DISP
DISP follows 2nd byte instruction (before data if required) Instructions which reference the flag register file as a 16-bit object use the
symbol FLAGS to represent the file
* Except if mod = 00 and r/m = 110 then EA = disp-high:disp-low FLAGS = X:X:X:X: (OF):(DF):(IF):(TF): (SF):(ZF):X:(AF):X:(PF):X:(CF)
1/8
DATA TRANSFER
MOV = Move 7 6 5 4 3 2 1 0 76543210 76543210 76543210 76543210 76543210
Register/memory to/from register 1 0 0 0 1 0 d w mod REG r/m (DISP-LOW) (DISP-HIGH)
Immediate to register/memory 1 1 0 0 0 1 1 w mod 000 r/m (DISP-LOW) (DISP-HIGH) Data Data if w = 1
Immediate to register 1 0 1 1 w REG Data Data if w = 1
Memory to accumulator 1 0 1 0 0 0 0 w ADDR-LOW ADDR-HIGH
Accumulator to memory 1 0 1 0 0 0 1 w ADDR-LOW ADDR-HIGH
Register/memory to segment register 1 0 0 0 1 1 1 0 mod 0 SR r/m (DISP-LOW) (DISP-HIGH)
Segment register to register/memory 1 0 0 0 1 1 0 0 mod 0 SR r/m (DISP-LOW) (DISP-HIGH)
PUSH = push
Register/memory 1 1 1 1 1 1 1 1 mod 110 r/m (DISP-LOW) (DISP-HIGH)
register 0 1 0 1 0 REG
Segment register 0 0 0 SR 1 1 0
POP = pop
Register/memory 1 0 0 0 1 1 1 1 mod 000 r/m (DISP-LOW) (DISP-HIGH)
register 0 1 0 1 1 REG
Segment register 0 0 0 SR 1 1 1
XCHG = Exchange
Register/memory with register 1 0 0 0 0 1 1 w mod REG r/m (DISP-LOW) (DISP-HIGH)
Register with accumulator 1 0 0 1 0 REG
IN = input from
Fixed port 1 1 1 0 0 1 0 w DATA-8
Variable port 1 1 1 0 1 1 0 w
OUT = ouput to
Fixed port 1 1 1 0 0 1 1 w DATA-8
Variable port 1 1 1 0 1 1 1 w
2/8
XLAT = translate byte to AL 1 1 0 1 0 1 1 1
LEA = lead EA to register 1 0 0 0 1 1 0 1 mod REG r/m (DISP-LOW) (DISP-HIGH)
LDS = load pointer to DS 1 1 0 0 0 1 0 1 mod REG r/m (DISP-LOW) (DISP-HIGH)
LES = load pointer to ES 1 1 0 0 0 1 0 0 mod REG r/m (DISP-LOW) (DISP-HIGH)
LAHF = load AH with flags 1 0 0 1 1 1 1 1
SAHF = store AH into flags 1 0 0 1 1 1 1 0
PUSHF = push flags 1 0 0 1 1 1 0 0
POPF = pop flags 1 0 0 1 1 1 0 1
Arithmetic
ADD = add
Register/memory with register to either 0 0 0 0 0 0 d w mod REG r/m (DISP-LOW) (DISP-HIGH)
Immediate to register/memory 1 0 0 0 0 0 s w mod 000 r/m (DISP-LOW) (DISP-HIGH) Data Data if s:w = 01
Immediate to accumulator 0 0 0 0 0 1 0 w Data Data if w = 1
INC = increment
Register/memory 1 1 1 1 1 1 1 w mod 000 r/m (DISP-LOW) (DISP-HIGH)
register 0 1 0 0 0 REG
3/8
SUB = subtract
Register/memory and register to either 0 0 1 0 1 0 d w mod REG r/m (DISP-LOW) (DISP-HIGH)
Immediate from register/memory 1 0 0 0 0 0 s w mod 101 r/m (DISP-LOW) (DISP-HIGH) Data Data if s:w = 01
Immediate from accumulator 0 0 1 0 1 1 0 w Data Data if w = 1
DEC = decrement
Register/memory 1 1 1 1 1 1 1 w mod 001 r/m (DISP-LOW) (DISP-HIGH)
register 0 1 0 0 1 REG
CMP = compare
Register/memory and register 0 0 1 1 1 0 d w mod REG r/m (DISP-LOW) (DISP-HIGH)
Immediate with register/memory 1 0 0 0 0 0 s w mod 111 r/m (DISP-LOW) (DISP-HIGH) Data Data if s:w = 01
Immediate with accumulator 0 0 1 1 1 1 0 w Data Data if w = 1
4/8
Logic
NOT = invert 1 1 1 1 0 1 1 w mod 010 r/m (DISP-LOW) (DISP-HIGH)
SHL/SAL = shift logical/arithmetic left 1 1 0 1 0 0 v w mod 100 r/m (DISP-LOW) (DISP-HIGH)
SHR = shift logical right 1 1 0 1 0 0 v w mod 101 r/m (DISP-LOW) (DISP-HIGH)
SAR = shift arithmetic right 1 1 0 1 0 0 v w mod 111 r/m (DISP-LOW) (DISP-HIGH)
ROL = rotate left 1 1 0 1 0 0 v w mod 000 r/m (DISP-LOW) (DISP-HIGH)
ROR = rotate right 1 1 0 1 0 0 v w mod 001 r/m (DISP-LOW) (DISP-HIGH)
RCR = rotate through carry flag right 1 1 0 1 0 0 v w mod 010 r/m (DISP-LOW) (DISP-HIGH)
RCL = rotate through carry flag left 1 1 0 1 0 0 v w mod 011 r/m (DISP-LOW) (DISP-HIGH)
AND = And
Register/memory and register 0 0 1 0 0 0 d w mod REG r/m (DISP-LOW) (DISP-HIGH)
Immediate to register/memory 1 0 0 0 0 0 s w mod 100 r/m (DISP-LOW) (DISP-HIGH) Data Data if w = 1
Immediate to accumulator 0 0 1 0 0 1 0 w Data Data if w = 1
OR = or
Register/memory and register either 0 0 0 0 1 0 d w mod REG r/m (DISP-LOW) (DISP-HIGH)
Immediate to register/memory 1 0 0 0 0 0 s w mod 001 r/m (DISP-LOW) (DISP-HIGH) Data Data if w = 1
Immediate to accumulator 0 0 0 0 1 1 0 w Data Data if w = 1
XOR = Exclusive or
Register/memory with register to either 0 0 1 1 0 0 d w mod REG r/m (DISP-LOW) (DISP-HIGH)
Immediate to register/memory 1 0 0 0 0 0 s w mod 110 r/m (DISP-LOW) (DISP-HIGH) Data Data if w = 1
Immediate to accumulator 0 0 1 1 0 1 0 w Data Data if w = 1
5/8
String manipulation
REP = repeat 1 1 1 1 0 0 1 z
MOVS = move byte/word 1 0 1 0 0 1 0 w
CMPS = compare byte/word 1 0 1 0 0 1 1 w
SCAS = scan byte/word 1 0 1 0 1 1 1 w
LODS = load byte/word to AL/AX 1 0 1 0 1 1 0 w
STDS = store byte/word from AL/AX 1 0 1 0 1 0 1 w
Control transfer
CALL = call
Direct within segment 1 1 1 0 1 0 0 0 IP-INC-LOW IP-INC-HIGH
Indirect within segment 1 1 1 1 1 1 1 1 mod 010 r/m (DISP-LOW) (DISP-HIGH)
Direct intersegment 1 0 0 1 1 0 1 0 IP-LOW IP-HIGH CS-LOW CS-HIGH
Indirect intersegment 1 1 1 1 1 1 1 1 mod 011 r/m (DISP-LOW) (DISP-HIGH)
6/8
Conditional jump
JE/JZ = jump on equal/zero 0 1 1 1 0 1 0 0 IP-INC8
JL/JNZE = jump on less/not greater or equal 0 1 1 1 1 1 0 0 IP-INC8
JLE/JNG = jump on less or equal/not greater 0 1 1 1 1 1 1 0 IP-INC8
JB/JNAE = jump on below/not above or equal 0 1 1 1 0 0 1 0 IP-INC8
JBE/JNA = jump on below/not above 0 1 1 1 0 1 1 0 IP-INC8
JP/JPE = jump on parity/parity even 0 1 1 1 1 0 1 0 IP-INC8
JO = jump on overflow 0 1 1 1 0 0 0 0 IP-INC8
JS = jump on sign 0 1 1 1 1 0 0 0 IP-INC8
JNE/JNZ = jump on not equal/not zero 0 1 1 1 0 1 0 1 IP-INC8
JNL/JGE = jump on not less/greater or equal 0 1 1 1 1 1 0 1 IP-INC8
JNLE/JG = jump on not less or equal/greater 0 1 1 1 1 1 1 1 IP-INC8
JNB/JAE = jump on not below/above or equal 0 1 1 1 0 0 1 1 IP-INC8
JNBE/JA = jump on not below or equal/above 0 1 1 1 0 1 1 1 IP-INC8
JNP/JPO = jump on not parity/parity odd 0 1 1 1 1 0 1 1 IP-INC8
JNO = jump on not overflow 0 1 1 1 0 0 0 1 IP-INC8
JNS = jump on not sign 0 1 1 1 1 0 0 1 IP-INC8
LOOP = loop CX times 1 1 1 0 0 0 1 0 IP-INC8
LOOPZ/LOOPE = loop while zero/equal 1 1 1 0 0 0 0 1 IP-INC8
LOOPNZ/LOOPNE = loop while not zero/equal 1 1 1 0 0 0 0 0 IP-INC8
JCXZ = jump on CX zero 1 1 1 0 0 0 1 1 IP-INC8
7/8
INT = interrupt
Type specified 1 1 0 0 1 1 0 1 DATA-8
Type 3 1 1 0 0 1 1 0 0
Processor control
8/8