GBA I/O: More legibility improvements

This commit is contained in:
Vicki Pfau 2023-09-06 22:47:43 -07:00
parent bcb0073a4a
commit 4c03970ffe
2 changed files with 120 additions and 173 deletions

View File

@ -12,6 +12,8 @@ CXX_GUARD_START
#include <mgba/core/log.h> #include <mgba/core/log.h>
#define GBA_REG(X) (REG_ ## X >> 1)
enum GBAIORegisters { enum GBAIORegisters {
// Video // Video
REG_DISPCNT = 0x000, REG_DISPCNT = 0x000,

View File

@ -14,189 +14,134 @@ mLOG_DEFINE_CATEGORY(GBA_IO, "GBA I/O", "gba.io");
const char* const GBAIORegisterNames[] = { const char* const GBAIORegisterNames[] = {
// Video // Video
"DISPCNT", [GBA_REG(DISPCNT)] = "DISPCNT",
0, [GBA_REG(DISPSTAT)] = "DISPSTAT",
"DISPSTAT", [GBA_REG(VCOUNT)] = "VCOUNT",
"VCOUNT", [GBA_REG(BG0CNT)] = "BG0CNT",
"BG0CNT", [GBA_REG(BG1CNT)] = "BG1CNT",
"BG1CNT", [GBA_REG(BG2CNT)] = "BG2CNT",
"BG2CNT", [GBA_REG(BG3CNT)] = "BG3CNT",
"BG3CNT", [GBA_REG(BG0HOFS)] = "BG0HOFS",
"BG0HOFS", [GBA_REG(BG0VOFS)] = "BG0VOFS",
"BG0VOFS", [GBA_REG(BG1HOFS)] = "BG1HOFS",
"BG1HOFS", [GBA_REG(BG1VOFS)] = "BG1VOFS",
"BG1VOFS", [GBA_REG(BG2HOFS)] = "BG2HOFS",
"BG2HOFS", [GBA_REG(BG2VOFS)] = "BG2VOFS",
"BG2VOFS", [GBA_REG(BG3HOFS)] = "BG3HOFS",
"BG3HOFS", [GBA_REG(BG3VOFS)] = "BG3VOFS",
"BG3VOFS", [GBA_REG(BG2PA)] = "BG2PA",
"BG2PA", [GBA_REG(BG2PB)] = "BG2PB",
"BG2PB", [GBA_REG(BG2PC)] = "BG2PC",
"BG2PC", [GBA_REG(BG2PD)] = "BG2PD",
"BG2PD", [GBA_REG(BG2X_LO)] = "BG2X_LO",
"BG2X_LO", [GBA_REG(BG2X_HI)] = "BG2X_HI",
"BG2X_HI", [GBA_REG(BG2Y_LO)] = "BG2Y_LO",
"BG2Y_LO", [GBA_REG(BG2Y_HI)] = "BG2Y_HI",
"BG2Y_HI", [GBA_REG(BG3PA)] = "BG3PA",
"BG3PA", [GBA_REG(BG3PB)] = "BG3PB",
"BG3PB", [GBA_REG(BG3PC)] = "BG3PC",
"BG3PC", [GBA_REG(BG3PD)] = "BG3PD",
"BG3PD", [GBA_REG(BG3X_LO)] = "BG3X_LO",
"BG3X_LO", [GBA_REG(BG3X_HI)] = "BG3X_HI",
"BG3X_HI", [GBA_REG(BG3Y_LO)] = "BG3Y_LO",
"BG3Y_LO", [GBA_REG(BG3Y_HI)] = "BG3Y_HI",
"BG3Y_HI", [GBA_REG(WIN0H)] = "WIN0H",
"WIN0H", [GBA_REG(WIN1H)] = "WIN1H",
"WIN1H", [GBA_REG(WIN0V)] = "WIN0V",
"WIN0V", [GBA_REG(WIN1V)] = "WIN1V",
"WIN1V", [GBA_REG(WININ)] = "WININ",
"WININ", [GBA_REG(WINOUT)] = "WINOUT",
"WINOUT", [GBA_REG(MOSAIC)] = "MOSAIC",
"MOSAIC", [GBA_REG(BLDCNT)] = "BLDCNT",
0, [GBA_REG(BLDALPHA)] = "BLDALPHA",
"BLDCNT", [GBA_REG(BLDY)] = "BLDY",
"BLDALPHA",
"BLDY",
0,
0,
0,
0,
0,
// Sound // Sound
"SOUND1CNT_LO", [GBA_REG(SOUND1CNT_LO)] = "SOUND1CNT_LO",
"SOUND1CNT_HI", [GBA_REG(SOUND1CNT_HI)] = "SOUND1CNT_HI",
"SOUND1CNT_X", [GBA_REG(SOUND1CNT_X)] = "SOUND1CNT_X",
0, [GBA_REG(SOUND2CNT_LO)] = "SOUND2CNT_LO",
"SOUND2CNT_LO", [GBA_REG(SOUND2CNT_HI)] = "SOUND2CNT_HI",
0, [GBA_REG(SOUND3CNT_LO)] = "SOUND3CNT_LO",
"SOUND2CNT_HI", [GBA_REG(SOUND3CNT_HI)] = "SOUND3CNT_HI",
0, [GBA_REG(SOUND3CNT_X)] = "SOUND3CNT_X",
"SOUND3CNT_LO", [GBA_REG(SOUND4CNT_LO)] = "SOUND4CNT_LO",
"SOUND3CNT_HI", [GBA_REG(SOUND4CNT_HI)] = "SOUND4CNT_HI",
"SOUND3CNT_X", [GBA_REG(SOUNDCNT_LO)] = "SOUNDCNT_LO",
0, [GBA_REG(SOUNDCNT_HI)] = "SOUNDCNT_HI",
"SOUND4CNT_LO", [GBA_REG(SOUNDCNT_X)] = "SOUNDCNT_X",
0, [GBA_REG(SOUNDBIAS)] = "SOUNDBIAS",
"SOUND4CNT_HI", [GBA_REG(WAVE_RAM0_LO)] = "WAVE_RAM0_LO",
0, [GBA_REG(WAVE_RAM0_HI)] = "WAVE_RAM0_HI",
"SOUNDCNT_LO", [GBA_REG(WAVE_RAM1_LO)] = "WAVE_RAM1_LO",
"SOUNDCNT_HI", [GBA_REG(WAVE_RAM1_HI)] = "WAVE_RAM1_HI",
"SOUNDCNT_X", [GBA_REG(WAVE_RAM2_LO)] = "WAVE_RAM2_LO",
0, [GBA_REG(WAVE_RAM2_HI)] = "WAVE_RAM2_HI",
"SOUNDBIAS", [GBA_REG(WAVE_RAM3_LO)] = "WAVE_RAM3_LO",
0, [GBA_REG(WAVE_RAM3_HI)] = "WAVE_RAM3_HI",
0, [GBA_REG(FIFO_A_LO)] = "FIFO_A_LO",
0, [GBA_REG(FIFO_A_HI)] = "FIFO_A_HI",
"WAVE_RAM0_LO", [GBA_REG(FIFO_B_LO)] = "FIFO_B_LO",
"WAVE_RAM0_HI", [GBA_REG(FIFO_B_HI)] = "FIFO_B_HI",
"WAVE_RAM1_LO",
"WAVE_RAM1_HI",
"WAVE_RAM2_LO",
"WAVE_RAM2_HI",
"WAVE_RAM3_LO",
"WAVE_RAM3_HI",
"FIFO_A_LO",
"FIFO_A_HI",
"FIFO_B_LO",
"FIFO_B_HI",
0,
0,
0,
0,
// DMA // DMA
"DMA0SAD_LO", [GBA_REG(DMA0SAD_LO)] = "DMA0SAD_LO",
"DMA0SAD_HI", [GBA_REG(DMA0SAD_HI)] = "DMA0SAD_HI",
"DMA0DAD_LO", [GBA_REG(DMA0DAD_LO)] = "DMA0DAD_LO",
"DMA0DAD_HI", [GBA_REG(DMA0DAD_HI)] = "DMA0DAD_HI",
"DMA0CNT_LO", [GBA_REG(DMA0CNT_LO)] = "DMA0CNT_LO",
"DMA0CNT_HI", [GBA_REG(DMA0CNT_HI)] = "DMA0CNT_HI",
"DMA1SAD_LO", [GBA_REG(DMA1SAD_LO)] = "DMA1SAD_LO",
"DMA1SAD_HI", [GBA_REG(DMA1SAD_HI)] = "DMA1SAD_HI",
"DMA1DAD_LO", [GBA_REG(DMA1DAD_LO)] = "DMA1DAD_LO",
"DMA1DAD_HI", [GBA_REG(DMA1DAD_HI)] = "DMA1DAD_HI",
"DMA1CNT_LO", [GBA_REG(DMA1CNT_LO)] = "DMA1CNT_LO",
"DMA1CNT_HI", [GBA_REG(DMA1CNT_HI)] = "DMA1CNT_HI",
"DMA2SAD_LO", [GBA_REG(DMA2SAD_LO)] = "DMA2SAD_LO",
"DMA2SAD_HI", [GBA_REG(DMA2SAD_HI)] = "DMA2SAD_HI",
"DMA2DAD_LO", [GBA_REG(DMA2DAD_LO)] = "DMA2DAD_LO",
"DMA2DAD_HI", [GBA_REG(DMA2DAD_HI)] = "DMA2DAD_HI",
"DMA2CNT_LO", [GBA_REG(DMA2CNT_LO)] = "DMA2CNT_LO",
"DMA2CNT_HI", [GBA_REG(DMA2CNT_HI)] = "DMA2CNT_HI",
"DMA3SAD_LO", [GBA_REG(DMA3SAD_LO)] = "DMA3SAD_LO",
"DMA3SAD_HI", [GBA_REG(DMA3SAD_HI)] = "DMA3SAD_HI",
"DMA3DAD_LO", [GBA_REG(DMA3DAD_LO)] = "DMA3DAD_LO",
"DMA3DAD_HI", [GBA_REG(DMA3DAD_HI)] = "DMA3DAD_HI",
"DMA3CNT_LO", [GBA_REG(DMA3CNT_LO)] = "DMA3CNT_LO",
"DMA3CNT_HI", [GBA_REG(DMA3CNT_HI)] = "DMA3CNT_HI",
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
// Timers // Timers
"TM0CNT_LO", [GBA_REG(TM0CNT_LO)] = "TM0CNT_LO",
"TM0CNT_HI", [GBA_REG(TM0CNT_HI)] = "TM0CNT_HI",
"TM1CNT_LO", [GBA_REG(TM1CNT_LO)] = "TM1CNT_LO",
"TM1CNT_HI", [GBA_REG(TM1CNT_HI)] = "TM1CNT_HI",
"TM2CNT_LO", [GBA_REG(TM2CNT_LO)] = "TM2CNT_LO",
"TM2CNT_HI", [GBA_REG(TM2CNT_HI)] = "TM2CNT_HI",
"TM3CNT_LO", [GBA_REG(TM3CNT_LO)] = "TM3CNT_LO",
"TM3CNT_HI", [GBA_REG(TM3CNT_HI)] = "TM3CNT_HI",
0, 0, 0, 0, 0, 0, 0, 0,
// SIO // SIO
"SIOMULTI0", [GBA_REG(SIOMULTI0)] = "SIOMULTI0",
"SIOMULTI1", [GBA_REG(SIOMULTI1)] = "SIOMULTI1",
"SIOMULTI2", [GBA_REG(SIOMULTI2)] = "SIOMULTI2",
"SIOMULTI3", [GBA_REG(SIOMULTI3)] = "SIOMULTI3",
"SIOCNT", [GBA_REG(SIOCNT)] = "SIOCNT",
"SIOMLT_SEND", [GBA_REG(SIOMLT_SEND)] = "SIOMLT_SEND",
0, [GBA_REG(KEYINPUT)] = "KEYINPUT",
0, [GBA_REG(KEYCNT)] = "KEYCNT",
"KEYINPUT", [GBA_REG(RCNT)] = "RCNT",
"KEYCNT", [GBA_REG(JOYCNT)] = "JOYCNT",
"RCNT", [GBA_REG(JOY_RECV_LO)] = "JOY_RECV_LO",
0, [GBA_REG(JOY_RECV_HI)] = "JOY_RECV_HI",
0, [GBA_REG(JOY_TRANS_LO)] = "JOY_TRANS_LO",
0, [GBA_REG(JOY_TRANS_HI)] = "JOY_TRANS_HI",
0, [GBA_REG(JOYSTAT)] = "JOYSTAT",
0,
"JOYCNT",
0,
0,
0,
0,
0,
0,
0,
"JOY_RECV_LO",
"JOY_RECV_HI",
"JOY_TRANS_LO",
"JOY_TRANS_HI",
"JOYSTAT",
0,
0,
0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
// Interrupts, etc // Interrupts, etc
"IE", [GBA_REG(IE)] = "IE",
"IF", [GBA_REG(IF)] = "IF",
"WAITCNT", [GBA_REG(WAITCNT)] = "WAITCNT",
0, [GBA_REG(IME)] = "IME",
"IME"
}; };
static const int _isValidRegister[REG_INTERNAL_MAX >> 1] = { static const int _isValidRegister[REG_INTERNAL_MAX >> 1] = {