1 /***************************************************************************
\r
4 begin : Wed May 15 2002
\r
5 copyright : (C) 2002 by Pete Bernert
\r
6 email : BlackDove@addcom.de
\r
7 ***************************************************************************/
\r
8 /***************************************************************************
\r
10 * This program is free software; you can redistribute it and/or modify *
\r
11 * it under the terms of the GNU General Public License as published by *
\r
12 * the Free Software Foundation; either version 2 of the License, or *
\r
13 * (at your option) any later version. See also the license.txt file for *
\r
14 * additional informations. *
\r
16 ***************************************************************************/
\r
22 #include "externals.h"
\r
24 ////////////////////////////////////////////////////////////////////////
\r
25 // READ DMA (one value)
\r
26 ////////////////////////////////////////////////////////////////////////
\r
28 unsigned short CALLBACK SPUreadDMA(void)
\r
30 unsigned short s = *(unsigned short *)(spu.spuMemC + spu.spuAddr);
\r
32 spu.spuAddr &= 0x7fffe;
\r
37 ////////////////////////////////////////////////////////////////////////
\r
38 // READ DMA (many values)
\r
39 ////////////////////////////////////////////////////////////////////////
\r
41 void CALLBACK SPUreadDMAMem(unsigned short *pusPSXMem, int iSize,
\r
42 unsigned int cycles)
\r
46 do_samples_if_needed(cycles, 1);
\r
48 for(i=0;i<iSize;i++)
\r
50 *pusPSXMem++ = *(unsigned short *)(spu.spuMemC + spu.spuAddr);
\r
52 spu.spuAddr &= 0x7fffe;
\r
56 ////////////////////////////////////////////////////////////////////////
\r
57 ////////////////////////////////////////////////////////////////////////
\r
58 ////////////////////////////////////////////////////////////////////////
\r
60 // to investigate: do sound data updates by writedma affect spu
\r
61 // irqs? Will an irq be triggered, if new data is written to
\r
62 // the memory irq address?
\r
64 ////////////////////////////////////////////////////////////////////////
\r
65 // WRITE DMA (one value)
\r
66 ////////////////////////////////////////////////////////////////////////
\r
68 void CALLBACK SPUwriteDMA(unsigned short val)
\r
70 *(unsigned short *)(spu.spuMemC + spu.spuAddr) = val;
\r
73 spu.spuAddr &= 0x7fffe;
\r
76 ////////////////////////////////////////////////////////////////////////
\r
77 // WRITE DMA (many values)
\r
78 ////////////////////////////////////////////////////////////////////////
\r
80 void CALLBACK SPUwriteDMAMem(unsigned short *pusPSXMem, int iSize,
\r
81 unsigned int cycles)
\r
85 do_samples_if_needed(cycles, 1);
\r
87 if(spu.spuAddr + iSize*2 < 0x80000)
\r
89 memcpy(spu.spuMemC + spu.spuAddr, pusPSXMem, iSize*2);
\r
90 spu.spuAddr += iSize*2;
\r
94 for(i=0;i<iSize;i++)
\r
96 *(unsigned short *)(spu.spuMemC + spu.spuAddr) = *pusPSXMem++;
\r
98 spu.spuAddr &= 0x7fffe;
\r
102 ////////////////////////////////////////////////////////////////////////
\r