Day 22 - Saving And 0xE000000
Well... I figured I might as well do something about this as many people
have been asking the question around the 'net. Today we are going to see how to
put something into the save memory of the cart.
Patater GBAGuy Mirror
The LDRB/STRB Instructions
These instructions load or store a byte to/from memory and are needed to
be able to read/write from save ram (SRAM). They work just like any other loads
Save RAM is at 0xE000000. All you have to do is write to any address from
0xE000000 to 0xE00FFFF (which is 64kb of save memory) with the STRB instruction.
To read from SRAM, use the LDRB instruction. simple!
Reading the first byte of SRAM:
Writting the first byte of SRAM:
ldr r2,=0xFF ; we are going to write 0xFF to SRAM
; note that we still, most likely, will use a normal LDR to load the register
; with a number
Hope that helps anyone having trouble with SRAM.
Which I hope isn't the case as it is very easy to use. (thanks N!)
Day In Review
If anyone would like to write something, let me know via email.
With saving as easy as it is, it's surprising that a lot of games
still use a password system...
- Mike H
Intro - Day 23