So i need to filter out the positive numbers and display the sum if it is less than FFH, if not display FFH. i typed the code in the simulator and use #DB to store the numbers in a particular memory location. but when i run it step by step the memory content register is displaying 00. how to resolve it?
MVI B,00
MVI C,0A
LXI H,4000
NEXT: MOV A,M
RAL
JC REJECT
RAR
ADD B
JC OVR
MOV B,A
REJECT: INX H
DCR C
JNZ NEXT
STA 8070
OVR: MVI A,FF
HLT
# ORIGIN 4000H
# DB 28H, D8H, C2H, 21H, 24H, 30H, 2FH, 19H, F2H, 9FH
GNUSim8085
What do you mean by 'memory content register'? If you are referring to
Mit is not an actual register, it denotes the contents at the memory location pointed by theHLregister pair. At the end of your codeHLwill have400AHand memory location400AHcan hold any garbage value.Since you are using a simulator where memory cells are usually initialized to 0, your simulator shows contents of
Mis 0 which is perfectly normal. What you should look at is the contents of registerA.