Addition of two 16-bit numbers
Aim:-
Addition of two 8-bit numbers.
Apparatus:-
Microprocessor kit.
Data:-
7501-98H, LSB's of 1st number
7502-5B, MSB's of 1st number
7503-4CH, LSB's of 2nd number
7504-8EH, MSB's of 2nd number
Memory address |
Machine code |
Labels |
Mnemonics |
Operand |
Comments |
7000 |
2A,01,75 |
|
LHLD |
7-501H |
1st 16-bit no. in H-L pair |
7003 |
EB |
|
XCHG |
|
Get 1st no. D-E pair |
7005 |
2A,03,75 |
|
LHLD |
7503H |
2nd 16-bit no. in H-l pair |
7007 |
0E,00 |
|
MVI |
C,00 |
MSB’s of the sum in register C initial value= ∞ |
7009 |
19 |
|
DAD |
D |
1st no. + 2nd no. |
700A |
D2, OE,70 |
|
INC |
AHEAD |
Is carry? No, go to the label AHEAD |
700D |
OC |
|
INR |
C |
Yes, increment C |
700E |
22,05,75 |
AHEAD |
SHLD |
7505H |
Store LSB’s of a sum in 7505 and 7506H |
7011 |
79 |
|
MOV |
A.C |
MSB’s of a sum in accumulator |
7012 |
32,07,75 |
|
STA |
7507H |
Store MSB’s of a sum in 7507H |
7015 |
CF |
|
HLT |
|
HALT |
Procedure:-
1)How to enter the program
Esc->S->CR->CR->S address (7000)->CR->Esc->S->CR->CR->Data->CR
2)How to execute the program
Esc-> Go-> CR->CR->S. address -> CR
3)How to check results
S-> CR->CR->Address (7505)->CR
Result:-
7505-E4, LSB's of sum
7506+E9, LSB's of sum
7507-00, MSB's of sum
Comments
Post a Comment
Its not necessary everyone should know everything feel free to ask or tell :)