mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2026-01-23 08:16:25 +00:00
Prefer to use events directly, rather than through "On" methods
This commit is contained in:
@@ -42,9 +42,9 @@ namespace EightBit
|
||||
|
||||
public byte Read()
|
||||
{
|
||||
this.OnReadingByte();
|
||||
this.ReadingByte?.Invoke(this, EventArgs.Empty);
|
||||
var returned = this.Data = this.Reference();
|
||||
this.OnReadByte();
|
||||
ReadByte?.Invoke(this, EventArgs.Empty);
|
||||
return returned;
|
||||
}
|
||||
|
||||
@@ -67,9 +67,9 @@ namespace EightBit
|
||||
|
||||
public void Write()
|
||||
{
|
||||
this.OnWritingByte();
|
||||
this.WritingByte?.Invoke(this, EventArgs.Empty);
|
||||
this.Reference() = this.Data;
|
||||
this.OnWrittenByte();
|
||||
this.WrittenByte?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
public void Write(byte value)
|
||||
@@ -106,14 +106,6 @@ namespace EightBit
|
||||
|
||||
public abstract void Initialize();
|
||||
|
||||
protected virtual void OnWritingByte() => WritingByte?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
protected virtual void OnWrittenByte() => WrittenByte?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
protected virtual void OnReadingByte() => ReadingByte?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
protected virtual void OnReadByte() => ReadByte?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
protected ref byte Reference(ushort absolute)
|
||||
{
|
||||
var mapped = this.Mapping(absolute);
|
||||
|
||||
@@ -25,11 +25,9 @@ namespace EightBit
|
||||
public void Tick()
|
||||
{
|
||||
++this.Cycles;
|
||||
this.OnTicked();
|
||||
Ticked?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
protected virtual void OnTicked() => Ticked?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
protected void ResetCycles() => this.Cycles = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,22 +138,6 @@ namespace EightBit
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnRaisingRESET() => RaisingRESET?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
protected virtual void OnRaisedRESET() => RaisedRESET?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
protected virtual void OnLoweringRESET() => LoweringRESET?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
protected virtual void OnLoweredRESET() => LoweredRESET?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
protected virtual void OnRaisingINT() => RaisingINT?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
protected virtual void OnRaisedINT() => RaisedINT?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
protected virtual void OnLoweringINT() => LoweringINT?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
protected virtual void OnLoweredINT() => LoweredINT?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
protected virtual void HandleRESET() => this.RaiseRESET();
|
||||
|
||||
protected virtual void HandleINT() => this.RaiseINT();
|
||||
|
||||
Reference in New Issue
Block a user