More accurate emulation of the IR port
This commit is contained in:
parent
cd2310f0a7
commit
b7f3454763
@ -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)
|
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)
|
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: {
|
case GB_IO_RP: {
|
||||||
if (!gb->cgb_mode) return 0xFF;
|
if (!gb->cgb_mode) return 0xFF;
|
||||||
/* You will read your own IR LED if it's on. */
|
/* You will read your own IR LED if it's on. */
|
||||||
uint8_t ret = (gb->io_registers[GB_IO_RP] & 0xC1) | 0x3C;
|
uint8_t ret = (gb->io_registers[GB_IO_RP] & 0xC1) | 0x2E;
|
||||||
if ((gb->io_registers[GB_IO_RP] & 0xC0) == 0xC0 && effective_ir_input(gb)) {
|
if (gb->model != GB_MODEL_CGB_E) {
|
||||||
ret |= 2;
|
ret |= 0x10;
|
||||||
|
}
|
||||||
|
if (((gb->io_registers[GB_IO_RP] & 0xC1) == 0xC0 && effective_ir_input(gb)) && gb->model != GB_MODEL_AGB) {
|
||||||
|
ret &= ~2;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user