thedrip wrote:
By any chance does anything in your ISR write to the stack?
Do you have an NMI triggering during a regular interrupt?
Shotgunning ideas based on mistakes I made on my machine.
Technically I do have things that write to the stack in the ISR, but I do know that the pushes are matched with pops correctly.
I'm doubtful that I have an NMI triggering... I haven't explicitly checked for this, but, I have the NMI pin tied high with a pull-up resistor.
GARTHWILSON wrote:
What do you find if you look a few bytes above and below that return address? Is the correct address in there somewhere? (which would indicate you have something in the ISR that's getting the stack out of balance)
Just did a quick test of this, here's what I got:
Code:
01FA: 0A
01FB: E3
01FC: 11
01FD: 31
01FE: A0
01FF: 10
0200: 05
0201: FA
0202: 00
0203: 00
I have kept this testing code as simple as possible; probably under a hundred lines total (most of that is just a few utility procedures for the 7-segment LEDs and the ACIA). I'm pretty convinced that I don't have any silly stack mistake like pushing without popping, etc.; if I do, it's fake news; I've literally even printed out the stack pointer at various points to make sure it was popped appropriately, after calling these 'utility procedures'. Not that it's impossible that I've got a bug in the code somewhere, but I have good reason to doubt it.
This issue is going to be the death of me
EDIT: Strange; I added some more prints for some more stack values, descending from $01FA. That 31 changed to 71. Assuming that's the flags, uh, well, that's weird...