clydeshaffer / GameTankEmulator

An emulator for the GameTank, a real physical hardware game console I've built
MIT License
15 stars 9 forks source link

Deferred Blitting Emulation #13

Closed clydeshaffer closed 10 months ago

clydeshaffer commented 10 months ago

The real GameTank's blitter runs in parallel with CPU work and copies one pixel per cycle. The emulator has been operating under the assumption that the programmer would avoid interacting with its registers while it was running. However I'd like to allow programmers to experiment with this and see what techniques could be found by messing with the blitter mid-blit.

The new blitting emulation works incrementally, instead of happening all in one for-loop there's now a function that simulates the state of each counter and flipflop, and completes a given number of cycles. A timestamp is recorded whenever the blitter, video memory, or system registers are interacted with and the number of cycles since the previous interaction are processed.

The new method should accurately simulate what happens when the blitter registers are written to during a blit, as well as other behaviors such as disabling the blitter while it is running or changing framebuffer/sprite banks.

To ease the transition for any software currently under development an "Instant Blit" toggle is available in the menu bar that mimics the old behavior of the emulator.