Skip to content

Commit

Permalink
Added the Memory slots for F256 in Memory Window.
Browse files Browse the repository at this point in the history
Fixed the Interrupt checkboxes in CPU Window to account for F256.
Adjusted to repaint the CPU Window upon interrupt/Breakpoint.
  • Loading branch information
Daniel Tremblay committed Jan 11, 2024
1 parent ee25999 commit 57243d1
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 45 deletions.
69 changes: 51 additions & 18 deletions Main/UI/CPUWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -298,18 +298,36 @@ private void DisplayInterruptTooltips()
Tooltip.SetToolTip(TMR1Checkbox, "Break on Mouse Interrupts");
Tooltip.SetToolTip(TMR2Checkbox, "Break on Timer0 Interrupts");
Tooltip.SetToolTip(RTCCheckbox, "Break on Timer1 Interrupts");
Tooltip.SetToolTip(FDCCheckbox, "Break on DMA Interrupts");
Tooltip.SetToolTip(MouseCheckbox, "Break on Reserved Interrupts");
Tooltip.SetToolTip(FDCCheckbox, "Reserved");
Tooltip.SetToolTip(MouseCheckbox, "Break on Cartridge Inserted Interrupts");
FDCCheckbox.Visible = false;

// Register 1
Tooltip.SetToolTip(KeyboardCheckBox, "Break on UART Interrupts");
Tooltip.SetToolTip(V2SprColCheck, "Break on Vicky Int2 Interrupts");
Tooltip.SetToolTip(V2BitColCheck, "Break on Vicky Int3 Interrupts");
Tooltip.SetToolTip(COM2Checkbox, "Break on Vicky Int4 Interrupts");
Tooltip.SetToolTip(V2SprColCheck, "Reserved");
Tooltip.SetToolTip(V2BitColCheck, "Reserved");
Tooltip.SetToolTip(COM2Checkbox, "Reserved");
Tooltip.SetToolTip(COM1Checkbox, "Break on RTC Interrupts");
Tooltip.SetToolTip(MPU401Checkbox, "Break on VIA Interrupts");
Tooltip.SetToolTip(ParallelPortCheck, "Break on IEC Interrupts");
Tooltip.SetToolTip(MPU401Checkbox, "Break on VIA 0 Interrupts");
Tooltip.SetToolTip(ParallelPortCheck, "Break on VIA 1 Interrupts");
Tooltip.SetToolTip(SDCardCheckBox, "Break on SD Card Interrupts");
V2SprColCheck.Visible = false;
V2BitColCheck.Visible = false;
COM2Checkbox.Visible = false;

// Register 2
Tooltip.SetToolTip(OPL3Checkbox, "Break on IEC Data In Interrupts");
Tooltip.SetToolTip(GabeInt0Check, "Break on IEC Clock In Interrupts");
Tooltip.SetToolTip(GabeInt1Check, "Break on IEC ATN In Interrupts");
Tooltip.SetToolTip(VDMACheck, "Break on IEC SEQ In Interrupts");
Tooltip.SetToolTip(V2TileColCheck, "Reserved");
Tooltip.SetToolTip(GabeInt2Check, "Reserved");
Tooltip.SetToolTip(ExtExpCheck, "Reserved");
Tooltip.SetToolTip(SDCardInsertCheck, "Reserved");
V2TileColCheck.Visible = false;
GabeInt2Check.Visible = false;
ExtExpCheck.Visible = false;
SDCardInsertCheck.Visible = false;
}
else
{
Expand All @@ -322,6 +340,7 @@ private void DisplayInterruptTooltips()
Tooltip.SetToolTip(RTCCheckbox, "Break on RTC Interrupts");
Tooltip.SetToolTip(FDCCheckbox, "Break on FDC Interrupts");
Tooltip.SetToolTip(MouseCheckbox, "Break on Mouse Interrupts");
FDCCheckbox.Visible = true;

// Register 1
Tooltip.SetToolTip(KeyboardCheckBox, "Break on Keyboard Interrupts");
Expand All @@ -332,6 +351,9 @@ private void DisplayInterruptTooltips()
Tooltip.SetToolTip(MPU401Checkbox, "Break on MIDI Ctrlr Interrupts");
Tooltip.SetToolTip(ParallelPortCheck, "Break on Parallel Interrupts");
Tooltip.SetToolTip(SDCardCheckBox, "Break on SD Card Interrupts");
V2SprColCheck.Visible = true;
V2BitColCheck.Visible = true;
COM2Checkbox.Visible = true;

// Register 2
Tooltip.SetToolTip(OPL3Checkbox, "Break on OPL3 Interrupts");
Expand All @@ -342,6 +364,10 @@ private void DisplayInterruptTooltips()
Tooltip.SetToolTip(GabeInt2Check, "Break on Gabe INT2 Interrupts");
Tooltip.SetToolTip(ExtExpCheck, "Break on External Expansion Interrupts");
Tooltip.SetToolTip(SDCardInsertCheck, "Break on SDCard Insertion Interrupts");
V2TileColCheck.Visible = true;
GabeInt2Check.Visible = true;
ExtExpCheck.Visible = true;
SDCardInsertCheck.Visible = true;
}
}
private void DebugPanel_MouseMove(object sender, MouseEventArgs e)
Expand Down Expand Up @@ -554,6 +580,7 @@ public void RunButton_Click(object sender, EventArgs e)
{
ResetInterrupts();
}
TurnOffActiveInterrupts();
//if (BreakOnIRQCheckBox.Checked)
//{
// InterruptMatchesCheckboxes();
Expand Down Expand Up @@ -823,6 +850,7 @@ public void ExecuteStep()
kernel.CPU.Pins.IRQ = false;
nextPC = kernel.CPU.PC;
UpdateInterruptCheckboxes();
Invoke(new nullParamMethod(Refresh));
}
if (line == null)
{
Expand Down Expand Up @@ -1010,35 +1038,37 @@ private void BreakOnIRQCheckBox_CheckedChanged(object sender, EventArgs e)
{
ResetInterrupts();
}
bool isF256 = BoardVersionHelpers.IsF256(boardVersion);

// Row 1
SOFCheckbox.Visible = visible;
SOLCheckbox.Visible = visible;
TMR0Checkbox.Visible = visible;
TMR1Checkbox.Visible = visible;
TMR2Checkbox.Visible = visible;
RTCCheckbox.Visible = visible;
FDCCheckbox.Visible = visible;
FDCCheckbox.Visible = !isF256 && visible;
MouseCheckbox.Visible = visible;

// Row 2
KeyboardCheckBox.Visible = visible;
V2SprColCheck.Visible = visible;
V2BitColCheck.Visible = visible;
COM2Checkbox.Visible = visible;
V2SprColCheck.Visible = !isF256 && visible;
V2BitColCheck.Visible = !isF256 && visible;
COM2Checkbox.Visible = !isF256 && visible;
COM1Checkbox.Visible = visible;
MPU401Checkbox.Visible = visible;
ParallelPortCheck.Visible = visible;
SDCardCheckBox.Visible = visible;

// Row 3
OPL3Checkbox.Visible = visible;
GabeInt0Check.Visible = visible;
GabeInt1Check.Visible = visible;
VDMACheck.Visible = visible;
V2TileColCheck.Visible = visible;
GabeInt2Check.Visible = visible;
ExtExpCheck.Visible = visible;
SDCardInsertCheck.Visible = visible;
V2TileColCheck.Visible = !isF256 && visible;
GabeInt2Check.Visible = !isF256 && visible;
ExtExpCheck.Visible = !isF256 && visible;
SDCardInsertCheck.Visible = !isF256 && visible;
}

/// <summary>
Expand Down Expand Up @@ -1127,6 +1157,10 @@ private void ResetInterrupts()
kernel.MemMgr.INTERRUPT.WriteFromGabe(3, 0);
}
}
}

private void TurnOffActiveInterrupts()
{
// turn off the checkboxes
// Row 1
SOFCheckbox.IsActive = false;
Expand Down Expand Up @@ -1158,7 +1192,6 @@ private void ResetInterrupts()
ExtExpCheck.IsActive = false;
SDCardInsertCheck.IsActive = false;
}

private void ResetButton_Click(object sender, EventArgs e)
{
MainWindow.Instance.RestartMenuItemClick(sender, e);
Expand Down
21 changes: 0 additions & 21 deletions Main/UI/MemoryWindow.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 54 additions & 6 deletions Main/UI/MemoryWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ public void SetVersion(BoardVersion version)
MCRBit11Button.Visible = true;
MCRBit12Button.Visible = true;
MCRBit13Button.Visible = true;

AddressCombo.Items.Clear();
AddressCombo.Items.Add("Slot $00");
AddressCombo.Items.Add("Slot $01");
AddressCombo.Items.Add("Slot $02");
AddressCombo.Items.Add("Slot $03");
AddressCombo.Items.Add("Slot $04");
AddressCombo.Items.Add("Slot $05");
AddressCombo.Items.Add("Address $C000 (IO Page)");
AddressCombo.Items.Add("Address $D000 (IO Page)");
AddressCombo.Items.Add("Slot $07");
AddressCombo.Items.Add("Unspecified Page");
}
else
{
Expand All @@ -67,7 +79,30 @@ public void SetVersion(BoardVersion version)
MCRBit11Button.Visible = false;
MCRBit12Button.Visible = false;
MCRBit13Button.Visible = false;
}

AddressCombo.Items.Clear();
AddressCombo.Items.Add("Bank $00");
AddressCombo.Items.Add("Bank $18");
AddressCombo.Items.Add("Bank $19");
AddressCombo.Items.Add("Bank $AF(Vicky)");
AddressCombo.Items.Add("Bank $B0(Video)");
AddressCombo.Items.Add("Address $AF: 0100(Bitmap Registers)");
AddressCombo.Items.Add("Address $AF: 0200(Tile Registers)");
AddressCombo.Items.Add("Address $AF: 0C00(Sprite Registers)");
AddressCombo.Items.Add("Address $AF: 1F40(Text Color Palette Foreground)");
AddressCombo.Items.Add("Address $AF: 1F80(Text Color Palette Background)");
AddressCombo.Items.Add("Address $AF: 2000(LUT 0)");
AddressCombo.Items.Add("Address $AF: 2400(LUT 1)");
AddressCombo.Items.Add("Address $AF: 2800(LUT 2)");
AddressCombo.Items.Add("Address $AF: 2C00(LUT 3)");
AddressCombo.Items.Add("Address $AF: 8000(Font Memory Bank 0)");
AddressCombo.Items.Add("Address $AF: 8800(Font Memory Bank 1)");
AddressCombo.Items.Add("Address $AF: A000(Text Memory)");
AddressCombo.Items.Add("Address $AF: C000(Text Colors)");
AddressCombo.Items.Add("Address $AF: E000(Gabe)");
AddressCombo.Items.Add("Unspecified Page");
}
AddressCombo.SelectedIndex = 0;
}
private void MemoryWindow_Load(object sender, EventArgs e)
{
Expand Down Expand Up @@ -116,7 +151,6 @@ private void MemoryWindow_Load(object sender, EventArgs e)
}
else
{
AddressCombo.SelectedIndex = 0;
HighlightPanel.ReadOnly = true;
HighlightPanel.ReadOnly = false;
}
Expand Down Expand Up @@ -259,18 +293,25 @@ private void FindMatchedDropDownEntry(int address)
bool matched = false;
foreach (string item in AddressCombo.Items)
{
dropdownAddress = 0;
dropdownAddress = -1;
if (item.StartsWith("Bank"))
{
int start = item.IndexOf('$');
dropdownAddress = Convert.ToInt32(item.Substring(start + 1, 2) + "0000", 16);
}
else if (item.StartsWith("Slot"))
{
// Read two characters and pad with '0000' to get a 16 bit address
int start = item.IndexOf('$');
dropdownAddress = Convert.ToInt32(item.Substring(start + 1, 2), 16) * 8192;
}
else if (item.StartsWith("Address"))
{
int start = item.IndexOf('$');
dropdownAddress = Convert.ToInt32(item.Replace(":", "").Substring(start + 1, 6), 16);
int paren = item.IndexOf('(', start);
dropdownAddress = Convert.ToInt32(item.Replace(":", "").Substring(start + 1, paren-start-1).Trim(), 16);
}
if (dropdownAddress != 0 && dropdownAddress == address)
if (dropdownAddress != -1 && dropdownAddress == address)
{
AddressCombo.SelectedItem = item;
matched = true;
Expand Down Expand Up @@ -314,11 +355,18 @@ private void AddressCombo_SelectedIndexChanged(object sender, EventArgs e)
int start = value.IndexOf('$');
startAddress = Convert.ToInt32(value.Substring(start + 1, 2) + "0000", 16);
}
else if (value.StartsWith("Slot"))
{
// Read two characters and pad with '0000' to get a 16 bit address
int start = value.IndexOf('$');
startAddress = Convert.ToInt32(value.Substring(start + 1, 2), 16) * 8192;
}
else if (value.StartsWith("Address"))
{
// Read all 6 characters, but omit the ':'
int start = value.IndexOf('$');
startAddress = Convert.ToInt32(value.Replace(":", "").Substring(start + 1, 6), 16);
int paren = value.IndexOf('(', start);
startAddress = Convert.ToInt32(value.Replace(":", "").Substring(start + 1, paren-start-1).Trim(), 16);
}
else
{
Expand Down

0 comments on commit 57243d1

Please sign in to comment.