public MainWindow() { InitializeComponent(); _cpu = new B33Cpu.B33Cpu(); _cpu.LoadProgram(@"C:\Users\Alan\Documents\TicTacToeBare.B33"); _cpu.Hardware.Add(B33MainScreen); _cpu.Hardware.Add(new B33Cpu.Hardware.B33Keyboard(this)); _cpu.Hardware.Add(new B33Cpu.Hardware.B33Sound()); }
private static void CreateTest(string name, byte[] program) { var cpu = new B33Cpu.B33Cpu { Name = name }; cpu.Hardware.Add(new B33Cpu.Hardware.B33Sound()); cpu.B33Stopped += B33Stopped; cpu.LoadProgram(program, 0x1000, 0x1000); cpu.Start(); _testCounter++; }
public void Cpu_B33PostOpcodeExecute(B33Cpu.B33Cpu sender, bool isStore, ushort storeAddress) { if (!chkLiveUpdate.Checked) { return; } if (!isStore) { return; } if (storeAddress < 16 * sbMemory.Value || storeAddress > 16 * sbMemory.Value + 16 * 16 + 1) { return; } if (Application.OpenForms["MemoryViewerForm"] == null) { return; } UpdateMemoryView(); }
private static void B33Stopped(B33Cpu.B33Cpu sender, bool isStore, ushort storeAddress) { _testCounter--; if (sender.Name == "LDA Immediate Test") { if (RegistersEqual(sender.Registers, 99, 0, 0, 0)) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "LDB Immediate Test") { if (RegistersEqual(sender.Registers, 0, 12, 0, 0)) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "LDD Immediate Test") { if (RegistersEqual(sender.Registers, 0xA7, 0x42, 0, 0)) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "LDX Immediate Test") { if (RegistersEqual(sender.Registers, 0, 0, 0xFE23, 0)) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "LDY Immediate Test") { if (RegistersEqual(sender.Registers, 0, 0, 0, 0x920A)) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "STA Extended Test ") { if (RegistersEqual(sender.Registers, 99, 0, 0, 0) && sender.Peek(0x2000) == 99) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "STB Extended Test ") { if (RegistersEqual(sender.Registers, 0, 45, 0, 0) && sender.Peek(0x3000) == 45) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "STD Extended Test ") { if (RegistersEqual(sender.Registers, 0x56, 0x78, 0, 0) && sender.Peek(0x5000) == 0x78 && sender.Peek(0x5001) == 0x56) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "STX Extended Test ") { if (RegistersEqual(sender.Registers, 0, 0, 0x1234, 0) && sender.Peek(0x4000) == 0x34 && sender.Peek(0x4001) == 0x12) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "STY Extended Test ") { if (RegistersEqual(sender.Registers, 0, 0, 0, 0x90A1) && sender.Peek(0x6000) == 0xA1 && sender.Peek(0x6001) == 0x90) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "LDA Extended Test ") { if (RegistersEqual(sender.Registers, 0x34, 0, 0x1234, 0)) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "LDB Extended Test ") { if (RegistersEqual(sender.Registers, 0, 0x78, 0x5678, 0)) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "LDD Extended Test ") { if (RegistersEqual(sender.Registers, 0x90, 0xA1, 0x90A1, 0)) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "LDX Extended Test ") { if (RegistersEqual(sender.Registers, 0x00, 0x00, 0xD56F, 0xD56F)) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "LDY Extended Test ") { if (RegistersEqual(sender.Registers, 0x00, 0x00, 0xEA19, 0xEA19)) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "STA Indexed Test (0 Offset, no inc/dec)") { if (RegistersEqual(sender.Registers, 100, 0x00, 0x2000, 0x0000) && sender.Peek(0x2000) == 100) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "STB Indexed Test (0 Offset, no inc/dec)") { if (RegistersEqual(sender.Registers, 0x00, 100, 0x2000, 0x0000) && sender.Peek(0x2000) == 100) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "STA Indexed Test (0 Offset, +1 Increment)") { if (RegistersEqual(sender.Registers, 100, 0x00, 0x2001, 0x0000) && sender.Peek(0x2000) == 100) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "STB Indexed Test (0 Offset, +1 Increment)") { if (RegistersEqual(sender.Registers, 0x00, 100, 0x2001, 0x0000) && sender.Peek(0x2000) == 100) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "STA Indexed Test (0 Offset, +2 Increment)") { if (RegistersEqual(sender.Registers, 100, 0x00, 0x2002, 0x0000) && sender.Peek(0x2000) == 100) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "STB Indexed Test (0 Offset, +2 Increment)") { if (RegistersEqual(sender.Registers, 0x00, 100, 0x2002, 0x0000) && sender.Peek(0x2000) == 100) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "STA Indexed Test (Offset by B, no inc/dec)") { if (RegistersEqual(sender.Registers, 100, 0x0A, 0x2000, 0x0000) && sender.Peek(0x200A) == 100) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "STB Indexed Test (Offset by A, no inc/dec)") { if (RegistersEqual(sender.Registers, 0x0A, 100, 0x2000, 0x0000) && sender.Peek(0x200A) == 100) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "Call/Ret Test") { if (RegistersEqual(sender.Registers, 0, 0, 0x9876, 0x5432)) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "Push/Pop Test") { if (RegistersEqual(sender.Registers, 0x69, 0x93, 0x1234, 0)) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "ADDA Register Test") { if (RegistersEqual(sender.Registers, 81, 49, 0, 0)) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "ADDA Immediate Test") { if (RegistersEqual(sender.Registers, 81, 0, 0, 0)) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "SUBA Register Test") { if (RegistersEqual(sender.Registers, 17, 32, 0, 0)) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } if (sender.Name == "SUBA Immediate Test") { if (RegistersEqual(sender.Registers, 17, 0, 0, 0)) { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Passed!"); } } else { lock (_results) { _results.Add(sender.Name.PadRight(50, ' ') + " ==> Failed :("); } } } }