1
0
mirror of https://github.com/livingcomputermuseum/ContrAlto.git synced 2026-02-06 08:25:11 +00:00

Implemented proper video timing, basic mouse support and fixed microcode RAM loading. MARTEST now passes with flying colors; more things are running. Suspect disk timing for other failures.

This commit is contained in:
Josh Dersch
2015-11-19 17:41:16 -08:00
parent cbcfd2b47e
commit b13944c81c
20 changed files with 889 additions and 378 deletions

View File

@@ -24,11 +24,13 @@ namespace Contralto
_keyboard = new Keyboard();
_diskController = new DiskController(this);
_displayController = new DisplayController(this);
_mouse = new Mouse();
//_fakeDisplayController = new FakeDisplayController(this);
// Attach memory-mapped devices to the bus
_memBus.AddDevice(_mem);
_memBus.AddDevice(_keyboard);
_memBus.AddDevice(_mouse);
// Register devices that need clocks
_clockableDevices = new List<IClockable>();
@@ -56,7 +58,9 @@ namespace Contralto
ALU.Reset();
Shifter.Reset();
_diskController.Reset();
_displayController.Reset();
_displayController.Reset();
_keyboard.Reset();
_mouse.Reset();
}
/// <summary>
@@ -110,6 +114,11 @@ namespace Contralto
get { return _keyboard; }
}
public Mouse Mouse
{
get { return _mouse; }
}
public Scheduler Scheduler
{
get { return _scheduler; }
@@ -136,6 +145,7 @@ namespace Contralto
private MemoryBus _memBus;
private Contralto.Memory.Memory _mem;
private Keyboard _keyboard;
private Mouse _mouse;
private DiskController _diskController;
private DisplayController _displayController;
// private FakeDisplayController _fakeDisplayController;

View File

@@ -144,7 +144,7 @@ namespace Contralto.CPU
{
if (_tasks[(int)task] != null)
{
_tasks[(int)task].WakeupTask();
_tasks[(int)task].WakeupTask();
}
}

View File

@@ -1,4 +1,5 @@
using System;
using Contralto.Memory;
using System;
namespace Contralto.CPU
{
@@ -157,6 +158,7 @@ namespace Contralto.CPU
{
public MicroInstruction(UInt32 code)
{
// Parse fields
RSELECT = (code & 0xf8000000) >> 27;
ALUF = (AluFunction)((code & 0x07800000) >> 23);
BS = (BusSource)((code & 0x00700000) >> 20);
@@ -165,6 +167,54 @@ namespace Contralto.CPU
LoadT = ((code & 0x00000800) >> 11) == 0 ? false : true;
LoadL = ((code & 0x00000400) >> 10) == 0 ? false : true;
NEXT = (ushort)(code & 0x3ff);
// Parse metadata:
// Whether this instruction references constant memory
ConstantAccess =
F1 == SpecialFunction1.Constant ||
F2 == SpecialFunction2.Constant;
// Whether this instruction accesses memory
MemoryAccess =
(BS == BusSource.ReadMD && !ConstantAccess) || // ReadMD only occurs if not reading from constant ROM.
F1 == SpecialFunction1.LoadMAR ||
F2 == SpecialFunction2.StoreMD;
// What kind of memory access this instruction performs, if any.
if (MemoryAccess)
{
if (BS == BusSource.ReadMD)
{
MemoryOperation = MemoryOperation.Read;
}
else if (F1 == SpecialFunction1.LoadMAR)
{
MemoryOperation = MemoryOperation.LoadAddress;
}
else
{
MemoryOperation = MemoryOperation.Store;
}
}
else
{
MemoryOperation = MemoryOperation.None;
}
// Whether to load T from the ALU or the bus.
switch (ALUF)
{
case AluFunction.Bus:
case AluFunction.BusOrT:
case AluFunction.BusPlus1:
case AluFunction.BusMinus1:
case AluFunction.BusPlusTPlus1:
case AluFunction.BusPlusSkip:
case AluFunction.AluBusAndT:
LoadTFromALU = true;
break;
}
}
public override string ToString()
@@ -188,5 +238,11 @@ namespace Contralto.CPU
public bool LoadT;
public bool LoadL;
public ushort NEXT;
// Metadata about the instruction that can be precalculated and used during execution
public bool ConstantAccess;
public bool MemoryAccess;
public MemoryOperation MemoryOperation;
public bool LoadTFromALU;
}
}

View File

@@ -13,19 +13,29 @@ namespace Contralto.CPU
{
_taskType = TaskType.Cursor;
_wakeup = false;
}
}
protected override bool ExecuteInstruction(MicroInstruction instruction)
{
// We put ourselves back to sleep immediately once we've started running
_wakeup = false;
return base.ExecuteInstruction(instruction);
}
protected override void ExecuteSpecialFunction2(MicroInstruction instruction)
{
CursorF2 cf2 = (CursorF2)instruction.F2;
switch (cf2)
{
case CursorF2.LoadXPREG:
// TODO: load cursor X-position register from bus
// Load cursor X-position register from bus
_cpu._system.DisplayController.LoadXPREG(_busData);
break;
case CursorF2.LoadCSR:
// TODO: load cursor shift register from bus
_cpu._system.DisplayController.LoadCSR(_busData);
break;
default:

View File

@@ -34,8 +34,15 @@ namespace Contralto.CPU
{
// Sector task is running; clear enable for seclate signal
_cpu._system.DiskController.DisableSeclate();
}
/*
if (_taskType == TaskType.DiskWord)
{
_wakeup = false;
} */
return task;
}

View File

@@ -34,12 +34,24 @@ namespace Contralto.CPU
case DisplayHorizontalF2.SETMODE:
_cpu._system.DisplayController.SETMODE(_busData);
// "If bit 0 = 1, the bit clock rate is set to 100ns period (at the start of the next scan line),
// and a 1 is merged into NEXT[9]."
if ((_busData & 0x8000) != 0)
{
_nextModifier |= 1;
}
break;
default:
throw new InvalidOperationException(String.Format("Unhandled display word F2 {0}.", dh2));
}
}
protected override void ExecuteBlock()
{
_cpu._system.DisplayController.DHTBLOCK = true;
}
}
}
}

View File

@@ -12,14 +12,17 @@ namespace Contralto.CPU
{
public DisplayWordTask(AltoCPU cpu) : base(cpu)
{
_taskType = TaskType.DisplayWord;
_wakeup = false;
_taskType = TaskType.DisplayWord;
_wakeup = false;
}
protected override bool ExecuteInstruction(MicroInstruction instruction)
{
// We put ourselves back to sleep immediately once we've started running
_wakeup = false;
// We remove our wakeup only if there isn't a wakeup being generated for us by the
// display controller.
_wakeup = (!_cpu._system.DisplayController.FIFOFULL &&
!_cpu._system.DisplayController.DHTBLOCK &&
!_cpu._system.DisplayController.DWTBLOCK);
return base.ExecuteInstruction(instruction);
}
@@ -37,6 +40,19 @@ namespace Contralto.CPU
throw new InvalidOperationException(String.Format("Unhandled display word F2 {0}.", dw2));
}
}
protected override void ExecuteBlock()
{
_cpu._system.DisplayController.DWTBLOCK = true;
//
// Wake up DHT if it has not blocked itself.
//
if (!_cpu._system.DisplayController.DHTBLOCK)
{
_cpu.WakeupTask(TaskType.DisplayHorizontal);
}
}
}
}
}

View File

@@ -12,7 +12,17 @@
_taskType = TaskType.MemoryRefresh;
_wakeup = false;
}
}
protected override bool ExecuteInstruction(MicroInstruction instruction)
{
//
// Based on readings of the MRT microcode, the MRT keeps its wakeup
// until it executes a BLOCK.
// "; This version assumes MRTACT is cleared by BLOCK, not MAR<- R37"
//
return base.ExecuteInstruction(instruction);
}
}
}
}

View File

@@ -68,7 +68,7 @@ namespace Contralto.CPU
public bool ExecuteNext()
{
// TODO: cache microinstructions (or pre-decode them) to save consing all these up every time.
MicroInstruction instruction = UCodeMemory.GetInstruction(_mpc);
MicroInstruction instruction = UCodeMemory.GetInstruction(_mpc, _taskType);
// Grab BLOCK bit so that other tasks / hardware can look at it
_block = instruction.F1 == SpecialFunction1.Block;
@@ -105,30 +105,10 @@ namespace Contralto.CPU
// Wait for memory state machine if a memory operation is requested by this instruction and
// the memory isn't ready yet.
// TODO: this needs to be seriously cleaned up.
//
bool constantAccess =
instruction.F1 == SpecialFunction1.Constant ||
instruction.F2 == SpecialFunction2.Constant;
if ((instruction.BS == BusSource.ReadMD && !constantAccess) || // ReadMD only occurs if not reading from constant ROM.
instruction.F1 == SpecialFunction1.LoadMAR ||
instruction.F2 == SpecialFunction2.StoreMD)
{
MemoryOperation op;
if (instruction.BS == BusSource.ReadMD)
{
op = MemoryOperation.Read;
}
else if (instruction.F1 == SpecialFunction1.LoadMAR)
{
op = MemoryOperation.LoadAddress;
}
else
{
op = MemoryOperation.Store;
}
if (!_cpu._system.MemoryBus.Ready(op))
//
if (instruction.MemoryAccess)
{
if (!_cpu._system.MemoryBus.Ready(instruction.MemoryOperation))
{
// Suspend operation for this cycle.
return false;
@@ -145,7 +125,7 @@ namespace Contralto.CPU
ExecuteSpecialFunction2Early(instruction);
// Select BUS data.
if (!constantAccess)
if (!instruction.ConstantAccess)
{
// Normal BUS data (not constant ROM access).
switch (instruction.BS)
@@ -172,9 +152,8 @@ namespace Contralto.CPU
_busData = _cpu._system.MemoryBus.ReadMD();
break;
case BusSource.ReadMouse:
//throw new NotImplementedException("ReadMouse bus source not implemented.");
_busData = 0; // TODO: implement;
case BusSource.ReadMouse:
_busData = _cpu._system.Mouse.PollMouseBits();
break;
case BusSource.ReadDisp:
@@ -217,7 +196,7 @@ namespace Contralto.CPU
// selection of R; they do not affect the address supplied to the constant ROM."
// Hence we use the unmodified RSELECT value here and above.
if ((int)instruction.BS > 4 ||
constantAccess)
instruction.ConstantAccess)
{
_busData &= ControlROM.ConstantROM[(instruction.RSELECT << 3) | ((uint)instruction.BS)];
}
@@ -372,7 +351,6 @@ namespace Contralto.CPU
ExecuteSpecialFunction2(instruction);
break;
}
// We always do the shifter operation; DNS may need its output.
//
@@ -397,30 +375,15 @@ namespace Contralto.CPU
// Load T
if (instruction.LoadT)
{
// Does this operation change the source for T?
bool loadTFromALU = false;
switch (instruction.ALUF)
{
case AluFunction.Bus:
case AluFunction.BusOrT:
case AluFunction.BusPlus1:
case AluFunction.BusMinus1:
case AluFunction.BusPlusTPlus1:
case AluFunction.BusPlusSkip:
case AluFunction.AluBusAndT:
loadTFromALU = true;
break;
}
_cpu._t = loadTFromALU ? aluData : _busData;
// Does this operation change the source for T?
_cpu._t = instruction.LoadTFromALU ? aluData : _busData;
//
// Control RAM: "...the control RAM address is specified by the control RAM
// address register... which is loaded from the ALU output whenver T is loaded
// from its source."
//
UCodeMemory.LoadControlRAMAddress(aluData);
UCodeMemory.LoadControlRAMAddress(aluData);
}
// Load L (and M) from ALU outputs.
@@ -444,7 +407,7 @@ namespace Contralto.CPU
//
if (swMode)
{
Console.WriteLine("SWMODE NEXT {0} Modifier {1}", Conversion.ToOctal(instruction.NEXT), Conversion.ToOctal(nextModifier));
//Console.WriteLine("SWMODE NEXT {0} Modifier {1}", Conversion.ToOctal(instruction.NEXT), Conversion.ToOctal(nextModifier));
UCodeMemory.SwitchMode((ushort)(instruction.NEXT | nextModifier));
}

View File

@@ -50,6 +50,12 @@ namespace Contralto.CPU
// Precache ROM
CacheMicrocodeROM();
// Precache (empty) RAM
for(ushort i=0;i<_uCodeRam.Length;i++)
{
UpdateRAMCache(i);
}
// Start in ROM0 -- TODO: need to implement reset logic
_microcodeBank = MicrocodeBank.ROM0;
_ramAddr = 0;
@@ -128,7 +134,7 @@ namespace Contralto.CPU
if (_ramBank > 0)
{
//throw new InvalidOperationException("RAM bank > 0, unexpected.");
return 0xffff;
_ramBank = 0;
}
// pretend no ram for the moment
@@ -162,7 +168,7 @@ namespace Contralto.CPU
if (_ramBank > 0)
{
//throw new InvalidOperationException("RAM bank > 0, unexpected.");
return;
_ramBank = 0;
}
Logging.Log.Write(Logging.LogComponent.Microcode, "CRAM address for write: Bank {0}, addr {1}",
@@ -186,9 +192,19 @@ namespace Contralto.CPU
/// </summary>
/// <param name="address"></param>
/// <returns></returns>
public static MicroInstruction GetInstruction(ushort address)
public static MicroInstruction GetInstruction(ushort address, TaskType task)
{
return _decodeCache[address + (int)_microcodeBank * 1024];
// Only RAM-enabled tasks can execute from anything other than ROM (right now)
if (task == TaskType.Emulator)
{
// banked
return _decodeCache[address + (int)_microcodeBank * 1024];
}
else
{
// ROM only
return _decodeCache[address];
}
}
private static void LoadMicrocode(RomFile[] romInfo)
@@ -244,9 +260,8 @@ namespace Contralto.CPU
// Invert the requisite bits just to make things easier; the high bits of F1 and F2 and the Load L bit are inverted
// already; we leave those alone.
const UInt32 bitMask = 0x00088400;
UInt32 masked = ~word & bitMask;
word = (word & ~bitMask) | masked;
word ^= bitMask;
return word;
}
@@ -270,7 +285,7 @@ namespace Contralto.CPU
UInt32 instructionWord = _uCodeRam[address];
_decodeCache[2048 + address] = new MicroInstruction(MapRAMWord(instructionWord));
Console.WriteLine(_decodeCache[2048 + address]);
//Console.WriteLine(_decodeCache[2048 + address]);
}
private static RomFile[] _uCodeRoms =

View File

@@ -92,6 +92,7 @@
<Compile Include="IO\DiskController.cs" />
<Compile Include="IO\DiabloPack.cs" />
<Compile Include="IO\Keyboard.cs" />
<Compile Include="IO\Mouse.cs" />
<Compile Include="Logging\Log.cs" />
<Compile Include="Memory\IMemoryMappedDevice.cs" />
<Compile Include="Memory\Memory.cs" />

View File

@@ -28,31 +28,31 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
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();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle20 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle21 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle22 = new System.Windows.Forms.DataGridViewCellStyle();
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 dataGridViewCellStyle76 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle80 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle77 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle78 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle79 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle81 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle85 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle82 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle83 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle84 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle86 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle90 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle87 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle88 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle89 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle91 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle92 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle93 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle94 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle95 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle96 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle97 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle98 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle99 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle100 = new System.Windows.Forms.DataGridViewCellStyle();
this.Microcode = new System.Windows.Forms.GroupBox();
this.SourceTabs = new System.Windows.Forms.TabControl();
this.Rom0Page = new System.Windows.Forms.TabPage();
@@ -173,8 +173,8 @@
this._rom0SourceViewer.AllowUserToDeleteRows = false;
this._rom0SourceViewer.AllowUserToResizeColumns = false;
this._rom0SourceViewer.AllowUserToResizeRows = false;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.Silver;
this._rom0SourceViewer.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
dataGridViewCellStyle76.BackColor = System.Drawing.Color.Silver;
this._rom0SourceViewer.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle76;
this._rom0SourceViewer.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.SingleVertical;
this._rom0SourceViewer.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this._rom0SourceViewer.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
@@ -187,14 +187,14 @@
this._rom0SourceViewer.Name = "_rom0SourceViewer";
this._rom0SourceViewer.ReadOnly = true;
this._rom0SourceViewer.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle5.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this._rom0SourceViewer.RowHeadersDefaultCellStyle = dataGridViewCellStyle5;
dataGridViewCellStyle80.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle80.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle80.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle80.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle80.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle80.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle80.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this._rom0SourceViewer.RowHeadersDefaultCellStyle = dataGridViewCellStyle80;
this._rom0SourceViewer.RowHeadersVisible = false;
this._rom0SourceViewer.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
this._rom0SourceViewer.RowTemplate.Height = 18;
@@ -223,9 +223,9 @@
// T
//
this.T.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
dataGridViewCellStyle2.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.T.DefaultCellStyle = dataGridViewCellStyle2;
dataGridViewCellStyle77.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle77.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.T.DefaultCellStyle = dataGridViewCellStyle77;
this.T.HeaderText = "T";
this.T.Name = "T";
this.T.ReadOnly = true;
@@ -236,8 +236,8 @@
// Addr
//
this.Addr.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
dataGridViewCellStyle3.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Addr.DefaultCellStyle = dataGridViewCellStyle3;
dataGridViewCellStyle78.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Addr.DefaultCellStyle = dataGridViewCellStyle78;
this.Addr.HeaderText = "Addr";
this.Addr.Name = "Addr";
this.Addr.ReadOnly = true;
@@ -248,8 +248,8 @@
// Source
//
this.Source.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
dataGridViewCellStyle4.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Source.DefaultCellStyle = dataGridViewCellStyle4;
dataGridViewCellStyle79.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Source.DefaultCellStyle = dataGridViewCellStyle79;
this.Source.HeaderText = "Source Code";
this.Source.Name = "Source";
this.Source.ReadOnly = true;
@@ -273,8 +273,8 @@
this._rom1SourceViewer.AllowUserToDeleteRows = false;
this._rom1SourceViewer.AllowUserToResizeColumns = false;
this._rom1SourceViewer.AllowUserToResizeRows = false;
dataGridViewCellStyle6.BackColor = System.Drawing.Color.Silver;
this._rom1SourceViewer.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle6;
dataGridViewCellStyle81.BackColor = System.Drawing.Color.Silver;
this._rom1SourceViewer.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle81;
this._rom1SourceViewer.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.SingleVertical;
this._rom1SourceViewer.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this._rom1SourceViewer.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
@@ -287,14 +287,14 @@
this._rom1SourceViewer.Name = "_rom1SourceViewer";
this._rom1SourceViewer.ReadOnly = true;
this._rom1SourceViewer.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle10.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle10.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle10.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle10.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle10.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this._rom1SourceViewer.RowHeadersDefaultCellStyle = dataGridViewCellStyle10;
dataGridViewCellStyle85.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle85.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle85.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle85.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle85.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle85.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle85.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this._rom1SourceViewer.RowHeadersDefaultCellStyle = dataGridViewCellStyle85;
this._rom1SourceViewer.RowHeadersVisible = false;
this._rom1SourceViewer.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
this._rom1SourceViewer.RowTemplate.Height = 18;
@@ -322,8 +322,8 @@
// 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;
dataGridViewCellStyle82.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.dataGridViewTextBoxColumn4.DefaultCellStyle = dataGridViewCellStyle82;
this.dataGridViewTextBoxColumn4.HeaderText = "Addr";
this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
this.dataGridViewTextBoxColumn4.ReadOnly = true;
@@ -334,9 +334,9 @@
// 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;
dataGridViewCellStyle83.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle83.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dataGridViewTextBoxColumn3.DefaultCellStyle = dataGridViewCellStyle83;
this.dataGridViewTextBoxColumn3.HeaderText = "Word";
this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
this.dataGridViewTextBoxColumn3.ReadOnly = true;
@@ -347,8 +347,8 @@
// 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;
dataGridViewCellStyle84.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.dataGridViewTextBoxColumn5.DefaultCellStyle = dataGridViewCellStyle84;
this.dataGridViewTextBoxColumn5.HeaderText = "Disassembly";
this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
this.dataGridViewTextBoxColumn5.ReadOnly = true;
@@ -372,8 +372,8 @@
this._ram0SourceViewer.AllowUserToDeleteRows = false;
this._ram0SourceViewer.AllowUserToResizeColumns = false;
this._ram0SourceViewer.AllowUserToResizeRows = false;
dataGridViewCellStyle11.BackColor = System.Drawing.Color.Silver;
this._ram0SourceViewer.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle11;
dataGridViewCellStyle86.BackColor = System.Drawing.Color.Silver;
this._ram0SourceViewer.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle86;
this._ram0SourceViewer.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.SingleVertical;
this._ram0SourceViewer.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this._ram0SourceViewer.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
@@ -386,14 +386,14 @@
this._ram0SourceViewer.Name = "_ram0SourceViewer";
this._ram0SourceViewer.ReadOnly = true;
this._ram0SourceViewer.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle15.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle15.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle15.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle15.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle15.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this._ram0SourceViewer.RowHeadersDefaultCellStyle = dataGridViewCellStyle15;
dataGridViewCellStyle90.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle90.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle90.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle90.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle90.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle90.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle90.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this._ram0SourceViewer.RowHeadersDefaultCellStyle = dataGridViewCellStyle90;
this._ram0SourceViewer.RowHeadersVisible = false;
this._ram0SourceViewer.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
this._ram0SourceViewer.RowTemplate.Height = 18;
@@ -421,8 +421,8 @@
// dataGridViewTextBoxColumn7
//
this.dataGridViewTextBoxColumn7.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
dataGridViewCellStyle12.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.dataGridViewTextBoxColumn7.DefaultCellStyle = dataGridViewCellStyle12;
dataGridViewCellStyle87.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.dataGridViewTextBoxColumn7.DefaultCellStyle = dataGridViewCellStyle87;
this.dataGridViewTextBoxColumn7.HeaderText = "Addr";
this.dataGridViewTextBoxColumn7.Name = "dataGridViewTextBoxColumn7";
this.dataGridViewTextBoxColumn7.ReadOnly = true;
@@ -433,9 +433,9 @@
// dataGridViewTextBoxColumn6
//
this.dataGridViewTextBoxColumn6.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
dataGridViewCellStyle13.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dataGridViewTextBoxColumn6.DefaultCellStyle = dataGridViewCellStyle13;
dataGridViewCellStyle88.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle88.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dataGridViewTextBoxColumn6.DefaultCellStyle = dataGridViewCellStyle88;
this.dataGridViewTextBoxColumn6.HeaderText = "Word";
this.dataGridViewTextBoxColumn6.Name = "dataGridViewTextBoxColumn6";
this.dataGridViewTextBoxColumn6.ReadOnly = true;
@@ -446,8 +446,8 @@
// dataGridViewTextBoxColumn8
//
this.dataGridViewTextBoxColumn8.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
dataGridViewCellStyle14.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.dataGridViewTextBoxColumn8.DefaultCellStyle = dataGridViewCellStyle14;
dataGridViewCellStyle89.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.dataGridViewTextBoxColumn8.DefaultCellStyle = dataGridViewCellStyle89;
this.dataGridViewTextBoxColumn8.HeaderText = "Disassembly";
this.dataGridViewTextBoxColumn8.Name = "dataGridViewTextBoxColumn8";
this.dataGridViewTextBoxColumn8.ReadOnly = true;
@@ -488,21 +488,21 @@
this._registerData.AllowUserToDeleteRows = false;
this._registerData.AllowUserToResizeColumns = false;
this._registerData.AllowUserToResizeRows = false;
dataGridViewCellStyle16.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
this._registerData.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle16;
dataGridViewCellStyle91.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
this._registerData.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle91;
this._registerData.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this._registerData.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.RegNum,
this.R,
this.S});
dataGridViewCellStyle17.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle17.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle17.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle17.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle17.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle17.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle17.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this._registerData.DefaultCellStyle = dataGridViewCellStyle17;
dataGridViewCellStyle92.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle92.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle92.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle92.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle92.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle92.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle92.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this._registerData.DefaultCellStyle = dataGridViewCellStyle92;
this._registerData.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
this._registerData.Location = new System.Drawing.Point(7, 19);
this._registerData.MultiSelect = false;
@@ -608,21 +608,21 @@
//
this._taskData.AllowUserToAddRows = false;
this._taskData.AllowUserToDeleteRows = false;
dataGridViewCellStyle18.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
this._taskData.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle18;
dataGridViewCellStyle93.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
this._taskData.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle93;
this._taskData.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this._taskData.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.TaskName,
this.TaskState,
this.TaskPC});
dataGridViewCellStyle19.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle19.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle19.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle19.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle19.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle19.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle19.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this._taskData.DefaultCellStyle = dataGridViewCellStyle19;
dataGridViewCellStyle94.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle94.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle94.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle94.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle94.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle94.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle94.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this._taskData.DefaultCellStyle = dataGridViewCellStyle94;
this._taskData.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
this._taskData.Location = new System.Drawing.Point(7, 19);
this._taskData.MultiSelect = false;
@@ -679,20 +679,20 @@
//
this._otherRegs.AllowUserToAddRows = false;
this._otherRegs.AllowUserToDeleteRows = false;
dataGridViewCellStyle20.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
this._otherRegs.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle20;
dataGridViewCellStyle95.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
this._otherRegs.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle95;
this._otherRegs.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this._otherRegs.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Reg,
this.RegValue});
dataGridViewCellStyle21.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle21.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle21.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle21.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle21.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle21.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle21.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this._otherRegs.DefaultCellStyle = dataGridViewCellStyle21;
dataGridViewCellStyle96.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle96.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle96.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle96.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle96.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle96.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle96.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this._otherRegs.DefaultCellStyle = dataGridViewCellStyle96;
this._otherRegs.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
this._otherRegs.Location = new System.Drawing.Point(7, 19);
this._otherRegs.MultiSelect = false;
@@ -745,8 +745,8 @@
this._memoryData.AllowUserToAddRows = false;
this._memoryData.AllowUserToDeleteRows = false;
this._memoryData.AllowUserToResizeRows = false;
dataGridViewCellStyle22.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
this._memoryData.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle22;
dataGridViewCellStyle97.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
this._memoryData.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle97;
this._memoryData.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.EnableWithoutHeaderText;
this._memoryData.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this._memoryData.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
@@ -754,14 +754,14 @@
this.Address,
this.Data,
this.Disassembly});
dataGridViewCellStyle23.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle23.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle23.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle23.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle23.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle23.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle23.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this._memoryData.DefaultCellStyle = dataGridViewCellStyle23;
dataGridViewCellStyle98.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle98.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle98.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle98.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle98.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle98.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle98.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this._memoryData.DefaultCellStyle = dataGridViewCellStyle98;
this._memoryData.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
this._memoryData.Location = new System.Drawing.Point(6, 19);
this._memoryData.MultiSelect = false;
@@ -858,20 +858,20 @@
//
this._diskData.AllowUserToAddRows = false;
this._diskData.AllowUserToDeleteRows = false;
dataGridViewCellStyle24.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
this._diskData.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle24;
dataGridViewCellStyle99.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
this._diskData.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle99;
this._diskData.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this._diskData.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.dataGridViewTextBoxColumn1,
this.dataGridViewTextBoxColumn2});
dataGridViewCellStyle25.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle25.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle25.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle25.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle25.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle25.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle25.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this._diskData.DefaultCellStyle = dataGridViewCellStyle25;
dataGridViewCellStyle100.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle100.BackColor = System.Drawing.SystemColors.Window;
dataGridViewCellStyle100.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle100.ForeColor = System.Drawing.SystemColors.ControlText;
dataGridViewCellStyle100.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle100.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle100.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this._diskData.DefaultCellStyle = dataGridViewCellStyle100;
this._diskData.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
this._diskData.Location = new System.Drawing.Point(6, 19);
this._diskData.MultiSelect = false;
@@ -957,6 +957,9 @@
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);
//
// Debugger

View File

@@ -91,7 +91,7 @@ namespace Contralto
DisplayBox.Refresh();
// If you want interlacing to be more visible:
Array.Clear(_displayData, 0, _displayData.Length);
//Array.Clear(_displayData, 0, _displayData.Length);
}
/// <summary>
@@ -100,18 +100,59 @@ namespace Contralto
/// <param name="scanline"></param>
/// <param name="wordOffset"></param>
/// <param name="word"></param>
public void DrawDisplayWord(int scanline, int wordOffset, ushort word)
public void DrawDisplayWord(int scanline, int wordOffset, ushort word, bool lowRes)
{
// TODO: move magic numbers to constants
int address = scanline * 76 + wordOffset * 2;
if (address > _displayData.Length)
if (lowRes)
{
throw new InvalidOperationException("Display word address is out of bounds.");
// 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);
}
}
/// <summary>
/// "Stretches" a 16 bit word into a 32-bit word (for low-res display purposes).
/// </summary>
/// <param name="word"></param>
/// <returns></returns>
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));
}
_displayData[address] = (byte)(word >> 8);
_displayData[address + 1] = (byte)(word);
return stretched;
}
private void RefreshUI()
@@ -925,6 +966,56 @@ namespace Contralto
}
}
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<Keys, AltoKey>();
@@ -1034,6 +1125,8 @@ namespace Contralto
private Rectangle _displayRect = new Rectangle(0, 0, 608, 808);
// Keyboard mapping from windows vkeys to Alto keys
private Dictionary<Keys, AltoKey> _keyMap;
private Dictionary<Keys, AltoKey> _keyMap;
}
}

View File

@@ -27,194 +27,294 @@ namespace Contralto.Display
set { _fields = value; }
}
public bool DWTBLOCK
{
get { return _dwtBlocked; }
set { _dwtBlocked = value; }
}
public bool DHTBLOCK
{
get { return _dhtBlocked; }
set { _dhtBlocked = value; }
}
public bool FIFOFULL
{
get
{
return _dataBuffer.Count >= 16;
}
}
public void Reset()
{
_evenField = true;
_clocks = 0;
_totalClocks = 0;
_state = DisplayState.VerticalBlank;
_evenField = false;
_scanline = 0;
_word = 0;
_dwtBlocked = true;
_dhtBlocked = false;
_whiteOnBlack = false;
_lowRes = false;
_whiteOnBlack = _whiteOnBlackLatch = false;
_lowRes = _lowResLatch = false;
_swModeLatch = false;
_cursorReg = 0;
_cursorX = 0;
_cursorRegLatch = false;
_cursorXLatch = false;
_verticalBlankEndWakeup = new Event(_verticalBlankDuration, null, VerticalBlankEndCallback);
_horizontalWakeup = new Event(_horizontalBlankDuration, null, HorizontalBlankEndCallback);
_wordWakeup = new Event(_wordDuration, null, WordCallback);
// Kick things off
FieldStart();
}
private void FieldStart()
{
// Start of Vertical Blanking (end of last field). This lasts for 16 scanline times or so.
_evenField = !_evenField;
// Wakeup DVT
_system.CPU.WakeupTask(TaskType.DisplayVertical);
// Block DHT, DWT
_system.CPU.BlockTask(TaskType.DisplayHorizontal);
_system.CPU.BlockTask(TaskType.DisplayWord);
_fields++;
_scanline = _evenField ? 0 : 1;
// Schedule wakeup for end of vblank
_verticalBlankEndWakeup.TimestampNsec = _verticalBlankDuration;
_system.Scheduler.Schedule(_verticalBlankEndWakeup);
}
private void VerticalBlankEndCallback(ulong timeNsec, ulong skewNsec, object context)
{
// End of VBlank, start new visible frame at beginning of first horizontal blanking period.
// Wake up DHT
_system.CPU.WakeupTask(TaskType.DisplayHorizontal);
_dataBuffer.Clear();
_dwtBlocked = false;
_dhtBlocked = false;
// Schedule HBlank wakeup for end of first HBlank
_horizontalWakeup.TimestampNsec = _horizontalBlankDuration - skewNsec;
_system.Scheduler.Schedule(_horizontalWakeup);
// Run MRT
//_system.CPU.WakeupTask(TaskType.MemoryRefresh);
// Run CURT
_system.CPU.WakeupTask(TaskType.Cursor);
}
private void HorizontalBlankEndCallback(ulong timeNsec, ulong skewNsec, object context)
{
// Reset scanline word counter
_word = 0;
// Deal with SWMODE latches for the scanline we're about to draw
if (_swModeLatch)
{
_lowRes = _lowResLatch;
_whiteOnBlack = _whiteOnBlackLatch;
_swModeLatch = false;
}
if (_cursorRegLatch)
{
_cursorRegLatched = _cursorReg;
_cursorRegLatch = false;
}
if (_cursorXLatch)
{
_cursorXLatched = _cursorX;
_cursorXLatch = false;
}
// Run MRT on end of hsync
_system.CPU.WakeupTask(TaskType.MemoryRefresh);
// Schedule immediate wakeup for first word on this scanline
_wordWakeup.TimestampNsec = 0;
_system.Scheduler.Schedule(_wordWakeup);
}
private void WordCallback(ulong timeNsec, ulong skewNsec, object context)
{
// Dequeue a word (if available) and draw it to the screen.
ushort displayWord = (ushort)(_whiteOnBlack ? 0 : 0xffff);
if (_dataBuffer.Count > 0)
{
displayWord = _whiteOnBlack ? _dataBuffer.Dequeue() : (ushort)~_dataBuffer.Dequeue();
}
// Merge in cursor word:
// Calculate X offset of current word
int xOffset = _word * (_lowRes ? 32 : 16);
// Is cursor within this range? (Note cursor is always 16 bits wide regardless of
// display mode, but may span two 16-bit display words.)
if ((_cursorXLatched >= xOffset && _cursorXLatched < xOffset + 16) ||
(_cursorXLatched + 16 >= xOffset & _cursorXLatched + 16 < xOffset + 16))
{
// Yes. Merge bits in the appropriate place.
int shift = (_cursorXLatched - xOffset);
// Which half of the 32-bit word the cursor will appear in are we in?
if (shift > 0)
{
// Take the cursor word shifted by the current offset
displayWord ^= (ushort)((_cursorRegLatched) >> shift);
}
else
{
// Take the cursor word shifted left
displayWord ^= (ushort)((_cursorRegLatched) << (-shift));
}
}
_display.DrawDisplayWord(_scanline, _word, displayWord, _lowRes);
_word++;
if (_word == (_lowRes ? _scanlineWords / 4 : _scanlineWords / 2))
{
// Run MRT
//_system.CPU.WakeupTask(TaskType.MemoryRefresh);
}
if (_word >= (_lowRes ? _scanlineWords / 2 : _scanlineWords))
{
// End of scanline.
// Move to next.
_scanline += 2;
if (_scanline > 807)
{
// Done with field.
// Draw the completed field to the emulated display.
_display.RefreshAltoDisplay();
// And start over
FieldStart();
}
else
{
// More scanlines to do.
// Run CURT at end of scanline
_system.CPU.WakeupTask(TaskType.Cursor);
// Schedule HBlank wakeup for end of next HBlank
_horizontalWakeup.TimestampNsec = _horizontalBlankDuration - skewNsec;
_system.Scheduler.Schedule(_horizontalWakeup);
_dwtBlocked = false;
_dataBuffer.Clear();
}
}
else
{
// More words to do.
// Schedule wakeup for next word
if (_lowRes)
{
_wordWakeup.TimestampNsec = _wordDuration * 2 - skewNsec;
}
else
{
_wordWakeup.TimestampNsec = _wordDuration - skewNsec;
}
_system.Scheduler.Schedule(_wordWakeup);
}
}
public void Clock()
{
//
// Move the electron beam appropriately and wake up the display tasks
// as necessary. Render the display at the end of the field.
//
//
// "The display control hardware also generates wakeup requests to the microprocessor
// tasking hardware. The vertical task DVT is awakened once per field, at the beginning
// of vertical retrace. The display horizontal task is awakened once at the beginning of
// each field, and thereafter whenever the display word task blocks. DHT can block itself,
// in which case neither it nor the word task can be awakened until the start of the next
// field. The wakeup request for the display word task (DWT) is controlled by the state
// of the 16 word buffer. If DWT has not executed a BLOCK, if DHT is not blocked, and if
// the buffer is not full, DWT wakeups are generated. The hardware sets the buffer empty
// and clears the DWT block flip-flop at the beginning of horizontal retrace for every
// scan line."
//
//
// Check the BLOCK status of the DWT and DHT tasks for the last executed uInstruction.
//
if (_system.CPU.CurrentTask.Priority == (int)CPU.TaskType.DisplayHorizontal &&
_system.CPU.CurrentTask.BLOCK)
{
_dhtBlocked = true;
}
if (_system.CPU.CurrentTask.Priority == (int)CPU.TaskType.DisplayWord &&
_system.CPU.CurrentTask.BLOCK)
{
_dwtBlocked = true;
//
// Wake up DHT if it has not blocked itself.
//
if (!_dhtBlocked)
{
_system.CPU.WakeupTask(TaskType.DisplayHorizontal);
}
}
_clocks++;
_totalClocks++;
{
//
// "If the DWT has not executed a BLOCK, if DHT is not blocked, and if the
// buffer is not full, DWT wakeups are generated."
//
// TODO: move this logic elsewhere so it doesn't have to be polled.
if (_dataBuffer.Count < 16 &&
!_dhtBlocked &&
!_dwtBlocked)
{
_system.CPU.WakeupTask(TaskType.DisplayWord);
}
switch (_state)
{
case DisplayState.VerticalBlank:
// Just killing time
if (_clocks > _verticalBlankClocks)
{
// End of VBlank, start new visible frame
_clocks -= _verticalBlankClocks;
_scanline = _evenField ? 0 : 1;
_word = 0;
_dataBuffer.Clear();
// Wake up DVT, DHT
_dwtBlocked = false;
_dhtBlocked = false;
_system.CPU.WakeupTask(TaskType.DisplayHorizontal);
_state = DisplayState.HorizontalBlank;
}
break;
case DisplayState.VisibleScanline:
//
// A scanline is 38 words wide; we clock in each word
// from the buffer (if present).
//
if (_clocks > _wordClocks)
{
_clocks -= _wordClocks;
ushort displayWord = (ushort)(_whiteOnBlack ? 0 : 0xffff);
if (_dataBuffer.Count > 0)
{
// Dequeue a word and draw it to the screen
displayWord = _whiteOnBlack ? _dataBuffer.Dequeue() : (ushort)~_dataBuffer.Dequeue();
}
_display.DrawDisplayWord(_scanline, _word, displayWord);
_word++;
if (_word > 37)
{
// Done with this line
_dwtBlocked = false;
_dataBuffer.Clear();
_state = DisplayState.HorizontalBlank;
}
}
break;
case DisplayState.HorizontalBlank:
// Kill time until end of HBlank
if (_clocks > _horizontalBlankClocks)
{
_clocks -= _horizontalBlankClocks;
// Move to next scanline
_scanline += 2;
_word = 0;
if (_scanline > 807)
{
// Done with field, move to vblank, tell display to render
_state = DisplayState.VerticalBlank;
_evenField = !_evenField;
// Wakeup DVT
_system.CPU.WakeupTask(TaskType.DisplayVertical);
// Block DHT, DWT
_system.CPU.BlockTask(TaskType.DisplayHorizontal);
_system.CPU.BlockTask(TaskType.DisplayWord);
_display.RefreshAltoDisplay();
_fields++;
//Log.Write(LogComponent.Display, "Display field completed. {0} total clocks elapsed.", _totalClocks);
_totalClocks = 0;
}
else
{
_state = DisplayState.VisibleScanline;
// Run MRT
_system.CPU.WakeupTask(TaskType.MemoryRefresh);
}
}
break;
}
}
public void LoadDDR(ushort word)
{
_dataBuffer.Enqueue(word);
{
//Console.WriteLine("Enqueue {0}, scanline {1}", word, _scanline);
if (_dataBuffer.Count < 20)
{
_dataBuffer.Enqueue(word);
}
/*
// Sanity check: data length should never exceed 16 words.
if (_dataBuffer.Count > 16)
{
if (_dataBuffer.Count >= 16)
{
//_dataBuffer.Dequeue();
//_system.CPU.BlockTask(TaskType.DisplayWord);
}
} */
}
public void LoadXPREG(ushort word)
{
if (!_cursorXLatch)
{
_cursorXLatch = true;
_cursorX = (ushort)(~word);
//System.Console.WriteLine("XPREG {0}, scanline {1} word {2}", word, _scanline, _word);
}
}
public void LoadCSR(ushort word)
{
/*
if (_cursorReg != 0 && word == 0)
{
System.Console.WriteLine("csr disabled, scanline {0}", _scanline);
} */
if (!_cursorRegLatch)
{
_cursorRegLatch = true;
_cursorReg = (ushort)word;
if (word != 0)
{
//System.Console.WriteLine("csr {0} scanline {1}, word {2}", Conversion.ToOctal(word), _scanline, _word);
}
}
}
public void SETMODE(ushort word)
{
_lowRes = (word & 0x8000) != 0;
_whiteOnBlack = (word & 0x4000) != 0;
// These take effect at the beginning of the next scanline.
if (!_swModeLatch)
{
_lowResLatch = (word & 0x8000) != 0;
_whiteOnBlackLatch = (word & 0x4000) != 0;
_swModeLatch = true;
}
}
public bool EVENFIELD
@@ -230,13 +330,21 @@ namespace Contralto.Display
HorizontalBlank,
}
// MODE data
private bool _evenField;
private bool _lowRes;
private bool _lowResLatch;
private bool _whiteOnBlack;
private double _clocks;
private double _totalClocks;
private int _fields;
private DisplayState _state;
private bool _whiteOnBlackLatch;
private bool _swModeLatch;
// Cursor data
private bool _cursorRegLatch;
private ushort _cursorReg;
private ushort _cursorRegLatched;
private bool _cursorXLatch;
private ushort _cursorX;
private ushort _cursorXLatched;
// Indicates whether the DWT or DHT blocked itself
// in which case they cannot be reawakened until the next field.
@@ -245,19 +353,28 @@ namespace Contralto.Display
private int _scanline;
private int _word;
private const int _scanlineWords = 38;
private Queue<ushort> _dataBuffer = new Queue<ushort>(16);
private AltoSystem _system;
private Debugger _display;
private int _fields;
// Timing constants
// 38uS per scanline; 4uS for hblank.
// 38uS per scanline; 6uS for hblank.
// ~35 scanlines for vblank (1330uS)
private const double _wordClocks = (34.0 / 38.0) / 0.060; // uSec to clocks
private const double _horizontalBlankClocks = 4.0 / 0.060;
private const double _verticalBlankClocks = 1333.0 / 0.060;
private const double _scale = 1.0;
private const ulong _verticalBlankDuration = (ulong)(665000.0 * _scale); // 665uS
private const ulong _horizontalBlankDuration = (ulong)(6084 * _scale); // 6uS
private const ulong _wordDuration = (ulong)(842.0 * _scale); // 32/38uS
//
// Scheduler events
//
private Event _verticalBlankEndWakeup;
private Event _horizontalWakeup;
private Event _wordWakeup;
}
}

View File

@@ -47,7 +47,7 @@
{
for (int word = 0; word < 38; word++)
{
_display.DrawDisplayWord(scanline, word, 0xffff);
_display.DrawDisplayWord(scanline, word, 0xffff, false);
}
}
@@ -65,7 +65,7 @@
// fill in HTAB
for(int htab = 0;htab<dcb.hTab; htab++)
{
_display.DrawDisplayWord(scanline, wordOffset, (ushort)(dcb.whiteOnBlack ? 0x0 : 0xffff));
_display.DrawDisplayWord(scanline, wordOffset, (ushort)(dcb.whiteOnBlack ? 0x0 : 0xffff), false);
wordOffset++;
}
@@ -79,14 +79,14 @@
data = (ushort)~data;
}
_display.DrawDisplayWord(scanline, wordOffset, data);
_display.DrawDisplayWord(scanline, wordOffset, data, false);
wordOffset++;
}
// erase remainder of line, if any
for (; wordOffset < 38; wordOffset++)
{
_display.DrawDisplayWord(scanline, wordOffset, (ushort)(dcb.whiteOnBlack ? 0x0 : 0xffff));
_display.DrawDisplayWord(scanline, wordOffset, (ushort)(dcb.whiteOnBlack ? 0x0 : 0xffff), false);
}
_display.RefreshAltoDisplay();

View File

@@ -435,7 +435,13 @@ namespace Contralto.IO
// actual data (it could be the pre-header delay, inter-record gaps or sync words)
// and we may not actually end up doing anything with it, but we may
// need it to decide whether to do anything at all.
//
//
if (_sectorWordIndex >= _sectorWordCount)
{
return;
}
ushort diskWord = _sectorData[_sectorWordIndex].Data;
bool bWakeup = false;
@@ -639,9 +645,10 @@ namespace Contralto.IO
// $MIR0BL $177775; DISK INTERRECORD PREAMBLE IS 3 WORDS <<-- writing
// $MRPAL $177775; DISK READ POSTAMBLE LENGTH IS 3 WORDS
// $MWPAL $177773; DISK WRITE POSTAMBLE LENGTH IS 5 WORDS <<-- writing, clearly.
private static ulong _sectorDuration = (ulong)((40.0 / 12.0) * Conversion.MsecToNsec); // time in nsec for one sector
private static double _scale = 1.0;
private static ulong _sectorDuration = (ulong)((40.0 / 12.0) * Conversion.MsecToNsec * _scale); // time in nsec for one sector
private static int _sectorWordCount = 269 + 22 + 34; // Based on : 269 data words (+ cksums) / sector, + X words for delay / preamble / sync
private static ulong _wordDuration = (ulong)(_sectorDuration / (ulong)(_sectorWordCount + 1)); // time in nsec for one word
private static ulong _wordDuration = (ulong)((_sectorDuration / (ulong)(_sectorWordCount + 1)) * _scale); // time in nsec for one word
private int _sectorWordIndex; // current word being read
private Event _sectorEvent;

191
Contralto/IO/Mouse.cs Normal file
View File

@@ -0,0 +1,191 @@
using Contralto.CPU;
using Contralto.Memory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace Contralto.IO
{
[Flags]
public enum AltoMouseButton
{
None = 0x0,
Middle = 0x1,
Right = 0x2,
Left = 0x4,
}
public class Mouse : IMemoryMappedDevice
{
public Mouse()
{
_lock = new ReaderWriterLockSlim();
Reset();
}
public void Reset()
{
// cheat for synchronization: this is approximately where the mouse is initialized to
// at alto boot.
_mouseY = 80;
_mouseX = 0;
}
public ushort Read(int address, TaskType task, bool extendedMemoryReference)
{
return (ushort)(~_buttons);
}
public void Load(int address, ushort data, TaskType task, bool extendedMemoryReference)
{
// nothing
}
public void MouseMove(int x, int y)
{
_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);
_ySteps = Math.Abs(_destY - _mouseY);
_yDir = Math.Sign(_destY - _mouseY);
//Console.WriteLine("Mouse move from ({0},{1}) to ({2},{3}).", _mouseX, _mouseY, _destX, _destY);
_lock.ExitWriteLock();
}
public void MouseDown(AltoMouseButton button)
{
_buttons |= button;
}
public void MouseUp(AltoMouseButton button)
{
_buttons ^= button;
}
/// <summary>
/// Gets the bits read by the "<-MOUSE" special function, and moves
/// the pointer one step closer to its final destination (if it has moved at all).
/// </summary>
/// <returns></returns>
public ushort PollMouseBits()
{
//
// The bits returned correspond to the delta incurred by mouse movement in the X and Y direction
// and map to:
// 0 : no change in X or Y
// 1 : dy = -1
// 2 : dy = 1
// 3 : dx = -1
// 4 : dy = -1, dx = -1
// 5 : dy = 1, dx = -1
// 6 : dx = 1
// 7 : dy = -1, dx = 1
// 8 : dy = 1, dx =1
ushort bits = 0;
_lock.EnterReadLock();
// TODO: optimize this
if (_yDir == -1 && _xDir == 0)
{
bits = 1;
}
else if (_yDir == 1 && _xDir == 0)
{
bits = 2;
}
else if (_yDir == 0 && _xDir == -1)
{
bits = 3;
}
else if (_yDir == -1 && _xDir == -1)
{
bits = 4;
}
else if (_yDir == 1 && _xDir == -1)
{
bits = 5;
}
else if (_yDir == 0 && _xDir == 1)
{
bits = 6;
}
else if (_yDir == -1 && _xDir == 1)
{
bits = 7;
}
else if (_yDir == 1 && _xDir == 1)
{
bits = 8;
}
//Console.WriteLine("Mouse poll: xdir {0}, ydir {1}, bits {2}", _xDir, _yDir, Conversion.ToOctal(bits));
// Move the mouse closer to its destination
if (_xSteps > 0)
{
_mouseX += _xDir;
_xSteps--;
if (_xSteps == 0)
{
_xDir = 0;
}
}
if (_ySteps > 0)
{
_mouseY += _yDir;
_ySteps--;
if (_ySteps == 0)
{
_yDir = 0;
}
}
_lock.ExitReadLock();
return bits;
}
public MemoryRange[] Addresses
{
get { return _addresses; }
}
private readonly MemoryRange[] _addresses =
{
new MemoryRange(0xfe18, 0xfe1b), // UTILIN: 177030-177033
};
// Mouse buttons:
AltoMouseButton _buttons;
/// <summary>
/// Where the mouse is currently reported to be
/// </summary>
private int _mouseX;
private int _mouseY;
/// <summary>
/// Where the mouse is moving to every time PollMouseBits is called.
/// </summary>
private int _destX;
private int _destY;
private int _xSteps;
private int _xDir;
private double _ySteps;
private int _yDir;
private ReaderWriterLockSlim _lock;
}
}

View File

@@ -44,7 +44,7 @@ namespace Contralto.Logging
static Log()
{
// TODO: make configurable
_components = LogComponent.None;
_components = LogComponent.None; //LogComponent.Memory; // | LogComponent.Microcode;
_type = LogType.Normal | LogType.Warning | LogType.Error;
}

View File

@@ -13,7 +13,7 @@ namespace Contralto.Memory
/// <summary>
/// The top address of main memory (above which lies the I/O space)
/// </summary>
public static ushort MemTop
public static ushort RamTop
{
get { return _memTop; }
}
@@ -35,8 +35,7 @@ namespace Contralto.Memory
else
{
address += 0x10000 * GetBankNumber(task, extendedMemory);
ushort data = _mem[address];
return data;
return _mem[address];
}
}

View File

@@ -6,6 +6,7 @@ namespace Contralto.Memory
{
public enum MemoryOperation
{
None,
LoadAddress,
Read,
Store
@@ -33,7 +34,7 @@ namespace Contralto.Memory
if (_bus.ContainsKey(addr))
{
throw new InvalidOperationException(
String.Format("Memory mapped address collision for dev {0} at address {1}", dev, Conversion.ToOctal(addr)));
String.Format("Memory mapped address collision for dev {0} at address {1} with {2}", dev, Conversion.ToOctal(addr), _bus[addr]));
}
else
{
@@ -269,7 +270,7 @@ namespace Contralto.Memory
/// <returns></returns>
private ushort ReadFromBus(ushort address, TaskType task, bool extendedMemoryReference)
{
if (address <= Memory.MemTop)
if (address <= Memory.RamTop)
{
// Main memory access; shortcut hashtable lookup for performance reasons.
return _mainMemory.Read(address, task, extendedMemoryReference);
@@ -301,7 +302,7 @@ namespace Contralto.Memory
/// <returns></returns>
private void WriteToBus(ushort address, ushort data, TaskType task, bool extendedMemoryReference)
{
if (address <= Memory.MemTop)
if (address <= Memory.RamTop)
{
// Main memory access; shortcut hashtable lookup for performance reasons.
_mainMemory.Load(address, data, task, extendedMemoryReference);