falco500: Support graphics mode

This commit is contained in:
Dirk Best 2022-01-18 12:53:14 +01:00
parent 5342d0e7f5
commit 88050be1df

View File

@ -301,7 +301,7 @@ void falco500_state::asic_mode_w(uint8_t data)
// -------0 80/132 columns
// timing wrong
rectangle visarea(0, (BIT(data, 0) ? 132 * 10 : 80 * 10) - 1, 0, 400 - 1);
rectangle visarea(0, (BIT(data, 0) ? 1320 : 1120) - 1, 0, 400 - 1);
m_screen->configure(1500, 422, visarea, HZ_TO_ATTOSECONDS(60));
}
@ -340,20 +340,24 @@ uint32_t falco500_state::screen_update(screen_device &screen, bitmap_rgb32 &bitm
// ----3210 offset for double-height lines
// la2 layout
// 7654---- line address bank (multiply by 2 to get the address)
// 7------- line address highest bit (only for graphics mode?)
// -654---- line address bank (multiply by 2 to get the address)
// ----3210 line address offset high bytes
// la3 layout
// 7------- unknown
// -6------ set on the line between windows
// --5----- 80 columns/132 columns
// ---43--- unknown
// ---4---- graphics/alphanumeric
// ----3--- unknown
// -----2-- double width
// ------1- double height first half
// -------0 double height second half (but not working for line modes 26 and 44?)
uint16_t line_addr = (la2 << 8) | la0;
line_addr = ((line_addr & 0xf000) << 1) | (line_addr & 0x0fff);
// move address highest bit to its place, shift bank left
line_addr = bitswap<16>(line_addr, 14, 13, 12, 15, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
//uint8_t unk_code = m_ram[0x0000 + line_addr]; // ?
//uint8_t unk_attr = m_ram[0x1000 + line_addr]; // ?
@ -364,16 +368,44 @@ uint32_t falco500_state::screen_update(screen_device &screen, bitmap_rgb32 &bitm
uint8_t line_height = la1 >> 4;
line_height++;
// safety check to prevent writing out of bounds
if (y + line_height > (cliprect.max_y + 1))
return 0;
if (BIT(la3, 4))
{
// horizontal resolution 560 pixels
for (int col = 0; col < 560; col++)
{
uint16_t char_addr = line_addr + col;
uint8_t code = m_ram[0x0000 + char_addr];
// foreground/background colors
rgb_t fg = pen[1];
rgb_t bg = pen[0];
for (int x = 0; x < 8; x++)
{
if (BIT(la3, 2))
{
bitmap.pix(y + (col / 70), (((col % 70) * 8) * 2) + (x * 2) + 0) = BIT(code, x) ? fg : bg;
bitmap.pix(y + (col / 70), (((col % 70) * 8) * 2) + (x * 2) + 1) = BIT(code, x) ? fg : bg;
}
else
{
bitmap.pix(y + (col / 70), ((col % 70) * 8) + x) = BIT(code, x) ? fg : bg;
}
}
}
}
else
{
// figure out number of columns
int cols = BIT(la3, 5) ? 80 : 132;
if (BIT(la3, 2))
cols /= 2;
// safety check to prevent writing out of bounds
if (y + line_height > (cliprect.max_y + 1))
return 0;
for (int col = 0; col < cols; col++)
{
uint16_t char_addr = line_addr + col;
@ -454,6 +486,7 @@ uint32_t falco500_state::screen_update(screen_device &screen, bitmap_rgb32 &bitm
}
}
}
}
y += line_height;
}