Comment by msk-lywenn
8 hours ago
I played a bit with original gameboy too. I was very surprised when, iirc, the cpu is not even fast enough to clear the screen in one vertical blank, or even in one frame! It takes like three to fully clear the map.
8 hours ago
I played a bit with original gameboy too. I was very surprised when, iirc, the cpu is not even fast enough to clear the screen in one vertical blank, or even in one frame! It takes like three to fully clear the map.
Yeah, you really need to structure your code around working with the tilemap system.
I did a small racing prototype with both vertical and horizontal scrolling and segmented my updates to 4x4 blocks of tiles per-frame (160x144 resolution so 20x18 of 32x32 tiles is visible at any point in time, so stippled updating 4x4 blocks outside of view is within the budget together with updating some of the tiles each frame)
This is false. You can do it in 1. It just involves mid-frame tile switching IIRC or using characters / sprites to fill in the rest.
You need to do mid-frame tile updates just to show a full bitmap frame. There’s 360 8x8 tiles on the screen, but the tile indices are 8 bit. You can store only 384 tiles in VRAM - a bit more than a full screen.
You can update 1 tile per scan line, so 154 per frame (including 10 vblank). So you need 2.5 frames to replace all tiles.
If you are really smart about updates, you can “race the beam”, basically start updating tiles just as the frame starts rendering, just behind the active scan line. Then you can update maybe 280 tiles before the active scan line of the next frame catches up with you.