示例#1
0
 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("}}");
     }
 }
示例#2
0
 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);
 }
示例#3
0
 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);
 }
示例#4
0
 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);
 }
示例#5
0
 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);
 }
示例#6
0
 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);
 }
示例#7
0
 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);
 }
示例#8
0
 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);
 }
示例#9
0
 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();
     }
 }
示例#10
0
 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();
     }
 }
示例#11
0
 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();
     }
 }
示例#12
0
 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);
     }
 }
示例#13
0
 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();
     }
 }
示例#14
0
 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();
     }
 }
示例#15
0
 public override string ToString(Program p,int address)
 {
     return string.Format("JAL {0:X}",(address & ~0xFFFFFFF) | target << 2);
 }
示例#16
0
 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);
 }
示例#17
0
 public abstract void Discompile(Program p,int address,bool direct);
示例#18
0
 public override void Discompile(Program p,int address,bool direct)
 {
     throw new PSXException("Unrecognized opcode.");
 }
示例#19
0
 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);
 }
示例#20
0
 public override void Discompile(Program p,int address,bool direct)
 {
     p.WriteLine("EMU_Break({0});",func);
 }
示例#21
0
 public override void Mark(Program p,int address)
 {
     base.Mark(p,address);
     p.MarkBranch(address + offset * 4 + 4);
 }
示例#22
0
 public virtual string ToString(Program p,int address)
 {
     return ToString();
 }
示例#23
0
 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);
 }
示例#24
0
 public override string ToString(Program p,int address)
 {
     return string.Format("BGEZAL ${0},{1:X}",rs,address + offset * 4 + 4);
 }
示例#25
0
 public override void Mark(Program p,int address)
 {
     p.MarkDelaySlot(address + 4);
     p.MarkBranch(address + 8);
     p.MarkCall((address & ~0xFFFFFFF) | target << 2,address + 8);
 }
示例#26
0
 public virtual void Mark(Program p,int address)
 {
     p.MarkDirect(address + 4);
 }
示例#27
0
 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);
 }
示例#28
0
 public override void Discompile(Program p,int address,bool direct)
 {
 }
示例#29
0
 public override string ToString(Program p,int address)
 {
     return string.Format("BNE ${0},${1},{2:X}",rs,rt,address + offset * 4 + 4);
 }
示例#30
0
 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);
 }