GB IO: Add some register names

This commit is contained in:
Vicki Pfau 2020-05-24 13:41:09 -07:00
parent f9a42d87d1
commit f78951b7dd
2 changed files with 8 additions and 6 deletions

View File

@ -84,7 +84,7 @@ enum GBIORegisters {
REG_WX = 0x4B, REG_WX = 0x4B,
// CGB // CGB
REG_UNK4C = 0x4C, REG_KEY0 = 0x4C,
REG_KEY1 = 0x4D, REG_KEY1 = 0x4D,
REG_VBK = 0x4F, REG_VBK = 0x4F,
REG_HDMA1 = 0x51, REG_HDMA1 = 0x51,
@ -97,7 +97,7 @@ enum GBIORegisters {
REG_BCPD = 0x69, REG_BCPD = 0x69,
REG_OCPS = 0x6A, REG_OCPS = 0x6A,
REG_OCPD = 0x6B, REG_OCPD = 0x6B,
REG_UNK6C = 0x6C, REG_OPRI = 0x6C,
REG_SVBK = 0x70, REG_SVBK = 0x70,
REG_UNK72 = 0x72, REG_UNK72 = 0x72,
REG_UNK73 = 0x73, REG_UNK73 = 0x73,

View File

@ -53,6 +53,7 @@ MGBA_EXPORT const char* const GBIORegisterNames[] = {
[REG_OBP1] = "OBP1", [REG_OBP1] = "OBP1",
[REG_WY] = "WY", [REG_WY] = "WY",
[REG_WX] = "WX", [REG_WX] = "WX",
[REG_KEY0] = "KEY0",
[REG_KEY1] = "KEY1", [REG_KEY1] = "KEY1",
[REG_VBK] = "VBK", [REG_VBK] = "VBK",
[REG_HDMA1] = "HDMA1", [REG_HDMA1] = "HDMA1",
@ -65,6 +66,7 @@ MGBA_EXPORT const char* const GBIORegisterNames[] = {
[REG_BCPD] = "BCPD", [REG_BCPD] = "BCPD",
[REG_OCPS] = "OCPS", [REG_OCPS] = "OCPS",
[REG_OCPD] = "OCPD", [REG_OCPD] = "OCPD",
[REG_OPRI] = "OPRI",
[REG_SVBK] = "SVBK", [REG_SVBK] = "SVBK",
[REG_IE] = "IE", [REG_IE] = "IE",
}; };
@ -99,7 +101,7 @@ static const uint8_t _registerMask[] = {
[REG_VBK] = 0xFE, [REG_VBK] = 0xFE,
[REG_OCPS] = 0x40, [REG_OCPS] = 0x40,
[REG_BCPS] = 0x40, [REG_BCPS] = 0x40,
[REG_UNK6C] = 0xFE, [REG_OPRI] = 0xFE,
[REG_SVBK] = 0xF8, [REG_SVBK] = 0xF8,
[REG_IE] = 0xE0, [REG_IE] = 0xE0,
}; };
@ -200,7 +202,7 @@ void GBIOReset(struct GB* gb) {
GBIOWrite(gb, REG_WY, 0x00); GBIOWrite(gb, REG_WY, 0x00);
GBIOWrite(gb, REG_WX, 0x00); GBIOWrite(gb, REG_WX, 0x00);
if (gb->model & GB_MODEL_CGB) { if (gb->model & GB_MODEL_CGB) {
GBIOWrite(gb, REG_UNK4C, 0); GBIOWrite(gb, REG_KEY0, 0);
GBIOWrite(gb, REG_JOYP, 0xFF); GBIOWrite(gb, REG_JOYP, 0xFF);
GBIOWrite(gb, REG_VBK, 0); GBIOWrite(gb, REG_VBK, 0);
GBIOWrite(gb, REG_BCPS, 0x80); GBIOWrite(gb, REG_BCPS, 0x80);
@ -462,7 +464,7 @@ void GBIOWrite(struct GB* gb, unsigned address, uint8_t value) {
break; break;
} }
GBUnmapBIOS(gb); GBUnmapBIOS(gb);
if (gb->model >= GB_MODEL_CGB && gb->memory.io[REG_UNK4C] < 0x80) { if (gb->model >= GB_MODEL_CGB && gb->memory.io[REG_KEY0] < 0x80) {
gb->model = GB_MODEL_DMG; gb->model = GB_MODEL_DMG;
GBVideoDisableCGB(&gb->video); GBVideoDisableCGB(&gb->video);
} }
@ -474,7 +476,7 @@ void GBIOWrite(struct GB* gb, unsigned address, uint8_t value) {
default: default:
if (gb->model >= GB_MODEL_CGB) { if (gb->model >= GB_MODEL_CGB) {
switch (address) { switch (address) {
case REG_UNK4C: case REG_KEY0:
break; break;
case REG_KEY1: case REG_KEY1:
value &= 0x1; value &= 0x1;