Tuesday 20 August 2013

Title Screen Break Dancing Headspin, Part 1

I have recently had a look deeper into my title screen tilemap woes. As posted earlier, currently my title screen looks like this:-

This seemed like a good start, but clearly not good enough. Before I began, I read a lot of VDP page on the Mega Drive Wiki. I cannot overstate how brilliant a resource this is, it has given me a much greater idea of the little black console's internals. If you want to know anything about the system, go there.

As the tilemap has repetitions in key places (for example, the X & Y tiles), I started looking for a way to change this (and hopefully get rid of the licensing info in the process). So step one was to try and find it plainly in the ROM. In RegenD, I loaded the ROM up to the title, and turned off the layers one by one to see what was where. The planet background is on PlaneA, and the Mass Effect logo & license info is on Plane B. I loaded up the VDP debugger to look at the registers:-
Register #04 is what I was looking for, the location of the PlaneB (FieldB in Regen-speak) - 0x2000. A quick VRAM dump, into my hex editor, and have a peek at location 0x2000 - and gold. After bytes & bytes of 00, suddenly I see it - "6C 87 6C 87 6C 87...". Obviously what  I was looking for, the first row of repeated blank tiles - 6C87 being the 16-bit nametable entry for the blank tile. First try, I copied the first 20-odd bytes from the tilemap in and searched the main ROM for it.

"No Match Found"

Not entirely surprised, to be honest. With that much repetition, storing it plainly would just be a waste of space - and that could get you the death sentence as a game developer in the cartridge days!

As I can't find it plainly in the ROM, it was time to get a bit clever, and see if I could find out where the game got the info from. Back in RegenD, I opened up the debugger, and set a breakpoint for both read and write on 0x2000 in the VDP:-
Now, I restarted the game, and hoped for it to freeze while the screen was loading so I could see the ASM code happening, and see where it was getting the data from (or how it was generating it). But nope, it never hit a break, just kept playing. Assuming the debugger was at fault, I tested it by setting a breakpoint at 0x1459 - the location I changed while attempting time travel, that ended up breaking the splash screen. Restart the game, and shortly after the EA splash begins, the debugger pauses the game and pops up. So it's not the debugger.

I scratched my head for a while, but couldn't get it - so I asked for help. No shame, this the first time I've tried to debug a Mega Drive game, and these tools don't have the best documentation! RedComet from the RHDN forums (another brilliant resource) brought something to my attention - the RegenD VDP debugger only breaks on standard read/write operations - but not from DMA access. So to find out what is going wrong, I'm going to need to use GensTracer.

And I have had serious issues getting any Gens derivative running on my system...

I've learnt a lot about the Mega Drive's VDP, and learnt how to use the RegenD debugging tools a lot more - but have also learnt of its limitations. Now to learn more, with GensTracer!


No comments:

Post a Comment