8085 Program - Transferring block of data with "Condition"

Q. There are two tables of data stored at 40A1H and 40B1H having 10 data each. Write a program to store the data in the first table to third table starting from address 40C1H if the corresponding data in the first table is greater than the second and table else store FF in the third table.
Program:

LXI B,40A1H                        ;assume A1 as the starting number
LXI H,40B1H
LXI D,40C1H
START: LDAX B
CMP M
JC NEXT
STAX D
INX B
INX H
INX D
MOV A,C
CPI ABH                    ;comparing for 10 values (A1-AA)
JNZ START
JMP LAST
NEXT: MVI A,FFH
STAX D
INX B
INX H
INX D
MOV A,C
CPI ABH
JNZ START
LAST: HLT

No comments:

Post a Comment