Skip to content

Commit

Permalink
gb: fix bootrom being re-enabled
Browse files Browse the repository at this point in the history
Fixed issue #110 whereby a spurious write could enable the bootrom.
Previously, the bootrom could be enabled by writing 0 to 0xFF50. But
this is not possible on real hardware after the bootrom writes 1 to
0xFF50. No game is expected to attempt to re-enable the bootrom, but a
bug in a game or the emulator could cause it to happen.

If the bootrom was enabled by the game, and the gb_bootrom_read function
was set to NULL, then a NULL pointer exception was possible.

Signed-off-by: Mahyar Koshkouei <mk@deltabeard.com>
  • Loading branch information
deltabeard committed Jun 13, 2024
1 parent 288f018 commit 4596d56
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion peanut_gb.h
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,7 @@ void __gb_write(struct gb_s *gb, uint_fast16_t addr, uint8_t val)

/* Turn off boot ROM */
case 0x50:
gb->hram_io[IO_BOOT] = val;
gb->hram_io[IO_BOOT] = 0x01;
return;

/* Interrupt Enable Register */
Expand Down

0 comments on commit 4596d56

Please sign in to comment.