summaryrefslogtreecommitdiff
path: root/arm9/asm
diff options
context:
space:
mode:
authorRevo <projectrevotpp@hotmail.com>2021-02-25 12:09:09 -0500
committerGitHub <noreply@github.com>2021-02-25 12:09:09 -0500
commit75dc81c75dc1dc86053303cdae9decdb2f05557d (patch)
tree002fb738596c50bb67a6dc5204340d2436f81041 /arm9/asm
parentab4e396b1dac3f2a3a3379f9aa3de4de16fd26e9 (diff)
parent8fdf73a9f02bf896d4620341f47436160cc008ba (diff)
Merge pull request #320 from red031000/master
partial CTRDG_flash_AT29LV512.o decomp
Diffstat (limited to 'arm9/asm')
-rw-r--r--arm9/asm/CTRDG_flash_AT29LV512_asm.s (renamed from arm9/asm/CTRDG_flash_AT29LV512.s)192
-rw-r--r--arm9/asm/CTRDG_flash_LE39FW512.s16
-rw-r--r--arm9/asm/CTRDG_flash_MX29L010.s18
-rw-r--r--arm9/asm/CTRDG_flash_common.s10
4 files changed, 26 insertions, 210 deletions
diff --git a/arm9/asm/CTRDG_flash_AT29LV512.s b/arm9/asm/CTRDG_flash_AT29LV512_asm.s
index 24b2e0f2..7cfa90af 100644
--- a/arm9/asm/CTRDG_flash_AT29LV512.s
+++ b/arm9/asm/CTRDG_flash_AT29LV512_asm.s
@@ -5,40 +5,11 @@
.extern AgbFlash
.extern CTRDGi_PollingSR
.extern ctrdgi_flash_lock_id
- .extern UNK_021D6B38
.extern UNK_021D6B08
-
- .section .rodata
-
- .global atMaxTime
-atMaxTime: ; 0x02104004
- .short 10, 40, 0, 40
-
- .global AT29LV512_lib
-AT29LV512_lib: ; 0x0210400C
- .word CTRDGi_WriteFlash4KBAT
- .word CTRDGi_EraseFlashChipAT
- .word CTRDGi_EraseFlash4KBAT
- .word CTRDGi_WriteFlash4KBAsyncAT
- .word CTRDGi_EraseFlashChipAsyncAT
- .word CTRDGi_EraseFlash4KBAsyncAT
- .word CTRDGi_PollingSR512kCOMMON
- .word atMaxTime
- .byte 0x00, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x0C, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00
- .byte 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x3D, 0x00
-
- .global AT29LV512_org
-AT29LV512_org: ; 0x02104048
- .word CTRDGi_WriteFlashSectorAT
- .word CTRDGi_EraseFlashChipAT
- .word CTRDGi_EraseFlashSectorAT
- .word CTRDGi_WriteFlashSectorAsyncAT
- .word CTRDGi_EraseFlashChipAsyncAT
- .word CTRDGi_EraseFlashSectorAsyncAT
- .word CTRDGi_PollingSR512kCOMMON
- .word atMaxTime
- .byte 0x00, 0x00, 0x01, 0x00, 0x80, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00
- .byte 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x3D, 0x00
+ .extern CTRDGi_EraseFlashChipCoreAT
+ .extern CTRDGi_EraseFlashSectorCoreAT
+ .extern AT29LV512_org
+ .extern AT29LV512_lib
.text
@@ -385,158 +356,3 @@ _020DCA18:
bx lr
.balign 4
_020DCA54: .word 0x000080FF
-
- arm_func_start CTRDGi_EraseFlashSectorCoreAT
-CTRDGi_EraseFlashSectorCoreAT: ; 0x020DCA58
- stmdb sp!, {r4-r5,lr}
- sub sp, sp, #0x24
- mov r5, r0
- ldmia r5!, {r0-r3}
- add r4, sp, #0x0
- stmia r4!, {r0-r3}
- ldmia r5!, {r0-r3}
- stmia r4!, {r0-r3}
- ldr r0, [r5, #0x0]
- ldr r1, _020DCB80 ; =AT29LV512_org
- str r0, [r4, #0x0]
- ldr r0, _020DCB84 ; =ctrdgi_flash_lock_id
- ldrh r2, [sp, #0x20]
- ldrh r1, [r1, #0x28]
- ldrh r0, [r0, #0x0]
- mov r1, r2, lsl r1
- add r5, r1, #0xa000000
- bl OS_LockCartridge
- ldr r4, _020DCB88 ; =0x04000204
- ldr r1, _020DCB8C ; =AgbFlash
- ldrh r0, [r4, #0x0]
- ldr r2, [r1, #0x0]
- ldrh r1, [r4, #0x0]
- ldr r2, [r2, #0x10]
- ldr r3, _020DCB90 ; =0x04000208
- bic r1, r1, #0x3
- orr r1, r1, r2
- strh r1, [r4, #0x0]
- ldrh r2, [r3, #0x0]
- mov r1, #0x0
- ldr r4, _020DCB94 ; =0x0A005555
- strh r1, [r3, #0x0]
- mov r3, #0xaa
- strb r3, [r4, #0x0]
- ldr r1, _020DCB98 ; =0x0A002AAA
- mov r3, #0x55
- strb r3, [r1, #0x0]
- mov r3, #0xa0
- strb r3, [r4, #0x0]
- ldr r1, _020DCB80 ; =AT29LV512_org
- and r4, r0, #0x3
- ldr r1, [r1, #0x24]
- cmp r1, #0x0
- beq _020DCB18
- mov r0, #0xff
-_020DCB0C:
- strb r0, [r5], #0x1
- subs r1, r1, #0x1
- bne _020DCB0C
-_020DCB18:
- ldr ip, _020DCB90 ; =0x04000208
- ldr r3, _020DCB9C ; =CTRDGi_PollingSR
- ldrh r0, [r12, #0x0]
- sub r1, r5, #0x1
- strh r2, [r12, #0x0]
- ldr r3, [r3, #0x0]
- mov r0, #0x1
- mov r2, #0xff
- blx r3
- ldr r2, _020DCB88 ; =0x04000204
- movs r5, r0
- ldrh r1, [r2, #0x0]
- andne r0, r5, #0xff00
- orrne r0, r0, #0x2
- movne r0, r0, lsl #0x10
- bic r1, r1, #0x3
- movne r5, r0, lsr #0x10
- orr r1, r1, r4
- ldr r0, _020DCB84 ; =ctrdgi_flash_lock_id
- strh r1, [r2, #0x0]
- ldrh r0, [r0, #0x0]
- bl OS_UnlockCartridge
- mov r0, r5
- add sp, sp, #0x24
- ldmia sp!, {r4-r5,lr}
- bx lr
- .balign 4
-_020DCB80: .word AT29LV512_org
-_020DCB84: .word ctrdgi_flash_lock_id
-_020DCB88: .word 0x04000204
-_020DCB8C: .word AgbFlash
-_020DCB90: .word 0x04000208
-_020DCB94: .word 0x0A005555
-_020DCB98: .word 0x0A002AAA
-_020DCB9C: .word CTRDGi_PollingSR
-
- arm_func_start CTRDGi_EraseFlashChipCoreAT
-CTRDGi_EraseFlashChipCoreAT: ; 0x020DCBA0
- stmdb sp!, {r4-r5,lr}
- sub sp, sp, #0x4
- ldr r0, _020DCC7C ; =ctrdgi_flash_lock_id
- ldrh r0, [r0, #0x0]
- bl OS_LockCartridge
- ldr r4, _020DCC80 ; =0x04000204
- ldr r0, _020DCC84 ; =AgbFlash
- ldrh r3, [r4, #0x0]
- ldr r0, [r0, #0x0]
- ldrh r1, [r4, #0x0]
- ldr r2, [r0, #0x10]
- ldr r0, _020DCC88 ; =0x04000208
- bic r1, r1, #0x3
- orr r1, r1, r2
- strh r1, [r4, #0x0]
- ldrh r4, [r0, #0x0]
- mov r2, #0x0
- ldr r1, _020DCC8C ; =UNK_021D6B38
- strh r2, [r0, #0x0]
- ldr lr, _020DCC90 ; =0x0A005555
- str r4, [r1, #0x0]
- mov r5, #0xaa
- ldr r4, _020DCC94 ; =0x0A002AAA
- strb r5, [lr, #0x0]
- mov r12, #0x55
- strb r12, [r4, #0x0]
- mov r2, #0x80
- strb r2, [lr, #0x0]
- strb r5, [lr, #0x0]
- strb r12, [r4, #0x0]
- mov r2, #0x10
- strb r2, [lr, #0x0]
- ldrh r2, [r0, #0x0]
- ldr r2, [r1, #0x0]
- ldr r1, _020DCC98 ; =CTRDGi_PollingSR
- strh r2, [r0, #0x0]
- ldr r4, [r1, #0x0]
- mov r0, #0x3
- mov r1, #0xa000000
- mov r2, #0xff
- and r5, r3, #0x3
- blx r4
- ldr r3, _020DCC80 ; =0x04000204
- ldr r1, _020DCC7C ; =ctrdgi_flash_lock_id
- ldrh r2, [r3, #0x0]
- mov r4, r0
- bic r0, r2, #0x3
- orr r0, r0, r5
- strh r0, [r3, #0x0]
- ldrh r0, [r1, #0x0]
- bl OS_UnlockCartridge
- mov r0, r4
- add sp, sp, #0x4
- ldmia sp!, {r4-r5,lr}
- bx lr
- .balign 4
-_020DCC7C: .word ctrdgi_flash_lock_id
-_020DCC80: .word 0x04000204
-_020DCC84: .word AgbFlash
-_020DCC88: .word 0x04000208
-_020DCC8C: .word UNK_021D6B38
-_020DCC90: .word 0x0A005555
-_020DCC94: .word 0x0A002AAA
-_020DCC98: .word CTRDGi_PollingSR
diff --git a/arm9/asm/CTRDG_flash_LE39FW512.s b/arm9/asm/CTRDG_flash_LE39FW512.s
index 3228818d..26e714c0 100644
--- a/arm9/asm/CTRDG_flash_LE39FW512.s
+++ b/arm9/asm/CTRDG_flash_LE39FW512.s
@@ -5,7 +5,7 @@
.extern AgbFlash
.extern CTRDGi_PollingSR
.extern ctrdgi_flash_lock_id
- .extern UNK_021D6B38
+ .extern ctrdgi_backup_irq
.extern UNK_021D6B08
.section .rodata
@@ -266,7 +266,7 @@ _020DCF38:
mov r2, #0x0
strh r1, [r7, #0x0]
ldrh r3, [r9, #0x0]
- ldr r1, _020DD034 ; =UNK_021D6B38
+ ldr r1, _020DD034 ; =ctrdgi_backup_irq
and r5, r0, #0x3
strh r2, [r9, #0x0]
ldrh r0, [r7, #0x0]
@@ -289,7 +289,7 @@ _020DCFA0:
bne _020DCFA0
_020DCFD4:
ldr r3, _020DD030 ; =0x04000208
- ldr r0, _020DD034 ; =UNK_021D6B38
+ ldr r0, _020DD034 ; =ctrdgi_backup_irq
ldrh r1, [r3, #0x0]
ldr r0, [r0, #0x0]
ldr r2, _020DD028 ; =0x04000204
@@ -313,7 +313,7 @@ _020DD024: .word ctrdgi_flash_lock_id
_020DD028: .word 0x04000204
_020DD02C: .word UNK_021D6B08
_020DD030: .word 0x04000208
-_020DD034: .word UNK_021D6B38
+_020DD034: .word ctrdgi_backup_irq
arm_func_start CTRDGi_ProgramFlashByteLE
CTRDGi_ProgramFlashByteLE: ; 0x020DD038
@@ -378,7 +378,7 @@ CTRDGi_EraseFlashSectorCoreLE: ; 0x020DD098
ldrh r5, [r0, #0x0]
ldrh r12, [r1, #0x8]
mov r1, #0x0
- ldr r2, _020DD1CC ; =UNK_021D6B38
+ ldr r2, _020DD1CC ; =ctrdgi_backup_irq
strh r1, [r0, #0x0]
mov r6, r4, lsl r12
ldr lr, _020DD1D0 ; =0x0A005555
@@ -423,7 +423,7 @@ _020DD1BC: .word ctrdgi_flash_lock_id
_020DD1C0: .word 0x04000204
_020DD1C4: .word AgbFlash
_020DD1C8: .word 0x04000208
-_020DD1CC: .word UNK_021D6B38
+_020DD1CC: .word ctrdgi_backup_irq
_020DD1D0: .word 0x0A005555
_020DD1D4: .word 0x0A002AAA
_020DD1D8: .word CTRDGi_PollingSR
@@ -447,7 +447,7 @@ CTRDGi_EraseFlashChipCoreLE: ; 0x020DD1DC
strh r1, [r4, #0x0]
ldrh r4, [r0, #0x0]
mov r2, #0x0
- ldr r1, _020DD2C8 ; =UNK_021D6B38
+ ldr r1, _020DD2C8 ; =ctrdgi_backup_irq
strh r2, [r0, #0x0]
ldr lr, _020DD2CC ; =0x0A005555
str r4, [r1, #0x0]
@@ -490,7 +490,7 @@ _020DD2B8: .word ctrdgi_flash_lock_id
_020DD2BC: .word 0x04000204
_020DD2C0: .word AgbFlash
_020DD2C4: .word 0x04000208
-_020DD2C8: .word UNK_021D6B38
+_020DD2C8: .word ctrdgi_backup_irq
_020DD2CC: .word 0x0A005555
_020DD2D0: .word 0x0A002AAA
_020DD2D4: .word CTRDGi_PollingSR
diff --git a/arm9/asm/CTRDG_flash_MX29L010.s b/arm9/asm/CTRDG_flash_MX29L010.s
index 7b4e1dc3..13de7bd7 100644
--- a/arm9/asm/CTRDG_flash_MX29L010.s
+++ b/arm9/asm/CTRDG_flash_MX29L010.s
@@ -5,7 +5,7 @@
.extern AgbFlash
.extern CTRDGi_PollingSR
.extern ctrdgi_flash_lock_id
- .extern UNK_021D6B38
+ .extern ctrdgi_backup_irq
.extern UNK_021D6B08
.section .rodata
@@ -184,7 +184,7 @@ CTRDGi_WriteFlashSectorCoreMX: ; 0x020DD3D0
mov r3, r5, lsl r3
strh r0, [r1, #0x0]
ldrh r1, [r8, #0x0]
- ldr r0, _020DD558 ; =UNK_021D6B38
+ ldr r0, _020DD558 ; =ctrdgi_backup_irq
add r5, r3, #0xa000000
str r2, [r0, #0x0]
cmp r1, #0x0
@@ -205,7 +205,7 @@ _020DD4C8:
bne _020DD4C8
_020DD4FC:
ldr r3, _020DD554 ; =0x04000208
- ldr r0, _020DD558 ; =UNK_021D6B38
+ ldr r0, _020DD558 ; =ctrdgi_backup_irq
ldrh r1, [r3, #0x0]
ldr r0, [r0, #0x0]
ldr r2, _020DD54C ; =0x04000204
@@ -228,7 +228,7 @@ _020DD548: .word ctrdgi_flash_lock_id
_020DD54C: .word 0x04000204
_020DD550: .word UNK_021D6B08
_020DD554: .word 0x04000208
-_020DD558: .word UNK_021D6B38
+_020DD558: .word ctrdgi_backup_irq
arm_func_start CTRDGi_ProgramFlashByteMX
CTRDGi_ProgramFlashByteMX: ; 0x020DD55C
@@ -314,7 +314,7 @@ _020DD684:
ldr r0, _020DD748 ; =AgbFlash
ldrh r12, [r8, #0x0]
ldr r0, [r0, #0x0]
- ldr r3, _020DD75C ; =UNK_021D6B38
+ ldr r3, _020DD75C ; =ctrdgi_backup_irq
ldrh r1, [r0, #0x8]
ldr r0, [sp, #0x8]
ldr r2, [sp, #0xc]
@@ -333,7 +333,7 @@ _020DD684:
strb r6, [r3, #0x0]
strb r4, [r1, #0x0]
ldrh r3, [r8, #0x0]
- ldr r3, _020DD75C ; =UNK_021D6B38
+ ldr r3, _020DD75C ; =ctrdgi_backup_irq
ldr r3, [r3, #0x0]
strh r3, [r8, #0x0]
ldr r3, _020DD768 ; =CTRDGi_PollingSR
@@ -367,7 +367,7 @@ _020DD74C: .word 0x000080FF
_020DD750: .word ctrdgi_flash_lock_id
_020DD754: .word 0x04000204
_020DD758: .word 0x04000208
-_020DD75C: .word UNK_021D6B38
+_020DD75C: .word ctrdgi_backup_irq
_020DD760: .word 0x0A005555
_020DD764: .word 0x0A002AAA
_020DD768: .word CTRDGi_PollingSR
@@ -391,7 +391,7 @@ CTRDGi_EraseFlashChipCoreMX: ; 0x020DD76C
strh r1, [r4, #0x0]
ldrh r4, [r0, #0x0]
mov r2, #0x0
- ldr r1, _020DD858 ; =UNK_021D6B38
+ ldr r1, _020DD858 ; =ctrdgi_backup_irq
strh r2, [r0, #0x0]
ldr lr, _020DD85C ; =0x0A005555
str r4, [r1, #0x0]
@@ -434,7 +434,7 @@ _020DD848: .word ctrdgi_flash_lock_id
_020DD84C: .word 0x04000204
_020DD850: .word AgbFlash
_020DD854: .word 0x04000208
-_020DD858: .word UNK_021D6B38
+_020DD858: .word ctrdgi_backup_irq
_020DD85C: .word 0x0A005555
_020DD860: .word 0x0A002AAA
_020DD864: .word CTRDGi_PollingSR
diff --git a/arm9/asm/CTRDG_flash_common.s b/arm9/asm/CTRDG_flash_common.s
index 4c51608a..ed1dd88e 100644
--- a/arm9/asm/CTRDG_flash_common.s
+++ b/arm9/asm/CTRDG_flash_common.s
@@ -51,8 +51,8 @@ CTRDGi_EraseAgbFlashSectorAsync: ; 0x021D6B30
CTRDGi_EraseAgbFlashChip: ; 0x021D6B34
.space 0x4
- .global UNK_021D6B38
-UNK_021D6B38: ; 0x021D6B38
+ .global ctrdgi_backup_irq
+ctrdgi_backup_irq: ; 0x021D6B38
.space 0x4
.global UNK_021D6B3C
@@ -493,7 +493,7 @@ CTRDGi_ReadFlashID: ; 0x020DC48C
ldr r5, _020DC590 ; =0x04000208
mov r0, #0x0
ldrh r2, [r5, #0x0]
- ldr r1, _020DC594 ; =UNK_021D6B38
+ ldr r1, _020DC594 ; =ctrdgi_backup_irq
ldr r4, _020DC598 ; =0x0A005555
strh r0, [r5, #0x0]
str r2, [r1, #0x0]
@@ -527,7 +527,7 @@ _020DC4FC:
orr r4, r0, r4, lsr #0x10
ldrh r2, [r12, #0x0]
mov r0, #0x0
- ldr r1, _020DC594 ; =UNK_021D6B38
+ ldr r1, _020DC594 ; =ctrdgi_backup_irq
strh r0, [r12, #0x0]
ldr r5, _020DC598 ; =0x0A005555
str r2, [r1, #0x0]
@@ -559,7 +559,7 @@ _020DC580:
bx lr
.balign 4
_020DC590: .word 0x04000208
-_020DC594: .word UNK_021D6B38
+_020DC594: .word ctrdgi_backup_irq
_020DC598: .word 0x0A005555
_020DC59C: .word 0x0A002AAA
_020DC5A0: .word UNK_021D6B10