Implement some suggestions from the code analysis.

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2019-02-14 23:51:32 +00:00
parent 63db46a7bc
commit cf4e633034
6 changed files with 35 additions and 57 deletions

View File

@ -55,10 +55,7 @@ namespace EightBit
return this.Read();
}
public byte Read(Register16 absolute)
{
return this.Read(absolute.Word);
}
public byte Read(Register16 absolute) => this.Read(absolute.Word);
public byte Read(byte low, byte high)
{
@ -86,10 +83,7 @@ namespace EightBit
this.Write(value);
}
public void Write(Register16 absolute, byte value)
{
this.Write(absolute.Word, value);
}
public void Write(Register16 absolute, byte value) => this.Write(absolute.Word, value);
public void Write(byte low, byte high, byte value)
{

View File

@ -6,6 +6,6 @@ namespace EightBit
{
public interface IMapper
{
MemoryMapping Mapping(ushort address);
MemoryMapping Mapping(ushort absolute);
}
}

View File

@ -6,11 +6,11 @@ namespace EightBit
{
public class IntelOpCodeDecoded
{
private int x;
private int y;
private int z;
private int p;
private int q;
private readonly int x;
private readonly int y;
private readonly int z;
private readonly int p;
private readonly int q;
public IntelOpCodeDecoded()
{

View File

@ -16,10 +16,7 @@ namespace EightBit
public abstract byte Peek(ushort address);
public virtual ref byte Reference(ushort address)
{
throw new NotImplementedException();
}
public virtual ref byte Reference(ushort address) => throw new NotImplementedException();
public abstract int Load(FileStream file, int writeOffset = 0, int readOffset = 0, int limit = -1);

View File

@ -48,25 +48,13 @@ namespace EightBit
this.Word = rhs.Word;
}
public static Register16 operator ++(Register16 value)
{
return Increment(value);
}
public static Register16 operator ++(Register16 value) => Increment(value);
public static Register16 operator --(Register16 value)
{
return Decrement(value);
}
public static Register16 operator --(Register16 value) => Decrement(value);
public static bool operator ==(Register16 left, Register16 right)
{
return left.Equals(right);
}
public static bool operator ==(Register16 left, Register16 right) => left.Equals(right);
public static bool operator !=(Register16 left, Register16 right)
{
return !(left == right);
}
public static bool operator !=(Register16 left, Register16 right) => !(left == right);
public static Register16 Increment(Register16 value)
{
@ -91,9 +79,6 @@ namespace EightBit
return rhs.Word == this.Word;
}
public override int GetHashCode()
{
return this.Word;
}
public override int GetHashCode() => this.Word;
}
}

View File

@ -9,28 +9,30 @@ namespace EightBit
[Flags]
public enum StatusBits : byte
{
// Negative
NF = Bits.Bit7,
None = 0,
// Overflow
VF = Bits.Bit6,
// reserved
RF = Bits.Bit5,
// Brk
BF = Bits.Bit4,
// D (use BCD for arithmetic)
DF = Bits.Bit3,
// I (IRQ disable)
IF = Bits.Bit2,
// Carry
CF = Bits.Bit0,
// Zero
ZF = Bits.Bit1,
// Carry
CF = Bits.Bit0,
}
// I (IRQ disable)
IF = Bits.Bit2,
// D (use BCD for arithmetic)
DF = Bits.Bit3,
// Brk
BF = Bits.Bit4,
// reserved
RF = Bits.Bit5,
// Overflow
VF = Bits.Bit6,
// Negative
NF = Bits.Bit7,
}
}