mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2025-06-27 14:24:41 +00:00
Add a initial port of the MC6809 processor to the .Net collection
Signed-off-by: Adrian Conlon <adrian.conlon@gmail.com>
This commit is contained in:
@ -35,6 +35,15 @@ namespace EightBit
|
||||
|
||||
protected byte OpCode { get; set; }
|
||||
|
||||
// http://graphics.stanford.edu/~seander/bithacks.html#FixedSignExtend
|
||||
public static sbyte SignExtend(int b, byte x)
|
||||
{
|
||||
var m = (byte)(1 << (b - 1)); // mask can be pre-computed if b is fixed
|
||||
x = (byte)(x & ((1 << b) - 1)); // (Skip this if bits in x above position b are already zero.)
|
||||
var result = (x ^ m) - m;
|
||||
return (sbyte)result;
|
||||
}
|
||||
|
||||
public ref PinLevel RESET() => ref this.resetLine;
|
||||
|
||||
public ref PinLevel INT() => ref this.intLine;
|
||||
@ -178,12 +187,16 @@ namespace EightBit
|
||||
return this.GetWord();
|
||||
}
|
||||
|
||||
protected Register16 GetWord(Register16 address) => this.GetWord(address.Word);
|
||||
|
||||
protected void SetWord(ushort address, Register16 value)
|
||||
{
|
||||
this.Bus.Address.Word = address;
|
||||
this.SetWord(value);
|
||||
}
|
||||
|
||||
protected void SetWord(Register16 address, Register16 value) => this.SetWord(address.Word, value);
|
||||
|
||||
protected void Jump(ushort destination) => this.PC.Word = destination;
|
||||
|
||||
protected void Call(ushort destination)
|
||||
|
Reference in New Issue
Block a user