mirror of https://github.com/mgba-emu/mgba.git
GBA I/O: More legibility improvements
This commit is contained in:
parent
bcb0073a4a
commit
4c03970ffe
|
@ -12,6 +12,8 @@ CXX_GUARD_START
|
|||
|
||||
#include <mgba/core/log.h>
|
||||
|
||||
#define GBA_REG(X) (REG_ ## X >> 1)
|
||||
|
||||
enum GBAIORegisters {
|
||||
// Video
|
||||
REG_DISPCNT = 0x000,
|
||||
|
|
291
src/gba/io.c
291
src/gba/io.c
|
@ -14,189 +14,134 @@ mLOG_DEFINE_CATEGORY(GBA_IO, "GBA I/O", "gba.io");
|
|||
|
||||
const char* const GBAIORegisterNames[] = {
|
||||
// Video
|
||||
"DISPCNT",
|
||||
0,
|
||||
"DISPSTAT",
|
||||
"VCOUNT",
|
||||
"BG0CNT",
|
||||
"BG1CNT",
|
||||
"BG2CNT",
|
||||
"BG3CNT",
|
||||
"BG0HOFS",
|
||||
"BG0VOFS",
|
||||
"BG1HOFS",
|
||||
"BG1VOFS",
|
||||
"BG2HOFS",
|
||||
"BG2VOFS",
|
||||
"BG3HOFS",
|
||||
"BG3VOFS",
|
||||
"BG2PA",
|
||||
"BG2PB",
|
||||
"BG2PC",
|
||||
"BG2PD",
|
||||
"BG2X_LO",
|
||||
"BG2X_HI",
|
||||
"BG2Y_LO",
|
||||
"BG2Y_HI",
|
||||
"BG3PA",
|
||||
"BG3PB",
|
||||
"BG3PC",
|
||||
"BG3PD",
|
||||
"BG3X_LO",
|
||||
"BG3X_HI",
|
||||
"BG3Y_LO",
|
||||
"BG3Y_HI",
|
||||
"WIN0H",
|
||||
"WIN1H",
|
||||
"WIN0V",
|
||||
"WIN1V",
|
||||
"WININ",
|
||||
"WINOUT",
|
||||
"MOSAIC",
|
||||
0,
|
||||
"BLDCNT",
|
||||
"BLDALPHA",
|
||||
"BLDY",
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
[GBA_REG(DISPCNT)] = "DISPCNT",
|
||||
[GBA_REG(DISPSTAT)] = "DISPSTAT",
|
||||
[GBA_REG(VCOUNT)] = "VCOUNT",
|
||||
[GBA_REG(BG0CNT)] = "BG0CNT",
|
||||
[GBA_REG(BG1CNT)] = "BG1CNT",
|
||||
[GBA_REG(BG2CNT)] = "BG2CNT",
|
||||
[GBA_REG(BG3CNT)] = "BG3CNT",
|
||||
[GBA_REG(BG0HOFS)] = "BG0HOFS",
|
||||
[GBA_REG(BG0VOFS)] = "BG0VOFS",
|
||||
[GBA_REG(BG1HOFS)] = "BG1HOFS",
|
||||
[GBA_REG(BG1VOFS)] = "BG1VOFS",
|
||||
[GBA_REG(BG2HOFS)] = "BG2HOFS",
|
||||
[GBA_REG(BG2VOFS)] = "BG2VOFS",
|
||||
[GBA_REG(BG3HOFS)] = "BG3HOFS",
|
||||
[GBA_REG(BG3VOFS)] = "BG3VOFS",
|
||||
[GBA_REG(BG2PA)] = "BG2PA",
|
||||
[GBA_REG(BG2PB)] = "BG2PB",
|
||||
[GBA_REG(BG2PC)] = "BG2PC",
|
||||
[GBA_REG(BG2PD)] = "BG2PD",
|
||||
[GBA_REG(BG2X_LO)] = "BG2X_LO",
|
||||
[GBA_REG(BG2X_HI)] = "BG2X_HI",
|
||||
[GBA_REG(BG2Y_LO)] = "BG2Y_LO",
|
||||
[GBA_REG(BG2Y_HI)] = "BG2Y_HI",
|
||||
[GBA_REG(BG3PA)] = "BG3PA",
|
||||
[GBA_REG(BG3PB)] = "BG3PB",
|
||||
[GBA_REG(BG3PC)] = "BG3PC",
|
||||
[GBA_REG(BG3PD)] = "BG3PD",
|
||||
[GBA_REG(BG3X_LO)] = "BG3X_LO",
|
||||
[GBA_REG(BG3X_HI)] = "BG3X_HI",
|
||||
[GBA_REG(BG3Y_LO)] = "BG3Y_LO",
|
||||
[GBA_REG(BG3Y_HI)] = "BG3Y_HI",
|
||||
[GBA_REG(WIN0H)] = "WIN0H",
|
||||
[GBA_REG(WIN1H)] = "WIN1H",
|
||||
[GBA_REG(WIN0V)] = "WIN0V",
|
||||
[GBA_REG(WIN1V)] = "WIN1V",
|
||||
[GBA_REG(WININ)] = "WININ",
|
||||
[GBA_REG(WINOUT)] = "WINOUT",
|
||||
[GBA_REG(MOSAIC)] = "MOSAIC",
|
||||
[GBA_REG(BLDCNT)] = "BLDCNT",
|
||||
[GBA_REG(BLDALPHA)] = "BLDALPHA",
|
||||
[GBA_REG(BLDY)] = "BLDY",
|
||||
|
||||
// Sound
|
||||
"SOUND1CNT_LO",
|
||||
"SOUND1CNT_HI",
|
||||
"SOUND1CNT_X",
|
||||
0,
|
||||
"SOUND2CNT_LO",
|
||||
0,
|
||||
"SOUND2CNT_HI",
|
||||
0,
|
||||
"SOUND3CNT_LO",
|
||||
"SOUND3CNT_HI",
|
||||
"SOUND3CNT_X",
|
||||
0,
|
||||
"SOUND4CNT_LO",
|
||||
0,
|
||||
"SOUND4CNT_HI",
|
||||
0,
|
||||
"SOUNDCNT_LO",
|
||||
"SOUNDCNT_HI",
|
||||
"SOUNDCNT_X",
|
||||
0,
|
||||
"SOUNDBIAS",
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
"WAVE_RAM0_LO",
|
||||
"WAVE_RAM0_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,
|
||||
[GBA_REG(SOUND1CNT_LO)] = "SOUND1CNT_LO",
|
||||
[GBA_REG(SOUND1CNT_HI)] = "SOUND1CNT_HI",
|
||||
[GBA_REG(SOUND1CNT_X)] = "SOUND1CNT_X",
|
||||
[GBA_REG(SOUND2CNT_LO)] = "SOUND2CNT_LO",
|
||||
[GBA_REG(SOUND2CNT_HI)] = "SOUND2CNT_HI",
|
||||
[GBA_REG(SOUND3CNT_LO)] = "SOUND3CNT_LO",
|
||||
[GBA_REG(SOUND3CNT_HI)] = "SOUND3CNT_HI",
|
||||
[GBA_REG(SOUND3CNT_X)] = "SOUND3CNT_X",
|
||||
[GBA_REG(SOUND4CNT_LO)] = "SOUND4CNT_LO",
|
||||
[GBA_REG(SOUND4CNT_HI)] = "SOUND4CNT_HI",
|
||||
[GBA_REG(SOUNDCNT_LO)] = "SOUNDCNT_LO",
|
||||
[GBA_REG(SOUNDCNT_HI)] = "SOUNDCNT_HI",
|
||||
[GBA_REG(SOUNDCNT_X)] = "SOUNDCNT_X",
|
||||
[GBA_REG(SOUNDBIAS)] = "SOUNDBIAS",
|
||||
[GBA_REG(WAVE_RAM0_LO)] = "WAVE_RAM0_LO",
|
||||
[GBA_REG(WAVE_RAM0_HI)] = "WAVE_RAM0_HI",
|
||||
[GBA_REG(WAVE_RAM1_LO)] = "WAVE_RAM1_LO",
|
||||
[GBA_REG(WAVE_RAM1_HI)] = "WAVE_RAM1_HI",
|
||||
[GBA_REG(WAVE_RAM2_LO)] = "WAVE_RAM2_LO",
|
||||
[GBA_REG(WAVE_RAM2_HI)] = "WAVE_RAM2_HI",
|
||||
[GBA_REG(WAVE_RAM3_LO)] = "WAVE_RAM3_LO",
|
||||
[GBA_REG(WAVE_RAM3_HI)] = "WAVE_RAM3_HI",
|
||||
[GBA_REG(FIFO_A_LO)] = "FIFO_A_LO",
|
||||
[GBA_REG(FIFO_A_HI)] = "FIFO_A_HI",
|
||||
[GBA_REG(FIFO_B_LO)] = "FIFO_B_LO",
|
||||
[GBA_REG(FIFO_B_HI)] = "FIFO_B_HI",
|
||||
|
||||
// DMA
|
||||
"DMA0SAD_LO",
|
||||
"DMA0SAD_HI",
|
||||
"DMA0DAD_LO",
|
||||
"DMA0DAD_HI",
|
||||
"DMA0CNT_LO",
|
||||
"DMA0CNT_HI",
|
||||
"DMA1SAD_LO",
|
||||
"DMA1SAD_HI",
|
||||
"DMA1DAD_LO",
|
||||
"DMA1DAD_HI",
|
||||
"DMA1CNT_LO",
|
||||
"DMA1CNT_HI",
|
||||
"DMA2SAD_LO",
|
||||
"DMA2SAD_HI",
|
||||
"DMA2DAD_LO",
|
||||
"DMA2DAD_HI",
|
||||
"DMA2CNT_LO",
|
||||
"DMA2CNT_HI",
|
||||
"DMA3SAD_LO",
|
||||
"DMA3SAD_HI",
|
||||
"DMA3DAD_LO",
|
||||
"DMA3DAD_HI",
|
||||
"DMA3CNT_LO",
|
||||
"DMA3CNT_HI",
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
[GBA_REG(DMA0SAD_LO)] = "DMA0SAD_LO",
|
||||
[GBA_REG(DMA0SAD_HI)] = "DMA0SAD_HI",
|
||||
[GBA_REG(DMA0DAD_LO)] = "DMA0DAD_LO",
|
||||
[GBA_REG(DMA0DAD_HI)] = "DMA0DAD_HI",
|
||||
[GBA_REG(DMA0CNT_LO)] = "DMA0CNT_LO",
|
||||
[GBA_REG(DMA0CNT_HI)] = "DMA0CNT_HI",
|
||||
[GBA_REG(DMA1SAD_LO)] = "DMA1SAD_LO",
|
||||
[GBA_REG(DMA1SAD_HI)] = "DMA1SAD_HI",
|
||||
[GBA_REG(DMA1DAD_LO)] = "DMA1DAD_LO",
|
||||
[GBA_REG(DMA1DAD_HI)] = "DMA1DAD_HI",
|
||||
[GBA_REG(DMA1CNT_LO)] = "DMA1CNT_LO",
|
||||
[GBA_REG(DMA1CNT_HI)] = "DMA1CNT_HI",
|
||||
[GBA_REG(DMA2SAD_LO)] = "DMA2SAD_LO",
|
||||
[GBA_REG(DMA2SAD_HI)] = "DMA2SAD_HI",
|
||||
[GBA_REG(DMA2DAD_LO)] = "DMA2DAD_LO",
|
||||
[GBA_REG(DMA2DAD_HI)] = "DMA2DAD_HI",
|
||||
[GBA_REG(DMA2CNT_LO)] = "DMA2CNT_LO",
|
||||
[GBA_REG(DMA2CNT_HI)] = "DMA2CNT_HI",
|
||||
[GBA_REG(DMA3SAD_LO)] = "DMA3SAD_LO",
|
||||
[GBA_REG(DMA3SAD_HI)] = "DMA3SAD_HI",
|
||||
[GBA_REG(DMA3DAD_LO)] = "DMA3DAD_LO",
|
||||
[GBA_REG(DMA3DAD_HI)] = "DMA3DAD_HI",
|
||||
[GBA_REG(DMA3CNT_LO)] = "DMA3CNT_LO",
|
||||
[GBA_REG(DMA3CNT_HI)] = "DMA3CNT_HI",
|
||||
|
||||
// Timers
|
||||
"TM0CNT_LO",
|
||||
"TM0CNT_HI",
|
||||
"TM1CNT_LO",
|
||||
"TM1CNT_HI",
|
||||
"TM2CNT_LO",
|
||||
"TM2CNT_HI",
|
||||
"TM3CNT_LO",
|
||||
"TM3CNT_HI",
|
||||
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
[GBA_REG(TM0CNT_LO)] = "TM0CNT_LO",
|
||||
[GBA_REG(TM0CNT_HI)] = "TM0CNT_HI",
|
||||
[GBA_REG(TM1CNT_LO)] = "TM1CNT_LO",
|
||||
[GBA_REG(TM1CNT_HI)] = "TM1CNT_HI",
|
||||
[GBA_REG(TM2CNT_LO)] = "TM2CNT_LO",
|
||||
[GBA_REG(TM2CNT_HI)] = "TM2CNT_HI",
|
||||
[GBA_REG(TM3CNT_LO)] = "TM3CNT_LO",
|
||||
[GBA_REG(TM3CNT_HI)] = "TM3CNT_HI",
|
||||
|
||||
// SIO
|
||||
"SIOMULTI0",
|
||||
"SIOMULTI1",
|
||||
"SIOMULTI2",
|
||||
"SIOMULTI3",
|
||||
"SIOCNT",
|
||||
"SIOMLT_SEND",
|
||||
0,
|
||||
0,
|
||||
"KEYINPUT",
|
||||
"KEYCNT",
|
||||
"RCNT",
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
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,
|
||||
[GBA_REG(SIOMULTI0)] = "SIOMULTI0",
|
||||
[GBA_REG(SIOMULTI1)] = "SIOMULTI1",
|
||||
[GBA_REG(SIOMULTI2)] = "SIOMULTI2",
|
||||
[GBA_REG(SIOMULTI3)] = "SIOMULTI3",
|
||||
[GBA_REG(SIOCNT)] = "SIOCNT",
|
||||
[GBA_REG(SIOMLT_SEND)] = "SIOMLT_SEND",
|
||||
[GBA_REG(KEYINPUT)] = "KEYINPUT",
|
||||
[GBA_REG(KEYCNT)] = "KEYCNT",
|
||||
[GBA_REG(RCNT)] = "RCNT",
|
||||
[GBA_REG(JOYCNT)] = "JOYCNT",
|
||||
[GBA_REG(JOY_RECV_LO)] = "JOY_RECV_LO",
|
||||
[GBA_REG(JOY_RECV_HI)] = "JOY_RECV_HI",
|
||||
[GBA_REG(JOY_TRANS_LO)] = "JOY_TRANS_LO",
|
||||
[GBA_REG(JOY_TRANS_HI)] = "JOY_TRANS_HI",
|
||||
[GBA_REG(JOYSTAT)] = "JOYSTAT",
|
||||
|
||||
// Interrupts, etc
|
||||
"IE",
|
||||
"IF",
|
||||
"WAITCNT",
|
||||
0,
|
||||
"IME"
|
||||
[GBA_REG(IE)] = "IE",
|
||||
[GBA_REG(IF)] = "IF",
|
||||
[GBA_REG(WAITCNT)] = "WAITCNT",
|
||||
[GBA_REG(IME)] = "IME",
|
||||
};
|
||||
|
||||
static const int _isValidRegister[REG_INTERNAL_MAX >> 1] = {
|
||||
|
|
Loading…
Reference in New Issue