RGP said:
Hey Guys, this is incredible, hardware with no pixel scrolling built in being taught how to do it.
I've only been able to quickly flick through everything but i'm assume you're having to use bitwise shifts to move things through 8-bit boundaries.
On Pac-Man hardware isn't the tile map referenced out of rom? So a byte in the screen RAM represents a specific lookup in the ROM area.
So on a C64 we did parallax starfields by ROL'ing bytes in the character RAM but on this hardware wouldn't that mean needing write access to the tilemap?
Am I overthinking it?
No matter how you've done it, its awesome and opens up a lot of possibilities.
You do have read/write access to the tile ram, but it doesn't help here, because two tiles are affected by one bitmap read.
I'll try and explain how it works James.
The is 1k of tile ram, the bytes here reference the 256 tiles in the tile rom, so putting 56 in tile ram location $4040 (top right corner of main playarea) would draw the 8x8 tile number 56 from rom.
There is also 1k of pallete rom which like the speccy specifies the pallete to use when rendering a specifc tile at that address
What I am doing here is reading a bitmap
0110 0011
each bit represents a full or empty tile ($e and $f)
There is a pixel offset counter 0 to 7 which specifies what tile pair should be drawn for the bitmap (it's a lot more complicated than this because following bitmap values affect what tile is drawn but keeping this simple for clarity)
if the offset is 1 then i need to draw the tile so it looks like it's shifted to the right 1 pixel (tile $d), then tile to the left needs to show the remainder of the tile (tile $c). This carries on moving down the tile list to show the different scroll offsets, until we reach the point where we have moved a full 8 pixels. We then in my rough unoptimised version need to rotate the bit pattern one position to reflect the move of the bitmap. and the process starts again. The bit that falls of the end into the carry is picked up on the left hand side of the bitmap for that row, so we get the continuous wrapping.
Like I said this is a simplification, writing one bitmap actually involves working out what we are doing for two tiles. As I am writing this my brain has just fired up with a potential optimisation to the renderer
I've tried to explain this as simple as I can, any questions just ask.