Introduce a little consistency with regards to pin naming and usage.

Signed-off-by: Adrian Conlon <adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2019-04-23 00:58:33 +01:00
parent 77a3171037
commit 1d976e811d
8 changed files with 61 additions and 61 deletions

View File

@ -22,21 +22,21 @@ namespace EightBit
public event EventHandler<EventArgs> LoweredPOWER;
public bool Powered => this.POWER().Raised();
public bool Powered => this.POWER.Raised();
public ref PinLevel POWER() => ref this.powerLine;
public ref PinLevel POWER => ref this.powerLine;
public virtual void RaisePOWER()
{
this.OnRaisingPOWER();
this.POWER().Raise();
this.POWER.Raise();
this.OnRaisedPOWER();
}
public virtual void LowerPOWER()
{
this.OnLoweringPOWER();
this.POWER().Lower();
this.POWER.Lower();
this.OnLoweredPOWER();
}

View File

@ -60,9 +60,9 @@ namespace EightBit
public byte L { get => this.HL.Low; set => this.HL.Low = value; }
protected bool Halted => this.HALT().Lowered();
public ref PinLevel HALT => ref this.haltLine;
public ref PinLevel HALT() => ref this.haltLine;
protected bool Halted => this.HALT.Lowered();
public IntelOpCodeDecoded GetDecodedOpCode(byte opCode) => this.decodedOpCodes[opCode];
@ -76,14 +76,14 @@ namespace EightBit
public virtual void RaiseHALT()
{
this.OnRaisingHALT();
this.HALT().Raise();
this.HALT.Raise();
this.OnRaisedHALT();
}
public virtual void LowerHALT()
{
this.OnLoweringHALT();
this.HALT().Lower();
this.HALT.Lower();
this.OnLoweredHALT();
}

View File

@ -29,6 +29,10 @@ namespace EightBit
public event EventHandler<EventArgs> LoweredINT;
public ref PinLevel RESET => ref this.resetLine;
public ref PinLevel INT => ref this.intLine;
public Bus Bus { get; }
public Register16 PC { get; } = new Register16();
@ -44,10 +48,6 @@ namespace EightBit
return (sbyte)result;
}
public ref PinLevel RESET() => ref this.resetLine;
public ref PinLevel INT() => ref this.intLine;
public abstract int Step();
public abstract int Execute();
@ -78,28 +78,28 @@ namespace EightBit
public virtual void RaiseRESET()
{
this.OnRaisingRESET();
this.RESET().Raise();
this.RESET.Raise();
this.OnRaisedRESET();
}
public virtual void LowerRESET()
{
this.OnLoweringRESET();
this.RESET().Lower();
this.RESET.Lower();
this.OnLoweredRESET();
}
public virtual void RaiseINT()
{
this.OnRaisingINT();
this.INT().Raise();
this.INT.Raise();
this.OnRaisedINT();
}
public virtual void LowerINT()
{
this.OnLoweringINT();
this.INT().Lower();
this.INT.Lower();
this.OnLoweredINT();
}

View File

@ -59,11 +59,11 @@ namespace EightBit
this.OnExecutingInstruction();
if (this.Powered)
{
if (this.RESET().Lowered())
if (this.RESET.Lowered())
{
this.HandleRESET();
}
else if (this.INT().Lowered())
else if (this.INT.Lowered())
{
this.HandleINT();
}

View File

@ -64,6 +64,14 @@ namespace EightBit
public event EventHandler<EventArgs> LoweredRDY;
public ref PinLevel NMI => ref this.nmiLine;
public ref PinLevel SO => ref this.soLine;
public ref PinLevel SYNC => ref this.syncLine;
public ref PinLevel RDY => ref this.rdyLine;
public byte X { get; set; } = 0;
public byte Y { get; set; } = 0;
@ -86,14 +94,6 @@ namespace EightBit
private int Carry => this.P & (byte)StatusBits.CF;
public ref PinLevel NMI() => ref this.nmiLine;
public ref PinLevel SO() => ref this.soLine;
public ref PinLevel SYNC() => ref this.syncLine;
public ref PinLevel RDY() => ref this.rdyLine;
public override void RaisePOWER()
{
base.RaisePOWER();
@ -108,42 +108,42 @@ namespace EightBit
public virtual void RaiseNMI()
{
this.OnRaisingNMI();
this.NMI().Raise();
this.NMI.Raise();
this.OnRaisedNMI();
}
public virtual void LowerNMI()
{
this.OnLoweringNMI();
this.NMI().Lower();
this.NMI.Lower();
this.OnLoweredNMI();
}
public virtual void RaiseSO()
{
this.OnRaisingSO();
this.SO().Raise();
this.SO.Raise();
this.OnRaisedSO();
}
public virtual void LowerSO()
{
this.OnLoweringSO();
this.SO().Lower();
this.SO.Lower();
this.OnLoweredSO();
}
public virtual void RaiseRDY()
{
this.OnRaisingRDY();
this.RDY().Raise();
this.RDY.Raise();
this.OnRaisedRDY();
}
public virtual void LowerRDY()
{
this.OnLoweringRDY();
this.RDY().Lower();
this.RDY.Lower();
this.OnLoweredRDY();
}
@ -435,24 +435,24 @@ namespace EightBit
if (this.Powered)
{
this.Tick();
if (this.SO().Lowered())
if (this.SO.Lowered())
{
this.HandleSO();
}
if (this.RDY().Raised())
if (this.RDY.Raised())
{
this.LowerSYNC(); // Instruction fetch beginning
this.OpCode = this.Bus.Read(this.PC.Word++); // can't use fetchByte
if (this.RESET().Lowered())
if (this.RESET.Lowered())
{
this.HandleRESET();
}
else if (this.NMI().Lowered())
else if (this.NMI.Lowered())
{
this.HandleNMI();
}
else if (this.INT().Lowered() && (this.InterruptMasked == 0))
else if (this.INT.Lowered() && (this.InterruptMasked == 0))
{
this.HandleINT();
}
@ -508,14 +508,14 @@ namespace EightBit
protected virtual void RaiseSYNC()
{
this.OnRaisingSYNC();
this.SYNC().Raise();
this.SYNC.Raise();
this.OnRaisedSYNC();
}
protected virtual void LowerSYNC()
{
this.OnLoweringSYNC();
this.SYNC().Lower();
this.SYNC.Lower();
this.OnLoweredSYNC();
}

View File

@ -169,7 +169,7 @@
{
this.HandleHALT();
}
else if (this.RESET().Lowered())
else if (this.RESET.Lowered())
{
this.HandleRESET();
}
@ -181,7 +181,7 @@
{
this.HandleFIRQ();
}
else if (this.INT().Lowered() && (this.InterruptMasked == 0))
else if (this.INT.Lowered() && (this.InterruptMasked == 0))
{
this.HandleINT();
}

View File

@ -45,7 +45,7 @@ namespace EightBit
var l = cpu.L;
var i = cpu.IV;
var r = cpu.REFRESH();
var r = cpu.REFRESH;
var im = cpu.IM;
@ -226,7 +226,7 @@ namespace EightBit
private string DisassembleED(Z80 cpu, ushort pc, ref string specification, ref int dumpCount, int x, int y, int z, int p, int q)
{
string output = string.Empty;
var output = string.Empty;
switch (x)
{
case 0:
@ -377,7 +377,7 @@ namespace EightBit
private string DisassembleOther(Z80 cpu, ushort pc, ref string specification, ref int dumpCount, int x, int y, int z, int p, int q)
{
string output = string.Empty;
var output = string.Empty;
switch (x)
{
case 0:

View File

@ -89,6 +89,12 @@ namespace EightBit
public byte IYL { get => this.IY.Low; set => this.IY.Low = value; }
public ref RefreshRegister REFRESH => ref this.refresh;
public ref PinLevel NMI => ref this.nmiLine;
public ref PinLevel M1 => ref this.m1Line;
private ushort DisplacedAddress
{
get
@ -98,12 +104,6 @@ namespace EightBit
}
}
public ref RefreshRegister REFRESH() => ref this.refresh;
public ref PinLevel NMI() => ref this.nmiLine;
public ref PinLevel M1() => ref this.m1Line;
public void Exx() => this.registerSet ^= 1;
public void ExxAF() => this.accumulatorFlagsSet ^= 1;
@ -117,7 +117,7 @@ namespace EightBit
this.DisableInterrupts();
this.IM = 0;
this.REFRESH() = new RefreshRegister(0);
this.REFRESH = new RefreshRegister(0);
this.IV = (byte)Mask.Mask8;
this.ExxAF();
@ -132,28 +132,28 @@ namespace EightBit
public virtual void RaiseNMI()
{
this.OnRaisingNMI();
this.NMI().Raise();
this.NMI.Raise();
this.OnRaisedNMI();
}
public virtual void LowerNMI()
{
this.OnLoweringNMI();
this.NMI().Lower();
this.NMI.Lower();
this.OnLoweredNMI();
}
public virtual void RaiseM1()
{
this.OnRaisingM1();
this.M1().Raise();
this.M1.Raise();
this.OnRaisedM1();
}
public virtual void LowerM1()
{
this.OnLoweringM1();
this.M1().Lower();
this.M1.Lower();
this.OnLoweredM1();
}
@ -161,7 +161,7 @@ namespace EightBit
{
if (!(this.prefixCB && this.displaced))
{
++this.REFRESH();
++this.REFRESH;
this.RaiseM1();
}
@ -202,15 +202,15 @@ namespace EightBit
{
this.displaced = this.prefixCB = this.prefixDD = this.prefixED = false;
this.LowerM1();
if (this.RESET().Lowered())
if (this.RESET.Lowered())
{
this.HandleRESET();
}
else if (this.NMI().Lowered())
else if (this.NMI.Lowered())
{
this.HandleNMI();
}
else if (this.INT().Lowered())
else if (this.INT.Lowered())
{
this.HandleINT();
}
@ -695,7 +695,7 @@ namespace EightBit
this.Tick(9);
break;
case 1: // LD R,A
this.REFRESH() = this.A;
this.REFRESH = this.A;
this.Tick(9);
break;
case 2: // LD A,I
@ -705,7 +705,7 @@ namespace EightBit
this.Tick(9);
break;
case 3: // LD A,R
this.F = AdjustSZXY(this.F, this.A = this.REFRESH());
this.F = AdjustSZXY(this.F, this.A = this.REFRESH);
this.F = ClearFlag(this.F, StatusBits.NF | StatusBits.HC);
this.F = SetFlag(this.F, StatusBits.PF, this.IFF2);
this.Tick(9);