mirror of
https://github.com/hch12907/orbum.git
synced 2024-05-20 05:00:48 -04:00
VIF: Implement SET instructions
This commit is contained in:
parent
afcde2166d
commit
db74f7dd49
|
@ -7,7 +7,7 @@
|
|||
void CVif::STCYCL(VifUnit_Base* unit, const VifcodeInstruction inst)
|
||||
{
|
||||
// Writes CODE.IMMEDIATE to CYCLE
|
||||
uword immediate = inst.imm();
|
||||
const uword immediate = inst.imm();
|
||||
unit->cycle.write_uword(immediate);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ void CVif::OFFSET(VifUnit_Base* unit, const VifcodeInstruction inst)
|
|||
unit->stat.insert_field(VifUnitRegister_Stat::DBF, 0);
|
||||
|
||||
// Writes the lower 10 bits of CODE.IMMEDIATE to OFST
|
||||
uword immediate = inst.imm();
|
||||
const uword immediate = inst.imm();
|
||||
unit->ofst.insert_field(VifUnitRegister_Ofst::OFFSET, immediate);
|
||||
|
||||
// Transfer BASE to TOPS
|
||||
|
@ -43,26 +43,28 @@ void CVif::BASE(VifUnit_Base* unit, const VifcodeInstruction inst)
|
|||
}
|
||||
|
||||
// Writes the lower 10 bits of CODE.IMMEDIATE to BASE
|
||||
uword immediate = inst.imm();
|
||||
const uword immediate = inst.imm();
|
||||
unit->base.insert_field(VifUnitRegister_Base::BASE, immediate);
|
||||
}
|
||||
|
||||
// Refer to EE Users Manual pg 107.
|
||||
void CVif::ITOP(VifUnit_Base* unit, const VifcodeInstruction inst)
|
||||
{
|
||||
uword immediate = inst.imm();
|
||||
const uword immediate = inst.imm();
|
||||
unit->itops.insert_field(VifUnitRegister_Itops::ITOPS, immediate);
|
||||
}
|
||||
|
||||
// Refer to EE Users Manual pg 108.
|
||||
void CVif::STMOD(VifUnit_Base* unit, const VifcodeInstruction inst)
|
||||
{
|
||||
uword immediate = inst.imm();
|
||||
const uword immediate = inst.imm();
|
||||
unit->mode.insert_field(VifUnitRegister_Mode::MOD, immediate);
|
||||
}
|
||||
|
||||
void CVif::MSKPATH3(VifUnit_Base* unit, const VifcodeInstruction inst)
|
||||
{
|
||||
RResources& r = core->get_resources();
|
||||
|
||||
// VIF1 only
|
||||
if (unit->core_id != 1)
|
||||
{
|
||||
|
@ -70,23 +72,42 @@ void CVif::MSKPATH3(VifUnit_Base* unit, const VifcodeInstruction inst)
|
|||
return;
|
||||
}
|
||||
|
||||
// TODO: Implement this when GIF is implemented
|
||||
const uword immediate = inst.imm();
|
||||
const bool should_mask = immediate >> 15;
|
||||
|
||||
r.ee.gif.stat.insert_field(GifRegister_Stat::M3P, should_mask);
|
||||
}
|
||||
|
||||
void CVif::MARK(VifUnit_Base* unit, const VifcodeInstruction inst)
|
||||
{
|
||||
uword immediate = inst.imm();
|
||||
const uword immediate = inst.imm();
|
||||
unit->mark.insert_field(VifUnitRegister_Mark::MARK, immediate);
|
||||
}
|
||||
|
||||
void CVif::STMASK(VifUnit_Base* unit, const VifcodeInstruction inst)
|
||||
{
|
||||
if (unit->packets_left)
|
||||
return;
|
||||
|
||||
unit->mask.write_uword(unit->processing_data);
|
||||
}
|
||||
|
||||
void CVif::STROW(VifUnit_Base* unit, const VifcodeInstruction inst)
|
||||
{
|
||||
if (unit->packets_left >= 4)
|
||||
return;
|
||||
|
||||
SizedWordRegister* row_regs[4] = { &unit->r3, &unit->r2, &unit->r1, &unit->r0 };
|
||||
|
||||
row_regs[unit->packets_left]->write_uword(unit->processing_data);
|
||||
}
|
||||
|
||||
void CVif::STCOL(VifUnit_Base* unit, const VifcodeInstruction inst)
|
||||
{
|
||||
if (unit->packets_left >= 4)
|
||||
return;
|
||||
|
||||
SizedWordRegister* col_regs[4] = { &unit->c3, &unit->c2, &unit->c1, &unit->c0 };
|
||||
|
||||
col_regs[unit->packets_left]->write_uword(unit->processing_data);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue