Program Counter

From SnesLab
Jump to: navigation, search

The Program Counter (PC) points to the next instruction byte to fetch. On both the 65c816 and S-SMP it is 16 bits wide. The low byte is called PCL and the high byte is called PCH.

If incremented past FFFFh, it wraps around to zero.[E&L, page 34] It is incremented after opcode fetch.

The 6502 had 16-bit absolute addressing but only an 8-bit adder, so in emulation mode branches that cross a page boundary incur a one cycle penalty. 65c816 native mode has no such penalty because the full 16-bit adder is used.

Interrupts cause the program counter to be pushed to the stack (high byte first).

The program counter alone is not enough to uniquely identify the current instruction - the program bank register holds the high byte of the full 24-bit address.

See Also

References