2009-09-08 12:08:10 +00:00
|
|
|
/* PCSX2 - PS2 Emulator for PCs
|
2010-05-03 14:08:02 +00:00
|
|
|
* Copyright (C) 2002-2010 PCSX2 Dev Team
|
2010-04-25 00:31:27 +00:00
|
|
|
*
|
2009-09-08 12:08:10 +00:00
|
|
|
* 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
|
|
|
// This module contains code shared by both the dynarec and interpreter versions
|
|
|
|
// of the VU0 micro.
|
|
|
|
|
|
|
|
|
|
|
|
#include "PrecompiledHeader.h"
|
2009-11-14 12:02:56 +00:00
|
|
|
#include "Common.h"
|
2010-08-25 15:32:17 +00:00
|
|
|
#include "VUmicro.h"
|
2009-02-09 21:15:56 +00:00
|
|
|
|
|
|
|
#include <cmath>
|
|
|
|
|
|
|
|
using namespace R5900;
|
|
|
|
|
|
|
|
// This is called by the COP2 as per the CTC instruction
|
|
|
|
void vu0ResetRegs()
|
|
|
|
{
|
|
|
|
VU0.VI[REG_VPU_STAT].UL &= ~0xff; // stop vu0
|
|
|
|
VU0.VI[REG_FBRST].UL &= ~0xff; // stop vu0
|
2010-08-31 05:22:26 +00:00
|
|
|
vif0Regs.stat.VEW = false;
|
2009-02-09 21:15:56 +00:00
|
|
|
}
|
|
|
|
|
2009-10-20 20:02:07 +00:00
|
|
|
void __fastcall vu0ExecMicro(u32 addr) {
|
2009-03-27 06:34:51 +00:00
|
|
|
VUM_LOG("vu0ExecMicro %x", addr);
|
2010-04-25 00:31:27 +00:00
|
|
|
|
2009-02-09 21:15:56 +00:00
|
|
|
if(VU0.VI[REG_VPU_STAT].UL & 0x1) {
|
2009-10-29 13:32:40 +00:00
|
|
|
DevCon.Warning("vu0ExecMicro > Stalling for previous microprogram to finish");
|
2009-02-09 21:15:56 +00:00
|
|
|
vu0Finish();
|
|
|
|
}
|
|
|
|
|
2020-09-10 10:52:47 +00:00
|
|
|
// Need to copy the clip flag back to the interpreter in case COP2 has edited it
|
|
|
|
VU0.clipflag = VU0.VI[REG_CLIP_FLAG].UL;
|
2021-09-02 23:04:55 +00:00
|
|
|
VU0.macflag = VU0.VI[REG_MAC_FLAG].UL;
|
|
|
|
VU0.statusflag = VU0.VI[REG_STATUS_FLAG].UL;
|
2010-01-25 06:42:09 +00:00
|
|
|
VU0.VI[REG_VPU_STAT].UL &= ~0xFF;
|
|
|
|
VU0.VI[REG_VPU_STAT].UL |= 0x01;
|
2020-08-09 06:30:24 +00:00
|
|
|
VU0.cycle = cpuRegs.cycle;
|
2021-07-09 22:14:26 +00:00
|
|
|
if ((s32)addr != -1) VU0.VI[REG_TPC].UL = addr & 0x1FF;
|
2020-12-04 13:03:32 +00:00
|
|
|
|
|
|
|
CpuVU0->SetStartPC(VU0.VI[REG_TPC].UL << 3);
|
2009-02-09 21:15:56 +00:00
|
|
|
_vuExecMicroDebug(VU0);
|
2010-02-24 07:20:33 +00:00
|
|
|
CpuVU0->ExecuteBlock(1);
|
2009-02-09 21:15:56 +00:00
|
|
|
}
|