Re: Simulating an 8080. Is there a better way to do this?
Posted: Fri Mar 26, 2021 9:00 pm
IamRob wrote:
I did. The outcome is still the same as your code above, but without the Scratch variable.
The AND #$10 preserves the Aux Carry flag, which comes from the DEX TXA EOR above.
The AND #$3A also preserves the Aux Carry flag. If you punch the code in you will see you get exactly the same result as when using the scratch variable.
I had a typo in my previous post. It should have been #$3A, not #$3C.
The AND #$10 preserves the Aux Carry flag, which comes from the DEX TXA EOR above.
The AND #$3A also preserves the Aux Carry flag. If you punch the code in you will see you get exactly the same result as when using the scratch variable.
I had a typo in my previous post. It should have been #$3A, not #$3C.
Quote:
Command? u100l4
0100 3E10 mvi A,10
0102 3D dcr A
0103 3D dcr A
Command? r
A=00 BC=0000 DE=0000 HL=0000 SP=0000 PC=0100 szapc #=0000000000000000
0100 3E10 mvi A,10
Command? t
A=10 BC=0000 DE=0000 HL=0000 SP=0000 PC=0102 szapc #=0000000000000007
0102 3D dcr A
Command? t
A=0F BC=0000 DE=0000 HL=0000 SP=0000 PC=0103 szAPc #=000000000000000C
0103 3D dcr A
Command? t
A=0E BC=0000 DE=0000 HL=0000 SP=0000 PC=0104 szapc #=0000000000000011
0104 C30000 jmp 0000
0100 3E10 mvi A,10
0102 3D dcr A
0103 3D dcr A
Command? r
A=00 BC=0000 DE=0000 HL=0000 SP=0000 PC=0100 szapc #=0000000000000000
0100 3E10 mvi A,10
Command? t
A=10 BC=0000 DE=0000 HL=0000 SP=0000 PC=0102 szapc #=0000000000000007
0102 3D dcr A
Command? t
A=0F BC=0000 DE=0000 HL=0000 SP=0000 PC=0103 szAPc #=000000000000000C
0103 3D dcr A
Command? t
A=0E BC=0000 DE=0000 HL=0000 SP=0000 PC=0104 szapc #=0000000000000011
0104 C30000 jmp 0000