pmd-red/asm/code_80983D8.s
mid-kid 99a038284b Translate all .include to #include
This decision was made to reduce the complexity of using .include whilst
juggling with tools/scaninc and tools/preproc:
- tools/scaninc doesn't apply the proper search rules for .include (it
  assumes #include behavior). In particular, it doesn't consider paths
  starting from $PWD, and doesn't scan the included files as a result.
- .include had to be processed before #include by preproc in many cases,
  as code was being included that had to be preprocessed by CPP (think
  of #define). This contradicts standard GCC behavior.

To make include paths consistent across the asm/ data/ and src/
directories, the following files were moved:
- constants/ → include/asm/constants/
- asm/macros/ → include/asm/macros/
- asm/macros.inc → include/asm/macros.inc
- include/macros/m4a.inc → include/asm/macros/m4a.inc

As part of the necessary changes for this to work, the scaninc method in
the makefile was improved to generate .d files that don't choke when
files are missing.
2021-12-20 16:29:12 +01:00

64 lines
932 B
ArmAsm

#include "asm/constants/gba_constants.inc"
#include "asm/macros.inc"
.syntax unified
.text
thumb_func_start CalculateFacingDir
CalculateFacingDir:
push {r4,lr}
movs r2, 0
ldrsh r3, [r1, r2]
movs r4, 0
ldrsh r2, [r0, r4]
subs r2, r3, r2
movs r3, 0x2
ldrsh r1, [r1, r3]
movs r4, 0x2
ldrsh r0, [r0, r4]
subs r1, r0
cmp r2, 0
bne _080983FA
cmp r1, 0
bne _080983FA
movs r0, 0
b _08098428
_080983FA:
cmp r2, 0
ble _08098400
movs r2, 0x1
_08098400:
cmp r1, 0
ble _08098406
movs r1, 0x1
_08098406:
movs r0, 0x1
negs r0, r0
cmp r2, r0
bgt _08098410
adds r2, r0, 0
_08098410:
cmp r1, r0
bgt _08098416
adds r1, r0, 0
_08098416:
ldr r3, _08098430
adds r2, 0x1
adds r1, 0x1
lsls r0, r1, 1
adds r0, r1
adds r0, r2
lsls r0, 2
adds r0, r3
ldr r0, [r0]
_08098428:
pop {r4}
pop {r1}
bx r1
.align 2, 0
_08098430: .4byte gUnknown_8115E94
thumb_func_end CalculateFacingDir
.align 2,0