mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2026-10-24 14:05:42 +00:00
More performance improvements
This commit is contained in:
1 parent
552de802fe
commit
39561437e9
4 files changed
+31
-2
No files matched your search
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
+13
@@ -6,6 +6,7 @@ namespace Z80
|
||||
{
|
||||
using EightBit;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
public sealed class Z80 : IntelProcessor
|
||||
{
|
||||
@@ -307,6 +308,7 @@ namespace Z80
|
||||
public ref PinLevel M1 => ref this._m1Line;
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1030:Use events where appropriate", Justification = "The word 'raise' is used in an electrical sense")]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void RaiseM1()
|
||||
{
|
||||
if (this.M1.Lowered())
|
||||
@@ -317,6 +319,7 @@ namespace Z80
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void LowerM1()
|
||||
{
|
||||
if (this.M1.Raised())
|
||||
@@ -349,6 +352,7 @@ namespace Z80
|
||||
public ref PinLevel RFSH => ref this._refreshLine;
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1030:Use events where appropriate", Justification = "The word 'raise' is used in an electrical sense")]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void RaiseRFSH()
|
||||
{
|
||||
if (this.RFSH.Lowered())
|
||||
@@ -360,6 +364,7 @@ namespace Z80
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void LowerRFSH()
|
||||
{
|
||||
if (this.RFSH.Raised())
|
||||
@@ -387,6 +392,7 @@ namespace Z80
|
||||
public ref PinLevel MREQ => ref this._memoryRequestLine;
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1030:Use events where appropriate", Justification = "The word 'raise' is used in an electrical sense")]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void RaiseMREQ()
|
||||
{
|
||||
if (this.MREQ.Lowered())
|
||||
@@ -397,6 +403,7 @@ namespace Z80
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void LowerMREQ()
|
||||
{
|
||||
if (this.MREQ.Raised())
|
||||
@@ -424,6 +431,7 @@ namespace Z80
|
||||
public ref PinLevel IORQ => ref this._ioRequestLine;
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1030:Use events where appropriate", Justification = "The word 'raise' is used in an electrical sense")]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void RaiseIORQ()
|
||||
{
|
||||
if (this.IORQ.Lowered())
|
||||
@@ -434,6 +442,7 @@ namespace Z80
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void LowerIORQ()
|
||||
{
|
||||
if (this.IORQ.Raised())
|
||||
@@ -461,6 +470,7 @@ namespace Z80
|
||||
public ref PinLevel RD => ref this._rdLine;
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1030:Use events where appropriate", Justification = "The word 'raise' is used in an electrical sense")]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void RaiseRD()
|
||||
{
|
||||
if (this.RD.Lowered())
|
||||
@@ -471,6 +481,7 @@ namespace Z80
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void LowerRD()
|
||||
{
|
||||
if (this.RD.Raised())
|
||||
@@ -498,6 +509,7 @@ namespace Z80
|
||||
public ref PinLevel WR => ref this._wrLine;
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1030:Use events where appropriate", Justification = "The word 'raise' is used in an electrical sense")]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void RaiseWR()
|
||||
{
|
||||
if (this.WR.Lowered())
|
||||
@@ -508,6 +520,7 @@ namespace Z80
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void LowerWR()
|
||||
{
|
||||
if (this.WR.Raised())
|
||||
|
||||
Reference in new issue
Block a user