Merge branch 'master' into c64-refactor
This commit is contained in:
commit
8698aa41be
|
@ -133,7 +133,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
if (ToWindowRadio.Checked)
|
if (ToWindowRadio.Checked)
|
||||||
{
|
{
|
||||||
TraceView.VirtualListSize = _instructions.Count;
|
// setting to zero first fixes an exception when scrolling the view
|
||||||
|
// how or why I don't know
|
||||||
|
// it's hidden behind an internal class ListViewNativeItemCollection
|
||||||
|
TraceView.VirtualListSize = 0;
|
||||||
|
TraceView.VirtualListSize = _instructions.Count;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -148,7 +152,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
//connect tracer to sink for next frame
|
//connect tracer to sink for next frame
|
||||||
if (ToWindowRadio.Checked)
|
if (ToWindowRadio.Checked)
|
||||||
{
|
{
|
||||||
//update listview with most recentr results
|
//update listview with most recent results
|
||||||
TraceView.BlazingFast = !GlobalWin.MainForm.EmulatorPaused;
|
TraceView.BlazingFast = !GlobalWin.MainForm.EmulatorPaused;
|
||||||
|
|
||||||
Tracer.Sink = new CallbackSink()
|
Tracer.Sink = new CallbackSink()
|
||||||
|
|
|
@ -68,7 +68,7 @@ namespace BizHawk.Emulation.Common.Components.MC6809
|
||||||
"RTS", // 39
|
"RTS", // 39
|
||||||
"ABX", // 3a
|
"ABX", // 3a
|
||||||
"RTI", // 3b
|
"RTI", // 3b
|
||||||
"CWAI", // 3c
|
"CWAI i8", // 3c
|
||||||
"MUL", // 3d
|
"MUL", // 3d
|
||||||
"???", // 3e
|
"???", // 3e
|
||||||
"SWI1", // 3f
|
"SWI1", // 3f
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace BizHawk.Emulation.Common.Components.MC6809
|
||||||
{
|
{
|
||||||
Regs[ADDR] = 0xFFF8;
|
Regs[ADDR] = 0xFFF8;
|
||||||
PopulateCURINSTR(IDLE,
|
PopulateCURINSTR(IDLE,
|
||||||
IDLE,
|
SET_E,
|
||||||
DEC16, SP,
|
DEC16, SP,
|
||||||
WR_DEC_LO, SP, PC,
|
WR_DEC_LO, SP, PC,
|
||||||
WR_DEC_HI, SP, PC,
|
WR_DEC_HI, SP, PC,
|
||||||
|
@ -22,7 +22,7 @@ namespace BizHawk.Emulation.Common.Components.MC6809
|
||||||
WR_DEC_LO, SP, B,
|
WR_DEC_LO, SP, B,
|
||||||
WR_DEC_LO, SP, A,
|
WR_DEC_LO, SP, A,
|
||||||
WR, SP, CC,
|
WR, SP, CC,
|
||||||
SET_F_I,
|
SET_I,
|
||||||
RD_INC, ALU, ADDR,
|
RD_INC, ALU, ADDR,
|
||||||
RD_INC, ALU2, ADDR,
|
RD_INC, ALU2, ADDR,
|
||||||
SET_ADDR, PC, ALU, ALU2);
|
SET_ADDR, PC, ALU, ALU2);
|
||||||
|
@ -34,7 +34,7 @@ namespace BizHawk.Emulation.Common.Components.MC6809
|
||||||
{
|
{
|
||||||
Regs[ADDR] = 0xFFF6;
|
Regs[ADDR] = 0xFFF6;
|
||||||
PopulateCURINSTR(IDLE,
|
PopulateCURINSTR(IDLE,
|
||||||
IDLE,
|
CLR_E,
|
||||||
DEC16, SP,
|
DEC16, SP,
|
||||||
WR_DEC_LO, SP, PC,
|
WR_DEC_LO, SP, PC,
|
||||||
WR_DEC_HI, SP, PC,
|
WR_DEC_HI, SP, PC,
|
||||||
|
@ -51,7 +51,7 @@ namespace BizHawk.Emulation.Common.Components.MC6809
|
||||||
{
|
{
|
||||||
Regs[ADDR] = 0xFFFC;
|
Regs[ADDR] = 0xFFFC;
|
||||||
PopulateCURINSTR(IDLE,
|
PopulateCURINSTR(IDLE,
|
||||||
IDLE,
|
SET_E,
|
||||||
DEC16, SP,
|
DEC16, SP,
|
||||||
WR_DEC_LO, SP, PC,
|
WR_DEC_LO, SP, PC,
|
||||||
WR_DEC_HI, SP, PC,
|
WR_DEC_HI, SP, PC,
|
||||||
|
|
|
@ -66,17 +66,19 @@ namespace BizHawk.Emulation.Common.Components.MC6809
|
||||||
public const ushort WR_DEC_HI_OP = 55;
|
public const ushort WR_DEC_HI_OP = 55;
|
||||||
public const ushort SET_ADDR_PUL = 56;
|
public const ushort SET_ADDR_PUL = 56;
|
||||||
public const ushort SET_F_I = 57;
|
public const ushort SET_F_I = 57;
|
||||||
public const ushort SET_E = 58;
|
public const ushort SET_I = 58;
|
||||||
public const ushort ANDCC = 59;
|
public const ushort SET_E = 59;
|
||||||
public const ushort CMP8 = 60;
|
public const ushort ANDCC = 60;
|
||||||
public const ushort SUB16 = 61;
|
public const ushort CMP8 = 61;
|
||||||
public const ushort ADD16 = 62;
|
public const ushort SUB16 = 62;
|
||||||
public const ushort CMP16 = 63;
|
public const ushort ADD16 = 63;
|
||||||
public const ushort CMP16D = 64;
|
public const ushort CMP16 = 64;
|
||||||
public const ushort WR_HI_INC = 65;
|
public const ushort CMP16D = 65;
|
||||||
public const ushort LD_8 = 66;
|
public const ushort WR_HI_INC = 66;
|
||||||
public const ushort LD_16 = 67;
|
public const ushort LD_8 = 67;
|
||||||
public const ushort LEA = 68;
|
public const ushort LD_16 = 68;
|
||||||
|
public const ushort LEA = 69;
|
||||||
|
public const ushort CLR_E = 70;
|
||||||
|
|
||||||
public MC6809()
|
public MC6809()
|
||||||
{
|
{
|
||||||
|
@ -231,7 +233,7 @@ namespace BizHawk.Emulation.Common.Components.MC6809
|
||||||
Regs[reg_d_ad] = (ushort)((Regs[reg_h_ad] << 8) | Regs[reg_l_ad]);
|
Regs[reg_d_ad] = (ushort)((Regs[reg_h_ad] << 8) | Regs[reg_l_ad]);
|
||||||
break;
|
break;
|
||||||
case JPE:
|
case JPE:
|
||||||
if (!FlagE) { instr_pntr = 45; };
|
if (!FlagE) { instr_pntr = 44; irq_pntr = 10; };
|
||||||
break;
|
break;
|
||||||
case IDX_DCDE:
|
case IDX_DCDE:
|
||||||
Index_decode();
|
Index_decode();
|
||||||
|
@ -353,9 +355,15 @@ namespace BizHawk.Emulation.Common.Components.MC6809
|
||||||
case SET_F_I:
|
case SET_F_I:
|
||||||
FlagI = true; FlagF = true;
|
FlagI = true; FlagF = true;
|
||||||
break;
|
break;
|
||||||
|
case SET_I:
|
||||||
|
FlagI = true;
|
||||||
|
break;
|
||||||
case SET_E:
|
case SET_E:
|
||||||
FlagE = true;
|
FlagE = true;
|
||||||
break;
|
break;
|
||||||
|
case CLR_E:
|
||||||
|
FlagE = false;
|
||||||
|
break;
|
||||||
case ANDCC:
|
case ANDCC:
|
||||||
Regs[CC] &= Regs[instr_pntr++];
|
Regs[CC] &= Regs[instr_pntr++];
|
||||||
break;
|
break;
|
||||||
|
@ -449,6 +457,8 @@ namespace BizHawk.Emulation.Common.Components.MC6809
|
||||||
case CWAI:
|
case CWAI:
|
||||||
if (NMIPending)
|
if (NMIPending)
|
||||||
{
|
{
|
||||||
|
NMIPending = false;
|
||||||
|
|
||||||
Regs[ADDR] = 0xFFFC;
|
Regs[ADDR] = 0xFFFC;
|
||||||
PopulateCURINSTR(RD_INC, ALU, ADDR,
|
PopulateCURINSTR(RD_INC, ALU, ADDR,
|
||||||
RD_INC, ALU2, ADDR,
|
RD_INC, ALU2, ADDR,
|
||||||
|
@ -460,6 +470,8 @@ namespace BizHawk.Emulation.Common.Components.MC6809
|
||||||
}
|
}
|
||||||
else if (FIRQPending && !FlagF)
|
else if (FIRQPending && !FlagF)
|
||||||
{
|
{
|
||||||
|
FIRQPending = false;
|
||||||
|
|
||||||
Regs[ADDR] = 0xFFF6;
|
Regs[ADDR] = 0xFFF6;
|
||||||
PopulateCURINSTR(RD_INC, ALU, ADDR,
|
PopulateCURINSTR(RD_INC, ALU, ADDR,
|
||||||
RD_INC, ALU2, ADDR,
|
RD_INC, ALU2, ADDR,
|
||||||
|
@ -471,6 +483,8 @@ namespace BizHawk.Emulation.Common.Components.MC6809
|
||||||
}
|
}
|
||||||
else if (IRQPending && !FlagI)
|
else if (IRQPending && !FlagI)
|
||||||
{
|
{
|
||||||
|
IRQPending = false;
|
||||||
|
|
||||||
Regs[ADDR] = 0xFFF8;
|
Regs[ADDR] = 0xFFF8;
|
||||||
PopulateCURINSTR(RD_INC, ALU, ADDR,
|
PopulateCURINSTR(RD_INC, ALU, ADDR,
|
||||||
RD_INC, ALU2, ADDR,
|
RD_INC, ALU2, ADDR,
|
||||||
|
@ -542,7 +556,7 @@ namespace BizHawk.Emulation.Common.Components.MC6809
|
||||||
PopulateCURINSTR(IDLE);
|
PopulateCURINSTR(IDLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// then regular IRQ
|
// then regular IRQ
|
||||||
else if (IRQPending && !FlagI)
|
else if (IRQPending && !FlagI)
|
||||||
{
|
{
|
||||||
if (!FlagI)
|
if (!FlagI)
|
||||||
|
@ -567,7 +581,7 @@ namespace BizHawk.Emulation.Common.Components.MC6809
|
||||||
instr_pntr = irq_pntr = 0;
|
instr_pntr = irq_pntr = 0;
|
||||||
PopulateCURINSTR(IDLE);
|
PopulateCURINSTR(IDLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// otherwise start the next instruction
|
// otherwise start the next instruction
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -472,8 +472,7 @@ namespace BizHawk.Emulation.Common.Components.MC6809
|
||||||
RD_INC, ALU, SP,
|
RD_INC, ALU, SP,
|
||||||
RD_INC_OP, ALU2, SP, SET_ADDR, US, ALU, ALU2,
|
RD_INC_OP, ALU2, SP, SET_ADDR, US, ALU, ALU2,
|
||||||
RD_INC, ALU, SP,
|
RD_INC, ALU, SP,
|
||||||
RD_INC_OP, ALU2, SP,
|
RD_INC_OP, ALU2, SP, SET_ADDR, PC, ALU, ALU2);
|
||||||
SET_ADDR, PC, ALU, ALU2);
|
|
||||||
|
|
||||||
IRQS = 14;
|
IRQS = 14;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,6 +82,8 @@ namespace BizHawk.Emulation.Common.Components.MC6809
|
||||||
{
|
{
|
||||||
Regs[i] = 0;
|
Regs[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FlagI = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -59,7 +59,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
||||||
ret = (byte)((portB_ret & 0x7F) | (PB7 ? 0x80 : 0x0));
|
ret = (byte)((portB_ret & 0x7F) | (PB7 ? 0x80 : 0x0));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dir_ctrl.Bit(5)) { ret |= (byte)(compare ? 0x0 : 0x20); }
|
if (!dir_ctrl.Bit(5)) { ret |= (byte)(!compare ? 0x0 : 0x20); }
|
||||||
|
|
||||||
int_fl &= 0xE7;
|
int_fl &= 0xE7;
|
||||||
update_int_fl();
|
update_int_fl();
|
||||||
|
@ -181,8 +181,16 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
||||||
{
|
{
|
||||||
if (sel0)
|
if (sel0)
|
||||||
{
|
{
|
||||||
if (sel1) {/* sound samples direct to output */ audio.pcm_sample = (short)(portA_ret << 6); }
|
if (sel1)
|
||||||
else { ppu.vec_scale = portA_ret; if (portA_ret != 0) { Console.WriteLine("scale: " + portA_ret); } }
|
{
|
||||||
|
/* sound samples direct to output */
|
||||||
|
audio.pcm_sample = (short)(portA_ret << 6);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ppu.vec_scale = portA_ret;
|
||||||
|
if (portA_ret != 0) { Console.WriteLine("scale: " + portA_ret); }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -195,7 +203,37 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
||||||
ppu.bright = (byte)(portA_ret & 0x3F);
|
ppu.bright = (byte)(portA_ret & 0x3F);
|
||||||
ppu.bright_int_3 = (uint)(0xFF000000 | (ppu.bright << 16) | (ppu.bright << 8) | ppu.bright);
|
ppu.bright_int_3 = (uint)(0xFF000000 | (ppu.bright << 16) | (ppu.bright << 8) | ppu.bright);
|
||||||
}
|
}
|
||||||
else { ppu.y_vel = (byte)(portA_ret ^ 0x80); }
|
else
|
||||||
|
{
|
||||||
|
ppu.y_vel = (byte)(portA_ret ^ 0x80);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sel0)
|
||||||
|
{
|
||||||
|
if (sel1)
|
||||||
|
{
|
||||||
|
if (portA_ret >= joy2_UD) { compare = true; }
|
||||||
|
else { compare = false; }
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (portA_ret >= joy1_UD) { compare = true; }
|
||||||
|
else { compare = false; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (sel1)
|
||||||
|
{
|
||||||
|
if (portA_ret >= joy2_LR) { compare = true; }
|
||||||
|
else { compare = false; }
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (portA_ret >= joy1_LR) { compare = true; }
|
||||||
|
else { compare = false; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,8 +258,16 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
||||||
{
|
{
|
||||||
if (sel0)
|
if (sel0)
|
||||||
{
|
{
|
||||||
if (sel1) {/* sound samples direct to output */ audio.pcm_sample = (short)(portA_ret << 6); }
|
if (sel1)
|
||||||
else { ppu.vec_scale = portA_ret; if (portA_ret != 0) { Console.WriteLine("scale: " + portA_ret); } }
|
{
|
||||||
|
/* sound samples direct to output */
|
||||||
|
audio.pcm_sample = (short)(portA_ret << 6);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ppu.vec_scale = portA_ret;
|
||||||
|
if (portA_ret != 0) { Console.WriteLine("scale: " + portA_ret); }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -234,7 +280,37 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
||||||
ppu.bright = (byte)(portA_ret & 0x3F);
|
ppu.bright = (byte)(portA_ret & 0x3F);
|
||||||
ppu.bright_int_3 = (uint)(0xFF000000 | (ppu.bright << 16) | (ppu.bright << 8) | ppu.bright);
|
ppu.bright_int_3 = (uint)(0xFF000000 | (ppu.bright << 16) | (ppu.bright << 8) | ppu.bright);
|
||||||
}
|
}
|
||||||
else { ppu.y_vel = (byte)(portA_ret ^ 0x80); }
|
else
|
||||||
|
{
|
||||||
|
ppu.y_vel = (byte)(portA_ret ^ 0x80);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sel0)
|
||||||
|
{
|
||||||
|
if (sel1)
|
||||||
|
{
|
||||||
|
if (portA_ret >= joy2_UD) { compare = true; }
|
||||||
|
else { compare = false; }
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (portA_ret >= joy1_UD) { compare = true; }
|
||||||
|
else { compare = false; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (sel1)
|
||||||
|
{
|
||||||
|
if (portA_ret >= joy2_LR) { compare = true; }
|
||||||
|
else { compare = false; }
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (portA_ret >= joy1_LR) { compare = true; }
|
||||||
|
else { compare = false; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,6 +417,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
||||||
{
|
{
|
||||||
int_en &= (byte)((~value) & 0x7F);
|
int_en &= (byte)((~value) & 0x7F);
|
||||||
}
|
}
|
||||||
|
|
||||||
update_int_fl();
|
update_int_fl();
|
||||||
break;
|
break;
|
||||||
case 0xF:
|
case 0xF:
|
||||||
|
@ -392,7 +469,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
||||||
|
|
||||||
int_fl |= 0x40;
|
int_fl |= 0x40;
|
||||||
update_int_fl();
|
update_int_fl();
|
||||||
//if (int_en.Bit(6)) { cpu.IRQPending = true; }
|
if (int_en.Bit(6)) { cpu.IRQPending = true; }
|
||||||
|
|
||||||
if (t1_ctrl.Bit(7)) { PB7 = !PB7; ppu.ramp_sig = !PB7; }
|
if (t1_ctrl.Bit(7)) { PB7 = !PB7; ppu.ramp_sig = !PB7; }
|
||||||
}
|
}
|
||||||
|
@ -404,7 +481,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
||||||
{
|
{
|
||||||
int_fl |= 0x40;
|
int_fl |= 0x40;
|
||||||
update_int_fl();
|
update_int_fl();
|
||||||
//if (int_en.Bit(6)) { cpu.IRQPending = true; }
|
if (int_en.Bit(6)) { cpu.IRQPending = true; }
|
||||||
if (t1_ctrl.Bit(7)) { PB7 = true; ppu.ramp_sig = false; }
|
if (t1_ctrl.Bit(7)) { PB7 = true; ppu.ramp_sig = false; }
|
||||||
|
|
||||||
t1_shot_go = false;
|
t1_shot_go = false;
|
||||||
|
@ -420,10 +497,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
||||||
if (t2_ctrl.Bit(5))
|
if (t2_ctrl.Bit(5))
|
||||||
{
|
{
|
||||||
t2_counter = (t2_high << 8) | t2_low;
|
t2_counter = (t2_high << 8) | t2_low;
|
||||||
|
|
||||||
int_fl |= 0x20;
|
int_fl |= 0x20;
|
||||||
update_int_fl();
|
update_int_fl();
|
||||||
//if (int_en.Bit(6)) { cpu.IRQPending = true; }
|
if (int_en.Bit(5)) { cpu.IRQPending = true; }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -433,7 +509,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
||||||
{
|
{
|
||||||
int_fl |= 0x20;
|
int_fl |= 0x20;
|
||||||
update_int_fl();
|
update_int_fl();
|
||||||
//if (int_en.Bit(6)) { cpu.IRQPending = true; }
|
if (int_en.Bit(5)) { cpu.IRQPending = true; }
|
||||||
|
|
||||||
t2_shot_go = false;
|
t2_shot_go = false;
|
||||||
}
|
}
|
||||||
|
@ -488,6 +564,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
||||||
test |= int_en.Bit(i) & int_fl.Bit(i);
|
test |= int_en.Bit(i) & int_fl.Bit(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!test) { cpu.IRQPending = false; }
|
||||||
int_fl |= (byte)(test ? 0x80 : 0);
|
int_fl |= (byte)(test ? 0x80 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
||||||
{
|
{
|
||||||
public VectrexHawk Core { get; set; }
|
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 byte vec_scale, x_vel, y_vel, bright;
|
||||||
public double x_pos, y_pos;
|
public double x_pos, y_pos;
|
||||||
|
|
||||||
|
@ -32,13 +32,15 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
||||||
{
|
{
|
||||||
skip--;
|
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)
|
else if (zero_sig)
|
||||||
{
|
{
|
||||||
|
@ -46,7 +48,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
||||||
y_pos = 192 + 2;
|
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);
|
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(zero_sig), ref zero_sig);
|
||||||
ser.Sync(nameof(blank_sig), ref blank_sig);
|
ser.Sync(nameof(blank_sig), ref blank_sig);
|
||||||
ser.Sync(nameof(ramp_sig), ref ramp_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(vec_scale), ref vec_scale);
|
||||||
ser.Sync(nameof(x_vel), ref x_vel);
|
ser.Sync(nameof(x_vel), ref x_vel);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using BizHawk.Emulation.Common;
|
using BizHawk.Emulation.Common;
|
||||||
|
using BizHawk.Emulation.Common.Components.MC6809;
|
||||||
|
|
||||||
namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
||||||
{
|
{
|
||||||
|
@ -11,21 +12,22 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
||||||
{
|
{
|
||||||
return new Dictionary<string, RegisterValue>
|
return new Dictionary<string, RegisterValue>
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
["A"] = cpu.A,
|
["A"] = cpu.Regs[MC6809.A],
|
||||||
["X"] = cpu.X,
|
["B"] = cpu.Regs[MC6809.B],
|
||||||
["Y"] = cpu.Y,
|
["X"] = cpu.Regs[MC6809.X],
|
||||||
["S"] = cpu.S,
|
["Y"] = cpu.Regs[MC6809.Y],
|
||||||
["PC"] = cpu.PC,
|
["US"] = cpu.Regs[MC6809.US],
|
||||||
["Flag C"] = cpu.FlagC,
|
["SP"] = cpu.Regs[MC6809.SP],
|
||||||
["Flag Z"] = cpu.FlagZ,
|
["PC"] = cpu.Regs[MC6809.PC],
|
||||||
|
["Flag E"] = cpu.FlagE,
|
||||||
|
["Flag F"] = cpu.FlagF,
|
||||||
|
["Flag H"] = cpu.FlagH,
|
||||||
["Flag I"] = cpu.FlagI,
|
["Flag I"] = cpu.FlagI,
|
||||||
["Flag D"] = cpu.FlagD,
|
|
||||||
["Flag B"] = cpu.FlagB,
|
|
||||||
["Flag V"] = cpu.FlagV,
|
|
||||||
["Flag N"] = cpu.FlagN,
|
["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:
|
default:
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
case "A":
|
case "A":
|
||||||
//cpu.A = (byte)value;
|
cpu.Regs[MC6809.A] = (byte)value;
|
||||||
|
break;
|
||||||
|
case "B":
|
||||||
|
cpu.Regs[MC6809.B] = (byte)value;
|
||||||
break;
|
break;
|
||||||
case "X":
|
case "X":
|
||||||
//cpu.X = (byte)value;
|
cpu.Regs[MC6809.X] = (byte)value;
|
||||||
break;
|
break;
|
||||||
case "Y":
|
case "Y":
|
||||||
//cpu.Y = (byte)value;
|
cpu.Regs[MC6809.Y] = (ushort)value;
|
||||||
break;
|
break;
|
||||||
case "S":
|
case "US":
|
||||||
//cpu.S = (byte)value;
|
cpu.Regs[MC6809.US] = (ushort)value;
|
||||||
|
break;
|
||||||
|
case "SP":
|
||||||
|
cpu.Regs[MC6809.SP] = (ushort)value;
|
||||||
break;
|
break;
|
||||||
case "PC":
|
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;
|
break;
|
||||||
case "Flag I":
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
||||||
|
|
||||||
public ControllerDefinition ControllerDefinition => _controllerDeck.Definition;
|
public ControllerDefinition ControllerDefinition => _controllerDeck.Definition;
|
||||||
|
|
||||||
|
byte joy1_LR, joy2_LR, joy1_UD, joy2_UD;
|
||||||
|
|
||||||
public bool FrameAdvance(IController controller, bool render, bool rendersound)
|
public bool FrameAdvance(IController controller, bool render, bool rendersound)
|
||||||
{
|
{
|
||||||
if (_tracer.Enabled)
|
if (_tracer.Enabled)
|
||||||
|
@ -37,7 +39,23 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
||||||
audio.Register[14] |= (byte)(_controllerDeck.ReadPort2(controller) << 4);
|
audio.Register[14] |= (byte)(_controllerDeck.ReadPort2(controller) << 4);
|
||||||
|
|
||||||
// joystick position is based on pot reading
|
// joystick position is based on pot reading
|
||||||
|
joy1_LR = (byte)(Math.Floor(controller.GetFloat("P1 Stick X")) + 128);
|
||||||
|
joy1_UD = (byte)(Math.Floor(controller.GetFloat("P1 Stick Y")) + 128);
|
||||||
|
joy2_LR = (byte)(Math.Floor(controller.GetFloat("P2 Stick X")) + 128);
|
||||||
|
joy2_UD = (byte)(Math.Floor(controller.GetFloat("P2 Stick Y")) + 128);
|
||||||
|
|
||||||
|
// override stick reading with digital input if supplied
|
||||||
|
// On vectrex there is no such thing as pressing left + right or up + down
|
||||||
|
// so convention will be up and right dominate
|
||||||
|
if (controller.IsPressed("P1 Down")) { joy1_UD = 0xFF; }
|
||||||
|
if (controller.IsPressed("P1 Up")) { joy1_UD = 0; }
|
||||||
|
if (controller.IsPressed("P1 Left")) { joy1_LR = 0xFF; }
|
||||||
|
if (controller.IsPressed("P1 Right")) { joy1_LR = 0; }
|
||||||
|
|
||||||
|
if (controller.IsPressed("P2 Down")) { joy2_UD = 0xFF; }
|
||||||
|
if (controller.IsPressed("P2 Up")) { joy2_UD = 0; }
|
||||||
|
if (controller.IsPressed("P2 Left")) { joy2_LR = 0xFF; }
|
||||||
|
if (controller.IsPressed("P2 Right")) { joy2_LR = 0; }
|
||||||
|
|
||||||
|
|
||||||
frame_end = false;
|
frame_end = false;
|
||||||
|
@ -55,8 +73,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
||||||
public void do_frame()
|
public void do_frame()
|
||||||
{
|
{
|
||||||
_vidbuffer = new int[VirtualWidth * VirtualHeight];
|
_vidbuffer = new int[VirtualWidth * VirtualHeight];
|
||||||
//PB7_undriven = true;
|
|
||||||
//for (int i = 0; i < 1000; i++)
|
//for (int i = 0; i < 100; i++)
|
||||||
while (!frame_end)
|
while (!frame_end)
|
||||||
{
|
{
|
||||||
internal_state_tick();
|
internal_state_tick();
|
||||||
|
|
|
@ -104,6 +104,12 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
||||||
ser.Sync(nameof(PB7_undriven), ref PB7_undriven);
|
ser.Sync(nameof(PB7_undriven), ref PB7_undriven);
|
||||||
ser.Sync(nameof(pot_val), ref pot_val);
|
ser.Sync(nameof(pot_val), ref pot_val);
|
||||||
|
|
||||||
|
ser.Sync(nameof(joy1_LR), ref joy1_LR);
|
||||||
|
ser.Sync(nameof(joy1_UD), ref joy1_UD);
|
||||||
|
ser.Sync(nameof(joy2_LR), ref joy2_LR);
|
||||||
|
ser.Sync(nameof(joy2_UD), ref joy2_UD);
|
||||||
|
|
||||||
|
|
||||||
// probably a better way to do this
|
// probably a better way to do this
|
||||||
if (cart_RAM != null)
|
if (cart_RAM != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
||||||
.Select(b => "P" + PortNum + " " + b)
|
.Select(b => "P" + PortNum + " " + b)
|
||||||
.ToList(),
|
.ToList(),
|
||||||
FloatControls = { "P" + PortNum + " Stick X", "P" + PortNum + " Stick Y" },
|
FloatControls = { "P" + PortNum + " Stick X", "P" + PortNum + " Stick Y" },
|
||||||
FloatRanges = { new[] { -127.0f, 0, 127.0f }, new[] { -127.0f, 0, 127.0f } }
|
FloatRanges = { new[] { 127.0f, 0, -128.0f }, new[] { -128.0f, 0, 127.0f } }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,6 +57,10 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
|
||||||
|
|
||||||
private static readonly string[] BaseDefinition =
|
private static readonly string[] BaseDefinition =
|
||||||
{
|
{
|
||||||
|
"Up",
|
||||||
|
"Down",
|
||||||
|
"Left",
|
||||||
|
"Right",
|
||||||
"Button 1",
|
"Button 1",
|
||||||
"Button 2",
|
"Button 2",
|
||||||
"Button 3",
|
"Button 3",
|
||||||
|
|
Loading…
Reference in New Issue