amiga/amigaaga.cpp: align hires fmode 3 DDFs, experimentally enable drawing even if bitplane fetch DMA disabled

This commit is contained in:
angelosa 2025-01-22 12:06:09 +01:00
parent 803d38da65
commit 46247a8c06

View File

@ -530,7 +530,7 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline)
// TODO: copper runs on odd timeslots
next_copper_x = m_copper->restore_offset();
// TODO: verify where we're missing pixels here for the GFX pitch bitplane corruptions
// - wbenc30 scrolling in lores mode (fmode=3, expects a +58!, verify ddfstrt)
// - wbenc30 scrolling in lores mode (fmode=3, expects a +58!, verify ddfstrt / delays)
// - roadkill title (fmode=3, max +14), gameplay uses fmode=1
// - sockid_a, alfred gameplay (fmode=1)
// - virocp_a (fmode=1, +26)
@ -542,6 +542,13 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline)
// - cd32 cdtv:labytime intro/tutorial screens
// (swaps between fmode=1 and 3, verify ddfstrt / ddfstop)
const int offset_hack[] = { 10, 11, 11, 13 };
const int default_bit_offset[] = { 15, 31, 31, 63 };
// TODO: verify fmode 1/2 stops
// - wbenc30/kangfu/pbillusn (F10 key)/cd32 (CD splash loading) all expects a +8 offset
const int ddf_start_offset_hires[] = { 9, 9, 9, 9 + 8 };
const int ddf_stop_offset_hires[] = { 9 + 15, 9 + 15, 9 + 15, 9 + 8 };
// TODO: can it change mid-scanline?
const u8 bitplane_fmode = CUSTOM_REG(REG_FMODE) & 0x3;
for (int x = 0; x < (amiga_state::SCREEN_WIDTH / 2) + offset_hack[bitplane_fmode]; x++)
@ -588,20 +595,13 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline)
ehb = (CUSTOM_REG(REG_BPLCON0) & 0x7c10) == 0x6000 && !bool(BIT(CUSTOM_REG(REG_BPLCON2), 9));
/* get default bitoffset */
switch(bitplane_fmode)
{
case 0: defbitoffs = 15; break;
case 1:
case 2: defbitoffs = 31; break;
case 3: defbitoffs = 63; break;
}
defbitoffs = default_bit_offset[bitplane_fmode];
/* compute the pixel fetch parameters */
// FIXME: offsets applied are definitely not right
// does ddf_start_pixel offsets with fmode != 0?
// wbenc30 expects a +8 to align the screen with fmode == 3, which may or may not be right
ddf_start_pixel = ( CUSTOM_REG(REG_DDFSTRT) & 0xfc ) * 2 + (hires ? 9 : 17);
ddf_stop_pixel = ( CUSTOM_REG(REG_DDFSTOP) & 0xfc ) * 2 + (hires ? (9 + defbitoffs - ((defbitoffs >= 31) ? 16 : 0)) : (17 + defbitoffs));
ddf_start_pixel = ( CUSTOM_REG(REG_DDFSTRT) & 0xfc ) * 2;
ddf_start_pixel += hires ? ddf_start_offset_hires[bitplane_fmode] : 17;
ddf_stop_pixel = ( CUSTOM_REG(REG_DDFSTOP) & 0xfc ) * 2;
ddf_stop_pixel += hires ? ddf_stop_offset_hires[bitplane_fmode] : 17 + defbitoffs;
// FIXME: as like OCS/ECS Amiga verify this one
if ( ( CUSTOM_REG(REG_DDFSTRT) ^ CUSTOM_REG(REG_DDFSTOP) ) & 0x04 )
@ -696,8 +696,7 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline)
/* to render, we must have bitplane DMA enabled, at least 1 plane, and be within the */
/* vertical display window */
// TODO: bitplane DMA enabled applies to fetch_bitplane_data only
if (bitplane_dma_enabled && planes > 0 && scanline >= m_diw.top() && scanline < m_diw.bottom())
if (planes > 0 && scanline >= m_diw.top() && scanline < m_diw.bottom())
{
int pfpix0 = 0, pfpix1 = 0, collide;
@ -705,7 +704,7 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline)
if (x >= ddf_start_pixel && x <= ddf_stop_pixel + odelay)
{
/* if we need to fetch more data, do it now */
if (obitoffs == defbitoffs)
if (obitoffs == defbitoffs && bitplane_dma_enabled)
{
for (pl = 0; pl < planes; pl += 2)
{
@ -721,7 +720,7 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline)
if (hires)
{
/* reset bit offsets and fetch more data if needed */
if (obitoffs < 0)
if (obitoffs < 0 && bitplane_dma_enabled)
{
obitoffs = defbitoffs;
@ -746,7 +745,7 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline)
if (x >= ddf_start_pixel && x <= ddf_stop_pixel + edelay)
{
/* if we need to fetch more data, do it now */
if (ebitoffs == defbitoffs)
if (ebitoffs == defbitoffs && bitplane_dma_enabled)
{
for (pl = 1; pl < planes; pl += 2)
{
@ -762,7 +761,7 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline)
if (hires)
{
/* reset bit offsets and fetch more data if needed */
if (ebitoffs < 0)
if (ebitoffs < 0 && bitplane_dma_enabled)
{
ebitoffs = defbitoffs;
@ -876,7 +875,7 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline)
pri = (sprpix >> 12);
/* sprite has priority */
// TODO: porting OCS alfred fix to AGA will break OCS rodland status bar (!?)
// TODO: porting OCS alfred fix to AGA will break OCS rodland status bar (!?)
if (sprpix && pf1pri > pri)
{
dst[x*2+0] =