psx 0.1.8

Library for developing homebrew for the Sony PlayStation 1
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
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
// This file was automatically generated by gen_bios_mod.rs
.set noreorder

.section .text.bios.psx_file_open
.globl psx_file_open
psx_file_open:
    la $8, 0xA0
    jr $8
    li $9, 0x00

.section .text.bios.psx_file_seek
.globl psx_file_seek
psx_file_seek:
    la $8, 0xA0
    jr $8
    li $9, 0x01

.section .text.bios.psx_file_read
.globl psx_file_read
psx_file_read:
    la $8, 0xA0
    jr $8
    li $9, 0x02

.section .text.bios.psx_file_write
.globl psx_file_write
psx_file_write:
    la $8, 0xA0
    jr $8
    li $9, 0x03

.section .text.bios.psx_file_close
.globl psx_file_close
psx_file_close:
    la $8, 0xA0
    jr $8
    li $9, 0x04

.section .text.bios.psx_exit
.globl psx_exit
psx_exit:
    la $8, 0xA0
    jr $8
    li $9, 0x06

.section .text.bios.psx_save_state
.globl psx_save_state
psx_save_state:
    la $8, 0xA0
    jr $8
    li $9, 0x13

.section .text.bios.psx_restore_state
.globl psx_restore_state
psx_restore_state:
    la $8, 0xA0
    jr $8
    li $9, 0x14

.section .text.bios.psx_rand
.globl psx_rand
psx_rand:
    la $8, 0xA0
    jr $8
    li $9, 0x2F

.section .text.bios.psx_srand
.globl psx_srand
psx_srand:
    la $8, 0xA0
    jr $8
    li $9, 0x30

.section .text.bios.psx_malloc
.globl psx_malloc
psx_malloc:
    la $8, 0xA0
    jr $8
    li $9, 0x33

.section .text.bios.psx_free
.globl psx_free
psx_free:
    la $8, 0xA0
    jr $8
    li $9, 0x34

.section .text.bios.psx_calloc
.globl psx_calloc
psx_calloc:
    la $8, 0xA0
    jr $8
    li $9, 0x37

.section .text.bios.psx_realloc
.globl psx_realloc
psx_realloc:
    la $8, 0xA0
    jr $8
    li $9, 0x38

.section .text.bios.psx_init_heap
.globl psx_init_heap
psx_init_heap:
    la $8, 0xA0
    jr $8
    li $9, 0x39

.section .text.bios.psx_system_error_exit
.globl psx_system_error_exit
psx_system_error_exit:
    la $8, 0xA0
    jr $8
    li $9, 0x3A

.section .text.bios.psx_std_out_putchar
.globl psx_std_out_putchar
psx_std_out_putchar:
    la $8, 0xB0
    jr $8
    li $9, 0x3D

.section .text.bios.psx_std_out_puts
.globl psx_std_out_puts
psx_std_out_puts:
    la $8, 0xA0
    jr $8
    li $9, 0x3E

.section .text.bios.psx_printf
.globl psx_printf
psx_printf:
    la $8, 0xA0
    jr $8
    li $9, 0x3F

.section .text.bios.psx_load_exe_header
.globl psx_load_exe_header
psx_load_exe_header:
    la $8, 0xA0
    jr $8
    li $9, 0x41

.section .text.bios.psx_load_exe_file
.globl psx_load_exe_file
psx_load_exe_file:
    la $8, 0xA0
    jr $8
    li $9, 0x42

.section .text.bios.psx_do_execute
.globl psx_do_execute
psx_do_execute:
    la $8, 0xA0
    jr $8
    li $9, 0x43

.section .text.bios.psx_flush_cache
.globl psx_flush_cache
psx_flush_cache:
    la $8, 0xA0
    jr $8
    li $9, 0x44

.section .text.bios.psx_gpu_send_dma
.globl psx_gpu_send_dma
psx_gpu_send_dma:
    la $8, 0xA0
    jr $8
    li $9, 0x47

.section .text.bios.psx_gp1_command
.globl psx_gp1_command
psx_gp1_command:
    la $8, 0xA0
    jr $8
    li $9, 0x48

.section .text.bios.psx_gp0_command
.globl psx_gp0_command
psx_gp0_command:
    la $8, 0xA0
    jr $8
    li $9, 0x49

.section .text.bios.psx_gp0_command_params
.globl psx_gp0_command_params
psx_gp0_command_params:
    la $8, 0xA0
    jr $8
    li $9, 0x4A

.section .text.bios.psx_gpu_get_status
.globl psx_gpu_get_status
psx_gpu_get_status:
    la $8, 0xA0
    jr $8
    li $9, 0x4D

.section .text.bios.psx_gpu_sync
.globl psx_gpu_sync
psx_gpu_sync:
    la $8, 0xA0
    jr $8
    li $9, 0x4E

.section .text.bios.psx_load_and_execute
.globl psx_load_and_execute
psx_load_and_execute:
    la $8, 0xA0
    jr $8
    li $9, 0x51

.section .text.bios.psx_cd_init
.globl psx_cd_init
psx_cd_init:
    la $8, 0xA0
    jr $8
    li $9, 0x54

.section .text.bios.psx_cd_remove
.globl psx_cd_remove
psx_cd_remove:
    la $8, 0xA0
    jr $8
    li $9, 0x56

.section .text.bios.psx_cd_async_get_status
.globl psx_cd_async_get_status
psx_cd_async_get_status:
    la $8, 0xA0
    jr $8
    li $9, 0x7C

.section .text.bios.psx_add_cdrom_device
.globl psx_add_cdrom_device
psx_add_cdrom_device:
    la $8, 0xA0
    jr $8
    li $9, 0x96

.section .text.bios.psx_set_memsize
.globl psx_set_memsize
psx_set_memsize:
    la $8, 0xA0
    jr $8
    li $9, 0x9F

.section .text.bios.psx_warm_boot
.globl psx_warm_boot
psx_warm_boot:
    la $8, 0xA0
    jr $8
    li $9, 0xA0

.section .text.bios.psx_cd_get_lbn
.globl psx_cd_get_lbn
psx_cd_get_lbn:
    la $8, 0xA0
    jr $8
    li $9, 0xA4

.section .text.bios.psx_cd_get_status
.globl psx_cd_get_status
psx_cd_get_status:
    la $8, 0xA0
    jr $8
    li $9, 0xA6

.section .text.bios.psx_get_system_info
.globl psx_get_system_info
psx_get_system_info:
    la $8, 0xA0
    jr $8
    li $9, 0xB4

.section .text.bios.psx_get_timer
.globl psx_get_timer
psx_get_timer:
    la $8, 0xB0
    jr $8
    li $9, 0x03

.section .text.bios.psx_enable_timer_irq
.globl psx_enable_timer_irq
psx_enable_timer_irq:
    la $8, 0xB0
    jr $8
    li $9, 0x04

.section .text.bios.psx_disable_timer_irq
.globl psx_disable_timer_irq
psx_disable_timer_irq:
    la $8, 0xB0
    jr $8
    li $9, 0x05

.section .text.bios.psx_restart_timer
.globl psx_restart_timer
psx_restart_timer:
    la $8, 0xB0
    jr $8
    li $9, 0x06

.section .text.bios.psx_deliver_event
.globl psx_deliver_event
psx_deliver_event:
    la $8, 0xB0
    jr $8
    li $9, 0x07

.section .text.bios.psx_open_event
.globl psx_open_event
psx_open_event:
    la $8, 0xB0
    jr $8
    li $9, 0x08

.section .text.bios.psx_close_event
.globl psx_close_event
psx_close_event:
    la $8, 0xB0
    jr $8
    li $9, 0x09

.section .text.bios.psx_wait_event
.globl psx_wait_event
psx_wait_event:
    la $8, 0xB0
    jr $8
    li $9, 0x0A

.section .text.bios.psx_test_event
.globl psx_test_event
psx_test_event:
    la $8, 0xB0
    jr $8
    li $9, 0x0B

.section .text.bios.psx_enable_event
.globl psx_enable_event
psx_enable_event:
    la $8, 0xB0
    jr $8
    li $9, 0x0C

.section .text.bios.psx_disable_event
.globl psx_disable_event
psx_disable_event:
    la $8, 0xB0
    jr $8
    li $9, 0x0D

.section .text.bios.psx_open_thread
.globl psx_open_thread
psx_open_thread:
    la $8, 0xB0
    jr $8
    li $9, 0x0E

.section .text.bios.psx_close_thread
.globl psx_close_thread
psx_close_thread:
    la $8, 0xB0
    jr $8
    li $9, 0x0F

.section .text.bios.psx_change_thread
.globl psx_change_thread
psx_change_thread:
    la $8, 0xB0
    jr $8
    li $9, 0x10

.section .text.bios.psx_init_pad
.globl psx_init_pad
psx_init_pad:
    la $8, 0xB0
    jr $8
    li $9, 0x12

.section .text.bios.psx_start_pad
.globl psx_start_pad
psx_start_pad:
    la $8, 0xB0
    jr $8
    li $9, 0x13

.section .text.bios.psx_stop_pad
.globl psx_stop_pad
psx_stop_pad:
    la $8, 0xB0
    jr $8
    li $9, 0x14

.section .text.bios.psx_set_default_exit_from_exception
.globl psx_set_default_exit_from_exception
psx_set_default_exit_from_exception:
    la $8, 0xB0
    jr $8
    li $9, 0x18

.section .text.bios.psx_undeliver_event
.globl psx_undeliver_event
psx_undeliver_event:
    la $8, 0xB0
    jr $8
    li $9, 0x20

.section .text.bios.psx_first_file
.globl psx_first_file
psx_first_file:
    la $8, 0xB0
    jr $8
    li $9, 0x42

.section .text.bios.psx_next_file
.globl psx_next_file
psx_next_file:
    la $8, 0xB0
    jr $8
    li $9, 0x43

.section .text.bios.psx_file_rename
.globl psx_file_rename
psx_file_rename:
    la $8, 0xB0
    jr $8
    li $9, 0x44

.section .text.bios.psx_file_delete
.globl psx_file_delete
psx_file_delete:
    la $8, 0xB0
    jr $8
    li $9, 0x45

.section .text.bios.psx_file_undelete
.globl psx_file_undelete
psx_file_undelete:
    la $8, 0xB0
    jr $8
    li $9, 0x46

.section .text.bios.psx_print_installed_devices
.globl psx_print_installed_devices
psx_print_installed_devices:
    la $8, 0xB0
    jr $8
    li $9, 0x49

.section .text.bios.psx_init_card
.globl psx_init_card
psx_init_card:
    la $8, 0xB0
    jr $8
    li $9, 0x4A

.section .text.bios.psx_start_card
.globl psx_start_card
psx_start_card:
    la $8, 0xB0
    jr $8
    li $9, 0x4B

.section .text.bios.psx_stop_card
.globl psx_stop_card
psx_stop_card:
    la $8, 0xB0
    jr $8
    li $9, 0x4C

.section .text.bios.psx_get_last_error
.globl psx_get_last_error
psx_get_last_error:
    la $8, 0xB0
    jr $8
    li $9, 0x54

.section .text.bios.psx_get_last_file_error
.globl psx_get_last_file_error
psx_get_last_file_error:
    la $8, 0xB0
    jr $8
    li $9, 0x55

.section .text.bios.psx_change_clear_pad
.globl psx_change_clear_pad
psx_change_clear_pad:
    la $8, 0xB0
    jr $8
    li $9, 0x5B

.section .text.bios.psx_change_clear_rcnt
.globl psx_change_clear_rcnt
psx_change_clear_rcnt:
    la $8, 0xC0
    jr $8
    li $9, 0x0A

.section .text.bios.psx_flush_std_in_out_put
.globl psx_flush_std_in_out_put
psx_flush_std_in_out_put:
    la $8, 0xC0
    jr $8
    li $9, 0x13

.section .text.bios.psx_enter_critical_section
.globl psx_enter_critical_section
psx_enter_critical_section:
    li $4, 0x01
    syscall 0x0
    jr $ra
    nop

.section .text.bios.psx_exit_critical_section
.globl psx_exit_critical_section
psx_exit_critical_section:
    li $4, 0x02
    syscall 0x0
    jr $ra
    nop

.section .text.bios.psx_change_thread_sub_fn
.globl psx_change_thread_sub_fn
psx_change_thread_sub_fn:
    li $4, 0x03
    syscall 0x0
    jr $ra
    nop