Behaviour of Z flag for ROL and ROR
Posted: Tue Oct 30, 2018 10:20 am
I am confused by the wording of the behaviour of the Z flag for ROL and ROR given here:
http://www.obelisk.me.uk/6502/reference.html#ROL
For Z the documentation for both ROL and ROR states
I am confused about whether this applies even in non-accumulator mode. If you are doing e.g. zero page ROL, why should we care about the accumulator contents at the end?
I am further confused by the behaviour of easy6502 in this regard.
The following:
does not set Z.
But even more confusingly:
does set Z!?!
My current thinking is:
should set Z.
Can a guru please clear this up for me?
http://www.obelisk.me.uk/6502/reference.html#ROL
For Z the documentation for both ROL and ROR states
Quote:
Set if A = 0
I am further confused by the behaviour of easy6502 in this regard.
The following:
Code: Select all
LDA #$80
STA $1
ROL $1
But even more confusingly:
Code: Select all
LDA #$1
STA $1
ROR $1
My current thinking is:
- Z should reflect the result of the operation, rather than the contents of A
- Easy6502 ROL has a bug
Code: Select all
LDA #$80
STA $1
LDA #$AA
ROL $1
Can a guru please clear this up for me?