diff options
Diffstat (limited to 'arm9/lib/include')
-rw-r--r-- | arm9/lib/include/GX_bgcnt.h | 414 | ||||
-rw-r--r-- | arm9/lib/include/GX_g2.h | 80 | ||||
-rw-r--r-- | arm9/lib/include/GX_vramcnt.h | 24 | ||||
-rw-r--r-- | arm9/lib/include/OS_interrupt.h | 2 | ||||
-rw-r--r-- | arm9/lib/include/fx.h | 3 | ||||
-rw-r--r-- | arm9/lib/include/gx.h | 40 | ||||
-rw-r--r-- | arm9/lib/include/registers.h | 375 |
7 files changed, 922 insertions, 16 deletions
diff --git a/arm9/lib/include/GX_bgcnt.h b/arm9/lib/include/GX_bgcnt.h index a581443e..b64d4432 100644 --- a/arm9/lib/include/GX_bgcnt.h +++ b/arm9/lib/include/GX_bgcnt.h @@ -285,6 +285,14 @@ typedef enum } GXBGExtPltt; +typedef enum +{ + GX_BG_EXTMODE_256x16PLTT = (0 << REG_G2_BG2CNT_CHARBASE_SHIFT) | (0 << REG_G2_BG2CNT_COLORMODE_SHIFT), + GX_BG_EXTMODE_256BITMAP = (0 << REG_G2_BG2CNT_CHARBASE_SHIFT) | (1 << REG_G2_BG2CNT_COLORMODE_SHIFT), + GX_BG_EXTMODE_DCBITMAP = (1 << REG_G2_BG2CNT_CHARBASE_SHIFT) | (1 << REG_G2_BG2CNT_COLORMODE_SHIFT) +} +GXBGExtMode; + //GX_capture typedef enum { @@ -344,4 +352,410 @@ typedef enum } GXCaptureMode; +static inline void G2_SetBG0Control(GXBGScrSizeText screenSize, GXBGColorMode colorMode, GXBGScrBase screenBase, GXBGCharBase charBase, GXBGExtPltt bgExtPltt) +{ + reg_G2_BG0CNT = (u16)((reg_G2_BG0CNT & (REG_G2_BG0CNT_PRIORITY_MASK | REG_G2_BG0CNT_MOSAIC_MASK)) | (screenSize << REG_G2_BG0CNT_SCREENSIZE_SHIFT) | (colorMode << REG_G2_BG0CNT_COLORMODE_SHIFT) | (screenBase << REG_G2_BG0CNT_SCREENBASE_SHIFT) | (charBase << REG_G2_BG0CNT_CHARBASE_SHIFT) | (bgExtPltt << REG_G2_BG0CNT_BGPLTTSLOT_SHIFT)); +} + +static inline void G2S_SetBG0Control(GXBGScrSizeText screenSize, GXBGColorMode colorMode, GXBGScrBase screenBase, GXBGCharBase charBase, GXBGExtPltt bgExtPltt) +{ + reg_G2S_DB_BG0CNT = (u16)((reg_G2S_DB_BG0CNT & (REG_G2S_DB_BG0CNT_PRIORITY_MASK | REG_G2S_DB_BG0CNT_MOSAIC_MASK)) | (screenSize << REG_G2S_DB_BG0CNT_SCREENSIZE_SHIFT) | (colorMode << REG_G2S_DB_BG0CNT_COLORMODE_SHIFT) | (screenBase << REG_G2S_DB_BG0CNT_SCREENBASE_SHIFT) | (charBase << REG_G2S_DB_BG0CNT_CHARBASE_SHIFT) | (bgExtPltt << REG_G2S_DB_BG0CNT_BGPLTTSLOT_SHIFT)); +} + +static inline void G2_SetBG1Control(GXBGScrSizeText screenSize, GXBGColorMode colorMode, GXBGScrBase screenBase, GXBGCharBase charBase, GXBGExtPltt bgExtPltt) +{ + reg_G2_BG1CNT = (u16)((reg_G2_BG1CNT & (REG_G2_BG1CNT_PRIORITY_MASK | REG_G2_BG1CNT_MOSAIC_MASK)) | (screenSize << REG_G2_BG1CNT_SCREENSIZE_SHIFT) | (colorMode << REG_G2_BG1CNT_COLORMODE_SHIFT) | (screenBase << REG_G2_BG1CNT_SCREENBASE_SHIFT) | (charBase << REG_G2_BG1CNT_CHARBASE_SHIFT) | (bgExtPltt << REG_G2_BG1CNT_BGPLTTSLOT_SHIFT)); +} + +static inline void G2S_SetBG1Control(GXBGScrSizeText screenSize, GXBGColorMode colorMode, GXBGScrBase screenBase, GXBGCharBase charBase, GXBGExtPltt bgExtPltt) +{ + reg_G2S_DB_BG1CNT = (u16)((reg_G2S_DB_BG1CNT & (REG_G2S_DB_BG1CNT_PRIORITY_MASK | REG_G2S_DB_BG1CNT_MOSAIC_MASK)) | (screenSize << REG_G2S_DB_BG1CNT_SCREENSIZE_SHIFT) | (colorMode << REG_G2S_DB_BG1CNT_COLORMODE_SHIFT) | (screenBase << REG_G2S_DB_BG1CNT_SCREENBASE_SHIFT) | (charBase << REG_G2S_DB_BG1CNT_CHARBASE_SHIFT) | (bgExtPltt << REG_G2S_DB_BG1CNT_BGPLTTSLOT_SHIFT)); +} + +static inline void G2_SetBG2ControlText(GXBGScrSizeText screenSize, GXBGColorMode colorMode, GXBGScrBase screenBase, GXBGCharBase charBase) +{ + reg_G2_BG2CNT = (u16)((reg_G2_BG2CNT & ((REG_G2_BG2CNT_PRIORITY_MASK | REG_G2_BG2CNT_MOSAIC_MASK))) | (screenSize << REG_G2_BG2CNT_SCREENSIZE_SHIFT) | (colorMode << REG_G2_BG2CNT_COLORMODE_SHIFT) | (screenBase << REG_G2_BG2CNT_SCREENBASE_SHIFT) | (charBase << REG_G2_BG2CNT_CHARBASE_SHIFT)); +} + +static inline void G2S_SetBG2ControlText(GXBGScrSizeText screenSize, GXBGColorMode colorMode, GXBGScrBase screenBase, GXBGCharBase charBase) +{ + reg_G2S_DB_BG2CNT = (u16)((reg_G2S_DB_BG2CNT & ((REG_G2S_DB_BG2CNT_PRIORITY_MASK | REG_G2S_DB_BG2CNT_MOSAIC_MASK))) | (screenSize << REG_G2S_DB_BG2CNT_SCREENSIZE_SHIFT) | (colorMode << REG_G2S_DB_BG2CNT_COLORMODE_SHIFT) | (screenBase << REG_G2S_DB_BG2CNT_SCREENBASE_SHIFT) | (charBase << REG_G2S_DB_BG2CNT_CHARBASE_SHIFT)); +} + +static inline void G2_SetBG2ControlAffine(GXBGScrSizeAffine screenSize, GXBGAreaOver areaOver, GXBGScrBase screenBase, GXBGCharBase charBase) +{ + reg_G2_BG2CNT = (u16)((reg_G2_BG2CNT & ((REG_G2_BG2CNT_PRIORITY_MASK | REG_G2_BG2CNT_MOSAIC_MASK))) | (screenSize << REG_G2_BG2CNT_SCREENSIZE_SHIFT) | (screenBase << REG_G2_BG2CNT_SCREENBASE_SHIFT) | (charBase << REG_G2_BG2CNT_CHARBASE_SHIFT) | (areaOver << REG_G2_BG2CNT_AREAOVER_SHIFT)); +} + +static inline void G2S_SetBG2ControlAffine(GXBGScrSizeAffine screenSize, GXBGAreaOver areaOver, GXBGScrBase screenBase, GXBGCharBase charBase) +{ + reg_G2S_DB_BG2CNT = (u16)((reg_G2S_DB_BG2CNT & ((REG_G2S_DB_BG2CNT_PRIORITY_MASK | REG_G2S_DB_BG2CNT_MOSAIC_MASK))) | (screenSize << REG_G2S_DB_BG2CNT_SCREENSIZE_SHIFT) | (screenBase << REG_G2S_DB_BG2CNT_SCREENBASE_SHIFT) | (charBase << REG_G2S_DB_BG2CNT_CHARBASE_SHIFT) | (areaOver << REG_G2S_DB_BG2CNT_AREAOVER_SHIFT)); +} + +static inline void G2_SetBG2Control256x16Pltt(GXBGScrSize256x16Pltt screenSize, GXBGAreaOver areaOver, GXBGScrBase screenBase, GXBGCharBase charBase) +{ + reg_G2_BG2CNT = (u16)((reg_G2_BG2CNT & (REG_G2_BG2CNT_PRIORITY_MASK | REG_G2_BG2CNT_MOSAIC_MASK)) | (screenSize << REG_G2_BG2CNT_SCREENSIZE_SHIFT) | (charBase << REG_G2_BG2CNT_CHARBASE_SHIFT) | GX_BG_EXTMODE_256x16PLTT | (screenBase << REG_G2_BG2CNT_SCREENBASE_SHIFT) | (areaOver << REG_G2_BG2CNT_AREAOVER_SHIFT)); +} + +static inline void G2S_SetBG2Control256x16Pltt(GXBGScrSize256x16Pltt screenSize, GXBGAreaOver areaOver, GXBGScrBase screenBase, GXBGCharBase charBase) +{ + reg_G2S_DB_BG2CNT = (u16)((reg_G2S_DB_BG2CNT & (REG_G2S_DB_BG2CNT_PRIORITY_MASK | REG_G2S_DB_BG2CNT_MOSAIC_MASK)) | (screenSize << REG_G2S_DB_BG2CNT_SCREENSIZE_SHIFT) | (charBase << REG_G2S_DB_BG2CNT_CHARBASE_SHIFT) | GX_BG_EXTMODE_256x16PLTT | (screenBase << REG_G2S_DB_BG2CNT_SCREENBASE_SHIFT) | (areaOver << REG_G2S_DB_BG2CNT_AREAOVER_SHIFT)); +} + +static inline void G2_SetBG2Control256Bmp(GXBGScrSize256Bmp screenSize, GXBGAreaOver areaOver, GXBGBmpScrBase screenBase) +{ + reg_G2_BG2CNT = (u16)((reg_G2_BG2CNT & (REG_G2_BG2CNT_PRIORITY_MASK | REG_G2_BG2CNT_MOSAIC_MASK)) | (screenSize << REG_G2_BG2CNT_SCREENSIZE_SHIFT) | GX_BG_EXTMODE_256BITMAP | (screenBase << REG_G2_BG2CNT_SCREENBASE_SHIFT) | (areaOver << REG_G2_BG2CNT_AREAOVER_SHIFT)); +} + +static inline void G2S_SetBG2Control256Bmp(GXBGScrSize256Bmp screenSize, GXBGAreaOver areaOver, GXBGBmpScrBase screenBase) +{ + reg_G2S_DB_BG2CNT = (u16)((reg_G2S_DB_BG2CNT & (REG_G2S_DB_BG2CNT_PRIORITY_MASK | REG_G2S_DB_BG2CNT_MOSAIC_MASK)) | (screenSize << REG_G2S_DB_BG2CNT_SCREENSIZE_SHIFT) | GX_BG_EXTMODE_256BITMAP | (screenBase << REG_G2S_DB_BG2CNT_SCREENBASE_SHIFT) | (areaOver << REG_G2S_DB_BG2CNT_AREAOVER_SHIFT)); +} + +static inline void G2_SetBG2ControlDCBmp(GXBGScrSizeDcBmp screenSize, GXBGAreaOver areaOver, GXBGBmpScrBase screenBase) +{ + reg_G2_BG2CNT = (u16)((reg_G2_BG2CNT & (REG_G2_BG2CNT_PRIORITY_MASK | REG_G2_BG2CNT_MOSAIC_MASK)) | (screenSize << REG_G2_BG2CNT_SCREENSIZE_SHIFT) | GX_BG_EXTMODE_DCBITMAP | (screenBase << REG_G2_BG2CNT_SCREENBASE_SHIFT) | (areaOver << REG_G2_BG2CNT_AREAOVER_SHIFT)); +} + +static inline void G2S_SetBG2ControlDCBmp(GXBGScrSizeDcBmp screenSize, GXBGAreaOver areaOver, GXBGBmpScrBase screenBase) +{ + reg_G2S_DB_BG2CNT = (u16)((reg_G2S_DB_BG2CNT & (REG_G2S_DB_BG2CNT_PRIORITY_MASK | REG_G2S_DB_BG2CNT_MOSAIC_MASK)) | (screenSize << REG_G2S_DB_BG2CNT_SCREENSIZE_SHIFT) | GX_BG_EXTMODE_DCBITMAP | (screenBase << REG_G2S_DB_BG2CNT_SCREENBASE_SHIFT) | (areaOver << REG_G2S_DB_BG2CNT_AREAOVER_SHIFT)); +} + +static inline void G2_SetBG2ControlLargeBmp(GXBGScrSizeLargeBmp screenSize, GXBGAreaOver areaOver) +{ + reg_G2_BG2CNT = (u16)((reg_G2_BG2CNT & (REG_G2_BG2CNT_PRIORITY_MASK | REG_G2_BG2CNT_MOSAIC_MASK)) | (screenSize << REG_G2_BG2CNT_SCREENSIZE_SHIFT) | (areaOver << REG_G2_BG2CNT_AREAOVER_SHIFT)); +} + +static inline void G2S_SetBG2ControlLargeBmp(GXBGScrSizeLargeBmp screenSize, GXBGAreaOver areaOver) +{ + reg_G2S_DB_BG2CNT = (u16)((reg_G2S_DB_BG2CNT & (REG_G2S_DB_BG2CNT_PRIORITY_MASK | REG_G2S_DB_BG2CNT_MOSAIC_MASK)) | (screenSize << REG_G2S_DB_BG2CNT_SCREENSIZE_SHIFT) | (areaOver << REG_G2S_DB_BG2CNT_AREAOVER_SHIFT)); +} + +static inline void G2_SetBG3ControlText(GXBGScrSizeText screenSize, GXBGColorMode colorMode, GXBGScrBase screenBase, GXBGCharBase charBase) +{ + reg_G2_BG3CNT = (u16)((reg_G2_BG3CNT & ((REG_G2_BG3CNT_PRIORITY_MASK | REG_G2_BG3CNT_MOSAIC_MASK))) | (screenSize << REG_G2_BG3CNT_SCREENSIZE_SHIFT) | (colorMode << REG_G2_BG3CNT_COLORMODE_SHIFT) | (screenBase << REG_G2_BG3CNT_SCREENBASE_SHIFT) | (charBase << REG_G2_BG3CNT_CHARBASE_SHIFT)); +} + +static inline void G2S_SetBG3ControlText(GXBGScrSizeText screenSize, GXBGColorMode colorMode, GXBGScrBase screenBase, GXBGCharBase charBase) +{ + reg_G2S_DB_BG3CNT = (u16)((reg_G2S_DB_BG3CNT & ((REG_G2S_DB_BG3CNT_PRIORITY_MASK | REG_G2S_DB_BG3CNT_MOSAIC_MASK))) | (screenSize << REG_G2S_DB_BG3CNT_SCREENSIZE_SHIFT) | (colorMode << REG_G2S_DB_BG3CNT_COLORMODE_SHIFT) | (screenBase << REG_G2S_DB_BG3CNT_SCREENBASE_SHIFT) | (charBase << REG_G2S_DB_BG3CNT_CHARBASE_SHIFT)); +} + +static inline void G2_SetBG3ControlAffine(GXBGScrSizeAffine screenSize, GXBGAreaOver areaOver, GXBGScrBase screenBase, GXBGCharBase charBase) +{ + reg_G2_BG3CNT = (u16)((reg_G2_BG3CNT & ((REG_G2_BG3CNT_PRIORITY_MASK | REG_G2_BG3CNT_MOSAIC_MASK))) | (screenSize << REG_G2_BG3CNT_SCREENSIZE_SHIFT) | (screenBase << REG_G2_BG3CNT_SCREENBASE_SHIFT) | (charBase << REG_G2_BG3CNT_CHARBASE_SHIFT) | (areaOver << REG_G2_BG3CNT_AREAOVER_SHIFT)); +} + +static inline void G2S_SetBG3ControlAffine(GXBGScrSizeAffine screenSize, GXBGAreaOver areaOver, GXBGScrBase screenBase, GXBGCharBase charBase) +{ + reg_G2S_DB_BG3CNT = (u16)((reg_G2S_DB_BG3CNT & ((REG_G2S_DB_BG3CNT_PRIORITY_MASK | REG_G2S_DB_BG3CNT_MOSAIC_MASK))) | (screenSize << REG_G2S_DB_BG3CNT_SCREENSIZE_SHIFT) | (screenBase << REG_G2S_DB_BG3CNT_SCREENBASE_SHIFT) | (charBase << REG_G2S_DB_BG3CNT_CHARBASE_SHIFT) | (areaOver << REG_G2S_DB_BG3CNT_AREAOVER_SHIFT)); +} + +static inline void G2_SetBG3Control256x16Pltt(GXBGScrSize256x16Pltt screenSize, GXBGAreaOver areaOver, GXBGScrBase screenBase, GXBGCharBase charBase) +{ + reg_G2_BG3CNT = (u16)((reg_G2_BG3CNT & (REG_G2_BG3CNT_PRIORITY_MASK | REG_G2_BG3CNT_MOSAIC_MASK)) | (screenSize << REG_G2_BG3CNT_SCREENSIZE_SHIFT) | (charBase << REG_G2_BG3CNT_CHARBASE_SHIFT) | GX_BG_EXTMODE_256x16PLTT | (screenBase << REG_G2_BG3CNT_SCREENBASE_SHIFT) | (areaOver << REG_G2_BG3CNT_AREAOVER_SHIFT)); +} + +static inline void G2S_SetBG3Control256x16Pltt(GXBGScrSize256x16Pltt screenSize, GXBGAreaOver areaOver, GXBGScrBase screenBase, GXBGCharBase charBase) +{ + reg_G2S_DB_BG3CNT = (u16)((reg_G2S_DB_BG3CNT & (REG_G2S_DB_BG3CNT_PRIORITY_MASK | REG_G2S_DB_BG3CNT_MOSAIC_MASK)) | (screenSize << REG_G2S_DB_BG3CNT_SCREENSIZE_SHIFT) | (charBase << REG_G2S_DB_BG3CNT_CHARBASE_SHIFT) | GX_BG_EXTMODE_256x16PLTT | (screenBase << REG_G2S_DB_BG3CNT_SCREENBASE_SHIFT) | (areaOver << REG_G2S_DB_BG3CNT_AREAOVER_SHIFT)); +} + +static inline void G2_SetBG3Control256Bmp(GXBGScrSize256Bmp screenSize, GXBGAreaOver areaOver, GXBGBmpScrBase screenBase) +{ + reg_G2_BG3CNT = (u16)((reg_G2_BG3CNT & (REG_G2_BG3CNT_PRIORITY_MASK | REG_G2_BG3CNT_MOSAIC_MASK)) | (screenSize << REG_G2_BG3CNT_SCREENSIZE_SHIFT) | GX_BG_EXTMODE_256BITMAP | (screenBase << REG_G2_BG3CNT_SCREENBASE_SHIFT) | (areaOver << REG_G2_BG3CNT_AREAOVER_SHIFT)); +} + +static inline void G2S_SetBG3Control256Bmp(GXBGScrSize256Bmp screenSize, GXBGAreaOver areaOver, GXBGBmpScrBase screenBase) +{ + reg_G2S_DB_BG3CNT = (u16)((reg_G2S_DB_BG3CNT & (REG_G2S_DB_BG3CNT_PRIORITY_MASK | REG_G2S_DB_BG3CNT_MOSAIC_MASK)) | (screenSize << REG_G2S_DB_BG3CNT_SCREENSIZE_SHIFT) | GX_BG_EXTMODE_256BITMAP | (screenBase << REG_G2S_DB_BG3CNT_SCREENBASE_SHIFT) | (areaOver << REG_G2S_DB_BG3CNT_AREAOVER_SHIFT)); +} + +static inline void G2_SetBG3ControlDCBmp(GXBGScrSizeDcBmp screenSize, GXBGAreaOver areaOver, GXBGBmpScrBase screenBase) +{ + reg_G2_BG3CNT = (u16)((reg_G2_BG3CNT & (REG_G2_BG3CNT_PRIORITY_MASK | REG_G2_BG3CNT_MOSAIC_MASK)) | (screenSize << REG_G2_BG3CNT_SCREENSIZE_SHIFT) | GX_BG_EXTMODE_DCBITMAP | (screenBase << REG_G2_BG3CNT_SCREENBASE_SHIFT) | (areaOver << REG_G2_BG3CNT_AREAOVER_SHIFT)); +} + +static inline void G2S_SetBG3ControlDCBmp(GXBGScrSizeDcBmp screenSize, GXBGAreaOver areaOver, GXBGBmpScrBase screenBase) +{ + reg_G2S_DB_BG3CNT = (u16)((reg_G2S_DB_BG3CNT & (REG_G2S_DB_BG3CNT_PRIORITY_MASK | REG_G2S_DB_BG3CNT_MOSAIC_MASK)) | (screenSize << REG_G2S_DB_BG3CNT_SCREENSIZE_SHIFT) | GX_BG_EXTMODE_DCBITMAP | (screenBase << REG_G2S_DB_BG3CNT_SCREENBASE_SHIFT) | (areaOver << REG_G2S_DB_BG3CNT_AREAOVER_SHIFT)); +} + +static inline void G2_SetBG3ControlLargeBmp(GXBGScrSizeLargeBmp screenSize, GXBGAreaOver areaOver) +{ + reg_G2_BG3CNT = (u16)((reg_G2_BG3CNT & (REG_G2_BG3CNT_PRIORITY_MASK | REG_G2_BG3CNT_MOSAIC_MASK)) | (screenSize << REG_G2_BG3CNT_SCREENSIZE_SHIFT) | (areaOver << REG_G2_BG3CNT_AREAOVER_SHIFT)); +} + +static inline void G2S_SetBG3ControlLargeBmp(GXBGScrSizeLargeBmp screenSize, GXBGAreaOver areaOver) +{ + reg_G2S_DB_BG3CNT = (u16)((reg_G2S_DB_BG3CNT & (REG_G2S_DB_BG3CNT_PRIORITY_MASK | REG_G2S_DB_BG3CNT_MOSAIC_MASK)) | (screenSize << REG_G2S_DB_BG3CNT_SCREENSIZE_SHIFT) | (areaOver << REG_G2S_DB_BG3CNT_AREAOVER_SHIFT)); +} + +static inline void G2_BG0Mosaic(BOOL enable) +{ + if (enable) + { + reg_G2_BG0CNT |= REG_G2_BG0CNT_MOSAIC_MASK; + } + else + { + reg_G2_BG0CNT &= ~REG_G2_BG0CNT_MOSAIC_MASK; + } +} + +static inline void G2S_BG0Mosaic(BOOL enable) +{ + if (enable) + { + reg_G2S_DB_BG0CNT |= REG_G2S_DB_BG0CNT_MOSAIC_MASK; + } + else + { + reg_G2S_DB_BG0CNT &= ~REG_G2S_DB_BG0CNT_MOSAIC_MASK; + } +} + +static inline void G2_BG1Mosaic(BOOL enable) +{ + if (enable) + { + reg_G2_BG1CNT |= REG_G2_BG1CNT_MOSAIC_MASK; + } + else + { + reg_G2_BG1CNT &= ~REG_G2_BG1CNT_MOSAIC_MASK; + } +} + +static inline void G2S_BG1Mosaic(BOOL enable) +{ + if (enable) + { + reg_G2S_DB_BG1CNT |= REG_G2S_DB_BG1CNT_MOSAIC_MASK; + } + else + { + reg_G2S_DB_BG1CNT &= ~REG_G2S_DB_BG1CNT_MOSAIC_MASK; + } +} + +static inline void G2_BG2Mosaic(BOOL enable) +{ + if (enable) + { + reg_G2_BG2CNT |= REG_G2_BG2CNT_MOSAIC_MASK; + } + else + { + reg_G2_BG2CNT &= ~REG_G2_BG2CNT_MOSAIC_MASK; + } +} + +static inline void G2S_BG2Mosaic(BOOL enable) +{ + if (enable) + { + reg_G2S_DB_BG2CNT |= REG_G2S_DB_BG2CNT_MOSAIC_MASK; + } + else + { + reg_G2S_DB_BG2CNT &= ~REG_G2S_DB_BG2CNT_MOSAIC_MASK; + } +} + +static inline void G2_BG3Mosaic(BOOL enable) +{ + if (enable) + { + reg_G2_BG3CNT |= REG_G2_BG3CNT_MOSAIC_MASK; + } + else + { + reg_G2_BG3CNT &= ~REG_G2_BG3CNT_MOSAIC_MASK; + } +} + +static inline void G2S_BG3Mosaic(BOOL enable) +{ + if (enable) + { + reg_G2S_DB_BG3CNT |= REG_G2S_DB_BG3CNT_MOSAIC_MASK; + } + else + { + reg_G2S_DB_BG3CNT &= ~REG_G2S_DB_BG3CNT_MOSAIC_MASK; + } +} + +static inline void G2_SetBG0Priority(int priority) +{ + reg_G2_BG0CNT = (u16)((reg_G2_BG0CNT & ~REG_G2_BG0CNT_PRIORITY_MASK) | (priority << REG_G2_BG0CNT_PRIORITY_SHIFT)); +} + +static inline void G2S_SetBG0Priority(int priority) +{ + reg_G2S_DB_BG0CNT = (u16)((reg_G2S_DB_BG0CNT & ~REG_G2S_DB_BG0CNT_PRIORITY_MASK) | (priority << REG_G2S_DB_BG0CNT_PRIORITY_SHIFT)); +} + +static inline void G2_SetBG1Priority(int priority) +{ + reg_G2_BG1CNT = (u16)((reg_G2_BG1CNT & ~REG_G2_BG1CNT_PRIORITY_MASK) | (priority << REG_G2_BG1CNT_PRIORITY_SHIFT)); +} + +static inline void G2S_SetBG1Priority(int priority) +{ + reg_G2S_DB_BG1CNT = (u16)((reg_G2S_DB_BG1CNT & ~REG_G2S_DB_BG1CNT_PRIORITY_MASK) | (priority << REG_G2S_DB_BG1CNT_PRIORITY_SHIFT)); +} + +static inline void G2_SetBG2Priority(int priority) +{ + reg_G2_BG2CNT = (u16)((reg_G2_BG2CNT & ~REG_G2_BG2CNT_PRIORITY_MASK) | (priority << REG_G2_BG2CNT_PRIORITY_SHIFT)); +} + +static inline void G2S_SetBG2Priority(int priority) +{ + reg_G2S_DB_BG2CNT = (u16)((reg_G2S_DB_BG2CNT & ~REG_G2S_DB_BG2CNT_PRIORITY_MASK) | (priority << REG_G2S_DB_BG2CNT_PRIORITY_SHIFT)); +} + +static inline void G2_SetBG3Priority(int priority) +{ + reg_G2_BG3CNT = (u16)((reg_G2_BG3CNT & ~REG_G2_BG3CNT_PRIORITY_MASK) | (priority << REG_G2_BG3CNT_PRIORITY_SHIFT)); +} + +static inline void G2S_SetBG3Priority(int priority) +{ + reg_G2S_DB_BG3CNT = (u16)((reg_G2S_DB_BG3CNT & ~REG_G2S_DB_BG3CNT_PRIORITY_MASK) | (priority << REG_G2S_DB_BG3CNT_PRIORITY_SHIFT)); +} + +static inline GXBg01Control G2_GetBG0Control(void) +{ + return *(volatile GXBg01Control *)®_G2_BG0CNT; +} + +static inline GXBg01Control G2S_GetBG0Control(void) +{ + return *(volatile GXBg01Control *)®_G2S_DB_BG0CNT; +} + +static inline GXBg01Control G2_GetBG1Control(void) +{ + return *(volatile GXBg01Control *)®_G2_BG1CNT; +} + +static inline GXBg01Control G2S_GetBG1Control(void) +{ + return *(volatile GXBg01Control *)®_G2S_DB_BG1CNT; +} + +static inline GXBg23ControlText G2_GetBG2ControlText(void) +{ + return *(volatile GXBg23ControlText *)®_G2_BG2CNT; +} + +static inline GXBg23ControlText G2S_GetBG2ControlText(void) +{ + return *(volatile GXBg23ControlText *)®_G2S_DB_BG2CNT; +} + +static inline GXBg23ControlAffine G2_GetBG2ControlAffine(void) +{ + return *(volatile GXBg23ControlAffine *)®_G2_BG2CNT; +} + +static inline GXBg23ControlAffine G2S_GetBG2ControlAffine(void) +{ + return *(volatile GXBg23ControlAffine *)®_G2S_DB_BG2CNT; +} + +static inline GXBg23Control256x16Pltt G2_GetBG2Control256x16Pltt(void) +{ + return *(volatile GXBg23Control256x16Pltt *)®_G2_BG2CNT; +} + +static inline GXBg23Control256x16Pltt G2S_GetBG2Control256x16Pltt(void) +{ + return *(volatile GXBg23Control256x16Pltt *)®_G2S_DB_BG2CNT; +} + +static inline GXBg23Control256Bmp G2_GetBG2Control256Bmp(void) +{ + return *(volatile GXBg23Control256Bmp *)®_G2_BG2CNT; +} + +static inline GXBg23Control256Bmp G2S_GetBG2Control256Bmp(void) +{ + return *(volatile GXBg23Control256Bmp *)®_G2S_DB_BG2CNT; +} + +static inline GXBg23ControlDCBmp G2_GetBG2ControlDCBmp(void) +{ + return *(volatile GXBg23ControlDCBmp *)®_G2_BG2CNT; +} + +static inline GXBg23ControlDCBmp G2S_GetBG2ControlDCBmp(void) +{ + return *(volatile GXBg23ControlDCBmp *)®_G2S_DB_BG2CNT; +} + +static inline GXBg2ControlLargeBmp G2_GetBG2ControlLargeBmp(void) +{ + return *(volatile GXBg2ControlLargeBmp *)®_G2_BG2CNT; +} + +static inline GXBg2ControlLargeBmp G2S_GetBG2ControlLargeBmp(void) +{ + return *(volatile GXBg2ControlLargeBmp *)®_G2S_DB_BG2CNT; +} + +static inline GXBg23ControlText G2_GetBG3ControlText(void) +{ + return *(volatile GXBg23ControlText *)®_G2_BG3CNT; +} + +static inline GXBg23ControlText G2S_GetBG3ControlText(void) +{ + return *(volatile GXBg23ControlText *)®_G2S_DB_BG3CNT; +} + +static inline GXBg23ControlAffine G2_GetBG3ControlAffine(void) +{ + return *(volatile GXBg23ControlAffine *)®_G2_BG3CNT; +} + +static inline GXBg23ControlAffine G2S_GetBG3ControlAffine(void) +{ + return *(volatile GXBg23ControlAffine *)®_G2S_DB_BG3CNT; +} + +static inline GXBg23Control256x16Pltt G2_GetBG3Control256x16Pltt(void) +{ + return *(volatile GXBg23Control256x16Pltt *)®_G2_BG3CNT; +} + +static inline GXBg23Control256x16Pltt G2S_GetBG3Control256x16Pltt(void) +{ + return *(volatile GXBg23Control256x16Pltt *)®_G2S_DB_BG3CNT; +} + +static inline GXBg23Control256Bmp G2_GetBG3Control256Bmp(void) +{ + return *(volatile GXBg23Control256Bmp *)®_G2_BG3CNT; +} + +static inline GXBg23Control256Bmp G2S_GetBG3Control256Bmp(void) +{ + return *(volatile GXBg23Control256Bmp *)®_G2S_DB_BG3CNT; +} + +static inline GXBg23ControlDCBmp G2_GetBG3ControlDCBmp(void) +{ + return *(volatile GXBg23ControlDCBmp *)®_G2_BG3CNT; +} + +static inline GXBg23ControlDCBmp G2S_GetBG3ControlDCBmp(void) +{ + return *(volatile GXBg23ControlDCBmp *)®_G2S_DB_BG3CNT; +} + #endif //GUARD_GX_BGCNT_H diff --git a/arm9/lib/include/GX_g2.h b/arm9/lib/include/GX_g2.h index 372be12b..97fa0e10 100644 --- a/arm9/lib/include/GX_g2.h +++ b/arm9/lib/include/GX_g2.h @@ -4,7 +4,7 @@ #include "fx.h" #include "registers.h" -void G2x_SetBGyAffine_(u32 *ptr, struct Mtx22 *mtx, fx32 a, fx32 b, fx32 c, fx32 d); +void G2x_SetBGyAffine_(u32 ptr, const struct Mtx22 *mtx, fx32 a, fx32 b, fx32 c, fx32 d); void G2x_SetBlendAlpha_(u32 *ptr, fx32 a, fx32 b, fx32 c, fx32 d); void G2x_SetBlendBrightness_(u16 *ptr, fx32 a, fx32 brightness); void G2x_SetBlendBrightnessExt_(u16 *ptr, fx32 a, fx32 b, fx32 c, fx32 d, fx32 brightness); @@ -43,6 +43,84 @@ static inline void G2_SetWndOutsidePlane(int wnd, BOOL effect) reg_G2_WINOUT = (u16)tmp; } +static inline void G2_SetBG0Offset(int hOffset, int vOffset) +{ + reg_G2_BG0OFS = (u32)(((hOffset << REG_G2_BG0OFS_HOFFSET_SHIFT) & REG_G2_BG0OFS_HOFFSET_MASK) | + ((vOffset << REG_G2_BG0OFS_VOFFSET_SHIFT) & REG_G2_BG0OFS_VOFFSET_MASK)); +} + +static inline void G2_SetBG1Offset(int hOffset, int vOffset) +{ + reg_G2_BG1OFS = (u32)(((hOffset << REG_G2_BG1OFS_HOFFSET_SHIFT) & REG_G2_BG1OFS_HOFFSET_MASK) | + ((vOffset << REG_G2_BG1OFS_VOFFSET_SHIFT) & REG_G2_BG1OFS_VOFFSET_MASK)); +} + +static inline void G2_SetBG2Offset(int hOffset, int vOffset) +{ + reg_G2_BG2OFS = (u32)(((hOffset << REG_G2_BG2OFS_HOFFSET_SHIFT) & REG_G2_BG2OFS_HOFFSET_MASK) | + ((vOffset << REG_G2_BG2OFS_VOFFSET_SHIFT) & REG_G2_BG2OFS_VOFFSET_MASK)); +} + +static inline void G2_SetBG3Offset(int hOffset, int vOffset) +{ + reg_G2_BG3OFS = (u32)(((hOffset << REG_G2_BG3OFS_HOFFSET_SHIFT) & REG_G2_BG3OFS_HOFFSET_MASK) | + ((vOffset << REG_G2_BG3OFS_VOFFSET_SHIFT) & REG_G2_BG3OFS_VOFFSET_MASK)); +} + +static inline void G2S_SetBG0Offset(int hOffset, int vOffset) +{ + reg_G2S_DB_BG0OFS = (u32)(((hOffset << REG_G2S_DB_BG0OFS_HOFFSET_SHIFT) & REG_G2S_DB_BG0OFS_HOFFSET_MASK) | + ((vOffset << REG_G2S_DB_BG0OFS_VOFFSET_SHIFT) & REG_G2S_DB_BG0OFS_VOFFSET_MASK)); +} + +static inline void G2S_SetBG1Offset(int hOffset, int vOffset) +{ + reg_G2S_DB_BG1OFS = (u32)(((hOffset << REG_G2S_DB_BG1OFS_HOFFSET_SHIFT) & REG_G2S_DB_BG1OFS_HOFFSET_MASK) | + ((vOffset << REG_G2S_DB_BG1OFS_VOFFSET_SHIFT) & REG_G2S_DB_BG1OFS_VOFFSET_MASK)); +} + +static inline void G2S_SetBG2Offset(int hOffset, int vOffset) +{ + reg_G2S_DB_BG2OFS = (u32)(((hOffset << REG_G2S_DB_BG2OFS_HOFFSET_SHIFT) & REG_G2S_DB_BG2OFS_HOFFSET_MASK) | + ((vOffset << REG_G2S_DB_BG2OFS_VOFFSET_SHIFT) & REG_G2S_DB_BG2OFS_VOFFSET_MASK)); +} + +static inline void G2S_SetBG3Offset(int hOffset, int vOffset) +{ + reg_G2S_DB_BG3OFS = (u32)(((hOffset << REG_G2S_DB_BG3OFS_HOFFSET_SHIFT) & REG_G2S_DB_BG3OFS_HOFFSET_MASK) | + ((vOffset << REG_G2S_DB_BG3OFS_VOFFSET_SHIFT) & REG_G2S_DB_BG3OFS_VOFFSET_MASK)); +} + +static inline void G2_SetBG2Affine(const struct Mtx22 *mtx, int centerX, int centerY, int x1, int y1) +{ + G2x_SetBGyAffine_((u32)®_G2_BG2PA, mtx, centerX, centerY, x1, y1); +} + +static inline void G2_SetBG3Affine(const struct Mtx22 *mtx, int centerX, int centerY, int x1, int y1) +{ + G2x_SetBGyAffine_((u32)®_G2_BG3PA, mtx, centerX, centerY, x1, y1); +} + +static inline void G2S_SetBG2Affine(const struct Mtx22 *mtx, int centerX, int centerY, int x1, int y1) +{ + G2x_SetBGyAffine_((u32)®_G2S_DB_BG2PA, mtx, centerX, centerY, x1, y1); +} + +static inline void G2S_SetBG3Affine(const struct Mtx22 *mtx, int centerX, int centerY, int x1, int y1) +{ + G2x_SetBGyAffine_((u32)®_G2S_DB_BG3PA, mtx, centerX, centerY, x1, y1); +} + +static inline void G2_BlendNone(void) +{ + reg_G2_BLDCNT = 0; +} + +static inline void G2S_BlendNone(void) +{ + reg_G2S_DB_BLDCNT = 0; +} + //The g2 and g2_oam headers contain a lot of inline functions and enums that may want to be ported over at some point #endif //GUARD_GX_G2_H diff --git a/arm9/lib/include/GX_vramcnt.h b/arm9/lib/include/GX_vramcnt.h index 6fe677bc..3b82d28c 100644 --- a/arm9/lib/include/GX_vramcnt.h +++ b/arm9/lib/include/GX_vramcnt.h @@ -16,7 +16,7 @@ void GX_SetBankForSubBG(s32 subbg); void GX_SetBankForSubOBJ(s32 subobj); void GX_SetBankForSubBGExtPltt(s32 subbgextpltt); void GX_SetBankForSubOBJExtPltt(s32 subobjextpltt); -u32 FUN_020C6130(u16 *ptr); +u32 resetBankForX_(u16 *ptr); u32 GX_ResetBankForBG(); u32 GX_ResetBankForOBJ(); u32 GX_ResetBankForBGExtPltt(); @@ -25,31 +25,31 @@ u32 GX_ResetBankForTex(); u32 GX_ResetBankForTexPltt(); u32 GX_ResetBankForClearImage(); u32 GX_ResetBankForSubBG(); -u32 FUN_020C605C(); -u32 FUN_020C6034(); u32 GX_ResetBankForSubOBJ(); -u32 FUN_020C5F28(u16 *ptr); -u32 disableBankForX_(); -u32 GX_DisableBankForOBJExtPltt_2(); +u32 GX_ResetBankForSubBGExtPltt(); +u32 GX_ResetBankForSubOBJExtPltt(); +u32 disableBankForX_(u16 *ptr); +u32 GX_DisableBankForBG(); +u32 GX_DisableBankForOBJ(); u32 GX_DisableBankForBGExtPltt(); u32 GX_DisableBankForOBJExtPltt(); -u32 GX_DisableBankForTexPltt_2(); +u32 GX_DisableBankForTex(); u32 GX_DisableBankForTexPltt(); u32 GX_DisableBankForClearImage(); u32 GX_DisableBankForARM7(); u32 GX_DisableBankForLCDC(); +u32 GX_DisableBankForSubBG(); +u32 GX_DisableBankForSubOBJ(); u32 GX_DisableBankForSubBGExtPltt(); -u32 GX_DisableBankForSubOBJExtPltt_2(); -u32 FUN_020C5E04(); u32 GX_DisableBankForSubOBJExtPltt(); -u32 GX_GetBankForBGExtPltt_2(); +u32 GX_GetBankForBG(); u32 GX_GetBankForOBJ(); u32 GX_GetBankForBGExtPltt(); u32 GX_GetBankForOBJExtPltt(); -u32 FUN_020C5D8C(); +u32 GX_GetBankForTex(); u32 GX_GetBankForTexPltt(); u32 GX_GetBankForLCDC(); -u32 GX_GetBankForSubBGExtPltt_2(); +u32 GX_GetBankForSubBG(); u32 GX_GetBankForSubOBJ(); u32 GX_GetBankForSubBGExtPltt(); u32 GX_GetBankForSubOBJExtPltt(); diff --git a/arm9/lib/include/OS_interrupt.h b/arm9/lib/include/OS_interrupt.h index d063b817..130ad2de 100644 --- a/arm9/lib/include/OS_interrupt.h +++ b/arm9/lib/include/OS_interrupt.h @@ -12,6 +12,8 @@ #define OS_IE_V_COUNT (1UL << REG_OS_IE_VE_SHIFT) #define OS_IE_TIMER0 (1UL << REG_OS_IE_T0_SHIFT) #define OS_IE_TIMER1 (1UL << REG_OS_IE_T1_SHIFT) +#define OS_IE_TIMER2 (1UL << REG_OS_IE_T2_SHIFT) +#define OS_IE_TIMER3 (1UL << REG_OS_IE_T3_SHIFT) #define OS_IE_SPFIFO_RECV (1UL << REG_OS_IE_IFN_SHIFT) #define OS_IE_CARD_DATA (1UL << REG_OS_IE_MC_SHIFT) diff --git a/arm9/lib/include/fx.h b/arm9/lib/include/fx.h index 4a844872..38506194 100644 --- a/arm9/lib/include/fx.h +++ b/arm9/lib/include/fx.h @@ -65,6 +65,9 @@ typedef s64 fx64c; #define FX16_CONST(x) FX_F32_TO_FX16(x) #define FX32_CONST(x) FX_F32_TO_FX32(x) +#define FX16_ONE ((fx16)0x1000) +#define FX32_ONE ((fx32)0x00001000L) + struct Vecx32 { fx32 x; diff --git a/arm9/lib/include/gx.h b/arm9/lib/include/gx.h index acd23b39..cce14e57 100644 --- a/arm9/lib/include/gx.h +++ b/arm9/lib/include/gx.h @@ -186,4 +186,44 @@ static inline void GX_SetMasterBrightness(int brightness) GXx_SetMasterBrightness_(®_GX_MASTER_BRIGHT, brightness); } +static inline void GX_SetVisiblePlane(int plane) +{ + reg_GX_DISPCNT = (u32)((reg_GX_DISPCNT & ~REG_GX_DISPCNT_DISPLAY_MASK) | (plane << REG_GX_DISPCNT_DISPLAY_SHIFT)); +} + +static inline void GXS_SetVisiblePlane(int plane) +{ + reg_GXS_DB_DISPCNT = (u32)((reg_GXS_DB_DISPCNT & ~REG_GXS_DB_DISPCNT_DISPLAY_MASK) | (plane << REG_GXS_DB_DISPCNT_DISPLAY_SHIFT)); +} + +static inline void GXS_DispOn(void) +{ + reg_GXS_DB_DISPCNT |= REG_GXS_DB_DISPCNT_MODE_MASK; +} + +static inline void GX_SetDispSelect(GXDispSelect sel) +{ + reg_GX_POWCNT = (u16)((reg_GX_POWCNT & ~REG_GX_POWCNT_DSEL_MASK) | (sel << REG_GX_POWCNT_DSEL_SHIFT)); +} + +static inline void GX_SetBGScrOffset(GXBGScrOffset offset) +{ + reg_GX_DISPCNT = (u32)((reg_GX_DISPCNT & ~REG_GX_DISPCNT_BGSCREENOFFSET_MASK) | (offset << REG_GX_DISPCNT_BGSCREENOFFSET_SHIFT)); +} + +static inline void GX_SetBGCharOffset(GXBGCharOffset offset) +{ + reg_GX_DISPCNT = (u32)((reg_GX_DISPCNT & ~REG_GX_DISPCNT_BGCHAROFFSET_MASK) | (offset << REG_GX_DISPCNT_BGCHAROFFSET_SHIFT)); +} + +static inline void GX_SetVisibleWnd(int window) +{ + reg_GX_DISPCNT = (u32)((reg_GX_DISPCNT & ~(REG_GX_DISPCNT_W0_MASK | REG_GX_DISPCNT_W1_MASK | REG_GX_DISPCNT_OW_MASK)) | (window << REG_GX_DISPCNT_W0_SHIFT)); +} + +static inline void GXS_SetVisibleWnd(int window) +{ + reg_GXS_DB_DISPCNT = (u32)((reg_GXS_DB_DISPCNT & ~(REG_GXS_DB_DISPCNT_W0_MASK | REG_GXS_DB_DISPCNT_W1_MASK | REG_GXS_DB_DISPCNT_OW_MASK)) | (window << REG_GXS_DB_DISPCNT_W0_SHIFT)); +} + #endif //GUARD_GX_H diff --git a/arm9/lib/include/registers.h b/arm9/lib/include/registers.h index 73ae7ccf..b4fd8ce7 100644 --- a/arm9/lib/include/registers.h +++ b/arm9/lib/include/registers.h @@ -350,12 +350,11 @@ #define REG_OS_IE_VE_SHIFT 2 #define REG_OS_IE_T0_SHIFT 3 #define REG_OS_IE_T1_SHIFT 4 +#define REG_OS_IE_T2_SHIFT 5 +#define REG_OS_IE_T3_SHIFT 6 #define REG_OS_IE_IFN_SHIFT 18 #define REG_OS_IE_MC_SHIFT 19 -#define REG_OS_TM0CNT_H_I_MASK 0x0040 -#define REG_OS_TM0CNT_H_E_MASK 0x0080 - #define REG_PAD_KEYINPUT_L_SHIFT 9 #define REG_PAD_KEYINPUT_L_SIZE 1 #define REG_PAD_KEYINPUT_L_MASK 0x0200 @@ -697,4 +696,374 @@ #define REG_GX_DISPSTAT_VBLK_SIZE 1 #define REG_GX_DISPSTAT_VBLK_MASK 0x0001 +// G2_BG0CNT +#define REG_G2_BG0CNT_SCREENSIZE_SHIFT 14 +#define REG_G2_BG0CNT_SCREENSIZE_SIZE 2 +#define REG_G2_BG0CNT_SCREENSIZE_MASK 0xc000 + +#define REG_G2_BG0CNT_BGPLTTSLOT_SHIFT 13 +#define REG_G2_BG0CNT_BGPLTTSLOT_SIZE 1 +#define REG_G2_BG0CNT_BGPLTTSLOT_MASK 0x2000 + +#define REG_G2_BG0CNT_SCREENBASE_SHIFT 8 +#define REG_G2_BG0CNT_SCREENBASE_SIZE 5 +#define REG_G2_BG0CNT_SCREENBASE_MASK 0x1f00 + +#define REG_G2_BG0CNT_COLORMODE_SHIFT 7 +#define REG_G2_BG0CNT_COLORMODE_SIZE 1 +#define REG_G2_BG0CNT_COLORMODE_MASK 0x0080 + +#define REG_G2_BG0CNT_MOSAIC_SHIFT 6 +#define REG_G2_BG0CNT_MOSAIC_SIZE 1 +#define REG_G2_BG0CNT_MOSAIC_MASK 0x0040 + +#define REG_G2_BG0CNT_CHARBASE_SHIFT 2 +#define REG_G2_BG0CNT_CHARBASE_SIZE 4 +#define REG_G2_BG0CNT_CHARBASE_MASK 0x003c + +#define REG_G2_BG0CNT_PRIORITY_SHIFT 0 +#define REG_G2_BG0CNT_PRIORITY_SIZE 2 +#define REG_G2_BG0CNT_PRIORITY_MASK 0x0003 + +// G2_BG1CNT +#define REG_G2_BG1CNT_SCREENSIZE_SHIFT 14 +#define REG_G2_BG1CNT_SCREENSIZE_SIZE 2 +#define REG_G2_BG1CNT_SCREENSIZE_MASK 0xc000 + +#define REG_G2_BG1CNT_BGPLTTSLOT_SHIFT 13 +#define REG_G2_BG1CNT_BGPLTTSLOT_SIZE 1 +#define REG_G2_BG1CNT_BGPLTTSLOT_MASK 0x2000 + +#define REG_G2_BG1CNT_SCREENBASE_SHIFT 8 +#define REG_G2_BG1CNT_SCREENBASE_SIZE 5 +#define REG_G2_BG1CNT_SCREENBASE_MASK 0x1f00 + +#define REG_G2_BG1CNT_COLORMODE_SHIFT 7 +#define REG_G2_BG1CNT_COLORMODE_SIZE 1 +#define REG_G2_BG1CNT_COLORMODE_MASK 0x0080 + +#define REG_G2_BG1CNT_MOSAIC_SHIFT 6 +#define REG_G2_BG1CNT_MOSAIC_SIZE 1 +#define REG_G2_BG1CNT_MOSAIC_MASK 0x0040 + +#define REG_G2_BG1CNT_CHARBASE_SHIFT 2 +#define REG_G2_BG1CNT_CHARBASE_SIZE 4 +#define REG_G2_BG1CNT_CHARBASE_MASK 0x003c + +#define REG_G2_BG1CNT_PRIORITY_SHIFT 0 +#define REG_G2_BG1CNT_PRIORITY_SIZE 2 +#define REG_G2_BG1CNT_PRIORITY_MASK 0x0003 + +// G2_BG2CNT +#define REG_G2_BG2CNT_SCREENSIZE_SHIFT 14 +#define REG_G2_BG2CNT_SCREENSIZE_SIZE 2 +#define REG_G2_BG2CNT_SCREENSIZE_MASK 0xc000 + +#define REG_G2_BG2CNT_AREAOVER_SHIFT 13 +#define REG_G2_BG2CNT_AREAOVER_SIZE 1 +#define REG_G2_BG2CNT_AREAOVER_MASK 0x2000 + +#define REG_G2_BG2CNT_SCREENBASE_SHIFT 8 +#define REG_G2_BG2CNT_SCREENBASE_SIZE 5 +#define REG_G2_BG2CNT_SCREENBASE_MASK 0x1f00 + +#define REG_G2_BG2CNT_COLORMODE_SHIFT 7 +#define REG_G2_BG2CNT_COLORMODE_SIZE 1 +#define REG_G2_BG2CNT_COLORMODE_MASK 0x0080 + +#define REG_G2_BG2CNT_MOSAIC_SHIFT 6 +#define REG_G2_BG2CNT_MOSAIC_SIZE 1 +#define REG_G2_BG2CNT_MOSAIC_MASK 0x0040 + +#define REG_G2_BG2CNT_CHARBASE_SHIFT 2 +#define REG_G2_BG2CNT_CHARBASE_SIZE 4 +#define REG_G2_BG2CNT_CHARBASE_MASK 0x003c + +#define REG_G2_BG2CNT_PRIORITY_SHIFT 0 +#define REG_G2_BG2CNT_PRIORITY_SIZE 2 +#define REG_G2_BG2CNT_PRIORITY_MASK 0x0003 + +// G2_BG3CNT +#define REG_G2_BG3CNT_SCREENSIZE_SHIFT 14 +#define REG_G2_BG3CNT_SCREENSIZE_SIZE 2 +#define REG_G2_BG3CNT_SCREENSIZE_MASK 0xc000 + +#define REG_G2_BG3CNT_AREAOVER_SHIFT 13 +#define REG_G2_BG3CNT_AREAOVER_SIZE 1 +#define REG_G2_BG3CNT_AREAOVER_MASK 0x2000 + +#define REG_G2_BG3CNT_SCREENBASE_SHIFT 8 +#define REG_G2_BG3CNT_SCREENBASE_SIZE 5 +#define REG_G2_BG3CNT_SCREENBASE_MASK 0x1f00 + +#define REG_G2_BG3CNT_COLORMODE_SHIFT 7 +#define REG_G2_BG3CNT_COLORMODE_SIZE 1 +#define REG_G2_BG3CNT_COLORMODE_MASK 0x0080 + +#define REG_G2_BG3CNT_MOSAIC_SHIFT 6 +#define REG_G2_BG3CNT_MOSAIC_SIZE 1 +#define REG_G2_BG3CNT_MOSAIC_MASK 0x0040 + +#define REG_G2_BG3CNT_CHARBASE_SHIFT 2 +#define REG_G2_BG3CNT_CHARBASE_SIZE 4 +#define REG_G2_BG3CNT_CHARBASE_MASK 0x003c + +#define REG_G2_BG3CNT_PRIORITY_SHIFT 0 +#define REG_G2_BG3CNT_PRIORITY_SIZE 2 +#define REG_G2_BG3CNT_PRIORITY_MASK 0x0003 + +// G2S_DB_BG0CNT +#define REG_G2S_DB_BG0CNT_SCREENSIZE_SHIFT 14 +#define REG_G2S_DB_BG0CNT_SCREENSIZE_SIZE 2 +#define REG_G2S_DB_BG0CNT_SCREENSIZE_MASK 0xc000 + +#define REG_G2S_DB_BG0CNT_BGPLTTSLOT_SHIFT 13 +#define REG_G2S_DB_BG0CNT_BGPLTTSLOT_SIZE 1 +#define REG_G2S_DB_BG0CNT_BGPLTTSLOT_MASK 0x2000 + +#define REG_G2S_DB_BG0CNT_SCREENBASE_SHIFT 8 +#define REG_G2S_DB_BG0CNT_SCREENBASE_SIZE 5 +#define REG_G2S_DB_BG0CNT_SCREENBASE_MASK 0x1f00 + +#define REG_G2S_DB_BG0CNT_COLORMODE_SHIFT 7 +#define REG_G2S_DB_BG0CNT_COLORMODE_SIZE 1 +#define REG_G2S_DB_BG0CNT_COLORMODE_MASK 0x0080 + +#define REG_G2S_DB_BG0CNT_MOSAIC_SHIFT 6 +#define REG_G2S_DB_BG0CNT_MOSAIC_SIZE 1 +#define REG_G2S_DB_BG0CNT_MOSAIC_MASK 0x0040 + +#define REG_G2S_DB_BG0CNT_CHARBASE_SHIFT 2 +#define REG_G2S_DB_BG0CNT_CHARBASE_SIZE 4 +#define REG_G2S_DB_BG0CNT_CHARBASE_MASK 0x003c + +#define REG_G2S_DB_BG0CNT_PRIORITY_SHIFT 0 +#define REG_G2S_DB_BG0CNT_PRIORITY_SIZE 2 +#define REG_G2S_DB_BG0CNT_PRIORITY_MASK 0x0003 + +// G2S_DB_BG1CNT +#define REG_G2S_DB_BG1CNT_SCREENSIZE_SHIFT 14 +#define REG_G2S_DB_BG1CNT_SCREENSIZE_SIZE 2 +#define REG_G2S_DB_BG1CNT_SCREENSIZE_MASK 0xc000 + +#define REG_G2S_DB_BG1CNT_BGPLTTSLOT_SHIFT 13 +#define REG_G2S_DB_BG1CNT_BGPLTTSLOT_SIZE 1 +#define REG_G2S_DB_BG1CNT_BGPLTTSLOT_MASK 0x2000 + +#define REG_G2S_DB_BG1CNT_SCREENBASE_SHIFT 8 +#define REG_G2S_DB_BG1CNT_SCREENBASE_SIZE 5 +#define REG_G2S_DB_BG1CNT_SCREENBASE_MASK 0x1f00 + +#define REG_G2S_DB_BG1CNT_COLORMODE_SHIFT 7 +#define REG_G2S_DB_BG1CNT_COLORMODE_SIZE 1 +#define REG_G2S_DB_BG1CNT_COLORMODE_MASK 0x0080 + +#define REG_G2S_DB_BG1CNT_MOSAIC_SHIFT 6 +#define REG_G2S_DB_BG1CNT_MOSAIC_SIZE 1 +#define REG_G2S_DB_BG1CNT_MOSAIC_MASK 0x0040 + +#define REG_G2S_DB_BG1CNT_CHARBASE_SHIFT 2 +#define REG_G2S_DB_BG1CNT_CHARBASE_SIZE 4 +#define REG_G2S_DB_BG1CNT_CHARBASE_MASK 0x003c + +#define REG_G2S_DB_BG1CNT_PRIORITY_SHIFT 0 +#define REG_G2S_DB_BG1CNT_PRIORITY_SIZE 2 +#define REG_G2S_DB_BG1CNT_PRIORITY_MASK 0x0003 + +// G2S_DB_BG2CNT +#define REG_G2S_DB_BG2CNT_SCREENSIZE_SHIFT 14 +#define REG_G2S_DB_BG2CNT_SCREENSIZE_SIZE 2 +#define REG_G2S_DB_BG2CNT_SCREENSIZE_MASK 0xc000 + +#define REG_G2S_DB_BG2CNT_AREAOVER_SHIFT 13 +#define REG_G2S_DB_BG2CNT_AREAOVER_SIZE 1 +#define REG_G2S_DB_BG2CNT_AREAOVER_MASK 0x2000 + +#define REG_G2S_DB_BG2CNT_SCREENBASE_SHIFT 8 +#define REG_G2S_DB_BG2CNT_SCREENBASE_SIZE 5 +#define REG_G2S_DB_BG2CNT_SCREENBASE_MASK 0x1f00 + +#define REG_G2S_DB_BG2CNT_COLORMODE_SHIFT 7 +#define REG_G2S_DB_BG2CNT_COLORMODE_SIZE 1 +#define REG_G2S_DB_BG2CNT_COLORMODE_MASK 0x0080 + +#define REG_G2S_DB_BG2CNT_MOSAIC_SHIFT 6 +#define REG_G2S_DB_BG2CNT_MOSAIC_SIZE 1 +#define REG_G2S_DB_BG2CNT_MOSAIC_MASK 0x0040 + +#define REG_G2S_DB_BG2CNT_CHARBASE_SHIFT 2 +#define REG_G2S_DB_BG2CNT_CHARBASE_SIZE 4 +#define REG_G2S_DB_BG2CNT_CHARBASE_MASK 0x003c + +#define REG_G2S_DB_BG2CNT_PRIORITY_SHIFT 0 +#define REG_G2S_DB_BG2CNT_PRIORITY_SIZE 2 +#define REG_G2S_DB_BG2CNT_PRIORITY_MASK 0x0003 + +// G2S_DB_BG3CNT +#define REG_G2S_DB_BG3CNT_SCREENSIZE_SHIFT 14 +#define REG_G2S_DB_BG3CNT_SCREENSIZE_SIZE 2 +#define REG_G2S_DB_BG3CNT_SCREENSIZE_MASK 0xc000 + +#define REG_G2S_DB_BG3CNT_AREAOVER_SHIFT 13 +#define REG_G2S_DB_BG3CNT_AREAOVER_SIZE 1 +#define REG_G2S_DB_BG3CNT_AREAOVER_MASK 0x2000 + +#define REG_G2S_DB_BG3CNT_SCREENBASE_SHIFT 8 +#define REG_G2S_DB_BG3CNT_SCREENBASE_SIZE 5 +#define REG_G2S_DB_BG3CNT_SCREENBASE_MASK 0x1f00 + +#define REG_G2S_DB_BG3CNT_COLORMODE_SHIFT 7 +#define REG_G2S_DB_BG3CNT_COLORMODE_SIZE 1 +#define REG_G2S_DB_BG3CNT_COLORMODE_MASK 0x0080 + +#define REG_G2S_DB_BG3CNT_MOSAIC_SHIFT 6 +#define REG_G2S_DB_BG3CNT_MOSAIC_SIZE 1 +#define REG_G2S_DB_BG3CNT_MOSAIC_MASK 0x0040 + +#define REG_G2S_DB_BG3CNT_CHARBASE_SHIFT 2 +#define REG_G2S_DB_BG3CNT_CHARBASE_SIZE 4 +#define REG_G2S_DB_BG3CNT_CHARBASE_MASK 0x003c + +#define REG_G2S_DB_BG3CNT_PRIORITY_SHIFT 0 +#define REG_G2S_DB_BG3CNT_PRIORITY_SIZE 2 +#define REG_G2S_DB_BG3CNT_PRIORITY_MASK 0x0003 + +// G2_BG0OFS +#define REG_G2_BG0OFS_VOFFSET_SHIFT 16 +#define REG_G2_BG0OFS_VOFFSET_SIZE 9 +#define REG_G2_BG0OFS_VOFFSET_MASK 0x01ff0000 + +#define REG_G2_BG0OFS_HOFFSET_SHIFT 0 +#define REG_G2_BG0OFS_HOFFSET_SIZE 9 +#define REG_G2_BG0OFS_HOFFSET_MASK 0x000001ff + +// G2_BG1OFS +#define REG_G2_BG1OFS_VOFFSET_SHIFT 16 +#define REG_G2_BG1OFS_VOFFSET_SIZE 9 +#define REG_G2_BG1OFS_VOFFSET_MASK 0x01ff0000 + +#define REG_G2_BG1OFS_HOFFSET_SHIFT 0 +#define REG_G2_BG1OFS_HOFFSET_SIZE 9 +#define REG_G2_BG1OFS_HOFFSET_MASK 0x000001ff + +// G2_BG2OFS +#define REG_G2_BG2OFS_VOFFSET_SHIFT 16 +#define REG_G2_BG2OFS_VOFFSET_SIZE 9 +#define REG_G2_BG2OFS_VOFFSET_MASK 0x01ff0000 + +#define REG_G2_BG2OFS_HOFFSET_SHIFT 0 +#define REG_G2_BG2OFS_HOFFSET_SIZE 9 +#define REG_G2_BG2OFS_HOFFSET_MASK 0x000001ff + +// G2_BG3OFS +#define REG_G2_BG3OFS_VOFFSET_SHIFT 16 +#define REG_G2_BG3OFS_VOFFSET_SIZE 9 +#define REG_G2_BG3OFS_VOFFSET_MASK 0x01ff0000 + +#define REG_G2_BG3OFS_HOFFSET_SHIFT 0 +#define REG_G2_BG3OFS_HOFFSET_SIZE 9 +#define REG_G2_BG3OFS_HOFFSET_MASK 0x000001ff + +// G2S_DB_BG0OFS +#define REG_G2S_DB_BG0OFS_VOFFSET_SHIFT 16 +#define REG_G2S_DB_BG0OFS_VOFFSET_SIZE 9 +#define REG_G2S_DB_BG0OFS_VOFFSET_MASK 0x01ff0000 + +#define REG_G2S_DB_BG0OFS_HOFFSET_SHIFT 0 +#define REG_G2S_DB_BG0OFS_HOFFSET_SIZE 9 +#define REG_G2S_DB_BG0OFS_HOFFSET_MASK 0x000001ff + +// G2S_DB_BG1OFS +#define REG_G2S_DB_BG1OFS_VOFFSET_SHIFT 16 +#define REG_G2S_DB_BG1OFS_VOFFSET_SIZE 9 +#define REG_G2S_DB_BG1OFS_VOFFSET_MASK 0x01ff0000 + +#define REG_G2S_DB_BG1OFS_HOFFSET_SHIFT 0 +#define REG_G2S_DB_BG1OFS_HOFFSET_SIZE 9 +#define REG_G2S_DB_BG1OFS_HOFFSET_MASK 0x000001ff + +// G2S_DB_BG2OFS +#define REG_G2S_DB_BG2OFS_VOFFSET_SHIFT 16 +#define REG_G2S_DB_BG2OFS_VOFFSET_SIZE 9 +#define REG_G2S_DB_BG2OFS_VOFFSET_MASK 0x01ff0000 + +#define REG_G2S_DB_BG2OFS_HOFFSET_SHIFT 0 +#define REG_G2S_DB_BG2OFS_HOFFSET_SIZE 9 +#define REG_G2S_DB_BG2OFS_HOFFSET_MASK 0x000001ff + +// G2S_DB_BG3OFS +#define REG_G2S_DB_BG3OFS_VOFFSET_SHIFT 16 +#define REG_G2S_DB_BG3OFS_VOFFSET_SIZE 9 +#define REG_G2S_DB_BG3OFS_VOFFSET_MASK 0x01ff0000 + +#define REG_G2S_DB_BG3OFS_HOFFSET_SHIFT 0 +#define REG_G2S_DB_BG3OFS_HOFFSET_SIZE 9 +#define REG_G2S_DB_BG3OFS_HOFFSET_MASK 0x000001ff + +// Timer control + +#define REG_OS_TM0CNT_L_TIMER0CNT_SHIFT 0 +#define REG_OS_TM0CNT_L_TIMER0CNT_SIZE 16 +#define REG_OS_TM0CNT_L_TIMER0CNT_MASK 0xffff + +#define REG_OS_TM0CNT_H_E_SHIFT 7 +#define REG_OS_TM0CNT_H_E_SIZE 1 +#define REG_OS_TM0CNT_H_E_MASK 0x0080 + +#define REG_OS_TM0CNT_H_I_SHIFT 6 +#define REG_OS_TM0CNT_H_I_SIZE 1 +#define REG_OS_TM0CNT_H_I_MASK 0x0040 + +#define REG_OS_TM0CNT_H_PS_SHIFT 0 +#define REG_OS_TM0CNT_H_PS_SIZE 2 +#define REG_OS_TM0CNT_H_PS_MASK 0x0003 + +#define REG_OS_TM1CNT_L_TIMER0CNT_SHIFT 0 +#define REG_OS_TM1CNT_L_TIMER0CNT_SIZE 16 +#define REG_OS_TM1CNT_L_TIMER0CNT_MASK 0xffff + +#define REG_OS_TM1CNT_H_E_SHIFT 7 +#define REG_OS_TM1CNT_H_E_SIZE 1 +#define REG_OS_TM1CNT_H_E_MASK 0x0080 + +#define REG_OS_TM1CNT_H_I_SHIFT 6 +#define REG_OS_TM1CNT_H_I_SIZE 1 +#define REG_OS_TM1CNT_H_I_MASK 0x0040 + +#define REG_OS_TM1CNT_H_PS_SHIFT 0 +#define REG_OS_TM1CNT_H_PS_SIZE 2 +#define REG_OS_TM1CNT_H_PS_MASK 0x0003 + +#define REG_OS_TM2CNT_L_TIMER0CNT_SHIFT 0 +#define REG_OS_TM2CNT_L_TIMER0CNT_SIZE 16 +#define REG_OS_TM2CNT_L_TIMER0CNT_MASK 0xffff + +#define REG_OS_TM2CNT_H_E_SHIFT 7 +#define REG_OS_TM2CNT_H_E_SIZE 1 +#define REG_OS_TM2CNT_H_E_MASK 0x0080 + +#define REG_OS_TM2CNT_H_I_SHIFT 6 +#define REG_OS_TM2CNT_H_I_SIZE 1 +#define REG_OS_TM2CNT_H_I_MASK 0x0040 + +#define REG_OS_TM2CNT_H_PS_SHIFT 0 +#define REG_OS_TM2CNT_H_PS_SIZE 2 +#define REG_OS_TM2CNT_H_PS_MASK 0x0003 + +#define REG_OS_TM3CNT_L_TIMER0CNT_SHIFT 0 +#define REG_OS_TM3CNT_L_TIMER0CNT_SIZE 16 +#define REG_OS_TM3CNT_L_TIMER0CNT_MASK 0xffff + +#define REG_OS_TM3CNT_H_E_SHIFT 7 +#define REG_OS_TM3CNT_H_E_SIZE 1 +#define REG_OS_TM3CNT_H_E_MASK 0x0080 + +#define REG_OS_TM3CNT_H_I_SHIFT 6 +#define REG_OS_TM3CNT_H_I_SIZE 1 +#define REG_OS_TM3CNT_H_I_MASK 0x0040 + +#define REG_OS_TM3CNT_H_PS_SHIFT 0 +#define REG_OS_TM3CNT_H_PS_SIZE 2 +#define REG_OS_TM3CNT_H_PS_MASK 0x0003 + #endif //POKEDIAMOND_ARM9_REGISTERS_H |