O2Hawk: color and display work
This commit is contained in:
parent
d0e6441f7b
commit
cba08040f7
|
@ -4,5 +4,7 @@ SHA1:38D4AAB263E10B1DAC3410C120536EE079826BCB Fatso 2 O2
|
|||
SHA1:3720DD6B5EE3DC62C5AF2EA9D915A2B83DE9463D Chief Chef O2
|
||||
SHA1:FEB358E28587DE70D1E89BF0F9A3209CE0B67C57 Haunted House O2
|
||||
SHA1:B1D65BEDB56FE7A9CF60AA054A9FD9BB7F65B77C 3D Box O2
|
||||
SHA1:0270047E2B1FC07581BF0FF9E55035925CF0EFF0 Guiseppe apr14 O2
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
|
||||
public byte VDC_ctrl, VDC_status, VDC_collision, VDC_col_ret, VDC_color;
|
||||
public byte Pixel_Stat;
|
||||
public int bg_brightness;
|
||||
|
||||
public int grid_fill;
|
||||
public byte grid_fill_col;
|
||||
|
@ -131,7 +132,7 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
{
|
||||
VDC_color = value;
|
||||
//Console.WriteLine("VDC_color: " + value + " " + Core.cpu.TotalExecutedCycles);
|
||||
//VDC_color &= 0xF8;
|
||||
bg_brightness = VDC_color.Bit(6) ? 8 : 0;
|
||||
//VDC_color |= 3;
|
||||
}
|
||||
else if (addr == 0xA4)
|
||||
|
@ -182,12 +183,12 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
if (LY < 240)
|
||||
{
|
||||
// background
|
||||
Core._vidbuffer[LY * 186 + (cycle - 43)] = (int)Color_Palette_BG[(VDC_color >> 3) & 0x7];
|
||||
Core._vidbuffer[LY * 186 + (cycle - 43)] = (int)Color_Palette_BG[((VDC_color >> 3) & 0x7) + bg_brightness];
|
||||
|
||||
// grid
|
||||
if (grid_fill > 0)
|
||||
{
|
||||
Core._vidbuffer[LY * 186 + (cycle - 43)] = (int)Color_Palette_BG[VDC_color & 0x7];
|
||||
Core._vidbuffer[LY * 186 + (cycle - 43)] = (int)Color_Palette_BG[(VDC_color & 0x7) + bg_brightness];
|
||||
Pixel_Stat |= grid_fill_col;
|
||||
grid_fill--;
|
||||
}
|
||||
|
@ -205,7 +206,7 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
{
|
||||
if (Grid_V[k].Bit(j))
|
||||
{
|
||||
Core._vidbuffer[LY * 186 + (cycle - 43)] = (int)Color_Palette_BG[VDC_color & 0x7];
|
||||
Core._vidbuffer[LY * 186 + (cycle - 43)] = (int)Color_Palette_BG[(VDC_color & 0x7) + bg_brightness];
|
||||
Pixel_Stat |= 0x10;
|
||||
if (VDC_ctrl.Bit(7)) { grid_fill = 15; }
|
||||
else { grid_fill = 1; }
|
||||
|
@ -225,7 +226,7 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
{
|
||||
if (Grid_H[k + 9].Bit(0))
|
||||
{
|
||||
Core._vidbuffer[LY * 186 + (cycle - 43)] = (int)Color_Palette_BG[VDC_color & 0x7];
|
||||
Core._vidbuffer[LY * 186 + (cycle - 43)] = (int)Color_Palette_BG[(VDC_color & 0x7) + bg_brightness];
|
||||
Pixel_Stat |= 0x20;
|
||||
|
||||
if (((cycle - 43 - 8) % 16) == 15) { grid_fill = 2; grid_fill_col = 0x20; }
|
||||
|
@ -235,7 +236,7 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
{
|
||||
if (Grid_H[k].Bit(j))
|
||||
{
|
||||
Core._vidbuffer[LY * 186 + (cycle - 43)] = (int)Color_Palette_BG[VDC_color & 0x7];
|
||||
Core._vidbuffer[LY * 186 + (cycle - 43)] = (int)Color_Palette_BG[(VDC_color & 0x7) + bg_brightness];
|
||||
Pixel_Stat |= 0x20;
|
||||
if (((cycle - 43 - 8) % 16) == 15) { grid_fill = 2; grid_fill_col = 0x20; }
|
||||
}
|
||||
|
@ -243,34 +244,6 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
}
|
||||
}
|
||||
|
||||
// sprites
|
||||
for (int i = 3; i >= 0; i--)
|
||||
{
|
||||
int double_size = Sprites[i * 4 + 2].Bit(2) ? 4 : 2;
|
||||
|
||||
if ((LY >= Sprites[i * 4]) && (LY < (Sprites[i * 4] + 8 * double_size)))
|
||||
{
|
||||
if (((cycle - 43) >= Sprites[i * 4 + 1]) && ((cycle - 43) < (Sprites[i * 4 + 1] + 8 * (double_size / 2))))
|
||||
{
|
||||
// character is in drawing region, pick a pixel
|
||||
int offset_y = (LY - Sprites[i * 4]) >> (double_size / 2);
|
||||
int offset_x = ((cycle - 43) - Sprites[i * 4 + 1]) >> (double_size / 2 - 1);
|
||||
|
||||
int pixel_pick = (Sprite_Shapes[i * 8 + offset_y] >> offset_x) & 1;
|
||||
|
||||
if (pixel_pick == 1)
|
||||
{
|
||||
if (Core._settings.Show_Sprites)
|
||||
{
|
||||
Core._vidbuffer[LY * 186 + (cycle - 43)] = (int) Color_Palette_SPR[(Sprites[i * 4 + 2] >> 3) & 0x7];
|
||||
}
|
||||
|
||||
Pixel_Stat |= (byte)(1 << i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// single characters
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
|
@ -371,6 +344,34 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
}
|
||||
}
|
||||
|
||||
// sprites
|
||||
for (int i = 3; i >= 0; i--)
|
||||
{
|
||||
int double_size = Sprites[i * 4 + 2].Bit(2) ? 4 : 2;
|
||||
|
||||
if ((LY >= Sprites[i * 4]) && (LY < (Sprites[i * 4] + 8 * double_size)))
|
||||
{
|
||||
if (((cycle - 43) >= Sprites[i * 4 + 1]) && ((cycle - 43) < (Sprites[i * 4 + 1] + 8 * (double_size / 2))))
|
||||
{
|
||||
// character is in drawing region, pick a pixel
|
||||
int offset_y = (LY - Sprites[i * 4]) >> (double_size / 2);
|
||||
int offset_x = ((cycle - 43) - Sprites[i * 4 + 1]) >> (double_size / 2 - 1);
|
||||
|
||||
int pixel_pick = (Sprite_Shapes[i * 8 + offset_y] >> offset_x) & 1;
|
||||
|
||||
if (pixel_pick == 1)
|
||||
{
|
||||
if (Core._settings.Show_Sprites)
|
||||
{
|
||||
Core._vidbuffer[LY * 186 + (cycle - 43)] = (int)Color_Palette_SPR[(Sprites[i * 4 + 2] >> 3) & 0x7];
|
||||
}
|
||||
|
||||
Pixel_Stat |= (byte)(1 << i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// calculate collision
|
||||
int col_bit = 0;
|
||||
for (int i = 7; i >= 0; i--)
|
||||
|
@ -489,7 +490,7 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
0x66, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x18, 00, // Y 0x2C
|
||||
0xC6, 0xE6, 0xF6, 0xFE, 0xDE, 0xCE, 0xC6, 00, // N 0x2D
|
||||
0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 00, // / 0x2E
|
||||
0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 00, // (box) 0x2F
|
||||
0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 00, // (box) 0x2F
|
||||
0xCE, 0xDB, 0xDB, 0xDB, 0xDB, 0xDB, 0xCE, 00, // 10 0x30
|
||||
0x00, 0x00, 0x3C, 0x7E, 0x7E, 0x7E, 0x3C, 00, // (ball) 0x31
|
||||
0x38, 0x38, 0x30, 0x3C, 0x30, 0x30, 0x38, 00, // (person R) 0x32
|
||||
|
@ -511,11 +512,11 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
public static readonly uint[] Color_Palette_SPR =
|
||||
{
|
||||
0xFF676767, // grey
|
||||
0xFF790000, // red
|
||||
0xFF006D07, // green
|
||||
0xFFC75151, // light red
|
||||
0xFF1A37BE, // blue
|
||||
0xFF94309F, // violet
|
||||
0xFF56C469, // light green
|
||||
0xFFC6B869, // light yellow
|
||||
0xFF5C80F6, // light blue
|
||||
0xFFDC84D4, // light violet
|
||||
0xFFCECECE, // light grey
|
||||
0xFFFFFFFF, // white
|
||||
};
|
||||
|
@ -525,19 +526,19 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
0xFF000000, // black
|
||||
0xFF1A37BE, // blue
|
||||
0xFF006D07, // green
|
||||
0xFF56C469, // light green
|
||||
0xFF2AAABE, // blue-green
|
||||
0xFF790000, // red
|
||||
0xFF94309F, // violet
|
||||
0xFFC75151, // light red
|
||||
0xFF77670B, // yellow
|
||||
0xFF676767, // grey
|
||||
0xFF000000, // black
|
||||
0xFF5C80F6, // light blue
|
||||
0xFF56C469, // light green
|
||||
0xFF77E6EB, // light blue-green
|
||||
0xFFC75151, // light red
|
||||
0xFFDC84D4, // light violet
|
||||
0xFFC6B869, // light yellow
|
||||
0xFFCECECE, // light grey
|
||||
0xFF2AAABE, // blue-green
|
||||
0xFF77E6EB, // light blue-green
|
||||
0xFF5C80F6, // light blue
|
||||
0xFFDC84D4, // light violet
|
||||
0xFF77670B, // yellow
|
||||
0xFFFFFFFF, // white
|
||||
};
|
||||
|
||||
|
||||
|
@ -556,6 +557,7 @@ namespace BizHawk.Emulation.Cores.Consoles.O2Hawk
|
|||
ser.Sync(nameof(VDC_col_ret), ref VDC_col_ret);
|
||||
ser.Sync(nameof(VDC_color), ref VDC_color);
|
||||
ser.Sync(nameof(Pixel_Stat), ref Pixel_Stat);
|
||||
ser.Sync(nameof(bg_brightness), ref bg_brightness);
|
||||
|
||||
ser.Sync(nameof(grid_fill), ref grid_fill);
|
||||
ser.Sync(nameof(grid_fill_col), ref grid_fill_col);
|
||||
|
|
Loading…
Reference in New Issue