예제 #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
파일: Instruction.cs 프로젝트: wurlyfox/c1c
 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
파일: Instruction.cs 프로젝트: wurlyfox/c1c
 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
파일: Instruction.cs 프로젝트: wurlyfox/c1c
 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);
 }