git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

commit 2971b1770155fc396e310059269c5564362f3f61
parent 5f2e8938289f3271241fe2304051f9dcf511458a
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Mon, 19 Apr 2021 00:32:10 +0300

Add support for ugetab's GBS extensions, fixes #377

Diffstat:
MCore/gb.c9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/Core/gb.c b/Core/gb.c @@ -333,6 +333,9 @@ void GB_gbs_switch_track(GB_gameboy_t *gb, uint8_t track) gb->sgb->intro_animation = GB_SGB_INTRO_ANIMATION_LENGTH; gb->sgb->disable_commands = true; } + if (gb->gbs_header.TAC & 0x40) { + gb->interrupt_enable = true; + } } int GB_load_gbs(GB_gameboy_t *gb, const char *path, GB_gbs_info_t *info) @@ -384,13 +387,15 @@ int GB_load_gbs(GB_gameboy_t *gb, const char *path, GB_gbs_info_t *info) memset(gb->mbc_ram, 0xFF, gb->mbc_ram_size); } + bool has_interrupts = gb->gbs_header.TAC & 0x40; + // Generate interrupt handlers - for (unsigned i = 0; i <= 0x38; i += 8) { + for (unsigned i = 0; i <= (has_interrupts? 0x50 : 0x38); i += 8) { gb->rom[i] = 0xc3; // jp $XXXX gb->rom[i + 1] = (LE16(gb->gbs_header.load_address) + i); gb->rom[i + 2] = (LE16(gb->gbs_header.load_address) + i) >> 8; } - for (unsigned i = 0x40; i <= 0x60; i += 8) { + for (unsigned i = has_interrupts? 0x58 : 0x40; i <= 0x60; i += 8) { gb->rom[i] = 0xc9; // ret }

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.