#63222 - AkumaATR - Sat Dec 10, 2005 4:37 am
I am finding in my interrupt dispatcher code that I have to push LR to the system stack (and that I can't use the IRQ stack) before executing the user handler, and restore it after the user handler returns.
I had a version of the interrupt dispatacher code that I thought was finished/fully-working because it works correctly in VBA and NO$GBA. However, on hardware, the animated (falling) pixel I have stops about 1/4 of the screen down (freezes I guess). I find it very strange how long it works (in computing terms) before freezing (it's already handled the vblank int a number of times at this point)... It's page flipping on vblank int when a page is ready, and doing a vblankintrwait after the code to produce the next frame is done.
It pushed the regs I needed to preserve (including LR) to the IRQ stack, then switched to system mode, then returned to IRQ mode before popping those items off the IRQ stack. That's kinda how I would like to do it... it's only a total of four additional words (not enough to overrun the IRQ stack space), and there's no nesting going on now (I don't think this problem is from overrunning IRQ stack space).
My dispatcher code is very similar to the dispatcher code in libgba because I studied how that dispatcher worked before writing mine. Like I said, I can get it to work by pushing LR to the system stack, I just don't want to do that if I don't have to and would like to know why it's not working if I use IRQ stack space for that.
Works: http://www.rafb.net/paste/results/Dy1tLo18.html
Doesn't: http://www.rafb.net/paste/results/jRlou772.html
The only difference is that I save LR on the IRQ stack in the one that doesn't work, but to the system stack in the one that does.
The stuff in question begins around line 104.
Also there is a bug in the abort code (I need to ack. via IF there), but that's not causing this problem (abort code is never running for my current tests).
Here is a link to the main source file (not where the problem lies):
http://www.rafb.net/paste/results/CAPxLE39.html
Thanks a lot for any help with this... I've been working on this interrupts code way too long now :-/. And in case anyone is wondering I just wrote it as a learning exercise, it's no better than handlers than interrupt code that's currently available.
I had a version of the interrupt dispatacher code that I thought was finished/fully-working because it works correctly in VBA and NO$GBA. However, on hardware, the animated (falling) pixel I have stops about 1/4 of the screen down (freezes I guess). I find it very strange how long it works (in computing terms) before freezing (it's already handled the vblank int a number of times at this point)... It's page flipping on vblank int when a page is ready, and doing a vblankintrwait after the code to produce the next frame is done.
It pushed the regs I needed to preserve (including LR) to the IRQ stack, then switched to system mode, then returned to IRQ mode before popping those items off the IRQ stack. That's kinda how I would like to do it... it's only a total of four additional words (not enough to overrun the IRQ stack space), and there's no nesting going on now (I don't think this problem is from overrunning IRQ stack space).
My dispatcher code is very similar to the dispatcher code in libgba because I studied how that dispatcher worked before writing mine. Like I said, I can get it to work by pushing LR to the system stack, I just don't want to do that if I don't have to and would like to know why it's not working if I use IRQ stack space for that.
Works: http://www.rafb.net/paste/results/Dy1tLo18.html
Doesn't: http://www.rafb.net/paste/results/jRlou772.html
The only difference is that I save LR on the IRQ stack in the one that doesn't work, but to the system stack in the one that does.
The stuff in question begins around line 104.
Also there is a bug in the abort code (I need to ack. via IF there), but that's not causing this problem (abort code is never running for my current tests).
Here is a link to the main source file (not where the problem lies):
http://www.rafb.net/paste/results/CAPxLE39.html
Thanks a lot for any help with this... I've been working on this interrupts code way too long now :-/. And in case anyone is wondering I just wrote it as a learning exercise, it's no better than handlers than interrupt code that's currently available.