More performance improvements

This commit is contained in:
Adrian Conlon committed 2026-06-10 17:26:26 +01:00
1 parent 552de802fe
commit 39561437e9
4 files changed
+31 -2

No files matched your search

+5
View File
@@ -3,6 +3,7 @@
// </copyright>
using System.Diagnostics;
using System.Runtime.CompilerServices;
namespace EightBit
{
@@ -35,6 +36,7 @@ namespace EightBit
this.Poke(absolute.Joined, value);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Read()
{
Debug.Assert(!this._writing, "Writing flag is in an invalid state");
@@ -42,6 +44,7 @@ namespace EightBit
Debug.Assert(!this._writing, "Writing flag is in an invalid state");
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Write()
{
Debug.Assert(!this._writing, "Writing flag is in an invalid state");
@@ -63,6 +66,7 @@ namespace EightBit
public abstract void Initialize();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected ref byte Reference(ushort absolute)
{
var mapped = this.Mapping(absolute);
@@ -78,6 +82,7 @@ namespace EightBit
return ref this._data;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected ref byte Reference() => ref this.Reference(this.Address.Joined);
protected void LoadHexFile(string path)
+6 -2
View File
@@ -20,9 +20,13 @@ namespace EightBit
public void Tick(int extra = 1)
{
this.Cycles += extra;
for (var i = 0; i < extra; ++i)
var ticked = this.Ticked;
if (ticked is not null)
{
this.Ticked?.Invoke(this, EventArgs.Empty);
for (var i = 0; i < extra; ++i)
{
ticked.Invoke(this, EventArgs.Empty);
}
}
}
+7
View File
@@ -3,6 +3,7 @@
// </copyright>
using System.Diagnostics;
using System.Runtime.CompilerServices;
namespace EightBit
{
@@ -158,12 +159,16 @@ namespace EightBit
protected virtual void HandleINT() => this.RaiseINT();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected void OnReadingMemory() => this.ReadingMemory?.Invoke(this, EventArgs.Empty);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected void OnReadMemory() => this.ReadMemory?.Invoke(this, EventArgs.Empty);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected void OnWritingMemory() => this.WritingMemory?.Invoke(this, EventArgs.Empty);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected void OnWrittenMemory() => this.WrittenMemory?.Invoke(this, EventArgs.Empty);
protected void MemoryWrite(byte low, byte high, byte data)
@@ -186,6 +191,7 @@ namespace EightBit
protected virtual void MemoryWrite() => this.BusWrite();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
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,6 +208,7 @@ namespace EightBit
protected virtual void MemoryRead() => this.BusRead();
[MethodImpl(MethodImplOptions.AggressiveInlining)]
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();