2015-10-06 05:46:30 -07:00
|
|
|
thumb_func_start Main
|
|
|
|
Main:
|
|
|
|
push {r4-r7,lr}
|
|
|
|
mov r7, r8
|
|
|
|
push {r7}
|
|
|
|
movs r0, 0xFF
|
|
|
|
bl RegisterRamReset
|
|
|
|
movs r1, 0xA0
|
|
|
|
lsls r1, 19
|
|
|
|
ldr r2, =0x00007fff
|
|
|
|
adds r0, r2, 0
|
|
|
|
strh r0, [r1]
|
2015-11-29 23:17:50 -08:00
|
|
|
bl InitGpuRegManager
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r1, =0x04000204
|
|
|
|
ldr r3, =0x00004014
|
|
|
|
adds r0, r3, 0
|
|
|
|
strh r0, [r1]
|
2015-11-29 23:17:50 -08:00
|
|
|
bl InitKeypadData
|
|
|
|
bl InitIntrHandlers
|
2015-10-06 05:46:30 -07:00
|
|
|
bl m4aSoundInit
|
2015-11-29 23:17:50 -08:00
|
|
|
bl EnableVCountIntrAtLine150
|
2015-10-06 05:46:30 -07:00
|
|
|
bl sub_800E6D0
|
2015-11-27 18:50:30 -08:00
|
|
|
bl GameFreakRTC_Init
|
2015-11-29 23:17:50 -08:00
|
|
|
bl CheckForFlashMemory
|
|
|
|
bl InitVariablesAndSetCopyrightScreenCallback
|
2015-10-06 05:46:30 -07:00
|
|
|
bl sound_sources_off
|
2015-10-06 20:15:42 -07:00
|
|
|
bl ClearDma3Requests
|
2015-11-29 23:17:50 -08:00
|
|
|
bl ResetBgs
|
2015-11-28 19:28:41 -08:00
|
|
|
bl SetDefaultFontsPointer
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r0, =0x02000000
|
|
|
|
movs r1, 0xE0
|
|
|
|
lsls r1, 9
|
2015-11-29 23:17:50 -08:00
|
|
|
bl InitHeap
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r0, =0x03002700
|
|
|
|
movs r4, 0
|
|
|
|
strb r4, [r0]
|
|
|
|
ldr r0, =0x03005d88
|
|
|
|
ldr r0, [r0]
|
|
|
|
cmp r0, 0x1
|
2015-10-10 03:12:48 -07:00
|
|
|
beq @08000414
|
2015-10-06 05:46:30 -07:00
|
|
|
movs r0, 0
|
2015-11-29 23:17:50 -08:00
|
|
|
bl SetMainCallback2
|
2015-10-10 03:12:48 -07:00
|
|
|
@08000414:
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r2, =0x030022b4
|
|
|
|
strb r4, [r2]
|
|
|
|
ldr r1, =0x03000000
|
|
|
|
movs r3, 0xFC
|
|
|
|
lsls r3, 4
|
|
|
|
adds r0, r3, 0
|
|
|
|
strh r0, [r1]
|
|
|
|
ldr r7, =0x030022c0
|
|
|
|
movs r0, 0
|
|
|
|
mov r8, r0
|
|
|
|
adds r6, r2, 0
|
2015-10-10 03:12:48 -07:00
|
|
|
@0800042A:
|
2015-11-29 23:17:50 -08:00
|
|
|
bl ReadKeypad
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r0, =0x03002700
|
|
|
|
ldrb r0, [r0]
|
|
|
|
cmp r0, 0
|
2015-10-10 03:12:48 -07:00
|
|
|
bne @08000454
|
2015-10-06 05:46:30 -07:00
|
|
|
ldrh r1, [r7, 0x28]
|
|
|
|
movs r0, 0x1
|
|
|
|
ands r0, r1
|
|
|
|
cmp r0, 0
|
2015-10-10 03:12:48 -07:00
|
|
|
beq @08000454
|
2015-10-06 05:46:30 -07:00
|
|
|
movs r0, 0xE
|
|
|
|
ands r0, r1
|
|
|
|
cmp r0, 0xE
|
2015-10-10 03:12:48 -07:00
|
|
|
bne @08000454
|
2015-10-06 05:46:30 -07:00
|
|
|
bl rfu_REQ_stopMode
|
|
|
|
bl rfu_waitREQComplete
|
2015-11-29 23:17:50 -08:00
|
|
|
bl Reset
|
2015-10-10 03:12:48 -07:00
|
|
|
@08000454:
|
2015-10-06 05:46:30 -07:00
|
|
|
bl sub_8087634
|
|
|
|
cmp r0, 0x1
|
2015-10-10 03:12:48 -07:00
|
|
|
bne @0800048C
|
2015-10-06 05:46:30 -07:00
|
|
|
strb r0, [r6]
|
2015-11-29 23:17:50 -08:00
|
|
|
bl HandleLinkConnectionAndCallMainCallbacks
|
2015-10-06 05:46:30 -07:00
|
|
|
movs r0, 0
|
|
|
|
strb r0, [r6]
|
2015-10-10 03:12:48 -07:00
|
|
|
b @080004B2
|
2015-10-06 05:46:30 -07:00
|
|
|
.pool
|
2015-10-10 03:12:48 -07:00
|
|
|
@0800048C:
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r5, =0x030022b4
|
|
|
|
movs r0, 0
|
|
|
|
strb r0, [r5]
|
2015-11-29 23:17:50 -08:00
|
|
|
bl HandleLinkConnectionAndCallMainCallbacks
|
2015-10-06 05:46:30 -07:00
|
|
|
bl sub_80875C8
|
|
|
|
adds r4, r0, 0
|
|
|
|
cmp r4, 0x1
|
2015-10-10 03:12:48 -07:00
|
|
|
bne @080004B2
|
2015-10-06 05:46:30 -07:00
|
|
|
movs r0, 0
|
|
|
|
strh r0, [r7, 0x2E]
|
|
|
|
bl copy_queue_clear
|
|
|
|
strb r4, [r5]
|
2015-11-29 23:17:50 -08:00
|
|
|
bl HandleLinkConnectionAndCallMainCallbacks
|
2015-10-06 05:46:30 -07:00
|
|
|
mov r2, r8
|
|
|
|
strb r2, [r5]
|
2015-10-10 03:12:48 -07:00
|
|
|
@080004B2:
|
2015-10-06 05:46:30 -07:00
|
|
|
bl gametime_increment
|
|
|
|
bl sound_something
|
2015-11-29 23:17:50 -08:00
|
|
|
bl WaitForVBlankIntr
|
2015-10-10 03:12:48 -07:00
|
|
|
b @0800042A
|
2015-10-06 05:46:30 -07:00
|
|
|
.pool
|
|
|
|
thumb_func_end Main
|
|
|
|
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_start HandleLinkConnectionAndCallMainCallbacks
|
|
|
|
; void HandleLinkConnectionAndCallMainCallbacks()
|
|
|
|
HandleLinkConnectionAndCallMainCallbacks: ; 80004C4
|
2015-10-06 05:46:30 -07:00
|
|
|
push {lr}
|
2015-11-29 23:17:50 -08:00
|
|
|
bl HandleLinkConnection
|
2015-10-06 05:46:30 -07:00
|
|
|
lsls r0, 24
|
|
|
|
cmp r0, 0
|
2015-10-10 03:12:48 -07:00
|
|
|
bne @080004D4
|
2015-11-29 23:17:50 -08:00
|
|
|
bl CallMainCallbacks
|
2015-10-10 03:12:48 -07:00
|
|
|
@080004D4:
|
2015-10-06 05:46:30 -07:00
|
|
|
pop {r0}
|
|
|
|
bx r0
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_end HandleLinkConnectionAndCallMainCallbacks
|
2015-10-06 05:46:30 -07:00
|
|
|
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_start InitVariablesAndSetCopyrightScreenCallback
|
|
|
|
; void InitVariablesAndSetCopyrightScreenCallback()
|
|
|
|
InitVariablesAndSetCopyrightScreenCallback: ; 80004D8
|
2015-10-06 05:46:30 -07:00
|
|
|
push {lr}
|
|
|
|
ldr r2, =0x030022c0
|
|
|
|
movs r0, 0
|
|
|
|
str r0, [r2, 0x20]
|
|
|
|
ldr r1, =0x0203cf5c
|
|
|
|
str r0, [r1]
|
|
|
|
str r0, [r2, 0x24]
|
|
|
|
str r0, [r2]
|
2015-10-20 23:52:50 -07:00
|
|
|
ldr r0, =c2_copyright_1
|
2015-11-29 23:17:50 -08:00
|
|
|
bl SetMainCallback2
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r1, =0x03005d90
|
|
|
|
ldr r0, =0x02024a54
|
|
|
|
str r0, [r1]
|
|
|
|
ldr r1, =0x03005d94
|
|
|
|
ldr r0, =0x02029808
|
|
|
|
str r0, [r1]
|
|
|
|
pop {r0}
|
|
|
|
bx r0
|
|
|
|
.pool
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_end InitVariablesAndSetCopyrightScreenCallback
|
2015-10-06 05:46:30 -07:00
|
|
|
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_start CallMainCallbacks
|
|
|
|
; void CallMainCallbacks()
|
|
|
|
CallMainCallbacks: ; 800051C
|
2015-10-06 05:46:30 -07:00
|
|
|
push {r4,lr}
|
|
|
|
ldr r4, =0x030022c0
|
|
|
|
ldr r0, [r4]
|
|
|
|
cmp r0, 0
|
2015-10-10 03:12:48 -07:00
|
|
|
beq @0800052A
|
2015-10-06 05:46:30 -07:00
|
|
|
bl _call_via_r0
|
2015-10-10 03:12:48 -07:00
|
|
|
@0800052A:
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r0, [r4, 0x4]
|
|
|
|
cmp r0, 0
|
2015-10-10 03:12:48 -07:00
|
|
|
beq @08000534
|
2015-10-06 05:46:30 -07:00
|
|
|
bl _call_via_r0
|
2015-10-10 03:12:48 -07:00
|
|
|
@08000534:
|
2015-10-06 05:46:30 -07:00
|
|
|
pop {r4}
|
|
|
|
pop {r0}
|
|
|
|
bx r0
|
|
|
|
.pool
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_end CallMainCallbacks
|
2015-10-06 05:46:30 -07:00
|
|
|
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_start SetMainCallback2
|
|
|
|
; void SetMainCallback2(void ( *func)())
|
|
|
|
SetMainCallback2: ; 8000540
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r1, =0x030022c0
|
|
|
|
str r0, [r1, 0x4]
|
|
|
|
movs r0, 0x87
|
|
|
|
lsls r0, 3
|
|
|
|
adds r1, r0
|
|
|
|
movs r0, 0
|
|
|
|
strb r0, [r1]
|
|
|
|
bx lr
|
|
|
|
.pool
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_end SetMainCallback2
|
2015-10-06 05:46:30 -07:00
|
|
|
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_start StartTimer1
|
|
|
|
; void StartTimer1()
|
|
|
|
StartTimer1: ; 8000554
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r1, =0x04000106
|
|
|
|
movs r0, 0x80
|
|
|
|
strh r0, [r1]
|
|
|
|
bx lr
|
|
|
|
.pool
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_end StartTimer1
|
2015-10-06 05:46:30 -07:00
|
|
|
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_start SetRngAndSetTrainerId
|
|
|
|
; void SetRngAndSetTrainerId()
|
|
|
|
SetRngAndSetTrainerId: ; 8000560
|
2015-10-06 05:46:30 -07:00
|
|
|
push {r4,lr}
|
|
|
|
ldr r0, =0x04000104
|
|
|
|
ldrh r4, [r0]
|
|
|
|
adds r0, r4, 0
|
|
|
|
bl SeedRng
|
|
|
|
ldr r1, =0x04000106
|
|
|
|
movs r0, 0
|
|
|
|
strh r0, [r1]
|
|
|
|
ldr r0, =0x02020000
|
|
|
|
strh r4, [r0]
|
|
|
|
pop {r4}
|
|
|
|
pop {r0}
|
|
|
|
bx r0
|
|
|
|
.pool
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_end SetRngAndSetTrainerId
|
2015-10-06 05:46:30 -07:00
|
|
|
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_start GetTrainerId
|
|
|
|
; u16 GetTrainerId()
|
|
|
|
GetTrainerId: ; 8000588
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r0, =0x02020000
|
|
|
|
ldrh r0, [r0]
|
|
|
|
bx lr
|
|
|
|
.pool
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_end GetTrainerId
|
2015-10-06 05:46:30 -07:00
|
|
|
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_start EnableVCountIntrAtLine150
|
|
|
|
; void EnableVCountIntrAtLine150()
|
|
|
|
EnableVCountIntrAtLine150: ; 8000594
|
2015-10-06 05:46:30 -07:00
|
|
|
push {lr}
|
|
|
|
movs r0, 0x4
|
2015-11-29 23:17:50 -08:00
|
|
|
bl GetGpuReg
|
2015-10-06 05:46:30 -07:00
|
|
|
movs r1, 0xFF
|
|
|
|
ands r1, r0
|
|
|
|
movs r2, 0x96
|
|
|
|
lsls r2, 8
|
|
|
|
adds r0, r2, 0
|
|
|
|
orrs r1, r0
|
|
|
|
movs r0, 0x20
|
|
|
|
orrs r1, r0
|
|
|
|
movs r0, 0x4
|
2015-11-29 23:17:50 -08:00
|
|
|
bl SetGpuReg
|
2015-10-06 05:46:30 -07:00
|
|
|
movs r0, 0x4
|
2015-11-29 23:17:50 -08:00
|
|
|
bl EnableInterrupts
|
2015-10-06 05:46:30 -07:00
|
|
|
pop {r0}
|
|
|
|
bx r0
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_end EnableVCountIntrAtLine150
|
2015-10-06 05:46:30 -07:00
|
|
|
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_start InitKeypadData
|
|
|
|
; void InitKeypadData()
|
|
|
|
InitKeypadData: ; 80005BC
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r1, =0x030026fc
|
|
|
|
movs r0, 0x5
|
|
|
|
strh r0, [r1]
|
|
|
|
ldr r1, =0x030022b0
|
|
|
|
movs r0, 0x28
|
|
|
|
strh r0, [r1]
|
|
|
|
ldr r1, =0x030022c0
|
|
|
|
movs r0, 0
|
|
|
|
strh r0, [r1, 0x2C]
|
|
|
|
strh r0, [r1, 0x2E]
|
|
|
|
strh r0, [r1, 0x30]
|
|
|
|
strh r0, [r1, 0x28]
|
|
|
|
strh r0, [r1, 0x2A]
|
|
|
|
bx lr
|
|
|
|
.pool
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_end InitKeypadData
|
2015-10-06 05:46:30 -07:00
|
|
|
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_start ReadKeypad
|
|
|
|
; void ReadKeypad()
|
|
|
|
ReadKeypad: ; 80005E4
|
2015-10-06 05:46:30 -07:00
|
|
|
push {lr}
|
|
|
|
ldr r0, =0x04000130
|
|
|
|
ldrh r1, [r0]
|
|
|
|
ldr r2, =0x000003ff
|
|
|
|
adds r0, r2, 0
|
|
|
|
adds r3, r0, 0
|
|
|
|
eors r3, r1
|
|
|
|
ldr r1, =0x030022c0
|
|
|
|
ldrh r2, [r1, 0x28]
|
|
|
|
adds r0, r3, 0
|
|
|
|
bics r0, r2
|
|
|
|
strh r0, [r1, 0x2A]
|
|
|
|
strh r0, [r1, 0x2E]
|
|
|
|
strh r0, [r1, 0x30]
|
|
|
|
adds r2, r1, 0
|
|
|
|
cmp r3, 0
|
2015-10-10 03:12:48 -07:00
|
|
|
beq @08000630
|
2015-10-06 05:46:30 -07:00
|
|
|
ldrh r0, [r2, 0x2C]
|
|
|
|
cmp r0, r3
|
2015-10-10 03:12:48 -07:00
|
|
|
bne @08000630
|
2015-10-06 05:46:30 -07:00
|
|
|
ldrh r0, [r2, 0x32]
|
|
|
|
subs r0, 0x1
|
|
|
|
strh r0, [r2, 0x32]
|
|
|
|
lsls r0, 16
|
|
|
|
cmp r0, 0
|
2015-10-10 03:12:48 -07:00
|
|
|
bne @08000636
|
2015-10-06 05:46:30 -07:00
|
|
|
strh r3, [r2, 0x30]
|
|
|
|
ldr r0, =0x030026fc
|
2015-10-10 03:12:48 -07:00
|
|
|
b @08000632
|
2015-10-06 05:46:30 -07:00
|
|
|
.pool
|
2015-10-10 03:12:48 -07:00
|
|
|
@08000630:
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r0, =0x030022b0
|
2015-10-10 03:12:48 -07:00
|
|
|
@08000632:
|
2015-10-06 05:46:30 -07:00
|
|
|
ldrh r0, [r0]
|
|
|
|
strh r0, [r2, 0x32]
|
2015-10-10 03:12:48 -07:00
|
|
|
@08000636:
|
2015-10-06 05:46:30 -07:00
|
|
|
strh r3, [r2, 0x28]
|
|
|
|
strh r3, [r2, 0x2C]
|
|
|
|
ldr r0, =0x03005d90
|
|
|
|
ldr r0, [r0]
|
|
|
|
ldrb r0, [r0, 0x13]
|
|
|
|
cmp r0, 0x2
|
2015-10-10 03:12:48 -07:00
|
|
|
bne @08000668
|
2015-10-06 05:46:30 -07:00
|
|
|
ldrh r1, [r2, 0x2E]
|
|
|
|
movs r3, 0x80
|
|
|
|
lsls r3, 2
|
|
|
|
adds r0, r3, 0
|
|
|
|
ands r0, r1
|
|
|
|
cmp r0, 0
|
2015-10-10 03:12:48 -07:00
|
|
|
beq @08000658
|
2015-10-06 05:46:30 -07:00
|
|
|
movs r0, 0x1
|
|
|
|
orrs r0, r1
|
|
|
|
strh r0, [r2, 0x2E]
|
2015-10-10 03:12:48 -07:00
|
|
|
@08000658:
|
2015-10-06 05:46:30 -07:00
|
|
|
ldrh r1, [r2, 0x2C]
|
|
|
|
adds r0, r3, 0
|
|
|
|
ands r0, r1
|
|
|
|
cmp r0, 0
|
2015-10-10 03:12:48 -07:00
|
|
|
beq @08000668
|
2015-10-06 05:46:30 -07:00
|
|
|
movs r0, 0x1
|
|
|
|
orrs r0, r1
|
|
|
|
strh r0, [r2, 0x2C]
|
2015-10-10 03:12:48 -07:00
|
|
|
@08000668:
|
2015-10-06 05:46:30 -07:00
|
|
|
ldrh r1, [r2, 0x2E]
|
|
|
|
ldrh r0, [r2, 0x36]
|
|
|
|
ands r0, r1
|
|
|
|
cmp r0, 0
|
2015-10-10 03:12:48 -07:00
|
|
|
beq @08000676
|
2015-10-06 05:46:30 -07:00
|
|
|
movs r0, 0x1
|
|
|
|
strh r0, [r2, 0x34]
|
2015-10-10 03:12:48 -07:00
|
|
|
@08000676:
|
2015-10-06 05:46:30 -07:00
|
|
|
pop {r0}
|
|
|
|
bx r0
|
|
|
|
.pool
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_end ReadKeypad
|
2015-10-06 05:46:30 -07:00
|
|
|
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_start InitIntrHandlers
|
|
|
|
; void InitIntrHandlers()
|
|
|
|
InitIntrHandlers: ; 8000684
|
2015-10-06 05:46:30 -07:00
|
|
|
push {r4,r5,lr}
|
|
|
|
ldr r5, =InterruptMain
|
|
|
|
ldr r4, =0x03002750
|
2015-10-06 20:45:31 -07:00
|
|
|
ldr r3, =gRomInterruptTable
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r2, =0x03002710
|
|
|
|
movs r1, 0xD
|
2015-10-10 03:12:48 -07:00
|
|
|
@08000690:
|
2015-10-06 05:46:30 -07:00
|
|
|
ldm r3!, {r0}
|
|
|
|
stm r2!, {r0}
|
|
|
|
subs r1, 0x1
|
|
|
|
cmp r1, 0
|
2015-10-10 03:12:48 -07:00
|
|
|
bge @08000690
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r0, =0x040000d4
|
|
|
|
str r5, [r0]
|
|
|
|
str r4, [r0, 0x4]
|
|
|
|
ldr r1, =0x84000200
|
|
|
|
str r1, [r0, 0x8]
|
|
|
|
ldr r0, [r0, 0x8]
|
|
|
|
ldr r0, =0x03007ffc
|
|
|
|
str r4, [r0]
|
|
|
|
movs r0, 0
|
|
|
|
bl SetVBlankCallback
|
|
|
|
movs r0, 0
|
|
|
|
bl SetHBlankCallback
|
|
|
|
movs r0, 0
|
2015-11-29 23:17:50 -08:00
|
|
|
bl SetSerialCallback
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r1, =0x04000208
|
|
|
|
movs r0, 0x1
|
|
|
|
strh r0, [r1]
|
|
|
|
movs r0, 0x1
|
2015-11-29 23:17:50 -08:00
|
|
|
bl EnableInterrupts
|
2015-10-06 05:46:30 -07:00
|
|
|
pop {r4,r5}
|
|
|
|
pop {r0}
|
|
|
|
bx r0
|
|
|
|
.pool
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_end InitIntrHandlers
|
2015-10-06 05:46:30 -07:00
|
|
|
|
|
|
|
thumb_func_start SetVBlankCallback
|
2015-10-10 03:12:48 -07:00
|
|
|
; void SetVBlankCallback(void ( *func)())
|
|
|
|
SetVBlankCallback: ; 80006F0
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r1, =0x030022c0
|
|
|
|
str r0, [r1, 0xC]
|
|
|
|
bx lr
|
|
|
|
.pool
|
|
|
|
thumb_func_end SetVBlankCallback
|
|
|
|
|
|
|
|
thumb_func_start SetHBlankCallback
|
2015-10-10 03:12:48 -07:00
|
|
|
; void SetHBlankCallback(void ( *func)())
|
|
|
|
SetHBlankCallback: ; 80006FC
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r1, =0x030022c0
|
|
|
|
str r0, [r1, 0x10]
|
|
|
|
bx lr
|
|
|
|
.pool
|
|
|
|
thumb_func_end SetHBlankCallback
|
|
|
|
|
|
|
|
thumb_func_start SetVCountCallback
|
2015-11-29 23:17:50 -08:00
|
|
|
; void SetVCountCallback(void ( *func)())
|
2015-10-10 03:12:48 -07:00
|
|
|
SetVCountCallback: ; 8000708
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r1, =0x030022c0
|
|
|
|
str r0, [r1, 0x14]
|
|
|
|
bx lr
|
|
|
|
.pool
|
|
|
|
thumb_func_end SetVCountCallback
|
|
|
|
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_start RestoreSerialTimer3IntrHandlers
|
|
|
|
; void RestoreSerialTimer3IntrHandlers()
|
|
|
|
RestoreSerialTimer3IntrHandlers: ; 8000714
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r0, =0x03002710
|
2015-11-29 23:17:50 -08:00
|
|
|
ldr r1, =SerialIntr
|
2015-10-06 05:46:30 -07:00
|
|
|
str r1, [r0, 0x4]
|
2015-11-29 23:17:50 -08:00
|
|
|
ldr r1, =Timer3Intr
|
2015-10-06 05:46:30 -07:00
|
|
|
str r1, [r0, 0x8]
|
|
|
|
bx lr
|
|
|
|
.pool
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_end RestoreSerialTimer3IntrHandlers
|
2015-10-06 05:46:30 -07:00
|
|
|
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_start SetSerialCallback
|
|
|
|
; void SetSerialCallback(void ( *func)())
|
|
|
|
SetSerialCallback: ; 800072C
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r1, =0x030022c0
|
|
|
|
str r0, [r1, 0x18]
|
|
|
|
bx lr
|
|
|
|
.pool
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_end SetSerialCallback
|
2015-10-06 05:46:30 -07:00
|
|
|
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_start VBlankIntr
|
|
|
|
; void VBlankIntr()
|
|
|
|
VBlankIntr: ; 8000738
|
2015-10-06 05:46:30 -07:00
|
|
|
push {r4,lr}
|
|
|
|
ldr r0, =0x030030fc
|
|
|
|
ldrb r0, [r0]
|
|
|
|
cmp r0, 0
|
2015-10-10 03:12:48 -07:00
|
|
|
beq @0800074C
|
2015-10-06 05:46:30 -07:00
|
|
|
bl rfu_syncVBlank__
|
2015-10-10 03:12:48 -07:00
|
|
|
b @08000758
|
2015-10-06 05:46:30 -07:00
|
|
|
.pool
|
2015-10-10 03:12:48 -07:00
|
|
|
@0800074C:
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r0, =0x03002748
|
|
|
|
ldrb r0, [r0]
|
|
|
|
cmp r0, 0
|
2015-10-10 03:12:48 -07:00
|
|
|
bne @08000758
|
2015-10-06 05:46:30 -07:00
|
|
|
bl sub_800B9B8
|
2015-10-10 03:12:48 -07:00
|
|
|
@08000758:
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r0, =0x030022c0
|
|
|
|
ldr r1, [r0, 0x20]
|
|
|
|
adds r1, 0x1
|
|
|
|
str r1, [r0, 0x20]
|
|
|
|
ldr r1, =0x0203cf5c
|
|
|
|
ldr r1, [r1]
|
|
|
|
adds r4, r0, 0
|
|
|
|
cmp r1, 0
|
2015-10-10 03:12:48 -07:00
|
|
|
beq @08000778
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r2, [r1]
|
|
|
|
movs r0, 0x2
|
|
|
|
negs r0, r0
|
|
|
|
cmp r2, r0
|
2015-10-10 03:12:48 -07:00
|
|
|
bhi @08000778
|
2015-10-06 05:46:30 -07:00
|
|
|
adds r0, r2, 0x1
|
|
|
|
str r0, [r1]
|
2015-10-10 03:12:48 -07:00
|
|
|
@08000778:
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r0, [r4, 0xC]
|
|
|
|
cmp r0, 0
|
2015-10-10 03:12:48 -07:00
|
|
|
beq @08000782
|
2015-10-06 05:46:30 -07:00
|
|
|
bl _call_via_r0
|
2015-10-10 03:12:48 -07:00
|
|
|
@08000782:
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r0, [r4, 0x24]
|
|
|
|
adds r0, 0x1
|
|
|
|
str r0, [r4, 0x24]
|
2015-11-29 23:17:50 -08:00
|
|
|
bl CopyBufferedValuesToGpuRegs
|
2015-10-06 20:15:42 -07:00
|
|
|
bl ProcessDma3Requests
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r1, =0x03002f50
|
|
|
|
ldr r0, =0x03006380
|
|
|
|
ldrb r0, [r0, 0x4]
|
|
|
|
strb r0, [r1]
|
|
|
|
bl m4aSoundMain
|
|
|
|
bl sub_8033648
|
|
|
|
ldr r1, =0x00000439
|
|
|
|
adds r0, r4, r1
|
|
|
|
ldrb r1, [r0]
|
|
|
|
movs r0, 0x2
|
|
|
|
ands r0, r1
|
|
|
|
cmp r0, 0
|
2015-10-10 03:12:48 -07:00
|
|
|
beq @080007BA
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r0, =0x02022fec
|
|
|
|
ldr r0, [r0]
|
|
|
|
ldr r1, =0x013f0102
|
|
|
|
ands r0, r1
|
|
|
|
cmp r0, 0
|
2015-10-10 03:12:48 -07:00
|
|
|
bne @080007BE
|
|
|
|
@080007BA:
|
2015-10-06 05:46:30 -07:00
|
|
|
bl GenerateRandomNumber
|
2015-10-10 03:12:48 -07:00
|
|
|
@080007BE:
|
2015-10-06 05:46:30 -07:00
|
|
|
bl sub_800E174
|
|
|
|
ldr r2, =0x03007ff8
|
|
|
|
ldrh r0, [r2]
|
|
|
|
movs r1, 0x1
|
|
|
|
orrs r0, r1
|
|
|
|
strh r0, [r2]
|
|
|
|
ldr r0, =0x030022c0
|
|
|
|
ldrh r2, [r0, 0x1C]
|
|
|
|
ldrh r3, [r0, 0x1C]
|
|
|
|
orrs r1, r2
|
|
|
|
strh r1, [r0, 0x1C]
|
|
|
|
pop {r4}
|
|
|
|
pop {r0}
|
|
|
|
bx r0
|
|
|
|
.pool
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_end VBlankIntr
|
2015-10-06 05:46:30 -07:00
|
|
|
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_start StartFlashMemoryTimer
|
|
|
|
; void StartFlashMemoryTimer()
|
|
|
|
StartFlashMemoryTimer: ; 8000800
|
2015-10-06 05:46:30 -07:00
|
|
|
push {lr}
|
|
|
|
ldr r1, =0x0300272c
|
|
|
|
movs r0, 0x2
|
|
|
|
bl SetFlashTimerIntr
|
|
|
|
pop {r0}
|
|
|
|
bx r0
|
|
|
|
.pool
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_end StartFlashMemoryTimer
|
2015-10-06 05:46:30 -07:00
|
|
|
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_start HBlankIntr
|
|
|
|
; void HBlankIntr()
|
|
|
|
HBlankIntr: ; 8000814
|
2015-10-06 05:46:30 -07:00
|
|
|
push {r4,lr}
|
|
|
|
ldr r4, =0x030022c0
|
|
|
|
ldr r0, [r4, 0x10]
|
|
|
|
cmp r0, 0
|
2015-10-10 03:12:48 -07:00
|
|
|
beq @08000822
|
2015-10-06 05:46:30 -07:00
|
|
|
bl _call_via_r0
|
2015-10-10 03:12:48 -07:00
|
|
|
@08000822:
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r2, =0x03007ff8
|
|
|
|
ldrh r0, [r2]
|
|
|
|
movs r1, 0x2
|
|
|
|
orrs r0, r1
|
|
|
|
strh r0, [r2]
|
|
|
|
ldrh r0, [r4, 0x1C]
|
|
|
|
ldrh r2, [r4, 0x1C]
|
|
|
|
orrs r1, r0
|
|
|
|
strh r1, [r4, 0x1C]
|
|
|
|
pop {r4}
|
|
|
|
pop {r0}
|
|
|
|
bx r0
|
|
|
|
.pool
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_end HBlankIntr
|
2015-10-06 05:46:30 -07:00
|
|
|
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_start VCountIntr
|
|
|
|
; void VCountIntr()
|
|
|
|
VCountIntr: ; 8000844
|
2015-10-06 05:46:30 -07:00
|
|
|
push {r4,lr}
|
|
|
|
ldr r4, =0x030022c0
|
|
|
|
ldr r0, [r4, 0x14]
|
|
|
|
cmp r0, 0
|
2015-10-10 03:12:48 -07:00
|
|
|
beq @08000852
|
2015-10-06 05:46:30 -07:00
|
|
|
bl _call_via_r0
|
2015-10-10 03:12:48 -07:00
|
|
|
@08000852:
|
2015-10-06 05:46:30 -07:00
|
|
|
bl SoundVSync_rev01
|
|
|
|
ldr r2, =0x03007ff8
|
|
|
|
ldrh r0, [r2]
|
|
|
|
movs r1, 0x4
|
|
|
|
orrs r0, r1
|
|
|
|
strh r0, [r2]
|
|
|
|
ldrh r0, [r4, 0x1C]
|
|
|
|
ldrh r2, [r4, 0x1C]
|
|
|
|
orrs r1, r0
|
|
|
|
strh r1, [r4, 0x1C]
|
|
|
|
pop {r4}
|
|
|
|
pop {r0}
|
|
|
|
bx r0
|
|
|
|
.pool
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_end VCountIntr
|
2015-10-06 05:46:30 -07:00
|
|
|
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_start SerialIntr
|
|
|
|
; void SerialIntr()
|
|
|
|
SerialIntr: ; 8000878
|
2015-10-06 05:46:30 -07:00
|
|
|
push {r4,lr}
|
|
|
|
ldr r4, =0x030022c0
|
|
|
|
ldr r0, [r4, 0x18]
|
|
|
|
cmp r0, 0
|
2015-10-10 03:12:48 -07:00
|
|
|
beq @08000886
|
2015-10-06 05:46:30 -07:00
|
|
|
bl _call_via_r0
|
2015-10-10 03:12:48 -07:00
|
|
|
@08000886:
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r2, =0x03007ff8
|
|
|
|
ldrh r0, [r2]
|
|
|
|
movs r1, 0x80
|
|
|
|
orrs r0, r1
|
|
|
|
strh r0, [r2]
|
|
|
|
ldrh r0, [r4, 0x1C]
|
|
|
|
ldrh r2, [r4, 0x1C]
|
|
|
|
orrs r1, r0
|
|
|
|
strh r1, [r4, 0x1C]
|
|
|
|
pop {r4}
|
|
|
|
pop {r0}
|
|
|
|
bx r0
|
|
|
|
.pool
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_end SerialIntr
|
2015-10-06 05:46:30 -07:00
|
|
|
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_start DummyIntrHandler
|
|
|
|
; void DummyIntrHandler()
|
|
|
|
DummyIntrHandler: ; 80008A8
|
2015-10-06 05:46:30 -07:00
|
|
|
bx lr
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_end DummyIntrHandler
|
2015-10-06 05:46:30 -07:00
|
|
|
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_start WaitForVBlankIntr
|
|
|
|
; void WaitForVBlankIntr()
|
|
|
|
WaitForVBlankIntr: ; 80008AC
|
2015-10-06 05:46:30 -07:00
|
|
|
push {lr}
|
|
|
|
ldr r2, =0x030022c0
|
|
|
|
ldrh r1, [r2, 0x1C]
|
|
|
|
ldr r0, =0x0000fffe
|
|
|
|
ands r0, r1
|
|
|
|
ldrh r1, [r2, 0x1C]
|
|
|
|
strh r0, [r2, 0x1C]
|
|
|
|
ldrh r1, [r2, 0x1C]
|
|
|
|
movs r0, 0x1
|
|
|
|
ands r0, r1
|
|
|
|
cmp r0, 0
|
2015-10-10 03:12:48 -07:00
|
|
|
bne @080008D0
|
2015-10-06 05:46:30 -07:00
|
|
|
movs r3, 0x1
|
2015-10-10 03:12:48 -07:00
|
|
|
@080008C6:
|
2015-10-06 05:46:30 -07:00
|
|
|
ldrh r1, [r2, 0x1C]
|
|
|
|
adds r0, r3, 0
|
|
|
|
ands r0, r1
|
|
|
|
cmp r0, 0
|
2015-10-10 03:12:48 -07:00
|
|
|
beq @080008C6
|
|
|
|
@080008D0:
|
2015-10-06 05:46:30 -07:00
|
|
|
pop {r0}
|
|
|
|
bx r0
|
|
|
|
.pool
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_end WaitForVBlankIntr
|
2015-10-06 05:46:30 -07:00
|
|
|
|
|
|
|
thumb_func_start sub_80008DC
|
2015-10-10 03:12:48 -07:00
|
|
|
sub_80008DC: ; 80008DC
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r1, =0x0203cf5c
|
|
|
|
str r0, [r1]
|
|
|
|
bx lr
|
|
|
|
.pool
|
|
|
|
thumb_func_end sub_80008DC
|
|
|
|
|
|
|
|
thumb_func_start sub_80008E8
|
2015-10-10 03:12:48 -07:00
|
|
|
sub_80008E8: ; 80008E8
|
2015-10-06 05:46:30 -07:00
|
|
|
ldr r1, =0x0203cf5c
|
|
|
|
movs r0, 0
|
|
|
|
str r0, [r1]
|
|
|
|
bx lr
|
|
|
|
.pool
|
|
|
|
thumb_func_end sub_80008E8
|
|
|
|
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_start Reset
|
|
|
|
; void Reset()
|
|
|
|
Reset: ; 80008F4
|
2015-10-06 05:46:30 -07:00
|
|
|
push {r4,lr}
|
|
|
|
ldr r1, =0x04000208
|
|
|
|
movs r0, 0
|
|
|
|
strh r0, [r1]
|
|
|
|
bl SoundVSyncOff_rev01
|
|
|
|
bl remove_some_task
|
|
|
|
ldr r1, =0x040000bc
|
|
|
|
ldrh r2, [r1, 0xA]
|
|
|
|
ldr r3, =0x0000c5ff
|
|
|
|
adds r0, r3, 0
|
|
|
|
ands r0, r2
|
|
|
|
strh r0, [r1, 0xA]
|
|
|
|
ldrh r4, [r1, 0xA]
|
|
|
|
ldr r2, =0x00007fff
|
|
|
|
adds r0, r2, 0
|
|
|
|
ands r0, r4
|
|
|
|
strh r0, [r1, 0xA]
|
|
|
|
ldrh r0, [r1, 0xA]
|
|
|
|
adds r1, 0xC
|
|
|
|
ldrh r4, [r1, 0xA]
|
|
|
|
adds r0, r3, 0
|
|
|
|
ands r0, r4
|
|
|
|
strh r0, [r1, 0xA]
|
|
|
|
ldrh r4, [r1, 0xA]
|
|
|
|
adds r0, r2, 0
|
|
|
|
ands r0, r4
|
|
|
|
strh r0, [r1, 0xA]
|
|
|
|
ldrh r0, [r1, 0xA]
|
|
|
|
ldr r0, =0x040000d4
|
|
|
|
ldrh r1, [r0, 0xA]
|
|
|
|
ands r3, r1
|
|
|
|
strh r3, [r0, 0xA]
|
|
|
|
ldrh r1, [r0, 0xA]
|
|
|
|
ands r2, r1
|
|
|
|
strh r2, [r0, 0xA]
|
|
|
|
ldrh r0, [r0, 0xA]
|
2015-11-27 15:32:24 -08:00
|
|
|
bl RTC_SetReadOnly
|
2015-10-06 05:46:30 -07:00
|
|
|
movs r0, 0xFF
|
|
|
|
bl SoftReset
|
|
|
|
pop {r4}
|
|
|
|
pop {r0}
|
|
|
|
bx r0
|
|
|
|
.pool
|
2015-11-29 23:17:50 -08:00
|
|
|
thumb_func_end Reset
|
2015-10-06 05:46:30 -07:00
|
|
|
|
|
|
|
thumb_func_start sub_8000964
|
2015-10-10 03:12:48 -07:00
|
|
|
sub_8000964: ; 8000964
|
2015-10-06 05:46:30 -07:00
|
|
|
push {lr}
|
|
|
|
sub sp, 0x4
|
|
|
|
mov r1, sp
|
|
|
|
movs r0, 0
|
|
|
|
strh r0, [r1]
|
|
|
|
ldr r1, =0x03007330
|
|
|
|
ldr r2, =0x01000034
|
|
|
|
mov r0, sp
|
|
|
|
bl CpuSet
|
|
|
|
add sp, 0x4
|
|
|
|
pop {r0}
|
|
|
|
bx r0
|
|
|
|
.pool
|
|
|
|
thumb_func_end sub_8000964
|