summaryrefslogtreecommitdiff
path: root/asm/heal_location.s
blob: 6e8181b45e06705dcd0fe50d14c3b241c5e6de3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
	.include "constants/gba_constants.s"
	.include "constants/species_constants.s"
	.include "asm/macros.s"

	.syntax unified

	.text

	thumb_func_start GetHealLocationIndexByMap
GetHealLocationIndexByMap: @ 80FA86C
	push {r4,lr}
	lsls r0, 16
	lsrs r4, r0, 16
	lsls r1, 16
	lsrs r1, 16
	movs r3, 0
	ldr r2, _080FA890 @ =gHealLocations
_080FA87A:
	movs r0, 0
	ldrsb r0, [r2, r0]
	cmp r0, r4
	bne _080FA894
	movs r0, 0x1
	ldrsb r0, [r2, r0]
	cmp r0, r1
	bne _080FA894
	adds r0, r3, 0x1
	b _080FA89E
	.align 2, 0
_080FA890: .4byte gHealLocations
_080FA894:
	adds r2, 0x8
	adds r3, 0x1
	cmp r3, 0x15
	bls _080FA87A
	movs r0, 0
_080FA89E:
	pop {r4}
	pop {r1}
	bx r1
	thumb_func_end GetHealLocationIndexByMap

	thumb_func_start GetHealLocationByMap
GetHealLocationByMap: @ 80FA8A4
	push {lr}
	lsls r0, 16
	lsrs r0, 16
	lsls r1, 16
	lsrs r1, 16
	bl GetHealLocationIndexByMap
	cmp r0, 0
	beq _080FA8C4
	lsls r0, 3
	ldr r1, _080FA8C0 @ =gHealLocations - 0x8
	adds r0, r1
	b _080FA8C6
	.align 2, 0
_080FA8C0: .4byte gHealLocations - 0x8
_080FA8C4:
	movs r0, 0
_080FA8C6:
	pop {r1}
	bx r1
	thumb_func_end GetHealLocationByMap

	thumb_func_start GetHealLocation
GetHealLocation: @ 80FA8CC
	push {lr}
	cmp r0, 0
	beq _080FA8E4
	cmp r0, 0x16
	bhi _080FA8E4
	lsls r0, 3
	ldr r1, _080FA8E0 @ =gHealLocations - 0x8
	adds r0, r1
	b _080FA8E6
	.align 2, 0
_080FA8E0: .4byte gHealLocations - 0x8
_080FA8E4:
	movs r0, 0
_080FA8E6:
	pop {r1}
	bx r1
	thumb_func_end GetHealLocation

	.align 2, 0 @ Don't pad with nop.