annotate src/sexypsf/PsxBios.c @ 2507:251336bee085

Cosmetic cleanups, synchronized from XMMS-SID.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 02 Apr 2008 19:53:39 +0300
parents 9d2d7061caed
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1 /* Pcsx - Pc Psx Emulator
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
2 * Copyright (C) 1999-2002 Pcsx Team
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
3 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
7 * (at your option) any later version.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
8 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
9 * This program is distributed in the hope that it will be useful,
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
12 * GNU General Public License for more details.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
13 *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
15 * along with this program; if not, write to the Free Software
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
17 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
18
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
19 #include <stdlib.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
20 #include <stdio.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
21 #include <string.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
22 #include <stdarg.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
23 #include <ctype.h>
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
24
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
25 #include "PsxCommon.h"
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
26 //We try to emulate bios :) HELP US :P
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
27
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
28 #ifdef NONONO
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
29 char *biosA0n[256] = {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
30 // 0x00
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
31 "open", "lseek", "read", "write",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
32 "close", "ioctl", "exit", "sys_a0_07",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
33 "getc", "putc", "todigit", "atof",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
34 "strtoul", "strtol", "abs", "labs",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
35 // 0x10
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
36 "atoi", "atol", "atob", "setjmp",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
37 "longjmp", "strcat", "strncat", "strcmp",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
38 "strncmp", "strcpy", "strncpy", "strlen",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
39 "index", "rindex", "strchr", "strrchr",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
40 // 0x20
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
41 "strpbrk", "strspn", "strcspn", "strtok",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
42 "strstr", "toupper", "tolower", "bcopy",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
43 "bzero", "bcmp", "memcpy", "memset",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
44 "memmove", "memcmp", "memchr", "rand",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
45 // 0x30
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
46 "srand", "qsort", "strtod", "malloc",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
47 "free", "lsearch", "bsearch", "calloc",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
48 "realloc", "InitHeap", "_exit", "getchar",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
49 "putchar", "gets", "puts", "printf",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
50 // 0x40
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
51 "sys_a0_40", "LoadTest", "Load", "Exec",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
52 "FlushCache", "InstallInterruptHandler", "GPU_dw", "mem2vram",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
53 "SendGPUStatus", "GPU_cw", "GPU_cwb", "SendPackets",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
54 "sys_a0_4c", "GetGPUStatus", "GPU_sync", "sys_a0_4f",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
55 // 0x50
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
56 "sys_a0_50", "LoadExec", "GetSysSp", "sys_a0_53",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
57 "_96_init()", "_bu_init()", "_96_remove()", "sys_a0_57",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
58 "sys_a0_58", "sys_a0_59", "sys_a0_5a", "dev_tty_init",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
59 "dev_tty_open", "sys_a0_5d", "dev_tty_ioctl","dev_cd_open",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
60 // 0x60
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
61 "dev_cd_read", "dev_cd_close", "dev_cd_firstfile", "dev_cd_nextfile",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
62 "dev_cd_chdir", "dev_card_open", "dev_card_read", "dev_card_write",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
63 "dev_card_close", "dev_card_firstfile", "dev_card_nextfile","dev_card_erase",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
64 "dev_card_undelete","dev_card_format", "dev_card_rename", "dev_card_6f",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
65 // 0x70
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
66 "_bu_init", "_96_init", "_96_remove", "sys_a0_73",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
67 "sys_a0_74", "sys_a0_75", "sys_a0_76", "sys_a0_77",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
68 "_96_CdSeekL", "sys_a0_79", "sys_a0_7a", "sys_a0_7b",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
69 "_96_CdGetStatus", "sys_a0_7d", "_96_CdRead", "sys_a0_7f",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
70 // 0x80
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
71 "sys_a0_80", "sys_a0_81", "sys_a0_82", "sys_a0_83",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
72 "sys_a0_84", "_96_CdStop", "sys_a0_86", "sys_a0_87",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
73 "sys_a0_88", "sys_a0_89", "sys_a0_8a", "sys_a0_8b",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
74 "sys_a0_8c", "sys_a0_8d", "sys_a0_8e", "sys_a0_8f",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
75 // 0x90
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
76 "sys_a0_90", "sys_a0_91", "sys_a0_92", "sys_a0_93",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
77 "sys_a0_94", "sys_a0_95", "AddCDROMDevice", "AddMemCardDevide",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
78 "DisableKernelIORedirection", "EnableKernelIORedirection", "sys_a0_9a", "sys_a0_9b",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
79 "SetConf", "GetConf", "sys_a0_9e", "SetMem",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
80 // 0xa0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
81 "_boot", "SystemError", "EnqueueCdIntr", "DequeueCdIntr",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
82 "sys_a0_a4", "ReadSector", "get_cd_status", "bufs_cb_0",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
83 "bufs_cb_1", "bufs_cb_2", "bufs_cb_3", "_card_info",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
84 "_card_load", "_card_auto", "bufs_cd_4", "sys_a0_af",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
85 // 0xb0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
86 "sys_a0_b0", "sys_a0_b1", "do_a_long_jmp", "sys_a0_b3",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
87 "?? sub_function",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
88 };
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
89
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
90 char *biosB0n[256] = {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
91 // 0x00
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
92 "SysMalloc", "sys_b0_01", "sys_b0_02", "sys_b0_03",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
93 "sys_b0_04", "sys_b0_05", "sys_b0_06", "DeliverEvent",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
94 "OpenEvent", "CloseEvent", "WaitEvent", "TestEvent",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
95 "EnableEvent", "DisableEvent", "OpenTh", "CloseTh",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
96 // 0x10
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
97 "ChangeTh", "sys_b0_11", "InitPAD", "StartPAD",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
98 "StopPAD", "PAD_init", "PAD_dr", "ReturnFromExecption",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
99 "ResetEntryInt", "HookEntryInt", "sys_b0_1a", "sys_b0_1b",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
100 "sys_b0_1c", "sys_b0_1d", "sys_b0_1e", "sys_b0_1f",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
101 // 0x20
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
102 "UnDeliverEvent", "sys_b0_21", "sys_b0_22", "sys_b0_23",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
103 "sys_b0_24", "sys_b0_25", "sys_b0_26", "sys_b0_27",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
104 "sys_b0_28", "sys_b0_29", "sys_b0_2a", "sys_b0_2b",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
105 "sys_b0_2c", "sys_b0_2d", "sys_b0_2e", "sys_b0_2f",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
106 // 0x30
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
107 "sys_b0_30", "sys_b0_31", "open", "lseek",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
108 "read", "write", "close", "ioctl",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
109 "exit", "sys_b0_39", "getc", "putc",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
110 "getchar", "putchar", "gets", "puts",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
111 // 0x40
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
112 "cd", "format", "firstfile", "nextfile",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
113 "rename", "delete", "undelete", "AddDevice",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
114 "RemoteDevice", "PrintInstalledDevices", "InitCARD", "StartCARD",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
115 "StopCARD", "sys_b0_4d", "_card_write", "_card_read",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
116 // 0x50
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
117 "_new_card", "Krom2RawAdd", "sys_b0_52", "sys_b0_53",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
118 "_get_errno", "_get_error", "GetC0Table", "GetB0Table",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
119 "_card_chan", "sys_b0_59", "sys_b0_5a", "ChangeClearPAD",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
120 "_card_status", "_card_wait",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
121 };
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
122
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
123 char *biosC0n[256] = {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
124 // 0x00
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
125 "InitRCnt", "InitException", "SysEnqIntRP", "SysDeqIntRP",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
126 "get_free_EvCB_slot", "get_free_TCB_slot", "ExceptionHandler", "InstallExeptionHandler",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
127 "SysInitMemory", "SysInitKMem", "ChangeClearRCnt", "SystemError",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
128 "InitDefInt", "sys_c0_0d", "sys_c0_0e", "sys_c0_0f",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
129 // 0x10
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
130 "sys_c0_10", "sys_c0_11", "InstallDevices", "FlushStfInOutPut",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
131 "sys_c0_14", "_cdevinput", "_cdevscan", "_circgetc",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
132 "_circputc", "ioabort", "sys_c0_1a", "KernelRedirect",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
133 "PatchAOTable",
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
134 };
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
135 #endif
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
136
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
137 //#define r0 (psxRegs.GPR.n.r0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
138 #define at (psxRegs.GPR.n.at)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
139 #define v0 (psxRegs.GPR.n.v0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
140 #define v1 (psxRegs.GPR.n.v1)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
141 #define a0 (psxRegs.GPR.n.a0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
142 #define a1 (psxRegs.GPR.n.a1)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
143 #define a2 (psxRegs.GPR.n.a2)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
144 #define a3 (psxRegs.GPR.n.a3)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
145 #define t0 (psxRegs.GPR.n.t0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
146 #define t1 (psxRegs.GPR.n.t1)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
147 #define t2 (psxRegs.GPR.n.t2)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
148 #define t3 (psxRegs.GPR.n.t3)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
149 #define t4 (psxRegs.GPR.n.t4)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
150 #define t5 (psxRegs.GPR.n.t5)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
151 #define t6 (psxRegs.GPR.n.t6)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
152 #define t7 (psxRegs.GPR.n.t7)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
153 #define s0 (psxRegs.GPR.n.s0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
154 #define s1 (psxRegs.GPR.n.s1)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
155 #define s2 (psxRegs.GPR.n.s2)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
156 #define s3 (psxRegs.GPR.n.s3)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
157 #define s4 (psxRegs.GPR.n.s4)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
158 #define s5 (psxRegs.GPR.n.s5)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
159 #define s6 (psxRegs.GPR.n.s6)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
160 #define s7 (psxRegs.GPR.n.s7)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
161 #define t8 (psxRegs.GPR.n.t6)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
162 #define t9 (psxRegs.GPR.n.t7)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
163 #define k0 (psxRegs.GPR.n.k0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
164 #define k1 (psxRegs.GPR.n.k1)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
165 #define gp (psxRegs.GPR.n.gp)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
166 #define sp (psxRegs.GPR.n.sp)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
167 #define fp (psxRegs.GPR.n.s8)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
168 #define ra (psxRegs.GPR.n.ra)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
169 #define pc0 (psxRegs.pc)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
170
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
171 #define Ra0 ((char*)PSXM(a0))
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
172 #define Ra1 ((char*)PSXM(a1))
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
173 #define Ra2 ((char*)PSXM(a2))
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
174 #define Ra3 ((char*)PSXM(a3))
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
175 #define Rv0 ((char*)PSXM(v0))
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
176 #define Rsp ((char*)PSXM(sp))
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
177
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
178
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
179 typedef struct _malloc_chunk {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
180 u32 stat;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
181 u32 size;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
182 u32 fd;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
183 u32 bk;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
184 } PACKSTRUCT malloc_chunk;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
185
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
186 #define INUSE 0x1
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
187
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
188 typedef struct {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
189 u32 desc;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
190 s32 status;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
191 s32 mode;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
192 u32 fhandler;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
193 } PACKSTRUCT EvCB[32];
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
194
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
195 #define EvStUNUSED 0x0000
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
196 #define EvStWAIT 0x1000
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
197 #define EvStACTIVE 0x2000
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
198 #define EvStALREADY 0x4000
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
199
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
200 #define EvMdINTR 0x1000
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
201 #define EvMdNOINTR 0x2000
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
202
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
203 typedef struct {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
204 s32 status;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
205 s32 mode;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
206 u32 reg[32];
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
207 u32 func;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
208 } PACKSTRUCT TCB;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
209
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
210 static u32 *jmp_int;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
211
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
212 static u32 regs[35];
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
213 static EvCB *Event;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
214
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
215 //static EvCB *HwEV; // 0xf0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
216 //static EvCB *EvEV; // 0xf1
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
217 static EvCB *RcEV; // 0xf2
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
218 //static EvCB *UeEV; // 0xf3
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
219 //static EvCB *SwEV; // 0xf4
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
220 //static EvCB *ThEV; // 0xff
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
221
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
222 static u32 heap_addr;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
223 static u32 SysIntRP[8];
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
224 static TCB Thread[8];
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
225 static int CurThread;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
226
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
227 static INLINE void softCall(u32 pc) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
228 pc0 = pc;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
229 ra = 0x80001000;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
230 while (pc0 != 0x80001000) psxCpu->ExecuteBlock();
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
231 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
232
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
233 static INLINE void softCall2(u32 pc) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
234 u32 sra = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
235 pc0 = pc;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
236 ra = 0x80001000;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
237 while (pc0 != 0x80001000) psxCpu->ExecuteBlock();
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
238 ra = sra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
239 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
240
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
241 static INLINE void DeliverEvent(u32 ev, u32 spec) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
242 if (Event[ev][spec].status != BFLIP32S(EvStACTIVE)) return;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
243
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
244 // Event[ev][spec].status = BFLIP32S(EvStALREADY);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
245 if (Event[ev][spec].mode == BFLIP32S(EvMdINTR)) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
246 softCall2(BFLIP32S(Event[ev][spec].fhandler));
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
247 } else Event[ev][spec].status = BFLIP32S(EvStALREADY);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
248 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
249
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
250 /* *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
251 // *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
252 // *
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
253 // System calls A0 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
254
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
255 /* Abs and labs do the same thing? */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
256
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
257 static void bios_abs() { // 0x0e
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
258 if((s32)a0 < 0) v0=0-(s32)a0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
259 else v0=a0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
260 //v0 = abs(a0);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
261 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
262 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
263
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
264 static void bios_labs() { // 0x0f
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
265 if((s32)a0 < 0) v0=0-(s32)a0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
266 else v0=a0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
267 //v0 = labs(a0);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
268 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
269 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
270
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
271 static void bios_atoi() { // 0x10
2232
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
272 char *p0 = Ra0;
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
273 v0 = atoi(p0);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
274 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
275 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
276
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
277 static void bios_atol() { // 0x11
2232
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
278 char *p0 = Ra0;
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
279 v0 = atoi(p0);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
280 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
281 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
282
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
283 static void bios_setjmp() { // 13
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
284 u32 *jmp_buf= (u32*)Ra0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
285 int i;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
286
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
287 jmp_buf[0] = BFLIP32(ra);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
288 jmp_buf[1] = BFLIP32(sp);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
289 jmp_buf[2] = BFLIP32(fp);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
290 for (i=0; i<8; i++) // s0-s7
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
291 jmp_buf[3+i] = BFLIP32(psxRegs.GPR.r[16+i]);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
292 jmp_buf[11] = BFLIP32(gp);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
293
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
294 v0 = 0; pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
295 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
296
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
297 static void bios_longjmp() { //14
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
298 u32 *jmp_buf= (u32*)Ra0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
299 int i;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
300
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
301 ra = BFLIP32(jmp_buf[0]); /* ra */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
302 sp = BFLIP32(jmp_buf[1]); /* sp */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
303 fp = BFLIP32(jmp_buf[2]); /* fp */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
304 for (i=0; i<8; i++) // s0-s7
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
305 psxRegs.GPR.r[16+i] = BFLIP32(jmp_buf[3+i]);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
306 gp = BFLIP32(jmp_buf[11]); /* gp */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
307
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
308 v0 = a1; pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
309 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
310
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
311 static void bios_strcat() { // 0x15
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
312 u32 dest,src;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
313
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
314 dest=a0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
315 src=a1;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
316
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
317 while(PSXMu8(dest) != 0) dest++; /* Move to end of first string. */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
318 while(PSXMu8(src) != 0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
319 {
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
320 if(PSXM(dest) && PSXM(src))
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
321 PSXMu8(dest)=PSXMu8(src);
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
322 src++;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
323 dest++;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
324 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
325 PSXMu8(dest) = 0; /* Append null character. */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
326 //strcat(Ra0, Ra1);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
327
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
328 v0 = a0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
329 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
330 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
331
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
332 /*0x16*/
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
333 static void bios_strncat()
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
334 {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
335 u32 dest,src,count;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
336
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
337 dest=a0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
338 src=a1;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
339 count=a2;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
340
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
341 while(PSXMu8(dest) != 0) dest++; /* Move to end of first string. */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
342 while(PSXMu8(src) != 0 && count)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
343 {
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
344 if(PSXM(dest) && PSXM(src))
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
345 PSXMu8(dest)=PSXMu8(src);
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
346 src++;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
347 dest++;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
348 count--;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
349 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
350 PSXMu8(dest) = 0; /* Append null character. */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
351
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
352 //strncat(Ra0, Ra1, a2);
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
353 v0 = a0;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
354 pc0 = ra;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
355 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
356
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
357 static void bios_strcmp() { // 0x17
2232
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
358 char *p0 = Ra0, *p1 = Ra1;
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
359 v0 = strcmp(p0, p1);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
360 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
361 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
362
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
363 static void bios_strncmp() { // 0x18
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
364 u32 max=a2;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
365 u32 string1=a0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
366 u32 string2=a1;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
367 s8 tmpv=0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
368
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
369 while(max>0)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
370 {
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
371 u8 tmp1=PSXMuR8(string1);
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
372 u8 tmp2=PSXMuR8(string2);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
373
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
374 if(!tmp1 || !tmp2) break;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
375
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
376 tmpv=tmp1-tmp2;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
377 if(tmpv) break;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
378 if(!tmp1 || !tmp2) break;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
379 if(!PSXM(string1) || !PSXM(string2)) break;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
380 max--;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
381 string1++;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
382 string2++;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
383 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
384 if(tmpv>0) v0=1;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
385 else if(tmpv<0) v0=-1;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
386 else v0=0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
387 //printf("%s:%s, %d, %d\n",Ra0,Ra1,a2,v0);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
388 //v0 = strncmp(Ra0, Ra1, a2);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
389 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
390 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
391
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
392 /*0x19*/
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
393 static void bios_strcpy()
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
394 {
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
395 u32 src=a1,dest=a0;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
396 u8 val;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
397
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
398 do
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
399 {
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
400 val=PSXMu8(src);
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
401 PSXMu8(dest)=val;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
402 src++;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
403 dest++;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
404 } while(val);
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
405 //strcpy(Ra0, Ra1);
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
406 v0 = a0;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
407 pc0 = ra;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
408 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
409 /*0x1a*/
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
410 static void bios_strncpy()
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
411 {
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
412 u32 src=a1,dest=a0,max=a2;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
413 u8 val;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
414
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
415 do
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
416 {
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
417 val=PSXMu8(src);
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
418 PSXMu8(dest)=val;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
419 src++;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
420 dest++;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
421 max--;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
422 } while(val && max);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
423
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
424 //strncpy(Ra0, Ra1, a2);
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
425 v0 = a0;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
426 pc0 = ra;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
427 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
428
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
429 /*0x1b*/
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
430 static void bios_strlen()
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
431 {
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
432 u32 src=a0;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
433
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
434 while(PSXMu8(src)) src++;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
435
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
436 v0 = src-a0;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
437 pc0 = ra;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
438 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
439
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
440 static void bios_index() { // 0x1c
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
441 char *pcA0 = (char *)Ra0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
442 char *pcRet = strchr(pcA0, a1);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
443 if(pcRet)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
444 v0 = a0 + pcRet - pcA0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
445 else
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
446 v0 = 0;
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
447 pc0 = ra;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
448 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
449
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
450 static void bios_rindex() { // 0x1d
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
451 char *pcA0 = (char *)Ra0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
452 char *pcRet = strrchr(pcA0, a1);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
453 if(pcRet)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
454 v0 = a0 + pcRet - pcA0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
455 else
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
456 v0 = 0;
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
457 pc0 = ra;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
458 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
459
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
460 static void bios_strchr() { // 0x1e
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
461 char *pcA0 = (char *)Ra0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
462 char *pcRet = strchr(pcA0, a1);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
463 if(pcRet)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
464 v0 = a0 + pcRet - pcA0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
465 else
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
466 v0 = 0;
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
467 pc0 = ra;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
468 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
469
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
470 static void bios_strrchr() { // 0x1f
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
471 char *pcA0 = (char *)Ra0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
472 char *pcRet = strrchr(pcA0, a1);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
473 if(pcRet)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
474 v0 = a0 + pcRet - pcA0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
475 else
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
476 v0 = 0;
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
477 pc0 = ra;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
478 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
479
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
480 static void bios_strpbrk() { // 0x20
2232
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
481 char *pcA0 = Ra0, *pcA1 = Ra1;
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
482 char *pcRet = strpbrk(pcA0, pcA1);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
483 if(pcRet)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
484 v0 = a0 + pcRet - pcA0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
485 else
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
486 v0 = 0;
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
487 pc0 = ra;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
488 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
489
2232
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
490 static void bios_strspn() { /*21*/
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
491 char *p0 = Ra0, *p1 = Ra1;
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
492 v0 = strspn (p0, p1);
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
493 pc0 = ra;
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
494 }
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
495 static void bios_strcspn() { /*22*/
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
496 char *p0 = Ra0, *p1 = Ra1;
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
497 v0 = strcspn(p0, p1);
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
498 pc0 = ra;
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
499 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
500
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
501 #ifdef MOO
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
502 static void bios_strtok() { // 0x23
2232
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
503 char *pcA0 = Ra0, *pcA1 = Ra1;
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
504 char *pcRet = strtok(pcA0, pcA1);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
505 if(pcRet)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
506 v0 = a0 + pcRet - pcA0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
507 else
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
508 v0 = 0;
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
509 pc0 = ra;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
510 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
511 #endif
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
512
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
513 static void bios_strstr() { // 0x24
2232
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
514 char *pcA0 = Ra0, *pcA1 = Ra1;
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
515 char *pcRet = strstr(pcA0, pcA1);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
516 if(pcRet)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
517 v0 = a0 + pcRet - pcA0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
518 else
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
519 v0 = 0;
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
520 pc0 = ra;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
521 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
522
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
523 /*0x25*/
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
524 static void bios_toupper() {v0 = toupper(a0); pc0 = ra;}
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
525
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
526 /*0x26*/
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
527 static void bios_tolower() {v0 = tolower(a0); pc0 = ra;}
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
528
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
529 /*0x27*/
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
530 static void bios_bcopy()
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
531 {
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
532 u32 dest=a1, src=a0, len=a2;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
533
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
534 while(len--)
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
535 {
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
536 PSXMu8(dest)=PSXMu8(src);
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
537 dest++;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
538 src++;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
539 }
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
540 //memcpy(Ra1,Ra0,a2);
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
541 pc0=ra;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
542 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
543
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
544 /*0x28*/
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
545 static void bios_bzero()
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
546 {
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
547 u32 dest=a0, len=a1;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
548
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
549 while(len--)
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
550 {
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
551 PSXMu8(dest)=0;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
552 dest++;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
553 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
554
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
555 //memset(Ra0,0,a1);
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
556 pc0=ra;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
557 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
558
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
559 /*0x29*/
2232
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
560 static void bios_bcmp() {
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
561 char *p0 = Ra0, *p1 = Ra1;
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
562 v0 = memcmp(p0, p1, a2);
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
563 pc0=ra;
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
564 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
565
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
566 /*0x2a*/
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
567 static void bios_memcpy()
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
568 {
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
569 u32 dest=a0, src=a1, len=a2;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
570
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
571 while(len--)
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
572 {
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
573 PSXMu8(dest)=PSXMu8(src);
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
574 dest++;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
575 src++;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
576 }
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
577 //memcpy(Ra0, Ra1, a2);
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
578 v0 = a0;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
579 pc0 = ra;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
580 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
581
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
582 static void bios_memset() /*0x2b*/
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
583 {
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
584 u32 len=a2;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
585 u32 dest=a0;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
586
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
587 while(len--)
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
588 {
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
589 if(PSXM(dest)) PSXMu8(dest)=a1;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
590 dest++;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
591 }
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
592 //memset(Ra0, a1, a2);
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
593 v0 = a0;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
594 pc0 = ra;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
595 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
596
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
597 #ifdef MOO
2232
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
598 /*0x2c*/void bios_memmove() {
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
599 char *p0 = Ra0, *p1 = Ra1;
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
600 memmove(p0, p1, a2);
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
601 v0 = a0;
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
602 pc0 = ra;
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
603 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
604 #endif
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
605
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
606 /*0x2d*/
2232
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
607 static void bios_memcmp() {
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
608 char *p0 = Ra0, *p1 = Ra1;
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
609 v0 = memcmp(p0, p1, a2);
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
610 pc0 = ra;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
611 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
612
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
613 static void bios_memchr() { // 2e
2232
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
614 char *p0 = Ra0;
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
615 void *ret = memchr(p0, a1, a2);
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
616 if (ret != NULL) v0 = (u32)((char*)ret - p0) + a0;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
617 else v0 = 0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
618 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
619 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
620
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
621 static void bios_rand() { // 2f
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
622 v0 = 1+(int) (32767.0*rand()/(RAND_MAX+1.0));
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
623 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
624 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
625
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
626 static void bios_srand() { // 30
2232
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
627 srand(a0);
9d2d7061caed eliminate warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 2231
diff changeset
628 pc0 = ra;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
629 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
630
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
631 static void bios_malloc() { // 33
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
632 u32 chunk;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
633 u32 fd;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
634
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
635 /* a0: Number of bytes to allocate. */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
636
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
637 chunk = heap_addr;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
638
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
639 /* Search for first chunk that's large enough and not currently
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
640 being used.
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
641 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
642 while( (a0 > BFLIP32(((malloc_chunk*)PSXM(chunk)) ->size)) ||
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
643 (BFLIP32( ((malloc_chunk*)PSXM(chunk))->stat ) == INUSE)
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
644 )
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
645 chunk=((malloc_chunk*)PSXM(chunk)) -> fd;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
646 //printf("%08x\n",chunk);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
647
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
648 /* split free chunk */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
649 fd = chunk + sizeof(malloc_chunk) + a0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
650 ((malloc_chunk*)PSXM(fd))->stat = ((malloc_chunk*)PSXM(chunk))->stat;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
651 ((malloc_chunk*)PSXM(fd))->size = BFLIP32(BFLIP32(((malloc_chunk*)PSXM(chunk))->size) - a0);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
652 ((malloc_chunk*)PSXM(fd))->fd = ((malloc_chunk*)PSXM(chunk))->fd;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
653 ((malloc_chunk*)PSXM(fd))->bk = chunk;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
654
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
655 /* set new chunk */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
656 ((malloc_chunk*)PSXM(chunk))->stat = BFLIP32(INUSE);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
657 ((malloc_chunk*)PSXM(chunk))->size = BFLIP32(a0);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
658 ((malloc_chunk*)PSXM(chunk))->fd = fd;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
659
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
660 v0 = chunk + sizeof(malloc_chunk);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
661 v0|= 0x80000000;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
662 // printf ("malloc %lx,%lx\n", v0, a0);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
663 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
664 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
665
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
666 static void bios_InitHeap() { // 39
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
667 malloc_chunk *chunk;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
668
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
669 heap_addr = a0; // Ra0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
670
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
671 chunk = (malloc_chunk *)PSXM(heap_addr);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
672 chunk->stat = 0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
673 if (((a0 & 0x1fffff) + a1)>= 0x200000)
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
674 chunk->size = BFLIP32(0x1ffffc - (a0 & 0x1fffff));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
675 else chunk->size = BFLIP32(a1);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
676 chunk->fd = 0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
677 chunk->bk = 0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
678
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
679 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
680 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
681
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
682 static void bios_FlushCache() { // 44
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
683
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
684 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
685 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
686
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
687 static void bios__bu_init() { // 70
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
688
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
689 DeliverEvent(0x11, 0x2); // 0xf0000011, 0x0004
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
690 DeliverEvent(0x81, 0x2); // 0xf4000001, 0x0004
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
691
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
692 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
693 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
694
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
695 static void bios__96_init() { // 71
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
696
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
697 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
698 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
699
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
700 static void bios__96_remove() { // 72
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
701
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
702 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
703 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
704
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
705 /* System calls B0 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
706
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
707 static void bios_SetRCnt() { // 02
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
708
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
709 a0&= 0x3;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
710 if (a0 != 3) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
711 u32 mode=0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
712
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
713 psxRcntWtarget(a0, a1);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
714 if (a2&0x1000) mode|= 0x050; // Interrupt Mode
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
715 if (a2&0x0100) mode|= 0x008; // Count to 0xffff
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
716 if (a2&0x0010) mode|= 0x001; // Timer stop mode
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
717 if (a0 == 2) { if (a2&0x0001) mode|= 0x200; } // System Clock mode
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
718 else { if (a2&0x0001) mode|= 0x100; } // System Clock mode
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
719
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
720 psxRcntWmode(a0, mode);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
721 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
722 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
723 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
724
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
725 static void bios_GetRCnt() { // 03
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
726
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
727 a0&= 0x3;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
728 if (a0 != 3) v0 = psxRcntRcount(a0);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
729 else v0 = 0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
730 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
731 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
732
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
733 static void bios_StartRCnt() { // 04
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
734
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
735 a0&= 0x3;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
736 if (a0 != 3) psxHu32(0x1074)|= BFLIP32(1<<(a0+4));
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
737 else psxHu32(0x1074)|= BFLIP32(0x1);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
738 v0 = 1; pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
739 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
740
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
741 static void bios_StopRCnt() { // 05
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
742
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
743 a0&= 0x3;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
744 if (a0 != 3) psxHu32(0x1074)&= BFLIP32(~(1<<(a0+4)));
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
745 else psxHu32(0x1074)&= BFLIP32(~0x1);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
746 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
747 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
748
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
749 static void bios_ResetRCnt() { // 06
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
750
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
751 a0&= 0x3;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
752 if (a0 != 3) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
753 psxRcntWmode(a0, 0);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
754 psxRcntWtarget(a0, 0);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
755 psxRcntWcount(a0, 0);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
756 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
757 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
758 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
759
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
760
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
761 /* gets ev for use with Event */
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
762 #define GetEv() \
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
763 ev = (a0 >> 24) & 0xf; \
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
764 if (ev == 0xf) ev = 0x5; \
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
765 ev*= 32; \
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
766 ev+= a0&0x1f;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
767
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
768 /* gets spec for use with Event */
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
769 #define GetSpec() \
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
770 spec = 0; \
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
771 switch (a1) { \
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
772 case 0x0301: spec = 16; break; \
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
773 case 0x0302: spec = 17; break; \
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
774 default: \
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
775 for (i=0; i<16; i++) if (a1 & (1 << i)) { spec = i; break; } \
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
776 break; \
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
777 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
778
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
779 static void bios_DeliverEvent() { // 07
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
780 int ev, spec;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
781 int i;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
782
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
783 GetEv();
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
784 GetSpec();
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
785
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
786 DeliverEvent(ev, spec);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
787
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
788 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
789 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
790
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
791 static void bios_OpenEvent() { // 08
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
792 int ev, spec;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
793 int i;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
794
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
795 GetEv();
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
796 GetSpec();
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
797
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
798 Event[ev][spec].status = BFLIP32S(EvStWAIT);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
799 Event[ev][spec].mode = BFLIP32(a2);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
800 Event[ev][spec].fhandler = BFLIP32(a3);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
801
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
802 v0 = ev | (spec << 8);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
803 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
804 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
805
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
806 static void bios_CloseEvent() { // 09
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
807 int ev, spec;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
808
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
809 ev = a0 & 0xff;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
810 spec = (a0 >> 8) & 0xff;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
811
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
812 Event[ev][spec].status = BFLIP32S(EvStUNUSED);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
813
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
814 v0 = 1; pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
815 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
816
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
817 static void bios_WaitEvent() { // 0a
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
818 int ev, spec;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
819
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
820 ev = a0 & 0xff;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
821 spec = (a0 >> 8) & 0xff;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
822
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
823 Event[ev][spec].status = BFLIP32S(EvStACTIVE);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
824
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
825 v0 = 1; pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
826 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
827
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
828 static void bios_TestEvent() { // 0b
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
829 int ev, spec;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
830
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
831 ev = a0 & 0xff;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
832 spec = (a0 >> 8) & 0xff;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
833
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
834 if (Event[ev][spec].status == BFLIP32S(EvStALREADY)) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
835 Event[ev][spec].status = BFLIP32S(EvStACTIVE); v0 = 1;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
836 } else v0 = 0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
837
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
838 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
839 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
840
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
841 static void bios_EnableEvent() { // 0c
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
842 int ev, spec;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
843
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
844 ev = a0 & 0xff;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
845 spec = (a0 >> 8) & 0xff;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
846
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
847 Event[ev][spec].status = BFLIP32S(EvStACTIVE);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
848
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
849 v0 = 1; pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
850 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
851
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
852 static void bios_DisableEvent() { // 0d
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
853 int ev, spec;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
854
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
855 ev = a0 & 0xff;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
856 spec = (a0 >> 8) & 0xff;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
857
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
858 Event[ev][spec].status = BFLIP32S(EvStWAIT);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
859
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
860 v0 = 1; pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
861 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
862
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
863 /*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
864 * long OpenTh(long (*func)(), unsigned long sp, unsigned long gp);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
865 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
866
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
867 static void bios_OpenTh() { // 0e
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
868 int th;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
869
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
870 for (th=1; th<8; th++)
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
871 if (Thread[th].status == 0) break;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
872
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
873 Thread[th].status = BFLIP32(1);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
874 Thread[th].func = BFLIP32(a0);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
875 Thread[th].reg[29] = BFLIP32(a1);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
876 Thread[th].reg[28] = BFLIP32(a2);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
877
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
878 v0 = th; pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
879 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
880
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
881 /*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
882 * int CloseTh(long thread);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
883 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
884
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
885 static void bios_CloseTh() { // 0f
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
886 int th = a0 & 0xff;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
887
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
888 if (Thread[th].status == 0) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
889 v0 = 0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
890 } else {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
891 Thread[th].status = 0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
892 v0 = 1;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
893 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
894
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
895 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
896 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
897
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
898 /*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
899 * int ChangeTh(long thread);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
900 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
901
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
902 static void bios_ChangeTh() { // 10
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
903 int th = a0 & 0xff;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
904
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
905 if (Thread[th].status == 0 || CurThread == th) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
906 v0 = 0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
907
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
908 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
909 } else {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
910 v0 = 1;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
911
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
912 if (Thread[CurThread].status == BFLIP32S(2)) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
913 Thread[CurThread].status = BFLIP32S(1);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
914 Thread[CurThread].func = BFLIP32(ra);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
915 memcpy(Thread[CurThread].reg, psxRegs.GPR.r, 32*4);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
916 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
917
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
918 memcpy(psxRegs.GPR.r, Thread[th].reg, 32*4);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
919 pc0 = BFLIP32(Thread[th].func);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
920 Thread[th].status = BFLIP32(2);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
921 CurThread = th;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
922 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
923 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
924
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
925 static void bios_ReturnFromException() { // 17
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
926 memcpy(psxRegs.GPR.r, regs, 32*4);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
927 psxRegs.GPR.n.lo = regs[32];
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
928 psxRegs.GPR.n.hi = regs[33];
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
929
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
930 pc0 = psxRegs.CP0.n.EPC;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
931 if (psxRegs.CP0.n.Cause & 0x80000000) pc0+=4;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
932
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
933 psxRegs.CP0.n.Status = (psxRegs.CP0.n.Status & 0xfffffff0) |
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
934 ((psxRegs.CP0.n.Status & 0x3c) >> 2);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
935 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
936
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
937 static void bios_ResetEntryInt() { // 18
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
938
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
939 jmp_int = NULL;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
940 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
941 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
942
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
943 static void bios_HookEntryInt() { // 19
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
944
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
945 jmp_int = (u32*)Ra0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
946 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
947 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
948
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
949 static void bios_UnDeliverEvent() { // 0x20
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
950 int ev, spec;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
951 int i;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
952
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
953 GetEv();
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
954 GetSpec();
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
955
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
956 if (Event[ev][spec].status == BFLIP32S(EvStALREADY) &&
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
957 Event[ev][spec].mode == BFLIP32S(EvMdNOINTR))
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
958 Event[ev][spec].status = BFLIP32S(EvStACTIVE);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
959
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
960 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
961 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
962
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
963 static void bios_GetC0Table() { // 56
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
964
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
965 v0 = 0x674; pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
966 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
967
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
968 static void bios_GetB0Table() { // 57
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
969
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
970 v0 = 0x874; pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
971 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
972
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
973 /* System calls C0 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
974
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
975 /*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
976 * int SysEnqIntRP(int index , long *queue);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
977 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
978
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
979 static void bios_SysEnqIntRP() { // 02
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
980
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
981 SysIntRP[a0] = a1;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
982
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
983 v0 = 0; pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
984 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
985
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
986 /*
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
987 * int SysDeqIntRP(int index , long *queue);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
988 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
989
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
990 static void bios_SysDeqIntRP() { // 03
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
991
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
992 SysIntRP[a0] = 0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
993
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
994 v0 = 0; pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
995 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
996
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
997 static void bios_ChangeClearRCnt() { // 0a
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
998 u32 *ptr;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
999
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1000 ptr = (u32*)PSXM((a0 << 2) + 0x8600);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1001 v0 = BFLIP32(*ptr);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1002 *ptr = BFLIP32(a1);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1003
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1004 // psxRegs.CP0.n.Status|= 0x404;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1005 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1006 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1007
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1008 static void bios_dummy() {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1009 pc0 = ra;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1010 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1011
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1012 void (*biosA0[256])();
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1013 void (*biosB0[256])();
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1014 void (*biosC0[256])();
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1015
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1016 void psxBiosInit() {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1017 u32 base, size;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1018 u32 *ptr;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1019 int i;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1020
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1021 heap_addr=0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1022 CurThread = 0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1023 jmp_int = NULL;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1024
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1025 for(i = 0; i < 256; i++) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1026 biosA0[i] = NULL;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1027 biosB0[i] = NULL;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1028 biosC0[i] = NULL;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1029 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1030
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1031 for(i = 0; i < 256; i++) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1032 if (biosA0[i] == NULL) biosA0[i] = bios_dummy;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1033 if (biosB0[i] == NULL) biosB0[i] = bios_dummy;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1034 if (biosC0[i] == NULL) biosC0[i] = bios_dummy;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1035 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1036
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1037 biosA0[0x0e] = bios_abs;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1038 biosA0[0x0f] = bios_labs;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1039 biosA0[0x10] = bios_atoi;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1040 biosA0[0x11] = bios_atol;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1041 //biosA0[0x12] = bios_atob;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1042 biosA0[0x13] = bios_setjmp;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1043 biosA0[0x14] = bios_longjmp;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1044
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1045 biosA0[0x15] = bios_strcat;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1046 biosA0[0x16] = bios_strncat;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1047 biosA0[0x17] = bios_strcmp;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1048 biosA0[0x18] = bios_strncmp;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1049 biosA0[0x19] = bios_strcpy;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1050 biosA0[0x1a] = bios_strncpy;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1051 biosA0[0x1b] = bios_strlen;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1052 biosA0[0x1c] = bios_index;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1053 biosA0[0x1d] = bios_rindex;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1054 biosA0[0x1e] = bios_strchr;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1055 biosA0[0x1f] = bios_strrchr;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1056 biosA0[0x20] = bios_strpbrk;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1057 biosA0[0x21] = bios_strspn;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1058 biosA0[0x22] = bios_strcspn;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1059 //biosA0[0x23] = bios_strtok;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1060 biosA0[0x24] = bios_strstr;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1061 biosA0[0x25] = bios_toupper;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1062 biosA0[0x26] = bios_tolower;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1063 biosA0[0x27] = bios_bcopy;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1064 biosA0[0x28] = bios_bzero;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1065 biosA0[0x29] = bios_bcmp;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1066 biosA0[0x2a] = bios_memcpy;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1067 biosA0[0x2b] = bios_memset;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1068 //biosA0[0x2c] = bios_memmove;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1069 biosA0[0x2c] = bios_memcpy; /* Our code should be compatible
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1070 with both memcpy and memmove
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1071 semantics. */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1072 biosA0[0x2d] = bios_memcmp;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1073 biosA0[0x2e] = bios_memchr;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1074
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1075 biosA0[0x2f] = bios_rand;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1076 biosA0[0x30] = bios_srand;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1077
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1078 //biosA0[0x31] = bios_qsort;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1079 //biosA0[0x32] = bios_strtod;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1080 biosA0[0x33] = bios_malloc;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1081 //biosA0[0x34] = bios_free;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1082 //biosA0[0x35] = bios_lsearch;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1083 //biosA0[0x36] = bios_bsearch;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1084 //biosA0[0x37] = bios_calloc;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1085 //biosA0[0x38] = bios_realloc;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1086 biosA0[0x39] = bios_InitHeap;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1087 //biosA0[0x3a] = bios__exit;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1088 biosA0[0x44] = bios_FlushCache;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1089 //biosA0[0x45] = bios_InstallInterruptHandler;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1090 //biosA0[0x4f] = bios_sys_a0_4f;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1091 //biosA0[0x50] = bios_sys_a0_50;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1092 biosA0[0x70] = bios__bu_init;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1093 biosA0[0x71] = bios__96_init;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1094 biosA0[0x72] = bios__96_remove;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1095 //biosA0[0x73] = bios_sys_a0_73;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1096 //biosA0[0x74] = bios_sys_a0_74;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1097 //biosA0[0x75] = bios_sys_a0_75;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1098 //biosA0[0x76] = bios_sys_a0_76;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1099 //biosA0[0x77] = bios_sys_a0_77;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1100 //biosA0[0x78] = bios__96_CdSeekL;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1101 //biosA0[0x79] = bios_sys_a0_79;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1102 //biosA0[0x7a] = bios_sys_a0_7a;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1103 //biosA0[0x7b] = bios_sys_a0_7b;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1104 //biosA0[0x7c] = bios__96_CdGetStatus;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1105 //biosA0[0x7d] = bios_sys_a0_7d;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1106 //biosA0[0x7e] = bios__96_CdRead;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1107 //biosA0[0x7f] = bios_sys_a0_7f;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1108 //biosA0[0x80] = bios_sys_a0_80;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1109 //biosA0[0x81] = bios_sys_a0_81;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1110 //biosA0[0x82] = bios_sys_a0_82;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1111 //biosA0[0x83] = bios_sys_a0_83;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1112 //biosA0[0x84] = bios_sys_a0_84;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1113 //biosA0[0x85] = bios__96_CdStop;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1114 //biosA0[0x86] = bios_sys_a0_86;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1115 //biosA0[0x87] = bios_sys_a0_87;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1116 //biosA0[0x88] = bios_sys_a0_88;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1117 //biosA0[0x89] = bios_sys_a0_89;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1118 //biosA0[0x8a] = bios_sys_a0_8a;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1119 //biosA0[0x8b] = bios_sys_a0_8b;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1120 //biosA0[0x8c] = bios_sys_a0_8c;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1121 //biosA0[0x8d] = bios_sys_a0_8d;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1122 //biosA0[0x8e] = bios_sys_a0_8e;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1123 //biosA0[0x8f] = bios_sys_a0_8f;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1124 //biosA0[0x90] = bios_sys_a0_90;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1125 //biosA0[0x91] = bios_sys_a0_91;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1126 //biosA0[0x92] = bios_sys_a0_92;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1127 //biosA0[0x93] = bios_sys_a0_93;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1128 //biosA0[0x94] = bios_sys_a0_94;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1129 //biosA0[0x95] = bios_sys_a0_95;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1130 //biosA0[0x96] = bios_AddCDROMDevice;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1131 //biosA0[0x97] = bios_AddMemCardDevide;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1132 //biosA0[0x98] = bios_DisableKernelIORedirection;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1133 //biosA0[0x99] = bios_EnableKernelIORedirection;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1134 //biosA0[0x9a] = bios_sys_a0_9a;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1135 //biosA0[0x9b] = bios_sys_a0_9b;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1136 //biosA0[0x9c] = bios_SetConf;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1137 //biosA0[0x9d] = bios_GetConf;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1138 //biosA0[0x9e] = bios_sys_a0_9e;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1139 //biosA0[0x9f] = bios_SetMem;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1140 //biosA0[0xa0] = bios__boot;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1141 //biosA0[0xa1] = bios_SystemError;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1142 //biosA0[0xa2] = bios_EnqueueCdIntr;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1143 //biosA0[0xa3] = bios_DequeueCdIntr;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1144 //biosA0[0xa4] = bios_sys_a0_a4;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1145 //biosA0[0xa5] = bios_ReadSector;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1146 //biosA0[0xa6] = bios_get_cd_status;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1147 //biosA0[0xa7] = bios_bufs_cb_0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1148 //biosA0[0xa8] = bios_bufs_cb_1;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1149 //biosA0[0xa9] = bios_bufs_cb_2;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1150 //biosA0[0xaa] = bios_bufs_cb_3;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1151 //biosA0[0xab] = bios__card_info;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1152 //biosA0[0xac] = bios__card_load;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1153 //biosA0[0axd] = bios__card_auto;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1154 //biosA0[0xae] = bios_bufs_cd_4;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1155 //biosA0[0xaf] = bios_sys_a0_af;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1156 //biosA0[0xb0] = bios_sys_a0_b0;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1157 //biosA0[0xb1] = bios_sys_a0_b1;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1158 //biosA0[0xb2] = bios_do_a_long_jmp
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1159 //biosA0[0xb3] = bios_sys_a0_b3;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1160 //biosA0[0xb4] = bios_sub_function;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1161 //*******************B0 CALLS****************************
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1162 //biosB0[0x00] = bios_SysMalloc;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1163 //biosB0[0x01] = bios_sys_b0_01;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1164 biosB0[0x02] = bios_SetRCnt;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1165 biosB0[0x03] = bios_GetRCnt;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1166 biosB0[0x04] = bios_StartRCnt;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1167 biosB0[0x05] = bios_StopRCnt;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1168 biosB0[0x06] = bios_ResetRCnt;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1169 biosB0[0x07] = bios_DeliverEvent;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1170 biosB0[0x08] = bios_OpenEvent;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1171 biosB0[0x09] = bios_CloseEvent;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1172 biosB0[0x0a] = bios_WaitEvent;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1173 biosB0[0x0b] = bios_TestEvent;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1174 biosB0[0x0c] = bios_EnableEvent;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1175 biosB0[0x0d] = bios_DisableEvent;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1176 biosB0[0x0e] = bios_OpenTh;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1177 biosB0[0x0f] = bios_CloseTh;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1178 biosB0[0x10] = bios_ChangeTh;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1179 //biosB0[0x11] = bios_bios_b0_11;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1180 biosB0[0x17] = bios_ReturnFromException;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1181 biosB0[0x18] = bios_ResetEntryInt;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1182 biosB0[0x19] = bios_HookEntryInt;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1183 //biosB0[0x1a] = bios_sys_b0_1a;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1184 //biosB0[0x1b] = bios_sys_b0_1b;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1185 //biosB0[0x1c] = bios_sys_b0_1c;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1186 //biosB0[0x1d] = bios_sys_b0_1d;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1187 //biosB0[0x1e] = bios_sys_b0_1e;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1188 //biosB0[0x1f] = bios_sys_b0_1f;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1189 biosB0[0x20] = bios_UnDeliverEvent;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1190 //biosB0[0x21] = bios_sys_b0_21;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1191 //biosB0[0x22] = bios_sys_b0_22;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1192 //biosB0[0x23] = bios_sys_b0_23;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1193 //biosB0[0x24] = bios_sys_b0_24;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1194 //biosB0[0x25] = bios_sys_b0_25;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1195 //biosB0[0x26] = bios_sys_b0_26;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1196 //biosB0[0x27] = bios_sys_b0_27;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1197 //biosB0[0x28] = bios_sys_b0_28;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1198 //biosB0[0x29] = bios_sys_b0_29;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1199 //biosB0[0x2a] = bios_sys_b0_2a;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1200 //biosB0[0x2b] = bios_sys_b0_2b;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1201 //biosB0[0x2c] = bios_sys_b0_2c;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1202 //biosB0[0x2d] = bios_sys_b0_2d;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1203 //biosB0[0x2e] = bios_sys_b0_2e;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1204 //biosB0[0x2f] = bios_sys_b0_2f;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1205 //biosB0[0x30] = bios_sys_b0_30;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1206 //biosB0[0x31] = bios_sys_b0_31;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1207 biosB0[0x56] = bios_GetC0Table;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1208 biosB0[0x57] = bios_GetB0Table;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1209 //biosB0[0x58] = bios__card_chan;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1210 //biosB0[0x59] = bios_sys_b0_59;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1211 //biosB0[0x5a] = bios_sys_b0_5a;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1212 //biosB0[0x5c] = bios__card_status;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1213 //biosB0[0x5d] = bios__card_wait;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1214 //*******************C0 CALLS****************************
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1215 //biosC0[0x00] = bios_InitRCnt;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1216 //biosC0[0x01] = bios_InitException;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1217 biosC0[0x02] = bios_SysEnqIntRP;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1218 biosC0[0x03] = bios_SysDeqIntRP;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1219 //biosC0[0x04] = bios_get_free_EvCB_slot;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1220 //biosC0[0x05] = bios_get_free_TCB_slot;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1221 //biosC0[0x06] = bios_ExceptionHandler;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1222 //biosC0[0x07] = bios_InstallExeptionHandler;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1223 //biosC0[0x08] = bios_SysInitMemory;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1224 //biosC0[0x09] = bios_SysInitKMem;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1225 biosC0[0x0a] = bios_ChangeClearRCnt;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1226 //biosC0[0x0b] = bios_SystemError;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1227 //biosC0[0x0c] = bios_InitDefInt;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1228 //biosC0[0x0d] = bios_sys_c0_0d;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1229 //biosC0[0x0e] = bios_sys_c0_0e;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1230 //biosC0[0x0f] = bios_sys_c0_0f;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1231 //biosC0[0x10] = bios_sys_c0_10;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1232 //biosC0[0x11] = bios_sys_c0_11;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1233 //biosC0[0x12] = bios_InstallDevices;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1234 //biosC0[0x13] = bios_FlushStfInOutPut;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1235 //biosC0[0x14] = bios_sys_c0_14;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1236 //biosC0[0x15] = bios__cdevinput;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1237 //biosC0[0x16] = bios__cdevscan;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1238 //biosC0[0x17] = bios__circgetc;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1239 //biosC0[0x18] = bios__circputc;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1240 //biosC0[0x19] = bios_ioabort;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1241 //biosC0[0x1a] = bios_sys_c0_1a
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1242 //biosC0[0x1b] = bios_KernelRedirect;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1243 //biosC0[0x1c] = bios_PatchAOTable;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1244 //************** THE END ***************************************
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1245
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1246 base = 0x1000;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1247 size = sizeof(EvCB) * 32;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1248 Event = (void *)&psxR[base]; base+= size*6;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1249 memset(Event, 0, size * 6);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1250 //HwEV = Event;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1251 //EvEV = Event + 32;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1252 RcEV = Event + 32*2;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1253 //UeEV = Event + 32*3;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1254 //SwEV = Event + 32*4;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1255 //ThEV = Event + 32*5;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1256
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1257 ptr = (u32*)&psxM[0x0874]; // b0 table
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1258 ptr[0] = BFLIP32(0x4c54 - 0x884);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1259
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1260 ptr = (u32*)&psxM[0x0674]; // c0 table
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1261 ptr[6] = BFLIP32(0xc80);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1262
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1263 memset(SysIntRP, 0, sizeof(SysIntRP));
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1264 memset(Thread, 0, sizeof(Thread));
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1265 Thread[0].status = BFLIP32(2); // main thread
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1266
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1267 psxMu32(0x0150) = BFLIP32(0x160);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1268 psxMu32(0x0154) = BFLIP32(0x320);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1269 psxMu32(0x0160) = BFLIP32(0x248);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1270 strcpy(&psxM[0x248], "bu");
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1271
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1272 /* psxMu32(0x0ca8) = BFLIP32(0x1f410004);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1273 psxMu32(0x0cf0) = BFLIP32(0x3c020000);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1274 psxMu32(0x0cf4) = BFLIP32(0x2442641c);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1275 psxMu32(0x09e0) = BFLIP32(0x43d0);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1276 psxMu32(0x4d98) = BFLIP32(0x946f000a);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1277 */
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1278 // opcode HLE
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1279 psxRu32(0x0000) = BFLIP32((0x3b << 26) | 4);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1280 psxMu32(0x0000) = BFLIP32((0x3b << 26) | 0);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1281 psxMu32(0x00a0) = BFLIP32((0x3b << 26) | 1);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1282 psxMu32(0x00b0) = BFLIP32((0x3b << 26) | 2);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1283 psxMu32(0x00c0) = BFLIP32((0x3b << 26) | 3);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1284 psxMu32(0x4c54) = BFLIP32((0x3b << 26) | 0);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1285 psxMu32(0x8000) = BFLIP32((0x3b << 26) | 5);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1286 psxMu32(0x07a0) = BFLIP32((0x3b << 26) | 0);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1287 psxMu32(0x0884) = BFLIP32((0x3b << 26) | 0);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1288 psxMu32(0x0894) = BFLIP32((0x3b << 26) | 0);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1289 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1290
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1291 void psxBiosShutdown() {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1292 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1293
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1294 void biosInterrupt() {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1295 if (BFLIP32(psxHu32(0x1070)) & 0x1) { // Vsync
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1296 if (RcEV[3][1].status == BFLIP32S(EvStACTIVE)) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1297 softCall(BFLIP32(RcEV[3][1].fhandler));
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1298 // hwWrite32(0x1f801070, ~(1));
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1299 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1300 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1301
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1302 if (BFLIP32(psxHu32(0x1070)) & 0x70) { // Rcnt 0,1,2
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1303 int i;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1304
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1305 for (i=0; i<3; i++) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1306 if (BFLIP32(psxHu32(0x1070)) & (1 << (i+4))) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1307 if (RcEV[i][1].status == BFLIP32S(EvStACTIVE)) {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1308 softCall(BFLIP32(RcEV[i][1].fhandler));
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1309 psxHwWrite32(0x1f801070, ~(1 << (i+4)));
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1310 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1311 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1312 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1313 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1314 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1315
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1316 static INLINE void SaveRegs() {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1317 memcpy(regs, psxRegs.GPR.r, 32*4);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1318 regs[32] = psxRegs.GPR.n.lo;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1319 regs[33] = psxRegs.GPR.n.hi;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1320 regs[34] = psxRegs.pc;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1321 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1322
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1323 void psxBiosException() {
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1324 int i;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1325
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1326 switch (psxRegs.CP0.n.Cause & 0x3c) {
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1327 case 0x00: // Interrupt
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1328 #ifdef PSXCPU_LOG
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1329 // PSXCPU_LOG("interrupt\n");
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1330 #endif
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1331 SaveRegs();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1332
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1333 biosInterrupt();
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1334
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1335 for (i=0; i<8; i++) {
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1336 if (SysIntRP[i]) {
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1337 u32 *queue = (u32*)PSXM(SysIntRP[i]);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1338
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1339 s0 = BFLIP32(queue[2]);
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1340 softCall(BFLIP32(queue[1]));
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1341 }
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1342 }
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1343
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1344 if (jmp_int != NULL) {
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1345 int i;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1346
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1347 psxHwWrite32(0x1f801070, 0xffffffff);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1348
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1349 ra = BFLIP32(jmp_int[0]);
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1350 sp = BFLIP32(jmp_int[1]);
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1351 fp = BFLIP32(jmp_int[2]);
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1352 for (i=0; i<8; i++) // s0-s7
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1353 psxRegs.GPR.r[16+i] = BFLIP32(jmp_int[3+i]);
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1354 gp = BFLIP32(jmp_int[11]);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1355
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1356 v0 = 1;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1357 pc0 = ra;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1358 return;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1359 }
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1360 psxHwWrite16(0x1f801070, 0);
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1361 break;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1362 case 0x20: // Syscall
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1363 #ifdef PSXCPU_LOG
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1364 // PSXCPU_LOG("syscall exp %x\n", a0);
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1365 #endif
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1366 switch (a0) {
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1367 case 1: // EnterCritical - disable irq's
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1368 psxRegs.CP0.n.Status&=~0x404; break;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1369 case 2: // ExitCritical - enable irq's
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1370 psxRegs.CP0.n.Status|= 0x404; break;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1371 }
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1372 pc0 = psxRegs.CP0.n.EPC + 4;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1373
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1374 psxRegs.CP0.n.Status = (psxRegs.CP0.n.Status & 0xfffffff0) |
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1375 ((psxRegs.CP0.n.Status & 0x3c) >> 2);
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1376 return;
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1377 default:
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1378 #ifdef PSXCPU_LOG
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1379 PSXCPU_LOG("unk exp\n");
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1380 #endif
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1381 break;
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1382 }
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1383
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1384 pc0 = psxRegs.CP0.n.EPC;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1385 if (psxRegs.CP0.n.Cause & 0x80000000) pc0+=4;
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1386
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1387 psxRegs.CP0.n.Status = (psxRegs.CP0.n.Status & 0xfffffff0) |
2231
a8471cee0697 fix indentation.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents: 12
diff changeset
1388 ((psxRegs.CP0.n.Status & 0x3c) >> 2);
0
13389e613d67 [svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff changeset
1389 }