aboutsummaryrefslogtreecommitdiffstats
path: root/src/bios_calls.s
blob: 740fa0270bac328f7457cde88a5c3e2e42fa2d4f (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
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
@
@ Arithmetic functions.
@

@ Division.
    .text
    .code 16
    .align 2
    .global bios_div
    .thumb_func
bios_div:
    swi     0x06
    bx      lr

@ Square root.
    .text
    .code 16
    .align 2
    .global bios_sqrt
    .thumb_func
bios_sqrt:
    swi     0x08
    bx      lr

@ Arc-tangent.
    .text
    .code 16
    .align 2
    .global bios_atan
    .thumb_func
bios_atan:
    swi     0x09
    bx      lr

@ Arc-tangent2.
    .text
    .code 16
    .align 2
    .global bios_atan2
    .thumb_func
bios_atan2:
    swi     0x0a
    bx      lr

@
@ Rotation/Scaling.
@

@ BG Affine Set.
    .text
    .code 16
    .align 2
    .global bios_bg_affine_set
    .thumb_func
bios_bg_affine_set:
    swi     0x0e
    bx      lr

@ OBJ Affine Set.
    .text
    .code 16
    .align 2
    .global bios_obj_affine_set
    .thumb_func
bios_obj_affine_set:
    swi     0x0f
    bx      lr

@
@ (De)compression.
@

@ Bit unpacking.
    .text
    .code 16
    .align 2
    .global bios_bit_unpack
    .thumb_func
bios_bit_unpack:
    swi     0x10
    bx      lr

@ Huffman decompression.
    .text
    .code 16
    .align 2
    .global bios_huff_expand
    .thumb_func
bios_huff_expand:
    swi     0x13
    bx      lr

@ LZ77 decompression (Fast, WRAM, 8 bit writes).
    .text
    .code 16
    .align 2
    .global bios_lz77_expand_wram
    .thumb_func
bios_lz77_expand_wram:
    swi     0x11
    bx      lr

@ LZ77 decompression (Slow, VRAM, 16 bit writes).
    .text
    .code 16
    .align 2
    .global bios_lz77_expand_vram
    .thumb_func
bios_lz77_expand_vram:
    swi     0x12
    bx      lr

@ Run length encoding decompression (Fast, WRAM, 8 bit writes).
    .text
    .code 16
    .align 2
    .global bios_rle_expand_wram
    .thumb_func
bios_rle_expand_wram:
    swi     0x14
    bx      lr

@ Run length encoding decompression (Slow, VRAM, 16 bit writes).
    .text
    .code 16
    .align 2
    .global bios_rle_expand_vram
    .thumb_func
bios_rle_expand_vram:
    swi     0x15
    bx      lr

@
@ Memory copy.
@

@ Memcopy/memfill in 32 byte units (Fast).
    .text
    .code 16
    .align 2
    .global bios_memcopy_32
    .thumb_func
bios_memcopy_32:
    swi     0x0C
    bx      lr

@ Memcopy/memfill in 4 / 2 byte units (Slow).
    .text
    .code 16
    .align 2
    .global bios_memcopy_8
    .thumb_func
bios_memcopy_8:
    swi     0x0B
    bx      lr

@
@ Sound functions.
@

@ MIDI key to frequency.
    .text
    .code 16
    .align 2
    .global bios_midi2freq
    .thumb_func
bios_midi2freq:
    swi     0x1f
    bx      lr

@ Sound bias.
    .text
    .code 16
    .align 2
    .global bios_sound_bias
    .thumb_func
bios_sound_bias:
    swi     0x19
    bx      lr

@ Sound channels clear.
    .text
    .code 16
    .align 2
    .global bios_sound_clear
    .thumb_func
bios_sound_clear:
    swi     0x1e
    bx      lr

@ Sound driver initialization.
    .text
    .code 16
    .align 2
    .global bios_sound_init
    .thumb_func
bios_sound_init:
    swi     0x1a
    bx      lr

@ Sound main function. To be called each 1/60 of a second after the sound VSync.
    .text
    .code 16
    .align 2
    .global bios_sound_main
    .thumb_func
bios_sound_main:
    swi     0x1c
    bx      lr

@ Sound driver operation mode.
    .text
    .code 16
    .align 2
    .global bios_sound_mode
    .thumb_func
bios_sound_mode:
    swi     0x1b
    bx      lr

@ Sound VSync. Called just after the VBlank interrupt each 1/60 of a second.
    .text
    .code 16
    .align 2
    .global bios_sound_vsync
    .thumb_func
bios_sound_vsync:
    swi     0x1d
    bx      lr

@ Sound VSync off In case of issues manually call this to stop the sound.
    .text
    .code 16
    .align 2
    .global bios_sound_vsync_off
    .thumb_func
bios_sound_vsync_off:
    swi     0x28
    bx      lr

@
@ Halt/Reset functions.
@

@ Halt until interrupt request.
    .text
    .code 16
    .align 2
    .global bios_halt
    .thumb_func
bios_halt:
    swi     0x02
    bx      lr

@ Halt until one of the specified interrupts occur.
    .text
    .code 16
    .align 2
    .global bios_interrupt_wait
    .thumb_func
bios_interrupt_wait:
    swi     0x04
    bx      lr

@ Halt until the VBlank interrupt occurs.
    .text
    .code 16
    .align 2
    .global bios_vblank_wait
    .thumb_func
bios_vblank_wait:
    swi     0x05
    bx      lr

@ Stop. Switches GBA to low power mode.
    .text
    .code 16
    .align 2
    .global bios_stop
    .thumb_func
bios_stop:
    swi     0x03
    bx      lr

@ Soft reset.
    .text
    .code 16
    .align 2
    .global bios_soft_reset
    .thumb_func
bios_soft_reset:
    swi     0x00
    bx      lr

@ Register RAM reset.
    .text
    .code 16
    .align 2
    .global bios_regram_reset
    .thumb_func
bios_regram_reset:
    swi     0x01
    bx      lr

@ Hard reset.
    .text
    .code 16
    .align 2
    .global bios_hard_reset
    .thumb_func
bios_hard_reset:
    swi     0x26
    bx      lr

@
@ Misc functions.
@

@ BIOS checksum.
    .text
    .code 16
    .align 2
    .global bios_bios_checksum
    .thumb_func
bios_bios_checksum:
    swi     0x0d
    bx      lr

@ MultiBoot.
    .text
    .code 16
    .align 2
    .global bios_multiboot
    .thumb_func
bios_multiboot:
    swi     0x25
    bx      lr