Vectrex: another round of bug fixes

This commit is contained in:
alyosha-tas 2019-06-25 18:46:16 -04:00
parent 94db48b24f
commit 5188b7a2e7
5 changed files with 36 additions and 16 deletions

View File

@ -166,8 +166,8 @@ namespace BizHawk.Emulation.Common.Components.MC6809
"ADD A,DP+i8", // 9b
"CMP X,DP+i8", // 9c
"JSR DP+i8", // 9d
"LD X,ix16", // 9e
"ST X,ix16", // 9f
"LD X,DP+i8", // 9e
"ST X,DP+i8", // 9f
"SUB A,ix16", // a0
"CMP A,ix16", // a1
"SBC A,ix16", // a2

View File

@ -32,7 +32,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
public bool PB7, PB6;
public bool PB7_prev, PB6_prev;
public bool PB7_last_write;
public bool PB7_undriven;
// Port B controls
public bool sw, sel0, sel1, bc1, bdir, compare, shift_start;
@ -143,7 +143,6 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
if (aux_ctrl.Bit(7))
{
PB7_last_write = wrt_val.Bit(7);
wrt_val = (byte)((wrt_val & 0x7F) | (PB7 ? 0x80 : 0x0));
}
@ -156,7 +155,15 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
if (dir_ctrl.Bit(4)) { bdir = value.Bit(4); }
if (dir_ctrl.Bit(5)) { /*compare = value.Bit(5);*/ }
if (dir_ctrl.Bit(6)) { /* cart bank switch */ }
if (dir_ctrl.Bit(7)) { ppu.ramp_sig = !wrt_val.Bit(7); }
if (dir_ctrl.Bit(7))
{
ppu.ramp_sig = !wrt_val.Bit(7);
if (PB7_undriven && !wrt_val.Bit(7))
{
PB7_undriven = false;
ppu.skip = 14;
}
}
// writing to sound reg
if (bdir)
@ -179,9 +186,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
}
}
//ppu.x_vel = ~portA_ret;
ppu.x_vel = (byte)(portA_ret ^ 0x80);
//ppu.x_vel = portA_ret; if (ppu.x_vel >= 128) { ppu.x_vel -= 128; ppu.x_vel = -ppu.x_vel; }
int_fl &= 0xE7;
update_int_fl();
@ -212,9 +217,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
}
}
//ppu.x_vel = ~portA_ret;
ppu.x_vel = (byte)(portA_ret ^ 0x80);
//ppu.x_vel = portA_ret; if (ppu.x_vel >= 128) { ppu.x_vel -= 128; ppu.x_vel = -ppu.x_vel; }
int_fl &= 0xFC;
update_int_fl();
@ -233,7 +236,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
t1_counter = (t1_high << 8) | t1_low;
t1_shot_go = true;
if (aux_ctrl.Bit(7)) { PB7 = false; ppu.ramp_sig = true; }
if (aux_ctrl.Bit(7)) { PB7 = false; ppu.ramp_sig = true; ppu.skip = 0; }
t1_ctrl = aux_ctrl;
int_fl &= 0xBF;
@ -265,16 +268,21 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
int_fl &= 0xFB;
shift_reg = value;
shift_start = true;
if (ppu.skip == 1) { ppu.ramp_sig = true; ppu.skip = 0; }
shift_reg_wait = 2;
shift_count = 0;
update_int_fl();
break;
case 0xB:
if (aux_ctrl.Bit(7) && !value.Bit(7))
{
PB7_undriven = true;
}
aux_ctrl = value;
t1_ctrl = aux_ctrl;
//if (aux_ctrl.Bit(7)) { ppu.ramp_sig = !PB7; }
//else { ppu.ramp_sig = !PB7_last_write; }
break;
case 0xC:
prt_ctrl = value;

View File

@ -11,6 +11,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
public byte vec_scale, x_vel, y_vel, bright;
public double x_pos, y_pos;
public int skip;
public static uint br = 0xFFFFFFFF;
public void tick()
@ -20,9 +22,16 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
if (ramp_sig && !zero_sig)
{
x_pos = x_pos + (x_vel - 128.0) / 256.0 * (vec_scale + 2);
y_pos = y_pos - (y_vel - 128.0) / 256.0 * (vec_scale + 2);
if (skip == 0)
{
x_pos = x_pos + (x_vel - 128.0) / 256.0 * (vec_scale + 2);
y_pos = y_pos - (y_vel - 128.0) / 256.0 * (vec_scale + 2);
}
else
{
skip--;
}
if (x_pos > 255) { x_pos = 255; }
if (x_pos < 0) { x_pos = 0; }
if (y_pos > 383) { y_pos = 383; }
@ -61,6 +70,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
ser.Sync(nameof(x_pos), ref x_pos);
ser.Sync(nameof(y_pos), ref y_pos);
ser.Sync(nameof(skip), ref skip);
}
}
}

View File

@ -101,6 +101,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
ser.Sync(nameof(shift_count), ref shift_count);
ser.Sync(nameof(frame_end), ref frame_end);
ser.Sync(nameof(PB7_undriven), ref PB7_undriven);
// probably a better way to do this
if (cart_RAM != null)

View File

@ -102,7 +102,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
Setup_Mapper();
_frameHz = 60;
_frameHz = 50;
audio.Core = this;
ppu.Core = this;