summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSeth Barberee <seth.barberee@gmail.com>2021-01-04 13:40:33 -0600
committerGitHub <noreply@github.com>2021-01-04 13:40:33 -0600
commit469212f7ee42d04e3160d357ed1f088f12edd391 (patch)
treeea53fd58f6dc9a42e38c3a7a78d6b7baa760a520 /include
parent87cd9885a9f8b38a76ab6add4a634e2a8a4837ee (diff)
CPU and GPU Reg Funcs Decomp (#16)
* decomp/doc cpu funcs and gpu reg funcs * use Cpu32 macro funcs * address review comments * decomp SetBGOBJEnableFlags
Diffstat (limited to 'include')
-rw-r--r--include/bg.h18
-rw-r--r--include/gba/io_reg.h35
2 files changed, 53 insertions, 0 deletions
diff --git a/include/bg.h b/include/bg.h
new file mode 100644
index 0000000..376fb6f
--- /dev/null
+++ b/include/bg.h
@@ -0,0 +1,18 @@
+struct BGControlStruct
+{
+ u16 padding;
+ u16 unk2;
+ s16 hofs;
+ s16 vofs;
+};
+
+void SetBG0RegOffsets(s32 xoffset, s32 yoffset);
+void SetBG1RegOffsets(s32 xoffset, s32 yoffset);
+void SetBG2RegOffsets(s32 xoffset, s32 yoffset);
+void SetBG3RegOffsets(s32 xoffset, s32 yoffset);
+void SetBGRegOffsets(s32 reg, u32 xoffset, s32 yoffset);
+void SetBGRegXOffset(s32 reg, s32 offset);
+void SetBGRegYOffset(s32 reg, s32 offset);
+void UpdateBGControlRegisters(void);
+void SetBGOBJEnableFlags(u32 mask);
+
diff --git a/include/gba/io_reg.h b/include/gba/io_reg.h
index 6dbe5e8..2453645 100644
--- a/include/gba/io_reg.h
+++ b/include/gba/io_reg.h
@@ -538,6 +538,41 @@
#define BGCNT_AFF512x512 0x8000
#define BGCNT_AFF1024x1024 0xC000
+// WININ/OUT
+#define WININ_WIN0_BG0 (1 << 0)
+#define WININ_WIN0_BG1 (1 << 1)
+#define WININ_WIN0_BG2 (1 << 2)
+#define WININ_WIN0_BG3 (1 << 3)
+#define WININ_WIN0_BG_ALL (WININ_WIN0_BG0 | WININ_WIN0_BG1 | WININ_WIN0_BG2 | WININ_WIN0_BG3)
+#define WININ_WIN0_OBJ (1 << 4)
+#define WININ_WIN0_CLR (1 << 5)
+#define WININ_WIN0_ALL (WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR)
+#define WININ_WIN1_BG0 (1 << 8)
+#define WININ_WIN1_BG1 (1 << 9)
+#define WININ_WIN1_BG2 (1 << 10)
+#define WININ_WIN1_BG3 (1 << 11)
+#define WININ_WIN1_BG_ALL (WININ_WIN1_BG0 | WININ_WIN1_BG1 | WININ_WIN1_BG2 | WININ_WIN1_BG3)
+#define WININ_WIN1_OBJ (1 << 12)
+#define WININ_WIN1_CLR (1 << 13)
+#define WININ_WIN1_ALL (WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR)
+
+#define WINOUT_WIN01_BG0 (1 << 0)
+#define WINOUT_WIN01_BG1 (1 << 1)
+#define WINOUT_WIN01_BG2 (1 << 2)
+#define WINOUT_WIN01_BG3 (1 << 3)
+#define WINOUT_WIN01_BG_ALL (WINOUT_WIN01_BG0 | WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3)
+#define WINOUT_WIN01_OBJ (1 << 4)
+#define WINOUT_WIN01_CLR (1 << 5)
+#define WINOUT_WIN01_ALL (WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR)
+#define WINOUT_WINOBJ_BG0 (1 << 8)
+#define WINOUT_WINOBJ_BG1 (1 << 9)
+#define WINOUT_WINOBJ_BG2 (1 << 10)
+#define WINOUT_WINOBJ_BG3 (1 << 11)
+#define WINOUT_WINOBJ_BG_ALL (WINOUT_WINOBJ_BG0 | WINOUT_WINOBJ_BG1 | WINOUT_WINOBJ_BG2 | WINOUT_WINOBJ_BG3)
+#define WINOUT_WINOBJ_OBJ (1 << 12)
+#define WINOUT_WINOBJ_CLR (1 << 13)
+#define WINOUT_WINOBJ_ALL (WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR)
+
// BLDCNT
// Bits 0-5 select layers for the 1st target
#define BLDCNT_TGT1_BG0 (1 << 0)