Work in progress to correct fixup effect storage

This commit is contained in:
Adrian Conlon
2024-09-14 10:06:00 +01:00
parent c3f76bd3c7
commit 315ed8e040
2 changed files with 33 additions and 2 deletions

View File

@@ -223,8 +223,28 @@ namespace EightBit
private void StoreFixupEffect(byte data)
{
var fixedAddress = (byte)(this.Bus.Address.High + 1);
this.MemoryWrite((byte)(data & fixedAddress));
////var fixedAddress = (byte)(this.Bus.Address.High + 1);
//var fixedAddress = this.FixedPage + 1;
//var updated = (byte)(data & fixedAddress);
//if (this.Fixed)
//{
// this.Bus.Address.High = updated;
//}
//this.MemoryWrite(updated);
byte updated;
if (this.Fixed)
{
updated = (byte)(data & this.FixedPage);
this.Bus.Address.High = updated;
}
else
{
updated = (byte)(data & this.UnfixedPage);
this.Bus.Address.High = updated;
}
this.MemoryWrite(updated);
}
private void SHA() => this.StoreFixupEffect((byte)(this.A & this.X));

View File

@@ -646,12 +646,22 @@ namespace EightBit
private byte fixedPage;
private byte unfixedPage;
public byte FixedPage
{
get => this.fixedPage;
protected set => this.fixedPage = value;
}
public byte UnfixedPage
{
get => this.unfixedPage;
protected set => this.unfixedPage = value;
}
public bool Fixed => this.FixedPage != this.UnfixedPage;
protected void MaybeFixup()
{
if (this.Bus.Address.High != this.FixedPage)
@@ -685,6 +695,7 @@ namespace EightBit
protected void NoteFixedAddress(ushort address)
{
this.UnfixedPage = this.Bus.Address.High;
this.Intermediate.Word = address;
this.FixedPage = this.Intermediate.High;
this.Bus.Address.Low = this.Intermediate.Low;