Monday, September 8, 2008

#5 Fixed (or Hot Squash Burn)

I finally, after much anger, figured out the problem. The anger only resulted slightly from the actual problem. It (the anger) started when I got home, and suddenly my laptop (after locking up and being rebooted at least once) would no longer mount my card reader. So I took it to the other windows laptop, which would no longer read it either. So figured the card got corrupted, and tried to reformat it. But that failed also. Then my DS suddenly decided not to turn on anymore. About that time, Sara asked me to come blend the hot boiled squash she was cooking for baby food. Somehow I managed to not have the lid on right, and splattered boiling squash all over everything, including me. So let me just say Nathan wasn't the happiest man around.

Well, I finally dug out another card reader, which is working for now (I assume the other one just gave up the ghost?). Sara "fixed" my DS by waving her hands over it and saying "avada kedavra", so it works again (I still don't know what was up with that). And we even got the hot boiling squash off of everything, including me. And I only suffered mild first degree burns from the whole ordeal.

And now for the actual Anguna-related talk: In retrospect, I'm amazed at how much abuse in the form of wrong code you can throw at the GBA. The problem was a small section of code where I assume that each "map object" (the name I give to scenery sprites) has an array of two pointers to sprite info, and I write changes to both of them. Well, sometimes (like in the case of the small bushes) there's only 1 sprite, not two! Since C doesn't really protect you from your own stupidity, I was reading off the end of the array to some garbage pointer, and writing to a random location in memory. And the game boy was happy with that! (So were all the DS emulators I used). It makes me shudder to think that these few really nasty bugs made it into "production" code of the GBA Anguna, and I never noticed them because it somehow just worked.

Well, now, other than a small glitch in the background tile initialization for a room, (which is probably caused by another stupid instance of memory/pointer abuse), the actual on-hardware version works just like the emulated version. Which means I can go back to getting stuff done off the todo list. But first I'm going to bed.

No comments: