public override void Discompile(Program p,int address,bool direct) { //p.WriteLine("ZZ_ONCEBRANCH(0x{0:X},{1});",address,p.Clocks);return; if (!direct) throw new PSXException(); Word nextword = p[address + 4]; Word branchword = p[address + offset * 4 + 4]; if (rs == Register.R0) { nextword.Discompile(false); p.WriteClocks(1,branchword.Address); p.WriteLine("goto {0};",branchword.Label); } else { p.WriteLine("if ((int32_t){0} >= 0)",rs); p.WriteLine("{{"); p.Indent(); nextword.Discompile(false); p.WriteClocks(1,branchword.Address); p.WriteLine("goto {0};",branchword.Label); p.Unindent(); p.WriteLine("}}"); } }
public override void Discompile(Program p,int address,bool direct) { //p.WriteLine("ZZ_ONCE(0x{0:X});",address);return; if (rt == rd) p.WriteLine("{0} >>= {1};",rd,rs); else p.WriteLine("{0} = {1} >> {2};",rd,rt,rs); }
public override void Discompile(Program p,int address,bool direct) { //p.WriteLine("ZZ_ONCE(0x{0:X});",address);return; if (imm == 0) p.WriteLine("EMU_WriteRight({0},{1});",rs,rt); else p.WriteLine("EMU_WriteRight({0} + {1},{2}); //+ 0x{1:X}",rs,imm,rt); }
public override void Discompile(Program p,int address,bool direct) { //p.WriteLine("ZZ_ONCE(0x{0:X});",address);return; if (rs == Register.R0) p.WriteLine("{0} = -{1};",rd,rt); else p.WriteLine("{0} = {1} - {2};",rd,rs,rt); }
public override void Mark(Program p,int address) { if (rs == Register.R0) p.MarkDelaySlot(address + 4); else base.Mark(p,address); p.MarkBranch(address + offset * 4 + 4); }
public override void Discompile(Program p,int address,bool direct) { //p.WriteLine("ZZ_ONCE(0x{0:X});",address);return; if (rs == rd) p.WriteLine("{0} &= 0x{1:X};",rd,imm); else p.WriteLine("{0} = {1} & 0x{2:X};",rd,rs,imm); }
public override void Discompile(Program p,int address,bool direct) { //p.WriteLine("ZZ_ONCE(0x{0:X});",address);return; if (imm == 0) p.WriteLine("{0} = EMU_ReadU16({1});",rd,rs); else if (imm < 0) p.WriteLine("{0} = EMU_ReadU16({1} - {2}); //+ 0x{3:X}",rd,rs,-imm,imm); else p.WriteLine("{0} = EMU_ReadU16({1} + {2}); //+ 0x{2:X}",rd,rs,imm); }
public override void Discompile(Program p,int address,bool direct) { //p.WriteLine("ZZ_ONCEBRANCH(0x{0:X},{1});",address,p.Clocks);return; if (!direct) throw new PSXException(); Word nextword = p[address + 4]; Word branchword = p[(address & ~0xFFFFFFF) | target << 2]; nextword.Discompile(false); p.WriteClocks(1,branchword.Address); p.WriteLine("goto {0};",branchword.Label); }
public override void Discompile(Program p,int address,bool direct) { //p.WriteLine("ZZ_ONCE(0x{0:X});",address);return; if (copid == 0) { p.WriteLine("{0} = COP0_GetRegister({1});",rd,coprs); } else if (copid == 2) { p.WriteLine("{0} = GTE_GetDataRegister({1});",rd,coprs); } else { throw new PSXException(); } }
public override void Discompile(Program p,int address,bool direct) { //p.WriteLine("ZZ_ONCE(0x{0:X});",address);return; if (copid == 0) { p.WriteLine("COP0_Execute({0});",copargs); } else if (copid == 2) { p.WriteLine("GTE_Execute({0});",copargs); } else { throw new PSXException(); } }
public override void Discompile(Program p,int address,bool direct) { //p.WriteLine("ZZ_ONCE(0x{0:X});",address);return; if (copid == 0) { throw new PSXException(); } else if (copid == 2) { p.WriteLine("GTE_SetControlRegister({0},{1});",coprd,rs); } else { throw new PSXException(); } }
public override void Discompile(Program p,int address,bool direct) { //p.WriteLine("ZZ_ONCE(0x{0:X});",address);return; if (rs == Register.R0) p.WriteLine("{0} = {1};",rd,imm); else if (imm < 0) { if (rs == rd) p.WriteLine("{0} -= {1};",rd,-imm); else p.WriteLine("{0} = {1} - {2};",rd,rs,-imm); } else { if (rs == rd) p.WriteLine("{0} += {1};",rd,imm); else p.WriteLine("{0} = {1} + {2};",rd,rs,imm); } }
public override void Discompile(Program p,int address,bool direct) { //p.WriteLine("ZZ_ONCE(0x{0:X});",address);return; if (copid == 0) { if (imm == 0) p.WriteLine("EMU_Write32({0},COP0_GetRegister({1}));",rs,coprt); else p.WriteLine("EMU_Write32({0} + {1},COP0_GetRegister({2})); //+ 0x{1:X}",rs,imm,coprt); } else if (copid == 2) { if (imm == 0) p.WriteLine("EMU_Write32({0},GTE_GetDataRegister({1}));",rs,coprt); else p.WriteLine("EMU_Write32({0} + {1},GTE_GetDataRegister({2})); //+ 0x{1:X}",rs,imm,coprt); } else { throw new PSXException(); } }
public override void Discompile(Program p,int address,bool direct) { //p.WriteLine("ZZ_ONCE(0x{0:X});",address);return; if (copid == 0) { if (imm == 0) p.WriteLine("COP0_SetRegister({0},EMU_ReadU32({1}));",coprd,rs); else p.WriteLine("COP0_SetRegister({0},EMU_ReadU32({1} + {2})); //+ 0x{2:X}",coprd,rs,imm); } else if (copid == 2) { if (imm == 0) p.WriteLine("GTE_SetDataRegister({0},EMU_ReadU32({1}));",coprd,rs); else p.WriteLine("GTE_SetDataRegister({0},EMU_ReadU32({1} + {2})); //+ 0x{2:X}",coprd,rs,imm); } else { throw new PSXException(); } }
public override string ToString(Program p,int address) { return string.Format("JAL {0:X}",(address & ~0xFFFFFFF) | target << 2); }
public override void Discompile(Program p,int address,bool direct) { //p.WriteLine("ZZ_ONCE(0x{0:X});",address);return; p.WriteLine("{0} = EMU_CheckedAdd({1},{2});",rd,rs,rt); }
public abstract void Discompile(Program p,int address,bool direct);
public override void Discompile(Program p,int address,bool direct) { throw new PSXException("Unrecognized opcode."); }
public override void Discompile(Program p,int address,bool direct) { //p.WriteLine("ZZ_ONCE(0x{0:X});",address);return; p.WriteLine("EMU_UDivide({0},{1});",rs,rt); }
public override void Discompile(Program p,int address,bool direct) { p.WriteLine("EMU_Break({0});",func); }
public override void Mark(Program p,int address) { base.Mark(p,address); p.MarkBranch(address + offset * 4 + 4); }
public virtual string ToString(Program p,int address) { return ToString(); }
public override void Discompile(Program p,int address,bool direct) { //p.WriteLine("ZZ_ONCE(0x{0:X});",address);return; p.WriteLine("EMU_Syscall(0x{0:X});",address); }
public override string ToString(Program p,int address) { return string.Format("BGEZAL ${0},{1:X}",rs,address + offset * 4 + 4); }
public override void Mark(Program p,int address) { p.MarkDelaySlot(address + 4); p.MarkBranch(address + 8); p.MarkCall((address & ~0xFFFFFFF) | target << 2,address + 8); }
public virtual void Mark(Program p,int address) { p.MarkDirect(address + 4); }
public override void Discompile(Program p,int address,bool direct) { //p.WriteLine("ZZ_ONCE(0x{0:X});",address);return; p.WriteLine("{0} = {1} < {2};",rd,rs,imm); }
public override void Discompile(Program p,int address,bool direct) { }
public override string ToString(Program p,int address) { return string.Format("BNE ${0},${1},{2:X}",rs,rt,address + offset * 4 + 4); }
public override void Discompile(Program p,int address,bool direct) { //p.WriteLine("ZZ_ONCE(0x{0:X});",address);return; p.WriteLine("{0} = (int32_t){1} >> {2};",rd,rt,shamt); }