SameBoy | Accurate GB/GBC emulator |
| download: https://git.y1.nz/archives/sameboy.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit b7f34547631dba70f84ec670ec701af0e3f9ff56 parent cd2310f0a749499130cd148cafa2386c32491832 Author: Lior Halphon <LIJI32@gmail.com> Date: Fri, 20 Nov 2020 22:12:15 +0200 More accurate emulation of the IR port Diffstat:
| M | Core/memory.c | 11 | +++++++---- |
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/Core/memory.c b/Core/memory.c @@ -115,7 +115,7 @@ static bool is_addr_in_dma_use(GB_gameboy_t *gb, uint16_t addr) static bool effective_ir_input(GB_gameboy_t *gb) { - return gb->infrared_input || (gb->io_registers[GB_IO_RP] & 1) || gb->cart_ir; + return gb->infrared_input || gb->cart_ir; } static uint8_t read_rom(GB_gameboy_t *gb, uint16_t addr) @@ -428,9 +428,12 @@ static uint8_t read_high_memory(GB_gameboy_t *gb, uint16_t addr) case GB_IO_RP: { if (!gb->cgb_mode) return 0xFF; /* You will read your own IR LED if it's on. */ - uint8_t ret = (gb->io_registers[GB_IO_RP] & 0xC1) | 0x3C; - if ((gb->io_registers[GB_IO_RP] & 0xC0) == 0xC0 && effective_ir_input(gb)) { - ret |= 2; + uint8_t ret = (gb->io_registers[GB_IO_RP] & 0xC1) | 0x2E; + if (gb->model != GB_MODEL_CGB_E) { + ret |= 0x10; + } + if (((gb->io_registers[GB_IO_RP] & 0xC1) == 0xC0 && effective_ir_input(gb)) && gb->model != GB_MODEL_AGB) { + ret &= ~2; } return 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.