Search the web
Sign In
New User? Sign Up
gbadev
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Interrupt/stack question   Message List  
Reply | Forward Message #13720 of 15019 |
Re: [gbadev] Interrupt/stack question

From: "James Daniels" <james.daniels@...>
[...]
> I believe this might be the source of the problems because inside some
> of my routines I'm storing the stack (r13) and then using it as a
> general purpose register. Of course, I restore the stack before
> returning or calling another function so there's not normally a problem.
> However, if an interrupt were to occur whilst r13 contained something
> other than the stack then random areas of memory would be corrupted.
[...]

your understanding is correct. you may not twiddle r13 within your routines
unless you a) are not using interrupts or b) disable interrupts.

regards,
matthew.





Thu Feb 6, 2003 1:49 pm

whatwouldbig...
Offline Offline
Send Email Send Email

Forward
Message #13720 of 15019 |
Expand Messages Author Sort by Date

Hi all, I've also posted this question on the gbadev.org forums so I apologise if you've also read this there. Anyway, I'm using interrupts in my code and most...
James Daniels
j_r_daniels
Offline Send Email
Feb 6, 2003
11:36 am

Hi James. ... Interrupts use a different stack pointer from the user stack pointer. So, unless these other routines are also being run in IRQ mode, or your ...
Julian Squires
erovonket
Offline Send Email
Feb 6, 2003
12:09 pm

From: "James Daniels" <james.daniels@...> [...] ... [...] your understanding is correct. you may not twiddle r13 within your routines unless you...
matthew conte
whatwouldbig...
Offline Send Email
Feb 6, 2003
2:24 pm

... That's funny, works fine for me. Am I confusing something? (I just tested it, with some hblank and vblank effects driven by interrupts, while the main...
Julian Squires
erovonket
Offline Send Email
Feb 6, 2003
3:33 pm

Seriously, IRQ mode is a completely seperate processor mode - it has it's own set of certain registers it IS ok to play with r13 as long as you don't do it...
Stephen Stair
sgstair
Online Now Send Email
Feb 6, 2003
3:32 pm

Hi, I'm the author of the "Girlfriend Advance" emulator. If I can remember well, the interrupt just save the current PC value and jump in the bios, with...
Vincent Cantin
karma@...
Send Email
Feb 6, 2003
5:56 pm

Hi Julian, ... I've just done what I should have done before and confirmed that the stack value is sensible inside the interrupt and it always is, so you must...
James Daniels
j_r_daniels
Offline Send Email
Feb 6, 2003
7:00 pm

Hi James, ... That's right, there are two stack pointers. I originally found out about this when writing (the equivalent of) crt0.s for a recent project. So,...
Julian Squires
erovonket
Offline Send Email
Feb 6, 2003
7:45 pm

You're absolutely correct. However, it would be possible for the BIOS to do funky things with the stacks, if it chose to. I do not believe that the BIOS does...
Mike Schwartz
mykes@...
Send Email
Feb 6, 2003
10:29 pm

Hi Julian, ... Thanks for the help! ... Surely the interrupt stack is 224 bytes big in this case? Also, why does the interrupt stack need to start so far away...
James Daniels
j_r_daniels
Offline Send Email
Feb 6, 2003
10:28 pm

Hi James, ... Hah, you're absolutely right. I must have mentally switched between hex and decimal mode while writing that comment. ... One could put it at...
Julian Squires
erovonket
Offline Send Email
Feb 6, 2003
11:27 pm

Hi Julian, ... I just did a bit more research and discovered the following (from the GBATEK spec): * * * Default memory usuage at 03007FXX (and mirrored to...
James Daniels
j_r_daniels
Offline Send Email
Feb 7, 2003
1:14 am

From: "Julian Squires" <tek@...> ... i should have been clearer. i believe i had multiple interrupts enabled, which uses the normal stack as the interrupt...
matthew conte
whatwouldbig...
Offline Send Email
Feb 7, 2003
1:14 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help