Expt 1 Arithmetic Instructions
Expt 1 Arithmetic Instructions
Registers to be used
Operation
8-bit 16-bit
Addition CL, DL AX, BX
Subtraction CL, DL BX, CX
Multiplication AL, BL AX, BX
Division AL, BL AX, BX
Effect on Flags
C Z S O P A r: flag value depends on
r r r r r r result of the instruction
ret
ret
Effect on Flags
C Z S O P A r: flag value depends on
r r r r r r result of the instruction
ret
AF: 1-carry out from bit 3 on addition or borrow into bit 3 on subtraction
0-otherwise
Effect on Flags
C Z S O P A r: flag value depends on ?: flag value is undefined
r ? ? r ? ? result of the instruction. (maybe 1 or 0).
Example Code
org 100h
MOV AX,04H
MOV BX,05H
MUL BX
ret
Example Code
org 100h
Effect on Flags
org 100h
MOV AX,20H
MOV BX,10H
DIV BX
ret
Example Code
org 100h
MOV AX,2312H
MOV BX,1010H
DIV BX
ret
In each case interpret the results of different flags. Crosscheck your results
by converting them into decimal numbers.