mirror of https://github.com/PCSX2/pcsx2.git
Vif: Combined a lot of duplicate functions between vif0 and vif1...
Still got some more to do... git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2492 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
cc52adf6cb
commit
e8527448ca
|
@ -150,94 +150,7 @@ static int __fastcall Vif0TransUnpack(u32 *data) // UNPACK
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Vif0 CMD Base Commands
|
// Vif0 Data Transfer Table
|
||||||
//------------------------------------------------------------------
|
|
||||||
|
|
||||||
static void Vif0CMDNop() // NOP
|
|
||||||
{
|
|
||||||
vif0.cmd &= ~0x7f;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Vif0CMDSTCycl() // STCYCL
|
|
||||||
{
|
|
||||||
vif0Regs->cycle.cl = (u8)vif0Regs->code;
|
|
||||||
vif0Regs->cycle.wl = (u8)(vif0Regs->code >> 8);
|
|
||||||
vif0.cmd &= ~0x7f;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Vif0CMDITop() // ITOP
|
|
||||||
{
|
|
||||||
vif0Regs->itops = vif0Regs->code & 0x3ff;
|
|
||||||
vif0.cmd &= ~0x7f;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Vif0CMDSTMod() // STMOD
|
|
||||||
{
|
|
||||||
vif0Regs->mode = vif0Regs->code & 0x3;
|
|
||||||
vif0.cmd &= ~0x7f;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Vif0CMDMark() // MARK
|
|
||||||
{
|
|
||||||
vif0Regs->mark = (u16)vif0Regs->code;
|
|
||||||
vif0Regs->stat.MRK = true;
|
|
||||||
vif0.cmd &= ~0x7f;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Vif0CMDFlushE() // FLUSHE
|
|
||||||
{
|
|
||||||
vif0FLUSH();
|
|
||||||
vif0.cmd &= ~0x7f;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Vif0CMDMSCALF() //MSCAL/F
|
|
||||||
{
|
|
||||||
vuExecMicro<0>((u16)(vif0Regs->code) << 3);
|
|
||||||
vif0.cmd &= ~0x7f;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Vif0CMDMSCNT() // MSCNT
|
|
||||||
{
|
|
||||||
vuExecMicro<0>(-1);
|
|
||||||
vif0.cmd &= ~0x7f;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Vif0CMDSTMask() // STMASK
|
|
||||||
{
|
|
||||||
vif0.tag.size = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Vif0CMDSTRowCol() // STROW / STCOL
|
|
||||||
{
|
|
||||||
vif0.tag.addr = 0;
|
|
||||||
vif0.tag.size = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Vif0CMDMPGTransfer() // MPG
|
|
||||||
{
|
|
||||||
int vifNum;
|
|
||||||
vif0FLUSH();
|
|
||||||
vifNum = (u8)(vif0Regs->code >> 16);
|
|
||||||
if (vifNum == 0) vifNum = 256;
|
|
||||||
vif0.tag.addr = (u16)((vif0Regs->code) << 3) & 0xfff;
|
|
||||||
vif0.tag.size = vifNum * 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Vif0CMDNull() // invalid opcode
|
|
||||||
{
|
|
||||||
// if ME1, then force the vif to interrupt
|
|
||||||
if (!(vif0Regs->err.ME1)) //Ignore vifcode and tag mismatch error
|
|
||||||
{
|
|
||||||
Console.WriteLn("UNKNOWN VifCmd: %x", vif0.cmd);
|
|
||||||
vif0Regs->stat.ER1 = true;
|
|
||||||
vif0.irq++;
|
|
||||||
}
|
|
||||||
vif0.cmd &= ~0x7f;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
|
||||||
// Vif0 Data Transfer / Vif0 CMD Tables
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
int (__fastcall *Vif0TransTLB[128])(u32 *data) =
|
int (__fastcall *Vif0TransTLB[128])(u32 *data) =
|
||||||
|
@ -259,17 +172,3 @@ int (__fastcall *Vif0TransTLB[128])(u32 *data) =
|
||||||
Vif0TransUnpack , Vif0TransUnpack , Vif0TransUnpack , Vif0TransUnpack , Vif0TransUnpack , Vif0TransUnpack , Vif0TransUnpack , Vif0TransNull , /*0x77*/
|
Vif0TransUnpack , Vif0TransUnpack , Vif0TransUnpack , Vif0TransUnpack , Vif0TransUnpack , Vif0TransUnpack , Vif0TransUnpack , Vif0TransNull , /*0x77*/
|
||||||
Vif0TransUnpack , Vif0TransUnpack , Vif0TransUnpack , Vif0TransNull , Vif0TransUnpack , Vif0TransUnpack , Vif0TransUnpack , Vif0TransUnpack /*0x7F*/
|
Vif0TransUnpack , Vif0TransUnpack , Vif0TransUnpack , Vif0TransNull , Vif0TransUnpack , Vif0TransUnpack , Vif0TransUnpack , Vif0TransUnpack /*0x7F*/
|
||||||
};
|
};
|
||||||
|
|
||||||
void (*Vif0CMDTLB[75])() =
|
|
||||||
{
|
|
||||||
Vif0CMDNop , Vif0CMDSTCycl , Vif0CMDNull , Vif0CMDNull , Vif0CMDITop , Vif0CMDSTMod , Vif0CMDNull, Vif0CMDMark , /*0x7*/
|
|
||||||
Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , /*0xF*/
|
|
||||||
Vif0CMDFlushE , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull, Vif0CMDMSCALF, Vif0CMDMSCALF, Vif0CMDNull , Vif0CMDMSCNT, /*0x17*/
|
|
||||||
Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , /*0x1F*/
|
|
||||||
Vif0CMDSTMask , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , /*0x27*/
|
|
||||||
Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , /*0x2F*/
|
|
||||||
Vif0CMDSTRowCol, Vif0CMDSTRowCol, Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , /*0x37*/
|
|
||||||
Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , /*0x3F*/
|
|
||||||
Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , Vif0CMDNull , /*0x47*/
|
|
||||||
Vif0CMDNull , Vif0CMDNull , Vif0CMDMPGTransfer
|
|
||||||
};
|
|
||||||
|
|
|
@ -230,163 +230,7 @@ static int __fastcall Vif1TransUnpack(u32 *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
// Vif1 CMD Base Commands
|
// Vif1 Data Transfer Table
|
||||||
//------------------------------------------------------------------
|
|
||||||
|
|
||||||
static void Vif1CMDNop() // NOP
|
|
||||||
{
|
|
||||||
vif1.cmd &= ~0x7f;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Vif1CMDSTCycl() // STCYCL
|
|
||||||
{
|
|
||||||
vif1Regs->cycle.cl = (u8)vif1Regs->code;
|
|
||||||
vif1Regs->cycle.wl = (u8)(vif1Regs->code >> 8);
|
|
||||||
vif1.cmd &= ~0x7f;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Vif1CMDOffset() // OFFSET
|
|
||||||
{
|
|
||||||
vif1Regs->ofst = vif1Regs->code & 0x3ff;
|
|
||||||
vif1Regs->stat.DBF = false;
|
|
||||||
vif1Regs->tops = vif1Regs->base;
|
|
||||||
vif1.cmd &= ~0x7f;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Vif1CMDBase() // BASE
|
|
||||||
{
|
|
||||||
vif1Regs->base = vif1Regs->code & 0x3ff;
|
|
||||||
vif1.cmd &= ~0x7f;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Vif1CMDITop() // ITOP
|
|
||||||
{
|
|
||||||
vif1Regs->itops = vif1Regs->code & 0x3ff;
|
|
||||||
vif1.cmd &= ~0x7f;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Vif1CMDSTMod() // STMOD
|
|
||||||
{
|
|
||||||
vif1Regs->mode = vif1Regs->code & 0x3;
|
|
||||||
vif1.cmd &= ~0x7f;
|
|
||||||
}
|
|
||||||
|
|
||||||
u8 schedulepath3msk = 0;
|
|
||||||
|
|
||||||
void Vif1MskPath3() // MSKPATH3
|
|
||||||
{
|
|
||||||
vif1Regs->mskpath3 = schedulepath3msk & 0x1;
|
|
||||||
//Console.WriteLn("VIF MSKPATH3 %x", vif1Regs->mskpath3);
|
|
||||||
|
|
||||||
if (vif1Regs->mskpath3)
|
|
||||||
{
|
|
||||||
gifRegs->stat.M3P = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//Let the Gif know it can transfer again (making sure any vif stall isnt unset prematurely)
|
|
||||||
Path3progress = TRANSFER_MODE;
|
|
||||||
gifRegs->stat.IMT = false;
|
|
||||||
CPU_INT(2, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
schedulepath3msk = 0;
|
|
||||||
}
|
|
||||||
static void Vif1CMDMskPath3() // MSKPATH3
|
|
||||||
{
|
|
||||||
if (vif1ch->chcr.STR)
|
|
||||||
{
|
|
||||||
schedulepath3msk = 0x10 | ((vif1Regs->code >> 15) & 0x1);
|
|
||||||
vif1.vifstalled = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
schedulepath3msk = (vif1Regs->code >> 15) & 0x1;
|
|
||||||
Vif1MskPath3();
|
|
||||||
}
|
|
||||||
vif1.cmd &= ~0x7f;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void Vif1CMDMark() // MARK
|
|
||||||
{
|
|
||||||
vif1Regs->mark = (u16)vif1Regs->code;
|
|
||||||
vif1Regs->stat.MRK = true;
|
|
||||||
vif1.cmd &= ~0x7f;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Vif1CMDFlush() // FLUSH/E/A
|
|
||||||
{
|
|
||||||
vif1FLUSH();
|
|
||||||
|
|
||||||
if ((vif1.cmd & 0x7f) == 0x13)
|
|
||||||
{
|
|
||||||
// Gif is already transferring so wait for it.
|
|
||||||
if (((Path3progress != STOPPED_MODE) || !vif1Regs->mskpath3) && gif->chcr.STR)
|
|
||||||
{
|
|
||||||
vif1Regs->stat.VGW = true;
|
|
||||||
CPU_INT(2, 4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
vif1.cmd &= ~0x7f;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Vif1CMDMSCALF() //MSCAL/F
|
|
||||||
{
|
|
||||||
vif1FLUSH();
|
|
||||||
vuExecMicro<1>((u16)(vif1Regs->code) << 3);
|
|
||||||
vif1.cmd &= ~0x7f;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Vif1CMDMSCNT() // MSCNT
|
|
||||||
{
|
|
||||||
vuExecMicro<1>(-1);
|
|
||||||
vif1.cmd &= ~0x7f;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Vif1CMDSTMask() // STMASK
|
|
||||||
{
|
|
||||||
vif1.tag.size = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Vif1CMDSTRowCol() // STROW / STCOL
|
|
||||||
{
|
|
||||||
vif1.tag.addr = 0;
|
|
||||||
vif1.tag.size = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Vif1CMDMPGTransfer() // MPG
|
|
||||||
{
|
|
||||||
int vifNum = (u8)(vif1Regs->code >> 16);
|
|
||||||
if(!vifNum) vifNum = 256;
|
|
||||||
|
|
||||||
vif1.tag.addr = (u16)((vif1Regs->code) << 3) & 0x3fff;
|
|
||||||
vif1.tag.size = vifNum * 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Vif1CMDDirectHL() // DIRECT/HL
|
|
||||||
{
|
|
||||||
int vifImm = (u16)vif1Regs->code;
|
|
||||||
if(!vifImm) vif1.tag.size = 65536 << 2;
|
|
||||||
else vif1.tag.size = vifImm << 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Vif1CMDNull() // invalid opcode
|
|
||||||
{
|
|
||||||
// if ME1, then force the vif to interrupt
|
|
||||||
|
|
||||||
if (!(vif1Regs->err.ME1)) //Ignore vifcode and tag mismatch error
|
|
||||||
{
|
|
||||||
Console.WriteLn("UNKNOWN VifCmd: %x\n", vif1.cmd);
|
|
||||||
vif1Regs->stat.ER1 = true;
|
|
||||||
vif1.irq++;
|
|
||||||
}
|
|
||||||
vif1.cmd = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
|
||||||
// Vif1 Data Transfer / Vif1 CMD Tables
|
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
int (__fastcall *Vif1TransTLB[128])(u32 *data) =
|
int (__fastcall *Vif1TransTLB[128])(u32 *data) =
|
||||||
|
@ -408,18 +252,3 @@ int (__fastcall *Vif1TransTLB[128])(u32 *data) =
|
||||||
Vif1TransUnpack , Vif1TransUnpack , Vif1TransUnpack , Vif1TransUnpack , Vif1TransUnpack , Vif1TransUnpack , Vif1TransUnpack , Vif1TransNull , /*0x77*/
|
Vif1TransUnpack , Vif1TransUnpack , Vif1TransUnpack , Vif1TransUnpack , Vif1TransUnpack , Vif1TransUnpack , Vif1TransUnpack , Vif1TransNull , /*0x77*/
|
||||||
Vif1TransUnpack , Vif1TransUnpack , Vif1TransUnpack , Vif1TransNull , Vif1TransUnpack , Vif1TransUnpack , Vif1TransUnpack , Vif1TransUnpack /*0x7F*/
|
Vif1TransUnpack , Vif1TransUnpack , Vif1TransUnpack , Vif1TransNull , Vif1TransUnpack , Vif1TransUnpack , Vif1TransUnpack , Vif1TransUnpack /*0x7F*/
|
||||||
};
|
};
|
||||||
|
|
||||||
void (*Vif1CMDTLB[82])() =
|
|
||||||
{
|
|
||||||
Vif1CMDNop , Vif1CMDSTCycl , Vif1CMDOffset , Vif1CMDBase , Vif1CMDITop , Vif1CMDSTMod , Vif1CMDMskPath3, Vif1CMDMark , /*0x7*/
|
|
||||||
Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , /*0xF*/
|
|
||||||
Vif1CMDFlush , Vif1CMDFlush , Vif1CMDNull , Vif1CMDFlush, Vif1CMDMSCALF, Vif1CMDMSCALF, Vif1CMDNull , Vif1CMDMSCNT, /*0x17*/
|
|
||||||
Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , /*0x1F*/
|
|
||||||
Vif1CMDSTMask , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , /*0x27*/
|
|
||||||
Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , /*0x2F*/
|
|
||||||
Vif1CMDSTRowCol, Vif1CMDSTRowCol, Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , /*0x37*/
|
|
||||||
Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , /*0x3F*/
|
|
||||||
Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , /*0x47*/
|
|
||||||
Vif1CMDNull , Vif1CMDNull , Vif1CMDMPGTransfer, Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , Vif1CMDNull , /*0x4F*/
|
|
||||||
Vif1CMDDirectHL, Vif1CMDDirectHL
|
|
||||||
};
|
|
||||||
|
|
|
@ -15,24 +15,30 @@
|
||||||
|
|
||||||
#include "PrecompiledHeader.h"
|
#include "PrecompiledHeader.h"
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
#include "GS.h"
|
||||||
|
#include "Gif.h"
|
||||||
#include "Vif_Dma.h"
|
#include "Vif_Dma.h"
|
||||||
|
#include "newVif.h"
|
||||||
#include "VUmicro.h"
|
#include "VUmicro.h"
|
||||||
|
|
||||||
template void vuExecMicro<0>(u32 addr);
|
#define _vifT template <int idx>
|
||||||
template void vuExecMicro<1>(u32 addr);
|
#define vifX (idx ? vif1 : vif0)
|
||||||
template<const u32 VIFdmanum> void vuExecMicro(u32 addr)
|
#define vifXRegs (idx ? (vif1Regs) : (vif0Regs))
|
||||||
{
|
#define vif1Only() { if (!idx) { vifCMD_Null<idx>(); return; } }
|
||||||
VURegs * VU;
|
|
||||||
if (!VIFdmanum) { VU = &VU0; vif0FLUSH(); }
|
|
||||||
else { VU = &VU1; vif1FLUSH(); }
|
|
||||||
|
|
||||||
if (VU->vifRegs->itops > (VIFdmanum ? 0x3ffu : 0xffu))
|
_f void vuExecMicro(int idx, u32 addr) {
|
||||||
Console.WriteLn("VIF%d ITOP overrun! %x", VIFdmanum, VU->vifRegs->itops);
|
VURegs* VU = nVif[idx].VU;
|
||||||
|
if (!idx) vif0FLUSH();
|
||||||
|
else vif1FLUSH();
|
||||||
|
|
||||||
|
if (VU->vifRegs->itops > (idx ? 0x3ffu : 0xffu)) {
|
||||||
|
Console.WriteLn("VIF%d ITOP overrun! %x", idx, VU->vifRegs->itops);
|
||||||
|
VU->vifRegs->itops &= (idx ? 0x3ffu : 0xffu);
|
||||||
|
}
|
||||||
|
|
||||||
VU->vifRegs->itop = VU->vifRegs->itops;
|
VU->vifRegs->itop = VU->vifRegs->itops;
|
||||||
|
|
||||||
if (VIFdmanum == 1)
|
if (idx) {
|
||||||
{
|
|
||||||
// in case we're handling a VIF1 execMicro, set the top with the tops value
|
// in case we're handling a VIF1 execMicro, set the top with the tops value
|
||||||
VU->vifRegs->top = VU->vifRegs->tops & 0x3ff;
|
VU->vifRegs->top = VU->vifRegs->tops & 0x3ff;
|
||||||
|
|
||||||
|
@ -43,12 +49,216 @@ template<const u32 VIFdmanum> void vuExecMicro(u32 addr)
|
||||||
VU->vifRegs->stat.DBF = false;
|
VU->vifRegs->stat.DBF = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// it is not, so set tops with base + offset, and set stat DBF flag
|
// it is not, so set tops with base + offset, and set stat DBF flag
|
||||||
VU->vifRegs->tops = VU->vifRegs->base + VU->vifRegs->ofst;
|
VU->vifRegs->tops = VU->vifRegs->base + VU->vifRegs->ofst;
|
||||||
VU->vifRegs->stat.DBF = true;
|
VU->vifRegs->stat.DBF = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!VIFdmanum) vu0ExecMicro(addr);
|
if (!idx) vu0ExecMicro(addr);
|
||||||
else vu1ExecMicro(addr);
|
else vu1ExecMicro(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_f void vifFlush(int idx) {
|
||||||
|
if (!idx) vif0FLUSH();
|
||||||
|
else vif1FLUSH();
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 schedulepath3msk = 0;
|
||||||
|
|
||||||
|
void Vif1MskPath3() {
|
||||||
|
|
||||||
|
vif1Regs->mskpath3 = schedulepath3msk & 0x1;
|
||||||
|
//Console.WriteLn("VIF MSKPATH3 %x", vif1Regs->mskpath3);
|
||||||
|
|
||||||
|
if (vif1Regs->mskpath3) {
|
||||||
|
gifRegs->stat.M3P = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//Let the Gif know it can transfer again (making sure any vif stall isnt unset prematurely)
|
||||||
|
Path3progress = TRANSFER_MODE;
|
||||||
|
gifRegs->stat.IMT = false;
|
||||||
|
CPU_INT(2, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
schedulepath3msk = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
// Vif0/Vif1 Commands (VifCodes)
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
|
_vifT void vifCMD_Base() // BASE
|
||||||
|
{
|
||||||
|
vif1Only();
|
||||||
|
vif1Regs->base = vif1Regs->code & 0x3ff;
|
||||||
|
vif1.cmd &= ~0x7f;
|
||||||
|
}
|
||||||
|
|
||||||
|
_vifT void vifCMD_DirectHL() // DIRECT/HL
|
||||||
|
{
|
||||||
|
vif1Only();
|
||||||
|
int vifImm = (u16)vif1Regs->code;
|
||||||
|
if(!vifImm) vif1.tag.size = 65536 << 2;
|
||||||
|
else vif1.tag.size = vifImm << 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
_vifT void vifCMD_FlushE()
|
||||||
|
{
|
||||||
|
vifFlush(idx);
|
||||||
|
vifX.cmd &= ~0x7f;
|
||||||
|
}
|
||||||
|
|
||||||
|
_vifT void vifCMD_Flush()
|
||||||
|
{
|
||||||
|
vif1Only();
|
||||||
|
vifFlush(idx);
|
||||||
|
vifX.cmd &= ~0x7f;
|
||||||
|
}
|
||||||
|
|
||||||
|
_vifT void vifCMD_FlushA()
|
||||||
|
{
|
||||||
|
vif1Only();
|
||||||
|
vifFlush(idx);
|
||||||
|
|
||||||
|
// Gif is already transferring so wait for it.
|
||||||
|
if (((Path3progress != STOPPED_MODE) || !vif1Regs->mskpath3) && gif->chcr.STR) {
|
||||||
|
vif1Regs->stat.VGW = true;
|
||||||
|
CPU_INT(2, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
vifX.cmd &= ~0x7f;
|
||||||
|
}
|
||||||
|
|
||||||
|
_vifT void vifCMD_ITop()
|
||||||
|
{
|
||||||
|
vifXRegs->itops = vifXRegs->code & 0x3ff;
|
||||||
|
vifX.cmd &= ~0x7f;
|
||||||
|
}
|
||||||
|
|
||||||
|
_vifT void vifCMD_Mark()
|
||||||
|
{
|
||||||
|
vifXRegs->mark = (u16)vifXRegs->code;
|
||||||
|
vifXRegs->stat.MRK = true;
|
||||||
|
vifX.cmd &= ~0x7f;
|
||||||
|
}
|
||||||
|
|
||||||
|
_vifT void vifCMD_MPG()
|
||||||
|
{
|
||||||
|
if (!idx) vifFlush(idx); // Only Vif0 Flush!?
|
||||||
|
int vifNum = (u8)(vifXRegs->code >> 16);
|
||||||
|
if(!vifNum) vifNum = 256;
|
||||||
|
|
||||||
|
vifX.tag.addr = (u16)((vifXRegs->code) << 3) & (idx ? 0x3fff : 0xfff);
|
||||||
|
vifX.tag.size = vifNum * 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
_vifT void vifCMD_MSCALF()
|
||||||
|
{
|
||||||
|
if (idx) vif1FLUSH(); // Only Vif1 Flush!?
|
||||||
|
vuExecMicro(idx, (u16)(vifXRegs->code) << 3);
|
||||||
|
vifX.cmd &= ~0x7f;
|
||||||
|
}
|
||||||
|
|
||||||
|
_vifT void vifCMD_MSCNT()
|
||||||
|
{
|
||||||
|
vuExecMicro(idx, -1);
|
||||||
|
vifX.cmd &= ~0x7f;
|
||||||
|
}
|
||||||
|
|
||||||
|
_vifT void vifCMD_MskPath3()
|
||||||
|
{
|
||||||
|
vif1Only();
|
||||||
|
if (vif1ch->chcr.STR) {
|
||||||
|
schedulepath3msk = 0x10 | ((vif1Regs->code >> 15) & 0x1);
|
||||||
|
vif1.vifstalled = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
schedulepath3msk = (vif1Regs->code >> 15) & 0x1;
|
||||||
|
Vif1MskPath3();
|
||||||
|
}
|
||||||
|
vif1.cmd &= ~0x7f;
|
||||||
|
}
|
||||||
|
|
||||||
|
_vifT void vifCMD_Nop()
|
||||||
|
{
|
||||||
|
vifX.cmd &= ~0x7f;
|
||||||
|
}
|
||||||
|
|
||||||
|
_vifT void vifCMD_Null() // invalid opcode
|
||||||
|
{
|
||||||
|
// if ME1, then force the vif to interrupt
|
||||||
|
if (!(vifXRegs->err.ME1)) //Ignore vifcode and tag mismatch error
|
||||||
|
{
|
||||||
|
Console.WriteLn("UNKNOWN VifCmd: %x", vifX.cmd);
|
||||||
|
vifXRegs->stat.ER1 = true;
|
||||||
|
vifX.irq++;
|
||||||
|
}
|
||||||
|
if (!idx) vifX.cmd &= ~0x7f; // FixMe: vif0/vif1 should do the same thing!?
|
||||||
|
else vifX.cmd = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
_vifT void vifCMD_Offset()
|
||||||
|
{
|
||||||
|
vif1Only();
|
||||||
|
vif1Regs->ofst = vif1Regs->code & 0x3ff;
|
||||||
|
vif1Regs->stat.DBF = false;
|
||||||
|
vif1Regs->tops = vif1Regs->base;
|
||||||
|
vif1.cmd &= ~0x7f;
|
||||||
|
}
|
||||||
|
|
||||||
|
_vifT void vifCMD_STCycl()
|
||||||
|
{
|
||||||
|
vifXRegs->cycle.cl = (u8)(vifXRegs->code);
|
||||||
|
vifXRegs->cycle.wl = (u8)(vifXRegs->code >> 8);
|
||||||
|
vifX.cmd &= ~0x7f;
|
||||||
|
}
|
||||||
|
|
||||||
|
_vifT void vifCMD_STMask()
|
||||||
|
{
|
||||||
|
vifX.tag.size = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
_vifT void vifCMD_STMod()
|
||||||
|
{
|
||||||
|
vifXRegs->mode = vifXRegs->code & 0x3;
|
||||||
|
vifX.cmd &= ~0x7f;
|
||||||
|
}
|
||||||
|
|
||||||
|
_vifT void vifCMD_STRowCol() // STROW / STCOL
|
||||||
|
{
|
||||||
|
vifX.tag.addr = 0;
|
||||||
|
vifX.tag.size = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
// Vif0/Vif1 CMD Tables
|
||||||
|
//------------------------------------------------------------------
|
||||||
|
|
||||||
|
void (*Vif0CMDTLB[82])() = {
|
||||||
|
vifCMD_Nop<0> , vifCMD_STCycl<0> , vifCMD_Offset<0>, vifCMD_Base<0> , vifCMD_ITop<0> , vifCMD_STMod<0> , vifCMD_MskPath3<0>, vifCMD_Mark<0> , /*0x00*/
|
||||||
|
vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , /*0x08*/
|
||||||
|
vifCMD_FlushE<0> , vifCMD_Flush<0> , vifCMD_Null<0> , vifCMD_FlushA<0>, vifCMD_MSCALF<0>, vifCMD_MSCALF<0>, vifCMD_Null<0> , vifCMD_MSCNT<0>, /*0x10*/
|
||||||
|
vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , /*0x18*/
|
||||||
|
vifCMD_STMask<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , /*0x20*/
|
||||||
|
vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , /*0x28*/
|
||||||
|
vifCMD_STRowCol<0>, vifCMD_STRowCol<0>, vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , /*0x30*/
|
||||||
|
vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , /*0x38*/
|
||||||
|
vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , /*0x40*/
|
||||||
|
vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_MPG<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , vifCMD_Null<0> , /*0x48*/
|
||||||
|
vifCMD_DirectHL<0>, vifCMD_DirectHL<0>
|
||||||
|
};
|
||||||
|
|
||||||
|
void (*Vif1CMDTLB[82])() = {
|
||||||
|
vifCMD_Nop<1> , vifCMD_STCycl<1> , vifCMD_Offset<1>, vifCMD_Base<1> , vifCMD_ITop<1> , vifCMD_STMod<1> , vifCMD_MskPath3<1>, vifCMD_Mark<1> , /*0x00*/
|
||||||
|
vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , /*0x08*/
|
||||||
|
vifCMD_FlushE<1> , vifCMD_Flush<1> , vifCMD_Null<1> , vifCMD_FlushA<1>, vifCMD_MSCALF<1>, vifCMD_MSCALF<1>, vifCMD_Null<1> , vifCMD_MSCNT<1>, /*0x10*/
|
||||||
|
vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , /*0x18*/
|
||||||
|
vifCMD_STMask<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , /*0x20*/
|
||||||
|
vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , /*0x28*/
|
||||||
|
vifCMD_STRowCol<1>, vifCMD_STRowCol<1>, vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , /*0x30*/
|
||||||
|
vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , /*0x38*/
|
||||||
|
vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , /*0x40*/
|
||||||
|
vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_MPG<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , vifCMD_Null<1> , /*0x48*/
|
||||||
|
vifCMD_DirectHL<1>, vifCMD_DirectHL<1>
|
||||||
|
};
|
||||||
|
|
|
@ -78,7 +78,6 @@ static const unsigned int VIF1intc = 5;
|
||||||
|
|
||||||
extern int g_vifCycles;
|
extern int g_vifCycles;
|
||||||
|
|
||||||
template<const u32 VIFdmanum> void vuExecMicro(u32 addr);
|
|
||||||
extern void vif0FLUSH();
|
extern void vif0FLUSH();
|
||||||
extern void vif1FLUSH();
|
extern void vif1FLUSH();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue