deltabeard / Peanut-GB

A Game Boy (DMG) emulator single header library written in C99. Performance is prioritised over accuracy.
https://projects.deltabeard.com/peanutgb/
276 stars 35 forks source link

core: return to frontend after certain number of CPU cycles #89

Open deltabeard opened 1 year ago

deltabeard commented 1 year ago

Currently, Peanut-GB uses gb_run_frame() to emulate the Game Boy and returns after a frame is drawn. If the LCD is set to off, then this function would not return until the game turns the LCD back on again. On a real Game Boy, this would result in a delay (typically small). But Peanut-GB skips this delay.

Peanut-GB should return to the frontend after a certain number of CPU cycles (eg. the number of cycles that it would take for a frame to be drawn).