diff options
Diffstat (limited to 'src/bios_calls.s')
-rw-r--r-- | src/bios_calls.s | 337 |
1 files changed, 337 insertions, 0 deletions
diff --git a/src/bios_calls.s b/src/bios_calls.s new file mode 100644 index 0000000..740fa02 --- /dev/null +++ b/src/bios_calls.s | |||
@@ -0,0 +1,337 @@ | |||
1 | @ | ||
2 | @ Arithmetic functions. | ||
3 | @ | ||
4 | |||
5 | @ Division. | ||
6 | .text | ||
7 | .code 16 | ||
8 | .align 2 | ||
9 | .global bios_div | ||
10 | .thumb_func | ||
11 | bios_div: | ||
12 | swi 0x06 | ||
13 | bx lr | ||
14 | |||
15 | @ Square root. | ||
16 | .text | ||
17 | .code 16 | ||
18 | .align 2 | ||
19 | .global bios_sqrt | ||
20 | .thumb_func | ||
21 | bios_sqrt: | ||
22 | swi 0x08 | ||
23 | bx lr | ||
24 | |||
25 | @ Arc-tangent. | ||
26 | .text | ||
27 | .code 16 | ||
28 | .align 2 | ||
29 | .global bios_atan | ||
30 | .thumb_func | ||
31 | bios_atan: | ||
32 | swi 0x09 | ||
33 | bx lr | ||
34 | |||
35 | @ Arc-tangent2. | ||
36 | .text | ||
37 | .code 16 | ||
38 | .align 2 | ||
39 | .global bios_atan2 | ||
40 | .thumb_func | ||
41 | bios_atan2: | ||
42 | swi 0x0a | ||
43 | bx lr | ||
44 | |||
45 | @ | ||
46 | @ Rotation/Scaling. | ||
47 | @ | ||
48 | |||
49 | @ BG Affine Set. | ||
50 | .text | ||
51 | .code 16 | ||
52 | .align 2 | ||
53 | .global bios_bg_affine_set | ||
54 | .thumb_func | ||
55 | bios_bg_affine_set: | ||
56 | swi 0x0e | ||
57 | bx lr | ||
58 | |||
59 | @ OBJ Affine Set. | ||
60 | .text | ||
61 | .code 16 | ||
62 | .align 2 | ||
63 | .global bios_obj_affine_set | ||
64 | .thumb_func | ||
65 | bios_obj_affine_set: | ||
66 | swi 0x0f | ||
67 | bx lr | ||
68 | |||
69 | @ | ||
70 | @ (De)compression. | ||
71 | @ | ||
72 | |||
73 | @ Bit unpacking. | ||
74 | .text | ||
75 | .code 16 | ||
76 | .align 2 | ||
77 | .global bios_bit_unpack | ||
78 | .thumb_func | ||
79 | bios_bit_unpack: | ||
80 | swi 0x10 | ||
81 | bx lr | ||
82 | |||
83 | @ Huffman decompression. | ||
84 | .text | ||
85 | .code 16 | ||
86 | .align 2 | ||
87 | .global bios_huff_expand | ||
88 | .thumb_func | ||
89 | bios_huff_expand: | ||
90 | swi 0x13 | ||
91 | bx lr | ||
92 | |||
93 | @ LZ77 decompression (Fast, WRAM, 8 bit writes). | ||
94 | .text | ||
95 | .code 16 | ||
96 | .align 2 | ||
97 | .global bios_lz77_expand_wram | ||
98 | .thumb_func | ||
99 | bios_lz77_expand_wram: | ||
100 | swi 0x11 | ||
101 | bx lr | ||
102 | |||
103 | @ LZ77 decompression (Slow, VRAM, 16 bit writes). | ||
104 | .text | ||
105 | .code 16 | ||
106 | .align 2 | ||
107 | .global bios_lz77_expand_vram | ||
108 | .thumb_func | ||
109 | bios_lz77_expand_vram: | ||
110 | swi 0x12 | ||
111 | bx lr | ||
112 | |||
113 | @ Run length encoding decompression (Fast, WRAM, 8 bit writes). | ||
114 | .text | ||
115 | .code 16 | ||
116 | .align 2 | ||
117 | .global bios_rle_expand_wram | ||
118 | .thumb_func | ||
119 | bios_rle_expand_wram: | ||
120 | swi 0x14 | ||
121 | bx lr | ||
122 | |||
123 | @ Run length encoding decompression (Slow, VRAM, 16 bit writes). | ||
124 | .text | ||
125 | .code 16 | ||
126 | .align 2 | ||
127 | .global bios_rle_expand_vram | ||
128 | .thumb_func | ||
129 | bios_rle_expand_vram: | ||
130 | swi 0x15 | ||
131 | bx lr | ||
132 | |||
133 | @ | ||
134 | @ Memory copy. | ||
135 | @ | ||
136 | |||
137 | @ Memcopy/memfill in 32 byte units (Fast). | ||
138 | .text | ||
139 | .code 16 | ||
140 | .align 2 | ||
141 | .global bios_memcopy_32 | ||
142 | .thumb_func | ||
143 | bios_memcopy_32: | ||
144 | swi 0x0C | ||
145 | bx lr | ||
146 | |||
147 | @ Memcopy/memfill in 4 / 2 byte units (Slow). | ||
148 | .text | ||
149 | .code 16 | ||
150 | .align 2 | ||
151 | .global bios_memcopy_8 | ||
152 | .thumb_func | ||
153 | bios_memcopy_8: | ||
154 | swi 0x0B | ||
155 | bx lr | ||
156 | |||
157 | @ | ||
158 | @ Sound functions. | ||
159 | @ | ||
160 | |||
161 | @ MIDI key to frequency. | ||
162 | .text | ||
163 | .code 16 | ||
164 | .align 2 | ||
165 | .global bios_midi2freq | ||
166 | .thumb_func | ||
167 | bios_midi2freq: | ||
168 | swi 0x1f | ||
169 | bx lr | ||
170 | |||
171 | @ Sound bias. | ||
172 | .text | ||
173 | .code 16 | ||
174 | .align 2 | ||
175 | .global bios_sound_bias | ||
176 | .thumb_func | ||
177 | bios_sound_bias: | ||
178 | swi 0x19 | ||
179 | bx lr | ||
180 | |||
181 | @ Sound channels clear. | ||
182 | .text | ||
183 | .code 16 | ||
184 | .align 2 | ||
185 | .global bios_sound_clear | ||
186 | .thumb_func | ||
187 | bios_sound_clear: | ||
188 | swi 0x1e | ||
189 | bx lr | ||
190 | |||
191 | @ Sound driver initialization. | ||
192 | .text | ||
193 | .code 16 | ||
194 | .align 2 | ||
195 | .global bios_sound_init | ||
196 | .thumb_func | ||
197 | bios_sound_init: | ||
198 | swi 0x1a | ||
199 | bx lr | ||
200 | |||
201 | @ Sound main function. To be called each 1/60 of a second after the sound VSync. | ||
202 | .text | ||
203 | .code 16 | ||
204 | .align 2 | ||
205 | .global bios_sound_main | ||
206 | .thumb_func | ||
207 | bios_sound_main: | ||
208 | swi 0x1c | ||
209 | bx lr | ||
210 | |||
211 | @ Sound driver operation mode. | ||
212 | .text | ||
213 | .code 16 | ||
214 | .align 2 | ||
215 | .global bios_sound_mode | ||
216 | .thumb_func | ||
217 | bios_sound_mode: | ||
218 | swi 0x1b | ||
219 | bx lr | ||
220 | |||
221 | @ Sound VSync. Called just after the VBlank interrupt each 1/60 of a second. | ||
222 | .text | ||
223 | .code 16 | ||
224 | .align 2 | ||
225 | .global bios_sound_vsync | ||
226 | .thumb_func | ||
227 | bios_sound_vsync: | ||
228 | swi 0x1d | ||
229 | bx lr | ||
230 | |||
231 | @ Sound VSync off In case of issues manually call this to stop the sound. | ||
232 | .text | ||
233 | .code 16 | ||
234 | .align 2 | ||
235 | .global bios_sound_vsync_off | ||
236 | .thumb_func | ||
237 | bios_sound_vsync_off: | ||
238 | swi 0x28 | ||
239 | bx lr | ||
240 | |||
241 | @ | ||
242 | @ Halt/Reset functions. | ||
243 | @ | ||
244 | |||
245 | @ Halt until interrupt request. | ||
246 | .text | ||
247 | .code 16 | ||
248 | .align 2 | ||
249 | .global bios_halt | ||
250 | .thumb_func | ||
251 | bios_halt: | ||
252 | swi 0x02 | ||
253 | bx lr | ||
254 | |||
255 | @ Halt until one of the specified interrupts occur. | ||
256 | .text | ||
257 | .code 16 | ||
258 | .align 2 | ||
259 | .global bios_interrupt_wait | ||
260 | .thumb_func | ||
261 | bios_interrupt_wait: | ||
262 | swi 0x04 | ||
263 | bx lr | ||
264 | |||
265 | @ Halt until the VBlank interrupt occurs. | ||
266 | .text | ||
267 | .code 16 | ||
268 | .align 2 | ||
269 | .global bios_vblank_wait | ||
270 | .thumb_func | ||
271 | bios_vblank_wait: | ||
272 | swi 0x05 | ||
273 | bx lr | ||
274 | |||
275 | @ Stop. Switches GBA to low power mode. | ||
276 | .text | ||
277 | .code 16 | ||
278 | .align 2 | ||
279 | .global bios_stop | ||
280 | .thumb_func | ||
281 | bios_stop: | ||
282 | swi 0x03 | ||
283 | bx lr | ||
284 | |||
285 | @ Soft reset. | ||
286 | .text | ||
287 | .code 16 | ||
288 | .align 2 | ||
289 | .global bios_soft_reset | ||
290 | .thumb_func | ||
291 | bios_soft_reset: | ||
292 | swi 0x00 | ||
293 | bx lr | ||
294 | |||
295 | @ Register RAM reset. | ||
296 | .text | ||
297 | .code 16 | ||
298 | .align 2 | ||
299 | .global bios_regram_reset | ||
300 | .thumb_func | ||
301 | bios_regram_reset: | ||
302 | swi 0x01 | ||
303 | bx lr | ||
304 | |||
305 | @ Hard reset. | ||
306 | .text | ||
307 | .code 16 | ||
308 | .align 2 | ||
309 | .global bios_hard_reset | ||
310 | .thumb_func | ||
311 | bios_hard_reset: | ||
312 | swi 0x26 | ||
313 | bx lr | ||
314 | |||
315 | @ | ||
316 | @ Misc functions. | ||
317 | @ | ||
318 | |||
319 | @ BIOS checksum. | ||
320 | .text | ||
321 | .code 16 | ||
322 | .align 2 | ||
323 | .global bios_bios_checksum | ||
324 | .thumb_func | ||
325 | bios_bios_checksum: | ||
326 | swi 0x0d | ||
327 | bx lr | ||
328 | |||
329 | @ MultiBoot. | ||
330 | .text | ||
331 | .code 16 | ||
332 | .align 2 | ||
333 | .global bios_multiboot | ||
334 | .thumb_func | ||
335 | bios_multiboot: | ||
336 | swi 0x25 | ||
337 | bx lr | ||