kbeckmann/game-and-watch-retro-go

Is it possible to create a clock, and expose it as the RTC for the Game Boy emulator?

fangfufu opened this issue · 1 comments

Some Game Boy games have the concept of time, and they have a RTC chip in the cartridge. Some emulators on desktop can expose the system clock to the game. So I have several questions:

  1. Does the Game and Watch microcontroller have an RTC?
  2. If not, then how was the time implemented in the original firmware?
  3. If I want to expose RTC to Game Boy games, where do I start?

Yes there is an RTC peripheral in the MCU and there is an external crystal for this purpose.

I tried to integrate RTC using the external XTAL but had issues so I gave up. The current code uses the poor performance internal RC oscillator. It was useful as a profiling counter.

You could try to open the project in stm32cubemx and try to enable the RTC. My issue was that I never managed to get an interrupt when using the external XTAL, however you might have more luck :). This obviously works with the stock firmware so either I did something wrong or there was a bug in the HAL (not too uncommon unfortunately).