Example #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("}}");
     }
 }
Example #2
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);
 }
Example #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);
 }
Example #4
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);
 }
Example #5
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);
 }
Example #6
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);
 }
Example #7
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 linkword = p[address + 8];
     Word branchword = p[(address & ~0xFFFFFFF) | target << 2];
     p.WriteLine("RA = 0x{0:X}; //{1}",linkword.Address,linkword.Label);
     nextword.Discompile(false);
     p.WriteClocks(1,branchword.Address);
     p.WriteLine("goto {0};",branchword.Label);
 }
Example #8
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_SetRegister({0},{1});",coprd,rs);
     }
     else if (copid == 2)
     {
         p.WriteLine("GTE_SetDataRegister({0},{1});",coprd,rs);
     }
     else
     {
         throw new PSXException();
     }
 }
Example #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("COP0_Execute({0});",copargs);
     }
     else if (copid == 2)
     {
         p.WriteLine("GTE_Execute({0});",copargs);
     }
     else
     {
         throw new PSXException();
     }
 }
Example #10
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);
     }
 }
Example #11
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();
     }
 }
Example #12
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();
     }
 }
Example #13
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 linkword = p[address + 8];
     p.WriteLine("ZZ_JUMPREGISTER_BEGIN({0});",rs);
     p.WriteLine("{0} = 0x{1:X}; //{2}",rd,linkword.Address,linkword.Label);
     nextword.Discompile(false);
     p.WriteClocksJR(1);
     if (p[address].Destinations.Count > 0)
     {
         foreach (Word destination in p[address].Destinations)
         {
             p.WriteLine("ZZ_JUMPREGISTER(0x{0:X},{1});",destination.Address,destination.Label);
         }
     }
     else
     {
         p.WriteLine("// UNIMPLEMENTED JUMP-TO-REGISTER-AND-LINK ({0},{1:X})",rs,address);
     }
     p.WriteLine("ZZ_JUMPREGISTER_END();");
 }
Example #14
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);
 }
Example #15
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);
 }
Example #16
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);
 }
Example #17
0
 public override void Discompile(Program p,int address,bool direct)
 {
     p.WriteLine("EMU_Break({0});",func);
 }
Example #18
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);
 }
Example #19
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);
 }