From 3379a0ac39b2f18376432080dd61c88c5977198e Mon Sep 17 00:00:00 2001 From: jnosek Date: Tue, 29 Jul 2014 13:28:02 -0400 Subject: [PATCH] Major refactoring for 16 bit registers Allows overflow correction, sign extending, and overlapping custom register actions with the memory map --- AGC.dev/Program.cs | 4 +- AGC/AGC.csproj | 14 ++- AGC/Base/ErasableMemory.cs | 56 +++++++++++ AGC/Base/FixedMemory.cs | 37 +++++++ AGC/Base/IRegister.cs | 12 +++ AGC/Base/IWord.cs | 16 +++ AGC/Base/MemoryAddress.cs | 13 ++- AGC/Base/Register.cs | 38 ------- AGC/Base/Word.cs | 34 +++++++ AGC/ExtraCodeInstructionSet.cs | 3 +- AGC/Instructions/AddToStorage.cs | 2 +- AGC/Instructions/Augment.cs | 13 ++- AGC/Instructions/BranchZeroToFixed.cs | 29 ++++++ AGC/Instructions/ExtraQuarterCode.cs | 36 +++++++ AGC/Instructions/TransferControl.cs | 2 +- AGC/MemoryMap.cs | 45 ++++++--- AGC/Processor.cs | 138 +++++++++++++------------- AGC/Registers/Accumulator.cs | 16 +++ AGC/Registers/FullRegister.cs | 55 ++++++++++ AGC/Registers/ProgramCounter.cs | 59 +++++++++++ AGC/Registers/Register.cs | 16 +++ 21 files changed, 507 insertions(+), 131 deletions(-) create mode 100644 AGC/Base/ErasableMemory.cs create mode 100644 AGC/Base/FixedMemory.cs create mode 100644 AGC/Base/IRegister.cs create mode 100644 AGC/Base/IWord.cs delete mode 100644 AGC/Base/Register.cs create mode 100644 AGC/Base/Word.cs create mode 100644 AGC/Instructions/BranchZeroToFixed.cs create mode 100644 AGC/Instructions/ExtraQuarterCode.cs create mode 100644 AGC/Registers/Accumulator.cs create mode 100644 AGC/Registers/FullRegister.cs create mode 100644 AGC/Registers/ProgramCounter.cs create mode 100644 AGC/Registers/Register.cs diff --git a/AGC.dev/Program.cs b/AGC.dev/Program.cs index 1c22c01..a3d838f 100644 --- a/AGC.dev/Program.cs +++ b/AGC.dev/Program.cs @@ -13,8 +13,8 @@ static void Main(string[] args) { var computer = new Computer(); - computer.Memory.GetAddress(0x300).Write(0x6301); - computer.Memory.GetAddress(0x301).Write(0x02); + computer.Memory.GetWord(0x300).Write(0x6301); + computer.Memory.GetWord(0x301).Write(0x02); computer.CPU.Z.Write(0x300); computer.CPU.Execute(); diff --git a/AGC/AGC.csproj b/AGC/AGC.csproj index a53d221..907bb7c 100644 --- a/AGC/AGC.csproj +++ b/AGC/AGC.csproj @@ -37,9 +37,14 @@ - + + + + + - + + @@ -48,11 +53,16 @@ + + + + +