Some small consistency tidyups.

This commit is contained in:
Adrian Conlon committed 2026-05-24 22:48:34 +01:00
1 parent ec59b422b9
commit 932bcfd54e
5 files changed
+28 -25

No files matched your search

+7 -8
View File
@@ -87,16 +87,15 @@ namespace EightBit
{
var mapped = this.Mapping(absolute);
var offset = (ushort)mapped.Offset(absolute);
if (mapped.Access == AccessLevel.ReadOnly)
if (mapped.Access != AccessLevel.ReadOnly)
{
if (!this._writing)
{
this.Data = mapped.Memory.Peek(offset);
}
return ref this._data;
return ref mapped.Memory.Reference(offset);
}
return ref mapped.Memory.Reference(offset);
if (!this._writing)
{
this.Data = mapped.Memory.Peek(offset);
}
return ref this._data;
}
protected ref byte Reference() => ref this.Reference(this.Address.Joined);
+2 -2
View File
@@ -186,7 +186,7 @@ namespace EightBit
protected virtual void MemoryWrite() => this.BusWrite();
protected virtual void BusWrite() => this.Bus.Write(); // N.B. Should be the only real call into the "Bus.Write" code.
protected void BusWrite() => this.Bus.Write(); // N.B. Should be the only real call into the "Bus.Write" code.
protected void MemoryRead(byte low, byte high)
{
@@ -202,7 +202,7 @@ namespace EightBit
protected virtual void MemoryRead() => this.BusRead();
protected virtual void BusRead() => this.Bus.Read(); // N.B. Should be the only real call into the "Bus.Read" code.
protected void BusRead() => this.Bus.Read(); // N.B. Should be the only real call into the "Bus.Read" code.
protected virtual void IncrementPC() => this.PC.Increment();
+5 -1
View File
@@ -75,7 +75,11 @@ namespace EightBit
public override bool Equals(object? obj) => this.Equals(obj as Register16);
public bool Equals(Register16? rhs) => ReferenceEquals(this, rhs) || (rhs is not null && rhs.Low == this.Low && rhs.High == this.High);
public bool Equals(Register16? rhs)
{
Debug.Assert(rhs is not null, "rhs cannot be null");
return this.Joined == rhs.Joined;
}
public void Assign(byte low, byte high = 0)
{
+9 -9
View File
@@ -554,7 +554,7 @@ namespace M6502
// Can't use "FetchByte", since that would add an extra tick.
this.ImmediateAddress();
this.ReadFromBus();
this.ReadFromMemory();
System.Diagnostics.Debug.Assert(this.Cycles == 1, "BUS read has introduced stray cycles");
this.RaiseSYNC();
@@ -566,32 +566,32 @@ namespace M6502
#region Bus/Memory access
protected sealed override void BusWrite()
protected sealed override void MemoryWrite()
{
this.OnWritingMemory();
this.Tick();
this.WriteToBus();
this.WriteToMemory();
this.OnWrittenMemory();
}
protected sealed override void BusRead()
protected sealed override void MemoryRead()
{
this.OnReadingMemory();
this.Tick();
this.ReadFromBus();
this.ReadFromMemory();
this.OnReadMemory();
}
private void ReadFromBus()
private void ReadFromMemory()
{
this.RaiseRW();
base.BusRead();
base.MemoryRead();
}
private void WriteToBus()
private void WriteToMemory()
{
this.LowerRW();
base.BusWrite();
base.MemoryWrite();
}
protected abstract void ModifyWrite(byte data);
+5 -5
View File
@@ -571,21 +571,21 @@ namespace MC6809
#region Bus control
protected override void BusWrite()
protected override void MemoryWrite()
{
this.OnWritingMemory();
this.Tick();
this.LowerRW();
base.BusWrite();
base.MemoryWrite();
this.OnWrittenMemory();
}
protected override void BusRead()
protected override void MemoryRead()
{
this.OnReadingMemory();
this.Tick();
this.RaiseRW();
base.BusRead();
base.MemoryRead();
this.OnReadMemory();
}
@@ -772,7 +772,7 @@ namespace MC6809
else
{
// EA = ,R + 5-bit offset
this.EA.Joined = (ushort)(r.Joined + SignExtend(5, (byte)(type & (byte)Mask.Five)));
this.EA.Joined = (ushort)(r.Joined + SignExtend(5, type & (byte)Mask.Five));
this.SwallowCurrent();
this.SwallowRead();
}