World's most popular travel blog for travel bloggers.

Write a program in assembly language to multiply two 16-bit numbers and to store the result in the specified location.

, , No Comments

LDA 8051H
LXI H,8061H
MOV B,M
MVI E,00H
ADD B
JNC L1
INR E
L1:STA 8071H
LDA 8050H
LXI H,8060H
MOV B,M
MUL E
MUL B
MVI E,00H
JNC L2
INR E
L2:STA 8070H
MOV A,E
STA 8072H
HLT
****************************************************************
LHLD 4000H
: Get first I6-bit number
XCHG
: Save first I6-bit number in DE
LHLD 4002H
: Get second I6-bit number in HL
DAD D
: Add DE and HL
SHLD 4004H
: Store I6-bit result in memory locations 4004H and 4005H.
HLT
: Terminate program execution
Sample problem:
(4000H) = 15H
(4001H) = 1CH
(4002H) = B7H
(4003H) = 5AH


0 comments:

Post a Comment

Let us know your responses and feedback