0% found this document useful (0 votes)
37 views14 pages

Inst Format 8086

The document discusses the instruction format of the 8086 microprocessor. It has a general 3-byte instruction format with an opcode byte, mod/reg byte, and optional displacement/immediate byte. The opcode byte contains bits for the operation, data size, and whether the register field specifies a source or destination operand. The mod/reg byte further specifies the operands using mode, register, and register/memory fields. Examples of common instructions like MOV are provided to illustrate how they map to the machine code format. Single bit indicators like W, D, and S bits are also summarized.

Uploaded by

chinnuedwina
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views14 pages

Inst Format 8086

The document discusses the instruction format of the 8086 microprocessor. It has a general 3-byte instruction format with an opcode byte, mod/reg byte, and optional displacement/immediate byte. The opcode byte contains bits for the operation, data size, and whether the register field specifies a source or destination operand. The mod/reg byte further specifies the operands using mode, register, and register/memory fields. Examples of common instructions like MOV are provided to illustrate how they map to the machine code format. Single bit indicators like W, D, and S bits are also summarized.

Uploaded by

chinnuedwina
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Instruction Format

8086

By,
Hitha Paulson
Assistant Professor, Dept of Computer Science
LF College, Guruvayoor
ADD AX, BX

(Opcode) (Destination operand) (Source operand )


general instruction form for the
8086
• An instruction can be coded with 1 to 6 bytes

Opcode - 6 D-1 W -1 1st byte


MOD - 2 Reg - 3 R/M - 3 2nd byte
Displacement or data (optional) up to 4 bytes
Converting Assembly Language Instructions to
Machine Code
• Byte 1 contains three kinds of information
– Opcode field (6 bits) specifies the operation (add, subtract, move)

- Register Direction Bit (D bit) Tells the register operand in REG field in
byte 2 is source or destination operand
1: destination 0: source

-Data Size Bit (W bit) Specifies whether the operation will be performed
on 8-bit or 16-bit data

0: 8 bits 1: 16 bits
• Byte 2 has three fields
– Mode field (MOD)
– Register field (REG) used to identify the register for the first operand
– Register/memory field (R/M field)
2-bit MOD field and 3-bit R/M field together specify
the second operand

Mode Field encoding

Register/memory (R/M) Field Encoding


Examples
MOV BL,AL (88C316)
Opcode for MOV = 100010
D = 0 (AL source operand)
W bit = 0 (8-bits)
Therefore byte 1 is 100010002=8816
• MOD = 11 (register mode)
• REG = 000 (code for AL)
• R/M = 011 (destination is BL)
Therefore Byte 2 is 110000112=C316
• MOV CL,[BX]

• MOV CH,[1050]h
General format of 8086 instructions

general formats
• One byte instruction

– May have implied data or register operands

– Eg: CLC, clear carry (11111000)


• Register to Register ( 2 bytes)

• Register to /from memory with no displacement


( 2 bytes)
• Register to /from memory with displacement
( 3 or 4 bytes)

• Immediate Operand to Register


• Immediate Operand
to Memory with 16 bit
displacement
Single bit indicators
• W – bit: word or byte
• D- bit: if double operand is present, indicate which is
source and which is destination. D=1, REG destination
operand.
• S – bit : sign extension bit
• V – bit: for shift rotate instructions, if 1 CL contains
count, else count is one.
• Z – bit: used by REP instruction.

You might also like