mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2026-04-20 21:16:29 +00:00
Modernise some more c# code
This commit is contained in:
@@ -19,11 +19,11 @@ namespace Z80.Test
|
||||
public Board(Configuration configuration)
|
||||
{
|
||||
this.configuration = configuration;
|
||||
this.ram = new Ram(0x10000);
|
||||
this.ports = new InputOutput();
|
||||
this.CPU = new Z80(this, this.ports);
|
||||
this.disassembler = new Disassembler(this);
|
||||
this.mapping = new MemoryMapping(this.ram, 0x0000, (ushort)Mask.Sixteen, AccessLevel.ReadWrite);
|
||||
this.ram = new(0x10000);
|
||||
this.ports = new();
|
||||
this.CPU = new(this, this.ports);
|
||||
this.disassembler = new(this);
|
||||
this.mapping = new(this.ram, 0x0000, (ushort)Mask.Sixteen, AccessLevel.ReadWrite);
|
||||
}
|
||||
|
||||
public Z80 CPU { get; }
|
||||
@@ -81,7 +81,7 @@ namespace Z80.Test
|
||||
}
|
||||
}
|
||||
|
||||
private void CPU_ExecutingInstruction_CPM(object sender, System.EventArgs e)
|
||||
private void CPU_ExecutingInstruction_CPM(object? sender, System.EventArgs e)
|
||||
{
|
||||
if (this.CPU.PC.High != 0)
|
||||
{
|
||||
@@ -105,8 +105,8 @@ namespace Z80.Test
|
||||
}
|
||||
}
|
||||
|
||||
private void CPU_LoweredHALT(object sender, System.EventArgs e) => this.LowerPOWER();
|
||||
private void CPU_LoweredHALT(object? sender, System.EventArgs e) => this.LowerPOWER();
|
||||
|
||||
private void CPU_ExecutingInstruction_Debug(object sender, System.EventArgs e) => System.Console.Error.WriteLine($"{EightBit.Disassembler.State(this.CPU)}\t{this.disassembler.Disassemble(this.CPU)}");
|
||||
private void CPU_ExecutingInstruction_Debug(object? sender, System.EventArgs e) => System.Console.Error.WriteLine($"{EightBit.Disassembler.State(this.CPU)}\t{this.disassembler.Disassemble(this.CPU)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,9 +14,9 @@ namespace Z80.Test
|
||||
|
||||
public bool DebugMode { get; set; } = false;
|
||||
|
||||
public Register16 LoadAddress { get; } = new Register16(0x100);
|
||||
public Register16 LoadAddress { get; } = new(0x100);
|
||||
|
||||
public Register16 StartAddress { get; } = new Register16(0x100);
|
||||
public Register16 StartAddress { get; } = new(0x100);
|
||||
|
||||
public string RomDirectory { get; } = "roms";
|
||||
|
||||
|
||||
@@ -7,16 +7,14 @@ namespace Z80.Test
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
internal class TestHarness : IDisposable
|
||||
internal class TestHarness(Configuration configuration) : IDisposable
|
||||
{
|
||||
private readonly Stopwatch timer = new Stopwatch();
|
||||
private readonly Board board;
|
||||
private readonly Stopwatch timer = new();
|
||||
private readonly Board board = new(configuration);
|
||||
private long totalCycles = 0;
|
||||
|
||||
private bool disposed = false;
|
||||
|
||||
public TestHarness(Configuration configuration) => this.board = new Board(configuration);
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
this.Dispose(true);
|
||||
|
||||
+3
-3
@@ -118,13 +118,13 @@ namespace EightBit
|
||||
|
||||
public override Register16 HL => this.registers[this.registerSet, (int)RegisterIndex.IndexHL];
|
||||
|
||||
public Register16 IX { get; } = new Register16(0xffff);
|
||||
public Register16 IX { get; } = new(0xffff);
|
||||
|
||||
public byte IXH { get => this.IX.High; set => this.IX.High = value; }
|
||||
|
||||
public byte IXL { get => this.IX.Low; set => this.IX.Low = value; }
|
||||
|
||||
public Register16 IY { get; } = new Register16(0xffff);
|
||||
public Register16 IY { get; } = new(0xffff);
|
||||
|
||||
public byte IYH { get => this.IY.High; set => this.IY.High = value; }
|
||||
|
||||
@@ -410,7 +410,7 @@ namespace EightBit
|
||||
this.DisableInterrupts();
|
||||
this.IM = 0;
|
||||
|
||||
this.REFRESH = new RefreshRegister(0);
|
||||
this.REFRESH = new(0);
|
||||
this.IV = (byte)Mask.Eight;
|
||||
|
||||
this.ExxAF();
|
||||
|
||||
Reference in New Issue
Block a user