pmd-red/asm/code_801EE10_mid.s
2023-08-05 13:46:05 -04:00

293 lines
4.4 KiB
ArmAsm

#include "asm/constants/gba_constants.inc"
#include "asm/macros.inc"
.syntax unified
.text
thumb_func_start sub_8021410
sub_8021410:
push {r4,lr}
ldr r4, _08021490
ldr r0, [r4]
adds r0, 0xDC
movs r2, 0
movs r1, 0x1
strb r1, [r0]
ldr r0, [r4]
adds r0, 0xDD
strb r2, [r0]
ldr r0, [r4]
adds r0, 0xDE
movs r1, 0xC
strb r1, [r0]
ldr r0, [r4]
adds r0, 0xDF
strb r2, [r0]
bl ResetUnusedInputStruct
ldr r0, [r4]
adds r0, 0x7C
movs r1, 0x1
movs r2, 0x1
bl sub_800641C
ldr r0, [r4]
adds r0, 0x5A
movs r1, 0
ldrsh r0, [r0, r1]
movs r1, 0xC
bl sub_80095E4
adds r0, 0x2
lsls r0, 16
ldr r2, [r4]
ldr r3, [r2, 0x74]
lsls r1, r3, 1
adds r1, r3
lsls r1, 3
adds r1, r2, r1
adds r1, 0x8A
asrs r3, r0, 16
lsrs r0, 16
strh r0, [r1]
ldr r1, [r2, 0x74]
lsls r0, r1, 1
adds r0, r1
lsls r0, 3
adds r2, r0
adds r3, 0x2
adds r2, 0x8C
strh r3, [r2]
bl ResetUnusedInputStruct
ldr r0, [r4]
adds r0, 0x7C
movs r1, 0x1
movs r2, 0x1
bl sub_800641C
pop {r4}
pop {r0}
bx r0
.align 2, 0
_08021490: .4byte gUnknown_203B280
thumb_func_end sub_8021410
thumb_func_start sub_8021494
sub_8021494:
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0xA8
ldr r4, _08021568
ldr r0, [r4]
ldr r0, [r0, 0x74]
bl sub_8008C54
ldr r0, [r4]
ldr r0, [r0, 0x74]
bl sub_80073B8
ldr r2, _0802156C
ldr r0, [r4]
ldr r3, [r0, 0x74]
movs r0, 0
str r0, [sp]
movs r0, 0xA
movs r1, 0
bl xxx_call_draw_string
ldr r3, [r4]
adds r0, r3, 0
adds r0, 0xDE
ldrb r0, [r0]
lsls r0, 3
adds r0, 0x4
adds r1, r3, 0
adds r1, 0x5E
movs r5, 0
ldrsh r2, [r1, r5]
adds r2, 0x1
movs r1, 0x7
str r1, [sp]
ldr r1, [r3, 0x74]
str r1, [sp, 0x4]
movs r1, 0
movs r3, 0x1
bl sub_8012BC4
movs r0, 0
mov r9, r0
ldr r0, [r4]
adds r0, 0x5A
movs r1, 0
ldrsh r0, [r0, r1]
cmp r9, r0
blt _080214FC
b _08021646
_080214FC:
mov r8, r4
add r2, sp, 0x58
mov r10, r2
_08021502:
mov r3, r8
ldr r2, [r3]
adds r0, r2, 0
adds r0, 0x5E
movs r5, 0
ldrsh r1, [r0, r5]
subs r0, 0x2
movs r3, 0
ldrsh r0, [r0, r3]
muls r0, r1
add r0, r9
adds r0, r2, r0
ldrb r5, [r0]
adds r7, r5, 0
ldr r6, [r2, 0x3C]
cmp r6, 0x2
bne _0802159C
add r0, sp, 0x8
adds r1, r5, 0
movs r2, 0x1
bl sub_8092578
adds r0, r5, 0
bl GetFriendAreaPrice
ldr r1, _08021570
ldr r1, [r1]
movs r5, 0x98
lsls r5, 2
adds r1, r5
ldr r1, [r1]
cmp r0, r1
bgt _08021574
mov r1, r8
ldr r0, [r1]
adds r0, 0x40
mov r1, r9
bl sub_8013800
adds r1, r0, 0
mov r2, r8
ldr r0, [r2]
ldr r3, [r0, 0x74]
movs r0, 0
str r0, [sp]
movs r0, 0x8
add r2, sp, 0x8
bl xxx_call_draw_string
b _08021632
.align 2, 0
_08021568: .4byte gUnknown_203B280
_0802156C: .4byte gUnknown_80DC494
_08021570: .4byte gTeamInventoryRef
_08021574:
mov r0, r10
ldr r1, _08021598
add r2, sp, 0x8
bl sprintfStatic
mov r3, r8
ldr r0, [r3]
adds r0, 0x40
mov r1, r9
bl sub_8013800
adds r1, r0, 0
mov r5, r8
ldr r0, [r5]
ldr r3, [r0, 0x74]
movs r0, 0
str r0, [sp]
b _080215FE
.align 2, 0
_08021598: .4byte gUnknown_80DC4A4
_0802159C:
cmp r6, 0
bne _0802160C
ldr r0, _080215D4
ldr r0, [r0]
adds r0, r5
ldrb r0, [r0]
cmp r0, 0x1
bne _080215D8
adds r0, r2, 0
adds r0, 0x40
mov r1, r9
bl sub_8013800
adds r4, r0, 0
adds r0, r5, 0
bl GetFriendAreaName
adds r2, r0, 0
mov r1, r8
ldr r0, [r1]
ldr r3, [r0, 0x74]
str r6, [sp]
movs r0, 0x8
adds r1, r4, 0
bl xxx_call_draw_string
b _08021632
.align 2, 0
_080215D4: .4byte gFriendAreas
_080215D8:
adds r0, r5, 0
bl GetFriendAreaName
adds r2, r0, 0
mov r0, r10
ldr r1, _08021608
bl sprintfStatic
mov r2, r8
ldr r0, [r2]
adds r0, 0x40
mov r1, r9
bl sub_8013800
adds r1, r0, 0
mov r3, r8
ldr r0, [r3]
ldr r3, [r0, 0x74]
str r6, [sp]
_080215FE:
movs r0, 0x8
mov r2, r10
bl xxx_call_draw_string
b _08021632
.align 2, 0
_08021608: .4byte gUnknown_80DC4AC
_0802160C:
adds r0, r2, 0
adds r0, 0x40
mov r1, r9
bl sub_8013800
adds r4, r0, 0
adds r0, r7, 0
bl GetFriendAreaName
adds r2, r0, 0
mov r5, r8
ldr r0, [r5]
ldr r3, [r0, 0x74]
movs r0, 0
str r0, [sp]
movs r0, 0x8
adds r1, r4, 0
bl xxx_call_draw_string
_08021632:
movs r0, 0x1
add r9, r0
mov r1, r8
ldr r0, [r1]
adds r0, 0x5A
movs r2, 0
ldrsh r0, [r0, r2]
cmp r9, r0
bge _08021646
b _08021502
_08021646:
ldr r0, _08021660
ldr r0, [r0]
ldr r0, [r0, 0x74]
bl sub_80073E0
add sp, 0xA8
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_08021660: .4byte gUnknown_203B280
thumb_func_end sub_8021494
.align 2,0