From af472505c60f7a0463e8195e9039af4806b9d42b Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 29 May 2021 20:57:36 -0400 Subject: Document game_init.c --- arm9/lib/include/tp.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'arm9/lib/include') diff --git a/arm9/lib/include/tp.h b/arm9/lib/include/tp.h index d2687545..dc762f10 100644 --- a/arm9/lib/include/tp.h +++ b/arm9/lib/include/tp.h @@ -1,6 +1,14 @@ #ifndef NITRO_TP_H_ #define NITRO_TP_H_ +#define TP_TOUCH_OFF 0 // Not being touched +#define TP_TOUCH_ON 1 // Being touched + +#define TP_VALIDITY_VALID 0 // Valid +#define TP_VALIDITY_INVALID_X 1 // Data with invalid X coordinate +#define TP_VALIDITY_INVALID_Y 2 // Data with invalid Y coordinate +#define TP_VALIDITY_INVALID_XY (TP_VALIDITY_INVALID_X | TP_VALIDITY_INVALID_Y) // Data with invalid X and Y coordinates + // Touch panel input structure typedef struct { -- cgit v1.2.3 From 9da7dd90041b785cb156069ccdf96996d9a162e2 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 30 May 2021 08:54:50 -0400 Subject: Refactor heap.c using NNS types, 1 --- arm9/lib/include/NNS_FND_expheap.h | 15 +++++++++++++++ arm9/lib/include/NNS_FND_heapcommon.h | 24 ++++++++++++++++++++++++ arm9/lib/include/NNS_FND_list.h | 20 ++++++++++++++++++++ arm9/lib/include/consts.h | 1 + 4 files changed, 60 insertions(+) create mode 100644 arm9/lib/include/NNS_FND_expheap.h create mode 100644 arm9/lib/include/NNS_FND_heapcommon.h create mode 100644 arm9/lib/include/NNS_FND_list.h (limited to 'arm9/lib/include') diff --git a/arm9/lib/include/NNS_FND_expheap.h b/arm9/lib/include/NNS_FND_expheap.h new file mode 100644 index 00000000..171cacf6 --- /dev/null +++ b/arm9/lib/include/NNS_FND_expheap.h @@ -0,0 +1,15 @@ +#ifndef GUARD_NNS_FND_EXPHEAP_H +#define GUARD_NNS_FND_EXPHEAP_H + +#include "NNS_FND_heapcommon.h" + +NNSFndHeapHandle NNS_FndCreateExpHeapEx(void *startAddress, u32 size, u32 optFlag); +void *NNS_FndAllocFromExpHeapEx(void *param0, u32 param1, s32 param2); +void NNS_FndDestroyExpHeap(); +void NNS_FndFreeToExpHeap(void *ptr1, void *ptr2); +u32 NNS_FndGetTotalFreeSizeForExpHeap(void *param0); +void NNS_FndInitAllocatorForExpHeap(u32 param0, void *param1, u32 param2); +u32 NNS_FndGetSizeForMBlockExpHeap(void *param0); +void NNS_FndResizeForMBlockExpHeap(void *ptr1, void *ptr2, u32 param2); + +#endif //GUARD_NNS_FND_EXPHEAP_H diff --git a/arm9/lib/include/NNS_FND_heapcommon.h b/arm9/lib/include/NNS_FND_heapcommon.h new file mode 100644 index 00000000..6008e7e8 --- /dev/null +++ b/arm9/lib/include/NNS_FND_heapcommon.h @@ -0,0 +1,24 @@ +#ifndef GUARD_NNS_FND_HEAPCOMMON_H +#define GUARD_NNS_FND_HEAPCOMMON_H + +#include "NNS_FND_list.h" + +typedef struct NNSiFndHeapHead NNSiFndHeapHead; + +struct NNSiFndHeapHead +{ + u32 signature; + + NNSFndLink link; + NNSFndList childList; + + void* heapStart; // Heap start address + void* heapEnd; // Heap end (+1) address + + u32 attribute; // Attribute + // [8:Option flag] +}; + +typedef NNSiFndHeapHead* NNSFndHeapHandle; // Type to represent heap handle + +#endif //GUARD_NNS_FND_HEAPCOMMON_H diff --git a/arm9/lib/include/NNS_FND_list.h b/arm9/lib/include/NNS_FND_list.h new file mode 100644 index 00000000..5df01e5f --- /dev/null +++ b/arm9/lib/include/NNS_FND_list.h @@ -0,0 +1,20 @@ +#ifndef GUARD_NNS_FND_LIST_H +#define GUARD_NNS_FND_LIST_H + +typedef struct +{ + void* prevObject; // Pointer to the previous linked object. + void* nextObject; // Pointer to the next linked object. + +} NNSFndLink; + +typedef struct +{ + void* headObject; // Pointer for the object linked to the top of the list. + void* tailObject; // Pointer for the object linked to the end of the list. + u16 numObjects; // Number of objects linked in the list. + u16 offset; // Offset for NNSFndLink type structure member. + +} NNSFndList; + +#endif //GUARD_NNS_FND_LIST_H diff --git a/arm9/lib/include/consts.h b/arm9/lib/include/consts.h index a41f22ae..1ad79b93 100644 --- a/arm9/lib/include/consts.h +++ b/arm9/lib/include/consts.h @@ -52,6 +52,7 @@ #define OSi_TCM_REGION_BASE_MASK 0xfffff000 #define OS_IE_V_BLANK (1UL << 0) +#define OS_IE_H_BLANK (1UL << 1) #define HW_CPU_CLOCK_ARM9 67027964 -- cgit v1.2.3 From 2e6a113eb27577764b1b6de22e04ae1f73d3069f Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 30 May 2021 09:19:03 -0400 Subject: Refactor heap.c, 2 --- arm9/lib/include/NNS_FND_allocator.h | 34 ++++++++++++++++++++++ arm9/lib/include/NNS_FND_expheap.h | 54 ++++++++++++++++++++++++++++++----- arm9/lib/include/NNS_FND_heapcommon.h | 2 ++ 3 files changed, 83 insertions(+), 7 deletions(-) create mode 100644 arm9/lib/include/NNS_FND_allocator.h (limited to 'arm9/lib/include') diff --git a/arm9/lib/include/NNS_FND_allocator.h b/arm9/lib/include/NNS_FND_allocator.h new file mode 100644 index 00000000..48df282a --- /dev/null +++ b/arm9/lib/include/NNS_FND_allocator.h @@ -0,0 +1,34 @@ +#ifndef GUARD_NNS_FND_ALLOCATOR_H +#define GUARD_NNS_FND_ALLOCATOR_H + +#include "NNS_FND_heapcommon.h" + +typedef struct NNSFndAllocator NNSFndAllocator; + +typedef void* (*NNSFndFuncAllocatorAlloc)( + NNSFndAllocator* pAllocator, + u32 size); + +typedef void (*NNSFndFuncAllocatorFree)( + NNSFndAllocator* pAllocator, + void* memBlock); + +typedef struct NNSFndAllocatorFunc NNSFndAllocatorFunc; + +struct NNSFndAllocatorFunc +{ + NNSFndFuncAllocatorAlloc pfAlloc; + NNSFndFuncAllocatorFree pfFree; +}; + +struct NNSFndAllocator +{ + NNSFndAllocatorFunc const * pFunc; + void* pHeap; + u32 heapParam1; + u32 heapParam2; +}; + +void NNS_FndInitAllocatorForExpHeap(NNSFndAllocator * pAllocator, NNSFndHeapHandle heap, int alignment); + +#endif //GUARD_NNS_FND_ALLOCATOR_H diff --git a/arm9/lib/include/NNS_FND_expheap.h b/arm9/lib/include/NNS_FND_expheap.h index 171cacf6..c0008f28 100644 --- a/arm9/lib/include/NNS_FND_expheap.h +++ b/arm9/lib/include/NNS_FND_expheap.h @@ -3,13 +3,53 @@ #include "NNS_FND_heapcommon.h" +typedef struct NNSiFndExpHeapMBlockHead NNSiFndExpHeapMBlockHead; + +struct NNSiFndExpHeapMBlockHead +{ + u16 signature; // Signature + u16 attribute; // Attribute + // [8:groupID] + // [7:alignment] + // [1:temporary flag] + + u32 blockSize; // Block size (data area only) + + NNSiFndExpHeapMBlockHead* pMBHeadPrev; // Previous block + NNSiFndExpHeapMBlockHead* pMBHeadNext; // Next block +}; + +typedef struct NNSiFndExpMBlockList NNSiFndExpMBlockList; + +struct NNSiFndExpMBlockList +{ + NNSiFndExpHeapMBlockHead* head; // Pointer for memory block linked to header + NNSiFndExpHeapMBlockHead* tail; // Pointer to the memory block linked to the tail of the expanded heap +}; + +typedef struct NNSiFndExpHeapHead NNSiFndExpHeapHead; + +struct NNSiFndExpHeapHead +{ + NNSiFndExpMBlockList mbFreeList; // Free list + NNSiFndExpMBlockList mbUsedList; // Used list + + u16 groupID; // Current group ID (lower 8 bits only) + u16 feature; // Attribute +}; + NNSFndHeapHandle NNS_FndCreateExpHeapEx(void *startAddress, u32 size, u32 optFlag); -void *NNS_FndAllocFromExpHeapEx(void *param0, u32 param1, s32 param2); -void NNS_FndDestroyExpHeap(); -void NNS_FndFreeToExpHeap(void *ptr1, void *ptr2); -u32 NNS_FndGetTotalFreeSizeForExpHeap(void *param0); -void NNS_FndInitAllocatorForExpHeap(u32 param0, void *param1, u32 param2); -u32 NNS_FndGetSizeForMBlockExpHeap(void *param0); -void NNS_FndResizeForMBlockExpHeap(void *ptr1, void *ptr2, u32 param2); +void *NNS_FndAllocFromExpHeapEx(NNSFndHeapHandle heap, u32 size, int alignment); +void NNS_FndDestroyExpHeap(NNSFndHeapHandle heap); +void NNS_FndFreeToExpHeap(NNSFndHeapHandle heap, void *memBlock); +u32 NNS_FndGetTotalFreeSizeForExpHeap(NNSFndHeapHandle heap); +u32 NNS_FndGetSizeForMBlockExpHeap(const void *memBlock); +void NNS_FndResizeForMBlockExpHeap(NNSFndHeapHandle heap, void *memBlock, u32 size); + +#define NNS_FndCreateExpHeap(startAddress, size) \ + NNS_FndCreateExpHeapEx(startAddress, size, 0) +#define NNS_FndAllocFromExpHeap(heap, size) \ + NNS_FndAllocFromExpHeapEx(heap, size, NNS_FND_HEAP_DEFAULT_ALIGNMENT) + #endif //GUARD_NNS_FND_EXPHEAP_H diff --git a/arm9/lib/include/NNS_FND_heapcommon.h b/arm9/lib/include/NNS_FND_heapcommon.h index 6008e7e8..eb6f1bdb 100644 --- a/arm9/lib/include/NNS_FND_heapcommon.h +++ b/arm9/lib/include/NNS_FND_heapcommon.h @@ -3,6 +3,8 @@ #include "NNS_FND_list.h" +#define NNS_FND_HEAP_DEFAULT_ALIGNMENT 4 + typedef struct NNSiFndHeapHead NNSiFndHeapHead; struct NNSiFndHeapHead -- cgit v1.2.3 From d612c41066844fc82edaaea6bc946adbcc71a3d9 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 31 May 2021 12:14:52 -0400 Subject: Better docs of gx, error_message_reset, etc --- arm9/lib/include/GX_ioreg.h | 67 ++++++++++++++++++++++++++++++++++++++++ arm9/lib/include/OS_irqHandler.h | 2 +- arm9/lib/include/gx.h | 23 ++++++++------ 3 files changed, 82 insertions(+), 10 deletions(-) (limited to 'arm9/lib/include') diff --git a/arm9/lib/include/GX_ioreg.h b/arm9/lib/include/GX_ioreg.h index 81055b0a..bfdc370a 100644 --- a/arm9/lib/include/GX_ioreg.h +++ b/arm9/lib/include/GX_ioreg.h @@ -81,4 +81,71 @@ #define REG_GX_DISPCNT_EXOBJ_BM_SIZE 1 #define REG_GX_DISPCNT_EXOBJ_BM_MASK 0x00400000 +// DISPSTAT +#define REG_GX_DISPSTAT_VCOUNTER_SHIFT 7 +#define REG_GX_DISPSTAT_VCOUNTER_SIZE 9 +#define REG_GX_DISPSTAT_VCOUNTER_MASK 0xff80 + +#define REG_GX_DISPSTAT_VQI_SHIFT 5 +#define REG_GX_DISPSTAT_VQI_SIZE 1 +#define REG_GX_DISPSTAT_VQI_MASK 0x0020 + +#define REG_GX_DISPSTAT_HBI_SHIFT 4 +#define REG_GX_DISPSTAT_HBI_SIZE 1 +#define REG_GX_DISPSTAT_HBI_MASK 0x0010 + +#define REG_GX_DISPSTAT_VBI_SHIFT 3 +#define REG_GX_DISPSTAT_VBI_SIZE 1 +#define REG_GX_DISPSTAT_VBI_MASK 0x0008 + +#define REG_GX_DISPSTAT_LYC_SHIFT 2 +#define REG_GX_DISPSTAT_LYC_SIZE 1 +#define REG_GX_DISPSTAT_LYC_MASK 0x0004 + +#define REG_GX_DISPSTAT_HBLK_SHIFT 1 +#define REG_GX_DISPSTAT_HBLK_SIZE 1 +#define REG_GX_DISPSTAT_HBLK_MASK 0x0002 + +#define REG_GX_DISPSTAT_VBLK_SHIFT 0 +#define REG_GX_DISPSTAT_VBLK_SIZE 1 +#define REG_GX_DISPSTAT_VBLK_MASK 0x0001 + +// POWCNT +#define REG_GX_POWCNT_GE_SHIFT 3 +#define REG_GX_POWCNT_GE_SIZE 1 +#define REG_GX_POWCNT_GE_MASK 0x0008 + +#define REG_GX_POWCNT_RE_SHIFT 2 +#define REG_GX_POWCNT_RE_SIZE 1 +#define REG_GX_POWCNT_RE_MASK 0x0004 + +#define REG_GX_POWCNT_E2DG_SHIFT 1 +#define REG_GX_POWCNT_E2DG_SIZE 1 +#define REG_GX_POWCNT_E2DG_MASK 0x0002 + +#define REG_GX_POWCNT_LCD_SHIFT 0 +#define REG_GX_POWCNT_LCD_SIZE 1 +#define REG_GX_POWCNT_LCD_MASK 0x0001 + +#define REG_GX_POWCNT_LCDB_SHIFT 8 +#define REG_GX_POWCNT_LCDB_SIZE 1 +#define REG_GX_POWCNT_LCDB_MASK 0x0100 + +#define REG_GX_POWCNT_E2DGB_SHIFT 9 +#define REG_GX_POWCNT_E2DGB_SIZE 1 +#define REG_GX_POWCNT_E2DGB_MASK 0x0200 + +#define REG_GX_POWCNT_DSEL_SHIFT 15 +#define REG_GX_POWCNT_DSEL_SIZE 1 +#define REG_GX_POWCNT_DSEL_MASK 0x8000 + +// MASTER BRIGHT +#define REG_GX_MASTER_BRIGHT_E_MOD_SHIFT 14 +#define REG_GX_MASTER_BRIGHT_E_MOD_SIZE 2 +#define REG_GX_MASTER_BRIGHT_E_MOD_MASK 0xc000 + +#define REG_GX_MASTER_BRIGHT_E_VALUE_SHIFT 0 +#define REG_GX_MASTER_BRIGHT_E_VALUE_SIZE 5 +#define REG_GX_MASTER_BRIGHT_E_VALUE_MASK 0x001f + #endif //NITRO_GX_IOREG_H diff --git a/arm9/lib/include/OS_irqHandler.h b/arm9/lib/include/OS_irqHandler.h index f052016d..ea12a0ad 100644 --- a/arm9/lib/include/OS_irqHandler.h +++ b/arm9/lib/include/OS_irqHandler.h @@ -16,6 +16,6 @@ static inline OSIrqMask OS_GetIrqCheckFlag(void) void OS_IrqHandler(void); void OS_IrqHandler_ThreadSwitch(void); -void OS_WaitIrq(BOOL param1, u32 param2); +void OS_WaitIrq(BOOL clear, OSIrqMask irqFlags); #endif //POKEDIAMOND_OS_IRQHANDLER_H diff --git a/arm9/lib/include/gx.h b/arm9/lib/include/gx.h index 210d61f4..d73b4f53 100644 --- a/arm9/lib/include/gx.h +++ b/arm9/lib/include/gx.h @@ -27,15 +27,6 @@ void GXi_NopClearFifo128_(void *); #include "GX_g3imm.h" #include "GX_dma.h" -void GX_Init(); -u32 GX_HBlankIntr(u32 enable); -u32 GX_VBlankIntr(u32 enable); -void GX_DispOff(); -void GX_DispOn(); -void GX_SetGraphicsMode(u32 mode1, u32 mode2, u32 mode3); -void GXS_SetGraphicsMode(u32 mode); -void GXx_SetMasterBrightness_(vu16 *dst, s32 brightness); - typedef union { u32 raw; @@ -181,4 +172,18 @@ typedef enum } GXOBJVRamModeChar; +void GX_Init(); +u32 GX_HBlankIntr(u32 enable); +u32 GX_VBlankIntr(u32 enable); +void GX_DispOff(); +void GX_DispOn(); +void GX_SetGraphicsMode(GXDispMode dispMode, GXBGMode bgMode, GXBG0As bg0_2d3d); +void GXS_SetGraphicsMode(GXBGMode mode); +void GXx_SetMasterBrightness_(vu16 *dst, s32 brightness); + +static inline void GX_SetMasterBrightness(int brightness) +{ + GXx_SetMasterBrightness_(®_GX_MASTER_BRIGHT, brightness); +} + #endif //GUARD_GX_H -- cgit v1.2.3 From 94eb56526428935ea1f49d2b8912b5b3022d99b7 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 3 Jun 2021 18:27:52 -0400 Subject: Rename window-related structs; port g2 reg inlines --- arm9/lib/include/GX_bgcnt.h | 284 +++++++++++++++++++++++++++++++++++++++++++ arm9/lib/include/registers.h | 232 +++++++++++++++++++++++++++++++++++ 2 files changed, 516 insertions(+) (limited to 'arm9/lib/include') diff --git a/arm9/lib/include/GX_bgcnt.h b/arm9/lib/include/GX_bgcnt.h index a581443e..9a604046 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,280 @@ 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) | (areaOver << REG_G2_BG2CNT_AREAOVER_SHIFT) | (screenBase << REG_G2_BG2CNT_SCREENBASE_SHIFT) | (charBase << REG_G2_BG2CNT_CHARBASE_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) | (areaOver << REG_G2S_DB_BG2CNT_AREAOVER_SHIFT) | (screenBase << REG_G2S_DB_BG2CNT_SCREENBASE_SHIFT) | (charBase << REG_G2S_DB_BG2CNT_CHARBASE_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) | (areaOver << REG_G2_BG3CNT_AREAOVER_SHIFT) | (screenBase << REG_G2_BG3CNT_SCREENBASE_SHIFT) | (charBase << REG_G2_BG3CNT_CHARBASE_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) | (areaOver << REG_G2S_DB_BG3CNT_AREAOVER_SHIFT) | (screenBase << REG_G2S_DB_BG3CNT_SCREENBASE_SHIFT) | (charBase << REG_G2S_DB_BG3CNT_CHARBASE_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)); +} + #endif //GUARD_GX_BGCNT_H diff --git a/arm9/lib/include/registers.h b/arm9/lib/include/registers.h index 73ae7ccf..f4da59ad 100644 --- a/arm9/lib/include/registers.h +++ b/arm9/lib/include/registers.h @@ -697,4 +697,236 @@ #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 + #endif //POKEDIAMOND_ARM9_REGISTERS_H -- cgit v1.2.3 From 662866c1e3ed69c3895c5794ef6c9ab9cf9c1f0a Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 3 Jun 2021 18:59:46 -0400 Subject: Match FUN_02016C18 --- arm9/lib/include/GX_bgcnt.h | 8 ++++---- arm9/lib/include/fx.h | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'arm9/lib/include') diff --git a/arm9/lib/include/GX_bgcnt.h b/arm9/lib/include/GX_bgcnt.h index 9a604046..24d03e8a 100644 --- a/arm9/lib/include/GX_bgcnt.h +++ b/arm9/lib/include/GX_bgcnt.h @@ -384,12 +384,12 @@ static inline void G2S_SetBG2ControlText(GXBGScrSizeText screenSize, GXBGColorMo 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) | (areaOver << REG_G2_BG2CNT_AREAOVER_SHIFT) | (screenBase << REG_G2_BG2CNT_SCREENBASE_SHIFT) | (charBase << REG_G2_BG2CNT_CHARBASE_SHIFT)); + 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) | (areaOver << REG_G2S_DB_BG2CNT_AREAOVER_SHIFT) | (screenBase << REG_G2S_DB_BG2CNT_SCREENBASE_SHIFT) | (charBase << REG_G2S_DB_BG2CNT_CHARBASE_SHIFT)); + 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) @@ -444,12 +444,12 @@ static inline void G2S_SetBG3ControlText(GXBGScrSizeText screenSize, GXBGColorMo 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) | (areaOver << REG_G2_BG3CNT_AREAOVER_SHIFT) | (screenBase << REG_G2_BG3CNT_SCREENBASE_SHIFT) | (charBase << REG_G2_BG3CNT_CHARBASE_SHIFT)); + 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) | (areaOver << REG_G2S_DB_BG3CNT_AREAOVER_SHIFT) | (screenBase << REG_G2S_DB_BG3CNT_SCREENBASE_SHIFT) | (charBase << REG_G2S_DB_BG3CNT_CHARBASE_SHIFT)); + 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) 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; -- cgit v1.2.3 From a4f2d479c881034c93ce5617f4789fe3647c5f33 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 3 Jun 2021 20:17:52 -0400 Subject: Match FUN_020170F4 --- arm9/lib/include/GX_bgcnt.h | 130 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) (limited to 'arm9/lib/include') diff --git a/arm9/lib/include/GX_bgcnt.h b/arm9/lib/include/GX_bgcnt.h index 24d03e8a..b64d4432 100644 --- a/arm9/lib/include/GX_bgcnt.h +++ b/arm9/lib/include/GX_bgcnt.h @@ -628,4 +628,134 @@ 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 -- cgit v1.2.3 From e29c9e21ba9b64c86ac677b2bf4a69e92e8ac34b Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 4 Jun 2021 18:37:08 -0400 Subject: Port more inlines from gx lib --- arm9/lib/include/GX_g2.h | 70 +++++++++++++++++++++++++++++++++++++++++- arm9/lib/include/gx.h | 30 ++++++++++++++++++ arm9/lib/include/registers.h | 72 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 171 insertions(+), 1 deletion(-) (limited to 'arm9/lib/include') diff --git a/arm9/lib/include/GX_g2.h b/arm9/lib/include/GX_g2.h index 372be12b..987bda38 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,74 @@ 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); +} + //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.h b/arm9/lib/include/gx.h index acd23b39..7ba8d1f3 100644 --- a/arm9/lib/include/gx.h +++ b/arm9/lib/include/gx.h @@ -186,4 +186,34 @@ 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)); +} + #endif //GUARD_GX_H diff --git a/arm9/lib/include/registers.h b/arm9/lib/include/registers.h index f4da59ad..27796cf7 100644 --- a/arm9/lib/include/registers.h +++ b/arm9/lib/include/registers.h @@ -929,4 +929,76 @@ #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 + #endif //POKEDIAMOND_ARM9_REGISTERS_H -- cgit v1.2.3 From c87b617058767519480ef2d19e233fe0e99ca01d Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 5 Jun 2021 16:55:46 -0400 Subject: Fix GX_vramcnt symbol names --- arm9/lib/include/GX_g2.h | 10 ++++++ arm9/lib/include/GX_vramcnt.h | 24 +++++++------- arm9/lib/include/OS_interrupt.h | 2 ++ arm9/lib/include/gx.h | 10 ++++++ arm9/lib/include/registers.h | 71 +++++++++++++++++++++++++++++++++++++++-- 5 files changed, 102 insertions(+), 15 deletions(-) (limited to 'arm9/lib/include') diff --git a/arm9/lib/include/GX_g2.h b/arm9/lib/include/GX_g2.h index 987bda38..97fa0e10 100644 --- a/arm9/lib/include/GX_g2.h +++ b/arm9/lib/include/GX_g2.h @@ -111,6 +111,16 @@ static inline void G2S_SetBG3Affine(const struct Mtx22 *mtx, int centerX, int ce 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/gx.h b/arm9/lib/include/gx.h index 7ba8d1f3..cce14e57 100644 --- a/arm9/lib/include/gx.h +++ b/arm9/lib/include/gx.h @@ -216,4 +216,14 @@ 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 27796cf7..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 @@ -1001,4 +1000,70 @@ #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 -- cgit v1.2.3 From 4b1053c21cf22b9eca6f556139f52414b91f523b Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 12 Jun 2021 13:32:50 -0400 Subject: Decompile overlay 19 --- arm9/lib/include/gx.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'arm9/lib/include') diff --git a/arm9/lib/include/gx.h b/arm9/lib/include/gx.h index cce14e57..7e6606fa 100644 --- a/arm9/lib/include/gx.h +++ b/arm9/lib/include/gx.h @@ -226,4 +226,9 @@ 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)); } +static inline void GXS_SetOBJVRamModeChar(GXOBJVRamModeChar mode) +{ + reg_GXS_DB_DISPCNT = (u32)(reg_GXS_DB_DISPCNT & ~(REG_GXS_DB_DISPCNT_EXOBJ_CH_MASK | REG_GXS_DB_DISPCNT_OBJMAP_CH_MASK) | mode); +} + #endif //GUARD_GX_H -- cgit v1.2.3