Instructions Can Be Divided into 3 Classes • Data movement instructions  Move data from a memory location or register to another.

Download Report

Transcript Instructions Can Be Divided into 3 Classes • Data movement instructions  Move data from a memory location or register to another.

Instructions Can Be Divided into 3 Classes
• Data movement instructions
 Move data from a memory location or register to another memory
location or register without changing its form
 Load—source is memory and destination is register
 Store—source is register and destination is memory
• Arithmetic and logic (ALU) instructions
 Change the form of one or more operands to produce a result
stored in another location
 Add, Sub, And Shift, etc.
• Branch instructions (control flow instructions)
 Alter the normal flow of control from executing the next instruction
in sequence
 Jmp Loc, Jz Loc2,—unconditional or conditional branches
KMUTT: S. Srakaew
Examples of Data Movement Instructions
Instruction
MOV AX,BX
Meaning
Move 16 bits from register BX to register AX
MOV AL,[1234H] Load register AL with the byte content of the data
segment memory address 1234H
MOV BL,48
Copy 48 decimal(8-bit) (30H) into BL
MOV EAX, 100Y
Copy a 100 binary (32-bit) into EAX
MOV AH, ‘A’
Copy an ASCII ‘A’ (8-bit) into AH
MOV AX, ‘AB’
Copy an ASCII ‘BA’(16-bit) into AX
KMUTT: S. Srakaew
Examples of ALU Instructions
Instruction
ADD AL, BL
ADD BX, 2345H
SUB DH, 2FH
SUB ECX, data1
MUL ECX
KMUTT: S. Srakaew
Meaning
AL = AL + BL
BX = BX + 2345H
DH = DH - 2FH
Subtract the doubleword contents of the
data segment memory location addressed
by data1 from ECX
EAX is multiplied by ECX; the unsigned
product is in EDX-EAX
Examples of Branch Instructions
Instruction
Meaning
JMP Addr
Jump to address Addr.
JCXZ Addr
0.
Jump to Addr if contents of register CX =
KMUTT: S. Srakaew
Programming The 80x86
Addressing Modes
KMUTT: S. Srakaew
Programming The 80x86
Register Addressing
KMUTT: S. Srakaew
Programming The 80x86
Register Addressing: Example
KMUTT: S. Srakaew
Programming The 80x86
Immediate Addressing
KMUTT: S. Srakaew
Programming The 80x86
Direct Addressing
KMUTT: S. Srakaew
Programming The 80x86
Direct Addressing
KMUTT: S. Srakaew
Programming The 80x86
Direct Data Addressing
KMUTT: S. Srakaew
Programming The 80x86
Direct Data Addressing: Example
KMUTT: S. Srakaew
Programming The 80x86
Register Indirect Addressing
KMUTT: S. Srakaew
Programming The 80x86
Register Indirect Addressing
KMUTT: S. Srakaew
Programming The 80x86
Register Indirect Addressing: Example
KMUTT: S. Srakaew
Programming The 80x86
Register Indirect Addressing
KMUTT: S. Srakaew
Programming The 80x86
Base-Plus-Index Addressing
KMUTT: S. Srakaew
Programming The 80x86
Base-Plus-Index Addressing
KMUTT: S. Srakaew
Programming The 80x86
Base-Plus-Index Addressing: Array Structure
KMUTT: S. Srakaew
Programming The 80x86
Base-Plus-Index Addressing: Array Structure
KMUTT: S. Srakaew
Programming The 80x86
Register Relative Addressing
KMUTT: S. Srakaew
Programming The 80x86
Register Relative Addressing
KMUTT: S. Srakaew
Programming The 80x86
Array Structure Using Register Relative
KMUTT: S. Srakaew
Programming The 80x86
Array Structure Using Register Relative
KMUTT: S. Srakaew
Programming The 80x86
Base Relative-Plus-Index Addressing
KMUTT: S. Srakaew
Programming The 80x86
Base Relative-Plus-Index Addressing
KMUTT: S. Srakaew
Programming The 80x86
Base Relative-Plus-Index Addressing
KMUTT: S. Srakaew
Programming The 80x86
Base Relative-Plus-Index Addressing
KMUTT: S. Srakaew
Programming The 80x86
Scaled-Index Addressing
KMUTT: S. Srakaew
Programming The 80x86
Scaled-Index Addressing
KMUTT: S. Srakaew
Programming The 80x86
Direct Program Memory Addressing
KMUTT: S. Srakaew
Programming The 80x86
Stack Memory Addressing: PUSH
KMUTT: S. Srakaew
Programming The 80x86
Stack Memory Addressing: POP
KMUTT: S. Srakaew
Programming The 80x86
KMUTT: S. Srakaew