2009-09-08 12:08:10 +00:00
|
|
|
/* PCSX2 - PS2 Emulator for PCs
|
|
|
|
* Copyright (C) 2002-2009 PCSX2 Dev Team
|
|
|
|
*
|
|
|
|
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
|
|
|
|
* of the GNU Lesser General Public License as published by the Free Software Found-
|
|
|
|
* ation, either version 3 of the License, or (at your option) any later version.
|
2009-02-09 21:15:56 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE. See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with PCSX2.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
2009-02-09 21:15:56 +00:00
|
|
|
*/
|
|
|
|
|
2009-09-08 12:08:10 +00:00
|
|
|
|
2009-02-09 21:15:56 +00:00
|
|
|
#include "PrecompiledHeader.h"
|
2009-03-13 04:49:23 +00:00
|
|
|
#include "IopCommon.h"
|
2009-11-14 12:02:56 +00:00
|
|
|
|
2009-02-09 21:15:56 +00:00
|
|
|
#include "iR5900.h"
|
2009-11-14 12:02:56 +00:00
|
|
|
#include "Sio.h"
|
2009-02-09 21:15:56 +00:00
|
|
|
|
|
|
|
// NOTE: Any modifications to read/write fns should also go into their const counterparts
|
|
|
|
// found in iPsxHw.cpp.
|
|
|
|
|
|
|
|
void psxHwReset() {
|
|
|
|
/* if (Config.Sio) psxHu32(0x1070) |= 0x80;
|
|
|
|
if (Config.SpuIrq) psxHu32(0x1070) |= 0x200;*/
|
|
|
|
|
|
|
|
memzero_ptr<0x10000>(psxH);
|
|
|
|
|
|
|
|
// mdecInit(); //initialize mdec decoder
|
|
|
|
cdrReset();
|
|
|
|
cdvdReset();
|
|
|
|
psxRcntInit();
|
|
|
|
sioInit();
|
|
|
|
//sio2Reset();
|
|
|
|
}
|
|
|
|
|
2009-05-04 19:04:21 +00:00
|
|
|
__forceinline u8 psxHw4Read8(u32 add)
|
2009-05-01 11:06:52 +00:00
|
|
|
{
|
|
|
|
u16 mem = add & 0xFF;
|
2009-05-04 19:04:21 +00:00
|
|
|
u8 ret = cdvdRead(mem);
|
|
|
|
PSXHW_LOG("HwRead8 from Cdvd [segment 0x1f40], addr 0x%02x = 0x%02x", mem, ret);
|
|
|
|
return ret;
|
2009-02-09 21:15:56 +00:00
|
|
|
}
|
|
|
|
|
2009-05-04 19:04:21 +00:00
|
|
|
__forceinline void psxHw4Write8(u32 add, u8 value)
|
2009-05-01 11:06:52 +00:00
|
|
|
{
|
2009-05-04 19:04:21 +00:00
|
|
|
u8 mem = (u8)add; // only lower 8 bits are relevant (cdvd regs mirror across the page)
|
2009-05-01 11:06:52 +00:00
|
|
|
cdvdWrite(mem, value);
|
2009-05-04 19:04:21 +00:00
|
|
|
PSXHW_LOG("HwWrite8 to Cdvd [segment 0x1f40], addr 0x%02x = 0x%02x", mem, value);
|
2009-02-09 21:15:56 +00:00
|
|
|
}
|
|
|
|
|
2009-05-02 10:48:41 +00:00
|
|
|
void psxDmaInterrupt(int n)
|
|
|
|
{
|
|
|
|
if (HW_DMA_ICR & (1 << (16 + n)))
|
|
|
|
{
|
2009-02-09 21:15:56 +00:00
|
|
|
HW_DMA_ICR|= (1 << (24 + n));
|
|
|
|
psxRegs.CP0.n.Cause |= 1 << (9 + n);
|
|
|
|
iopIntcIrq( 3 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-05-02 10:48:41 +00:00
|
|
|
void psxDmaInterrupt2(int n)
|
|
|
|
{
|
|
|
|
if (HW_DMA_ICR2 & (1 << (16 + n)))
|
|
|
|
{
|
2009-02-09 21:15:56 +00:00
|
|
|
/* if (HW_DMA_ICR2 & (1 << (24 + n))) {
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
Console.WriteLn("*PCSX2*: HW_DMA_ICR2 n=%d already set", n);
|
2009-02-09 21:15:56 +00:00
|
|
|
}
|
|
|
|
if (psxHu32(0x1070) & 8) {
|
Lots of new code maintenance stuffs:
* Completely new assertion macros: pxAssert, pxAssertMsg, and pxFail, pxAssertDev (both which default to using a message). These replace *all* wxASSERT, DevAssert, and jASSUME varieties of macros. New macros borrow the best of all assertion worlds: MSVCRT, wxASSERT, and AtlAssume. :)
* Rewrote the Console namespace as a structure called IConsoleWriter, and created several varieties of ConsoleWriters for handling different states of log and console availability (should help reduce overhead of console logging nicely).
* More improvements to the PersistentThread model, using safely interlocked "Do*" style callbacks for starting and cleaning up threads.
* Fixed console logs so that they're readable in Win32 notepad again (the log writer adds CRs to naked LFs).
* Added AppInit.cpp -- contains constructor, destructor, OnInit, and command line parsing mess.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1950 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-04 08:27:27 +00:00
|
|
|
Console.WriteLn("*PCSX2*: psxHu32(0x1070) 8 already set (n=%d)", n);
|
2009-02-09 21:15:56 +00:00
|
|
|
}*/
|
|
|
|
HW_DMA_ICR2|= (1 << (24 + n));
|
|
|
|
psxRegs.CP0.n.Cause |= 1 << (16 + n);
|
|
|
|
iopIntcIrq( 3 );
|
|
|
|
}
|
|
|
|
}
|