split out some code

This commit is contained in:
YamaArashi 2015-10-06 05:46:30 -07:00
parent b05c4231a9
commit 25342bcf33
10 changed files with 18045 additions and 18043 deletions

553
asm/dma3_manager.s Normal file
View File

@ -0,0 +1,553 @@
thumb_func_start dma3_transfer_queue_clear
dma3_transfer_queue_clear: @ 8000BB8
push {lr}
ldr r2, =0x03000810
movs r0, 0x1
strb r0, [r2]
ldr r1, =0x03000811
movs r0, 0
strb r0, [r1]
movs r3, 0
ldr r0, =0x03000010
movs r1, 0x7F
_08000BCC:
strh r3, [r0, 0x8]
str r3, [r0]
str r3, [r0, 0x4]
adds r0, 0x10
subs r1, 0x1
cmp r1, 0
bge _08000BCC
movs r0, 0
strb r0, [r2]
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end dma3_transfer_queue_clear
thumb_func_start dma_transfer_queue_process
dma_transfer_queue_process: @ 8000BF0
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0xC
ldr r0, =0x03000810
ldrb r0, [r0]
cmp r0, 0
beq _08000C06
b _08000E46
_08000C06:
movs r0, 0
str r0, [sp, 0x8]
ldr r1, =0x03000010
ldr r2, =0x03000811
ldrb r0, [r2]
lsls r0, 4
adds r0, r1
ldrh r0, [r0, 0x8]
mov r12, r2
cmp r0, 0
bne _08000C1E
b _08000E46
_08000C1E:
mov r8, r1
adds r1, 0x4
mov r10, r1
movs r6, 0x80
lsls r6, 5
ldr r7, =0x040000d4
movs r2, 0
mov r9, r2
_08000C2E:
mov r3, r12
ldrb r0, [r3]
lsls r5, r0, 4
mov r0, r8
adds r1, r5, r0
ldrh r0, [r1, 0x8]
ldr r2, [sp, 0x8]
adds r0, r2, r0
lsls r0, 16
lsrs r0, 16
str r0, [sp, 0x8]
movs r0, 0xA0
lsls r0, 8
ldr r3, [sp, 0x8]
cmp r3, r0
bls _08000C50
b _08000E46
_08000C50:
ldr r0, =0x04000006
ldrb r0, [r0]
cmp r0, 0xE0
bls _08000C5A
b _08000E46
_08000C5A:
ldrh r0, [r1, 0xA]
cmp r0, 0x2
beq _08000CD0
cmp r0, 0x2
bgt _08000C80
cmp r0, 0x1
beq _08000C8C
b _08000DF0
.align 2, 0
.pool
_08000C80:
cmp r0, 0x3
beq _08000D3C
cmp r0, 0x4
bne _08000C8A
b _08000D88
_08000C8A:
b _08000DF0
_08000C8C:
ldr r3, [r1]
mov r2, r10
adds r0, r5, r2
ldr r2, [r0]
ldrh r1, [r1, 0x8]
cmp r1, r6
bhi _08000CA6
str r3, [r7]
str r2, [r7, 0x4]
lsrs r0, r1, 2
movs r1, 0x84
lsls r1, 24
b _08000DAA
_08000CA6:
ldr r4, =0x040000d4
str r3, [r4]
str r2, [r4, 0x4]
ldr r0, =0x84000400
str r0, [r4, 0x8]
ldr r0, [r4, 0x8]
adds r3, r6
adds r2, r6
subs r1, r6
cmp r1, r6
bhi _08000CA6
str r3, [r4]
str r2, [r4, 0x4]
lsrs r0, r1, 2
movs r1, 0x84
lsls r1, 24
b _08000D76
.align 2, 0
.pool
_08000CD0:
mov r3, r10
adds r0, r5, r3
ldr r4, [r0]
ldrh r1, [r1, 0x8]
cmp r1, r6
bhi _08000CF4
mov r0, r8
adds r0, 0xC
adds r0, r5, r0
ldr r0, [r0]
str r0, [sp]
mov r5, sp
str r5, [r7]
str r4, [r7, 0x4]
lsrs r0, r1, 2
movs r1, 0x85
lsls r1, 24
b _08000DAA
_08000CF4:
mov r2, r12
ldrb r0, [r2]
lsls r0, 4
mov r5, r8
adds r5, 0xC
adds r0, r5
ldr r0, [r0]
str r0, [sp]
ldr r3, =0x040000d4
mov r0, sp
str r0, [r3]
str r4, [r3, 0x4]
ldr r0, =0x85000400
str r0, [r3, 0x8]
ldr r0, [r3, 0x8]
adds r4, r6
subs r1, r6
cmp r1, r6
bhi _08000CF4
ldrb r0, [r2]
lsls r0, 4
adds r0, r5
ldr r0, [r0]
str r0, [sp]
mov r2, sp
str r2, [r3]
str r4, [r3, 0x4]
lsrs r0, r1, 2
movs r1, 0x85
lsls r1, 24
b _08000DEA
.align 2, 0
.pool
_08000D3C:
ldr r3, [r1]
mov r2, r10
adds r0, r5, r2
ldr r2, [r0]
ldrh r1, [r1, 0x8]
cmp r1, r6
bhi _08000D56
str r3, [r7]
str r2, [r7, 0x4]
lsrs r0, r1, 1
movs r1, 0x80
lsls r1, 24
b _08000DAA
_08000D56:
ldr r4, =0x040000d4
str r3, [r4]
str r2, [r4, 0x4]
ldr r0, =0x80000800
str r0, [r4, 0x8]
ldr r0, [r4, 0x8]
adds r3, r6
adds r2, r6
subs r1, r6
cmp r1, r6
bhi _08000D56
str r3, [r4]
str r2, [r4, 0x4]
lsrs r0, r1, 1
movs r1, 0x80
lsls r1, 24
_08000D76:
orrs r0, r1
str r0, [r4, 0x8]
ldr r0, [r4, 0x8]
b _08000DF0
.align 2, 0
.pool
_08000D88:
mov r3, r10
adds r0, r5, r3
ldr r2, [r0]
ldrh r4, [r1, 0x8]
add r1, sp, 0x4
cmp r4, r6
bhi _08000DB2
mov r0, r8
adds r0, 0xC
adds r0, r5, r0
ldr r0, [r0]
strh r0, [r1]
str r1, [r7]
str r2, [r7, 0x4]
lsrs r0, r4, 1
movs r1, 0x81
lsls r1, 24
_08000DAA:
orrs r0, r1
str r0, [r7, 0x8]
ldr r0, [r7, 0x8]
b _08000DF0
_08000DB2:
mov r5, r12
ldrb r0, [r5]
lsls r0, 4
ldr r3, =0x0300001c
adds r0, r3
ldr r0, [r0]
strh r0, [r1]
ldr r3, =0x040000d4
str r1, [r3]
str r2, [r3, 0x4]
ldr r0, =0x81000800
str r0, [r3, 0x8]
ldr r0, [r3, 0x8]
adds r2, r6
subs r4, r6
cmp r4, r6
bhi _08000DB2
ldrb r0, [r5]
lsls r0, 4
ldr r5, =0x0300001c
adds r0, r5
ldr r0, [r0]
strh r0, [r1]
str r1, [r3]
str r2, [r3, 0x4]
lsrs r0, r4, 1
movs r1, 0x81
lsls r1, 24
_08000DEA:
orrs r0, r1
str r0, [r3, 0x8]
ldr r0, [r3, 0x8]
_08000DF0:
ldr r1, =0x03000010
mov r3, r12
ldrb r0, [r3]
lsls r0, 4
adds r0, r1
mov r2, r9
str r2, [r0]
ldrb r0, [r3]
lsls r0, 4
add r0, r10
str r2, [r0]
ldrb r0, [r3]
lsls r0, 4
adds r0, r1
movs r4, 0
strh r2, [r0, 0x8]
ldrb r0, [r3]
lsls r0, 4
adds r0, r1
mov r5, r9
strh r5, [r0, 0xA]
ldrb r0, [r3]
lsls r0, 4
adds r1, 0xC
adds r0, r1
mov r1, r9
str r1, [r0]
ldrb r0, [r3]
adds r0, 0x1
strb r0, [r3]
lsls r0, 24
cmp r0, 0
bge _08000E34
strb r4, [r3]
_08000E34:
mov r2, r12
ldrb r0, [r2]
lsls r0, 4
ldr r3, =0x03000010
adds r0, r3
ldrh r0, [r0, 0x8]
cmp r0, 0
beq _08000E46
b _08000C2E
_08000E46:
add sp, 0xC
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end dma_transfer_queue_process
thumb_func_start dma3_transfer_queue_add_copy
dma3_transfer_queue_add_copy: @ 8000E68
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
mov r12, r0
mov r8, r1
lsls r2, 16
lsrs r7, r2, 16
lsls r3, 24
lsrs r4, r3, 24
movs r5, 0
ldr r1, =0x03000810
movs r0, 0x1
strb r0, [r1]
ldr r0, =0x03000811
ldrb r2, [r0]
mov r10, r1
ldr r6, =0x03000010
mov r9, r6
lsls r0, r2, 4
adds r1, r0, r6
_08000E94:
lsls r3, r2, 4
ldrh r0, [r1, 0x8]
cmp r0, 0
bne _08000ED4
mov r0, r12
str r0, [r1]
mov r0, r9
adds r0, 0x4
adds r0, r3, r0
mov r3, r8
str r3, [r0]
strh r7, [r1, 0x8]
cmp r4, 0x1
bne _08000EC0
strh r4, [r1, 0xA]
b _08000EC4
.align 2, 0
.pool
_08000EC0:
movs r0, 0x3
strh r0, [r1, 0xA]
_08000EC4:
movs r0, 0
ldr r1, =0x03000810
strb r0, [r1]
lsls r0, r2, 16
asrs r0, 16
b _08000EF0
.align 2, 0
.pool
_08000ED4:
adds r1, 0x10
adds r2, 0x1
cmp r2, 0x7F
ble _08000EE0
adds r1, r6, 0
movs r2, 0
_08000EE0:
adds r5, 0x1
cmp r5, 0x7F
ble _08000E94
movs r0, 0
mov r3, r10
strb r0, [r3]
movs r0, 0x1
negs r0, r0
_08000EF0:
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end dma3_transfer_queue_add_copy
thumb_func_start dma3_transfer_queue_add_fill
dma3_transfer_queue_add_fill: @ 8000F00
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
mov r9, r0
mov r8, r1
lsls r2, 16
lsrs r7, r2, 16
lsls r3, 24
lsrs r5, r3, 24
movs r6, 0
ldr r0, =0x03000811
ldrb r2, [r0]
ldr r1, =0x03000810
movs r0, 0x1
strb r0, [r1]
mov r10, r1
ldr r0, =0x03000010
mov r12, r0
mov r4, r12
lsls r0, r2, 4
adds r0, 0x8
adds r1, r0, r4
_08000F30:
lsls r3, r2, 4
ldrh r0, [r1]
cmp r0, 0
bne _08000F78
adds r0, r4, 0x4
adds r0, r3, r0
mov r6, r8
str r6, [r0]
strh r7, [r1]
strh r5, [r1, 0x2]
adds r0, r4, 0
adds r0, 0xC
adds r0, r3, r0
mov r3, r9
str r3, [r0]
cmp r5, 0x1
bne _08000F64
movs r0, 0x2
b _08000F66
.align 2, 0
.pool
_08000F64:
movs r0, 0x4
_08000F66:
strh r0, [r1, 0x2]
movs r0, 0
ldr r6, =0x03000810
strb r0, [r6]
lsls r0, r2, 16
asrs r0, 16
b _08000F96
.align 2, 0
.pool
_08000F78:
adds r1, 0x10
adds r2, 0x1
cmp r2, 0x7F
ble _08000F86
mov r1, r12
adds r1, 0x8
movs r2, 0
_08000F86:
adds r6, 0x1
cmp r6, 0x7F
ble _08000F30
movs r0, 0
mov r1, r10
strb r0, [r1]
movs r0, 0x1
negs r0, r0
_08000F96:
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end dma3_transfer_queue_add_fill
thumb_func_start dma3_transfer_queue_check_for_space
dma3_transfer_queue_check_for_space: @ 8000FA4
push {lr}
movs r2, 0
lsls r0, 16
asrs r1, r0, 16
movs r3, 0x1
negs r3, r3
cmp r1, r3
bne _08000FCC
ldr r1, =0x03000010
_08000FB6:
ldrh r0, [r1, 0x8]
cmp r0, 0
bne _08000FD8
adds r1, 0x10
adds r2, 0x1
cmp r2, 0x7F
ble _08000FB6
_08000FC4:
movs r0, 0
b _08000FDC
.align 2, 0
.pool
_08000FCC:
ldr r0, =0x03000010
lsls r1, 4
adds r1, r0
ldrh r0, [r1, 0x8]
cmp r0, 0
beq _08000FC4
_08000FD8:
movs r0, 0x1
negs r0, r0
_08000FDC:
pop {r1}
bx r1
.align 2, 0
.pool
thumb_func_end dma3_transfer_queue_check_for_space

File diff suppressed because it is too large Load Diff

3380
asm/gpu_bg.s Normal file

File diff suppressed because it is too large Load Diff

4546
asm/gpu_obj.s Normal file

File diff suppressed because it is too large Load Diff

414
asm/gpu_reg_manager.s Normal file
View File

@ -0,0 +1,414 @@
thumb_func_start lcd_io_copy_queue_clean
lcd_io_copy_queue_clean: @ 8000FE4
push {r4-r7,lr}
mov r7, r8
push {r7}
movs r2, 0
ldr r7, =0x030008d8
ldr r0, =0x030008d9
mov r12, r0
ldr r1, =0x030008da
mov r8, r1
ldr r6, =0x03000818
movs r5, 0
ldr r4, =0x03000878
movs r3, 0xFF
_08000FFE:
adds r0, r2, r6
strb r5, [r0]
adds r1, r2, r4
ldrb r0, [r1]
orrs r0, r3
strb r0, [r1]
adds r2, 0x1
cmp r2, 0x5F
ble _08000FFE
movs r0, 0
strb r0, [r7]
mov r1, r12
strb r0, [r1]
movs r0, 0
mov r1, r8
strh r0, [r1]
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end lcd_io_copy_queue_clean
thumb_func_start lcd_io_buffer_to_hardware
lcd_io_buffer_to_hardware: @ 800103C
push {lr}
lsls r0, 24
lsrs r2, r0, 24
cmp r2, 0x4
bne _08001068
ldr r2, =0x04000004
ldrh r1, [r2]
ldr r0, =0x0000ffe7
ands r0, r1
strh r0, [r2]
ldr r1, =0x0300081c
ldrh r0, [r2]
ldrh r1, [r1]
orrs r0, r1
strh r0, [r2]
b _08001076
.align 2, 0
.pool
_08001068:
movs r0, 0x80
lsls r0, 19
adds r0, r2, r0
ldr r1, =0x03000818
adds r1, r2, r1
ldrh r1, [r1]
strh r1, [r0]
_08001076:
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end lcd_io_buffer_to_hardware
thumb_func_start lcd_io_copy_queue_process
lcd_io_copy_queue_process: @ 8001080
push {r4,r5,lr}
ldr r0, =0x030008d8
ldrb r0, [r0]
cmp r0, 0
bne _080010A4
movs r5, 0
_0800108C:
ldr r0, =0x03000878
adds r4, r5, r0
ldrb r0, [r4]
cmp r0, 0xFF
beq _080010A4
bl lcd_io_buffer_to_hardware
movs r0, 0xFF
strb r0, [r4]
adds r5, 0x1
cmp r5, 0x5F
ble _0800108C
_080010A4:
pop {r4,r5}
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end lcd_io_copy_queue_process
thumb_func_start lcd_io_set
lcd_io_set: @ 80010B4
push {r4,r5,lr}
lsls r0, 24
lsrs r4, r0, 24
lsls r1, 16
lsrs r1, 16
cmp r4, 0x5F
bhi _08001130
ldr r0, =0x03000818
adds r0, r4, r0
strh r1, [r0]
ldr r0, =0x04000006
ldrh r1, [r0]
movs r0, 0xFF
ands r0, r1
subs r0, 0xA1
lsls r0, 16
lsrs r0, 16
cmp r0, 0x40
bls _080010E8
movs r0, 0x80
lsls r0, 19
ldrh r1, [r0]
movs r0, 0x80
ands r0, r1
cmp r0, 0
beq _080010FE
_080010E8:
adds r0, r4, 0
bl lcd_io_buffer_to_hardware
b _08001130
.align 2, 0
.pool
_080010F8:
movs r0, 0
strb r0, [r5]
b _08001130
_080010FE:
ldr r2, =0x030008d8
movs r0, 0x1
strb r0, [r2]
movs r3, 0
ldr r0, =0x03000878
ldrb r1, [r0]
adds r5, r2, 0
adds r2, r0, 0
cmp r1, 0xFF
beq _08001128
adds r1, r2, 0
_08001114:
ldrb r0, [r1]
cmp r0, r4
beq _080010F8
adds r1, 0x1
adds r3, 0x1
cmp r3, 0x5F
bgt _08001128
ldrb r0, [r1]
cmp r0, 0xFF
bne _08001114
_08001128:
adds r0, r3, r2
movs r1, 0
strb r4, [r0]
strb r1, [r5]
_08001130:
pop {r4,r5}
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end lcd_io_set
thumb_func_start lcd_io_set_forced_blank
lcd_io_set_forced_blank: @ 8001140
push {r4,r5,lr}
lsls r0, 24
lsrs r4, r0, 24
lsls r1, 16
lsrs r1, 16
cmp r4, 0x5F
bhi _080011A8
ldr r0, =0x03000818
adds r0, r4, r0
strh r1, [r0]
movs r0, 0x80
lsls r0, 19
ldrh r1, [r0]
movs r0, 0x80
ands r0, r1
cmp r0, 0
beq _08001176
adds r0, r4, 0
bl lcd_io_buffer_to_hardware
b _080011A8
.align 2, 0
.pool
_08001170:
movs r0, 0
strb r0, [r5]
b _080011A8
_08001176:
ldr r2, =0x030008d8
movs r0, 0x1
strb r0, [r2]
movs r3, 0
ldr r0, =0x03000878
ldrb r1, [r0]
adds r5, r2, 0
adds r2, r0, 0
cmp r1, 0xFF
beq _080011A0
adds r1, r2, 0
_0800118C:
ldrb r0, [r1]
cmp r0, r4
beq _08001170
adds r1, 0x1
adds r3, 0x1
cmp r3, 0x5F
bgt _080011A0
ldrb r0, [r1]
cmp r0, 0xFF
bne _0800118C
_080011A0:
adds r0, r3, r2
movs r1, 0
strb r4, [r0]
strb r1, [r5]
_080011A8:
pop {r4,r5}
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end lcd_io_set_forced_blank
thumb_func_start lcd_io_get
lcd_io_get: @ 80011B8
push {lr}
lsls r0, 24
lsrs r0, 24
adds r1, r0, 0
cmp r1, 0x4
bne _080011CC
ldr r0, =0x04000004
b _080011DE
.align 2, 0
.pool
_080011CC:
cmp r1, 0x6
beq _080011DC
ldr r0, =0x03000818
adds r0, r1, r0
ldrh r0, [r0]
b _080011E0
.align 2, 0
.pool
_080011DC:
ldr r0, =0x04000006
_080011DE:
ldrh r0, [r0]
_080011E0:
pop {r1}
bx r1
.align 2, 0
.pool
thumb_func_end lcd_io_get
thumb_func_start lcd_io_set_bits
lcd_io_set_bits: @ 80011E8
push {lr}
adds r2, r1, 0
lsls r0, 24
lsrs r0, 24
ldr r1, =0x03000818
adds r1, r0, r1
ldrh r1, [r1]
orrs r1, r2
lsls r1, 16
lsrs r1, 16
bl lcd_io_set
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end lcd_io_set_bits
thumb_func_start lcd_io_clear_bits
lcd_io_clear_bits: @ 8001208
push {lr}
adds r2, r1, 0
lsls r0, 24
lsrs r0, 24
lsls r2, 16
ldr r1, =0x03000818
adds r1, r0, r1
ldrh r1, [r1]
lsrs r2, 16
bics r1, r2
bl lcd_io_set
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end lcd_io_clear_bits
thumb_func_start update_hardware_IE
update_hardware_IE: @ 8001228
push {r4,r5,lr}
ldr r5, =0x030008d9
ldrb r0, [r5]
cmp r0, 0
beq _08001246
ldr r2, =0x04000208
ldrh r1, [r2]
movs r4, 0
strh r4, [r2]
ldr r3, =0x04000200
ldr r0, =0x030008da
ldrh r0, [r0]
strh r0, [r3]
strh r1, [r2]
strb r4, [r5]
_08001246:
pop {r4,r5}
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end update_hardware_IE
thumb_func_start enable_irqs
enable_irqs: @ 800125C
push {r4,lr}
lsls r0, 16
lsrs r0, 16
ldr r4, =0x030008da
ldrh r1, [r4]
orrs r0, r1
strh r0, [r4]
ldr r1, =0x030008d9
movs r0, 0x1
strb r0, [r1]
bl update_hardware_IE
ldrh r0, [r4]
bl dispstat_set_vblank_hblank_irqs
pop {r4}
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end enable_irqs
thumb_func_start disable_irqs
disable_irqs: @ 8001288
push {r4,lr}
lsls r0, 16
lsrs r0, 16
ldr r4, =0x030008da
ldrh r1, [r4]
bics r1, r0
strh r1, [r4]
ldr r1, =0x030008d9
movs r0, 0x1
strb r0, [r1]
bl update_hardware_IE
ldrh r0, [r4]
bl dispstat_set_vblank_hblank_irqs
pop {r4}
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end disable_irqs
thumb_func_start dispstat_set_vblank_hblank_irqs
dispstat_set_vblank_hblank_irqs: @ 80012B4
push {r4,lr}
adds r4, r0, 0
lsls r4, 16
lsrs r4, 16
movs r0, 0x4
bl lcd_io_get
movs r2, 0x18
ands r2, r0
movs r1, 0x1
ands r1, r4
negs r0, r1
orrs r0, r1
asrs r1, r0, 31
movs r0, 0x8
ands r1, r0
movs r0, 0x2
ands r0, r4
cmp r0, 0
beq _080012E0
movs r0, 0x10
orrs r1, r0
_080012E0:
cmp r2, r1
beq _080012EA
movs r0, 0x4
bl lcd_io_set
_080012EA:
pop {r4}
pop {r0}
bx r0
thumb_func_end dispstat_set_vblank_hblank_irqs

717
asm/main.s Normal file
View File

@ -0,0 +1,717 @@
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]
bl lcd_io_copy_queue_clean
ldr r1, =0x04000204
ldr r3, =0x00004014
adds r0, r3, 0
strh r0, [r1]
bl init_keypad_data
bl init_irq_handler
bl m4aSoundInit
bl lcd_enable_vcount_irq_at_150px
bl sub_800E6D0
bl sub_802F21C
bl flash_timeout_start_on_timer_2_when_flash_present
bl init_saveblock_ptrs_and_set_copyright_callback2
bl sound_sources_off
bl dma3_transfer_queue_clear
bl gpu_init_bgs
bl fboxes_set_default_ptr
ldr r0, =0x02000000
movs r1, 0xE0
lsls r1, 9
bl init_malloc
ldr r0, =0x03002700
movs r4, 0
strb r4, [r0]
ldr r0, =0x03005d88
ldr r0, [r0]
cmp r0, 0x1
beq _08000414
movs r0, 0
bl set_callback2
_08000414:
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
_0800042A:
bl load_keys
ldr r0, =0x03002700
ldrb r0, [r0]
cmp r0, 0
bne _08000454
ldrh r1, [r7, 0x28]
movs r0, 0x1
ands r0, r1
cmp r0, 0
beq _08000454
movs r0, 0xE
ands r0, r1
cmp r0, 0xE
bne _08000454
bl rfu_REQ_stopMode
bl rfu_waitREQComplete
bl do_reset
_08000454:
bl sub_8087634
cmp r0, 0x1
bne _0800048C
strb r0, [r6]
bl call_callbacks_wrapper
movs r0, 0
strb r0, [r6]
b _080004B2
.align 2, 0
.pool
_0800048C:
ldr r5, =0x030022b4
movs r0, 0
strb r0, [r5]
bl call_callbacks_wrapper
bl sub_80875C8
adds r4, r0, 0
cmp r4, 0x1
bne _080004B2
movs r0, 0
strh r0, [r7, 0x2E]
bl copy_queue_clear
strb r4, [r5]
bl call_callbacks_wrapper
mov r2, r8
strb r2, [r5]
_080004B2:
bl gametime_increment
bl sound_something
bl wait_for_vblank
b _0800042A
.align 2, 0
.pool
thumb_func_end Main
thumb_func_start call_callbacks_wrapper
call_callbacks_wrapper: @ 80004C4
push {lr}
bl sub_800B40C
lsls r0, 24
cmp r0, 0
bne _080004D4
bl call_callbacks
_080004D4:
pop {r0}
bx r0
thumb_func_end call_callbacks_wrapper
thumb_func_start init_saveblock_ptrs_and_set_copyright_callback2
init_saveblock_ptrs_and_set_copyright_callback2: @ 80004D8
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]
ldr r0, =c2_copyright_1 + 1
bl set_callback2
ldr r1, =0x03005d90
ldr r0, =0x02024a54
str r0, [r1]
ldr r1, =0x03005d94
ldr r0, =0x02029808
str r0, [r1]
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end init_saveblock_ptrs_and_set_copyright_callback2
thumb_func_start call_callbacks
call_callbacks: @ 800051C
push {r4,lr}
ldr r4, =0x030022c0
ldr r0, [r4]
cmp r0, 0
beq _0800052A
bl _call_via_r0
_0800052A:
ldr r0, [r4, 0x4]
cmp r0, 0
beq _08000534
bl _call_via_r0
_08000534:
pop {r4}
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end call_callbacks
thumb_func_start set_callback2
set_callback2: @ 8000540
ldr r1, =0x030022c0
str r0, [r1, 0x4]
movs r0, 0x87
lsls r0, 3
adds r1, r0
movs r0, 0
strb r0, [r1]
bx lr
.align 2, 0
.pool
thumb_func_end set_callback2
thumb_func_start start_timer1
start_timer1: @ 8000554
ldr r1, =0x04000106
movs r0, 0x80
strh r0, [r1]
bx lr
.align 2, 0
.pool
thumb_func_end start_timer1
thumb_func_start set_rand_seed_and_trainer_id_hi
set_rand_seed_and_trainer_id_hi: @ 8000560
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
.align 2, 0
.pool
thumb_func_end set_rand_seed_and_trainer_id_hi
thumb_func_start get_trainer_id_hi
get_trainer_id_hi: @ 8000588
ldr r0, =0x02020000
ldrh r0, [r0]
bx lr
.align 2, 0
.pool
thumb_func_end get_trainer_id_hi
thumb_func_start lcd_enable_vcount_irq_at_150px
lcd_enable_vcount_irq_at_150px: @ 8000594
push {lr}
movs r0, 0x4
bl lcd_io_get
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
bl lcd_io_set
movs r0, 0x4
bl enable_irqs
pop {r0}
bx r0
thumb_func_end lcd_enable_vcount_irq_at_150px
thumb_func_start init_keypad_data
init_keypad_data: @ 80005BC
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
.align 2, 0
.pool
thumb_func_end init_keypad_data
thumb_func_start load_keys
load_keys: @ 80005E4
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
beq _08000630
ldrh r0, [r2, 0x2C]
cmp r0, r3
bne _08000630
ldrh r0, [r2, 0x32]
subs r0, 0x1
strh r0, [r2, 0x32]
lsls r0, 16
cmp r0, 0
bne _08000636
strh r3, [r2, 0x30]
ldr r0, =0x030026fc
b _08000632
.align 2, 0
.pool
_08000630:
ldr r0, =0x030022b0
_08000632:
ldrh r0, [r0]
strh r0, [r2, 0x32]
_08000636:
strh r3, [r2, 0x28]
strh r3, [r2, 0x2C]
ldr r0, =0x03005d90
ldr r0, [r0]
ldrb r0, [r0, 0x13]
cmp r0, 0x2
bne _08000668
ldrh r1, [r2, 0x2E]
movs r3, 0x80
lsls r3, 2
adds r0, r3, 0
ands r0, r1
cmp r0, 0
beq _08000658
movs r0, 0x1
orrs r0, r1
strh r0, [r2, 0x2E]
_08000658:
ldrh r1, [r2, 0x2C]
adds r0, r3, 0
ands r0, r1
cmp r0, 0
beq _08000668
movs r0, 0x1
orrs r0, r1
strh r0, [r2, 0x2C]
_08000668:
ldrh r1, [r2, 0x2E]
ldrh r0, [r2, 0x36]
ands r0, r1
cmp r0, 0
beq _08000676
movs r0, 0x1
strh r0, [r2, 0x34]
_08000676:
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end load_keys
thumb_func_start init_irq_handler
init_irq_handler: @ 8000684
push {r4,r5,lr}
ldr r5, =InterruptMain
ldr r4, =0x03002750
ldr r3, =0x082e9548
ldr r2, =0x03002710
movs r1, 0xD
_08000690:
ldm r3!, {r0}
stm r2!, {r0}
subs r1, 0x1
cmp r1, 0
bge _08000690
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
bl set_serial_callback
ldr r1, =0x04000208
movs r0, 0x1
strh r0, [r1]
movs r0, 0x1
bl enable_irqs
pop {r4,r5}
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end init_irq_handler
thumb_func_start SetVBlankCallback
SetVBlankCallback: @ 80006F0
ldr r1, =0x030022c0
str r0, [r1, 0xC]
bx lr
.align 2, 0
.pool
thumb_func_end SetVBlankCallback
thumb_func_start SetHBlankCallback
SetHBlankCallback: @ 80006FC
ldr r1, =0x030022c0
str r0, [r1, 0x10]
bx lr
.align 2, 0
.pool
thumb_func_end SetHBlankCallback
thumb_func_start SetVCountCallback
SetVCountCallback: @ 8000708
ldr r1, =0x030022c0
str r0, [r1, 0x14]
bx lr
.align 2, 0
.pool
thumb_func_end SetVCountCallback
thumb_func_start restore_serial_timer3_irq_handlers
restore_serial_timer3_irq_handlers: @ 8000714
ldr r0, =0x03002710
ldr r1, =irq_serial + 1
str r1, [r0, 0x4]
ldr r1, =irq_timer3 + 1
str r1, [r0, 0x8]
bx lr
.align 2, 0
.pool
thumb_func_end restore_serial_timer3_irq_handlers
thumb_func_start set_serial_callback
set_serial_callback: @ 800072C
ldr r1, =0x030022c0
str r0, [r1, 0x18]
bx lr
.align 2, 0
.pool
thumb_func_end set_serial_callback
thumb_func_start irq_vblank
irq_vblank: @ 8000738
push {r4,lr}
ldr r0, =0x030030fc
ldrb r0, [r0]
cmp r0, 0
beq _0800074C
bl rfu_syncVBlank__
b _08000758
.align 2, 0
.pool
_0800074C:
ldr r0, =0x03002748
ldrb r0, [r0]
cmp r0, 0
bne _08000758
bl sub_800B9B8
_08000758:
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
beq _08000778
ldr r2, [r1]
movs r0, 0x2
negs r0, r0
cmp r2, r0
bhi _08000778
adds r0, r2, 0x1
str r0, [r1]
_08000778:
ldr r0, [r4, 0xC]
cmp r0, 0
beq _08000782
bl _call_via_r0
_08000782:
ldr r0, [r4, 0x24]
adds r0, 0x1
str r0, [r4, 0x24]
bl lcd_io_copy_queue_process
bl dma_transfer_queue_process
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
beq _080007BA
ldr r0, =0x02022fec
ldr r0, [r0]
ldr r1, =0x013f0102
ands r0, r1
cmp r0, 0
bne _080007BE
_080007BA:
bl GenerateRandomNumber
_080007BE:
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
.align 2, 0
.pool
thumb_func_end irq_vblank
thumb_func_start flash_timeout_start_on_timer_2
flash_timeout_start_on_timer_2: @ 8000800
push {lr}
ldr r1, =0x0300272c
movs r0, 0x2
bl SetFlashTimerIntr
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end flash_timeout_start_on_timer_2
thumb_func_start irq_hblank
irq_hblank: @ 8000814
push {r4,lr}
ldr r4, =0x030022c0
ldr r0, [r4, 0x10]
cmp r0, 0
beq _08000822
bl _call_via_r0
_08000822:
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
.align 2, 0
.pool
thumb_func_end irq_hblank
thumb_func_start irq_vcount
irq_vcount: @ 8000844
push {r4,lr}
ldr r4, =0x030022c0
ldr r0, [r4, 0x14]
cmp r0, 0
beq _08000852
bl _call_via_r0
_08000852:
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
.align 2, 0
.pool
thumb_func_end irq_vcount
thumb_func_start irq_serial
irq_serial: @ 8000878
push {r4,lr}
ldr r4, =0x030022c0
ldr r0, [r4, 0x18]
cmp r0, 0
beq _08000886
bl _call_via_r0
_08000886:
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
.align 2, 0
.pool
thumb_func_end irq_serial
thumb_func_start irq_other
irq_other: @ 80008A8
bx lr
thumb_func_end irq_other
thumb_func_start wait_for_vblank
wait_for_vblank: @ 80008AC
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
bne _080008D0
movs r3, 0x1
_080008C6:
ldrh r1, [r2, 0x1C]
adds r0, r3, 0
ands r0, r1
cmp r0, 0
beq _080008C6
_080008D0:
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end wait_for_vblank
thumb_func_start sub_80008DC
sub_80008DC: @ 80008DC
ldr r1, =0x0203cf5c
str r0, [r1]
bx lr
.align 2, 0
.pool
thumb_func_end sub_80008DC
thumb_func_start sub_80008E8
sub_80008E8: @ 80008E8
ldr r1, =0x0203cf5c
movs r0, 0
str r0, [r1]
bx lr
.align 2, 0
.pool
thumb_func_end sub_80008E8
thumb_func_start do_reset
do_reset: @ 80008F4
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]
bl sub_82E2168
movs r0, 0xFF
bl SoftReset
pop {r4}
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end do_reset
thumb_func_start sub_8000964
sub_8000964: @ 8000964
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
.align 2, 0
.pool
thumb_func_end sub_8000964

327
asm/malloc.s Normal file
View File

@ -0,0 +1,327 @@
thumb_func_start malloc_header
malloc_header: @ 8000988
push {r4,lr}
movs r4, 0
strh r4, [r0]
ldr r4, =0x0000a3a3
strh r4, [r0, 0x2]
str r3, [r0, 0x4]
str r1, [r0, 0x8]
str r2, [r0, 0xC]
pop {r4}
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end malloc_header
thumb_func_start malloc_unlinked_header
malloc_unlinked_header: @ 80009A4
push {lr}
adds r2, r0, 0
adds r3, r1, 0
subs r3, 0x10
adds r1, r2, 0
bl malloc_header
pop {r0}
bx r0
thumb_func_end malloc_unlinked_header
thumb_func_start malloc_core
malloc_core: @ 80009B8
push {r4-r6,lr}
adds r4, r0, 0
adds r6, r4, 0
movs r0, 0x3
ands r0, r1
cmp r0, 0
beq _080009CC
lsrs r0, r1, 2
adds r0, 0x1
lsls r1, r0, 2
_080009CC:
movs r2, 0x1
_080009CE:
ldrh r0, [r4]
cmp r0, 0
bne _08000A0C
ldr r3, [r4, 0x4]
cmp r3, r1
bcc _08000A0C
subs r0, r3, r1
cmp r0, 0x1F
bhi _080009E4
strh r2, [r4]
b _08000A06
_080009E4:
subs r3, 0x10
subs r3, r1
adds r0, r1, 0
adds r0, 0x10
adds r5, r4, r0
strh r2, [r4]
str r1, [r4, 0x4]
ldr r2, [r4, 0xC]
adds r0, r5, 0
adds r1, r4, 0
bl malloc_header
str r5, [r4, 0xC]
ldr r0, [r5, 0xC]
cmp r0, r6
beq _08000A06
str r5, [r0, 0x8]
_08000A06:
adds r0, r4, 0
adds r0, 0x10
b _08000A18
_08000A0C:
ldr r0, [r4, 0xC]
cmp r0, r6
beq _08000A16
adds r4, r0, 0
b _080009CE
_08000A16:
movs r0, 0
_08000A18:
pop {r4-r6}
pop {r1}
bx r1
thumb_func_end malloc_core
thumb_func_start free_core
free_core: @ 8000A20
push {r4,r5,lr}
cmp r1, 0
beq _08000A7C
adds r5, r0, 0
adds r2, r1, 0
subs r2, 0x10
movs r0, 0
strh r0, [r2]
ldr r3, [r2, 0xC]
cmp r3, r5
beq _08000A54
ldrh r4, [r3]
cmp r4, 0
bne _08000A54
ldr r0, [r2, 0x4]
adds r0, 0x10
ldr r1, [r3, 0x4]
adds r0, r1
str r0, [r2, 0x4]
strh r4, [r3, 0x2]
ldr r0, [r2, 0xC]
ldr r0, [r0, 0xC]
str r0, [r2, 0xC]
cmp r0, r5
beq _08000A54
str r2, [r0, 0x8]
_08000A54:
cmp r2, r5
beq _08000A7C
ldr r1, [r2, 0x8]
ldrh r3, [r1]
cmp r3, 0
bne _08000A7C
ldr r0, [r2, 0xC]
str r0, [r1, 0xC]
ldr r1, [r2, 0xC]
cmp r1, r5
beq _08000A6E
ldr r0, [r2, 0x8]
str r0, [r1, 0x8]
_08000A6E:
strh r3, [r2, 0x2]
ldr r0, [r2, 0x8]
ldr r1, [r0, 0x4]
adds r1, 0x10
ldr r2, [r2, 0x4]
adds r1, r2
str r1, [r0, 0x4]
_08000A7C:
pop {r4,r5}
pop {r0}
bx r0
thumb_func_end free_core
thumb_func_start malloc_core_and_clear
malloc_core_and_clear: @ 8000A84
push {r4,r5,lr}
sub sp, 0x4
adds r4, r1, 0
bl malloc_core
adds r5, r0, 0
cmp r5, 0
beq _08000AB8
movs r0, 0x3
ands r0, r4
cmp r0, 0
beq _08000AA2
lsrs r0, r4, 2
adds r0, 0x1
lsls r4, r0, 2
_08000AA2:
movs r0, 0
str r0, [sp]
lsls r2, r4, 9
lsrs r2, 11
movs r0, 0xA0
lsls r0, 19
orrs r2, r0
mov r0, sp
adds r1, r5, 0
bl CpuSet
_08000AB8:
adds r0, r5, 0
add sp, 0x4
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end malloc_core_and_clear
thumb_func_start check_memblk_core
check_memblk_core: @ 8000AC4
push {r4,r5,lr}
adds r5, r0, 0
adds r3, r1, 0
subs r3, 0x10
ldrh r2, [r3, 0x2]
ldr r0, =0x0000a3a3
cmp r2, r0
bne _08000B0A
ldr r0, [r3, 0xC]
ldrh r1, [r0, 0x2]
adds r4, r0, 0
cmp r1, r2
bne _08000B0A
cmp r4, r5
beq _08000AE8
ldr r0, [r4, 0x8]
cmp r0, r3
bne _08000B0A
_08000AE8:
ldr r2, [r3, 0x8]
ldrh r1, [r2, 0x2]
ldr r0, =0x0000a3a3
cmp r1, r0
bne _08000B0A
cmp r2, r5
beq _08000AFC
ldr r0, [r2, 0xC]
cmp r0, r3
bne _08000B0A
_08000AFC:
cmp r4, r5
beq _08000B14
ldr r0, [r3, 0x4]
adds r0, 0x10
adds r0, r3, r0
cmp r4, r0
beq _08000B14
_08000B0A:
movs r0, 0
b _08000B16
.align 2, 0
.pool
_08000B14:
movs r0, 0x1
_08000B16:
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end check_memblk_core
thumb_func_start init_malloc
init_malloc: @ 8000B1C
push {lr}
ldr r2, =0x03000004
str r0, [r2]
ldr r2, =0x03000008
str r1, [r2]
bl malloc_unlinked_header
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end init_malloc
thumb_func_start malloc
malloc: @ 8000B38
push {lr}
adds r1, r0, 0
ldr r0, =0x03000004
ldr r0, [r0]
bl malloc_core
pop {r1}
bx r1
.align 2, 0
.pool
thumb_func_end malloc
thumb_func_start malloc_and_clear
malloc_and_clear: @ 8000B4C
push {lr}
adds r1, r0, 0
ldr r0, =0x03000004
ldr r0, [r0]
bl malloc_core_and_clear
pop {r1}
bx r1
.align 2, 0
.pool
thumb_func_end malloc_and_clear
thumb_func_start free
free: @ 8000B60
push {lr}
adds r1, r0, 0
ldr r0, =0x03000004
ldr r0, [r0]
bl free_core
pop {r0}
bx r0
.align 2, 0
.pool
thumb_func_end free
thumb_func_start check_memblk
check_memblk: @ 8000B74
push {lr}
adds r1, r0, 0
ldr r0, =0x03000004
ldr r0, [r0]
bl check_memblk_core
pop {r1}
bx r1
.align 2, 0
.pool
thumb_func_end check_memblk
thumb_func_start check_all_memblks
check_all_memblks: @ 8000B88
push {r4,r5,lr}
ldr r0, =0x03000004
ldr r4, [r0]
adds r5, r0, 0
_08000B90:
ldr r0, [r5]
adds r1, r4, 0
adds r1, 0x10
bl check_memblk_core
cmp r0, 0
beq _08000BB0
ldr r4, [r4, 0xC]
ldr r0, [r5]
cmp r4, r0
bne _08000B90
movs r0, 0x1
b _08000BB2
.align 2, 0
.pool
_08000BB0:
movs r0, 0
_08000BB2:
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end check_all_memblks

809
asm/pixel_buffer.s Normal file
View File

@ -0,0 +1,809 @@
thumb_func_start sub_8002BDC
sub_8002BDC: @ 8002BDC
push {r4-r7,lr}
mov r7, r8
push {r7}
sub sp, 0x14
ldr r4, [sp, 0x2C]
ldr r5, [sp, 0x30]
ldr r6, [sp, 0x34]
ldr r7, [sp, 0x38]
lsls r2, 16
lsrs r2, 16
lsls r3, 16
lsrs r3, 16
lsls r4, 16
lsrs r4, 16
lsls r5, 16
lsrs r5, 16
lsls r6, 16
lsrs r6, 16
lsls r7, 16
lsrs r7, 16
str r4, [sp]
str r5, [sp, 0x4]
str r6, [sp, 0x8]
str r7, [sp, 0xC]
movs r4, 0xFF
str r4, [sp, 0x10]
bl PixelBlock_CopyRect4Bpp
add sp, 0x14
pop {r3}
mov r8, r3
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end sub_8002BDC
thumb_func_start PixelBlock_CopyRect4Bpp
PixelBlock_CopyRect4Bpp: @ 8002C20
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x2C
str r0, [sp]
str r1, [sp, 0x4]
ldr r0, [sp, 0x4C]
ldr r1, [sp, 0x50]
ldr r4, [sp, 0x54]
ldr r5, [sp, 0x58]
ldr r6, [sp, 0x5C]
lsls r2, 16
lsrs r2, 16
str r2, [sp, 0x8]
lsls r3, 16
lsrs r7, r3, 16
lsls r0, 16
lsrs r0, 16
str r0, [sp, 0xC]
lsls r1, 16
lsrs r1, 16
mov r9, r1
lsls r4, 16
lsrs r4, 16
lsls r5, 16
lsrs r5, 16
lsls r6, 24
lsrs r6, 24
str r6, [sp, 0x10]
ldr r0, [sp, 0x4]
ldrh r3, [r0, 0x4]
ldr r1, [sp, 0xC]
subs r0, r3, r1
adds r2, r4
mov r8, r2
cmp r0, r4
bge _08002C74
ldr r2, [sp, 0x8]
adds r0, r2
mov r8, r0
_08002C74:
ldr r4, [sp, 0x4]
ldrh r0, [r4, 0x6]
mov r1, r9
subs r0, r1
adds r2, r5, r7
str r2, [sp, 0x14]
cmp r0, r5
bge _08002C88
adds r0, r7
str r0, [sp, 0x14]
_08002C88:
ldr r4, [sp]
ldrh r1, [r4, 0x4]
movs r2, 0x7
adds r0, r1, 0
ands r0, r2
adds r1, r0
asrs r1, 3
str r1, [sp, 0x18]
adds r0, r3, 0
ands r0, r2
adds r0, r3, r0
asrs r0, 3
str r0, [sp, 0x1C]
ldr r0, [sp, 0x10]
cmp r0, 0xFF
bne _08002D46
adds r3, r7, 0
mov r1, r9
ldr r2, [sp, 0x14]
cmp r3, r2
blt _08002CB4
b _08002DEE
_08002CB4:
ldr r5, [sp, 0x8]
ldr r6, [sp, 0xC]
adds r4, r3, 0x1
str r4, [sp, 0x24]
adds r0, r1, 0x1
str r0, [sp, 0x28]
cmp r5, r8
bge _08002D3A
movs r7, 0x3
asrs r0, r3, 3
ldr r2, [sp, 0x18]
muls r0, r2
lsls r0, 5
mov r10, r0
lsls r0, r3, 29
lsrs r0, 27
mov r9, r0
asrs r0, r1, 3
ldr r4, [sp, 0x1C]
muls r0, r4
lsls r0, 5
mov r12, r0
lsls r0, r1, 29
lsrs r3, r0, 27
_08002CE4:
asrs r0, r5, 1
ands r0, r7
ldr r2, [sp]
ldr r1, [r2]
adds r1, r0
asrs r0, r5, 3
lsls r0, 5
adds r1, r0
add r1, r10
mov r4, r9
adds r2, r1, r4
asrs r0, r6, 1
ands r0, r7
ldr r4, [sp, 0x4]
ldr r1, [r4]
adds r1, r0
asrs r0, r6, 3
lsls r0, 5
adds r1, r0
add r1, r12
adds r4, r1, r3
ldrb r2, [r2]
adds r0, r5, 0
movs r1, 0x1
ands r0, r1
lsls r0, 2
asrs r2, r0
movs r0, 0xF
ands r2, r0
adds r0, r6, 0
ands r0, r1
lsls r1, r0, 2
lsls r2, r1
movs r0, 0xF0
asrs r0, r1
ldrb r1, [r4]
ands r0, r1
orrs r2, r0
strb r2, [r4]
adds r5, 0x1
adds r6, 0x1
cmp r5, r8
blt _08002CE4
_08002D3A:
ldr r3, [sp, 0x24]
ldr r1, [sp, 0x28]
ldr r2, [sp, 0x14]
cmp r3, r2
blt _08002CB4
b _08002DEE
_08002D46:
adds r3, r7, 0
mov r1, r9
ldr r4, [sp, 0x14]
cmp r3, r4
bge _08002DEE
_08002D50:
ldr r5, [sp, 0x8]
ldr r6, [sp, 0xC]
adds r0, r3, 0x1
str r0, [sp, 0x24]
adds r2, r1, 0x1
str r2, [sp, 0x28]
cmp r5, r8
bge _08002DE4
movs r4, 0x3
mov r9, r4
asrs r0, r3, 3
ldr r2, [sp, 0x18]
muls r0, r2
lsls r0, 5
str r0, [sp, 0x20]
lsls r0, r3, 29
lsrs r0, 27
mov r10, r0
movs r3, 0x1
asrs r0, r1, 3
ldr r4, [sp, 0x1C]
muls r0, r4
lsls r0, 5
mov r12, r0
lsls r0, r1, 29
lsrs r7, r0, 27
_08002D84:
asrs r0, r5, 1
mov r1, r9
ands r0, r1
ldr r2, [sp]
ldr r1, [r2]
adds r1, r0
asrs r0, r5, 3
lsls r0, 5
adds r1, r0
ldr r4, [sp, 0x20]
adds r1, r4
mov r0, r10
adds r2, r1, r0
asrs r0, r6, 1
mov r1, r9
ands r0, r1
ldr r4, [sp, 0x4]
ldr r1, [r4]
adds r1, r0
asrs r0, r6, 3
lsls r0, 5
adds r1, r0
add r1, r12
adds r4, r1, r7
ldrb r2, [r2]
adds r0, r5, 0
ands r0, r3
lsls r0, 2
asrs r2, r0
movs r0, 0xF
ands r2, r0
ldr r0, [sp, 0x10]
cmp r2, r0
beq _08002DDC
adds r0, r6, 0
ands r0, r3
lsls r1, r0, 2
lsls r2, r1
movs r0, 0xF0
asrs r0, r1
ldrb r1, [r4]
ands r0, r1
orrs r2, r0
strb r2, [r4]
_08002DDC:
adds r5, 0x1
adds r6, 0x1
cmp r5, r8
blt _08002D84
_08002DE4:
ldr r3, [sp, 0x24]
ldr r1, [sp, 0x28]
ldr r2, [sp, 0x14]
cmp r3, r2
blt _08002D50
_08002DEE:
add sp, 0x2C
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end PixelBlock_CopyRect4Bpp
thumb_func_start PixelBlock_FillRect4Bpp
PixelBlock_FillRect4Bpp: @ 8002E00
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x8
mov r9, r0
ldr r0, [sp, 0x28]
ldr r4, [sp, 0x2C]
lsls r1, 16
lsrs r1, 16
str r1, [sp]
lsls r2, 16
lsrs r2, 16
adds r6, r2, 0
lsls r3, 16
lsrs r3, 16
lsls r0, 16
lsrs r0, 16
lsls r4, 24
lsrs r5, r4, 24
adds r4, r1, r3
mov r3, r9
ldrh r1, [r3, 0x4]
cmp r4, r1
ble _08002E36
adds r4, r1, 0
_08002E36:
adds r2, r0
mov r12, r2
mov r2, r9
ldrh r0, [r2, 0x6]
cmp r12, r0
ble _08002E44
mov r12, r0
_08002E44:
movs r0, 0x7
ands r0, r1
adds r0, r1, r0
asrs r0, 3
str r0, [sp, 0x4]
lsls r0, r5, 28
lsrs r0, 24
mov r8, r0
movs r3, 0xF
mov r10, r3
mov r0, r10
ands r0, r5
mov r10, r0
adds r1, r6, 0
cmp r1, r12
bge _08002EB6
_08002E64:
ldr r3, [sp]
adds r7, r1, 0x1
cmp r3, r4
bge _08002EB0
asrs r0, r1, 3
ldr r2, [sp, 0x4]
muls r0, r2
lsls r6, r0, 5
lsls r0, r1, 29
lsrs r5, r0, 27
_08002E78:
asrs r2, r3, 1
movs r0, 0x3
ands r2, r0
mov r0, r9
ldr r1, [r0]
adds r1, r2
asrs r0, r3, 3
lsls r0, 5
adds r1, r0
adds r1, r6
adds r2, r1, r5
lsls r0, r3, 31
cmp r0, 0
beq _08002E9E
ldrb r1, [r2]
movs r0, 0xF
ands r0, r1
mov r1, r8
b _08002EA6
_08002E9E:
ldrb r1, [r2]
movs r0, 0xF0
ands r0, r1
mov r1, r10
_08002EA6:
orrs r0, r1
strb r0, [r2]
adds r3, 0x1
cmp r3, r4
blt _08002E78
_08002EB0:
adds r1, r7, 0
cmp r1, r12
blt _08002E64
_08002EB6:
add sp, 0x8
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end PixelBlock_FillRect4Bpp
thumb_func_start PixelBlock_CopyRect4BppTo8Bpp
PixelBlock_CopyRect4BppTo8Bpp: @ 8002EC8
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x3C
str r0, [sp]
str r1, [sp, 0x4]
ldr r0, [sp, 0x5C]
ldr r1, [sp, 0x60]
ldr r5, [sp, 0x64]
ldr r4, [sp, 0x68]
ldr r6, [sp, 0x6C]
ldr r7, [sp, 0x70]
mov r8, r7
lsls r2, 16
lsrs r2, 16
str r2, [sp, 0x8]
lsls r3, 16
lsrs r3, 16
lsls r0, 16
lsrs r0, 16
str r0, [sp, 0xC]
lsls r1, 16
lsrs r7, r1, 16
lsls r5, 16
lsrs r5, 16
lsls r4, 16
lsrs r4, 16
lsls r6, 24
lsrs r6, 24
str r6, [sp, 0x10]
mov r0, r8
lsls r0, 28
lsrs r0, 24
str r0, [sp, 0x14]
lsls r0, r6, 28
lsrs r0, 24
str r0, [sp, 0x28]
ldr r1, [sp, 0x4]
ldrh r0, [r1, 0x4]
ldr r2, [sp, 0xC]
subs r0, r2
ldr r1, [sp, 0x8]
adds r1, r5, r1
str r1, [sp, 0x18]
cmp r0, r5
bge _08002F2E
ldr r2, [sp, 0x8]
adds r0, r2
str r0, [sp, 0x18]
_08002F2E:
ldr r5, [sp, 0x4]
ldrh r1, [r5, 0x6]
subs r0, r1, r7
cmp r0, r4
bge _08002F40
adds r0, r3, r1
subs r0, r7
str r0, [sp, 0x1C]
b _08002F44
_08002F40:
adds r4, r3, r4
str r4, [sp, 0x1C]
_08002F44:
ldr r0, [sp]
ldrh r1, [r0, 0x4]
movs r2, 0x7
adds r0, r1, 0
ands r0, r2
adds r1, r0
asrs r1, 3
str r1, [sp, 0x20]
ldr r5, [sp, 0x4]
ldrh r1, [r5, 0x4]
adds r0, r1, 0
ands r0, r2
adds r1, r0
asrs r1, 3
str r1, [sp, 0x24]
ldr r0, [sp, 0x10]
cmp r0, 0xFF
bne _08003024
adds r2, r3, 0
adds r5, r7, 0
ldr r1, [sp, 0x1C]
cmp r2, r1
blt _08002F74
b _08003106
_08002F74:
ldr r3, [sp, 0x8]
lsrs r3, 1
str r3, [sp, 0x2C]
movs r0, 0x3
ands r3, r0
str r3, [sp, 0x2C]
ldr r7, [sp, 0x8]
lsrs r0, r7, 3
lsls r0, 5
str r0, [sp, 0x30]
_08002F88:
ldr r0, [sp]
ldr r1, [r0]
ldr r3, [sp, 0x2C]
adds r1, r3
ldr r7, [sp, 0x30]
adds r1, r7
asrs r0, r2, 3
ldr r3, [sp, 0x20]
muls r0, r3
lsls r0, 5
mov r8, r0
add r1, r8
lsls r0, r2, 29
lsrs r7, r0, 27
adds r6, r1, r7
ldr r3, [sp, 0x8]
ldr r4, [sp, 0xC]
adds r2, 0x1
mov r10, r2
adds r0, r5, 0x1
str r0, [sp, 0x38]
ldr r1, [sp, 0x18]
cmp r3, r1
bge _08003018
asrs r0, r5, 3
ldr r2, [sp, 0x24]
muls r0, r2
lsls r0, 6
mov r12, r0
lsls r0, r5, 29
lsrs r0, 26
mov r9, r0
_08002FC8:
movs r0, 0x7
ands r0, r4
ldr r5, [sp, 0x4]
ldr r1, [r5]
adds r1, r0
asrs r0, r4, 3
lsls r0, 6
adds r1, r0
add r1, r12
mov r0, r9
adds r5, r1, r0
movs r0, 0x1
ands r0, r3
cmp r0, 0
beq _08002FEC
ldrb r0, [r6]
lsrs r0, 4
b _08003008
_08002FEC:
asrs r2, r3, 1
movs r0, 0x3
ands r2, r0
ldr r0, [sp]
ldr r1, [r0]
adds r1, r2
asrs r0, r3, 3
lsls r0, 5
adds r1, r0
add r1, r8
adds r6, r1, r7
ldrb r1, [r6]
movs r0, 0xF
ands r0, r1
_08003008:
ldr r1, [sp, 0x14]
adds r0, r1, r0
strb r0, [r5]
adds r3, 0x1
adds r4, 0x1
ldr r2, [sp, 0x18]
cmp r3, r2
blt _08002FC8
_08003018:
mov r2, r10
ldr r5, [sp, 0x38]
ldr r3, [sp, 0x1C]
cmp r2, r3
blt _08002F88
b _08003106
_08003024:
adds r2, r3, 0
adds r5, r7, 0
ldr r7, [sp, 0x1C]
cmp r2, r7
bge _08003106
ldr r0, [sp, 0x8]
lsrs r0, 1
str r0, [sp, 0x34]
movs r0, 0x3
ldr r1, [sp, 0x34]
ands r1, r0
str r1, [sp, 0x34]
_0800303C:
ldr r3, [sp]
ldr r1, [r3]
ldr r7, [sp, 0x34]
adds r1, r7
ldr r3, [sp, 0x8]
lsrs r0, r3, 3
lsls r0, 5
adds r1, r0
asrs r0, r2, 3
ldr r7, [sp, 0x20]
muls r0, r7
lsls r0, 5
mov r8, r0
add r1, r8
lsls r0, r2, 29
lsrs r7, r0, 27
adds r6, r1, r7
ldr r4, [sp, 0xC]
adds r2, 0x1
mov r10, r2
adds r0, r5, 0x1
str r0, [sp, 0x38]
ldr r1, [sp, 0x18]
cmp r3, r1
bge _080030FC
asrs r0, r5, 3
ldr r2, [sp, 0x24]
muls r0, r2
lsls r0, 6
mov r9, r0
lsls r0, r5, 29
lsrs r0, 26
mov r12, r0
_0800307E:
movs r0, 0x1
ands r0, r3
cmp r0, 0
beq _080030B2
ldrb r2, [r6]
movs r0, 0xF0
ands r0, r2
ldr r5, [sp, 0x28]
cmp r0, r5
beq _080030F2
adds r0, r4, 0
movs r1, 0x7
ands r0, r1
ldr r5, [sp, 0x4]
ldr r1, [r5]
adds r1, r0
asrs r0, r4, 3
lsls r0, 6
adds r1, r0
add r1, r9
mov r0, r12
adds r5, r1, r0
lsrs r0, r2, 4
ldr r1, [sp, 0x14]
adds r0, r1, r0
b _080030F0
_080030B2:
asrs r2, r3, 1
movs r0, 0x3
ands r2, r0
ldr r5, [sp]
ldr r1, [r5]
adds r1, r2
asrs r0, r3, 3
lsls r0, 5
adds r1, r0
add r1, r8
adds r6, r1, r7
ldrb r0, [r6]
movs r2, 0xF
ands r2, r0
ldr r0, [sp, 0x10]
cmp r2, r0
beq _080030F2
adds r0, r4, 0
movs r1, 0x7
ands r0, r1
ldr r5, [sp, 0x4]
ldr r1, [r5]
adds r1, r0
asrs r0, r4, 3
lsls r0, 6
adds r1, r0
add r1, r9
mov r0, r12
adds r5, r1, r0
ldr r1, [sp, 0x14]
adds r0, r1, r2
_080030F0:
strb r0, [r5]
_080030F2:
adds r3, 0x1
adds r4, 0x1
ldr r2, [sp, 0x18]
cmp r3, r2
blt _0800307E
_080030FC:
mov r2, r10
ldr r5, [sp, 0x38]
ldr r3, [sp, 0x1C]
cmp r2, r3
blt _0800303C
_08003106:
add sp, 0x3C
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end PixelBlock_CopyRect4BppTo8Bpp
thumb_func_start PixelBlock_FillRect8Bpp
PixelBlock_FillRect8Bpp: @ 8003118
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x8
mov r8, r0
ldr r0, [sp, 0x28]
ldr r4, [sp, 0x2C]
lsls r1, 16
lsrs r1, 16
mov r10, r1
lsls r2, 16
lsrs r2, 16
adds r6, r2, 0
lsls r3, 16
lsrs r3, 16
lsls r0, 16
lsrs r0, 16
lsls r4, 24
lsrs r4, 24
mov r9, r4
adds r5, r1, r3
mov r3, r8
ldrh r1, [r3, 0x4]
cmp r5, r1
ble _08003150
adds r5, r1, 0
_08003150:
adds r7, r2, r0
mov r2, r8
ldrh r0, [r2, 0x6]
cmp r7, r0
ble _0800315C
adds r7, r0, 0
_0800315C:
movs r0, 0x7
ands r0, r1
adds r0, r1, r0
asrs r0, 3
str r0, [sp]
adds r1, r6, 0
cmp r1, r7
bge _080031AC
_0800316C:
mov r3, r10
adds r6, r1, 0x1
str r6, [sp, 0x4]
cmp r3, r5
bge _080031A6
movs r0, 0x7
mov r12, r0
asrs r0, r1, 3
ldr r2, [sp]
muls r0, r2
lsls r4, r0, 6
lsls r0, r1, 29
lsrs r2, r0, 26
_08003186:
adds r0, r3, 0
mov r6, r12
ands r0, r6
mov r6, r8
ldr r1, [r6]
adds r1, r0
asrs r0, r3, 3
lsls r0, 6
adds r1, r0
adds r1, r4
adds r1, r2
mov r0, r9
strb r0, [r1]
adds r3, 0x1
cmp r3, r5
blt _08003186
_080031A6:
ldr r1, [sp, 0x4]
cmp r1, r7
blt _0800316C
_080031AC:
add sp, 0x8
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end PixelBlock_FillRect8Bpp

4671
asm/text_renderer.s Normal file

File diff suppressed because it is too large Load Diff

2619
asm/window.s Normal file

File diff suppressed because it is too large Load Diff