/* The parts of devkitPro's libgba that mGBA's gbatests/keyirq/src/main.c uses, so that file * builds unchanged with the Arm GNU toolchain gba-python pins (no devkitARM here). * * Text goes to a console buffer in EWRAM (shim.c) instead of the screen: the runner reads it * there (scripts/run_test_roms.py, suite "keyirq"). Register names and IRQ bits are libgba's * (GBATEK "Keypad Input", "Interrupt Control"). */ #ifndef GBA_SHIM_H #define GBA_SHIM_H #include #include #define REG_IME (*(volatile uint16_t *)0x04000208) #define REG_IE (*(volatile uint16_t *)0x04000200) #define REG_IF (*(volatile uint16_t *)0x04000202) #define REG_DISPSTAT (*(volatile uint16_t *)0x04000004) #define REG_KEYINPUT (*(volatile uint16_t *)0x04000130) #define REG_KEYCNT (*(volatile uint16_t *)0x04000132) #define BG_PALETTE ((volatile uint16_t *)0x05000000) #define IRQ_VBLANK 0x0001 #define IRQ_KEYPAD 0x1000 void irqInit(void); void irqEnable(int mask); void consoleDemoInit(void); static inline void VBlankIntrWait(void) { __asm__ __volatile__("swi 0x05" ::: "r0", "r1", "r2", "r3", "memory"); } #endif