diff --git a/EightBit/BigEndianProcessor.cs b/EightBit/BigEndianProcessor.cs index 525ae16..242bce3 100644 --- a/EightBit/BigEndianProcessor.cs +++ b/EightBit/BigEndianProcessor.cs @@ -14,18 +14,21 @@ namespace EightBit public override void PokeWord(ushort address, Register16 value) { + ArgumentNullException.ThrowIfNull(value); this.Bus.Poke(address, value.High); this.Bus.Poke(++address, value.Low); } protected override void FetchInto(Register16 into) { + ArgumentNullException.ThrowIfNull(into); into.High = this.FetchByte(); into.Low = this.FetchByte(); } protected override void GetInto(Register16 into) { + ArgumentNullException.ThrowIfNull(into); into.High = this.MemoryRead(); _ = this.Bus.Address.Increment(); into.Low = this.MemoryRead(); @@ -41,18 +44,21 @@ namespace EightBit protected override void PopInto(Register16 into) { + ArgumentNullException.ThrowIfNull(into); into.High = this.Pop(); into.Low = this.Pop(); } protected override void PushWord(Register16 value) { + ArgumentNullException.ThrowIfNull(value); this.Push(value.Low); this.Push(value.High); } protected override void SetWord(Register16 value) { + ArgumentNullException.ThrowIfNull(value); this.MemoryWrite(value.High); _ = this.Bus.Address.Increment(); this.MemoryWrite(value.Low); @@ -60,6 +66,7 @@ namespace EightBit protected override void SetWordPaged(Register16 value) { + ArgumentNullException.ThrowIfNull(value); this.MemoryWrite(value.High); ++this.Bus.Address.Low; this.MemoryWrite(value.Low); diff --git a/EightBit/Bus.cs b/EightBit/Bus.cs index aa1664a..c14f3dd 100644 --- a/EightBit/Bus.cs +++ b/EightBit/Bus.cs @@ -24,13 +24,21 @@ namespace EightBit public byte Peek(ushort absolute) => this.Reference(absolute); - public byte Peek(Register16 absolute) => this.Peek(absolute.Word); + public byte Peek(Register16 absolute) + { + ArgumentNullException.ThrowIfNull(absolute); + return this.Peek(absolute.Word); + } public void Poke(byte value) => this.Reference() = value; public void Poke(ushort absolute, byte value) => this.Reference(absolute) = value; - public void Poke(Register16 absolute, byte value) => this.Poke(absolute.Word, value); + public void Poke(Register16 absolute, byte value) + { + ArgumentNullException.ThrowIfNull(absolute); + this.Poke(absolute.Word, value); + } public byte Read() { diff --git a/EightBit/EightBit.UnitTest/EightBit.UnitTest.csproj b/EightBit/EightBit.UnitTest/EightBit.UnitTest.csproj index eea8318..02dc9ba 100644 --- a/EightBit/EightBit.UnitTest/EightBit.UnitTest.csproj +++ b/EightBit/EightBit.UnitTest/EightBit.UnitTest.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 latest enable enable @@ -9,7 +9,7 @@ Exe true True - latest + latest-all