GARTHWILSON wrote:
> shows the RESET pushing the Program Counter and Processor Status
> Flags onto the stack... do you know if that is correct? Does a RESET
> push these registers onto the stack?
RESET is an interrupt of sorts, and I do seem to remember seeing it push these things onto the stack when I've done single-cycling experiments.
It doesn't look like you can rely on the behavior, though. I ran a couple of quick experiments. With the following code, I pressed RESET once it got to the BNE loop.
Code:
LDX #$7F ; clears Z flag, so BNE will branch
TXS
LABEL BNE LABEL
The LDX #$7F is just to move the stack pointer out far enough so that once the stack pointer is reset, the initialization routines won't clobber the effect RESET has on the stack. The reset handler I used was:
Code:
CLD
TSX
STX MEMORY
LDX #$FF
TXS
JMP RESET
On my 65C02, it appeared to push the PC and P register correctly at $17D to $17F. However, on my Synertek (NMOS) 6502, the stack pointer (stored in MEMORY) was $7C, but nothing got written to $017D to $017F. No matter what values I put there, they were never overwritten.