pokeheartgold/asm/font.s

633 lines
11 KiB
ArmAsm
Raw Normal View History

2021-08-13 18:03:14 +00:00
.include "asm/macros.inc"
.include "global.inc"
2021-09-04 20:01:18 +00:00
.rodata
_020F56C0:
.byte 0x00, 0x00
_020F56C2:
.byte 0x00, 0x00
_020F56C4:
.byte 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00
.byte 0x04, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00
_020F56D8:
.byte 0x0B
_020F56D9:
.byte 0x10
_020F56DA:
.byte 0x00
_020F56DB:
.byte 0x00
_020F56DC:
.byte 0x00
_020F56DD:
.byte 0x01
_020F56DE:
.byte 0x0F
_020F56DF:
.byte 0x02
.byte 0x0B, 0x10, 0x00, 0x00, 0x00, 0x01, 0x0F, 0x02, 0x0B, 0x10, 0x00, 0x00, 0x00, 0x01, 0x0F, 0x02
.byte 0x0B, 0x10, 0x00, 0x00, 0x00, 0x01, 0x0F, 0x02, 0x0B, 0x10, 0x00, 0x00, 0x00, 0x01, 0x0F, 0x02
.byte 0x0A, 0x10, 0x00, 0x00, 0x00, 0x01, 0x0F, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
2021-08-13 18:03:14 +00:00
.bss
_0211188C:
.space 4
_02111890:
.space 0xBC
.text
thumb_func_start sub_02002CA8
sub_02002CA8: ; 0x02002CA8
push {r4, lr}
2021-08-13 21:09:14 +00:00
ldr r0, _02002CE0 ; =_02111890
ldr r4, _02002CE4 ; =_0211188C
2021-08-13 18:03:14 +00:00
mov r1, #0
str r0, [r4]
add r2, r1, #0
add r0, r1, #0
_02002CB6:
ldr r3, [r4]
add r3, r3, r2
add r3, #0x84
str r0, [r3]
ldr r3, [r4]
add r3, r3, r2
add r3, #0x9c
str r0, [r3]
ldr r3, [r4]
add r2, r2, #4
add r3, r3, r1
add r3, #0xb4
add r1, r1, #1
strb r0, [r3]
cmp r1, #6
blo _02002CB6
2021-09-04 20:01:18 +00:00
ldr r0, _02002CE8 ; =_020F56D8
2021-08-13 18:03:14 +00:00
bl sub_0201FFE0
pop {r4, pc}
nop
2021-08-13 21:09:14 +00:00
_02002CE0: .word _02111890
_02002CE4: .word _0211188C
2021-09-04 20:01:18 +00:00
_02002CE8: .word _020F56D8
2021-08-13 18:03:14 +00:00
thumb_func_end sub_02002CA8
thumb_func_start sub_02002CEC
sub_02002CEC: ; 0x02002CEC
push {r3, r4, r5, lr}
add r5, r0, #0
2021-08-13 21:09:14 +00:00
ldr r0, _02002D34 ; =_0211188C
2021-08-13 18:03:14 +00:00
lsl r4, r5, #2
ldr r0, [r0]
add r2, r0, r4
add r2, #0x9c
ldr r2, [r2]
cmp r2, #0
bne _02002D28
str r1, [sp]
2021-09-04 20:01:18 +00:00
ldr r1, _02002D38 ; =_020F56C0
ldr r3, _02002D3C ; =_020F56C2
2021-08-13 18:03:14 +00:00
ldrh r1, [r1, r4]
ldrh r3, [r3, r4]
2021-08-16 12:51:45 +00:00
mov r0, #0x10 ; graphic/font.narc
2021-08-13 18:03:14 +00:00
mov r2, #1
bl FontData_new
2021-08-13 21:09:14 +00:00
ldr r2, _02002D34 ; =_0211188C
2021-08-13 18:03:14 +00:00
ldr r1, [r2]
add r1, r1, r4
add r1, #0x9c
str r0, [r1]
ldr r0, [r2]
mov r1, #1
add r0, r0, r5
add r0, #0xb4
strb r1, [r0]
pop {r3, r4, r5, pc}
_02002D28:
add r0, #0xb4
ldrsb r1, [r0, r5]
add r1, r1, #1
strb r1, [r0, r5]
pop {r3, r4, r5, pc}
nop
2021-08-13 21:09:14 +00:00
_02002D34: .word _0211188C
2021-09-04 20:01:18 +00:00
_02002D38: .word _020F56C0
_02002D3C: .word _020F56C2
2021-08-13 18:03:14 +00:00
thumb_func_end sub_02002CEC
thumb_func_start sub_02002D40
sub_02002D40: ; 0x02002D40
push {r3, r4, r5, lr}
add r4, r0, #0
add r5, r1, #0
cmp r4, #6
blt _02002D4E
bl GF_AssertFail
_02002D4E:
2021-08-13 21:09:14 +00:00
ldr r0, _02002D78 ; =_0211188C
2021-08-13 18:03:14 +00:00
lsl r4, r4, #2
ldr r0, [r0]
add r0, r0, r4
add r0, #0x9c
ldr r0, [r0]
cmp r0, #0
bne _02002D62
bl GF_AssertFail
_02002D62:
2021-08-13 21:09:14 +00:00
ldr r0, _02002D78 ; =_0211188C
2021-08-13 18:03:14 +00:00
mov r1, #0
ldr r0, [r0]
add r2, r5, #0
add r0, r0, r4
add r0, #0x9c
ldr r0, [r0]
bl FontData_ModeSwitch
2021-08-13 18:03:14 +00:00
pop {r3, r4, r5, pc}
nop
2021-08-13 21:09:14 +00:00
_02002D78: .word _0211188C
2021-08-13 18:03:14 +00:00
thumb_func_end sub_02002D40
thumb_func_start sub_02002D7C
sub_02002D7C: ; 0x02002D7C
push {r4, lr}
add r4, r0, #0
cmp r4, #6
blt _02002D88
bl GF_AssertFail
_02002D88:
2021-08-13 21:09:14 +00:00
ldr r0, _02002DB0 ; =_0211188C
2021-08-13 18:03:14 +00:00
lsl r4, r4, #2
ldr r0, [r0]
add r0, r0, r4
add r0, #0x9c
ldr r0, [r0]
cmp r0, #0
bne _02002D9C
bl GF_AssertFail
_02002D9C:
2021-08-13 21:09:14 +00:00
ldr r0, _02002DB0 ; =_0211188C
2021-08-13 18:03:14 +00:00
mov r1, #1
ldr r0, [r0]
mov r2, #0
add r0, r0, r4
add r0, #0x9c
ldr r0, [r0]
bl FontData_ModeSwitch
2021-08-13 18:03:14 +00:00
pop {r4, pc}
.balign 4, 0
2021-08-13 21:09:14 +00:00
_02002DB0: .word _0211188C
2021-08-13 18:03:14 +00:00
thumb_func_end sub_02002D7C
thumb_func_start sub_02002DB4
sub_02002DB4: ; 0x02002DB4
push {r3, r4, r5, r6, r7, lr}
add r4, r0, #0
cmp r4, #6
blt _02002DC0
bl GF_AssertFail
_02002DC0:
2021-08-13 21:09:14 +00:00
ldr r0, _02002E74 ; =_0211188C
2021-08-13 18:03:14 +00:00
ldr r0, [r0]
add r1, r0, r4
mov r0, #0xb4
ldrsb r0, [r1, r0]
cmp r0, #0
bne _02002DD2
bl GF_AssertFail
_02002DD2:
2021-08-13 21:09:14 +00:00
ldr r0, _02002E74 ; =_0211188C
2021-08-13 18:03:14 +00:00
ldr r1, [r0]
add r1, #0xb4
ldrsb r0, [r1, r4]
cmp r0, #0
ble _02002DE2
sub r0, r0, #1
strb r0, [r1, r4]
_02002DE2:
2021-08-13 21:09:14 +00:00
ldr r0, _02002E74 ; =_0211188C
2021-08-13 18:03:14 +00:00
ldr r6, [r0]
mov r0, #0xb4
add r1, r6, r4
ldrsb r0, [r1, r0]
cmp r0, #0
bne _02002E70
lsl r7, r4, #2
add r0, r6, r7
add r0, #0x84
ldr r0, [r0]
mov ip, r0
cmp r0, #0
beq _02002E50
2021-09-04 20:01:18 +00:00
ldr r2, _02002E78 ; =_020F56C0
2021-08-13 18:03:14 +00:00
mov r1, #0
ldrh r0, [r2, r7]
add r3, r6, #0
_02002E06:
cmp r1, r4
beq _02002E26
ldrh r5, [r2]
cmp r5, r0
bne _02002E26
add r5, r3, #0
add r5, #0x9c
ldr r5, [r5]
cmp r5, #0
beq _02002E26
lsl r0, r1, #2
add r2, r6, r0
add r2, #0x84
mov r0, ip
str r0, [r2]
b _02002E30
_02002E26:
add r1, r1, #1
add r2, r2, #4
add r3, r3, #4
cmp r1, #6
blo _02002E06
_02002E30:
cmp r1, #6
bne _02002E50
2021-08-13 21:09:14 +00:00
ldr r0, _02002E74 ; =_0211188C
2021-08-13 18:03:14 +00:00
lsl r5, r4, #2
ldr r0, [r0]
add r0, r0, r5
add r0, #0x84
ldr r0, [r0]
bl FreeToHeap
2021-08-13 21:09:14 +00:00
ldr r0, _02002E74 ; =_0211188C
2021-08-13 18:03:14 +00:00
mov r1, #0
ldr r0, [r0]
add r0, r0, r5
add r0, #0x84
str r1, [r0]
_02002E50:
2021-08-13 21:09:14 +00:00
ldr r0, _02002E74 ; =_0211188C
2021-08-13 18:03:14 +00:00
ldr r0, [r0]
add r0, r0, r7
add r0, #0x9c
ldr r0, [r0]
cmp r0, #0
beq _02002E70
bl FontData_delete
2021-08-13 21:09:14 +00:00
ldr r0, _02002E74 ; =_0211188C
2021-08-13 18:03:14 +00:00
mov r2, #0
ldr r1, [r0]
lsl r0, r4, #2
add r0, r1, r0
add r0, #0x9c
str r2, [r0]
_02002E70:
pop {r3, r4, r5, r6, r7, pc}
nop
2021-08-13 21:09:14 +00:00
_02002E74: .word _0211188C
2021-09-04 20:01:18 +00:00
_02002E78: .word _020F56C0
2021-08-13 18:03:14 +00:00
thumb_func_end sub_02002DB4
thumb_func_start sub_02002E7C
sub_02002E7C: ; 0x02002E7C
push {r3, lr}
2021-08-13 21:09:14 +00:00
ldr r2, _02002E94 ; =_0211188C
2021-08-13 18:03:14 +00:00
lsl r0, r0, #2
ldr r2, [r2]
add r0, r2, r0
add r0, #0x9c
ldr r0, [r0]
bl TryLoadGlyph
2021-08-13 21:09:14 +00:00
ldr r0, _02002E94 ; =_0211188C
2021-08-13 18:03:14 +00:00
ldr r0, [r0]
pop {r3, pc}
.balign 4, 0
2021-08-13 21:09:14 +00:00
_02002E94: .word _0211188C
2021-08-13 18:03:14 +00:00
thumb_func_end sub_02002E7C
thumb_func_start sub_02002E98
sub_02002E98: ; 0x02002E98
push {r4, lr}
add r3, r1, #0
add r3, #0x20
ldrb r2, [r3, #1]
lsl r2, r2, #0x18
lsr r2, r2, #0x1f
bne _02002EC0
ldrb r2, [r3]
mov r4, #0xf
lsl r0, r0, #0x18
bic r2, r4
lsr r4, r0, #0x18
mov r0, #0xf
and r0, r4
orr r0, r2
strb r0, [r3]
ldrb r2, [r3, #1]
mov r0, #0x80
orr r0, r2
strb r0, [r3, #1]
_02002EC0:
add r0, r1, #0
2021-08-16 12:51:45 +00:00
bl RenderText
2021-08-13 18:03:14 +00:00
pop {r4, pc}
thumb_func_end sub_02002E98
thumb_func_start sub_02002EC8
sub_02002EC8: ; 0x02002EC8
push {r4, r5, r6, lr}
lsl r4, r0, #2
2021-08-13 21:09:14 +00:00
ldr r0, _02002EF8 ; =_0211188C
2021-08-13 18:03:14 +00:00
add r5, r1, #0
ldr r0, [r0]
add r6, r2, #0
add r0, r0, r4
add r0, #0x9c
ldr r0, [r0]
cmp r0, #0
bne _02002EE2
bl GF_AssertFail
_02002EE2:
2021-08-13 21:09:14 +00:00
ldr r0, _02002EF8 ; =_0211188C
2021-08-13 18:03:14 +00:00
add r1, r5, #0
ldr r0, [r0]
add r2, r6, #0
add r0, r0, r4
add r0, #0x9c
ldr r0, [r0]
bl GetStringWidth
2021-08-13 18:03:14 +00:00
pop {r4, r5, r6, pc}
nop
2021-08-13 21:09:14 +00:00
_02002EF8: .word _0211188C
2021-08-13 18:03:14 +00:00
thumb_func_end sub_02002EC8
thumb_func_start sub_02002EFC
sub_02002EFC: ; 0x02002EFC
push {r4, r5, r6, lr}
lsl r4, r0, #2
2021-08-13 21:09:14 +00:00
ldr r0, _02002F2C ; =_0211188C
2021-08-13 18:03:14 +00:00
add r5, r1, #0
ldr r0, [r0]
add r6, r2, #0
add r0, r0, r4
add r0, #0x9c
ldr r0, [r0]
cmp r0, #0
bne _02002F16
bl GF_AssertFail
_02002F16:
2021-08-13 21:09:14 +00:00
ldr r0, _02002F2C ; =_0211188C
2021-08-13 18:03:14 +00:00
add r1, r5, #0
ldr r0, [r0]
add r2, r6, #0
add r0, r0, r4
add r0, #0x9c
ldr r0, [r0]
bl GetStringWidthFirstLine
2021-08-13 18:03:14 +00:00
pop {r4, r5, r6, pc}
nop
2021-08-13 21:09:14 +00:00
_02002F2C: .word _0211188C
2021-08-13 18:03:14 +00:00
thumb_func_end sub_02002EFC
thumb_func_start sub_02002F30
sub_02002F30: ; 0x02002F30
push {r4, r5, r6, lr}
lsl r4, r0, #2
2021-08-13 21:09:14 +00:00
ldr r0, _02002F64 ; =_0211188C
2021-08-13 18:03:14 +00:00
add r5, r1, #0
ldr r0, [r0]
add r6, r2, #0
add r0, r0, r4
add r0, #0x9c
ldr r0, [r0]
cmp r0, #0
bne _02002F4A
bl GF_AssertFail
_02002F4A:
add r0, r5, #0
2021-08-17 00:42:24 +00:00
bl String_c_str
2021-08-13 18:03:14 +00:00
add r1, r0, #0
2021-08-13 21:09:14 +00:00
ldr r0, _02002F64 ; =_0211188C
2021-08-13 18:03:14 +00:00
add r2, r6, #0
ldr r0, [r0]
add r0, r0, r4
add r0, #0x9c
ldr r0, [r0]
bl GetStringWidth
2021-08-13 18:03:14 +00:00
pop {r4, r5, r6, pc}
.balign 4, 0
2021-08-13 21:09:14 +00:00
_02002F64: .word _0211188C
2021-08-13 18:03:14 +00:00
thumb_func_end sub_02002F30
thumb_func_start sub_02002F68
sub_02002F68: ; 0x02002F68
push {r4, r5, r6, lr}
lsl r4, r0, #2
2021-08-13 21:09:14 +00:00
ldr r0, _02002FA8 ; =_0211188C
2021-08-13 18:03:14 +00:00
add r6, r1, #0
ldr r0, [r0]
add r5, r2, #0
add r0, r0, r4
add r0, #0x9c
ldr r0, [r0]
cmp r0, #0
bne _02002F82
bl GF_AssertFail
_02002F82:
add r0, r5, #0
2021-08-14 00:11:40 +00:00
bl StringSetEmpty
2021-08-13 18:03:14 +00:00
add r0, r5, #0
add r1, r6, #0
2021-08-17 00:42:24 +00:00
bl StringCat_HandleTrainerName
2021-08-13 18:03:14 +00:00
add r0, r5, #0
2021-08-17 00:42:24 +00:00
bl String_c_str
2021-08-13 18:03:14 +00:00
add r1, r0, #0
2021-08-13 21:09:14 +00:00
ldr r0, _02002FA8 ; =_0211188C
2021-08-13 18:03:14 +00:00
ldr r0, [r0]
add r0, r0, r4
add r0, #0x9c
ldr r0, [r0]
bl StringAllCharsValid
2021-08-13 18:03:14 +00:00
pop {r4, r5, r6, pc}
.balign 4, 0
2021-08-13 21:09:14 +00:00
_02002FA8: .word _0211188C
2021-08-13 18:03:14 +00:00
thumb_func_end sub_02002F68
thumb_func_start GetFontAttribute
GetFontAttribute: ; 0x02002FAC
mov r2, #0
cmp r1, #7
bhi _0200300C
add r1, r1, r1
add r1, pc
ldrh r1, [r1, #6]
lsl r1, r1, #0x10
asr r1, r1, #0x10
add pc, r1
_02002FBE: ; jump table
.short _02002FCE - _02002FBE - 2 ; case 0
.short _02002FD6 - _02002FBE - 2 ; case 1
.short _02002FDE - _02002FBE - 2 ; case 2
.short _02002FE6 - _02002FBE - 2 ; case 3
.short _02002FEE - _02002FBE - 2 ; case 4
.short _02002FF6 - _02002FBE - 2 ; case 5
.short _02002FFE - _02002FBE - 2 ; case 6
.short _02003006 - _02002FBE - 2 ; case 7
_02002FCE:
lsl r1, r0, #3
2021-09-04 20:01:18 +00:00
ldr r0, _02003010 ; =_020F56D8
2021-08-13 18:03:14 +00:00
ldrb r2, [r0, r1]
b _0200300C
_02002FD6:
lsl r1, r0, #3
2021-09-04 20:01:18 +00:00
ldr r0, _02003014 ; =_020F56D9
2021-08-13 18:03:14 +00:00
ldrb r2, [r0, r1]
b _0200300C
_02002FDE:
lsl r1, r0, #3
2021-09-04 20:01:18 +00:00
ldr r0, _02003018 ; =_020F56DA
2021-08-13 18:03:14 +00:00
ldrb r2, [r0, r1]
b _0200300C
_02002FE6:
lsl r1, r0, #3
2021-09-04 20:01:18 +00:00
ldr r0, _0200301C ; =_020F56DB
2021-08-13 18:03:14 +00:00
ldrb r2, [r0, r1]
b _0200300C
_02002FEE:
lsl r1, r0, #3
2021-09-04 20:01:18 +00:00
ldr r0, _02003020 ; =_020F56DC
2021-08-13 18:03:14 +00:00
ldrb r2, [r0, r1]
b _0200300C
_02002FF6:
lsl r1, r0, #3
2021-09-04 20:01:18 +00:00
ldr r0, _02003024 ; =_020F56DD
2021-08-13 18:03:14 +00:00
ldrb r2, [r0, r1]
b _0200300C
_02002FFE:
lsl r1, r0, #3
2021-09-04 20:01:18 +00:00
ldr r0, _02003028 ; =_020F56DE
2021-08-13 18:03:14 +00:00
ldrb r2, [r0, r1]
b _0200300C
_02003006:
lsl r1, r0, #3
2021-09-04 20:01:18 +00:00
ldr r0, _0200302C ; =_020F56DF
2021-08-13 18:03:14 +00:00
ldrb r2, [r0, r1]
_0200300C:
add r0, r2, #0
bx lr
.balign 4, 0
2021-09-04 20:01:18 +00:00
_02003010: .word _020F56D8
_02003014: .word _020F56D9
_02003018: .word _020F56DA
_0200301C: .word _020F56DB
_02003020: .word _020F56DC
_02003024: .word _020F56DD
_02003028: .word _020F56DE
_0200302C: .word _020F56DF
2021-08-13 18:03:14 +00:00
thumb_func_end GetFontAttribute
thumb_func_start sub_02003030
sub_02003030: ; 0x02003030
push {r4, lr}
sub sp, #8
add r4, r0, #0
mov r0, #0x20
str r0, [sp]
add r3, r1, #0
str r2, [sp, #4]
mov r0, #0x10
mov r1, #7
add r2, r4, #0
bl GfGfxLoader_GXLoadPal
2021-08-13 18:03:14 +00:00
add sp, #8
pop {r4, pc}
thumb_func_end sub_02003030
thumb_func_start sub_0200304C
sub_0200304C: ; 0x0200304C
push {r4, lr}
sub sp, #8
add r4, r0, #0
mov r0, #0x20
str r0, [sp]
add r3, r1, #0
str r2, [sp, #4]
mov r0, #0x10
mov r1, #8
add r2, r4, #0
bl GfGfxLoader_GXLoadPal
2021-08-13 18:03:14 +00:00
add sp, #8
pop {r4, pc}
thumb_func_end sub_0200304C
thumb_func_start sub_02003068
sub_02003068: ; 0x02003068
push {r4, r5, r6, lr}
lsl r4, r0, #2
2021-08-13 21:09:14 +00:00
ldr r0, _0200309C ; =_0211188C
2021-08-13 18:03:14 +00:00
add r5, r1, #0
ldr r0, [r0]
add r6, r2, #0
add r0, r0, r4
add r0, #0x9c
ldr r0, [r0]
cmp r0, #0
bne _02003082
bl GF_AssertFail
_02003082:
add r0, r5, #0
2021-08-17 00:42:24 +00:00
bl String_c_str
2021-08-13 18:03:14 +00:00
add r1, r0, #0
2021-08-13 21:09:14 +00:00
ldr r0, _0200309C ; =_0211188C
2021-08-13 18:03:14 +00:00
add r2, r6, #0
ldr r0, [r0]
add r0, r0, r4
add r0, #0x9c
ldr r0, [r0]
bl GetStringWidthMultiline
2021-08-13 18:03:14 +00:00
pop {r4, r5, r6, pc}
.balign 4, 0
2021-08-13 21:09:14 +00:00
_0200309C: .word _0211188C
2021-08-13 18:03:14 +00:00
thumb_func_end sub_02003068
thumb_func_start sub_020030A0
sub_020030A0: ; 0x020030A0
push {r4, lr}
add r4, r3, #0
bl sub_02002F30
cmp r0, r4
bhs _020030B2
sub r0, r4, r0
lsr r0, r0, #1
pop {r4, pc}
_020030B2:
mov r0, #0
pop {r4, pc}
.balign 4, 0
thumb_func_end sub_020030A0
thumb_func_start FontI_GetGlyphWidth
FontI_GetGlyphWidth: ; 0x020030B8
2021-08-13 18:03:14 +00:00
push {r3, r4, r5, lr}
lsl r4, r0, #2
2021-08-13 21:09:14 +00:00
ldr r0, _020030E4 ; =_0211188C
2021-08-13 18:03:14 +00:00
add r5, r1, #0
ldr r0, [r0]
add r0, r0, r4
add r0, #0x9c
ldr r0, [r0]
cmp r0, #0
bne _020030D0
bl GF_AssertFail
_020030D0:
2021-08-13 21:09:14 +00:00
ldr r0, _020030E4 ; =_0211188C
2021-08-13 18:03:14 +00:00
add r1, r5, #0
ldr r0, [r0]
add r0, r0, r4
add r0, #0x9c
ldr r0, [r0]
bl GetGlyphWidth
2021-08-13 18:03:14 +00:00
pop {r3, r4, r5, pc}
nop
2021-08-13 21:09:14 +00:00
_020030E4: .word _0211188C
thumb_func_end FontI_GetGlyphWidth