pokeemerald/asm/menu_specialized.s
2019-03-31 14:32:26 +02:00

337 lines
5.3 KiB
ArmAsm

.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start DrawLevelUpWindowPg1
DrawLevelUpWindowPg1: @ 81D3640
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x2C
mov r8, r0
adds r6, r1, 0
adds r5, r2, 0
adds r4, r3, 0
ldr r3, [sp, 0x4C]
ldr r0, [sp, 0x50]
mov r9, r0
lsls r4, 24
lsrs r4, 24
lsls r3, 24
lsrs r3, 24
mov r1, r9
lsls r1, 24
lsrs r1, 24
mov r9, r1
mov r0, r8
lsls r0, 24
lsrs r0, 24
mov r8, r0
lsls r1, r4, 4
orrs r1, r4
lsls r1, 24
lsrs r1, 24
str r3, [sp, 0x28]
bl FillWindowPixelBuffer
add r2, sp, 0xC
ldrh r0, [r5]
ldrh r1, [r6]
subs r0, r1
strh r0, [r2]
ldrh r0, [r5, 0x2]
ldrh r1, [r6, 0x2]
subs r0, r1
strh r0, [r2, 0x2]
ldrh r0, [r5, 0x4]
ldrh r1, [r6, 0x4]
subs r0, r1
strh r0, [r2, 0x4]
ldrh r0, [r5, 0x8]
ldrh r1, [r6, 0x8]
subs r0, r1
strh r0, [r2, 0x6]
ldrh r0, [r5, 0xA]
ldrh r1, [r6, 0xA]
subs r0, r1
strh r0, [r2, 0x8]
ldrh r0, [r5, 0x6]
ldrh r1, [r6, 0x6]
subs r0, r1
strh r0, [r2, 0xA]
add r0, sp, 0x24
strb r4, [r0]
ldr r3, [sp, 0x28]
strb r3, [r0, 0x1]
mov r1, r9
strb r1, [r0, 0x2]
movs r7, 0
mov r10, r0
movs r0, 0x1
negs r0, r0
mov r9, r0
add r6, sp, 0x18
_081D36CA:
lsls r0, r7, 4
subs r0, r7
lsls r0, 24
lsrs r5, r0, 24
mov r1, r10
str r1, [sp]
mov r0, r9
str r0, [sp, 0x4]
ldr r1, =gUnknown_08625B54
lsls r0, r7, 2
adds r0, r1
ldr r0, [r0]
str r0, [sp, 0x8]
mov r0, r8
movs r1, 0x1
movs r2, 0
adds r3, r5, 0
bl AddTextPrinterParameterized3
lsls r0, r7, 1
mov r4, sp
adds r4, r0
adds r4, 0xC
movs r1, 0
ldrsh r0, [r4, r1]
ldr r1, =gText_Dash
cmp r0, 0
blt _081D3704
ldr r1, =gText_UnkCtrlF904
_081D3704:
adds r0, r6, 0
bl StringCopy
mov r0, r10
str r0, [sp]
mov r1, r9
str r1, [sp, 0x4]
str r6, [sp, 0x8]
mov r0, r8
movs r1, 0x1
movs r2, 0x38
adds r3, r5, 0
bl AddTextPrinterParameterized3
movs r0, 0
ldrsh r1, [r4, r0]
adds r0, r1, 0
cmp r1, 0
bge _081D372C
negs r0, r1
_081D372C:
movs r4, 0xC
cmp r0, 0x9
bgt _081D3734
movs r4, 0x12
_081D3734:
cmp r1, 0
bge _081D373A
negs r1, r1
_081D373A:
adds r0, r6, 0
movs r2, 0
movs r3, 0x2
bl ConvertIntToDecimalStringN
adds r2, r4, 0
adds r2, 0x38
mov r1, r10
str r1, [sp]
mov r0, r9
str r0, [sp, 0x4]
str r6, [sp, 0x8]
mov r0, r8
movs r1, 0x1
adds r3, r5, 0
bl AddTextPrinterParameterized3
adds r0, r7, 0x1
lsls r0, 16
lsrs r7, r0, 16
cmp r7, 0x5
bls _081D36CA
add sp, 0x2C
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end DrawLevelUpWindowPg1
thumb_func_start DrawLevelUpWindowPg2
DrawLevelUpWindowPg2: @ 81D3784
push {r4-r7,lr}
mov r7, r10
mov r6, r9
mov r5, r8
push {r5-r7}
sub sp, 0x2C
mov r8, r0
adds r5, r1, 0
adds r4, r2, 0
adds r6, r3, 0
ldr r2, [sp, 0x4C]
lsls r4, 24
lsrs r4, 24
lsls r6, 24
lsrs r6, 24
lsls r2, 24
lsrs r2, 24
lsls r0, 24
lsrs r0, 24
mov r8, r0
lsls r1, r4, 4
orrs r1, r4
lsls r1, 24
lsrs r1, 24
str r2, [sp, 0x28]
bl FillWindowPixelBuffer
add r1, sp, 0xC
ldrh r0, [r5]
strh r0, [r1]
ldrh r0, [r5, 0x2]
strh r0, [r1, 0x2]
ldrh r0, [r5, 0x4]
strh r0, [r1, 0x4]
ldrh r0, [r5, 0x8]
strh r0, [r1, 0x6]
ldrh r0, [r5, 0xA]
strh r0, [r1, 0x8]
ldrh r0, [r5, 0x6]
strh r0, [r1, 0xA]
add r0, sp, 0x24
strb r4, [r0]
strb r6, [r0, 0x1]
ldr r2, [sp, 0x28]
strb r2, [r0, 0x2]
movs r6, 0
add r1, sp, 0x18
mov r9, r1
mov r7, r8
mov r10, r0
movs r2, 0x1
negs r2, r2
mov r8, r2
_081D37EE:
lsls r1, r6, 1
mov r0, sp
adds r0, r1
adds r0, 0xC
movs r2, 0
ldrsh r0, [r0, r2]
movs r4, 0x3
cmp r0, 0x63
bgt _081D3808
movs r4, 0x1
cmp r0, 0x9
ble _081D3808
movs r4, 0x2
_081D3808:
mov r0, sp
adds r0, r1
adds r0, 0xC
movs r2, 0
ldrsh r1, [r0, r2]
mov r0, r9
movs r2, 0
adds r3, r4, 0
bl ConvertIntToDecimalStringN
movs r0, 0x4
subs r0, r4
lsls r4, r0, 1
adds r4, r0
lsls r4, 17
lsrs r4, 16
lsls r5, r6, 4
subs r5, r6
lsls r5, 24
lsrs r5, 24
mov r0, r10
str r0, [sp]
mov r1, r8
str r1, [sp, 0x4]
ldr r1, =gUnknown_08625B54
lsls r0, r6, 2
adds r0, r1
ldr r0, [r0]
str r0, [sp, 0x8]
adds r0, r7, 0
movs r1, 0x1
movs r2, 0
adds r3, r5, 0
bl AddTextPrinterParameterized3
adds r4, 0x38
lsls r4, 24
lsrs r4, 24
mov r2, r10
str r2, [sp]
mov r0, r8
str r0, [sp, 0x4]
mov r1, r9
str r1, [sp, 0x8]
adds r0, r7, 0
movs r1, 0x1
adds r2, r4, 0
adds r3, r5, 0
bl AddTextPrinterParameterized3
adds r0, r6, 0x1
lsls r0, 16
lsrs r6, r0, 16
cmp r6, 0x5
bls _081D37EE
add sp, 0x2C
pop {r3-r5}
mov r8, r3
mov r9, r4
mov r10, r5
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end DrawLevelUpWindowPg2
thumb_func_start GetMonLevelUpWindowStats
GetMonLevelUpWindowStats: @ 81D388C
push {r4,r5,lr}
adds r4, r0, 0
adds r5, r1, 0
movs r1, 0x3A @ MON_DATA_MAX_HP
bl GetMonData
strh r0, [r5]
adds r0, r4, 0
movs r1, 0x3B @ MON_DATA_ATK
bl GetMonData
strh r0, [r5, 0x2]
adds r0, r4, 0
movs r1, 0x3C @ MON_DATA_DEF
bl GetMonData
strh r0, [r5, 0x4]
adds r0, r4, 0
movs r1, 0x3D @ MON_DATA_SPEED
bl GetMonData
strh r0, [r5, 0x6]
adds r0, r4, 0
movs r1, 0x3E @ MON_DATA_SPATK
bl GetMonData
strh r0, [r5, 0x8]
adds r0, r4, 0
movs r1, 0x3F @ MON_DATA_SPDEF
bl GetMonData
strh r0, [r5, 0xA]
pop {r4,r5}
pop {r0}
bx r0
thumb_func_end GetMonLevelUpWindowStats
.align 2, 0 @ Don't pad with nop.