View Single Post
Old 05-27-2012, 11:53 PM   #2
Senior Member
hcs's Avatar
Join Date: Oct 2001
Location: California
Posts: 1,585

It's actually a slightly different order:

1. Read opcode
2. Increment PC (you are now pointing at the next opcode or the data for the current opcode)
3. Do whatever

You'll notice that this is the order that the GB emulator you linked to uses.

The PC in general will be incremented whenever something is read from the instruction stream, so that it will point to the next byte to be read.

This does get somewhat confusing when the instruction does something with PC before the increment happens, like the 6502's JSR/RTS instructions. The Z80 Call/Return is more straightforward than that, fortunately.
hcs is offline   Reply With Quote