diff --git a/Contralto/AboutBox.Designer.cs b/Contralto/AboutBox.Designer.cs new file mode 100644 index 0000000..07e2de6 --- /dev/null +++ b/Contralto/AboutBox.Designer.cs @@ -0,0 +1,102 @@ +namespace Contralto +{ + partial class AboutBox + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AboutBox)); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.OkButton = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(53, 18); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(74, 13); + this.label1.TabIndex = 0; + this.label1.Text = "ContrAlto v0.1"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(12, 66); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(168, 13); + this.label2.TabIndex = 1; + this.label2.Text = "(c) 2015 Living Computer Museum"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(39, 41); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(109, 13); + this.label3.TabIndex = 2; + this.label3.Text = "A Xerox Alto Emulator"; + // + // OkButton + // + this.OkButton.Location = new System.Drawing.Point(52, 96); + this.OkButton.Name = "OkButton"; + this.OkButton.Size = new System.Drawing.Size(75, 23); + this.OkButton.TabIndex = 3; + this.OkButton.Text = "OK!"; + this.OkButton.UseVisualStyleBackColor = true; + this.OkButton.Click += new System.EventHandler(this.OkButton_Click); + // + // AboutBox + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(191, 131); + this.Controls.Add(this.OkButton); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "AboutBox"; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.Text = "About ContrAlto"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Button OkButton; + } +} \ No newline at end of file diff --git a/Contralto/AboutBox.cs b/Contralto/AboutBox.cs new file mode 100644 index 0000000..05b602a --- /dev/null +++ b/Contralto/AboutBox.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Contralto +{ + public partial class AboutBox : Form + { + public AboutBox() + { + InitializeComponent(); + } + + private void OkButton_Click(object sender, EventArgs e) + { + this.Close(); + } + } +} diff --git a/Contralto/AboutBox.resx b/Contralto/AboutBox.resx new file mode 100644 index 0000000..806dbb3 --- /dev/null +++ b/Contralto/AboutBox.resx @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + + AAABAAIAICAAAAAACACoCAAAJgAAABAQAAAAAAgAaAUAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAD///8ABwcHBwcHBwcHBwAABwcHBwcHBwcHBwcHBwcAAAcHBwcHBwcHBwcHBwcA + AAcHBwcHBwcHBwcHBwcHAAAHBwcHBwcHBwcHBwcHAAAHBwcHBwcHBwcHBwcHBwAABwcHBwcHBwcHBwAH + BwAABwcHBwcHBwcHBwcAAAcAAAcHBwcHBwcHBwcHAAAAAAcHBwcHBwcHBwcHBwAAAAAAAAAHBwcHBwcH + BwcAAAAAAAAHBwcHBwcHBwcHAAAAAAAHBwcHBwcHBwcHBwAAAAAHBwcHBwcHBwcHBwcAAAAHBwcHBwcH + BwcHBwcHAAAHBwcHBwcHBwcHBwcHBwAHBwcHBwcHBwcHBwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + + + \ No newline at end of file diff --git a/Contralto/Alto.ico b/Contralto/Alto.ico new file mode 100644 index 0000000..b14c091 Binary files /dev/null and b/Contralto/Alto.ico differ diff --git a/Contralto/AltoSystem.cs b/Contralto/AltoSystem.cs index 9344db5..3d59e48 100644 --- a/Contralto/AltoSystem.cs +++ b/Contralto/AltoSystem.cs @@ -5,6 +5,8 @@ using Contralto.IO; using Contralto.Memory; using Contralto.Display; using System.Timers; +using System.IO; +using System; namespace Contralto { @@ -86,6 +88,33 @@ namespace Contralto _clocks++; } + public void LoadDrive(int drive, string path) + { + if (drive < 0 || drive > 1) + { + throw new InvalidOperationException("drive must be 0 or 1."); + } + DiabloPack newPack = new DiabloPack(DiabloDiskType.Diablo31); + + using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read)) + { + newPack.Load(fs, false); + fs.Close(); + } + + _diskController.Drives[drive].LoadPack(newPack); + } + + public void UnloadDrive(int drive) + { + if (drive < 0 || drive > 1) + { + throw new InvalidOperationException("drive must be 0 or 1."); + } + + _diskController.Drives[drive].UnloadPack(); + } + public AltoCPU CPU { get { return _cpu; } diff --git a/Contralto/AltoWindow.Designer.cs b/Contralto/AltoWindow.Designer.cs index 44454ce..38d0bf6 100644 --- a/Contralto/AltoWindow.Designer.cs +++ b/Contralto/AltoWindow.Designer.cs @@ -28,6 +28,7 @@ /// private void InitializeComponent() { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AltoWindow)); this.DisplayBox = new System.Windows.Forms.PictureBox(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -42,8 +43,7 @@ this.loadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.unloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.debuggerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.showDebuggerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.SystemShowDebuggerMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.StatusLine = new System.Windows.Forms.StatusStrip(); @@ -70,7 +70,6 @@ this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.fileToolStripMenuItem, this.settingsToolStripMenuItem, - this.debuggerToolStripMenuItem, this.helpToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; @@ -91,6 +90,7 @@ this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; this.exitToolStripMenuItem.Size = new System.Drawing.Size(92, 22); this.exitToolStripMenuItem.Text = "Exit"; + this.exitToolStripMenuItem.Click += new System.EventHandler(this.OnFileExitClick); // // settingsToolStripMenuItem // @@ -99,7 +99,8 @@ this.SystemResetMenuItem, this.drive0ToolStripMenuItem, this.drive1ToolStripMenuItem, - this.optionsToolStripMenuItem}); + this.optionsToolStripMenuItem, + this.SystemShowDebuggerMenuItem}); this.settingsToolStripMenuItem.Name = "settingsToolStripMenuItem"; this.settingsToolStripMenuItem.Size = new System.Drawing.Size(54, 20); this.settingsToolStripMenuItem.Text = "System"; @@ -117,6 +118,7 @@ this.SystemResetMenuItem.Name = "SystemResetMenuItem"; this.SystemResetMenuItem.Size = new System.Drawing.Size(152, 22); this.SystemResetMenuItem.Text = "Reset"; + this.SystemResetMenuItem.Click += new System.EventHandler(this.OnSystemResetMenuClick); // // drive0ToolStripMenuItem // @@ -132,12 +134,14 @@ this.loadToolStripMenuItem1.Name = "loadToolStripMenuItem1"; this.loadToolStripMenuItem1.Size = new System.Drawing.Size(119, 22); this.loadToolStripMenuItem1.Text = "Load..."; + this.loadToolStripMenuItem1.Click += new System.EventHandler(this.OnSystemDrive0LoadClick); // // unloadToolStripMenuItem1 // this.unloadToolStripMenuItem1.Name = "unloadToolStripMenuItem1"; this.unloadToolStripMenuItem1.Size = new System.Drawing.Size(119, 22); this.unloadToolStripMenuItem1.Text = "Unload..."; + this.unloadToolStripMenuItem1.Click += new System.EventHandler(this.OnSystemDrive0UnloadClick); // // drive1ToolStripMenuItem // @@ -153,12 +157,14 @@ this.loadToolStripMenuItem.Name = "loadToolStripMenuItem"; this.loadToolStripMenuItem.Size = new System.Drawing.Size(119, 22); this.loadToolStripMenuItem.Text = "Load..."; + this.loadToolStripMenuItem.Click += new System.EventHandler(this.OnSystemDrive1LoadClick); // // unloadToolStripMenuItem // this.unloadToolStripMenuItem.Name = "unloadToolStripMenuItem"; this.unloadToolStripMenuItem.Size = new System.Drawing.Size(119, 22); this.unloadToolStripMenuItem.Text = "Unload..."; + this.unloadToolStripMenuItem.Click += new System.EventHandler(this.OnSystemDrive1UnloadClick); // // optionsToolStripMenuItem // @@ -166,19 +172,12 @@ this.optionsToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.optionsToolStripMenuItem.Text = "Options..."; // - // debuggerToolStripMenuItem + // SystemShowDebuggerMenuItem // - this.debuggerToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.showDebuggerToolStripMenuItem}); - this.debuggerToolStripMenuItem.Name = "debuggerToolStripMenuItem"; - this.debuggerToolStripMenuItem.Size = new System.Drawing.Size(66, 20); - this.debuggerToolStripMenuItem.Text = "Debugger"; - // - // showDebuggerToolStripMenuItem - // - this.showDebuggerToolStripMenuItem.Name = "showDebuggerToolStripMenuItem"; - this.showDebuggerToolStripMenuItem.Size = new System.Drawing.Size(150, 22); - this.showDebuggerToolStripMenuItem.Text = "Show Debugger"; + this.SystemShowDebuggerMenuItem.Name = "SystemShowDebuggerMenuItem"; + this.SystemShowDebuggerMenuItem.Size = new System.Drawing.Size(152, 22); + this.SystemShowDebuggerMenuItem.Text = "Show Debugger"; + this.SystemShowDebuggerMenuItem.Click += new System.EventHandler(this.OnDebuggerShowClick); // // helpToolStripMenuItem // @@ -193,6 +192,7 @@ this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; this.aboutToolStripMenuItem.Size = new System.Drawing.Size(103, 22); this.aboutToolStripMenuItem.Text = "About"; + this.aboutToolStripMenuItem.Click += new System.EventHandler(this.OnHelpAboutClick); // // StatusLine // @@ -219,14 +219,18 @@ this.Controls.Add(this.StatusLine); this.Controls.Add(this.DisplayBox); this.Controls.Add(this.menuStrip1); + this.DoubleBuffered = true; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MainMenuStrip = this.menuStrip1; - this.MinimizeBox = false; + this.MaximizeBox = false; this.Name = "AltoWindow"; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.Text = "ContrAlto"; + this.Deactivate += new System.EventHandler(this.OnWindowDeactivate); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnKeyDown); this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.OnKeyUp); + this.Leave += new System.EventHandler(this.OnWindowLeave); ((System.ComponentModel.ISupportInitialize)(this.DisplayBox)).EndInit(); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); @@ -255,9 +259,8 @@ private System.Windows.Forms.ToolStripMenuItem loadToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem unloadToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem debuggerToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem showDebuggerToolStripMenuItem; private System.Windows.Forms.StatusStrip StatusLine; private System.Windows.Forms.ToolStripStatusLabel StatusLabel; + private System.Windows.Forms.ToolStripMenuItem SystemShowDebuggerMenuItem; } } \ No newline at end of file diff --git a/Contralto/AltoWindow.resx b/Contralto/AltoWindow.resx index 501e458..8227c8e 100644 --- a/Contralto/AltoWindow.resx +++ b/Contralto/AltoWindow.resx @@ -120,7 +120,76 @@ 17, 17 + + True + 126, 17 + + + + AAABAAIAICAAAAAACACoCAAAJgAAABAQAAAAAAgAaAUAAM4IAAAoAAAAIAAAAEAAAAABAAgAAAAAAAAE + AAAAAAAAAAAAAAABAAAAAQAAAAAAAEJCQgBYWFgAY2JjAG5tbgB5eHgAhoaGAJGRkQCamZkApKOkAK+u + rwC6uboAxcTFAPHv8AD29vYA+fn5AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAD///8ABwcHBwcHBwcHBwAABwcHBwcHBwcHBwcHBwcAAAcHBwcHBwcHBwcHBwcA + AAcHBwcHBwcHBwcHBwcHAAAHBwcHBwcHBwcHBwcHAAAHBwcHBwcHBwcHBwcHBwAABwcHBwcHBwcHBwAH + BwAABwcHBwcHBwcHBwcAAAcAAAcHBwcHBwcHBwcHAAAAAAcHBwcHBwcHBwcHBwAAAAAAAAAHBwcHBwcH + BwcAAAAAAAAHBwcHBwcHBwcHAAAAAAAHBwcHBwcHBwcHBwAAAAAHBwcHBwcHBwcHBwcAAAAHBwcHBwcH + BwcHBwcHAAAHBwcHBwcHBwcHBwcHBwAHBwcHBwcHBwcHBwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + + \ No newline at end of file diff --git a/Contralto/Contralto.csproj b/Contralto/Contralto.csproj index d3be055..38c3677 100644 --- a/Contralto/Contralto.csproj +++ b/Contralto/Contralto.csproj @@ -63,6 +63,12 @@ + + Form + + + AboutBox.cs + Form @@ -109,6 +115,7 @@ + @@ -271,6 +278,9 @@ + + AboutBox.cs + AltoWindow.cs @@ -279,6 +289,7 @@ + diff --git a/Contralto/Debugger.Designer.cs b/Contralto/Debugger.Designer.cs index 7e519ca..714be87 100644 --- a/Contralto/Debugger.Designer.cs +++ b/Contralto/Debugger.Designer.cs @@ -35,6 +35,9 @@ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); @@ -50,9 +53,7 @@ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle23 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle24 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle25 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Debugger)); this.Microcode = new System.Windows.Forms.GroupBox(); this.SourceTabs = new System.Windows.Forms.TabControl(); this.Rom0Page = new System.Windows.Forms.TabPage(); @@ -63,6 +64,10 @@ this.Source = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Rom1Page = new System.Windows.Forms.TabPage(); this._rom1SourceViewer = new System.Windows.Forms.DataGridView(); + this.dataGridViewCheckBoxColumn1 = new System.Windows.Forms.DataGridViewCheckBoxColumn(); + this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Rom2Page = new System.Windows.Forms.TabPage(); this._ram0SourceViewer = new System.Windows.Forms.DataGridView(); this.dataGridViewCheckBoxColumn2 = new System.Windows.Forms.DataGridViewCheckBoxColumn(); @@ -104,12 +109,6 @@ this.ResetButton = new System.Windows.Forms.Button(); this.RunToNextTaskButton = new System.Windows.Forms.Button(); this.NovaStep = new System.Windows.Forms.Button(); - this.groupBox6 = new System.Windows.Forms.GroupBox(); - this.DisplayBox = new System.Windows.Forms.PictureBox(); - this.dataGridViewCheckBoxColumn1 = new System.Windows.Forms.DataGridViewCheckBoxColumn(); - this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Microcode.SuspendLayout(); this.SourceTabs.SuspendLayout(); this.Rom0Page.SuspendLayout(); @@ -128,8 +127,6 @@ ((System.ComponentModel.ISupportInitialize)(this._memoryData)).BeginInit(); this.groupBox5.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this._diskData)).BeginInit(); - this.groupBox6.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.DisplayBox)).BeginInit(); this.SuspendLayout(); // // Microcode @@ -306,6 +303,55 @@ this._rom1SourceViewer.TabIndex = 2; this._rom1SourceViewer.TabStop = false; // + // dataGridViewCheckBoxColumn1 + // + this.dataGridViewCheckBoxColumn1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; + this.dataGridViewCheckBoxColumn1.FalseValue = "false"; + this.dataGridViewCheckBoxColumn1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.dataGridViewCheckBoxColumn1.HeaderText = "B"; + this.dataGridViewCheckBoxColumn1.IndeterminateValue = "null"; + this.dataGridViewCheckBoxColumn1.Name = "dataGridViewCheckBoxColumn1"; + this.dataGridViewCheckBoxColumn1.ReadOnly = true; + this.dataGridViewCheckBoxColumn1.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.dataGridViewCheckBoxColumn1.TrueValue = "true"; + this.dataGridViewCheckBoxColumn1.Width = 20; + // + // dataGridViewTextBoxColumn4 + // + this.dataGridViewTextBoxColumn4.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader; + dataGridViewCellStyle7.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.dataGridViewTextBoxColumn4.DefaultCellStyle = dataGridViewCellStyle7; + this.dataGridViewTextBoxColumn4.HeaderText = "Addr"; + this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4"; + this.dataGridViewTextBoxColumn4.ReadOnly = true; + this.dataGridViewTextBoxColumn4.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.dataGridViewTextBoxColumn4.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; + this.dataGridViewTextBoxColumn4.Width = 5; + // + // dataGridViewTextBoxColumn3 + // + this.dataGridViewTextBoxColumn3.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader; + dataGridViewCellStyle8.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dataGridViewTextBoxColumn3.DefaultCellStyle = dataGridViewCellStyle8; + this.dataGridViewTextBoxColumn3.HeaderText = "Word"; + this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3"; + this.dataGridViewTextBoxColumn3.ReadOnly = true; + this.dataGridViewTextBoxColumn3.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.dataGridViewTextBoxColumn3.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; + this.dataGridViewTextBoxColumn3.Width = 5; + // + // dataGridViewTextBoxColumn5 + // + this.dataGridViewTextBoxColumn5.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + dataGridViewCellStyle9.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.dataGridViewTextBoxColumn5.DefaultCellStyle = dataGridViewCellStyle9; + this.dataGridViewTextBoxColumn5.HeaderText = "Source Code"; + this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5"; + this.dataGridViewTextBoxColumn5.ReadOnly = true; + this.dataGridViewTextBoxColumn5.Resizable = System.Windows.Forms.DataGridViewTriState.False; + this.dataGridViewTextBoxColumn5.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; + // // Rom2Page // this.Rom2Page.Controls.Add(this._ram0SourceViewer); @@ -890,84 +936,11 @@ this.NovaStep.UseVisualStyleBackColor = true; this.NovaStep.Click += new System.EventHandler(this.NovaStep_Click); // - // groupBox6 - // - this.groupBox6.Controls.Add(this.DisplayBox); - this.groupBox6.Location = new System.Drawing.Point(758, 3); - this.groupBox6.Name = "groupBox6"; - this.groupBox6.Size = new System.Drawing.Size(617, 834); - this.groupBox6.TabIndex = 15; - this.groupBox6.TabStop = false; - this.groupBox6.Text = "Display"; - // - // DisplayBox - // - this.DisplayBox.BackColor = System.Drawing.SystemColors.Window; - this.DisplayBox.Location = new System.Drawing.Point(6, 19); - this.DisplayBox.Name = "DisplayBox"; - this.DisplayBox.Size = new System.Drawing.Size(606, 808); - this.DisplayBox.TabIndex = 0; - this.DisplayBox.TabStop = false; - this.DisplayBox.MouseDown += new System.Windows.Forms.MouseEventHandler(this.OnDisplayMouseDown); - this.DisplayBox.MouseMove += new System.Windows.Forms.MouseEventHandler(this.OnDisplayMouseMove); - this.DisplayBox.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OnDisplayMouseUp); - this.DisplayBox.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.DisplayBox_PreviewKeyDown); - // - // dataGridViewCheckBoxColumn1 - // - this.dataGridViewCheckBoxColumn1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; - this.dataGridViewCheckBoxColumn1.FalseValue = "false"; - this.dataGridViewCheckBoxColumn1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.dataGridViewCheckBoxColumn1.HeaderText = "B"; - this.dataGridViewCheckBoxColumn1.IndeterminateValue = "null"; - this.dataGridViewCheckBoxColumn1.Name = "dataGridViewCheckBoxColumn1"; - this.dataGridViewCheckBoxColumn1.ReadOnly = true; - this.dataGridViewCheckBoxColumn1.Resizable = System.Windows.Forms.DataGridViewTriState.False; - this.dataGridViewCheckBoxColumn1.TrueValue = "true"; - this.dataGridViewCheckBoxColumn1.Width = 20; - // - // dataGridViewTextBoxColumn4 - // - this.dataGridViewTextBoxColumn4.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader; - dataGridViewCellStyle7.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.dataGridViewTextBoxColumn4.DefaultCellStyle = dataGridViewCellStyle7; - this.dataGridViewTextBoxColumn4.HeaderText = "Addr"; - this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4"; - this.dataGridViewTextBoxColumn4.ReadOnly = true; - this.dataGridViewTextBoxColumn4.Resizable = System.Windows.Forms.DataGridViewTriState.False; - this.dataGridViewTextBoxColumn4.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; - this.dataGridViewTextBoxColumn4.Width = 5; - // - // dataGridViewTextBoxColumn3 - // - this.dataGridViewTextBoxColumn3.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader; - dataGridViewCellStyle8.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dataGridViewTextBoxColumn3.DefaultCellStyle = dataGridViewCellStyle8; - this.dataGridViewTextBoxColumn3.HeaderText = "Word"; - this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3"; - this.dataGridViewTextBoxColumn3.ReadOnly = true; - this.dataGridViewTextBoxColumn3.Resizable = System.Windows.Forms.DataGridViewTriState.False; - this.dataGridViewTextBoxColumn3.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; - this.dataGridViewTextBoxColumn3.Width = 5; - // - // dataGridViewTextBoxColumn5 - // - this.dataGridViewTextBoxColumn5.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - dataGridViewCellStyle9.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.dataGridViewTextBoxColumn5.DefaultCellStyle = dataGridViewCellStyle9; - this.dataGridViewTextBoxColumn5.HeaderText = "Source Code"; - this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5"; - this.dataGridViewTextBoxColumn5.ReadOnly = true; - this.dataGridViewTextBoxColumn5.Resizable = System.Windows.Forms.DataGridViewTriState.False; - this.dataGridViewTextBoxColumn5.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; - // // Debugger // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1376, 997); - this.Controls.Add(this.groupBox6); + this.ClientSize = new System.Drawing.Size(750, 997); this.Controls.Add(this.NovaStep); this.Controls.Add(this.RunToNextTaskButton); this.Controls.Add(this.ResetButton); @@ -983,13 +956,15 @@ this.Controls.Add(this.StepButton); this.Controls.Add(this.groupBox1); this.Controls.Add(this.Microcode); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.KeyPreview = true; + this.MaximizeBox = false; + this.MinimizeBox = false; this.Name = "Debugger"; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.Text = "Debugger"; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.OnDebuggerClosed); this.Load += new System.EventHandler(this.Debugger_Load); - this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Debugger_KeyDown); - this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Debugger_KeyUp); - this.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.Debugger_PreviewKeyDown); this.Microcode.ResumeLayout(false); this.Microcode.PerformLayout(); this.SourceTabs.ResumeLayout(false); @@ -1009,8 +984,6 @@ ((System.ComponentModel.ISupportInitialize)(this._memoryData)).EndInit(); this.groupBox5.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this._diskData)).EndInit(); - this.groupBox6.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.DisplayBox)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -1059,8 +1032,6 @@ private System.Windows.Forms.DataGridViewTextBoxColumn Address; private System.Windows.Forms.DataGridViewTextBoxColumn Data; private System.Windows.Forms.DataGridViewTextBoxColumn Disassembly; - private System.Windows.Forms.GroupBox groupBox6; - private System.Windows.Forms.PictureBox DisplayBox; private System.Windows.Forms.TabControl SourceTabs; private System.Windows.Forms.TabPage Rom0Page; private System.Windows.Forms.TabPage Rom1Page; diff --git a/Contralto/Debugger.cs b/Contralto/Debugger.cs index a21b622..cba9543 100644 --- a/Contralto/Debugger.cs +++ b/Contralto/Debugger.cs @@ -19,17 +19,24 @@ namespace Contralto /// /// A basic & hacky debugger. To be improved. /// - public partial class Debugger : Form, IAltoDisplay + public partial class Debugger : Form { - public Debugger(AltoSystem system) + public Debugger(AltoSystem system, ExecutionController controller) { _system = system; + _controller = controller; _microcodeBreakpointEnabled = new bool[1024]; _novaBreakpointEnabled = new bool[65536]; + _controller.StepCallback += OnExecutionStep; + _controller.ErrorCallback += OnExecutionError; + + // Pick up the current execution status (if the main window hands us a running + // system, we want to know). + _execType = _controller.IsRunning ? ExecutionType.Normal : ExecutionType.None; + InitializeComponent(); - InitControls(); - InitKeymap(); + InitControls(); RefreshUI(); } @@ -75,87 +82,13 @@ namespace Contralto base.Refresh(); RefreshUI(); - } - - public void Render() - { - BeginInvoke(new StepDelegate(RefreshDisplayBox)); } - private void RefreshDisplayBox() + + private void OnDebuggerClosed(object sender, FormClosedEventArgs e) { - // Update the display - BitmapData data = _displayBuffer.LockBits(_displayRect, ImageLockMode.WriteOnly, PixelFormat.Format1bppIndexed); - - IntPtr ptr = data.Scan0; - System.Runtime.InteropServices.Marshal.Copy(_displayData, 0, ptr, _displayData.Length); - - _displayBuffer.UnlockBits(data); - DisplayBox.Refresh(); - - // If you want interlacing to be more visible: - //Array.Clear(_displayData, 0, _displayData.Length); - } - - /// - /// Invoked by the DisplayController to put a word on the emulated screen. - /// - /// - /// - /// - public void DrawDisplayWord(int scanline, int wordOffset, ushort word, bool lowRes) - { - // TODO: move magic numbers to constants - - if (lowRes) - { - // Low resolution; double up pixels. - int address = scanline * 76 + wordOffset * 4; - - if (address > _displayData.Length) - { - throw new InvalidOperationException("Display word address is out of bounds."); - } - - UInt32 stretched = StretchWord(word); - - _displayData[address] = (byte)(stretched >> 24); - _displayData[address + 1] = (byte)(stretched >> 16); - _displayData[address + 2] = (byte)(stretched >> 8); - _displayData[address + 3] = (byte)(stretched); - } - else - { - int address = scanline * 76 + wordOffset * 2; - - if (address > _displayData.Length) - { - throw new InvalidOperationException("Display word address is out of bounds."); - } - - _displayData[address] = (byte)(word >> 8); - _displayData[address + 1] = (byte)(word); - } - } - - /// - /// "Stretches" a 16 bit word into a 32-bit word (for low-res display purposes). - /// - /// - /// - private UInt32 StretchWord(ushort word) - { - UInt32 stretched = 0; - - for(int i=0x8000, j=15;j>=0; i=i>>1, j--) - { - uint bit = (uint)(word & i) >> j; - - stretched |= (bit << (j * 2 + 1)); - stretched |= (bit << (j * 2)); - } - - return stretched; + _controller.StepCallback -= OnExecutionStep; + _controller.ErrorCallback -= OnExecutionError; } private void RefreshUI() @@ -252,16 +185,7 @@ namespace Contralto case ExecutionState.InternalError: ExecutionStateLabel.Text = String.Format("Stopped (error {0})", _lastExceptionText); break; - } - - // Update the display - BitmapData data = _displayBuffer.LockBits(_displayRect, ImageLockMode.WriteOnly, PixelFormat.Format1bppIndexed); - - IntPtr ptr = data.Scan0; - System.Runtime.InteropServices.Marshal.Copy(_displayData, 0, ptr, _displayData.Length); - - _displayBuffer.UnlockBits(data); - + } } private void RefreshMicrocodeDisassembly() @@ -323,10 +247,6 @@ namespace Contralto _diskData.Rows.Add("KCOM", "0"); _diskData.Rows.Add("KSTAT", "0"); _diskData.Rows.Add("RECNO", "0"); - - _displayBuffer = new Bitmap(608, 808, PixelFormat.Format1bppIndexed); - - DisplayBox.Image = _displayBuffer; } @@ -721,53 +641,38 @@ namespace Contralto private void OnStepButtonClicked(object sender, EventArgs e) { - StopExecThread(); - - SetExecutionState(ExecutionState.SingleStep); - ExecuteStep(); - SetExecutionState(ExecutionState.Stopped); + _execType = ExecutionType.Step; + SetExecutionState(ExecutionState.SingleStep); + _controller.StartExecution(); } private void OnAutoStepButtonClicked(object sender, EventArgs e) { - StopExecThread(); // // Continuously step (and update the UI) // until the "Stop" button is pressed or something bad happens. // - _execThread = new Thread(new System.Threading.ParameterizedThreadStart(ExecuteProc)); - _execThread.Start(ExecutionType.Auto); + _execType = ExecutionType.Auto; SetExecutionState(ExecutionState.AutoStep); + _controller.StartExecution(); } private void RunButton_Click(object sender, EventArgs e) { - StopExecThread(); // // Continuously execute, but do not update UI // until the "Stop" button is pressed or something bad happens. - // - //if (_execThread == null) - { - _execThread = new Thread(new System.Threading.ParameterizedThreadStart(ExecuteProc)); - _execThread.Start(ExecutionType.Normal); - SetExecutionState(ExecutionState.Running); - } + // + _execType = ExecutionType.Normal; + SetExecutionState(ExecutionState.Running); + _controller.StartExecution(); } private void RunToNextTaskButton_Click(object sender, EventArgs e) - { - StopExecThread(); - // - // Continuously execute until the next task switch but do not update UI - // until the "Stop" button is pressed or something bad happens. - // - //if (_execThread == null) - { - _execThread = new Thread(new System.Threading.ParameterizedThreadStart(ExecuteProc)); - _execThread.Start(ExecutionType.NextTask); - SetExecutionState(ExecutionState.Running); - } + { + _execType = ExecutionType.NextTask; + SetExecutionState(ExecutionState.Running); + _controller.StartExecution(); } /// @@ -780,316 +685,89 @@ namespace Contralto /// private void NovaStep_Click(object sender, EventArgs e) { - StopExecThread(); - - { - _execThread = new Thread(new System.Threading.ParameterizedThreadStart(ExecuteProc)); - _execThread.Start(ExecutionType.NextNovaInstruction); - SetExecutionState(ExecutionState.Running); - } + _execType = ExecutionType.NextNovaInstruction; + SetExecutionState(ExecutionState.Running); + _controller.StartExecution(); + } private void OnStopButtonClicked(object sender, EventArgs e) - { - StopExecThread(); + { + _controller.StopExecution(); Refresh(); } private void ResetButton_Click(object sender, EventArgs e) { - StopExecThread(); - _system.Reset(); + _controller.Reset(); Refresh(); + } + + private void OnExecutionError(Exception e) + { + _lastExceptionText = e.Message; + SetExecutionState(ExecutionState.InternalError); } - private void ExecuteStep() + private bool OnExecutionStep() { - StopExecThread(); - _system.SingleStep(); - Refresh(); - } - - private void StopExecThread() - { - if (_execThread != null && - _execThread.IsAlive) + switch (_execType) { - // Signal for the exec thread to end - _execAbort = true; - - // Wait for the thread to exit. - _execThread.Join(); - - _execThread = null; - } - - SetExecutionState(ExecutionState.Stopped); - } - - private void ExecuteProc(object param) - { - ExecutionType execType = (ExecutionType)param; - - StepDelegate refUI = new StepDelegate(RefreshUI); - StepDelegate inv = new StepDelegate(Invalidate); - while (true) - { - bool internalError = false; - - try - { - switch (execType) + case ExecutionType.Auto: { - case ExecutionType.Auto: - { - // Execute a single step, then update UI and - // sleep to give messages time to run. - _system.SingleStep(); + // Execute a single step, then update UI and + // sleep to give messages time to run. + this.BeginInvoke(new StepDelegate(RefreshUI)); + this.BeginInvoke(new StepDelegate(Invalidate)); + System.Threading.Thread.Sleep(10); + return true; /* break always */ + } - this.BeginInvoke(refUI); - this.BeginInvoke(inv); - System.Threading.Thread.Sleep(10); - } - break; - - case ExecutionType.Step: - case ExecutionType.Normal: - case ExecutionType.NextTask: - case ExecutionType.NextNovaInstruction: - { - // Just execute one step, do not update UI. - _system.SingleStep(); - } - break; - } - } - catch(Exception e) - { - internalError = true; - _lastExceptionText = e.Message; - } - - if (internalError) - { - // - // Stop here because of an execution error. - // - this.BeginInvoke(refUI); - this.BeginInvoke(inv); - - - SetExecutionState(ExecutionState.InternalError); - - break; - } - - if (_execAbort || // The Stop button was hit - _microcodeBreakpointEnabled[_system.CPU.CurrentTask.MPC] || // A microcode breakpoint was hit - (execType == ExecutionType.NextTask && - _system.CPU.NextTask != null && - _system.CPU.NextTask != _system.CPU.CurrentTask) || // The next task was switched to - (_system.CPU.CurrentTask.MPC == 0x10 && // MPC is 20(octal) meaning a new Nova instruction and... - (_novaBreakpointEnabled[_system.CPU.R[6]] || // A breakpoint is set here - execType == ExecutionType.NextNovaInstruction))) // or we're running only a single Nova instruction. - { - // Stop here as we've hit a breakpoint or have been stopped - // Update UI to indicate where we stopped. - this.BeginInvoke(refUI); - this.BeginInvoke(inv); - - if (!_execAbort) + case ExecutionType.Step: + return true; /* break always */ + + case ExecutionType.Normal: + case ExecutionType.NextTask: + case ExecutionType.NextNovaInstruction: + // See if we need to stop here + if (_execAbort || // The Stop button was hit + _microcodeBreakpointEnabled[_system.CPU.CurrentTask.MPC] || // A microcode breakpoint was hit + (_execType == ExecutionType.NextTask && + _system.CPU.NextTask != null && + _system.CPU.NextTask != _system.CPU.CurrentTask) || // The next task was switched to + (_system.CPU.CurrentTask.MPC == 0x10 && // MPC is 20(octal) meaning a new Nova instruction and... + (_novaBreakpointEnabled[_system.CPU.R[6]] || // A breakpoint is set here + _execType == ExecutionType.NextNovaInstruction))) // or we're running only a single Nova instruction. { - SetExecutionState(ExecutionState.BreakpointStop); + // Stop here as we've hit a breakpoint or have been stopped + // Update UI to indicate where we stopped. + this.BeginInvoke(new StepDelegate(RefreshUI)); + this.BeginInvoke(new StepDelegate(Invalidate)); + + if (!_execAbort) + { + SetExecutionState(ExecutionState.BreakpointStop); + } + + _execAbort = false; + return true; } - _execAbort = false; break; - } } + + return false; } + + private void SetExecutionState(ExecutionState state) { _execState = state; this.BeginInvoke(new StepDelegate(RefreshUI)); } - - // Hacky initial implementation of keyboard input. - private void Debugger_KeyDown(object sender, KeyEventArgs e) - { - //e.Handled = true; - //e.SuppressKeyPress = true; - if (_keyMap.ContainsKey(e.KeyCode)) - { - _system.Keyboard.KeyDown(_keyMap[e.KeyCode]); - } - - if (e.Control) - { - _system.Keyboard.KeyDown(_keyMap[Keys.ControlKey]); - } - - if (e.Shift) - { - _system.Keyboard.KeyDown(_keyMap[Keys.LShiftKey]); - } - } - - private void DisplayBox_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) - { - - } - - private void Debugger_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) - { - /* - if (_keyMap.ContainsKey(e.KeyCode)) - { - _system.Keyboard.KeyDown(_keyMap[e.KeyCode]); - } */ - } - - private void Debugger_KeyUp(object sender, KeyEventArgs e) - { - if (_keyMap.ContainsKey(e.KeyCode)) - { - _system.Keyboard.KeyUp(_keyMap[e.KeyCode]); - } - - // e.Handled = true; - // e.SuppressKeyPress = true; - - if (e.Control) - { - _system.Keyboard.KeyUp(_keyMap[Keys.ControlKey]); - } - - if (e.Shift) - { - _system.Keyboard.KeyUp(_keyMap[Keys.LShiftKey]); - } - } - - private void OnDisplayMouseMove(object sender, MouseEventArgs e) - { - _system.Mouse.MouseMove(e.X, e.Y); - } - - private void OnDisplayMouseDown(object sender, MouseEventArgs e) - { - AltoMouseButton button = AltoMouseButton.None; - - switch(e.Button) - { - case MouseButtons.Left: - button = AltoMouseButton.Left; - break; - - case MouseButtons.Right: - button = AltoMouseButton.Right; - break; - - case MouseButtons.Middle: - button = AltoMouseButton.Middle; - break; - } - - _system.Mouse.MouseDown(button); - - } - - private void OnDisplayMouseUp(object sender, MouseEventArgs e) - { - AltoMouseButton button = AltoMouseButton.None; - - switch (e.Button) - { - case MouseButtons.Left: - button = AltoMouseButton.Left; - break; - - case MouseButtons.Right: - button = AltoMouseButton.Right; - break; - - case MouseButtons.Middle: - button = AltoMouseButton.Middle; - break; - } - - _system.Mouse.MouseUp(button); - } - - private void InitKeymap() - { - _keyMap = new Dictionary(); - - _keyMap.Add(Keys.A, AltoKey.A); - _keyMap.Add(Keys.B, AltoKey.B); - _keyMap.Add(Keys.C, AltoKey.C); - _keyMap.Add(Keys.D, AltoKey.D); - _keyMap.Add(Keys.E, AltoKey.E); - _keyMap.Add(Keys.F, AltoKey.F); - _keyMap.Add(Keys.G, AltoKey.G); - _keyMap.Add(Keys.H, AltoKey.H); - _keyMap.Add(Keys.I, AltoKey.I); - _keyMap.Add(Keys.J, AltoKey.J); - _keyMap.Add(Keys.K, AltoKey.K); - _keyMap.Add(Keys.L, AltoKey.L); - _keyMap.Add(Keys.M, AltoKey.M); - _keyMap.Add(Keys.N, AltoKey.N); - _keyMap.Add(Keys.O, AltoKey.O); - _keyMap.Add(Keys.P, AltoKey.P); - _keyMap.Add(Keys.Q, AltoKey.Q); - _keyMap.Add(Keys.R, AltoKey.R); - _keyMap.Add(Keys.S, AltoKey.S); - _keyMap.Add(Keys.T, AltoKey.T); - _keyMap.Add(Keys.U, AltoKey.U); - _keyMap.Add(Keys.V, AltoKey.V); - _keyMap.Add(Keys.W, AltoKey.W); - _keyMap.Add(Keys.X, AltoKey.X); - _keyMap.Add(Keys.Y, AltoKey.Y); - _keyMap.Add(Keys.Z, AltoKey.Z); - _keyMap.Add(Keys.D0, AltoKey.D0); - _keyMap.Add(Keys.D1, AltoKey.D1); - _keyMap.Add(Keys.D2, AltoKey.D2); - _keyMap.Add(Keys.D3, AltoKey.D3); - _keyMap.Add(Keys.D4, AltoKey.D4); - _keyMap.Add(Keys.D5, AltoKey.D5); - _keyMap.Add(Keys.D6, AltoKey.D6); - _keyMap.Add(Keys.D7, AltoKey.D7); - _keyMap.Add(Keys.D8, AltoKey.D8); - _keyMap.Add(Keys.D9, AltoKey.D9); - _keyMap.Add(Keys.Space, AltoKey.Space); - _keyMap.Add(Keys.OemPeriod, AltoKey.Period); - _keyMap.Add(Keys.Oemcomma, AltoKey.Comma); - _keyMap.Add(Keys.OemQuotes, AltoKey.Quote); - _keyMap.Add(Keys.OemBackslash, AltoKey.BSlash); - _keyMap.Add(Keys.OemQuestion, AltoKey.FSlash); - _keyMap.Add(Keys.Oemplus, AltoKey.Plus); - _keyMap.Add(Keys.OemMinus, AltoKey.Minus); - _keyMap.Add(Keys.Escape, AltoKey.ESC); - _keyMap.Add(Keys.Delete, AltoKey.DEL); - _keyMap.Add(Keys.Left, AltoKey.Arrow); - _keyMap.Add(Keys.LShiftKey, AltoKey.LShift); - _keyMap.Add(Keys.RShiftKey, AltoKey.RShift); - _keyMap.Add(Keys.ControlKey, AltoKey.CTRL); - _keyMap.Add(Keys.Return, AltoKey.Return); - _keyMap.Add(Keys.F1, AltoKey.BlankTop); - _keyMap.Add(Keys.F2, AltoKey.BlankMiddle); - _keyMap.Add(Keys.F3, AltoKey.BlankBottom); - _keyMap.Add(Keys.Back, AltoKey.BS); - _keyMap.Add(Keys.Tab, AltoKey.TAB); - _keyMap.Add(Keys.OemSemicolon, AltoKey.Semicolon); - _keyMap.Add(Keys.OemOpenBrackets, AltoKey.LBracket); - _keyMap.Add(Keys.OemCloseBrackets, AltoKey.RBracket); - - - } - - private enum ExecutionType { None = 0, @@ -1108,21 +786,21 @@ namespace Contralto Running, BreakpointStop, InternalError, - } - - private delegate void StepDelegate(); + } private AltoSystem _system; + private ExecutionController _controller; // Unicode character for the Arrow used by Alto microcode private const char _arrowChar = (char)0x2190; - // Thread used for execution other than single-step - private Thread _execThread; + // Execution / error state private bool _execAbort; private ExecutionState _execState; + private ExecutionType _execType; private string _lastExceptionText; + private delegate void StepDelegate(); // Microcode Debugger breakpoints; one entry per address since we only need // to worry about a 10 bit address space, this is fast and uses little memory. @@ -1131,16 +809,5 @@ namespace Contralto // Nova Debugger breakpoints; same as above private bool[] _novaBreakpointEnabled; - // Display related data. - // At some point this should move elsewhere. - // Note: display is actually 606 pixels wide, but that's not an even multiple of 8, so we round up. - private byte[] _displayData = new byte[808 * 76]; - private Bitmap _displayBuffer; - private Rectangle _displayRect = new Rectangle(0, 0, 608, 808); - - // Keyboard mapping from windows vkeys to Alto keys - private Dictionary _keyMap; - - } } diff --git a/Contralto/Debugger.resx b/Contralto/Debugger.resx index 077b547..032e0c7 100644 --- a/Contralto/Debugger.resx +++ b/Contralto/Debugger.resx @@ -195,4 +195,70 @@ True + + + + AAABAAIAICAAAAAACACoCAAAJgAAABAQAAAAAAgAaAUAAM4IAAAoAAAAIAAAAEAAAAABAAgAAAAAAAAE + AAAAAAAAAAAAAAABAAAAAQAAAAAAAEJCQgBYWFgAY2JjAG5tbgB5eHgAhoaGAJGRkQCamZkApKOkAK+u + rwC6uboAxcTFAPHv8AD29vYA+fn5AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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HBwcHBwAABwcHBwcHBwcHBwAH + BwAABwcHBwcHBwcHBwcAAAcAAAcHBwcHBwcHBwcHAAAAAAcHBwcHBwcHBwcHBwAAAAAAAAAHBwcHBwcH + BwcAAAAAAAAHBwcHBwcHBwcHAAAAAAAHBwcHBwcHBwcHBwAAAAAHBwcHBwcHBwcHBwcAAAAHBwcHBwcH + BwcHBwcHAAAHBwcHBwcHBwcHBwcHBwAHBwcHBwcHBwcHBwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= + + \ No newline at end of file diff --git a/Contralto/Display/FakeDisplayController.cs b/Contralto/Display/FakeDisplayController.cs index 2d7f071..097a7b5 100644 --- a/Contralto/Display/FakeDisplayController.cs +++ b/Contralto/Display/FakeDisplayController.cs @@ -13,7 +13,7 @@ Reset(); } - public void AttachDisplay(Debugger display) + public void AttachDisplay(IAltoDisplay display) { _display = display; } diff --git a/Contralto/ExecutionController.cs b/Contralto/ExecutionController.cs new file mode 100644 index 0000000..5e6359f --- /dev/null +++ b/Contralto/ExecutionController.cs @@ -0,0 +1,116 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace Contralto +{ + + public delegate bool StepCallbackDelegate(); + public delegate void ErrorCallbackDelegate(Exception e); + + + public class ExecutionController + { + public ExecutionController(AltoSystem system) + { + _system = system; + + _execAbort = false; + + } + + public void StartExecution() + { + StartAltoExecutionThread(); + } + + public void StopExecution() + { + _execAbort = true; + + if (_execThread != null) + { + _execThread.Join(); + _execThread = null; + } + } + + public void Reset() + { + _system.Reset(); + } + + public bool IsRunning + { + get { return (_execThread != null && _execThread.IsAlive); } + } + + public StepCallbackDelegate StepCallback + { + get { return _stepCallback; } + set { _stepCallback = value; } + } + + public ErrorCallbackDelegate ErrorCallback + { + get { return _errorCallback; } + set { _errorCallback = value; } + } + + private void StartAltoExecutionThread() + { + if (_execThread != null && _execThread.IsAlive) + { + return; + } + + _execAbort = false; + + _execThread = new Thread(new System.Threading.ThreadStart(ExecuteProc)); + _execThread.Start(); + } + + private void ExecuteProc() + { + while (true) + { + // Execute a single microinstruction + try + { + _system.SingleStep(); + } + catch (Exception e) + { + if (_errorCallback != null) + { + _errorCallback(e); + } + _execAbort = true; + } + + if (_stepCallback != null) + { + _execAbort = _stepCallback(); + } + + if (_execAbort) + { + // Halt execution + break; + } + } + } + + // Execution thread and state + private Thread _execThread; + private bool _execAbort; + + private StepCallbackDelegate _stepCallback; + private ErrorCallbackDelegate _errorCallback; + + private AltoSystem _system; + } +} diff --git a/Contralto/IO/Diablo30Drive.cs b/Contralto/IO/Diablo30Drive.cs index 10b449f..0bc4f15 100644 --- a/Contralto/IO/Diablo30Drive.cs +++ b/Contralto/IO/Diablo30Drive.cs @@ -32,6 +32,8 @@ namespace Contralto.IO { return String.Format("{0} {1}", Data, Type); } + + public static DataCell Empty = new DataCell(0, CellType.Data); } /// @@ -52,6 +54,7 @@ namespace Contralto.IO _cylinder = 0; _head = 0; + _sectorModified = false; InitSector(); LoadSector(); } @@ -59,11 +62,13 @@ namespace Contralto.IO public void LoadPack(DiabloPack pack) { _pack = pack; + Reset(); } public void UnloadPack() { _pack = null; + Reset(); } public bool IsLoaded() @@ -136,12 +141,19 @@ namespace Contralto.IO public DataCell ReadWord(int index) { - return _sectorData[index]; + if (_pack != null) + { + return _sectorData[index]; + } + else + { + return DataCell.Empty; + } } public void WriteWord(int index, ushort data) { - if (index < _sectorData.Length) + if (_pack!= null && index < _sectorData.Length) { if (_sectorData[index].Type == CellType.Data) { @@ -204,9 +216,7 @@ namespace Contralto.IO _sectorData[_dataOffset + 257].Data = checksum; Log.Write(LogType.Verbose, LogComponent.DiskController, "Data checksum for C/H/S {0}/{1}/{2} is {3}", _cylinder, _head, _sector, Conversion.ToOctal(checksum)); - } - - + } /// /// Commits modified sector data back to the emulated disk. diff --git a/Contralto/IO/DiskController.cs b/Contralto/IO/DiskController.cs index 9f538a0..da5654b 100644 --- a/Contralto/IO/DiskController.cs +++ b/Contralto/IO/DiskController.cs @@ -14,25 +14,9 @@ namespace Contralto.IO // Load the drives _drives = new Diablo30Drive[2]; _drives[0] = new Diablo30Drive(_system); - _drives[1] = new Diablo30Drive(_system); - - // TODO: this does not belong here. - DiabloPack p0 = new DiabloPack(DiabloDiskType.Diablo31); - FileStream fs = new FileStream("Disk\\diag.dsk", FileMode.Open, FileAccess.Read); - p0.Load(fs, false); - fs.Close(); - - _drives[0].LoadPack(p0); - - DiabloPack p1 = new DiabloPack(DiabloDiskType.Diablo31); - fs = new FileStream("Disk\\bravox.dsk", FileMode.Open, FileAccess.Read); - p1.Load(fs, true); - fs.Close(); - - _drives[1].LoadPack(p1); + _drives[1] = new Diablo30Drive(_system); Reset(); - } /// @@ -212,6 +196,11 @@ namespace Contralto.IO } } + public Diablo30Drive[] Drives + { + get { return _drives; } + } + public void Reset() { ClearStatus(); diff --git a/Contralto/IO/Mouse.cs b/Contralto/IO/Mouse.cs index e914bc1..e4fe479 100644 --- a/Contralto/IO/Mouse.cs +++ b/Contralto/IO/Mouse.cs @@ -43,18 +43,16 @@ namespace Contralto.IO // nothing } - public void MouseMove(int x, int y) + public void MouseMove(int dx, int dy) { _lock.EnterWriteLock(); - _destX = x; - _destY = y; - + // Calculate number of steps in x and y to be decremented every call to PollMouseBits - _xSteps = Math.Abs(_destX - _mouseX); - _xDir = Math.Sign(_destX - _mouseX); + _xSteps = Math.Abs(dx); + _xDir = Math.Sign(dx); - _ySteps = Math.Abs(_destY - _mouseY); - _yDir = Math.Sign(_destY - _mouseY); + _ySteps = Math.Abs(dy); + _yDir = Math.Sign(dy); //Console.WriteLine("Mouse move from ({0},{1}) to ({2},{3}).", _mouseX, _mouseY, _destX, _destY); _lock.ExitWriteLock(); @@ -176,10 +174,7 @@ namespace Contralto.IO /// /// Where the mouse is moving to every time PollMouseBits is called. - /// - private int _destX; - private int _destY; - + /// private int _xSteps; private int _xDir; private double _ySteps; diff --git a/Contralto/Program.cs b/Contralto/Program.cs index 1e0eb53..12cf1e4 100644 --- a/Contralto/Program.cs +++ b/Contralto/Program.cs @@ -1,9 +1,11 @@ using Contralto.CPU; +using System; namespace Contralto { class Program { + [STAThread] static void Main(string[] args) { AltoSystem system = new AltoSystem();