mirror of
https://github.com/pret/pmd-red.git
synced 2024-11-27 06:50:30 +00:00
532 lines
7.9 KiB
ArmAsm
532 lines
7.9 KiB
ArmAsm
#include "asm/constants/gba_constants.inc"
|
|
#include "asm/macros.inc"
|
|
|
|
.syntax unified
|
|
|
|
.text
|
|
|
|
thumb_func_start sub_804225C
|
|
sub_804225C:
|
|
push {r4-r7,lr}
|
|
mov r7, r8
|
|
push {r7}
|
|
sub sp, 0x4
|
|
mov r8, r0
|
|
adds r5, r1, 0
|
|
lsls r2, 24
|
|
lsrs r4, r2, 24
|
|
adds r7, r4, 0
|
|
cmp r4, 0x11
|
|
bne _08042274
|
|
b _08042384
|
|
_08042274:
|
|
adds r0, r5, 0
|
|
bl sub_803F428
|
|
lsls r0, 24
|
|
cmp r0, 0
|
|
bne _08042282
|
|
b _08042384
|
|
_08042282:
|
|
adds r0, r4, 0
|
|
bl sub_800EF28
|
|
bl sub_800EF64
|
|
movs r0, 0x4
|
|
movs r1, 0x42
|
|
bl sub_803E708
|
|
movs r0, 0
|
|
ldrsh r1, [r5, r0]
|
|
lsls r0, r1, 1
|
|
adds r0, r1
|
|
lsls r0, 11
|
|
movs r1, 0xC0
|
|
lsls r1, 4
|
|
adds r0, r1
|
|
cmp r0, 0
|
|
bge _080422AA
|
|
adds r0, 0xFF
|
|
_080422AA:
|
|
lsls r0, 8
|
|
lsrs r0, 16
|
|
ldr r1, _080422FC
|
|
ldr r2, [sp]
|
|
ands r2, r1
|
|
orrs r2, r0
|
|
str r2, [sp]
|
|
movs r0, 0x2
|
|
ldrsh r1, [r5, r0]
|
|
lsls r0, r1, 1
|
|
adds r0, r1
|
|
lsls r0, 11
|
|
movs r1, 0x80
|
|
lsls r1, 5
|
|
adds r0, r1
|
|
cmp r0, 0
|
|
bge _080422CE
|
|
adds r0, 0xFF
|
|
_080422CE:
|
|
lsls r0, 8
|
|
lsrs r0, 16
|
|
lsls r0, 16
|
|
ldr r1, _08042300
|
|
ands r2, r1
|
|
orrs r2, r0
|
|
str r2, [sp]
|
|
adds r0, r4, 0
|
|
mov r1, sp
|
|
bl sub_800E448
|
|
adds r6, r0, 0
|
|
cmp r4, 0x4
|
|
bne _08042308
|
|
ldr r1, _08042304
|
|
movs r0, 0
|
|
bl sub_80421C0
|
|
movs r0, 0x28
|
|
movs r1, 0x33
|
|
bl sub_803E708
|
|
b _08042360
|
|
.align 2, 0
|
|
_080422FC: .4byte 0xffff0000
|
|
_08042300: .4byte 0x0000ffff
|
|
_08042304: .4byte 0x00000193
|
|
_08042308:
|
|
cmp r7, 0x8
|
|
bne _08042358
|
|
mov r0, r8
|
|
ldr r7, [r0, 0x70]
|
|
adds r0, r7, 0
|
|
adds r0, 0x46
|
|
ldrb r4, [r0]
|
|
movs r5, 0
|
|
b _0804231C
|
|
_0804231A:
|
|
adds r5, 0x2
|
|
_0804231C:
|
|
ldr r0, _08042354
|
|
cmp r5, r0
|
|
bgt _08042346
|
|
subs r4, 0x1
|
|
movs r0, 0x7
|
|
ands r4, r0
|
|
mov r0, r8
|
|
movs r1, 0
|
|
adds r2, r4, 0
|
|
bl sub_806CDD4
|
|
movs r0, 0x2
|
|
movs r1, 0x33
|
|
bl sub_803E708
|
|
adds r0, r6, 0
|
|
bl sub_800E9A8
|
|
lsls r0, 24
|
|
cmp r0, 0
|
|
bne _0804231A
|
|
_08042346:
|
|
movs r0, 0x7
|
|
ands r4, r0
|
|
adds r0, r7, 0
|
|
adds r0, 0x46
|
|
strb r4, [r0]
|
|
b _08042360
|
|
.align 2, 0
|
|
_08042354: .4byte 0x000003e7
|
|
_08042358:
|
|
movs r0, 0x28
|
|
movs r1, 0x33
|
|
bl sub_803E708
|
|
_08042360:
|
|
movs r5, 0
|
|
ldr r4, _08042368
|
|
b _0804236E
|
|
.align 2, 0
|
|
_08042368: .4byte 0x000003e7
|
|
_0804236C:
|
|
adds r5, 0x1
|
|
_0804236E:
|
|
cmp r5, r4
|
|
bgt _08042384
|
|
movs r0, 0x42
|
|
bl sub_803E46C
|
|
adds r0, r6, 0
|
|
bl sub_800E9A8
|
|
lsls r0, 24
|
|
cmp r0, 0
|
|
bne _0804236C
|
|
_08042384:
|
|
add sp, 0x4
|
|
pop {r3}
|
|
mov r8, r3
|
|
pop {r4-r7}
|
|
pop {r0}
|
|
bx r0
|
|
thumb_func_end sub_804225C
|
|
|
|
thumb_func_start sub_8042390
|
|
sub_8042390:
|
|
push {r4-r6,lr}
|
|
sub sp, 0x18
|
|
adds r5, r0, 0
|
|
adds r4, r1, 0
|
|
bl sub_8042768
|
|
lsls r0, 24
|
|
cmp r0, 0
|
|
beq _08042454
|
|
ldrb r1, [r4]
|
|
movs r0, 0x8
|
|
ands r0, r1
|
|
movs r6, 0
|
|
cmp r0, 0
|
|
bne _080423B0
|
|
ldrb r6, [r4, 0x2]
|
|
_080423B0:
|
|
adds r0, r6, 0
|
|
movs r1, 0
|
|
bl sub_800EF40
|
|
bl sub_800EF64
|
|
movs r0, 0x4
|
|
movs r1, 0x42
|
|
bl sub_803E708
|
|
ldr r0, [r5, 0xC]
|
|
cmp r0, 0
|
|
bge _080423CC
|
|
adds r0, 0xFF
|
|
_080423CC:
|
|
lsls r0, 8
|
|
lsrs r0, 16
|
|
ldr r1, _08042428
|
|
ldr r2, [sp, 0x14]
|
|
ands r2, r1
|
|
orrs r2, r0
|
|
str r2, [sp, 0x14]
|
|
ldr r0, [r5, 0x10]
|
|
cmp r0, 0
|
|
bge _080423E2
|
|
adds r0, 0xFF
|
|
_080423E2:
|
|
lsls r0, 8
|
|
lsrs r0, 16
|
|
lsls r0, 16
|
|
ldr r4, _0804242C
|
|
ands r4, r2
|
|
orrs r4, r0
|
|
str r4, [sp, 0x14]
|
|
asrs r4, 16
|
|
ldr r0, _08042430
|
|
ldr r0, [r0]
|
|
ldr r1, _08042434
|
|
adds r0, r1
|
|
movs r1, 0
|
|
ldrsh r0, [r0, r1]
|
|
subs r4, r0
|
|
lsrs r0, r4, 31
|
|
adds r4, r0
|
|
asrs r4, 1
|
|
adds r4, 0x1
|
|
adds r1, r5, 0
|
|
adds r1, 0x28
|
|
add r0, sp, 0x4
|
|
bl sub_8005700
|
|
add r1, sp, 0x14
|
|
str r4, [sp]
|
|
adds r0, r6, 0
|
|
add r2, sp, 0x4
|
|
movs r3, 0
|
|
bl sub_800E49C
|
|
adds r5, r0, 0
|
|
movs r4, 0
|
|
ldr r6, _08042438
|
|
b _0804243E
|
|
.align 2, 0
|
|
_08042428: .4byte 0xffff0000
|
|
_0804242C: .4byte 0x0000ffff
|
|
_08042430: .4byte gDungeon
|
|
_08042434: .4byte 0x000181f2
|
|
_08042438: .4byte 0x000003e7
|
|
_0804243C:
|
|
adds r4, 0x1
|
|
_0804243E:
|
|
cmp r4, r6
|
|
bgt _08042454
|
|
movs r0, 0x42
|
|
bl sub_803E46C
|
|
adds r0, r5, 0
|
|
bl sub_800E9A8
|
|
lsls r0, 24
|
|
cmp r0, 0
|
|
bne _0804243C
|
|
_08042454:
|
|
add sp, 0x18
|
|
pop {r4-r6}
|
|
pop {r0}
|
|
bx r0
|
|
thumb_func_end sub_8042390
|
|
|
|
thumb_func_start sub_804245C
|
|
sub_804245C:
|
|
push {r4-r6,lr}
|
|
sub sp, 0x18
|
|
adds r5, r0, 0
|
|
adds r4, r1, 0
|
|
bl sub_8042768
|
|
lsls r0, 24
|
|
cmp r0, 0
|
|
beq _08042518
|
|
ldrb r1, [r4]
|
|
movs r0, 0x8
|
|
ands r0, r1
|
|
movs r6, 0
|
|
cmp r0, 0
|
|
bne _0804247C
|
|
ldrb r6, [r4, 0x2]
|
|
_0804247C:
|
|
bl sub_800EF64
|
|
movs r0, 0x4
|
|
movs r1, 0x42
|
|
bl sub_803E708
|
|
ldr r0, [r5, 0xC]
|
|
cmp r0, 0
|
|
bge _08042490
|
|
adds r0, 0xFF
|
|
_08042490:
|
|
lsls r0, 8
|
|
lsrs r0, 16
|
|
ldr r1, _080424EC
|
|
ldr r2, [sp, 0x14]
|
|
ands r2, r1
|
|
orrs r2, r0
|
|
str r2, [sp, 0x14]
|
|
ldr r0, [r5, 0x10]
|
|
cmp r0, 0
|
|
bge _080424A6
|
|
adds r0, 0xFF
|
|
_080424A6:
|
|
lsls r0, 8
|
|
lsrs r0, 16
|
|
lsls r0, 16
|
|
ldr r4, _080424F0
|
|
ands r4, r2
|
|
orrs r4, r0
|
|
str r4, [sp, 0x14]
|
|
asrs r4, 16
|
|
ldr r0, _080424F4
|
|
ldr r0, [r0]
|
|
ldr r1, _080424F8
|
|
adds r0, r1
|
|
movs r1, 0
|
|
ldrsh r0, [r0, r1]
|
|
subs r4, r0
|
|
lsrs r0, r4, 31
|
|
adds r4, r0
|
|
asrs r4, 1
|
|
adds r4, 0x1
|
|
adds r1, r5, 0
|
|
adds r1, 0x28
|
|
add r0, sp, 0x4
|
|
bl sub_8005700
|
|
add r1, sp, 0x14
|
|
str r4, [sp]
|
|
adds r0, r6, 0
|
|
add r2, sp, 0x4
|
|
movs r3, 0x1
|
|
bl sub_800E49C
|
|
adds r5, r0, 0
|
|
movs r4, 0
|
|
ldr r6, _080424FC
|
|
b _08042502
|
|
.align 2, 0
|
|
_080424EC: .4byte 0xffff0000
|
|
_080424F0: .4byte 0x0000ffff
|
|
_080424F4: .4byte gDungeon
|
|
_080424F8: .4byte 0x000181f2
|
|
_080424FC: .4byte 0x000003e7
|
|
_08042500:
|
|
adds r4, 0x1
|
|
_08042502:
|
|
cmp r4, r6
|
|
bgt _08042518
|
|
movs r0, 0x42
|
|
bl sub_803E46C
|
|
adds r0, r5, 0
|
|
bl sub_800E9A8
|
|
lsls r0, 24
|
|
cmp r0, 0
|
|
bne _08042500
|
|
_08042518:
|
|
add sp, 0x18
|
|
pop {r4-r6}
|
|
pop {r0}
|
|
bx r0
|
|
thumb_func_end sub_804245C
|
|
|
|
@ https://decomp.me/scratch/nTem0 (kermalis 89.31%) `s32 sub_8042520(Entity *)`
|
|
thumb_func_start sub_8042520
|
|
sub_8042520:
|
|
push {r4-r7,lr}
|
|
mov r7, r10
|
|
mov r6, r9
|
|
mov r5, r8
|
|
push {r5-r7}
|
|
sub sp, 0x3C
|
|
adds r4, r0, 0
|
|
bl sub_8045888
|
|
lsls r0, 24
|
|
cmp r0, 0
|
|
bne _0804253A
|
|
b _08042664
|
|
_0804253A:
|
|
ldr r0, [r4, 0x70]
|
|
adds r0, 0x46
|
|
ldrb r5, [r0]
|
|
ldr r0, [r4, 0xC]
|
|
cmp r0, 0
|
|
bge _08042548
|
|
adds r0, 0xFF
|
|
_08042548:
|
|
lsls r0, 8
|
|
lsrs r0, 16
|
|
ldr r1, _0804264C
|
|
ldr r2, [sp, 0x2C]
|
|
ands r2, r1
|
|
orrs r2, r0
|
|
str r2, [sp, 0x2C]
|
|
ldr r0, [r4, 0x10]
|
|
cmp r0, 0
|
|
bge _0804255E
|
|
adds r0, 0xFF
|
|
_0804255E:
|
|
lsls r0, 8
|
|
lsrs r0, 16
|
|
lsls r0, 16
|
|
ldr r1, _08042650
|
|
ands r1, r2
|
|
orrs r1, r0
|
|
str r1, [sp, 0x2C]
|
|
asrs r1, 16
|
|
ldr r0, _08042654
|
|
ldr r0, [r0]
|
|
ldr r2, _08042658
|
|
adds r0, r2
|
|
movs r2, 0
|
|
ldrsh r0, [r0, r2]
|
|
subs r1, r0
|
|
lsrs r0, r1, 31
|
|
adds r1, r0
|
|
asrs r7, r1, 1
|
|
ldr r0, _0804265C
|
|
str r0, [sp, 0x4]
|
|
movs r2, 0
|
|
str r2, [sp, 0x8]
|
|
str r5, [sp, 0xC]
|
|
add r1, sp, 0x4
|
|
add r4, sp, 0x2C
|
|
ldrh r0, [r4]
|
|
strh r0, [r1, 0xC]
|
|
ldr r0, [sp, 0x2C]
|
|
asrs r0, 16
|
|
strh r0, [r1, 0xE]
|
|
adds r0, r1, 0
|
|
strh r2, [r0, 0x10]
|
|
strh r2, [r0, 0x12]
|
|
movs r0, 0x1
|
|
negs r0, r0
|
|
str r0, [sp, 0x18]
|
|
str r7, [sp, 0x1C]
|
|
add r0, sp, 0x20
|
|
bl sub_8004E8C
|
|
add r0, sp, 0x4
|
|
movs r1, 0
|
|
bl sub_8041764
|
|
adds r6, r0, 0
|
|
mov r10, r4
|
|
lsls r1, r5, 2
|
|
mov r0, sp
|
|
adds r0, 0x30
|
|
str r0, [sp, 0x38]
|
|
ldr r0, _08042660
|
|
adds r5, r1, r0
|
|
movs r1, 0x5
|
|
mov r8, r1
|
|
mov r9, r10
|
|
_080425CC:
|
|
movs r0, 0
|
|
str r0, [sp]
|
|
adds r0, r6, 0
|
|
adds r1, r4, 0
|
|
movs r2, 0
|
|
adds r3, r7, 0
|
|
bl sub_800E8AC
|
|
movs r0, 0x42
|
|
bl sub_803E46C
|
|
movs r2, 0
|
|
ldrsh r0, [r5, r2]
|
|
lsls r0, 2
|
|
mov r1, r9
|
|
ldrh r1, [r1]
|
|
adds r0, r1
|
|
mov r2, r9
|
|
strh r0, [r2]
|
|
movs r0, 0x2
|
|
ldrsh r1, [r5, r0]
|
|
lsls r1, 2
|
|
ldrh r0, [r4, 0x2]
|
|
adds r0, r1
|
|
strh r0, [r4, 0x2]
|
|
movs r2, 0x2
|
|
ldrsh r1, [r4, r2]
|
|
ldr r0, _08042654
|
|
ldr r0, [r0]
|
|
ldr r2, _08042658
|
|
adds r0, r2
|
|
movs r2, 0
|
|
ldrsh r0, [r0, r2]
|
|
subs r1, r0
|
|
lsrs r0, r1, 31
|
|
adds r1, r0
|
|
asrs r7, r1, 1
|
|
movs r0, 0x1
|
|
negs r0, r0
|
|
add r8, r0
|
|
mov r1, r8
|
|
cmp r1, 0
|
|
bge _080425CC
|
|
bl sub_800DBBC
|
|
mov r2, r10
|
|
movs r1, 0
|
|
ldrsh r0, [r2, r1]
|
|
lsls r0, 8
|
|
str r0, [sp, 0x30]
|
|
add r0, sp, 0x2C
|
|
movs r2, 0x2
|
|
ldrsh r0, [r0, r2]
|
|
lsls r0, 8
|
|
ldr r1, [sp, 0x38]
|
|
str r0, [r1, 0x4]
|
|
movs r1, 0xD0
|
|
lsls r1, 1
|
|
ldr r0, [sp, 0x38]
|
|
movs r2, 0x1
|
|
bl sub_80416E0
|
|
adds r6, r0, 0
|
|
b _08042668
|
|
.align 2, 0
|
|
_0804264C: .4byte 0xffff0000
|
|
_08042650: .4byte 0x0000ffff
|
|
_08042654: .4byte gDungeon
|
|
_08042658: .4byte 0x000181f2
|
|
_0804265C: .4byte 0x00000165
|
|
_08042660: .4byte gAdjacentTileOffsets
|
|
_08042664:
|
|
movs r6, 0x1
|
|
negs r6, r6
|
|
_08042668:
|
|
adds r0, r6, 0
|
|
add sp, 0x3C
|
|
pop {r3-r5}
|
|
mov r8, r3
|
|
mov r9, r4
|
|
mov r10, r5
|
|
pop {r4-r7}
|
|
pop {r1}
|
|
bx r1
|
|
thumb_func_end sub_8042520
|
|
|
|
.align 2,0
|