Professional Documents
Culture Documents
Types of Instructions
Data transfer Instructions Arithmetic Instructions Logic Instructions Shift Instructions Rotate Instructions
01102
BX CX
DX XX XX
01102
BX CX
DX 01 00
PA = 02000 + 1212 = 03212 [AL] Memory location of 03212 [AH] Memory location of 03213
MEM = 0020
MOV CX,[MEM] MOV AX,0110H MOV DI,AX MOV BL,AL MOV [0100] , AX MOV [BX+DI] , AX MOV [DI] + 4 , AX MOV [BX][DI] + 4 , AX
(a) Value of immediate operand 0110H is moved into AX. (b) Contents of AX are copied into DI. (c) Contents of AL are copied into BL. (d) Contents of AX are copied into memory address DS:0100H (e) Contents of AX are copied into the data segment memory location pointed to by (DS)0 + (BX) + (DI) (f) Contents of AX are copied into the data segment memory location pointed to by (DS)0 + (DI) + 4H (g) Contents of AX are copied into the data segment memory location pointed to by (DS)0 + (BX) + (DI) + 4H
12000
12001 . . 13234 13235
XX
XX XX XX FF 00
BX CX
DX
AA
00
12000
12001 . . 13234 13235
XX
XX XX XX AA 11
BX CX
DX
FF
00
XCHG AX,DX Write an instruction sequence that will initialize the ES register with the immediate value 1010
MOV AX,1010H MOV ES,AX
Write an instruction sequence that saves the content of the ES register in memory at address DS:1000
MOV [1000H],ES
IP CS
DS SS ES AX BX CX DX SI DI
01 11
12
00 00
00
DS (0) + [ADDR] SI
00 01 XX FF 00 XX
20 00 00 13
IP CS
DS SS ES AX BX CX DX SI DI
01 11
12
00 00
00
DS (0) + [ADDR] SI
00 01 00 FF 00 20
20 00 00 13
Arithmetic Instructions
Operations
Addition Subtraction Multiplication Division
Data Formats
Unsigned and signed bytes or words Unpacked or packed decimal bytes ASCII Numbers
Example 1
AL 32 (ASCII for number 2) BL34 (ASCII for number 4)
ADD AL , BL (AL) (AL) + (BL) Answer 66 AAA adjust to give equivalent decimal number 6 Example 2 ADD AL,BL DAA
MUL CL FD02
IMUL CL 0002
What is the result of executing the following sequence of instructions MOV AL,0A1 AL = A1 1010 0001 CBW AX 1111 1111 1010 0001 CWD AX 1111 1111 1010 0001 DX 1111 1111 1111 1111
Assuming that AX=0010 BX=0100 DS=1000 what happens if the XLAT instruction is executed?
AL is loaded from the physical address
10000 + 0100+ 0010= 10110 Write a single instruction that loads AX from address 0200 and DS from address 0202 LDS AX,[0200H]
Clearing , setting and toggling bits of an operand Clear a particular bit AND with logic 0 Set a particular bit - OR with logic 1 Toggle(reverse) particular bit XOR operation
Logical Vs Arithmetic