mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2026-04-20 06:16:43 +00:00
Tidy register increment/decrement a little.
This commit is contained in:
@@ -28,7 +28,7 @@ namespace EightBit
|
||||
protected override Register16 GetWord()
|
||||
{
|
||||
this.Intermediate.High = this.MemoryRead();
|
||||
this.Bus.Address.Increment();
|
||||
_ = this.Bus.Address.Increment();
|
||||
this.Intermediate.Low = this.MemoryRead();
|
||||
return this.Intermediate;
|
||||
}
|
||||
@@ -57,7 +57,7 @@ namespace EightBit
|
||||
protected override void SetWord(Register16 value)
|
||||
{
|
||||
this.MemoryWrite(value.High);
|
||||
this.Bus.Address.Increment();
|
||||
_ = this.Bus.Address.Increment();
|
||||
this.MemoryWrite(value.Low);
|
||||
}
|
||||
|
||||
|
||||
@@ -100,12 +100,13 @@ namespace EightBit
|
||||
|
||||
protected abstract void EnableInterrupts();
|
||||
|
||||
protected override void IncrementPC()
|
||||
protected override Register16 IncrementPC()
|
||||
{
|
||||
if (this.HALT.Raised())
|
||||
{
|
||||
base.IncrementPC();
|
||||
return base.IncrementPC();
|
||||
}
|
||||
return this.PC;
|
||||
}
|
||||
|
||||
protected override byte FetchInstruction()
|
||||
@@ -149,14 +150,13 @@ namespace EightBit
|
||||
|
||||
protected sealed override void Push(byte value)
|
||||
{
|
||||
this.SP.Decrement();
|
||||
this.MemoryWrite(this.SP, value);
|
||||
this.MemoryWrite(this.SP.Decrement(), value);
|
||||
}
|
||||
|
||||
protected sealed override byte Pop()
|
||||
{
|
||||
var returned = this.MemoryRead(this.SP);
|
||||
this.SP.Increment();
|
||||
_ = this.SP.Increment();
|
||||
return returned;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace EightBit
|
||||
protected override Register16 GetWord()
|
||||
{
|
||||
this.Intermediate.Low = this.MemoryRead();
|
||||
this.Bus.Address.Increment();
|
||||
_ = this.Bus.Address.Increment();
|
||||
this.Intermediate.High = this.MemoryRead();
|
||||
return this.Intermediate;
|
||||
}
|
||||
@@ -58,7 +58,7 @@ namespace EightBit
|
||||
protected override void SetWord(Register16 value)
|
||||
{
|
||||
this.MemoryWrite(value.Low);
|
||||
this.Bus.Address.Increment();
|
||||
_ = this.Bus.Address.Increment();
|
||||
this.MemoryWrite(value.High);
|
||||
}
|
||||
|
||||
|
||||
@@ -261,14 +261,14 @@ namespace EightBit
|
||||
|
||||
protected virtual byte BusRead() => this.Bus.Read(); // N.B. Should be the only real call into the "Bus.Read" code.
|
||||
|
||||
protected virtual void IncrementPC() => this.PC.Increment();
|
||||
protected virtual Register16 IncrementPC() => this.PC.Increment();
|
||||
|
||||
protected virtual void DecrementPC() => this.PC.Decrement();
|
||||
protected virtual Register16 DecrementPC() => this.PC.Decrement();
|
||||
|
||||
protected virtual void ImmediateAddress()
|
||||
{
|
||||
this.Bus.Address.Assign(this.PC);
|
||||
this.IncrementPC();
|
||||
_ = this.IncrementPC();
|
||||
}
|
||||
|
||||
protected virtual byte FetchByte()
|
||||
|
||||
@@ -95,14 +95,14 @@ namespace EightBit
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public Register16 Increment()
|
||||
{
|
||||
this.Word++;
|
||||
++this.Word;
|
||||
return this;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public Register16 Decrement()
|
||||
{
|
||||
this.Word--;
|
||||
--this.Word;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user