From 479a0489f7d314981792613744d80c85d025ffca Mon Sep 17 00:00:00 2001 From: angelosa Date: Thu, 2 Jan 2025 23:57:47 +0100 Subject: amiga/amiga_v: don't add bitplane modulo if DMA is disabled * fixes amigaocs_flop:lweapon intro at least --- src/mame/amiga/amiga_v.cpp | 10 +++++++--- src/mame/amiga/amigaaga.cpp | 9 ++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/mame/amiga/amiga_v.cpp b/src/mame/amiga/amiga_v.cpp index 00814e11d41..a61586312ee 100644 --- a/src/mame/amiga/amiga_v.cpp +++ b/src/mame/amiga/amiga_v.cpp @@ -479,6 +479,7 @@ void amiga_state::render_scanline(bitmap_rgb32 &bitmap, int scanline) int next_copper_x; int pl; const int defbitoffs = 15; + bool bitplane_dma_enabled = false; int save_scanline = scanline; @@ -548,6 +549,7 @@ void amiga_state::render_scanline(bitmap_rgb32 &bitmap, int scanline) // - no separation of video and logic models; // - the offsets we are applying to DDFSTRT and DDFSTOP, they mustn't be right (copper timings?); // - ditto for DIW related values, they are offset in far too many places; + // - Twintris intro expects +11 on fast scrolling section (glitches at sides) for (int x = 0; x < (amiga_state::SCREEN_WIDTH / 2) + 10; x++) { int sprpix; @@ -641,10 +643,11 @@ void amiga_state::render_scanline(bitmap_rgb32 &bitmap, int scanline) /* need to run the sprite engine every pixel to ensure display */ sprpix = get_sprite_pixel(x); + bitplane_dma_enabled = (CUSTOM_REG(REG_DMACON) & (DMACON_BPLEN | DMACON_DMAEN)) == (DMACON_BPLEN | DMACON_DMAEN); /* to render, we must have bitplane DMA enabled, at least 1 plane, and be within the */ /* vertical display window */ - if ((CUSTOM_REG(REG_DMACON) & (DMACON_BPLEN | DMACON_DMAEN)) == (DMACON_BPLEN | DMACON_DMAEN) && - planes > 0 && scanline >= m_diw.top() && scanline < m_diw.bottom()) + // TODO: bitplane DMA enabled applies to fetch_bitplane_data only + if (bitplane_dma_enabled && planes > 0 && scanline >= m_diw.top() && scanline < m_diw.bottom()) { int pfpix0 = 0, pfpix1 = 0, collide; @@ -847,7 +850,8 @@ void amiga_state::render_scanline(bitmap_rgb32 &bitmap, int scanline) } // end of the line: time to add the modulos - if (scanline >= m_diw.top() && scanline < m_diw.bottom()) + // NOTE: lweapon intro expects modulos to not be applied when bitplane DMA is disabled + if (scanline >= m_diw.top() && scanline < m_diw.bottom() && bitplane_dma_enabled) { // update odd planes for (pl = 0; pl < planes; pl += 2) diff --git a/src/mame/amiga/amigaaga.cpp b/src/mame/amiga/amigaaga.cpp index ed16ee32b3f..d7697827121 100644 --- a/src/mame/amiga/amigaaga.cpp +++ b/src/mame/amiga/amigaaga.cpp @@ -471,6 +471,7 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline) int pl; int defbitoffs = 0; rgb_t *aga_palette = m_aga_palette; + bool bitplane_dma_enabled = false; int save_scanline = scanline; @@ -679,10 +680,12 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline) /* need to run the sprite engine every pixel to ensure display */ sprpix = aga_get_sprite_pixel(x); + bitplane_dma_enabled = (CUSTOM_REG(REG_DMACON) & (DMACON_BPLEN | DMACON_DMAEN)) == (DMACON_BPLEN | DMACON_DMAEN); + /* to render, we must have bitplane DMA enabled, at least 1 plane, and be within the */ /* vertical display window */ - if ((CUSTOM_REG(REG_DMACON) & (DMACON_BPLEN | DMACON_DMAEN)) == (DMACON_BPLEN | DMACON_DMAEN) && - planes > 0 && scanline >= m_diw.top() && scanline < m_diw.bottom()) + // TODO: bitplane DMA enabled applies to fetch_bitplane_data only + if (bitplane_dma_enabled && planes > 0 && scanline >= m_diw.top() && scanline < m_diw.bottom()) { int pfpix0 = 0, pfpix1 = 0, collide; @@ -905,7 +908,7 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline) #endif /* end of the line: time to add the modulos */ - if (scanline >= m_diw.top() && scanline < m_diw.bottom()) + if (scanline >= m_diw.top() && scanline < m_diw.bottom() && bitplane_dma_enabled) { int16_t odd_modulo = CUSTOM_REG_SIGNED(REG_BPL1MOD); int16_t even_modulo = CUSTOM_REG_SIGNED(REG_BPL2MOD); -- cgit v1.2.3