Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interpolate in cores #1533

Merged
merged 4 commits into from
Jun 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions BizHawk.Emulation.Cores/CPUs/68000/Diassembler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ public sealed class DisassemblyInfo
public string RawBytes;
public int Length;

public override string ToString()
YoshiRulz marked this conversation as resolved.
Show resolved Hide resolved
{
return string.Format("{0:X6}: {1,-20} {2,-8} {3}", PC, RawBytes, Mnemonic, Args);
}
public override string ToString() => $"{PC:X6}: {RawBytes,-20} {Mnemonic,-8} {Args}";
}

partial class MC68000
Expand Down
48 changes: 24 additions & 24 deletions BizHawk.Emulation.Cores/CPUs/68000/Instructions/BitArithemetic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ void AND0_Disasm(DisassemblyInfo info)
{
case 0: // Byte
info.Mnemonic = "and.b";
info.Args = string.Format("{0}, D{1}", DisassembleValue(srcMode, srcReg, 1, ref pc), dstReg);
info.Args = $"{DisassembleValue(srcMode, srcReg, 1, ref pc)}, D{dstReg}";
break;
case 1: // Word
info.Mnemonic = "and.w";
info.Args = string.Format("{0}, D{1}", DisassembleValue(srcMode, srcReg, 2, ref pc), dstReg);
info.Args = $"{DisassembleValue(srcMode, srcReg, 2, ref pc)}, D{dstReg}";
break;
case 2: // Long
info.Mnemonic = "and.l";
info.Args = string.Format("{0}, D{1}", DisassembleValue(srcMode, srcReg, 4, ref pc), dstReg);
info.Args = $"{DisassembleValue(srcMode, srcReg, 4, ref pc)}, D{dstReg}";
break;
}

Expand Down Expand Up @@ -124,15 +124,15 @@ void AND1_Disasm(DisassemblyInfo info)
{
case 0: // Byte
info.Mnemonic = "and.b";
info.Args = string.Format("D{0}, {1}", srcReg, DisassembleValue(dstMode, dstReg, 1, ref pc));
info.Args = $"D{srcReg}, {DisassembleValue(dstMode, dstReg, 1, ref pc)}";
break;
case 1: // Word
info.Mnemonic = "and.w";
info.Args = string.Format("D{0}, {1}", srcReg, DisassembleValue(dstMode, dstReg, 2, ref pc));
info.Args = $"D{srcReg}, {DisassembleValue(dstMode, dstReg, 2, ref pc)}";
break;
case 2: // Long
info.Mnemonic = "and.l";
info.Args = string.Format("D{0}, {1}", srcReg, DisassembleValue(dstMode, dstReg, 4, ref pc));
info.Args = $"D{srcReg}, {DisassembleValue(dstMode, dstReg, 4, ref pc)}";
break;
}

Expand Down Expand Up @@ -200,23 +200,23 @@ void ANDI_Disasm(DisassemblyInfo info)
{
info.Mnemonic = "andi.b";
sbyte imm = (sbyte)ReadWord(pc); pc += 2;
info.Args = string.Format("#${0:X}, ", imm);
info.Args = $"#${imm:X}, ";
info.Args += DisassembleValue(dstMode, dstReg, 1, ref pc);
break;
}
case 1: // Word
{
info.Mnemonic = "andi.w";
short imm = ReadWord(pc); pc += 2;
info.Args = string.Format("#${0:X}, ", imm);
info.Args = $"#${imm:X}, ";
info.Args += DisassembleValue(dstMode, dstReg, 2, ref pc);
break;
}
case 2: // Long
{
info.Mnemonic = "andi.l";
int imm = ReadLong(pc); pc += 4;
info.Args = string.Format("#${0:X}, ", imm);
info.Args = $"#${imm:X}, ";
info.Args += DisassembleValue(dstMode, dstReg, 4, ref pc);
break;
}
Expand Down Expand Up @@ -283,15 +283,15 @@ void EOR_Disasm(DisassemblyInfo info)
{
case 0: // Byte
info.Mnemonic = "eor.b";
info.Args = string.Format("D{0}, {1}", srcReg, DisassembleValue(dstMode, dstReg, 1, ref pc));
info.Args = $"D{srcReg}, {DisassembleValue(dstMode, dstReg, 1, ref pc)}";
break;
case 1: // Word
info.Mnemonic = "eor.w";
info.Args = string.Format("D{0}, {1}", srcReg, DisassembleValue(dstMode, dstReg, 2, ref pc));
info.Args = $"D{srcReg}, {DisassembleValue(dstMode, dstReg, 2, ref pc)}";
break;
case 2: // Long
info.Mnemonic = "eor.l";
info.Args = string.Format("D{0}, {1}", srcReg, DisassembleValue(dstMode, dstReg, 4, ref pc));
info.Args = $"D{srcReg}, {DisassembleValue(dstMode, dstReg, 4, ref pc)}";
break;
}

Expand Down Expand Up @@ -355,21 +355,21 @@ void EORI_Disasm(DisassemblyInfo info)
{
info.Mnemonic = "eori.b";
sbyte immed = (sbyte)ReadWord(pc); pc += 2;
info.Args = String.Format("#${0:X}, {1}", immed, DisassembleValue(mode, reg, 1, ref pc));
info.Args = $"#${immed:X}, {DisassembleValue(mode, reg, 1, ref pc)}";
break;
}
case 1: // word
{
info.Mnemonic = "eori.w";
short immed = ReadWord(pc); pc += 2;
info.Args = String.Format("#${0:X}, {1}", immed, DisassembleValue(mode, reg, 2, ref pc));
info.Args = $"#${immed:X}, {DisassembleValue(mode, reg, 2, ref pc)}";
break;
}
case 2: // long
{
info.Mnemonic = "eori.l";
int immed = ReadLong(pc); pc += 4;
info.Args = String.Format("#${0:X}, {1}", immed, DisassembleValue(mode, reg, 4, ref pc));
info.Args = $"#${immed:X}, {DisassembleValue(mode, reg, 4, ref pc)}";
break;
}
}
Expand Down Expand Up @@ -423,15 +423,15 @@ void OR0_Disasm(DisassemblyInfo info)
{
case 0: // Byte
info.Mnemonic = "or.b";
info.Args = string.Format("{0}, D{1}", DisassembleValue(srcMode, srcReg, 1, ref pc), dstReg);
info.Args = $"{DisassembleValue(srcMode, srcReg, 1, ref pc)}, D{dstReg}";
break;
case 1: // Word
info.Mnemonic = "or.w";
info.Args = string.Format("{0}, D{1}", DisassembleValue(srcMode, srcReg, 2, ref pc), dstReg);
info.Args = $"{DisassembleValue(srcMode, srcReg, 2, ref pc)}, D{dstReg}";
break;
case 2: // Long
info.Mnemonic = "or.l";
info.Args = string.Format("{0}, D{1}", DisassembleValue(srcMode, srcReg, 4, ref pc), dstReg);
info.Args = $"{DisassembleValue(srcMode, srcReg, 4, ref pc)}, D{dstReg}";
break;
}

Expand Down Expand Up @@ -496,15 +496,15 @@ void OR1_Disasm(DisassemblyInfo info)
{
case 0: // Byte
info.Mnemonic = "or.b";
info.Args = string.Format("D{0}, {1}", srcReg, DisassembleValue(dstMode, dstReg, 1, ref pc));
info.Args = $"D{srcReg}, {DisassembleValue(dstMode, dstReg, 1, ref pc)}";
break;
case 1: // Word
info.Mnemonic = "or.w";
info.Args = string.Format("D{0}, {1}", srcReg, DisassembleValue(dstMode, dstReg, 2, ref pc));
info.Args = $"D{srcReg}, {DisassembleValue(dstMode, dstReg, 2, ref pc)}";
break;
case 2: // Long
info.Mnemonic = "or.l";
info.Args = string.Format("D{0}, {1}", srcReg, DisassembleValue(dstMode, dstReg, 4, ref pc));
info.Args = $"D{srcReg}, {DisassembleValue(dstMode, dstReg, 4, ref pc)}";
break;
}

Expand Down Expand Up @@ -568,21 +568,21 @@ void ORI_Disasm(DisassemblyInfo info)
{
info.Mnemonic = "ori.b";
sbyte immed = (sbyte)ReadWord(pc); pc += 2;
info.Args = String.Format("#${0:X}, {1}", immed, DisassembleValue(mode, reg, 1, ref pc));
info.Args = $"#${immed:X}, {DisassembleValue(mode, reg, 1, ref pc)}";
break;
}
case 1: // word
{
info.Mnemonic = "ori.w";
short immed = ReadWord(pc); pc += 2;
info.Args = String.Format("#${0:X}, {1}", immed, DisassembleValue(mode, reg, 2, ref pc));
info.Args = $"#${immed:X}, {DisassembleValue(mode, reg, 2, ref pc)}";
break;
}
case 2: // long
{
info.Mnemonic = "ori.l";
int immed = ReadLong(pc); pc += 4;
info.Args = String.Format("#${0:X}, {1}", immed, DisassembleValue(mode, reg, 4, ref pc));
info.Args = $"#${immed:X}, {DisassembleValue(mode, reg, 4, ref pc)}";
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void MOVEQ()
void MOVEQ_Disasm(DisassemblyInfo info)
{
info.Mnemonic = "moveq";
info.Args = String.Format("#{0}, D{1}", (sbyte)op, (op >> 9) & 7);
info.Args = $"#{(sbyte)op}, D{(op >> 9) & 7}";
}

void MOVEM0()
Expand Down Expand Up @@ -438,7 +438,7 @@ static string DisassembleRegisterList0(uint registers)
}
registers <<= 1;
}
//str.Append(string.Format("[{0:X4}]", registers >> 16));
//str.Append($"[{registers >> 16:X4}]");
return str.ToString();
}

Expand Down Expand Up @@ -493,7 +493,7 @@ static string DisassembleRegisterList1(uint registers)
}
registers >>= 1;
}
//str.Append(string.Format("[{0:X4}]", registers & 0xFFFF));
//str.Append($"[{registers & 0xFFFF:X4}]");
return str.ToString();
}

Expand Down
16 changes: 8 additions & 8 deletions BizHawk.Emulation.Cores/CPUs/68000/Instructions/IntegerMath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ void CMPM_Disasm(DisassemblyInfo info)
case 1: info.Mnemonic = "cmpm.w"; break;
case 2: info.Mnemonic = "cmpm.l"; break;
}
info.Args = string.Format("(A{0})+, (A{1})+", ayReg, axReg);
info.Args = $"(A{ayReg})+, (A{axReg})+";
info.Length = pc - info.PC;
}

Expand Down Expand Up @@ -1001,17 +1001,17 @@ void CMPI_Disasm(DisassemblyInfo info)
case 0:
immediate = (byte)ReadWord(pc); pc += 2;
info.Mnemonic = "cmpi.b";
info.Args = String.Format("#${0:X}, {1}", immediate, DisassembleValue(mode, reg, 1, ref pc));
info.Args = $"#${immediate:X}, {DisassembleValue(mode, reg, 1, ref pc)}";
break;
case 1:
immediate = ReadWord(pc); pc += 2;
info.Mnemonic = "cmpi.w";
info.Args = String.Format("#${0:X}, {1}", immediate, DisassembleValue(mode, reg, 2, ref pc));
info.Args = $"#${immediate:X}, {DisassembleValue(mode, reg, 2, ref pc)}";
break;
case 2:
immediate = ReadLong(pc); pc += 4;
info.Mnemonic = "cmpi.l";
info.Args = String.Format("#${0:X}, {1}", immediate, DisassembleValue(mode, reg, 4, ref pc));
info.Args = $"#${immediate:X}, {DisassembleValue(mode, reg, 4, ref pc)}";
break;
}
info.Length = pc - info.PC;
Expand Down Expand Up @@ -1042,7 +1042,7 @@ void MULU_Disasm(DisassemblyInfo info)

int pc = info.PC + 2;
info.Mnemonic = "mulu";
info.Args = String.Format("{0}, D{1}", DisassembleValue(mode, reg, 2, ref pc), dreg);
info.Args = $"{DisassembleValue(mode, reg, 2, ref pc)}, D{dreg}";
info.Length = pc - info.PC;
}

Expand Down Expand Up @@ -1071,7 +1071,7 @@ void MULS_Disasm(DisassemblyInfo info)

int pc = info.PC + 2;
info.Mnemonic = "muls";
info.Args = String.Format("{0}, D{1}", DisassembleValue(mode, reg, 2, ref pc), dreg);
info.Args = $"{DisassembleValue(mode, reg, 2, ref pc)}, D{dreg}";
info.Length = pc - info.PC;
}

Expand Down Expand Up @@ -1107,7 +1107,7 @@ void DIVU_Disasm(DisassemblyInfo info)

int pc = info.PC + 2;
info.Mnemonic = "divu";
info.Args = String.Format("{0}, D{1}", DisassembleValue(mode, reg, 2, ref pc), dreg);
info.Args = $"{DisassembleValue(mode, reg, 2, ref pc)}, D{dreg}";
info.Length = pc - info.PC;
}

Expand Down Expand Up @@ -1143,7 +1143,7 @@ void DIVS_Disasm(DisassemblyInfo info)

int pc = info.PC + 2;
info.Mnemonic = "divs";
info.Args = String.Format("{0}, D{1}", DisassembleValue(mode, reg, 2, ref pc), dreg);
info.Args = $"{DisassembleValue(mode, reg, 2, ref pc)}, D{dreg}";
info.Length = pc - info.PC;
}
}
Expand Down
30 changes: 15 additions & 15 deletions BizHawk.Emulation.Cores/CPUs/68000/Instructions/ProgramFlow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ void Bcc_Disasm(DisassemblyInfo info)
info.Mnemonic = "b" + DisassembleCondition(cond);
if (displacement8 != 0)
{
info.Args = string.Format("${0:X}", pc + displacement8);
info.Args = $"${pc + displacement8:X}";
}
else
{
info.Args = string.Format("${0:X}", pc + ReadWord(pc));
info.Args = $"${pc + ReadWord(pc):X}";
pc += 2;
}
info.Length = pc - info.PC;
Expand All @@ -122,10 +122,10 @@ void BRA_Disasm(DisassemblyInfo info)

sbyte displacement8 = (sbyte)op;
if (displacement8 != 0)
info.Args = String.Format("${0:X}", pc + displacement8);
info.Args = $"${pc + displacement8:X}";
else
{
info.Args = String.Format("${0:X}", pc + ReadWord(pc));
info.Args = $"${pc + ReadWord(pc):X}";
pc += 2;
}
info.Length = pc - info.PC;
Expand Down Expand Up @@ -158,10 +158,10 @@ void BSR_Disasm(DisassemblyInfo info)

sbyte displacement8 = (sbyte)op;
if (displacement8 != 0)
info.Args = String.Format("${0:X}", pc + displacement8);
info.Args = $"${pc + displacement8:X}";
else
{
info.Args = String.Format("${0:X}", pc + ReadWord(pc));
info.Args = $"${pc + ReadWord(pc):X}";
pc += 2;
}
info.Length = pc - info.PC;
Expand Down Expand Up @@ -201,7 +201,7 @@ void DBcc_Disasm(DisassemblyInfo info)
info.Mnemonic = "db" + DisassembleCondition(cond);

int pc = info.PC + 2;
info.Args = String.Format("D{0}, ${1:X}", op & 7, pc + ReadWord(pc));
info.Args = $"D{op & 7}, ${pc + ReadWord(pc):X}";
info.Length = 4;
}

Expand Down Expand Up @@ -319,7 +319,7 @@ void BTSTi_Disasm(DisassemblyInfo info)
int reg = op & 7;

info.Mnemonic = "btst";
info.Args = String.Format("#${0:X}, {1}", bit, DisassembleValue(mode, reg, 1, ref pc));
info.Args = $"#${bit:X}, {DisassembleValue(mode, reg, 1, ref pc)}";
info.Length = pc - info.PC;
}

Expand Down Expand Up @@ -354,7 +354,7 @@ void BTSTr_Disasm(DisassemblyInfo info)
int reg = op & 7;

info.Mnemonic = "btst";
info.Args = String.Format("D{0}, {1}", dReg, DisassembleValue(mode, reg, 1, ref pc));
info.Args = $"D{dReg}, {DisassembleValue(mode, reg, 1, ref pc)}";
info.Length = pc - info.PC;
}

Expand Down Expand Up @@ -392,7 +392,7 @@ void BCHGi_Disasm(DisassemblyInfo info)
int reg = op & 7;

info.Mnemonic = "bchg";
info.Args = String.Format("#${0:X}, {1}", bit, DisassembleValue(mode, reg, 1, ref pc));
info.Args = $"#${bit:X}, {DisassembleValue(mode, reg, 1, ref pc)}";
info.Length = pc - info.PC;
}

Expand Down Expand Up @@ -431,7 +431,7 @@ void BCHGr_Disasm(DisassemblyInfo info)
int reg = op & 7;

info.Mnemonic = "bchg";
info.Args = String.Format("D{0}, {1}", dReg, DisassembleValue(mode, reg, 1, ref pc));
info.Args = $"D{dReg}, {DisassembleValue(mode, reg, 1, ref pc)}";
info.Length = pc - info.PC;
}

Expand Down Expand Up @@ -469,7 +469,7 @@ void BCLRi_Disasm(DisassemblyInfo info)
int reg = op & 7;

info.Mnemonic = "bclr";
info.Args = String.Format("#${0:X}, {1}", bit, DisassembleValue(mode, reg, 1, ref pc));
info.Args = $"#${bit:X}, {DisassembleValue(mode, reg, 1, ref pc)}";
info.Length = pc - info.PC;
}

Expand Down Expand Up @@ -508,7 +508,7 @@ void BCLRr_Disasm(DisassemblyInfo info)
int reg = op & 7;

info.Mnemonic = "bclr";
info.Args = String.Format("D{0}, {1}", dReg, DisassembleValue(mode, reg, 1, ref pc));
info.Args = $"D{dReg}, {DisassembleValue(mode, reg, 1, ref pc)}";
info.Length = pc - info.PC;
}

Expand Down Expand Up @@ -546,7 +546,7 @@ void BSETi_Disasm(DisassemblyInfo info)
int reg = op & 7;

info.Mnemonic = "bset";
info.Args = String.Format("#${0:X}, {1}", bit, DisassembleValue(mode, reg, 1, ref pc));
info.Args = $"#${bit:X}, {DisassembleValue(mode, reg, 1, ref pc)}";
info.Length = pc - info.PC;
}

Expand Down Expand Up @@ -585,7 +585,7 @@ void BSETr_Disasm(DisassemblyInfo info)
int reg = op & 7;

info.Mnemonic = "bset";
info.Args = String.Format("D{0}, {1}", dReg, DisassembleValue(mode, reg, 1, ref pc));
info.Args = $"D{dReg}, {DisassembleValue(mode, reg, 1, ref pc)}";
info.Length = pc - info.PC;
}

Expand Down
Loading