#178293 - JoeWawaw - Sun Nov 30, 2014 4:31 am
Hi, does anyone know how the GBA implements bank switching for SRAM? the theoretical max would be 2^16 = 64kB of SRAM, yet some games have 128kB of it.
Thanks
#178294 - Dwedit - Sun Nov 30, 2014 5:08 am
No game uses 128KB of SRAM, at sizes beyond 32K, official cartridges use Flash memory instead of SRAM.
The sequence of writes for bankswitching is documented right in GBATEK:
Code: |
Bank Switching (devices bigger than 64K only)
[E005555h]=AAh, [E002AAAh]=55h, [E005555h]=B0h (select bank command)
[E000000h]=bnk (write bank number 0..1)
Specifies 64K bank number for read/write/erase operations.
Required because gamepak flash/sram addressbus is limited to 16bit width.
|
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."
#178295 - JoeWawaw - Sun Nov 30, 2014 7:47 pm
Sorry, i misspoke, what i meant to say was that flash memory in some gba cartridges is 128kB in size (the battery files generated by vba are 128kB)
since accessing RAM is done with 16 addresses
these writes documented in gbatek, how would i load them?
#178296 - JoeWawaw - Mon Dec 01, 2014 9:25 pm
UPDATE:
looking through the datasheet and probing the pins on the cartridge, all i had to do was setup the arduino as a writer, and write the command bytes to the gba cartridge to select memory bank 1
then i reverted the arduino to a reader and read the rest of the memory bank
Save file obtained works perfectly.