vectrex: fix display bug and add some brightness

This commit is contained in:
alyosha-tas 2019-06-30 08:07:54 -04:00
parent 233825bbb7
commit 565bafd25e
4 changed files with 62 additions and 17 deletions

View File

@ -186,7 +186,15 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
}
else
{
if (sel1) { ppu.bright = portA_ret; ppu.bright_int = (uint)(0xFF000000 | (ppu.bright << 16) | (ppu.bright << 8) | ppu.bright); }
if (sel1)
{
ppu.bright = (byte)((portA_ret & 0x7F) << 1);
ppu.bright_int_1 = (uint)(0xFF000000 | (ppu.bright << 16) | (ppu.bright << 8) | ppu.bright);
ppu.bright = (byte)(portA_ret & 0x7F);
ppu.bright_int_2 = (uint)(0xFF000000 | (ppu.bright << 16) | (ppu.bright << 8) | ppu.bright);
ppu.bright = (byte)(portA_ret & 0x3F);
ppu.bright_int_3 = (uint)(0xFF000000 | (ppu.bright << 16) | (ppu.bright << 8) | ppu.bright);
}
else { ppu.y_vel = (byte)(portA_ret ^ 0x80); }
}
}
@ -217,7 +225,15 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
}
else
{
if (sel1) { ppu.bright = portA_ret; ppu.bright_int = (uint)(0xFF000000 | (ppu.bright << 16) | (ppu.bright << 8) | ppu.bright); }
if (sel1)
{
ppu.bright = (byte)((portA_ret & 0x7F) << 1);
ppu.bright_int_1 = (uint)(0xFF000000 | (ppu.bright << 16) | (ppu.bright << 8) | ppu.bright);
ppu.bright = (byte)(portA_ret & 0x7F);
ppu.bright_int_2 = (uint)(0xFF000000 | (ppu.bright << 16) | (ppu.bright << 8) | ppu.bright);
ppu.bright = (byte)(portA_ret & 0x3F);
ppu.bright_int_3 = (uint)(0xFF000000 | (ppu.bright << 16) | (ppu.bright << 8) | ppu.bright);
}
else { ppu.y_vel = (byte)(portA_ret ^ 0x80); }
}
}

View File

@ -12,7 +12,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
public double x_pos, y_pos;
public int skip;
public uint bright_int;
public uint bright_int_1, bright_int_2, bright_int_3;
public static uint br = 0xFFFFFFFF;
@ -33,17 +33,38 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
skip--;
}
if (x_pos > 255) { x_pos = 255; }
if (x_pos < 0) { x_pos = 0; }
if (y_pos > 383) { y_pos = 383; }
if (y_pos < 0) { y_pos = 0; }
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; }
if (!blank_sig) { Core._vidbuffer[(int)(Math.Round(x_pos) + 256 * Math.Round(y_pos))] = (int)(br & bright_int); }
}
else if (zero_sig)
{
x_pos = 128;
y_pos = 192;
x_pos = 128 + 2;
y_pos = 192 + 2;
}
if (!blank_sig)
{
Core._vidbuffer[(int)(Math.Round(x_pos) + 260 * Math.Round(y_pos))] |= (int)(br & bright_int_1);
Core._vidbuffer[(int)(Math.Round(x_pos) + 1 + 260 * Math.Round(y_pos))] |= (int)(br & bright_int_2);
Core._vidbuffer[(int)(Math.Round(x_pos) - 1 + 260 * Math.Round(y_pos))] |= (int)(br & bright_int_2);
Core._vidbuffer[(int)(Math.Round(x_pos) + 260 * (Math.Round(y_pos) + 1))] |= (int)(br & bright_int_2);
Core._vidbuffer[(int)(Math.Round(x_pos) + 260 * (Math.Round(y_pos) - 1))] |= (int)(br & bright_int_2);
Core._vidbuffer[(int)(Math.Round(x_pos) + 2 + 260 * Math.Round(y_pos))] |= (int)(br & bright_int_3);
Core._vidbuffer[(int)(Math.Round(x_pos) - 2 + 260 * Math.Round(y_pos))] |= (int)(br & bright_int_3);
Core._vidbuffer[(int)(Math.Round(x_pos) + 260 * (Math.Round(y_pos) + 2))] |= (int)(br & bright_int_3);
Core._vidbuffer[(int)(Math.Round(x_pos) + 260 * (Math.Round(y_pos) - 2))] |= (int)(br & bright_int_3);
Core._vidbuffer[(int)(Math.Round(x_pos) + 1 + 260 * (Math.Round(y_pos) + 1))] |= (int)(br & bright_int_3);
Core._vidbuffer[(int)(Math.Round(x_pos) + 1 + 260 * (Math.Round(y_pos) - 1))] |= (int)(br & bright_int_3);
Core._vidbuffer[(int)(Math.Round(x_pos) - 1 + 260 * (Math.Round(y_pos) + 1))] |= (int)(br & bright_int_3);
Core._vidbuffer[(int)(Math.Round(x_pos) - 1 + 260 * (Math.Round(y_pos) - 1))] |= (int)(br & bright_int_3);
}
}
@ -54,8 +75,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
ramp_sig = false;
vec_scale = x_vel = y_vel = bright = 0;
x_pos = 128;
y_pos = 192;
x_pos = 128 + 2;
y_pos = 192 + 2;
}
public void SyncState(Serializer ser)
@ -73,7 +94,9 @@ 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);
ser.Sync(nameof(bright_int_1), ref bright_int_1);
ser.Sync(nameof(bright_int_2), ref bright_int_2);
ser.Sync(nameof(bright_int_3), ref bright_int_3);
}
}
}

View File

@ -97,10 +97,10 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
return _vidbuffer;
}
public int VirtualWidth => 256;
public int VirtualHeight => 384;
public int BufferWidth => 256;
public int BufferHeight => 384;
public int VirtualWidth => 256 + 4;
public int VirtualHeight => 384 + 4;
public int BufferWidth => 256 + 4;
public int BufferHeight => 384 + 4;
public int BackgroundColor => unchecked((int)0xFF000000);
public int VsyncNumerator => _frameHz;
public int VsyncDenominator => 1;

View File

@ -100,6 +100,12 @@ namespace BizHawk.Emulation.Cores.Consoles.Vectrex
}
}
// RAM appears to power up to either random values or 0xFF, otherwise all the asteroids in minestorm are on the same side if RAM[0x7E]=0
for (int i = 0; i < RAM.Length; i++)
{
RAM[i] = 0xFF;
}
Setup_Mapper();
_frameHz = 50;