RSP: Added musyx ucode suport to HLE from mupen64plus-ae
[mupen64plus-pandora.git] / source / mupen64plus-rsp-hle / src / cicx105.c
CommitLineData
d9e74a6f 1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2 * Mupen64plus-rsp-hle - cicx105.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
24#include <string.h>
25
0a8a0368 26#include "m64p_plugin.h"
d9e74a6f 27#include "hle.h"
0a8a0368 28#include "cicx105.h"
d9e74a6f 29
30/**
31 * During IPL3 stage of CIC x105 games, the RSP performs some checks and transactions
32 * necessary for booting the game.
0a8a0368 33 *
d9e74a6f 34 * We only implement the needed DMA transactions for booting.
35 *
36 * Found in Banjo-Tooie, Zelda, Perfect Dark, ...)
37 **/
0a8a0368 38void cicx105_ucode(void)
d9e74a6f 39{
0a8a0368 40 /* memcpy is okay to use because access constrains are met (alignment, size) */
d9e74a6f 41 unsigned int i;
0a8a0368 42 unsigned char *dst = rsp.RDRAM + 0x2fb1f0;
43 unsigned char *src = rsp.IMEM + 0x120;
d9e74a6f 44
45 /* dma_read(0x1120, 0x1e8, 0x1e8) */
46 memcpy(rsp.IMEM + 0x120, rsp.RDRAM + 0x1e8, 0x1f0);
47
48 /* dma_write(0x1120, 0x2fb1f0, 0xfe817000) */
0a8a0368 49 for (i = 0; i < 24; ++i) {
d9e74a6f 50 memcpy(dst, src, 8);
51 dst += 0xff0;
52 src += 0x8;
53
54 }
55}