diff options
author | Made <made111@gmx.de> | 2020-05-09 19:44:46 +0200 |
---|---|---|
committer | Made <made111@gmx.de> | 2020-05-09 19:44:46 +0200 |
commit | 4abf7d45568d93040fdb86993e915ffdfc4c4a9e (patch) | |
tree | 2bf002914ba0877d914fe5fa2fba82386a3da90d | |
parent | 4ca37a40d9fbe67888777e65aea5a6bf1f4c5829 (diff) |
start decompiling GX_vramcnt.s
-rw-r--r-- | arm9/arm9.lcf | 1 | ||||
-rw-r--r-- | arm9/asm/GX_vramcnt.s | 98 | ||||
-rw-r--r-- | arm9/lib/include/gx.h | 14 | ||||
-rw-r--r-- | arm9/lib/src/GX_vramcnt_c.c | 24 |
4 files changed, 88 insertions, 49 deletions
diff --git a/arm9/arm9.lcf b/arm9/arm9.lcf index eeb735db..d5ebf272 100644 --- a/arm9/arm9.lcf +++ b/arm9/arm9.lcf @@ -143,6 +143,7 @@ SECTIONS { GX.o (.text) GX_state.o (.text) GX_vramcnt.o (.text) + GX_vramcnt_c.o (.text) GX_bgcnt.o (.text) GX_g2.o (.text) GX_g3b.o (.text) diff --git a/arm9/asm/GX_vramcnt.s b/arm9/asm/GX_vramcnt.s index 0dc8890b..bf11bd92 100644 --- a/arm9/asm/GX_vramcnt.s +++ b/arm9/asm/GX_vramcnt.s @@ -1489,52 +1489,52 @@ _020C6E9C: .word 0x04000246 _020C6EA0: .word 0x04000245 _020C6EA4: .word 0x04000244 - arm_func_start GX_VRAMCNT_SetLCDC_ -GX_VRAMCNT_SetLCDC_: ; 0x020C6EA8 - ands r1, r0, #0x1 - ldrne r1, _020C6F3C ; =0x04000240 - movne r2, #0x80 - strneb r2, [r1, #0x0] - ands r1, r0, #0x2 - ldrne r1, _020C6F40 ; =0x04000241 - movne r2, #0x80 - strneb r2, [r1, #0x0] - ands r1, r0, #0x4 - ldrne r1, _020C6F44 ; =0x04000242 - movne r2, #0x80 - strneb r2, [r1, #0x0] - ands r1, r0, #0x8 - ldrne r1, _020C6F48 ; =0x04000243 - movne r2, #0x80 - strneb r2, [r1, #0x0] - ands r1, r0, #0x10 - ldrne r1, _020C6F4C ; =0x04000244 - movne r2, #0x80 - strneb r2, [r1, #0x0] - ands r1, r0, #0x20 - ldrne r1, _020C6F50 ; =0x04000245 - movne r2, #0x80 - strneb r2, [r1, #0x0] - ands r1, r0, #0x40 - ldrne r1, _020C6F54 ; =0x04000246 - movne r2, #0x80 - strneb r2, [r1, #0x0] - ands r1, r0, #0x80 - ldrne r1, _020C6F58 ; =0x04000248 - movne r2, #0x80 - strneb r2, [r1, #0x0] - ands r0, r0, #0x100 - ldrne r0, _020C6F5C ; =0x04000249 - movne r1, #0x80 - strneb r1, [r0, #0x0] - bx lr - .balign 4 -_020C6F3C: .word 0x04000240 -_020C6F40: .word 0x04000241 -_020C6F44: .word 0x04000242 -_020C6F48: .word 0x04000243 -_020C6F4C: .word 0x04000244 -_020C6F50: .word 0x04000245 -_020C6F54: .word 0x04000246 -_020C6F58: .word 0x04000248 -_020C6F5C: .word 0x04000249 +.extern GX_VRAMCNT_SetLCDC_ +;GX_VRAMCNT_SetLCDC_: ; 0x020C6EA8 +; ands r1, r0, #0x1 +; ldrne r1, _020C6F3C ; =0x04000240 +; movne r2, #0x80 +; strneb r2, [r1, #0x0] +; ands r1, r0, #0x2 +; ldrne r1, _020C6F40 ; =0x04000241 +; movne r2, #0x80 +; strneb r2, [r1, #0x0] +; ands r1, r0, #0x4 +; ldrne r1, _020C6F44 ; =0x04000242 +; movne r2, #0x80 +; strneb r2, [r1, #0x0] +; ands r1, r0, #0x8 +; ldrne r1, _020C6F48 ; =0x04000243 +; movne r2, #0x80 +; strneb r2, [r1, #0x0] +; ands r1, r0, #0x10 +; ldrne r1, _020C6F4C ; =0x04000244 +; movne r2, #0x80 +; strneb r2, [r1, #0x0] +; ands r1, r0, #0x20 +; ldrne r1, _020C6F50 ; =0x04000245 +; movne r2, #0x80 +; strneb r2, [r1, #0x0] +; ands r1, r0, #0x40 +; ldrne r1, _020C6F54 ; =0x04000246 +; movne r2, #0x80 +; strneb r2, [r1, #0x0] +; ands r1, r0, #0x80 +; ldrne r1, _020C6F58 ; =0x04000248 +; movne r2, #0x80 +; strneb r2, [r1, #0x0] +; ands r0, r0, #0x100 +; ldrne r0, _020C6F5C ; =0x04000249 +; movne r1, #0x80 +; strneb r1, [r0, #0x0] +; bx lr +; .balign 4 +;_020C6F3C: .word 0x04000240 +;_020C6F40: .word 0x04000241 +;_020C6F44: .word 0x04000242 +;_020C6F48: .word 0x04000243 +;_020C6F4C: .word 0x04000244 +;_020C6F50: .word 0x04000245 +;_020C6F54: .word 0x04000246 +;_020C6F58: .word 0x04000248 +;_020C6F5C: .word 0x04000249 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); +} |