Clarifications of EightBit library

This commit is contained in:
Adrian Conlon
2024-09-18 11:23:18 +01:00
parent 0621b9ed1d
commit 489b7b21e6
8 changed files with 5 additions and 27 deletions

View File

@@ -61,8 +61,7 @@ namespace EightBit
public void Write()
{
this.OnWritingByte();
var value = this.Data; // N.B. Don't join these two lines together: the
this.Reference() = value; // data bus integrity is lost, due to evaluation order!
this.Reference() = this.Data;
this.OnWrittenByte();
}

View File

@@ -6,10 +6,6 @@ namespace EightBit
{
public class Chip : Device
{
protected Chip()
{
}
public static byte Bit(int which) => (byte)(1 << which);
public static byte Bit(byte which) => Bit((int)which);

View File

@@ -10,10 +10,6 @@ namespace EightBit
{
private PinLevel powerLine;
protected Device()
{
}
public event EventHandler<EventArgs>? RaisingPOWER;
public event EventHandler<EventArgs>? RaisedPOWER;

View File

@@ -11,10 +11,6 @@ namespace EightBit
private readonly byte[] input = new byte[0x100];
private readonly byte[] output = new byte[0x100];
public InputOutput()
{
}
public event EventHandler<PortEventArgs>? ReadingPort;
public event EventHandler<PortEventArgs>? ReadPort;

View File

@@ -4,12 +4,8 @@
namespace EightBit
{
public class IntelOpCodeDecoded
public sealed class IntelOpCodeDecoded
{
public IntelOpCodeDecoded()
{
}
public IntelOpCodeDecoded(byte opCode)
{
this.X = (opCode & 0b11000000) >> 6; // 0 - 3

View File

@@ -4,7 +4,7 @@
namespace EightBit
{
public class MemoryMapping(Memory memory, ushort begin, ushort mask, AccessLevel access)
public sealed class MemoryMapping(Memory memory, ushort begin, ushort mask, AccessLevel access)
{
public MemoryMapping(Memory memory, ushort begin, Mask mask, AccessLevel access)
: this(memory, begin, (ushort)mask, access)

View File

@@ -7,7 +7,7 @@ namespace EightBit
using System.Diagnostics;
[DebuggerDisplay("Word = {Word}")]
public class Register16
public sealed class Register16
{
private byte low;
private byte high;

View File

@@ -7,15 +7,10 @@ namespace EightBit
using System;
using System.IO;
public class Rom(int size) : Memory
public class Rom(int size = 0) : Memory
{
private byte[] bytes = new byte[size];
public Rom()
: this(0)
{
}
public override int Size => this.bytes.Length;
public static int Load(Stream file, ref byte[] output, int writeOffset = 0, int readOffset = 0, int limit = -1, int maximumSize = -1)