mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2026-04-19 15:16:41 +00:00
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>
This commit is contained in:
+6
-26
@@ -31,8 +31,8 @@
|
||||
protected byte OpCode { get => opcode; set => opcode = value; }
|
||||
public Bus Bus { get => bus; set => bus = value; }
|
||||
|
||||
public ref PinLevel RESET() { return ref resetLine; }
|
||||
public ref PinLevel INT() { return ref intLine; }
|
||||
public ref PinLevel RESET() => ref resetLine;
|
||||
public ref PinLevel INT() => ref intLine;
|
||||
|
||||
public abstract int Step();
|
||||
public abstract int Execute();
|
||||
@@ -101,10 +101,7 @@
|
||||
|
||||
#region BusWrite
|
||||
|
||||
protected void BusWrite(byte low, byte high, byte data)
|
||||
{
|
||||
BusWrite(MakeWord(low, high), data);
|
||||
}
|
||||
protected void BusWrite(byte low, byte high, byte data) => BusWrite(MakeWord(low, high), data);
|
||||
|
||||
protected void BusWrite(ushort address, byte data)
|
||||
{
|
||||
@@ -124,10 +121,7 @@
|
||||
|
||||
#region BusRead
|
||||
|
||||
protected byte BusRead(byte low, byte high)
|
||||
{
|
||||
return BusRead(MakeWord(low, high));
|
||||
}
|
||||
protected byte BusRead(byte low, byte high) => BusRead(MakeWord(low, high));
|
||||
|
||||
protected byte BusRead(ushort address)
|
||||
{
|
||||
@@ -139,14 +133,6 @@
|
||||
|
||||
#endregion
|
||||
|
||||
#region Paged reader/writer wrappers
|
||||
|
||||
protected byte GetBytePaged(byte page, byte offset) => BusRead(offset, page);
|
||||
|
||||
protected void SetBytePaged(byte page, byte offset, byte value) => BusWrite(offset, page, value);
|
||||
|
||||
#endregion
|
||||
|
||||
protected byte FetchByte() => BusRead(PC++);
|
||||
|
||||
protected abstract ushort GetWord();
|
||||
@@ -175,10 +161,7 @@
|
||||
SetWord(value);
|
||||
}
|
||||
|
||||
protected void Jump(ushort destination)
|
||||
{
|
||||
PC = destination;
|
||||
}
|
||||
protected void Jump(ushort destination) => PC = destination;
|
||||
|
||||
protected void Call(ushort destination)
|
||||
{
|
||||
@@ -186,9 +169,6 @@
|
||||
Jump(destination);
|
||||
}
|
||||
|
||||
protected virtual void Return()
|
||||
{
|
||||
Jump(PopWord());
|
||||
}
|
||||
protected virtual void Return() => Jump(PopWord());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user