Rename the M6502 disassembler class to something a little better grammatically.

This commit is contained in:
Adrian Conlon 2019-02-20 22:21:14 +00:00
parent 4ee184eaf4
commit 28516bbc84
4 changed files with 22 additions and 22 deletions

View File

@ -6,14 +6,14 @@ namespace EightBit
{ {
using System.Text; using System.Text;
public class Disassembly public class Disassembler
{ {
private readonly Bus bus; private readonly Bus bus;
private readonly M6502 processor; private readonly M6502 processor;
private readonly Symbols symbols; private readonly Symbols symbols;
private ushort address; private ushort address;
public Disassembly(Bus bus, M6502 processor, Symbols symbols) public Disassembler(Bus bus, M6502 processor, Symbols symbols)
{ {
this.bus = bus; this.bus = bus;
this.processor = processor; this.processor = processor;
@ -555,7 +555,7 @@ namespace EightBit
private string Dump_Byte(ushort absolute) private string Dump_Byte(ushort absolute)
{ {
return Disassembly.Dump_ByteValue(this.GetByte(absolute)); return Disassembler.Dump_ByteValue(this.GetByte(absolute));
} }
private string Dump_DByte(ushort absolute) private string Dump_DByte(ushort absolute)
@ -565,7 +565,7 @@ namespace EightBit
private string Dump_Word(ushort absolute) private string Dump_Word(ushort absolute)
{ {
return Disassembly.Dump_WordValue(this.GetWord(absolute)); return Disassembler.Dump_WordValue(this.GetWord(absolute));
} }
private string Disassemble_Implied(string instruction) private string Disassemble_Implied(string instruction)
@ -585,7 +585,7 @@ namespace EightBit
private string Disassemble_Relative(string instruction, ushort absolute) private string Disassemble_Relative(string instruction, ushort absolute)
{ {
return this.AM_Immediate_dump() + "\t" + instruction + " $" + Disassembly.Dump_WordValue(absolute); return this.AM_Immediate_dump() + "\t" + instruction + " $" + Disassembler.Dump_WordValue(absolute);
} }
private string Disassemble_Immediate(string instruction) private string Disassemble_Immediate(string instruction)

View File

@ -11,9 +11,8 @@ namespace M6502.Test
{ {
private readonly Configuration configuration; private readonly Configuration configuration;
private readonly Ram ram; private readonly Ram ram;
private readonly M6502 cpu;
private readonly Symbols symbols; private readonly Symbols symbols;
private readonly Disassembly disassembler; private readonly Disassembler disassembler;
private readonly MemoryMapping mapping; private readonly MemoryMapping mapping;
private ushort oldPC; private ushort oldPC;
@ -22,15 +21,15 @@ namespace M6502.Test
{ {
this.configuration = configuration; this.configuration = configuration;
this.ram = new Ram(0x10000); this.ram = new Ram(0x10000);
this.cpu = new M6502(this); this.CPU = new M6502(this);
this.symbols = new Symbols(); this.symbols = new Symbols();
this.disassembler = new Disassembly(this, this.cpu, this.symbols); this.disassembler = new Disassembler(this, this.CPU, this.symbols);
this.mapping = new MemoryMapping(this.ram, 0x0000, (ushort)Mask.Mask16, AccessLevel.ReadWrite); this.mapping = new MemoryMapping(this.ram, 0x0000, (ushort)Mask.Mask16, AccessLevel.ReadWrite);
this.oldPC = (ushort)Mask.Mask16; this.oldPC = (ushort)Mask.Mask16;
} }
public M6502 CPU { get => this.cpu; } public M6502 CPU { get; }
public override void RaisePOWER() public override void RaisePOWER()
{ {
@ -64,7 +63,7 @@ namespace M6502.Test
this.CPU.ExecutedInstruction += this.CPU_ExecutedInstruction; this.CPU.ExecutedInstruction += this.CPU_ExecutedInstruction;
this.Poke(0x00, 0x4c); this.Poke(0x00, 0x4c);
this.cpu.PokeWord(0x01, this.configuration.StartAddress); this.CPU.PokeWord(0x01, this.configuration.StartAddress);
} }
public override MemoryMapping Mapping(ushort absolute) => this.mapping; public override MemoryMapping Mapping(ushort absolute) => this.mapping;
@ -82,7 +81,7 @@ namespace M6502.Test
var test = this.Peek(0x0200); var test = this.Peek(0x0200);
System.Console.Out.WriteLine(); System.Console.Out.WriteLine();
System.Console.Out.Write("** Test="); System.Console.Out.Write("** Test=");
System.Console.Out.WriteLine(Disassembly.Dump_ByteValue(test)); System.Console.Out.WriteLine(Disassembler.Dump_ByteValue(test));
} }
} }
@ -94,27 +93,27 @@ namespace M6502.Test
var output = new StringBuilder(); var output = new StringBuilder();
output.Append("PC="); output.Append("PC=");
output.Append(Disassembly.Dump_WordValue(address)); output.Append(Disassembler.Dump_WordValue(address));
output.Append(":"); output.Append(":");
output.Append("P="); output.Append("P=");
output.Append(Disassembly.Dump_Flags(this.CPU.P)); output.Append(Disassembler.Dump_Flags(this.CPU.P));
output.Append(", "); output.Append(", ");
output.Append("A="); output.Append("A=");
output.Append(Disassembly.Dump_ByteValue(this.CPU.A)); output.Append(Disassembler.Dump_ByteValue(this.CPU.A));
output.Append(", "); output.Append(", ");
output.Append("X="); output.Append("X=");
output.Append(Disassembly.Dump_ByteValue(this.CPU.X)); output.Append(Disassembler.Dump_ByteValue(this.CPU.X));
output.Append(", "); output.Append(", ");
output.Append("Y="); output.Append("Y=");
output.Append(Disassembly.Dump_ByteValue(this.CPU.Y)); output.Append(Disassembler.Dump_ByteValue(this.CPU.Y));
output.Append(", "); output.Append(", ");
output.Append("S="); output.Append("S=");
output.Append(Disassembly.Dump_ByteValue(this.CPU.S)); output.Append(Disassembler.Dump_ByteValue(this.CPU.S));
output.Append("\t"); output.Append("\t");
output.Append(this.disassembler.Disassemble(address)); output.Append(this.disassembler.Disassemble(address));

View File

@ -4,14 +4,15 @@
namespace M6502.Test namespace M6502.Test
{ {
public class Program public static class Program
{ {
public static void Main(string[] args) public static void Main(string[] args)
{ {
var configuration = new Configuration(); var configuration = new Configuration();
////configuration.DebugMode = true; #if DEBUG
configuration.DebugMode = true;
#endif
using (var harness = new TestHarness(configuration)) using (var harness = new TestHarness(configuration))
{ {
harness.Run(); harness.Run();

View File

@ -47,7 +47,7 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Disassembly.cs" /> <Compile Include="Disassembler.cs" />
<Compile Include="M6502.cs" /> <Compile Include="M6502.cs" />
<Compile Include="PageCrossingBehavior.cs" /> <Compile Include="PageCrossingBehavior.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />