get the C# code up to date with the C++ code. Much better support for undocumented modes/instructions etc.

This commit is contained in:
Adrian Conlon 2024-05-28 13:59:37 +01:00
parent 6d7e936a60
commit 9e9d86423d
4 changed files with 824 additions and 597 deletions

View File

@ -35,10 +35,11 @@ namespace EightBit
return this.intermediate;
}
protected override Register16 GetWordPaged(byte page, byte offset)
protected override Register16 GetWordPaged()
{
this.intermediate.High = this.MemoryRead(offset, page);
this.intermediate.Low = this.MemoryRead(++offset, page);
this.intermediate.High = this.MemoryRead();
++this.Bus.Address.Low;
this.intermediate.Low = this.MemoryRead();
return this.intermediate;
}
@ -62,10 +63,12 @@ namespace EightBit
this.MemoryWrite(value.Low);
}
protected override void SetWordPaged(byte page, byte offset, Register16 value)
protected override void SetWordPaged(Register16 value)
{
this.MemoryWrite(offset, page, value.High);
this.MemoryWrite(++offset, page, value.Low);
}
this.MemoryWrite(value.High);
++this.Bus.Address.Low;
this.MemoryWrite(value.Low);
}
}
}

View File

@ -36,10 +36,11 @@ namespace EightBit
return this.intermediate;
}
protected override Register16 GetWordPaged(byte page, byte offset)
protected override Register16 GetWordPaged()
{
this.intermediate.Low = this.MemoryRead(offset, page);
this.intermediate.High = this.MemoryRead(++offset, page);
this.intermediate.Low = this.MemoryRead();
++this.Bus.Address.Low;
this.intermediate.High = this.MemoryRead();
return this.intermediate;
}
@ -63,10 +64,11 @@ namespace EightBit
this.MemoryWrite(value.High);
}
protected override void SetWordPaged(byte page, byte offset, Register16 value)
protected override void SetWordPaged(Register16 value)
{
this.MemoryWrite(offset, page, value.Low);
this.MemoryWrite(++offset, page, value.High);
this.MemoryWrite(value.Low);
++this.Bus.Address.Low;
this.MemoryWrite(value.High);
}
}
}

View File

@ -49,7 +49,7 @@ namespace EightBit
public abstract int Step();
public abstract int Execute();
public abstract void Execute();
public int Run(int limit)
{
@ -62,10 +62,10 @@ namespace EightBit
return current;
}
public int Execute(byte value)
public void Execute(byte value)
{
this.OpCode = value;
return this.Execute();
this.Execute();
}
public abstract Register16 PeekWord(ushort address);
@ -184,9 +184,33 @@ namespace EightBit
protected abstract void SetWord(Register16 value);
protected abstract Register16 GetWordPaged(byte page, byte offset);
protected abstract Register16 GetWordPaged();
protected abstract void SetWordPaged(byte page, byte offset, Register16 value);
protected Register16 GetWordPaged(Register16 address)
{
this.Bus.Address.Word = address.Word;
return this.GetWordPaged();
}
protected Register16 GetWordPaged(byte page, byte offset)
{
this.Bus.Address.Word = new Register16(offset, page).Word;
return this.GetWordPaged();
}
protected abstract void SetWordPaged(Register16 value);
protected void SetWordPaged(Register16 address, Register16 value)
{
this.Bus.Address.Word = address.Word;
this.SetWordPaged(value);
}
protected void SetWordPaged(byte page, byte offset, Register16 value)
{
this.Bus.Address.Word = new Register16(offset, page).Word;
this.SetWordPaged(value);
}
protected abstract Register16 FetchWord();

File diff suppressed because it is too large Load Diff