#3267 - jenswa - Fri Feb 21, 2003 12:44 pm
How to put the gba into sleepmode ?
it's with calling a bios function and setting an irq interrupt or something.
But i don't know how to do that, can somebody help me?
bye
tha J
_________________
It seems this wasn't lost after all.
#3839 - Kay - Mon Mar 10, 2003 12:40 pm
To do so you've to set bit 7 ($80) at $4000301.
The CPU is then in suspend mode until the next IRQ occurs.
WARINING: don't forgett to set interrupts before, otherwise CPU activity will be completely halted.
Nintendo recommends to set this byte after all VBL tasks are proceeded, in order too save battery power.
-- Kay.
#3857 - NEiM0D - Mon Mar 10, 2003 10:25 pm
it's swi 2 or 3 can't remember it that quite
#3887 - jenswa - Tue Mar 11, 2003 8:30 pm
swi 2 = halt
swi 3 = stop,
but the problem actually is that i don't know how to call
them from c/c++
_________________
It seems this wasn't lost after all.
#3899 - Quirky - Wed Mar 12, 2003 8:57 am
You can just do this. (Untested, but I use a vblank_wait routine that looks identical except the 2 is a 5)
Code: |
void halt(void) {
asm volatile("swi 0x20000");
} |
#4198 - tepples - Sun Mar 23, 2003 5:42 am
Currently, here's how I have reasoned how to put the GBA to sleep:
1. Disable sound.
2. Disable all interrupts but the joypad interrupt.
3. Wait for vblank.
4. Disable video (force blank).
5. Wait for 2 vblanks (so as not to produce any fading horizontal line artifacts).
6. Call swi 0x03 ("Stop")
7. Reinitialize video.
8. Reinitialize interrupts.
9. Reinitialize sound.
10. Resume game engine.
Will this work as expected? Have I left out a major source of power drain?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#4911 - delbogun - Mon Apr 14, 2003 10:36 pm
This is probably a stupid question, but how do I return from sleep mode and how do I turn on/off LCD and Sound?
#4922 - tepples - Tue Apr 15, 2003 12:23 am
To get out of sleep mode: Set the joypad interrupt control register to trigger an interrupt on Select+Start, and install an interrupt handler. The sleep SWI will handle everything from there. And I've found out that you don't need to disable sound; swi 3 takes care of everything for you.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#4927 - TooTall - Tue Apr 15, 2003 1:38 am
Is the sleep mode to save computations or for a screen saver type thing when nothing has been pressed for a while. just wunderin'.
TT
_________________
Knowledge speaks, wisdom listens.
-Jimi Hendrix
#4928 - Daikath - Tue Apr 15, 2003 1:58 am
To save batteries if your not at a savepoint yet. Or where you can't save some stuff.
_________________
?There are no stupid questions but there are a LOT of inquisitive idiots.?
#4936 - delbogun - Tue Apr 15, 2003 11:33 am
I can't seem to make my interrupts work. I saw at dovoto's tutorial that I need to change crt0.s. I downloaded this file and changed it, but how do I use it? Should I copy that file to C:\devkitadv\ or in my project directory? Is there something I must add in my make.bat file?
#13004 - thorgull - Wed Dec 03, 2003 12:48 pm
well, it seems that halt and stop don't work on EZ-Flash Card (I have EZ-Flash Power Star).
does someone know why ?
#13007 - torne - Wed Dec 03, 2003 1:25 pm
thorgull wrote: |
well, it seems that halt and stop don't work on EZ-Flash Card (I have EZ-Flash Power Star).
does someone know why ? |
Halt and stop have nothing to do with the cartridge. If it doesn't work, then the problem is elsewhere.
#13017 - thorgull - Wed Dec 03, 2003 7:06 pm
hum... I don't think so...
why sleep of backup of an original game (GoldenSun) doesn't work.
game go to sleepmode (screen turn off) and return imediatly... (no no,... I don't press L & R)
is it possible that the bootloader of the ezflash generate interrupt that keep CPU awake ? (this is the only idea i have)
and the folowing home-made code (using Register instead of interrupt) does't work.... can you say me what is wrong ?
Code: |
...
REG_IME=0;
REG_IE= INT_KEY;
REG_P1CNT= KEY_L|KEY_R|KEY_INT|KEY_INT_ALL;
INT_HANDLER= (u32)&InterruptHandler;
REG_IME=1;
in_vsync();
REG_DISPCNT=FORCE_BLANK;
in_vsync();in_vsync();
REG_HALTCNT_H=0x80;
...
|
a last question... is there an emu that handle halt and stop (for testing)
Last edited by thorgull on Wed Dec 03, 2003 9:11 pm; edited 1 time in total
#13023 - torne - Wed Dec 03, 2003 9:11 pm
thorgull wrote: |
is it possible that the bootloader of the ezflash generate interrupt that keep CPU awake ? (this is the only idea i have) |
No, the bootloader isn't running once the game is started. All interrupts are reset and controlled by the game.
Quote: |
and the folowing home-made code (using Register instead of interrupt) does't work.... can you say me what is wrong ? |
Never tried to do it except with SWI.
Quote: |
a last question... is there an emu that handler halt and stop (for testing) |
VBA and No$GBA both handle halt, afaik. (No$ definately does)