Tuesday, August 5, 2008

Title screen and vram banks

Well, I've got the title screen working:



But it wasn't without a fair amount of pain. The first step was pretty easy: when I copy the tile data from regular memory to video memory (vram), I needed to make sure I was copying enough -- since I'm using different memory copy routines than I did on the gba.

I did that, ran it in my emulator, and it looked great. Till I ran it on the actual DS, and it was just a blank screen. Bleh. I loaded it up in the No$GBA emulator, which is the most accurate emulator out there, (but you have to pay to get access to most normal debugging features, and unfortunately, the author has disappeared, meaning it's impossible to purchase, so I'm out of luck getting a useful debug version!), and it black screened also. Bother.

So I spent a few hours fiddling around with some DS demos and copying code back and forth, trying to figure out where I went wrong. Turns out it's with DS's funky vram banks.

See, on the gba, your vram is vram. In the DS, there's a few banks of memory that are meant to be used for vram, but aren't assigned to specific memory addresses by default. You have to assign them yourself, depending on what you want to do with your video. If you are doing fancy 3d stuff, you assign them to the 3d texture memory addresses. If you're doing 2d tile graphics, you assign them somewhere else, and so forth. The trick is that there are certain configurations that are valid, and others that are not. And somehow I had been using an incorrect configuration. So changing that all around fixed things. So now it's working. Although I'm still not sure I have my head wrapped around how these vram banks are supposed to work, and why It's working now, but I don't completely understand it....and that's a dangerous place to be (If you want a taste of what the vile documentation looks like, check this out) . Oh well, for the sake of time, I'll move on, and come back to these things if they bite me again.

Next step: get this looking a little more normal:

No comments: