Professional Documents
Culture Documents
Prelim Lecture 5
INTEL P INSTRUCTION
ENCODING AND
DECODING
Introduction
Intel P Instruction Encoding and Decoding
Machine Language
It is the native binary code that the microprocessor understand.
Assembler
It is use to translate assembly instruction to a machine code.
Decoding
It is a processes representing entire assembly instruction as a binary value or hexadecimal
Encoding
It is the process of converting hexadecimal format to assembly language (machine
perspective)
Instruction Encoding
Intel P Instruction Encoding and Decoding
Instruction Encoding
Intel P Instruction Encoding and Decoding
encoded .
Instruction Encoding
Intel P Instruction Encoding and Decoding
Override Prefixes
It is the first 2 bytes of a 32-bit instruction format
These bytes are not always used
Divided in Two Parts:
Address Size modifies the size of the address
Instruction Encoding
Intel P Instruction Encoding and Decoding
register.
If the 80386/80486 is operating as 16-bit instruction
Instruction Encoding
Intel P Instruction Encoding and Decoding
register
W = 1, 16- or 32-bit data width (word or dword)
W = 0, 8-bit data width (byte)
instruction.
This selects the type of addressing and whether a
displacement is present or with the selected instruction.
MOD = 11, selects data addressing modes
MOD = 00, 01, or 10, selects memory addressing modes
REG field
Field for register assignment
assignment.
Instruction Encoding
Intel P Instruction Encoding and Decoding
Instruction Encoding
Intel P Instruction Encoding and Decoding
Figure 5 16- and 32-bit R/M field, segment register field, and
scaled factor.
Instruction Encoding
Intel P Instruction Encoding and Decoding
Register Addressing
It uses the R/M field to specify a register instead of memory location
Examples (Decoding)
Intel P Instruction Encoding and Decoding
MOV DX, AX
MOV DX, [BX + DI + 1234h]
ADD AX, 1023
SUB DX, 1234h
AND [BX + 12h], AX
MOV EAX, [EBX + 4*ECX]
MOV [5267h], DH
MOV CS, AX
MOV DS, AX
MOV AX, [BX]
Examples (Encoding)
Intel P Instruction Encoding and Decoding
8B923412h
81C17856h
2326h
8B163412h
20D8h