mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2026-04-20 06:16:43 +00:00
Help out callers using Register16 arguments a little: Don't always require the ".Word" property to be passed.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
@@ -129,6 +129,8 @@ namespace EightBit
|
||||
this.BusWrite(data);
|
||||
}
|
||||
|
||||
protected void BusWrite(Register16 address, byte data) => this.BusWrite(address.Word, data);
|
||||
|
||||
protected void BusWrite(byte data)
|
||||
{
|
||||
this.Bus.Data = data;
|
||||
@@ -150,9 +152,11 @@ namespace EightBit
|
||||
return this.BusRead();
|
||||
}
|
||||
|
||||
protected byte BusRead(Register16 address) => this.BusRead(address.Word);
|
||||
|
||||
protected virtual byte BusRead() => this.Bus.Read(); // N.B. Should be the only real call into the "Bus.Read" code.
|
||||
|
||||
protected byte FetchByte() => this.BusRead(this.PC().Word++);
|
||||
protected byte FetchByte() => this.BusRead(this.PC()++);
|
||||
|
||||
protected abstract Register16 GetWord();
|
||||
|
||||
@@ -186,12 +190,16 @@ namespace EightBit
|
||||
|
||||
protected void Jump(ushort destination) => this.PC().Word = destination;
|
||||
|
||||
protected void Jump(Register16 destination) => this.Jump(destination.Word);
|
||||
|
||||
protected void Call(ushort destination)
|
||||
{
|
||||
this.PushWord(this.PC());
|
||||
this.Jump(destination);
|
||||
}
|
||||
|
||||
protected void Call(Register16 destination) => this.Call(destination.Word);
|
||||
|
||||
protected virtual void Return() => this.Jump(this.PopWord().Word);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user