4 4 rite a program to perform the following using a 4pts a C
#4
4. rite a program to perform the following using a. (4pts) a. Clear the content of data memory starting at 0x80 to 0x100. b. d AB to the contents of file register starting at 0x80 to 0x100.Solution
a ) CLR A; the content in ACC is used to clear RAM locations
MOV R1, #80H; R1 is a pointer starting from 80H
MOV R7, #20; 20 iterations
Again: MOV @R1, A; loop
INC R1
DJNZ R7, Again
b)LXI H, 4000H :HL Points 4000H
MOV A, M :Get first operand
INX H :HL Points 4001H
ADD M :Add second operand
INX H :HL Points 80H
MOV M, A :Store the lower byte of result at 80H
MVIA, 00 :Initialize higher byte result with 00H
ADC A :Add carry in the high byte result
INX H :HL Points 80H
MOV M, A :Store the higher byte of result at 80H
HLT :Terminate program execution
