mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2026-10-24 14:05:42 +00:00
Simplify intermediate 16-bit register usage
This commit is contained in:
1 parent
53e33b9eef
commit
699791f7a4
10 files changed
+110
-57
No files matched your search
@@ -34,12 +34,12 @@ namespace EightBit
|
||||
into.Low = this.MemoryRead();
|
||||
}
|
||||
|
||||
protected override Register16 GetWordPaged()
|
||||
protected override void GetPagedInto(Register16 into)
|
||||
{
|
||||
this.Intermediate.High = this.MemoryRead();
|
||||
ArgumentNullException.ThrowIfNull(into);
|
||||
into.High = this.MemoryRead();
|
||||
++this.Bus.Address.Low;
|
||||
this.Intermediate.Low = this.MemoryRead();
|
||||
return this.Intermediate;
|
||||
into.Low = this.MemoryRead();
|
||||
}
|
||||
|
||||
protected override void PopInto(Register16 into)
|
||||
@@ -64,7 +64,7 @@ namespace EightBit
|
||||
this.MemoryWrite(value.Low);
|
||||
}
|
||||
|
||||
protected override void SetWordPaged(Register16 value)
|
||||
protected override void SetPaged(Register16 value)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(value);
|
||||
this.MemoryWrite(value.High);
|
||||
|
||||
@@ -155,11 +155,10 @@ namespace EightBit
|
||||
return this.Bus.Data;
|
||||
}
|
||||
|
||||
protected sealed override Register16 GetWord()
|
||||
protected sealed override void GetWord()
|
||||
{
|
||||
_ = base.GetWord();
|
||||
base.GetWord();
|
||||
this.MEMPTR.Assign(this.Bus.Address);
|
||||
return this.Intermediate;
|
||||
}
|
||||
|
||||
protected sealed override void SetWord(Register16 value)
|
||||
|
||||
@@ -35,12 +35,12 @@ namespace EightBit
|
||||
into.High = this.MemoryRead();
|
||||
}
|
||||
|
||||
protected override Register16 GetWordPaged()
|
||||
protected override void GetPagedInto(Register16 into)
|
||||
{
|
||||
this.Intermediate.Low = this.MemoryRead();
|
||||
ArgumentNullException.ThrowIfNull(into);
|
||||
into.Low = this.MemoryRead();
|
||||
++this.Bus.Address.Low;
|
||||
this.Intermediate.High = this.MemoryRead();
|
||||
return this.Intermediate;
|
||||
into.High = this.MemoryRead();
|
||||
}
|
||||
|
||||
protected override void PopInto(Register16 into)
|
||||
@@ -65,7 +65,7 @@ namespace EightBit
|
||||
this.MemoryWrite(value.High);
|
||||
}
|
||||
|
||||
protected override void SetWordPaged(Register16 value)
|
||||
protected override void SetPaged(Register16 value)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(value);
|
||||
this.MemoryWrite(value.Low);
|
||||
|
||||
+30
-16
@@ -219,45 +219,59 @@ namespace EightBit
|
||||
|
||||
protected abstract void GetInto(Register16 into);
|
||||
|
||||
protected virtual Register16 GetWord()
|
||||
protected virtual void GetWord()
|
||||
{
|
||||
this.GetInto(this.Intermediate);
|
||||
return this.Intermediate;
|
||||
}
|
||||
|
||||
protected abstract void SetWord(Register16 value);
|
||||
|
||||
protected abstract Register16 GetWordPaged();
|
||||
protected abstract void GetPagedInto(Register16 into);
|
||||
|
||||
protected Register16 GetWordPaged(byte page, byte offset)
|
||||
protected virtual void GetWordPaged()
|
||||
{
|
||||
this.Bus.Address.Assign(offset, page);
|
||||
return this.GetWordPaged();
|
||||
this.GetPagedInto(this.Intermediate);
|
||||
}
|
||||
|
||||
protected abstract void SetWordPaged(Register16 value);
|
||||
protected void GetWordPaged(byte page, byte offset)
|
||||
{
|
||||
this.Bus.Address.Assign(offset, page);
|
||||
this.GetWordPaged();
|
||||
}
|
||||
|
||||
protected void SetWordPaged(Register16 address, Register16 value)
|
||||
protected void GetPagedInto(byte page, byte offset, Register16 into)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(into);
|
||||
this.Bus.Address.Assign(offset, page);
|
||||
this.GetPagedInto(into);
|
||||
}
|
||||
|
||||
protected abstract void SetPaged(Register16 value);
|
||||
|
||||
protected void SetPaged(Register16 address, Register16 value)
|
||||
{
|
||||
this.Bus.Address.Assign(address);
|
||||
this.SetWordPaged(value);
|
||||
this.SetPaged(value);
|
||||
}
|
||||
|
||||
protected void SetWordPaged(byte page, byte offset, Register16 value)
|
||||
protected void SetPaged(byte page, byte offset, Register16 value)
|
||||
{
|
||||
this.Bus.Address.Assign(offset, page);
|
||||
this.SetWordPaged(value);
|
||||
this.SetPaged(value);
|
||||
}
|
||||
|
||||
protected abstract void FetchInto(Register16 into);
|
||||
|
||||
protected Register16 FetchWord()
|
||||
protected void FetchWord()
|
||||
{
|
||||
this.FetchInto(this.Intermediate);
|
||||
return this.Intermediate;
|
||||
}
|
||||
|
||||
protected void FetchWordAddress() => this.Bus.Address.Assign(this.FetchWord());
|
||||
protected void FetchWordAddress()
|
||||
{
|
||||
this.FetchWord();
|
||||
this.Bus.Address.Assign(this.Intermediate);
|
||||
}
|
||||
|
||||
protected abstract void Push(byte value);
|
||||
|
||||
@@ -267,10 +281,10 @@ namespace EightBit
|
||||
|
||||
protected abstract void PopInto(Register16 into);
|
||||
|
||||
protected Register16 GetWord(Register16 address)
|
||||
protected void GetWord(Register16 address)
|
||||
{
|
||||
this.Bus.Address.Assign(address);
|
||||
return this.GetWord();
|
||||
this.GetWord();
|
||||
}
|
||||
|
||||
protected void SetWord(Register16 address, Register16 value)
|
||||
|
||||
Reference in new issue
Block a user