First of all, I really needed a better way to produce my maps and dump out my tiles, so wrote a custom VB.NET program that opens "tiles.gif", converts all the tiles in it (and produces a palette) then displays a map editor. This speeds things up a lot - all it needs is the tiles.gif file and nothing else. It also saves the current map in "map.dat" which it saves/loads when you close/open the program, so I don't have to reenter the map by hand each time. [smile]
You might also notice that I have altered some of the tiles and added a handful of new ones:
(Fear the evil magenta!)
Smooth scrolling backgrounds on the Game Gear are "easy" to do, thanks to hardware support!
What you have is a largish buffer to hold your map in. You can offset the smaller view window inside this by controlling VDP registers $08 (x) and $09 (y). For the y-scroll axis (the one I'm interested in) you can enter a value of 0 to 224. Unfortunately, a value of zero indicates that the view rectangle is centred and NOT at the top row - which requires some fudging. I need to calculate where in this larger "map" buffer I need to output my map data as I move the view rectangle around. If the y range started from 0 being the top row of the map buffer all would be much easier - the jump from 223 to 0 32 pixels down means that I need to handle the top few rows slightly differently, which is a bit of a bore. At least this isn't the curse of having to handle converting a screen (x,y) coordinate into a memory location on the VDP - but I'll have to do that at some point to handle swapping map tiles to holes where my bullets have destroyed some element on the landscape below. *shivers*
With a good deal of trial and error, I finally get my landscape to smoothly scroll past:
Now, something I learned is that the "corruption" in my tiles is not actually corruption at all. The Tiles window displays all the VRAM, including the names table (my map buffer). No wonder it "corrupts" when I write to the names table... *slaps forehead* Well, it works in an emulator... do I dare try it on hardware?
Of course I do.
Click to view in action (270KB AVI, MPEG4)
According to my Game Gear this was produced "Under License" from Sega Enterprises Ltd. I think not. [grin]
Unless, of course, it's referring to the BIOS my Game Gear has, and as far as I know all the BIOS does is display that one screen. Answers on the back of a postcard!