Set & ALP
MOV Revisted
EX 1. Swap the word at memory location
24000H with 25000H
24000H
24001H
25000H
25001H
MOV AX, 2000H
•
Initialise Segment
Register
•
Initialise Offset Registers
•
Transfer data from reg to mem temporarily
•
Store back the data in mem MOV DS, AX
MOV SI, 4000H
MOV DI, 5000H
MOV BX, [SI]
MOV DX, [DI]
MOV [SI], DX
MOV [DI], BX
Ex 2
MOV BX, 2000H
MOV DI, 10H
MOV AL, [BX+DI]
MOV DI, 20H
MOV [BX+DI], AL
DS: 2020 DS: 2010
Different mov options
R
M
M
R
R
R
M
I
R
I
MOV
DST,SRC
•
Copies the contents of source to destination
•
No Flags Affected
•
Size of source and destination must be the same
•
Source can be register, memory, or immediate data
•
Destination can be register or memory location
Types of Instruction
●
●
●
●
Data Transfer Instructions
Arithmetic Instructions
Logical Instructions
Branch and Program control Instructions
8086-80486 – Inst
Set & ALP
A Simple Program
INC Destination
•
Destination – Register or memory location ( specified in 24 diff ways)
•
( AF, OF, PF, SF, ZF affected, CF not affected)
•
INC BL
•
INC BX
•
DEC Destination
Inc / Dec the contents of a
Memory location
•
Specify the data size in memory
•
use directive
•
BYTE PTR, WORD PTR, DWORD PTR
•
INC WORD PTR [BX]
•
INC BYTE PTR[BX]
•
BX-1000H DS- 2000H
21000
21000
FF
00
21001
21001
00
00
01
Flags
INC WORD PTR [BX]
INC BYTE PTR[BX]
•
OF – 0
•
OF – 0
•
SF – 0
•
SF – 0
•
ZF - 0
•
ZF -1
•
PF – 1(follows only low byte)
•
PF -1
•
AF - 1
•
AF -1
Branch Instructions
JE/JZ
Displacement (-128 to +127)
JNE/ JNZ
Displacement (-128 to +127)
Copy a block of data from one memory area to another memory area- from