Originally posted by YoshiNextGen
If A+B=C and A=C and C=B then what does D=?
In the 65816 processor architecture:
A is the accumulator.
B is the upper byte of the accumulator, in range $00..$ff.
C is the entire accumulator, in range $0000..$ffff.
D is the address of the direct page in bank zero, in range $0000..$ffff.
C=B,
then C is in range $0000..$00ff,
then the upper byte of C is $00,
then B=$00.
C=B,
then C=$0000.
The processor flag M is set, or the processor flag M is clear.
I consider both cases.
Case 1: processor flag M is set
A is the lower byte of the accumulator, in range $00..$ff.
C=$0000,
then the lower byte of C is $00,
then A=$00.
Case 2: processor flag M is clear
A is the entire accumulator, in range $0000..$ffff.
C=$0000,
then A=$0000.