diff --git a/Main/Devices/BoardVersion.cs b/Main/Devices/BoardVersion.cs index 8feaa71..9a90d72 100644 --- a/Main/Devices/BoardVersion.cs +++ b/Main/Devices/BoardVersion.cs @@ -13,14 +13,19 @@ public enum BoardVersion RevU, RevUPlus, RevJr_6502, - RevJr_65816 + RevJr_65816, + RevF256K_6502, + RevF256K_65816 } public static class BoardVersionHelpers { - public static bool IsJr(BoardVersion boardVersion) + public static bool IsF256(BoardVersion boardVersion) { - return boardVersion == BoardVersion.RevJr_6502 || boardVersion == BoardVersion.RevJr_65816; + return boardVersion == BoardVersion.RevJr_6502 || + boardVersion == BoardVersion.RevJr_65816 || + boardVersion == BoardVersion.RevF256K_6502 || + boardVersion == BoardVersion.RevF256K_65816; } } } diff --git a/Main/Devices/PS2KeyboardRegister.cs b/Main/Devices/PS2KeyboardRegister.cs index 9c3d0bb..0bfa0b1 100644 --- a/Main/Devices/PS2KeyboardRegister.cs +++ b/Main/Devices/PS2KeyboardRegister.cs @@ -10,12 +10,20 @@ public class PS2KeyboardRegister: MemoryLocations.MemoryRAM private byte ps2PacketCntr = 0; private int packetLength = 0; private byte[] ps2packet = new byte[6]; + private Mode mode; // Mode 1 for C256, Mode 2 for F256 public delegate void TriggerInterruptDelegate(); public TriggerInterruptDelegate TriggerKeyboardInterrupt; public TriggerInterruptDelegate TriggerMouseInterrupt; - public PS2KeyboardRegister(int StartAddress, int Length) : base(StartAddress, Length) + public enum Mode { + Mode1, + Mode2 + } + + public PS2KeyboardRegister(int StartAddress, int Length, Mode m) : base(StartAddress, Length) + { + mode = m; } // This is used to simulate the Keyboard Register @@ -144,6 +152,11 @@ public override byte ReadByte(int Address) } return data[0]; } + else if (Address == 4 && mode == Mode.Mode2) + { + // PS2 mode 2 keyboards are not currently supported, so always return 0b11, indicating that they keyboard and mouse queues are empty. + return 3; + } else if (Address == 5) { return 0; diff --git a/Main/FoenixSystem.cs b/Main/FoenixSystem.cs index 0d1c41d..bfaf811 100644 --- a/Main/FoenixSystem.cs +++ b/Main/FoenixSystem.cs @@ -50,12 +50,14 @@ public FoenixSystem(BoardVersion version, string DefaultKernel) keyboardAddress = MemoryMap.KBD_DATA_BUF_U; break; case BoardVersion.RevJr_6502: + case BoardVersion.RevF256K_6502: memSize = 1024*1024; // Includes both RAM and flash. keyboardAddress = MemoryMap.KBD_DATA_BUF_JR; clock = 6293000; is6502 = true; break; case BoardVersion.RevJr_65816: + case BoardVersion.RevF256K_65816: memSize = 1024 * 1024; keyboardAddress = MemoryMap.KBD_DATA_BUF_JR; clock = 6293000; @@ -67,7 +69,7 @@ public FoenixSystem(BoardVersion version, string DefaultKernel) codec = new CodecRAM(MemoryMap.CODEC_WR_CTRL, 4); sdcard = new CH376SRegister(MemoryMap.SDCARD_DATA, MemoryMap.SDCARD_SIZE); } - else if (BoardVersionHelpers.IsJr(boardVersion)) + else if (BoardVersionHelpers.IsF256(boardVersion)) { codec = new CodecRAM(MemoryMap.CODEC_WR_CTRL_JR, 3); // unlike the FMX, this register is 16-bits in F256Jr sdcard = new F256SDController(MemoryMap.SDCARD_JR, 2); @@ -78,7 +80,7 @@ public FoenixSystem(BoardVersion version, string DefaultKernel) sdcard = new GabeSDController(MemoryMap.GABE_SDC_CTRL_START, MemoryMap.GABE_SDC_CTRL_SIZE); } - if (!BoardVersionHelpers.IsJr(boardVersion)) + if (!BoardVersionHelpers.IsF256(boardVersion)) { // These are the strictly 65816-based machines MemMgr = new MemoryManager @@ -91,7 +93,7 @@ public FoenixSystem(BoardVersion version, string DefaultKernel) // Special devices MATH = new MathCoproRegister(MemoryMap.MATH_START, MemoryMap.MATH_END - MemoryMap.MATH_START + 1), // 48 bytes - PS2KEYBOARD = new PS2KeyboardRegister(keyboardAddress, 5), + PS2KEYBOARD = new PS2KeyboardRegister(keyboardAddress, 5, PS2KeyboardRegister.Mode.Mode1), SDCARD = sdcard, INTERRUPT = new InterruptController(MemoryMap.INT_PENDING_REG0, 4), UART1 = new UART(MemoryMap.UART1_REGISTERS, 8), @@ -114,14 +116,14 @@ public FoenixSystem(BoardVersion version, string DefaultKernel) } else { - // This is either a 6502-based machine, or a 65816-based Jr with the same memory map + // This is a 6502 or 85816-based F256 machine; both have the same memory map MemMgr = new MemoryManager { RAM = new MemoryRAM(MemoryMap.RAM_START, memSize), FLASHJR = new FlashJr(MemoryMap.RAM_START, 0x08_0000), // vicky will store 4 pages of data VICKY = new MemoryRAM(0, 4 * 0x2000), - PS2KEYBOARD = new PS2KeyboardRegister(keyboardAddress, 5), + PS2KEYBOARD = new PS2KeyboardRegister(keyboardAddress, 5, PS2KeyboardRegister.Mode.Mode2), MATRIXKEYBOARD = new MatrixKeyboardRegister(MemoryMap.MATRIX_KEYBOARD_VIA0_PORT_B, 4, MemoryMap.MATRIX_KEYBOARD_VIA1_PORT_B, 4), MATH = new MathCoproRegister(MemoryMap.MATH_START_JR, MemoryMap.MATH_END_JR - MemoryMap.MATH_START_JR + 1), // 32 bytes SDCARD = sdcard, @@ -142,7 +144,7 @@ public FoenixSystem(BoardVersion version, string DefaultKernel) // Load the kernel.hex if present ResetCPU(DefaultKernel); - if (!BoardVersionHelpers.IsJr(boardVersion)) + if (!BoardVersionHelpers.IsF256(boardVersion)) { // Write bytes $9F in the joystick registers to mean that they are not installed. MemMgr.WriteWord(0xAFE800, 0x9F9F); @@ -183,7 +185,15 @@ public FoenixSystem(BoardVersion version, string DefaultKernel) } else { - MemMgr.WriteByte(MemoryMap.REVOFJR, 0x2); + if (boardVersion == BoardVersion.RevJr_6502 || boardVersion == BoardVersion.RevJr_65816) + { + MemMgr.WriteByte(MemoryMap.REVOFJR, 0x2); + } + else + { + System.Diagnostics.Debug.Assert(boardVersion == BoardVersion.RevF256K_6502 || boardVersion == BoardVersion.RevF256K_65816); + MemMgr.WriteByte(MemoryMap.REVOFJR, 0x12); + } MemMgr.VICKY.WriteWord(0xD000 - 0xC000, 1); MemMgr.VICKY.WriteWord(0xD002 - 0xC000, 0x1540); string applicationDirectory = System.AppContext.BaseDirectory; @@ -211,7 +221,7 @@ public FoenixSystem(BoardVersion version, string DefaultKernel) private void TimerEvent0() { - if (!BoardVersionHelpers.IsJr(boardVersion)) + if (!BoardVersionHelpers.IsF256(boardVersion)) { byte mask = MemMgr.ReadByte(MemoryLocations.MemoryMap.INT_MASK_REG0); if (!CPU.DebugPause && !CPU.Flags.IrqDisable && ((~mask & (byte)Register0.FNX0_INT02_TMR0) == (byte)Register0.FNX0_INT02_TMR0)) @@ -238,7 +248,7 @@ private void TimerEvent0() } private void TimerEvent1() { - if (!BoardVersionHelpers.IsJr(boardVersion)) + if (!BoardVersionHelpers.IsF256(boardVersion)) { byte mask = MemMgr.ReadByte(MemoryLocations.MemoryMap.INT_MASK_REG0); if (!CPU.DebugPause && !CPU.Flags.IrqDisable && ((~mask & (byte)Register0.FNX0_INT03_TMR1) == (byte)Register0.FNX0_INT03_TMR1)) @@ -280,7 +290,7 @@ private void TimerEvent2() private void RTCAlarmEvents() { - if (!BoardVersionHelpers.IsJr(boardVersion)) + if (!BoardVersionHelpers.IsF256(boardVersion)) { byte mask = MemMgr.ReadByte(MemoryLocations.MemoryMap.INT_MASK_REG0); if (!CPU.DebugPause && !CPU.Flags.IrqDisable && ((~mask & (byte)Register0.FNX0_INT05_RTC) == (byte)Register0.FNX0_INT05_RTC)) @@ -357,7 +367,7 @@ public bool ResetCPU(string filename) string extension = info.Extension.ToUpper(); if (info.Name.StartsWith("kernel")) { - if (BoardVersionHelpers.IsJr(boardVersion)) + if (BoardVersionHelpers.IsF256(boardVersion)) { MemMgr.MMU.Reset(); } @@ -365,7 +375,7 @@ public bool ResetCPU(string filename) else { // Ensure the first LUTs are set correctly - but don't overwrite the kernel. - if (BoardVersionHelpers.IsJr(boardVersion)) + if (BoardVersionHelpers.IsF256(boardVersion)) { MemMgr.MMU.SetActiveLUT(0); MemMgr.MMU.WriteByte(0x8, 0); @@ -447,7 +457,7 @@ public bool ResetCPU(string filename) } while (reader.BaseStream.Position < info.Length); reader.Close(); - if (!BoardVersionHelpers.IsJr(boardVersion)) + if (!BoardVersionHelpers.IsF256(boardVersion)) { // This is pretty messed up... ERESET points to $FF00, which has simple load routine. MemMgr.WriteWord(MemoryMap.VECTOR_ERESET, 0xFF00); @@ -497,7 +507,7 @@ public bool ResetCPU(string filename) // Copy the data into memory MemMgr.RAM.CopyBuffer(DataBuffer, 0, DataStartAddress, flen); - if (BoardVersionHelpers.IsJr(boardVersion)) + if (BoardVersionHelpers.IsF256(boardVersion)) { bool binOverlapsFlash = DataStartAddress >= 0x08_0000; if (binOverlapsFlash) diff --git a/Main/Program.cs b/Main/Program.cs index 80deaf3..69fa842 100644 --- a/Main/Program.cs +++ b/Main/Program.cs @@ -128,8 +128,14 @@ private static Dictionary DecodeProgramArguments(string[] args) case "jr816": context.Add("version", "RevJr816"); break; + case "f256k": + context.Add("version", "RevF256K"); + break; + case "f256k816": + context.Add("version", "RevF256K816"); + break; default: - Console.Out.WriteLine("Invalid board specified: " + verArg + ". Must be one of b, c, u, u+, jr, jr816"); + Console.Out.WriteLine("Invalid board specified: " + verArg + ". Must be one of b, c, u, u+, jr, jr816, f256k, f256k816"); context["Continue"] = "false"; break; } diff --git a/Main/UI/CPUWindow.cs b/Main/UI/CPUWindow.cs index 94cea79..50d5920 100644 --- a/Main/UI/CPUWindow.cs +++ b/Main/UI/CPUWindow.cs @@ -241,8 +241,8 @@ private void DebugPanel_Paint(object sender, PaintEventArgs e) private void DisplayInterruptTooltips() { - bool isJunior = BoardVersionHelpers.IsJr(boardVersion); - if (isJunior) + bool isF256 = BoardVersionHelpers.IsF256(boardVersion); + if (isF256) { // this is going to be confusing - the F256 Interrupts are different // Register 0 @@ -462,7 +462,7 @@ public void RunButton_Click(object sender, EventArgs e) IRQPC = -1; kernel.MemMgr.INTERRUPT.WriteFromGabe(0, 0); kernel.MemMgr.INTERRUPT.WriteFromGabe(1, 0); - if (!BoardVersionHelpers.IsJr(kernel.GetVersion())) + if (!BoardVersionHelpers.IsF256(kernel.GetVersion())) { kernel.MemMgr.INTERRUPT.WriteFromGabe(2, 0); kernel.MemMgr.INTERRUPT.WriteFromGabe(3, 0); @@ -896,7 +896,7 @@ private void CPUWindow_KeyDown(object sender, KeyEventArgs e) private void BreakOnIRQCheckBox_CheckedChanged(object sender, EventArgs e) { bool visible = BreakOnIRQCheckBox.Checked; - if (BoardVersionHelpers.IsJr(boardVersion)) + if (BoardVersionHelpers.IsF256(boardVersion)) { // Row 1 SOFCheckbox.Visible = visible; @@ -1002,7 +1002,7 @@ private bool InterruptMatchesCheckboxes() } // The F256s do not have the following registers - if (!BoardVersionHelpers.IsJr(kernel.GetVersion())) + if (!BoardVersionHelpers.IsF256(kernel.GetVersion())) { //Read Interrupt Register 2 - we don't handle these yet byte reg2 = kernel.MemMgr.INTERRUPT.ReadByte(2); diff --git a/Main/UI/MainWindow.Designer.cs b/Main/UI/MainWindow.Designer.cs index 6dea885..3c71bd4 100644 --- a/Main/UI/MainWindow.Designer.cs +++ b/Main/UI/MainWindow.Designer.cs @@ -85,6 +85,8 @@ private void InitializeComponent() this.revUPlusToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.revJrToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.revJr816ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.revF256KToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.revF256K816ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.revBToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.gpu = new FoenixIDE.Display.Gpu(); this.statusStrip1.SuspendLayout(); @@ -119,7 +121,9 @@ private void InitializeComponent() this.revUToolStripMenuItem, this.revUPlusToolStripMenuItem, this.revJrToolStripMenuItem, - this.revJr816ToolStripMenuItem}); + this.revJr816ToolStripMenuItem, + this.revF256KToolStripMenuItem, + this.revF256K816ToolStripMenuItem}); this.toolStripRevision.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold); this.toolStripRevision.Name = "toolStripRevision"; this.toolStripRevision.Size = new System.Drawing.Size(110, 28); @@ -554,6 +558,18 @@ private void InitializeComponent() this.revJr816ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.revJr816ToolStripMenuItem.Text = "Rev Jr(816)"; // + // revF256KToolStripMenuItem + // + this.revF256KToolStripMenuItem.Name = "revF256KToolStripMenuItem"; + this.revF256KToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.revF256KToolStripMenuItem.Text = "Rev F256K"; + // + // revF256K816ToolStripMenuItem + // + this.revF256K816ToolStripMenuItem.Name = "revF256K816ToolStripMenuItem"; + this.revF256K816ToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.revF256K816ToolStripMenuItem.Text = "Rev F256K(816)"; + // // revBToolStripMenuItem // this.revBToolStripMenuItem.Name = "revBToolStripMenuItem"; @@ -665,7 +681,9 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripMenuItem viewScalingToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem scale1_0XToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem scale2_0XToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem scale1_5XToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem scale1_5XToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem revF256K816ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem revF256KToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem revJr816ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem revJrToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem revUPlusToolStripMenuItem; diff --git a/Main/UI/MainWindow.cs b/Main/UI/MainWindow.cs index ae7e4db..c83c1a8 100644 --- a/Main/UI/MainWindow.cs +++ b/Main/UI/MainWindow.cs @@ -101,6 +101,14 @@ public MainWindow(Dictionary context) { version = BoardVersion.RevJr_65816; } + else if (context["version"] == "RevF256K") + { + version = BoardVersion.RevF256K_6502; + } + else if (context["version"] == "RevF256K816") + { + version = BoardVersion.RevF256K_65816; + } boardVersionCommandLineSpecified = true; } } @@ -131,6 +139,12 @@ public MainWindow(Dictionary context) case "Jr(816)": version = BoardVersion.RevJr_65816; break; + case "F256K": + version = BoardVersion.RevF256K_6502; + break; + case "F256K(816)": + version = BoardVersion.RevF256K_65816; + break; } } if (defaultKernel == null) @@ -151,7 +165,9 @@ public MainWindow(Dictionary context) defaultKernel = Path.Combine(romsDir, "kernel_U_Plus.hex"); break; case BoardVersion.RevJr_6502: - case BoardVersion.RevJr_65816: // Both SKUs share the same kernelfile + case BoardVersion.RevJr_65816: + case BoardVersion.RevF256K_6502: + case BoardVersion.RevF256K_65816:// All SKUs share the same kernelfile currently defaultKernel = Path.Combine(romsDir, "kernel_F256jr.hex"); break; } @@ -197,7 +213,7 @@ private void BasicWindow_Load(object sender, EventArgs e) gpu.GpuUpdated += Gpu_Update_Cps_Fps; } gpu.VICKY = kernel.MemMgr.VICKY; - if (!BoardVersionHelpers.IsJr(version)) + if (!BoardVersionHelpers.IsF256(version)) { gpu.SetMode(0); gpu.VRAM = kernel.MemMgr.VIDEO; @@ -278,7 +294,7 @@ private void BasicWindow_Load(object sender, EventArgs e) } SetDipSwitchMemory(); - if (!BoardVersionHelpers.IsJr(version)) + if (!BoardVersionHelpers.IsF256(version)) { // Code is tightly coupled with memory manager kernel.MemMgr.UART1.TransmitByte += SerialTransmitByte; @@ -471,7 +487,7 @@ public void SOFRoutine() { // Check if the interrupt is enabled byte mask = kernel.MemMgr.ReadByte(MemoryLocations.MemoryMap.INT_MASK_REG0); - if (BoardVersionHelpers.IsJr(version)) + if (BoardVersionHelpers.IsF256(version)) { // we need to this to avoid using the MMU IO Paging function mask = kernel.MemMgr.VICKY.ReadByte(MemoryLocations.MemoryMap.INT_MASK_REG0_JR - 0xC000); @@ -481,7 +497,7 @@ public void SOFRoutine() { // Set the SOF Interrupt byte IRQ0 = kernel.MemMgr.INTERRUPT.ReadByte(0); - if (BoardVersionHelpers.IsJr(version)) + if (BoardVersionHelpers.IsF256(version)) { // we need to this to avoid using the MMU IO Paging function IRQ0 = kernel.MemMgr.VICKY.ReadByte(MemoryLocations.MemoryMap.INT_PENDING_REG0_JR - 0xC000); @@ -499,7 +515,7 @@ public void SOLRoutine() { // Check if the interrupt is enabled byte mask = kernel.MemMgr.ReadByte(MemoryLocations.MemoryMap.INT_MASK_REG0); - if (BoardVersionHelpers.IsJr(version)) + if (BoardVersionHelpers.IsF256(version)) { mask = kernel.MemMgr.ReadByte(MemoryLocations.MemoryMap.INT_MASK_REG0_JR); } @@ -508,7 +524,7 @@ public void SOLRoutine() { // Set the SOL Interrupt byte IRQ0 = kernel.MemMgr.ReadByte(MemoryLocations.MemoryMap.INT_PENDING_REG0); - if (BoardVersionHelpers.IsJr(version)) + if (BoardVersionHelpers.IsF256(version)) { IRQ0 = kernel.MemMgr.ReadByte(MemoryLocations.MemoryMap.INT_PENDING_REG0_JR - 0xC000); } @@ -527,7 +543,7 @@ public void SDCardInterrupt(CH376SInterrupt irq) { // Check if the SD Card interrupt is allowed byte mask = kernel.MemMgr.ReadByte(MemoryLocations.MemoryMap.INT_MASK_REG1); - if (BoardVersionHelpers.IsJr(version)) + if (BoardVersionHelpers.IsF256(version)) { mask = kernel.MemMgr.ReadByte(MemoryLocations.MemoryMap.INT_MASK_REG0_JR + 1); } @@ -535,7 +551,7 @@ public void SDCardInterrupt(CH376SInterrupt irq) { // Set the SD Card Interrupt byte IRQ1 = kernel.MemMgr.ReadByte(MemoryLocations.MemoryMap.INT_PENDING_REG1); - if (BoardVersionHelpers.IsJr(version)) + if (BoardVersionHelpers.IsF256(version)) { IRQ1 = kernel.MemMgr.ReadByte(MemoryLocations.MemoryMap.INT_PENDING_REG0_JR + 1); } @@ -628,7 +644,7 @@ private void BasicWindow_KeyDown(object sender, KeyEventArgs e) private void WriteKeyboardCode(ScanCode sc) { - if (!BoardVersionHelpers.IsJr(version)) + if (!BoardVersionHelpers.IsF256(version)) { // Check if the Keyboard interrupt is allowed byte mask = kernel.MemMgr.ReadByte(MemoryMap.INT_MASK_REG1); @@ -661,7 +677,7 @@ private void WriteKeyboardCode(ScanCode sc) } private void TriggerKeyboardInterrupt() { - if (!BoardVersionHelpers.IsJr(version)) + if (!BoardVersionHelpers.IsF256(version)) { // Set the Keyboard Interrupt byte IrqVal = kernel.MemMgr.INTERRUPT.ReadByte(1); @@ -681,7 +697,7 @@ private void TriggerKeyboardInterrupt() private void TriggerMouseInterrupt() { - if (!BoardVersionHelpers.IsJr(version)) + if (!BoardVersionHelpers.IsF256(version)) { // Set the Mouse Interrupt byte IRQ0 = kernel.MemMgr.INTERRUPT.ReadByte(0); @@ -810,7 +826,7 @@ public void RestartMenuItemClick(object sender, EventArgs e) debugWindow.ClearTrace(); SetDipSwitchMemory(); memoryWindow.Memory = kernel.CPU.MemMgr; - if (BoardVersionHelpers.IsJr(version)) + if (BoardVersionHelpers.IsF256(version)) { // Now update other registers //kernel.MemMgr.MMU.Reset(); @@ -838,7 +854,7 @@ private void DebugToolStripMenuItem_Click(object sender, EventArgs e) debugWindow.ClearTrace(); SetDipSwitchMemory(); memoryWindow.Memory = kernel.CPU.MemMgr; - if (BoardVersionHelpers.IsJr(version)) + if (BoardVersionHelpers.IsF256(version)) { // Now update other registers kernel.MemMgr.MMU.Reset(); @@ -863,7 +879,7 @@ private void DefaultKernelToolStripMenuItem_Click(object sender, EventArgs e) debugWindow.ClearTrace(); SetDipSwitchMemory(); memoryWindow.Memory = kernel.CPU.MemMgr; - if (BoardVersionHelpers.IsJr(version)) + if (BoardVersionHelpers.IsF256(version)) { // Now update other registers kernel.MemMgr.MMU.Reset(); @@ -968,7 +984,7 @@ private void LoadFNXMLFileToolStripMenuItem_Click(object sender, EventArgs e) debugWindow.Pause(); SetDipSwitchMemory(); ShowDebugWindow(version); - if (BoardVersionHelpers.IsJr(version)) + if (BoardVersionHelpers.IsF256(version)) { // Now update other registers kernel.MemMgr.MMU.Reset(); @@ -1050,7 +1066,7 @@ private void EditorWindowClosed(object sender, FormClosedEventArgs e) { gpu.TileEditorMode = false; // Restore the previous graphics mode - if (!BoardVersionHelpers.IsJr(version)) + if (!BoardVersionHelpers.IsF256(version)) { kernel.MemMgr.VICKY.WriteByte(0, previousGraphicMode); } @@ -1072,7 +1088,7 @@ private void TileEditorToolStripMenuItem_Click(object sender, EventArgs e) tileEditor.SetResourceChecker(kernel.ResCheckerRef); gpu.TileEditorMode = true; // Set Vicky into Tile mode - if (!BoardVersionHelpers.IsJr(version)) + if (!BoardVersionHelpers.IsF256(version)) { previousGraphicMode = kernel.MemMgr.VICKY.ReadByte(0); kernel.MemMgr.VICKY.WriteByte(0, 0x10); @@ -1112,13 +1128,13 @@ private void CharacterEditorToolStripMenuItem_Click(object sender, EventArgs e) private void Gpu_MouseMove(object sender, MouseEventArgs e) { Point size = gpu.GetScreenSize(); - if (BoardVersionHelpers.IsJr(version)) + if (BoardVersionHelpers.IsF256(version)) { size = gpu.GetScreenSize_JR(); } float ratioW = gpu.Width / (float)size.X; float ratioH = gpu.Height / (float)size.Y; - if (!BoardVersionHelpers.IsJr(version)) + if (!BoardVersionHelpers.IsF256(version)) { bool borderEnabled = kernel.MemMgr.ReadByte(MemoryLocations.MemoryMap.BORDER_CTRL_REG) == 1; double borderWidth = borderEnabled ? kernel.MemMgr.ReadByte(MemoryLocations.MemoryMap.BORDER_X_SIZE) : 0; @@ -1146,7 +1162,7 @@ private void Gpu_MouseMove(object sender, MouseEventArgs e) private void Gpu_MouseDown(object sender, MouseEventArgs e) { Point size = gpu.GetScreenSize(); - if (BoardVersionHelpers.IsJr(version)) + if (BoardVersionHelpers.IsF256(version)) { size = gpu.GetScreenSize_JR(); } @@ -1204,7 +1220,7 @@ private void Gpu_MouseUp(object sender, MouseEventArgs e) private void GenerateMouseInterrupt(MouseEventArgs e) { Point size = gpu.GetScreenSize(); - if (BoardVersionHelpers.IsJr(version)) + if (BoardVersionHelpers.IsF256(version)) { gpu.GetScreenSize_JR(); } @@ -1233,7 +1249,7 @@ private void Gpu_MouseLeave(object sender, EventArgs e) left = false; right = false; middle = false; - if (!BoardVersionHelpers.IsJr(version) && gpu.IsMousePointerVisible() || gpu.TileEditorMode) + if (!BoardVersionHelpers.IsF256(version) && gpu.IsMousePointerVisible() || gpu.TileEditorMode) { Cursor.Show(); } @@ -1242,7 +1258,7 @@ private void Gpu_MouseLeave(object sender, EventArgs e) private void Gpu_MouseEnter(object sender, EventArgs e) { - if (!BoardVersionHelpers.IsJr(version) && gpu.IsMousePointerVisible() && !gpu.TileEditorMode) + if (!BoardVersionHelpers.IsF256(version) && gpu.IsMousePointerVisible() && !gpu.TileEditorMode) { Cursor.Hide(); } @@ -1351,6 +1367,16 @@ private void DisplayBoardVersion() toolStripRevision.Text = "Rev F256Jr(816)"; shortVersion = "Jr(816)"; } + else if (version == BoardVersion.RevF256K_6502) + { + toolStripRevision.Text = "Rev F256K"; + shortVersion = "F256K"; + } + else if (version == BoardVersion.RevF256K_65816) + { + toolStripRevision.Text = "Rev F256K(816)"; + shortVersion = "F256K(816)"; + } // force repaint statusStrip1.Invalidate(); @@ -1392,6 +1418,16 @@ private void ToolStripRevision_DropDownItemClicked(object sender, ToolStripItemC version = BoardVersion.RevJr_65816; defaultKernel += Path.Combine("roms", "kernel_F256jr.hex"); } + else if (e.ClickedItem == revF256KToolStripMenuItem) + { + version = BoardVersion.RevF256K_6502; + defaultKernel += Path.Combine("roms", "kernel_F256jr.hex"); + } + else if (e.ClickedItem == revF256K816ToolStripMenuItem) + { + version = BoardVersion.RevF256K_65816; + defaultKernel += Path.Combine("roms", "kernel_F256jr.hex"); + } kernel.SetVersion(version); if (uploaderWindow != null) @@ -1477,7 +1513,7 @@ private void DipSwitch_MouseDown(object sender, MouseEventArgs e) private void SetDipSwitchMemory() { - if (!BoardVersionHelpers.IsJr(version)) + if (!BoardVersionHelpers.IsF256(version)) { // if kernel memory is available, set the memory byte bootMode = (byte)((switches[0] ? 0 : 1) + (switches[1] ? 0 : 2)); @@ -1541,7 +1577,7 @@ private void SetDipSwitchMemory() public void WriteMCRBytesToVicky(byte low, byte high) { - int baseAddr = BoardVersionHelpers.IsJr(version) ? 0xD000 - 0xC000 : 0; + int baseAddr = BoardVersionHelpers.IsF256(version) ? 0xD000 - 0xC000 : 0; kernel.MemMgr.VICKY.WriteByte(baseAddr, low); kernel.MemMgr.VICKY.WriteByte(baseAddr + 1, high); @@ -1549,12 +1585,12 @@ public void WriteMCRBytesToVicky(byte low, byte high) public ushort ReadMCRBytesFromVicky() { - return (ushort)kernel.MemMgr.VICKY.ReadWord(BoardVersionHelpers.IsJr(version) ? 0xD000 - 0xC000 : 0); + return (ushort)kernel.MemMgr.VICKY.ReadWord(BoardVersionHelpers.IsF256(version) ? 0xD000 - 0xC000 : 0); } public void UpdateGamma(bool gamma) { - if (!BoardVersionHelpers.IsJr(version)) + if (!BoardVersionHelpers.IsF256(version)) { switches[6] = gamma; dipSwitch.Invalidate(); diff --git a/Main/UI/UploaderWindow.cs b/Main/UI/UploaderWindow.cs index 85e5f91..cd84221 100644 --- a/Main/UI/UploaderWindow.cs +++ b/Main/UI/UploaderWindow.cs @@ -47,6 +47,12 @@ public void SetBoardVersion(BoardVersion ver) case BoardVersion.RevJr_65816: RevModeLabel.Text = "Mode: F256Jr(816)"; break; + case BoardVersion.RevF256K_6502: + RevModeLabel.Text = "Mode: F256K"; + break; + case BoardVersion.RevF256K_65816: + RevModeLabel.Text = "Mode: F256K(816)"; + break; } } @@ -271,7 +277,7 @@ private void SendBinaryButton_Click(object sender, EventArgs e) { BaseBankAddress = 0x18_0000; } - else if (BoardVersionHelpers.IsJr(boardVersion)) + else if (BoardVersionHelpers.IsF256(boardVersion)) { BaseBankAddress = 0; } @@ -785,7 +791,7 @@ public void PreparePacket2Write(byte[] buffer, int FNXMemPointer, int FilePointe // Maximum transmission size is 8192 if (Size > 8192) { - if (!BoardVersionHelpers.IsJr(boardVersion)) + if (!BoardVersionHelpers.IsF256(boardVersion)) { Size = 8192; Console.WriteLine("PreparePacket2Write: output truncated to 8K bytes.");