#4518 - delbogun - Wed Apr 02, 2003 11:19 am
i was wondering if it is possible to detect if the gba is running on low batteries so a warning text could be displayed, or something like that.
also, is it possible to detect additional hardware accessories to the gba? for example if additional hardware have been plugged in, the game refuses to run. (was thinking more like cheating devices such as gameshark...)
#4527 - Unciaa - Wed Apr 02, 2003 4:31 pm
And to further this question, how would one go about giving his program a power saving mode? Any way to turn off the LCD display?
#4528 - delbogun - Wed Apr 02, 2003 4:39 pm
Unciaa: i found something interesting about power saving at dev'rs gba faqs:
Quote: |
Question: How do I conserve battery power when developing GBA software?
Answer: The main things would be to use 4/2 rom wait state timing and to leave the ROM prefetch turned off. 3/1 rom wait states uses about 20% more power. ROM prefetch increases power usage by about 10%.
|
i have no idea what that means. anyone knows?
#4532 - DekuTree64 - Wed Apr 02, 2003 5:46 pm
Yea, there's a register to control the timings of things. Here's some defines:
#define REG_WSCNT *(volatile u16*)0x4000204
#define CST_SRAM_4WAIT 0x0000
#define CST_SRAM_3WAIT 0x0001
#define CST_SRAM_2WAIT 0x0002
#define CST_SRAM_8WAIT 0x0003
#define CST_ROM0_1ST_4WAIT 0x0000
#define CST_ROM0_1ST_3WAIT 0x0004
#define CST_ROM0_1ST_2WAIT 0x0008
#define CST_ROM0_1ST_8WAIT 0x000c
#define CST_ROM0_2ND_2WAIT 0x0000
#define CST_ROM0_2ND_1WAIT 0x0010
#define CST_ROM1_1ST_4WAIT 0x0000
#define CST_ROM1_1ST_3WAIT 0x0020
#define CST_ROM1_1ST_2WAIT 0x0040
#define CST_ROM1_1ST_8WAIT 0x0060
#define CST_ROM1_2ND_4WAIT 0x0000
#define CST_ROM1_2ND_1WAIT 0x0080
#define CST_ROM2_1ST_4WAIT 0x0000
#define CST_ROM2_1ST_3WAIT 0x0100
#define CST_ROM2_1ST_2WAIT 0x0200
#define CST_ROM2_1ST_8WAIT 0x0300
#define CST_ROM2_2ND_8WAIT 0x0000
#define CST_ROM2_2ND_1WAIT 0x0400
#define CST_PHI_OUT_NONE 0x0000 // terminal output clock fixed Lo
#define CST_PHI_OUT_4MCK 0x0800 // 4MHz
#define CST_PHI_OUT_8MCK 0x1000 // 8MHz
#define CST_PHI_OUT_16MCK 0x1800 // 16MHz
#define CST_PREFETCH_ENABLE 0x4000 // Enable prefetch buffer
#define CST_AGB 0x0000 // AGB Game Pak
#define CST_CGB 0x8000 // CGB Game Pak
I just copied those from the GBADev Yahoo list a long time ago, and haven't ever actually tried them. Basically you set the ROM0_1ST for the first access (normally 3, I think), and then ROM0_2ND for sequential access (normally 1). You can set it to 2/1, but I'm not sure if it would damage a normal ROM to run that fast. ROM0, ROM1 and ROM2 refer to having more than one chip in a cart, so you can have like one regular chip for most things, and one smaller, fast (and more expensive) chip for things that require some speed, but won't fit in IWRAM or whatever. ROM is mirrored at 0x08000000 - 0x09ffffff, 0x0a000000 - 0x0bffffff, and 0x0c000000 - 0x0dffffff (taken from the www.devrs.com FAQ), and I think each of the waitstate settings refers to each mirror, but they all have access to all chips in the cart, it's just a way for your game to tell the system which speed to access at.
Then the PHI_OUT_xMCK settings are for the processor speed, which I guess you could use to save battery power on a really simple game, but I've neer used/heard of them being used.
Prefetch is exactly what it says. It makes the processor tell the memory system to load the next instruction while the processor executes the current one, but uses about 10% more battery power to do it.
But like I said, I've never tried any of that, I'm just going off what I've read here and there.
#4533 - tepples - Wed Apr 02, 2003 5:50 pm
It means that if you set the GBA to read the cartridge slower, it'll use less power in spin-wait loops. On the other hand, if you set the GBA to not read the cartridge at all, it'll use even less power. Examples include use of VblankIntrWait() instead of spin-waiting, or writing your program for multiboot and then copying it into RAM, or both.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.