Use official register names

This commit is contained in:
Lior Halphon 2020-04-09 02:36:27 +03:00
parent d8e89f5114
commit 92d6cc6394
3 changed files with 13 additions and 13 deletions

View File

@ -185,7 +185,7 @@ enum {
// Unfortunately it is not readable or writable after boot has finished, so research of this
// register is quite limited. The value written to this register, however, can be controlled
// in some cases.
GB_IO_MODE = 0x4c,
GB_IO_KEY0 = 0x4c,
/* General CGB features */
GB_IO_KEY1 = 0x4d, // CGB Mode Only - Prepare Speed Switch
@ -193,7 +193,7 @@ enum {
/* Missing */
GB_IO_VBK = 0x4f, // CGB Mode Only - VRAM Bank
GB_IO_BIOS = 0x50, // Write to disable the BIOS mapping
GB_IO_BANK = 0x50, // Write to disable the BIOS mapping
/* CGB DMA */
GB_IO_HDMA1 = 0x51, // CGB Mode Only - New DMA Source, High
@ -212,7 +212,7 @@ enum {
GB_IO_BGPD = 0x69, // CGB Mode Only - Background Palette Data
GB_IO_OBPI = 0x6a, // CGB Mode Only - Sprite Palette Index
GB_IO_OBPD = 0x6b, // CGB Mode Only - Sprite Palette Data
GB_IO_OBJECT_PRIORITY = 0x6c, // Affects object priority (X based or index based)
GB_IO_OPRI = 0x6c, // Affects object priority (X based or index based)
/* Missing */

View File

@ -295,11 +295,11 @@ static uint8_t read_high_memory(GB_gameboy_t *gb, uint16_t addr)
return gb->io_registers[GB_IO_TAC] | 0xF8;
case GB_IO_STAT:
return gb->io_registers[GB_IO_STAT] | 0x80;
case GB_IO_OBJECT_PRIORITY:
case GB_IO_OPRI:
if (!GB_is_cgb(gb)) {
return 0xFF;
}
return gb->io_registers[GB_IO_OBJECT_PRIORITY] | 0xFE;
return gb->io_registers[GB_IO_OPRI] | 0xFE;
case GB_IO_PCM_12:
if (!GB_is_cgb(gb)) return 0xFF;
@ -663,8 +663,8 @@ static void write_high_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value)
case GB_IO_UNKNOWN5:
gb->io_registers[addr & 0xFF] = value;
return;
case GB_IO_OBJECT_PRIORITY:
if ((!gb->boot_rom_finished || (gb->io_registers[GB_IO_MODE] & 8)) && GB_is_cgb(gb)) {
case GB_IO_OPRI:
if ((!gb->boot_rom_finished || (gb->io_registers[GB_IO_KEY0] & 8)) && GB_is_cgb(gb)) {
gb->io_registers[addr & 0xFF] = value;
gb->object_priority = (value & 1) ? GB_OBJECT_PRIORITY_X : GB_OBJECT_PRIORITY_INDEX;
}
@ -785,14 +785,14 @@ static void write_high_memory(GB_gameboy_t *gb, uint16_t addr, uint8_t value)
}
return;
case GB_IO_BIOS:
case GB_IO_BANK:
gb->boot_rom_finished = true;
return;
case GB_IO_MODE:
case GB_IO_KEY0:
if (GB_is_cgb(gb) && !gb->boot_rom_finished) {
gb->cgb_mode = !(value & 0xC); /* The real "contents" of this register aren't quite known yet. */
gb->io_registers[GB_IO_MODE] = value;
gb->io_registers[GB_IO_KEY0] = value;
}
return;

View File

@ -41,10 +41,10 @@
00:FF49 IO_OBP1
00:FF4A IO_WY
00:FF4B IO_WX
00:FF4C IO_DMG_EMULATION
00:FF4C IO_KEY0
00:FF4D IO_KEY1
00:FF4F IO_VBK
00:FF50 IO_BIOS
00:FF50 IO_BANK
00:FF51 IO_HDMA1
00:FF52 IO_HDMA2
00:FF53 IO_HDMA3
@ -55,7 +55,7 @@
00:FF69 IO_BGPD
00:FF6A IO_OBPI
00:FF6B IO_OBPD
00:FF6C IO_OBJECT_PRIORITY
00:FF6C IO_OPRI
00:FF70 IO_SVBK
00:FF72 IO_UNKNOWN2
00:FF73 IO_UNKNOWN3