Mateusz Viste
2010-08-28 12:15:42 UTC
Hi!
I'm working on a small project these days, trying to emulate a GameBoy's
Z80 CPU.
I have some doubts about the RLCA and RRCA instructions, and don't know
how they should be implemented exactly...
What I am wondering about, is what to do with flag Z?
The official Z80 manual says that flag Z should be left untouched (but
still... the GameBoy is not built on an "official" Z80).
In the document "GameBoy CPU manual v1.01" I see:
Z - Set if result is zero.
Hmm... Who should I believe?
Also, I tested the RRCA/RLCA behavior on the NO$GMB emulator (which
integrates a very nice debugger), and it's even more surprising:
Flag Z is set only when register A changes from a non-zero value to zero.
So if A is already 0, NO$GMB does'nt set Z after RRCA/RLCA.
Where could I find 100% sure information about that?
Best regards,
Mateusz Viste
I'm working on a small project these days, trying to emulate a GameBoy's
Z80 CPU.
I have some doubts about the RLCA and RRCA instructions, and don't know
how they should be implemented exactly...
What I am wondering about, is what to do with flag Z?
The official Z80 manual says that flag Z should be left untouched (but
still... the GameBoy is not built on an "official" Z80).
In the document "GameBoy CPU manual v1.01" I see:
Z - Set if result is zero.
Hmm... Who should I believe?
Also, I tested the RRCA/RLCA behavior on the NO$GMB emulator (which
integrates a very nice debugger), and it's even more surprising:
Flag Z is set only when register A changes from a non-zero value to zero.
So if A is already 0, NO$GMB does'nt set Z after RRCA/RLCA.
Where could I find 100% sure information about that?
Best regards,
Mateusz Viste