Simple Programs with Arithmetic
and Logical Operations
Write a program to add two
numbers 40H and 20H and keep the result
in register B.
MOV B,40H moves the 40H(data) to
register B
MOV A,20H Moves the 20H(data) to
Accumulator
ADD B; Adds the
content of register B with content of Acc. and stores in Acc.
MOV B,A Moves the content of accumulator to
register B;
HLT Terminates
the program
Write a program to subtract two
numbers 40H and 20H and keep the result in register B.
MOV B,40H moves the 40H(data) to register B
MOV A,20H Moves the 20H(data) to Accumulator
SUB B; Adds the content of
register B with content of Acc. and stores in Acc.
MOV B,A Moves the content of
accumulator to register B;
HLT Terminates the program
Write the ALP to load memory
location 7090H and 7080 with data 40H and 50H and also swap the data.
MVI H,70H
MVI L,90H
MVI M,40H
MVI L,90H
MVI M,50H
MOV B,M
MVI L,90H
MOV A,M
STA 7080H
MOV A,B
STA 7090H
HLT
2ND
METHOD
LXI H,7090H
MVI M,40H
LXI H, 7080H
MVI M, 50H
MOV B, M
MVI L, 90H
MOV A, M
STA 7080H
MOV A, B
STA 7090H
HLT
3RD
METHOD
MVI A, 40H
LXI D ,7090H
STAX D
MVI A,50H
STA 7080
HLT
Swap the data between 4040 and
8080
1ST
METHOD
LDA 4040
MOV B,A
LDA 8080
STA 4040
MOV A,B
LDA 4040
HLT
2ND
METHOD
LXI H,4040
MOV B,M
LXI H,8080
MOV D,M
MOV A,B
STA 8080
MOV A,D
STA 4040
HLT
There is definately a great deal to know about this issue.
ReplyDeleteI really like all the points you've made.
My webpage; new year quotes