From 275ccb381a7dcec67291e23067359551ecae70e4 Mon Sep 17 00:00:00 2001 From: alyosha-tas Date: Thu, 4 Jul 2019 21:26:13 -0400 Subject: [PATCH] Vectrex: ramp overscan more accurate, fixes numerous display bugs --- .../Consoles/GCE/Vectrex/PPU.cs | 19 ++--- .../GCE/Vectrex/VectrexHawk.IDebuggable.cs | 69 +++++++++++++------ 2 files changed, 60 insertions(+), 28 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/PPU.cs b/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/PPU.cs index 089739b7e7..07fad880be 100644 --- a/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/PPU.cs +++ b/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/PPU.cs @@ -7,7 +7,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex { public VectrexHawk Core { get; set; } - public bool zero_sig, ramp_sig, blank_sig; + public bool zero_sig, ramp_sig, blank_sig, off_screen; public byte vec_scale, x_vel, y_vel, bright; public double x_pos, y_pos; @@ -32,13 +32,15 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex { skip--; } - - if (x_pos > 257) { x_pos = 257; } - if (x_pos < 2) { x_pos = 2; } - if (y_pos > 385) { y_pos = 385; } - if (y_pos < 2) { y_pos = 2; } - + off_screen = false; + + if (x_pos > 257) { off_screen = true; if (x_pos > (257 + 256)) { x_pos = (257 + 256); } } + if (x_pos < 2) { off_screen = true; if (x_pos < (2 - 256)) { x_pos = (2 - 256); } } + if (y_pos > 385) { off_screen = true; if (y_pos > (385 + 256)) { y_pos = (385 + 256); } } + if (y_pos < 2) { off_screen = true; if (y_pos < (2 - 256)) { y_pos = (2 - 256); } } + + } else if (zero_sig) { @@ -46,7 +48,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex y_pos = 192 + 2; } - if (!blank_sig) + if (!blank_sig && !off_screen) { Core._vidbuffer[(int)(Math.Round(x_pos) + 260 * Math.Round(y_pos))] |= (int)(br & bright_int_1); @@ -84,6 +86,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex ser.Sync(nameof(zero_sig), ref zero_sig); ser.Sync(nameof(blank_sig), ref blank_sig); ser.Sync(nameof(ramp_sig), ref ramp_sig); + ser.Sync(nameof(off_screen), ref off_screen); ser.Sync(nameof(vec_scale), ref vec_scale); ser.Sync(nameof(x_vel), ref x_vel); diff --git a/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/VectrexHawk.IDebuggable.cs b/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/VectrexHawk.IDebuggable.cs index c703f77cbc..95405698d6 100644 --- a/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/VectrexHawk.IDebuggable.cs +++ b/BizHawk.Emulation.Cores/Consoles/GCE/Vectrex/VectrexHawk.IDebuggable.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using BizHawk.Emulation.Common; +using BizHawk.Emulation.Common.Components.MC6809; namespace BizHawk.Emulation.Cores.Consoles.Vectrex { @@ -11,21 +12,22 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex { return new Dictionary { - /* - ["A"] = cpu.A, - ["X"] = cpu.X, - ["Y"] = cpu.Y, - ["S"] = cpu.S, - ["PC"] = cpu.PC, - ["Flag C"] = cpu.FlagC, - ["Flag Z"] = cpu.FlagZ, + + ["A"] = cpu.Regs[MC6809.A], + ["B"] = cpu.Regs[MC6809.B], + ["X"] = cpu.Regs[MC6809.X], + ["Y"] = cpu.Regs[MC6809.Y], + ["US"] = cpu.Regs[MC6809.US], + ["SP"] = cpu.Regs[MC6809.SP], + ["PC"] = cpu.Regs[MC6809.PC], + ["Flag E"] = cpu.FlagE, + ["Flag F"] = cpu.FlagF, + ["Flag H"] = cpu.FlagH, ["Flag I"] = cpu.FlagI, - ["Flag D"] = cpu.FlagD, - ["Flag B"] = cpu.FlagB, - ["Flag V"] = cpu.FlagV, ["Flag N"] = cpu.FlagN, - ["Flag T"] = cpu.FlagT - */ + ["Flag Z"] = cpu.FlagZ, + ["Flag V"] = cpu.FlagV, + ["Flag C"] = cpu.FlagC }; } @@ -36,22 +38,49 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex default: throw new InvalidOperationException(); case "A": - //cpu.A = (byte)value; + cpu.Regs[MC6809.A] = (byte)value; + break; + case "B": + cpu.Regs[MC6809.B] = (byte)value; break; case "X": - //cpu.X = (byte)value; + cpu.Regs[MC6809.X] = (byte)value; break; case "Y": - //cpu.Y = (byte)value; + cpu.Regs[MC6809.Y] = (ushort)value; break; - case "S": - //cpu.S = (byte)value; + case "US": + cpu.Regs[MC6809.US] = (ushort)value; + break; + case "SP": + cpu.Regs[MC6809.SP] = (ushort)value; break; case "PC": - //cpu.PC = (ushort)value; + cpu.Regs[MC6809.PC] = (ushort)value; + break; + case "Flag E": + cpu.FlagE = value > 0; + break; + case "Flag F": + cpu.FlagF = value > 0; + break; + case "Flag H": + cpu.FlagH = value > 0; break; case "Flag I": - //cpu.FlagI = value > 0; + cpu.FlagI = value > 0; + break; + case "Flag N": + cpu.FlagN = value > 0; + break; + case "Flag Z": + cpu.FlagZ = value > 0; + break; + case "Flag V": + cpu.FlagV = value > 0; + break; + case "Flag C": + cpu.FlagC = value > 0; break; } }