BCD SUBTRACTION




ADDRESS
OPCODE
LABEL
MNEMONICS
OPERAND
COMMENT
4100

START
MVI
D, 00
Clear D reg.
4101




4102


LXI
H, 4500
Initialize HL reg. to
4500
4103




4104




4105


MOV
B, M
Transfer first data to accumulator
4106


INX
H
Increment HL reg. to point next mem. Location.
4107


MOV
C, M
Move second no. to B reg.
4108


MVI
A, 99
Move 99 to the Accumulator
4109




410A


SUB
C
Subtract [C] from  acc. Content.
410B


INR
A
Increment  A  register
410C


ADD
B
Add [B] with [A]
410D


DAA

Adjust Accumulator value for Decimal digits
410E


JC
LOOP
Jump on carry to loop
410F




4110




4111


INR
D
Increment D reg.
4112

LOOP
INX
H
Increment HL register pair
4113


MOV
M , A
Move the Acc.content to the memory location
4114


INX
H
Increment HL reg. to point next mem. Location.
4115


MOV
M, D
Transfer D register content to memory.
4116


HLT

Stop the program

Comments

Popular posts from this blog

8086 STRING MANIPULATION –FIND AND REPLACE A WORD

Animated Circles In C++

C program to find out the sum of series 1 + 2 + …. + n.