You are on page 1of 7

7.

(i) Program for addition of two 8-bit numbers using registers

ADDRESS HEXCODE LABEL OPCODE OPERAND


MOV R0,#45H
MOV R1,#30H
MOV A,R0
ADD A,R1
MOV R3,A
JNC (LOOP)
MOV R2,#01H
LOOP: LCALL 0003H

INPUT OUPTUT

R0= R3=
R1= R2= (CARRY)
gisters
7.(ii) Program for subtraction of two 8-bit numbers using registers

ADDRESS HEXCODE LABEL OPCODE OPERAND


MOV R0,#45H
MOV R1,#30H
MOV A,R0
SUBB A,R1
MOV R3,A
JNC (LOOP)
MOV R2,#01H
LOOP: LCALL 0003H

INPUT OUPTUT

R0= R3=
R1= R2= (CARRY)
8 (i). Product of two 8-bit numbers using MUL instruction stored at 50h and 51h locations

ADDRESS HEXCODE LABEL OPCODE OPERAND


MOV 50H,#02H
MOV 51H,#04H
MOV A,50H
MOV 0F0H,A
MOV A,51H
MUL AB
MOV 52H,A
MOV 53H,0F0H
LCALL 0003H

INPUT OUTPUT

50H= 52H=
51H= 53H=
8 (ii) Division of two 8-bit numbers using DIV instruction stored at 50h and 51h locations

ADDRESS HEXCODE LABEL OPCODE OPERAND


MOV 50H,#04H
MOV 51H,#02H
MOV 0F0H,51H
MOV A,50H
DIV AB
MOV 52H,A
MOV 53H,0F0H
LCALL 0003H

INPUT OUTPUT

50H= 52H=
51H= 53H=
9 Conversion of Binary Code to Gray Code

ADDRESS HEXCODE LABEL OPCODE OPERAND


MOV R0,#22H
MOV R1,R0
MOV A,R0
RRC A
ANL A,#7FH
XRL A,R1
MOV R2,A
LCALL 00BBH
10 Centigrade to Fahreinheit Conversion

ADDRESS HEXCODE LABEL OPCODE OPERAND


MOV R0,#05H
MOV R1,#09H
MOV R2,#20H
MOV R3,#05H
MOV A,R0
MOV 0F0H,R1
MUL AB
MOV 0F0H,R3
DIV AB
ADD A,R2
MOV R4,A
LCALL 00BBH

You might also like