Resurrect the concept of pin level matching. Allows for easier device wiring.

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2019-05-06 09:58:50 +01:00
parent 0340142282
commit efbd576624
3 changed files with 20 additions and 45 deletions

View File

@ -13,5 +13,19 @@ namespace EightBit
public static void Raise(this ref PinLevel line) => line = PinLevel.High;
public static void Lower(this ref PinLevel line) => line = PinLevel.Low;
public static void Match(this ref PinLevel line, int condition) => Match(ref line, condition != 0);
public static void Match(this ref PinLevel line, bool condition)
{
if (condition)
{
line.Raise();
}
else
{
line.Lower();
}
}
}
}
}

View File

@ -186,42 +186,10 @@ namespace EightBit
private void UpdateAciaPins()
{
this.ACIA.DATA = this.Data;
if ((this.Address.Word & (ushort)Bits.Bit0) != 0)
{
this.ACIA.RS.Raise();
}
else
{
this.ACIA.RS.Lower();
}
if ((this.Address.Word & (ushort)Bits.Bit15) != 0)
{
this.ACIA.CS0.Raise();
}
else
{
this.ACIA.CS0.Lower();
}
if ((this.Address.Word & (ushort)Bits.Bit13) != 0)
{
this.ACIA.CS1.Raise();
}
else
{
this.ACIA.CS1.Lower();
}
if ((this.Address.Word & (ushort)Bits.Bit14) != 0)
{
this.ACIA.CS2.Raise();
}
else
{
this.ACIA.CS2.Lower();
}
this.ACIA.RS.Match(this.Address.Word & (ushort)Bits.Bit0);
this.ACIA.CS0.Match(this.Address.Word & (ushort)Bits.Bit15);
this.ACIA.CS1.Match(this.Address.Word & (ushort)Bits.Bit13);
this.ACIA.CS2.Match(this.Address.Word & (ushort)Bits.Bit14);
}
private bool AccessAcia()

View File

@ -376,14 +376,7 @@ namespace EightBit
this.wordSelect = (WordSelect)((this.DATA & (byte)(ControlRegister.CR2 | ControlRegister.CR3 | ControlRegister.CR4)) >> 2);
this.transmitControl = (TransmitterControl)((this.DATA & (byte)(ControlRegister.CR5 | ControlRegister.CR6)) >> 5);
this.receiveControl = (ReceiveControl)((this.DATA & (byte)ControlRegister.CR7) >> 7);
if (this.TransmitReadyHigh)
{
this.RTS.Raise();
}
else
{
this.RTS.Lower();
}
this.RTS.Match(this.TransmitReadyHigh);
}
}
else