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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
|
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start PrintCoinsString
@ void PrintCoinsString(s32 coinAmount)
PrintCoinsString: @ 8145B54
push {r4,lr}
sub sp, 0xC
adds r1, r0, 0
ldr r0, =gStringVar1
movs r2, 0x1
movs r3, 0x4
bl ConvertIntToDecimalStringN
ldr r4, =gStringVar4
ldr r1, =gUnknown_085E8DAB
adds r0, r4, 0
bl StringExpandPlaceholders
movs r0, 0x1
adds r1, r4, 0
movs r2, 0x40
bl GetStringRightAlignXOffset
adds r3, r0, 0
ldr r0, =gUnknown_0203AB9C
ldrb r0, [r0]
lsls r3, 24
lsrs r3, 24
movs r1, 0x1
str r1, [sp]
movs r1, 0
str r1, [sp, 0x4]
str r1, [sp, 0x8]
movs r1, 0x1
adds r2, r4, 0
bl Print
add sp, 0xC
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end PrintCoinsString
thumb_func_start ShowCoinsWindow
@ void ShowCoinsWindow(s32 coinAmount, u8 x, u8 y)
ShowCoinsWindow: @ 8145BAC
push {r4,r5,lr}
sub sp, 0x18
adds r5, r0, 0
adds r4, r1, 0
adds r3, r2, 0
lsls r4, 24
lsrs r4, 24
lsls r3, 24
lsrs r3, 24
movs r0, 0x8
str r0, [sp]
movs r0, 0x2
str r0, [sp, 0x4]
movs r0, 0xF
str r0, [sp, 0x8]
ldr r0, =0x00000141
str r0, [sp, 0xC]
add r0, sp, 0x10
movs r1, 0
adds r2, r4, 0
bl rbox_template_set
ldr r4, =gUnknown_0203AB9C
add r0, sp, 0x10
bl AddWindow
strb r0, [r4]
ldrb r0, [r4]
movs r1, 0
bl FillWindowPixelBuffer
ldrb r0, [r4]
bl PutWindowTilemap
ldrb r0, [r4]
movs r2, 0x85
lsls r2, 2
movs r1, 0
movs r3, 0xE
bl SetWindowBorderStyle
adds r0, r5, 0
bl PrintCoinsString
add sp, 0x18
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end ShowCoinsWindow
thumb_func_start HideCoinsWindow
@ void HideCoinsWindow()
HideCoinsWindow: @ 8145C14
push {r4,lr}
ldr r4, =gUnknown_0203AB9C
ldrb r0, [r4]
movs r1, 0x1
bl sub_819746C
ldrb r0, [r4]
bl RemoveWindow
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end HideCoinsWindow
thumb_func_start GetCoins
@ u16 GetCoins()
GetCoins: @ 8145C30
ldr r0, =gSaveBlock1Ptr
ldr r1, [r0]
ldr r0, =0x00000494
adds r1, r0
ldr r0, =gSaveBlock2Ptr
ldr r0, [r0]
adds r0, 0xAC
ldr r0, [r0]
ldrh r1, [r1]
eors r0, r1
lsls r0, 16
lsrs r0, 16
bx lr
.pool
thumb_func_end GetCoins
thumb_func_start SetCoins
@ void SetCoins(u16 amount)
SetCoins: @ 8145C58
lsls r0, 16
lsrs r0, 16
ldr r1, =gSaveBlock1Ptr
ldr r2, [r1]
ldr r1, =gSaveBlock2Ptr
ldr r1, [r1]
adds r1, 0xAC
ldr r1, [r1]
eors r0, r1
ldr r1, =0x00000494
adds r2, r1
strh r0, [r2]
bx lr
.pool
thumb_func_end SetCoins
thumb_func_start AddCoins
@ bool8 AddCoins(u16 amount)
AddCoins: @ 8145C80
push {r4,lr}
lsls r0, 16
lsrs r4, r0, 16
bl GetCoins
lsls r0, 16
lsrs r1, r0, 16
ldr r0, =0x0000270e
cmp r1, r0
bls _08145C9C
movs r0, 0
b _08145CC0
.pool
_08145C9C:
adds r0, r1, r4
cmp r1, r0
ble _08145CAC
ldr r0, =0x0000270f
b _08145CBA
.pool
_08145CAC:
lsls r0, 16
lsrs r1, r0, 16
ldr r0, =0x0000270f
cmp r1, r0
bls _08145CB8
adds r1, r0, 0
_08145CB8:
adds r0, r1, 0
_08145CBA:
bl SetCoins
movs r0, 0x1
_08145CC0:
pop {r4}
pop {r1}
bx r1
.pool
thumb_func_end AddCoins
thumb_func_start SubtractCoins
@ bool8 SubtractCoins(u16 amount)
SubtractCoins: @ 8145CCC
push {r4,lr}
lsls r0, 16
lsrs r4, r0, 16
bl GetCoins
lsls r0, 16
lsrs r0, 16
cmp r0, r4
bcs _08145CE2
movs r0, 0
b _08145CEE
_08145CE2:
subs r0, r4
lsls r0, 16
lsrs r0, 16
bl SetCoins
movs r0, 0x1
_08145CEE:
pop {r4}
pop {r1}
bx r1
thumb_func_end SubtractCoins
.align 2, 0 @ Don't pad with nop.
|