Vectrex: code cleanup

This commit is contained in:
alyosha-tas 2019-07-06 16:44:46 -04:00
parent 432abb27f6
commit 475702c1e8
9 changed files with 54 additions and 109 deletions

View File

@ -29,56 +29,53 @@ namespace BizHawk.Emulation.Common.Components.MC6809
public const ushort AND8 = 18;
public const ushort XOR8 = 19;
public const ushort OR8 = 20;
public const ushort CP8 = 21;
public const ushort ASL = 22;
public const ushort ASR = 23;
public const ushort LSR = 24;
public const ushort BIT = 25;
public const ushort CWAI = 26;
public const ushort SYNC = 27;
public const ushort INT_GET = 28;
public const ushort HALT_CHK = 29;
public const ushort RD_INC = 30;
public const ushort SET_ADDR = 31;
public const ushort NEG = 32;
public const ushort TST = 33;
public const ushort CLR = 34;
public const ushort OP_PG_2 = 35;
public const ushort OP_PG_3 = 36;
public const ushort SEX = 37;
public const ushort RD_INC_OP = 38;
public const ushort ASL = 21;
public const ushort ASR = 22;
public const ushort LSR = 23;
public const ushort BIT = 24;
public const ushort CWAI = 25;
public const ushort SYNC = 26;
public const ushort RD_INC = 27;
public const ushort RD_INC_OP = 28;
public const ushort WR_DEC_LO = 29;
public const ushort WR_DEC_HI = 30;
public const ushort WR_HI = 31;
public const ushort SET_ADDR = 32;
public const ushort NEG = 33;
public const ushort TST = 34;
public const ushort CLR = 35;
public const ushort OP_PG_2 = 36;
public const ushort OP_PG_3 = 37;
public const ushort SEX = 38;
public const ushort EXG = 39;
public const ushort TFR = 40;
public const ushort WR_DEC_LO = 41;
public const ushort WR_DEC_HI = 42;
public const ushort WR_HI = 43;
public const ushort ADD8BR = 44;
public const ushort ABX = 45;
public const ushort MUL = 46;
public const ushort JPE = 47;
public const ushort IDX_DCDE = 48;
public const ushort IDX_OP_BLD = 49;
public const ushort EA_8 = 50;
public const ushort EA_16 = 51;
public const ushort PSH_n = 52;
public const ushort PUL_n = 53;
public const ushort WR_DEC_LO_OP = 54;
public const ushort WR_DEC_HI_OP = 55;
public const ushort SET_ADDR_PUL = 56;
public const ushort SET_F_I = 57;
public const ushort SET_I = 58;
public const ushort SET_E = 59;
public const ushort ANDCC = 60;
public const ushort CMP8 = 61;
public const ushort SUB16 = 62;
public const ushort ADD16 = 63;
public const ushort CMP16 = 64;
public const ushort CMP16D = 65;
public const ushort WR_HI_INC = 66;
public const ushort LD_8 = 67;
public const ushort LD_16 = 68;
public const ushort LEA = 69;
public const ushort CLR_E = 70;
public const ushort ADD8BR = 41;
public const ushort ABX = 42;
public const ushort MUL = 43;
public const ushort JPE = 44;
public const ushort IDX_DCDE = 45;
public const ushort IDX_OP_BLD = 46;
public const ushort EA_8 = 47;
public const ushort EA_16 = 48;
public const ushort PSH_n = 49;
public const ushort PUL_n = 50;
public const ushort WR_DEC_LO_OP = 51;
public const ushort WR_DEC_HI_OP = 52;
public const ushort WR_HI_INC = 53;
public const ushort SET_ADDR_PUL = 54;
public const ushort SET_F_I = 55;
public const ushort SET_I = 56;
public const ushort SET_E = 57;
public const ushort ANDCC = 58;
public const ushort CMP8 = 59;
public const ushort SUB16 = 60;
public const ushort ADD16 = 61;
public const ushort CMP16 = 62;
public const ushort CMP16D = 63;
public const ushort LD_8 = 64;
public const ushort LD_16 = 65;
public const ushort LEA = 66;
public const ushort CLR_E = 67;
public MC6809()
{
@ -439,9 +436,6 @@ namespace BizHawk.Emulation.Common.Components.MC6809
case OR8:
OR8_Func(cur_instr[instr_pntr++], cur_instr[instr_pntr++]);
break;
case CP8:
CP8_Func(cur_instr[instr_pntr++], cur_instr[instr_pntr++]);
break;
case ASL:
ASL_Func(cur_instr[instr_pntr++]);
break;
@ -507,12 +501,6 @@ namespace BizHawk.Emulation.Common.Components.MC6809
IRQS = 1;
instr_pntr = irq_pntr = 0;
PopulateCURINSTR(SYNC);
break;
case INT_GET:
break;
case HALT_CHK:
break;
}

View File

@ -311,23 +311,6 @@ namespace BizHawk.Emulation.Common.Components.MC6809
FlagN = Regs[dest] > 127;
}
public void CP8_Func(ushort dest, ushort src)
{
int Reg16_d = Regs[dest];
Reg16_d -= Regs[src];
FlagC = Reg16_d.Bit(8);
FlagZ = (Reg16_d & 0xFF) == 0;
// redo for half carry flag
Reg16_d = Regs[dest] & 0xF;
Reg16_d -= (Regs[src] & 0xF);
FlagH = Reg16_d.Bit(4);
FlagN = true;
}
public void ROR_Func(ushort src)
{
ushort c = (ushort)(FlagC ? 0x80 : 0);

View File

@ -1,7 +1,6 @@
using System;
using BizHawk.Common;
using BizHawk.Common.BufferExtensions;
using BizHawk.Emulation.Common;
using BizHawk.Common.NumberExtensions;

View File

@ -1,7 +1,6 @@
using System;
using BizHawk.Emulation.Common;
using BizHawk.Common.NumberExtensions;
using BizHawk.Common;
namespace BizHawk.Emulation.Cores.Consoles.Vectrex
{

View File

@ -1,9 +1,7 @@
using System;
using BizHawk.Common.BufferExtensions;
using BizHawk.Emulation.Common;
/*
0x0000 - 0x7FFF ROM
0x8000 - 0xC7FF Unmapped

View File

@ -3,7 +3,6 @@ using System.IO;
using System.Collections.Generic;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Components.M6502;
namespace BizHawk.Emulation.Cores.Consoles.Vectrex
{
@ -16,24 +15,10 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
public void NewCDL(ICodeDataLog cdl)
{
cdl["RAM"] = new byte[MemoryDomains["RAM"].Size];
cdl["RAM"] = new byte[MemoryDomains["Main RAM"].Size];
cdl["ROM"] = new byte[MemoryDomains["ROM"].Size];
if (MemoryDomains.Has("Save RAM"))
{
cdl["Save RAM"] = new byte[MemoryDomains["Save RAM"].Size];
}
if (MemoryDomains.Has("Battery RAM"))
{
cdl["Battery RAM"] = new byte[MemoryDomains["Battery RAM"].Size];
}
if (MemoryDomains.Has("Battery RAM"))
{
cdl["Battery RAM"] = new byte[MemoryDomains["Battery RAM"].Size];
}
cdl.SubType = "VIC20";
cdl.SubType = "VEC";
cdl.SubVer = 0;
}
@ -46,9 +31,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
private enum CDLog_AddrType
{
None,
ROM,
MainRAM,
SaveRAM,
RAM,
ROM,
}
[Flags]
@ -77,8 +61,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
switch (results.Type)
{
case CDLog_AddrType.None: break;
case CDLog_AddrType.MainRAM: CDL["Main RAM"][results.Address] |= (byte)flags; break;
case CDLog_AddrType.SaveRAM: CDL["Save RAM"][results.Address] |= (byte)flags; break;
case CDLog_AddrType.RAM: CDL["RAM"][results.Address] |= (byte)flags; break;
case CDLog_AddrType.ROM: CDL["ROM"][results.Address] |= (byte)flags; break;
}
}
}

View File

@ -1,8 +1,5 @@
using BizHawk.Common.NumberExtensions;
using System;
using BizHawk.Emulation.Common;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace BizHawk.Emulation.Cores.Consoles.Vectrex
{

View File

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using BizHawk.Emulation.Common;

View File

@ -4,8 +4,6 @@ using BizHawk.Common.BufferExtensions;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Common.Components.MC6809;
using System.Runtime.InteropServices;
namespace BizHawk.Emulation.Cores.Consoles.Vectrex
{
[Core(