Rationalise use of "intermediate" Register16

This commit is contained in:
Adrian Conlon
2024-06-29 13:38:55 +01:00
parent 7f0ca27412
commit 6e46c8e47f
5 changed files with 65 additions and 70 deletions

View File

@@ -20,7 +20,7 @@ namespace EightBit
public byte Data { get => this.data; set => this.data = value; }
public Register16 Address { get; } = new Register16();
public Register16 Address { get; } = new();
public abstract MemoryMapping Mapping(ushort absolute);
@@ -30,16 +30,12 @@ namespace EightBit
public byte Peek(Register16 absolute) => this.Peek(absolute.Word);
public byte Peek(byte low, byte high) => this.Reference(low, high);
public void Poke(byte value) => this.Reference() = value;
public void Poke(ushort absolute, byte value) => this.Reference(absolute) = value;
public void Poke(Register16 absolute, byte value) => this.Poke(absolute.Word, value);
public void Poke(byte low, byte high, byte value) => this.Reference(low, high) = value;
public byte Read()
{
this.OnReadingByte();
@@ -127,8 +123,6 @@ namespace EightBit
protected ref byte Reference() => ref this.Reference(this.Address);
protected ref byte Reference(byte low, byte high) => ref this.Reference(new Register16(low, high).Word);
protected void LoadHexFile(string path)
{
using var file = new IntelHexFile(path);