summaryrefslogtreecommitdiff
path: root/arm9/lib
diff options
context:
space:
mode:
authorMade <made111@gmx.de>2020-05-09 19:44:46 +0200
committerMade <made111@gmx.de>2020-05-09 19:44:46 +0200
commit4abf7d45568d93040fdb86993e915ffdfc4c4a9e (patch)
tree2bf002914ba0877d914fe5fa2fba82386a3da90d /arm9/lib
parent4ca37a40d9fbe67888777e65aea5a6bf1f4c5829 (diff)
start decompiling GX_vramcnt.s
Diffstat (limited to 'arm9/lib')
-rw-r--r--arm9/lib/include/gx.h14
-rw-r--r--arm9/lib/src/GX_vramcnt_c.c24
2 files changed, 38 insertions, 0 deletions
diff --git a/arm9/lib/include/gx.h b/arm9/lib/include/gx.h
index 03e26610..81138da3 100644
--- a/arm9/lib/include/gx.h
+++ b/arm9/lib/include/gx.h
@@ -34,11 +34,25 @@
#define HW_REG_SHININESS 0x040004D0
+
+#define HW_REG_VRAMCNT_A 0x04000240
+#define HW_REG_VRAMCNT_B 0x04000241
+#define HW_REG_VRAMCNT_C 0x04000242
+#define HW_REG_VRAMCNT_D 0x04000243
+#define HW_REG_VRAMCNT_E 0x04000244
+#define HW_REG_VRAMCNT_F 0x04000245
+#define HW_REG_VRAMCNT_G 0x04000246
+#define HW_REG_WRAMCNT 0x04000247
+#define HW_REG_VRAMCNT_H 0x04000248
+#define HW_REG_VRAMCNT_I 0x04000249
+
//TODO: wait for register commit and replace these
+#define SETREG8(x, y) ((*(vu8 *)x) = y)
#define SETREG16(x, y) ((*(vu16 *)x) = y)
#define SETREG32(x, y) ((*(vu32 *)x) = y)
#define SETREG64(x, y) ((*(vu64 *)x) = y)
+#define READREG8(x) (*(vu8 *)x)
#define READREG16(x) (*(vu16 *)x)
#define READREG32(x) (*(vu32 *)x)
#define READREG64(x) (*(vu64 *)x)
diff --git a/arm9/lib/src/GX_vramcnt_c.c b/arm9/lib/src/GX_vramcnt_c.c
new file mode 100644
index 00000000..50107888
--- /dev/null
+++ b/arm9/lib/src/GX_vramcnt_c.c
@@ -0,0 +1,24 @@
+#include "global.h"
+#include "main.h"
+#include "gx.h"
+
+void GX_VRAMCNT_SetLCDC_(u32 r0){
+ if (r0 & (0x1 << 0))
+ SETREG8(HW_REG_VRAMCNT_A, 0x80);
+ if (r0 & (0x1 << 1))
+ SETREG8(HW_REG_VRAMCNT_B, 0x80);
+ if (r0 & (0x1 << 2))
+ SETREG8(HW_REG_VRAMCNT_C, 0x80);
+ if (r0 & (0x1 << 3))
+ SETREG8(HW_REG_VRAMCNT_D, 0x80);
+ if (r0 & (0x1 << 4))
+ SETREG8(HW_REG_VRAMCNT_E, 0x80);
+ if (r0 & (0x1 << 5))
+ SETREG8(HW_REG_VRAMCNT_F, 0x80);
+ if (r0 & (0x1 << 6))
+ SETREG8(HW_REG_VRAMCNT_G, 0x80);
+ if (r0 & (0x1 << 7))
+ SETREG8(HW_REG_VRAMCNT_H, 0x80);
+ if (r0 & (0x1 << 8))
+ SETREG8(HW_REG_VRAMCNT_I, 0x80);
+}