Vectrex: Add schema and do some miscellanous clean up

This commit is contained in:
alyosha-tas 2019-07-09 20:01:45 -04:00
parent f544c044bf
commit 84b0917f65
9 changed files with 255 additions and 72 deletions

View File

@ -1252,6 +1252,7 @@
<Compile Include="tools\VirtualPads\schema\AppleIISchema.cs" />
<Compile Include="tools\VirtualPads\schema\C64Schema.cs" />
<Compile Include="tools\VirtualPads\schema\ColecoSchema.cs" />
<Compile Include="tools\VirtualPads\schema\VECSchema.cs" />
<Compile Include="tools\VirtualPads\schema\GGLSchema.cs" />
<Compile Include="tools\VirtualPads\schema\DualGBSchema.cs" />
<Compile Include="tools\VirtualPads\schema\GBASchema.cs" />
@ -2283,4 +2284,4 @@
<PreBuildEvent />
</PropertyGroup>
<Import Project="$(SolutionDir)Build\Common.targets" />
</Project>
</Project>

View File

@ -5,6 +5,7 @@ using System.Linq;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Nintendo.NES;
using BizHawk.Emulation.Cores.Nintendo.SubNESHawk;
using BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES;
namespace BizHawk.Client.EmuHawk
@ -17,6 +18,7 @@ namespace BizHawk.Client.EmuHawk
if (core is NES)
{
var nes = (NES)core;
var ss = nes.GetSyncSettings();
var isFds = nes.IsFDS;
@ -122,6 +124,117 @@ namespace BizHawk.Client.EmuHawk
yield return NesConsoleButtons();
}
}
else if (core is SubNESHawk)
{
{
var nes = (SubNESHawk)core;
var ss = nes.GetSyncSettings();
var isFds = nes.IsFDS;
if (ss.Controls.Famicom)
{
yield return StandardController(1);
yield return Famicom2ndController();
switch (ss.Controls.FamicomExpPort)
{
default:
case "UnpluggedFam":
break;
case "Zapper":
yield return Zapper(3);
break;
case "ArkanoidFam":
yield return ArkanoidPaddle(3);
break;
case "Famicom4P":
yield return StandardController(3);
yield return StandardController(4);
break;
case "FamilyBasicKeyboard":
yield return FamicomFamilyKeyboard(3);
break;
case "OekaKids":
yield return OekaKidsTablet(3);
break;
}
}
else
{
var currentControlerNo = 1;
switch (ss.Controls.NesLeftPort)
{
default:
case "UnpluggedNES":
break;
case "ControllerNES":
yield return StandardController(1);
currentControlerNo++;
break;
case "Zapper":
yield return Zapper(1);
currentControlerNo++;
break;
case "ArkanoidNES":
yield return ArkanoidPaddle(1);
currentControlerNo++;
break;
case "FourScore":
yield return StandardController(1);
yield return StandardController(2);
currentControlerNo += 2;
break;
case "PowerPad":
yield return PowerPad(1);
currentControlerNo++;
break;
case "ControllerSNES":
throw new Exception("TODO");
}
switch (ss.Controls.NesRightPort)
{
default:
case "UnpluggedNES":
break;
case "ControllerNES":
yield return StandardController(currentControlerNo);
break;
case "Zapper":
yield return Zapper(currentControlerNo);
break;
case "ArkanoidNES":
yield return ArkanoidPaddle(currentControlerNo);
break;
case "FourScore":
yield return StandardController(currentControlerNo);
yield return StandardController(currentControlerNo + 1);
currentControlerNo += 2;
break;
case "PowerPad":
yield return PowerPad(currentControlerNo);
break;
case "ControllerSNES":
throw new Exception("TODO");
}
if (currentControlerNo == 0)
{
yield return null;
}
}
if (isFds)
{
yield return FdsConsoleButtons(core.ControllerDefinition.BoolButtons.Count(b => b.StartsWith("FDS Insert ")));
}
else
{
yield return NesConsoleButtons();
}
}
}
else
// Quicknes Can support none, one or two controllers.
{

View File

@ -0,0 +1,101 @@
using System.Collections.Generic;
using System.Drawing;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
[Schema("VEC")]
public class VECSchema : IVirtualPadSchema
{
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
{
yield return StandardController(1);
yield return StandardController(2);
}
private static PadSchema StandardController(int controller)
{
return new PadSchema
{
IsConsole = false,
DefaultSize = new Size(280, 380),
Buttons = new[]
{
new PadSchema.ButtonSchema
{
Name = $"P{controller} Up",
Icon = Properties.Resources.BlueUp,
Location = new Point(14, 12),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = $"P{controller} Down",
Icon = Properties.Resources.BlueDown,
Location = new Point(14, 56),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = $"P{controller} Left",
Icon = Properties.Resources.Back,
Location = new Point(2, 34),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = $"P{controller} Right",
Icon = Properties.Resources.Forward,
Location = new Point(24, 34),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = $"P{controller} Button 1",
DisplayName = "1",
Location = new Point(74, 34),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = $"P{controller} Button 2",
DisplayName = "2",
Location = new Point(98, 34),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = $"P{controller} Button 3",
DisplayName = "3",
Location = new Point(122, 34),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = $"P{controller} Button 4",
DisplayName = "4",
Location = new Point(146, 34),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = $"P{controller} Stick X",
Location = new Point(2, 85),
MinValue = 127,
MidValue = 0,
MaxValue = -128,
MinValueSec = -128,
MidValueSec = 0,
MaxValueSec = 127,
Type = PadSchema.PadInputType.AnalogStick,
SecondaryNames = new[]
{
$"P{controller} Stick Y",
}
}
}
};
}
}
}

View File

@ -304,15 +304,7 @@ namespace BizHawk.Emulation.Common.Components.MC6800
result = result.Replace("ix16", "X + " + "ea");
result = result.Replace("ea", string.Format("{0:N}h", d));
}
else if (result.Contains("r8"))
{
byte d = reader(addr++);
bytes.Add(d);
int offs = d;
if (offs >= 128)
offs -= 256;
result = result.Replace("r8", string.Format("{0:X4}h", (ushort)(addr + offs)));
}
StringBuilder ret = new StringBuilder();
ret.Append(string.Format("{0:X4}: ", origaddr));
foreach (var b in bytes)

View File

@ -38,41 +38,38 @@ namespace BizHawk.Emulation.Common.Components.MC6800
public const ushort RD_INC_OP = 27;
public const ushort WR_DEC_LO = 28;
public const ushort WR_DEC_HI = 29;
public const ushort WR_HI = 31;
public const ushort NEG = 32;
public const ushort TST = 33;
public const ushort CLR = 34;
public const ushort ADD8BR = 35;
public const ushort JPE = 36;
public const ushort WR_HI = 30;
public const ushort LD_8 = 31;
public const ushort LD_16 = 32;
public const ushort NEG = 33;
public const ushort TST = 34;
public const ushort CLR = 35;
public const ushort ADD8BR = 36;
public const ushort IDX_DCDE = 37;
public const ushort IDX_OP_BLD = 38;
public const ushort EA_8 = 39;
public const ushort EA_16 = 40;
public const ushort WR_HI_INC = 41;
public const ushort SET_I = 42;
public const ushort CMP8 = 43;
public const ushort CMP16 = 44;
public const ushort LD_8 = 45;
public const ushort LD_16 = 46;
public const ushort TAP = 47;
public const ushort TPA = 48;
public const ushort INX = 49;
public const ushort DEX = 50;
public const ushort CLV = 51;
public const ushort SEV = 52;
public const ushort CLC = 53;
public const ushort SEC = 54;
public const ushort CLI = 55;
public const ushort SEI = 56;
public const ushort SBA = 57;
public const ushort CBA = 58;
public const ushort TAB = 59;
public const ushort TBA = 60;
public const ushort ABA = 61;
public const ushort TSX = 62;
public const ushort INS = 63;
public const ushort DES = 64;
public const ushort TXS = 65;
public const ushort WR_HI_INC = 39;
public const ushort SET_I = 40;
public const ushort CMP8 = 41;
public const ushort CMP16 = 42;
public const ushort TAP = 43;
public const ushort TPA = 44;
public const ushort INX = 45;
public const ushort DEX = 46;
public const ushort CLV = 47;
public const ushort SEV = 48;
public const ushort CLC = 49;
public const ushort SEC = 50;
public const ushort CLI = 51;
public const ushort SEI = 52;
public const ushort SBA = 53;
public const ushort CBA = 54;
public const ushort TAB = 55;
public const ushort TBA = 56;
public const ushort ABA = 57;
public const ushort TSX = 58;
public const ushort INS = 59;
public const ushort DES = 60;
public const ushort TXS = 61;
public MC6800()
{
@ -216,19 +213,12 @@ namespace BizHawk.Emulation.Common.Components.MC6800
Regs[reg_d_ad] = (ushort)((Regs[reg_h_ad] << 8) | Regs[reg_l_ad]);
break;
case JPE:
if (!FlagE) { instr_pntr = 44; irq_pntr = 10; };
break;
case IDX_DCDE:
Index_decode();
break;
case IDX_OP_BLD:
Index_Op_Builder();
break;
case EA_8:
Regs[IDX_EA] = (ushort)(Regs[indexed_reg] + (((Regs[ALU2] & 0x80) == 0x80) ? (Regs[ALU2] | 0xFF00) : Regs[ALU2]));
Index_Op_Builder();
break;
case LD_8:
LD_8_Func(cur_instr[instr_pntr++], cur_instr[instr_pntr++]);
break;
@ -264,10 +254,6 @@ namespace BizHawk.Emulation.Common.Components.MC6800
case IDX_OP_BLD:
Index_Op_Builder();
break;
case EA_16:
Regs[IDX_EA] = (ushort)(Regs[indexed_reg] + Regs[ADDR]);
Index_Op_Builder();
break;
case SET_ADDR:
reg_d_ad = cur_instr[instr_pntr++];
reg_h_ad = cur_instr[instr_pntr++];
@ -527,14 +513,13 @@ namespace BizHawk.Emulation.Common.Components.MC6800
{
Disassembly = $"{(disassemble ? Disassemble(Regs[PC], ReadMemory, out notused) : "---")} ".PadRight(50),
RegisterInfo = string.Format(
"A:{0:X2} B:{1:X2} X:{2:X4} SP:{3:X4} CC:{4:X2} Cy:{5} {6}{7}{8}{9}{10}{11}{12}",
"A:{0:X2} B:{1:X2} X:{2:X4} SP:{3:X4} CC:{4:X2} Cy:{5} {6}{7}{8}{9}{10}{11}",
Regs[A],
Regs[B],
Regs[X],
Regs[SP],
Regs[CC],
TotalExecutedCycles,
FlagE ? "E" : "e",
FlagH ? "H" : "h",
FlagI ? "I" : "i",
FlagN ? "N" : "n",

View File

@ -255,7 +255,7 @@ namespace BizHawk.Emulation.Common.Components.MC6800
private void RTI()
{
PopulateCURINSTR(INC16, SP,
RD_INC_OP, CC, SP, JPE,
RD_INC, CC, SP,
RD_INC, B, SP,
RD_INC, A, SP,
RD_INC, ALU, SP,

View File

@ -55,12 +55,6 @@ namespace BizHawk.Emulation.Common.Components.MC6800
set { Regs[CC] = (byte)((Regs[CC] & ~0x20) | (value ? 0x20 : 0x00)); }
}
public bool FlagE
{
get { return (Regs[CC] & 0x80) != 0; }
set { Regs[CC] = (byte)((Regs[CC] & ~0x80) | (value ? 0x80 : 0x00)); }
}
private void ResetRegisters()
{
for (int i = 0; i < 14; i++)

View File

@ -1010,15 +1010,7 @@ namespace BizHawk.Emulation.Common.Components.MC6809
}
}
}
else if (result.Contains("r8"))
{
byte d = reader(addr++);
bytes.Add(d);
int offs = d;
if (offs >= 128)
offs -= 256;
result = result.Replace("r8", string.Format("{0:X4}h", (ushort)(addr + offs)));
}
StringBuilder ret = new StringBuilder();
ret.Append(string.Format("{0:X4}: ", origaddr));
foreach (var b in bytes)

View File

@ -69,6 +69,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.SubNESHawk
public int _frame = 0;
public bool IsFDS
{
get { return subnes.Board is FDS; }
}
private readonly ITraceable _tracer;
#region ISettable