EightBitNet/EightBit/Device.cs
Adrian Conlon d4a35c402c A few small consistency updates:
1) Drop Get/SetPagedByte in favour of normal BusRead/Write
2) Tidy some "using" statements
3) More "expression body" usage, if possible
4) Use field initialisation, rather than construction, if possible
5) Correct IntelProcessor register set/get methods (there were remnants of "copy pasta" code)

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2019-02-03 20:29:52 +00:00

41 lines
1.2 KiB
C#

namespace EightBit
{
using System;
public class Device
{
private PinLevel powerLine;
protected Device() { }
public event EventHandler<EventArgs> RaisingPOWER;
public event EventHandler<EventArgs> RaisedPOWER;
public event EventHandler<EventArgs> LoweringPOWER;
public event EventHandler<EventArgs> LoweredPOWER;
public ref PinLevel POWER() => ref powerLine;
public bool Powered => POWER().Raised();
public virtual void RaisePOWER()
{
OnRaisingPOWER();
POWER().Raise();
OnRaisedPOWER();
}
public virtual void LowerPOWER()
{
OnLoweringPOWER();
POWER().Lower();
OnLoweredPOWER();
}
protected virtual void OnRaisingPOWER() => RaisingPOWER?.Invoke(this, EventArgs.Empty);
protected virtual void OnRaisedPOWER() => RaisedPOWER?.Invoke(this, EventArgs.Empty);
protected virtual void OnLoweringPOWER() => LoweringPOWER?.Invoke(this, EventArgs.Empty);
protected virtual void OnLoweredPOWER() => LoweredPOWER?.Invoke(this, EventArgs.Empty);
}
}