Vectrexx: More bug fixes

This commit is contained in:
alyosha-tas 2019-06-29 12:27:17 -04:00
parent 290de71b71
commit 233825bbb7
5 changed files with 33 additions and 62 deletions

View File

@ -168,7 +168,7 @@ namespace BizHawk.Emulation.Common.Components.MC6809
FlagH = Reg16_d.Bit(4);
FlagV = (Regs[dest].Bit(7) != Regs[src].Bit(7)) && (Regs[dest].Bit(7) != ans.Bit(7));
FlagN = false;
FlagN = ans > 127;
Regs[dest] = ans;
}
@ -453,55 +453,6 @@ namespace BizHawk.Emulation.Common.Components.MC6809
FlagH = false;
}
// used for signed operations
public void ADDS_Func(ushort dest_l, ushort dest_h, ushort src_l, ushort src_h)
{
int Reg16_d = Regs[dest_l];
int Reg16_s = Regs[src_l];
Reg16_d += Reg16_s;
ushort temp = 0;
// since this is signed addition, calculate the high byte carry appropriately
if (Reg16_s.Bit(7))
{
if (((Reg16_d & 0xFF) >= Regs[dest_l]))
{
temp = 0xFF;
}
else
{
temp = 0;
}
}
else
{
temp = (ushort)(Reg16_d.Bit(8) ? 1 : 0);
}
ushort ans_l = (ushort)(Reg16_d & 0xFF);
// JR operations do not effect flags
if (dest_l != PC)
{
FlagC = Reg16_d.Bit(8);
// redo for half carry flag
Reg16_d = Regs[dest_l] & 0xF;
Reg16_d += Regs[src_l] & 0xF;
FlagH = Reg16_d.Bit(4);
FlagN = false;
FlagZ = false;
}
Regs[dest_l] = ans_l;
Regs[dest_h] += temp;
Regs[dest_h] &= 0xFF;
}
// D register implied
public void SUB16_Func(ushort src)
{

View File

@ -34,6 +34,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
public bool PB7_undriven;
public byte pot_val;
// Port B controls
public bool sw, sel0, sel1, bc1, bdir, compare, shift_start;
@ -55,7 +57,9 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
else
{
ret = (byte)((portB_ret & 0x7F) | (PB7 ? 0x80 : 0x0));
}
}
if (!dir_ctrl.Bit(5)) { ret |= (byte)(compare ? 0x0 : 0x20); }
int_fl &= 0xE7;
update_int_fl();
@ -157,12 +161,13 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
if (dir_ctrl.Bit(6)) { /* cart bank switch */ }
if (dir_ctrl.Bit(7))
{
//Console.WriteLine(PB7_undriven + " " + !wrt_val.Bit(7));
ppu.ramp_sig = !wrt_val.Bit(7);
if (PB7_undriven && !wrt_val.Bit(7))
{
PB7_undriven = false;
PB7_undriven = false;
ppu.skip = 14;
}
}
}
// writing to sound reg
@ -177,11 +182,11 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
if (sel0)
{
if (sel1) {/* sound line? */ }
else { ppu.vec_scale = portA_ret; }
else { ppu.vec_scale = portA_ret; if (portA_ret != 0) { Console.WriteLine("scale: " + portA_ret); } }
}
else
{
if (sel1) { ppu.bright = portA_ret; }
if (sel1) { ppu.bright = portA_ret; ppu.bright_int = (uint)(0xFF000000 | (ppu.bright << 16) | (ppu.bright << 8) | ppu.bright); }
else { ppu.y_vel = (byte)(portA_ret ^ 0x80); }
}
}
@ -208,11 +213,11 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
if (sel0)
{
if (sel1) {/* sound line? */ }
else { ppu.vec_scale = portA_ret; }
else { ppu.vec_scale = portA_ret; if (portA_ret != 0) { Console.WriteLine("scale: " + portA_ret); } }
}
else
{
if (sel1) { ppu.bright = portA_ret; }
if (sel1) { ppu.bright = portA_ret; ppu.bright_int = (uint)(0xFF000000 | (ppu.bright << 16) | (ppu.bright << 8) | ppu.bright); }
else { ppu.y_vel = (byte)(portA_ret ^ 0x80); }
}
}
@ -235,8 +240,15 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
t1_high = value;
t1_counter = (t1_high << 8) | t1_low;
if (aux_ctrl.Bit(7))
{
PB7 = false;
ppu.ramp_sig = true;
}
t1_shot_go = true;
if (aux_ctrl.Bit(7)) { PB7 = false; ppu.ramp_sig = true; ppu.skip = 0; }
t1_ctrl = aux_ctrl;
int_fl &= 0xBF;
@ -268,7 +280,7 @@ 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;
@ -366,7 +378,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
update_int_fl();
//if (int_en.Bit(6)) { cpu.IRQPending = true; }
if (t1_ctrl.Bit(7)) { PB7 = !PB7; ppu.ramp_sig = !ppu.ramp_sig; }
if (t1_ctrl.Bit(7)) { PB7 = !PB7; ppu.ramp_sig = !PB7; }
}
else
{
@ -435,6 +447,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
else
{
ppu.blank_sig = !shift_reg.Bit(7 - shift_count);
shift_count++;
shift_reg_wait = 1;
}

View File

@ -12,6 +12,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
public double x_pos, y_pos;
public int skip;
public uint bright_int;
public static uint br = 0xFFFFFFFF;
@ -37,7 +38,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
if (y_pos > 383) { y_pos = 383; }
if (y_pos < 0) { y_pos = 0; }
if (!blank_sig) { Core._vidbuffer[(int)(Math.Round(x_pos) + 256 * Math.Round(y_pos))] = (int)br; }
if (!blank_sig) { Core._vidbuffer[(int)(Math.Round(x_pos) + 256 * Math.Round(y_pos))] = (int)(br & bright_int); }
}
else if (zero_sig)
{
@ -72,6 +73,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
ser.Sync(nameof(y_pos), ref y_pos);
ser.Sync(nameof(skip), ref skip);
ser.Sync(nameof(bright_int), ref bright_int);
}
}
}

View File

@ -36,6 +36,10 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
audio.Register[14] = (byte)(_controllerDeck.ReadPort1(controller) & 0xF);
audio.Register[14] |= (byte)(_controllerDeck.ReadPort2(controller) << 4);
// joystick position is based on pot reading
frame_end = false;
do_frame();
@ -51,7 +55,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
public void do_frame()
{
_vidbuffer = new int[VirtualWidth * VirtualHeight];
//PB7_undriven = true;
//for (int i = 0; i < 1000; i++)
while (!frame_end)
{

View File

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