RSP: Added musyx ucode suport to HLE from mupen64plus-ae
[mupen64plus-pandora.git] / source / mupen64plus-rsp-hle / src / alist.c
CommitLineData
d9e74a6f 1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2 * Mupen64plus-rsp-hle - alist.c *
3 * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
4 * Copyright (C) 2012 Bobby Smiles *
5 * Copyright (C) 2009 Richard Goedeken *
6 * Copyright (C) 2002 Hacktarux *
7 * *
8 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program; if not, write to the *
20 * Free Software Foundation, Inc., *
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
22 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
23
0a8a0368 24#include <stdint.h>
25#include "m64p_plugin.h"
26#include "m64p_types.h"
27
d9e74a6f 28#include "hle.h"
29#include "alist_internal.h"
0a8a0368 30#include "alist.h"
d9e74a6f 31
32/* local functions */
33static void alist_process(const acmd_callback_t abi[], unsigned int abi_size)
34{
0a8a0368 35 uint32_t inst1, inst2;
d9e74a6f 36 unsigned int acmd;
0a8a0368 37 const OSTask_t *const task = get_task();
d9e74a6f 38
0a8a0368 39 const unsigned int *alist = (unsigned int *)(rsp.RDRAM + task->data_ptr);
40 const unsigned int *const alist_end = alist + (task->data_size >> 2);
d9e74a6f 41
0a8a0368 42 while (alist != alist_end) {
d9e74a6f 43 inst1 = *(alist++);
44 inst2 = *(alist++);
45
46 acmd = inst1 >> 24;
47
48 if (acmd < abi_size)
d9e74a6f 49 (*abi[acmd])(inst1, inst2);
d9e74a6f 50 else
d9e74a6f 51 DebugMessage(M64MSG_WARNING, "Invalid ABI command %u", acmd);
d9e74a6f 52 }
53}
54
55/* global functions */
0a8a0368 56void alist_process_ABI1(void)
d9e74a6f 57{
58 alist_process(ABI1, 0x10);
59}
60
0a8a0368 61void alist_process_ABI2(void)
d9e74a6f 62{
63 alist_process(ABI2, 0x20);
64}
65
0a8a0368 66void alist_process_ABI3(void)
d9e74a6f 67{
68 alist_process(ABI3, 0x10);
69}
70