From a2e75c92b02c39eb5474538016a8cb830a0d4834 Mon Sep 17 00:00:00 2001 From: Roberto Zandona Date: Mon, 10 Oct 2011 21:32:08 +0000 Subject: [PATCH] konami 56832: fixed scrollmode 2 for flipped screen [Roberto Zandona'] --- src/mame/video/asterix.c | 8 ++++---- src/mame/video/konicdev.c | 28 +++++++++++++++++++++++++--- src/mame/video/konicdev.h | 1 + src/mame/video/lethal.c | 8 ++++---- 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/src/mame/video/asterix.c b/src/mame/video/asterix.c index cb785c40e9c..3ad87b9f2f0 100644 --- a/src/mame/video/asterix.c +++ b/src/mame/video/asterix.c @@ -99,14 +99,14 @@ SCREEN_UPDATE( asterix ) bitmap_fill(screen->machine().priority_bitmap, cliprect, 0); bitmap_fill(bitmap, cliprect, 0); - k056832_tilemap_draw(state->m_k056832, bitmap, cliprect, layer[0], 0, 1); - k056832_tilemap_draw(state->m_k056832, bitmap, cliprect, layer[1], 0, 2); - k056832_tilemap_draw(state->m_k056832, bitmap, cliprect, layer[2], 0, 4); + k056832_tilemap_draw(state->m_k056832, bitmap, cliprect, layer[0], K056832_DRAW_FLAG_MIRROR, 1); + k056832_tilemap_draw(state->m_k056832, bitmap, cliprect, layer[1], K056832_DRAW_FLAG_MIRROR, 2); + k056832_tilemap_draw(state->m_k056832, bitmap, cliprect, layer[2], K056832_DRAW_FLAG_MIRROR, 4); /* this isn't supported anymore and it is unsure if still needed; keeping here for reference pdrawgfx_shadow_lowpri = 1; fix shadows in front of feet */ k053245_sprites_draw(state->m_k053244, bitmap, cliprect); - k056832_tilemap_draw(state->m_k056832, bitmap, cliprect, 2, 0, 0); + k056832_tilemap_draw(state->m_k056832, bitmap, cliprect, 2, K056832_DRAW_FLAG_MIRROR, 0); return 0; } diff --git a/src/mame/video/konicdev.c b/src/mame/video/konicdev.c index 8a0c5197abe..2632299ff69 100644 --- a/src/mame/video/konicdev.c +++ b/src/mame/video/konicdev.c @@ -7178,7 +7178,25 @@ void k056832_tilemap_draw( device_t *device, bitmap_t *bitmap, const rectangle * } if (flipy) sdat_adv = -sdat_adv; - +/* +if (scrollmode==2) +{ +printf("%08x %08x %08x\n",layer,scrollbank<<12,k056832->lsram_page[layer][1]>>1); +printf("\n000-100:\n"); +for (int zz=0x000; zz<0x100; zz++) + printf("%04x ",k056832->videoram[(scrollbank<<12)+(k056832->lsram_page[layer][1]>>1)+zz]); +printf("\n100-200:\n"); +for (int zz=0x100; zz<0x200; zz++) + printf("%04x ",k056832->videoram[(scrollbank<<12)+(k056832->lsram_page[layer][1]>>1)+zz]); +printf("\n200-300:\n"); +for (int zz=0x200; zz<0x300; zz++) + printf("%04x ",k056832->videoram[(scrollbank<<12)+(k056832->lsram_page[layer][1]>>1)+zz]); +printf("\n300-400:\n"); +for (int zz=0x300; zz<0x400; zz++) + printf("%04x ",k056832->videoram[(scrollbank<<12)+(k056832->lsram_page[layer][1]>>1)+zz]); +printf("\nend\n"); +} +*/ last_active = k056832->active_layer; new_colorbase = (k056832->k055555 != NULL) ? k055555_get_palette_index(k056832->k055555, layer) : 0; @@ -7322,8 +7340,12 @@ void k056832_tilemap_draw( device_t *device, bitmap_t *bitmap, const rectangle * drawrect.min_y = (dminy < cminy ) ? cminy : dminy; drawrect.max_y = (dmaxy > cmaxy ) ? cmaxy : dmaxy; - - dx = ((int)p_scroll_data[sdat_offs]<<16 | (int)p_scroll_data[sdat_offs + 1]) + corr; +// printf("%04x %04x\n",layer,flipy); + // in xexex: K056832_DRAW_FLAG_MIRROR != flipy + if ((scrollmode == 2) && (flags & K056832_DRAW_FLAG_MIRROR) && (flipy)) + dx = ((int)p_scroll_data[sdat_offs + 0x1e0 + 14]<<16 | (int)p_scroll_data[sdat_offs + 0x1e0 + 15]) + corr; + else + dx = ((int)p_scroll_data[sdat_offs]<<16 | (int)p_scroll_data[sdat_offs + 1]) + corr; if (last_dx == dx) { if (last_visible) goto LINE_SHORTCIRCUIT; continue; } last_dx = dx; diff --git a/src/mame/video/konicdev.h b/src/mame/video/konicdev.h index 4bf7a522024..1c0d9a4b18f 100644 --- a/src/mame/video/konicdev.h +++ b/src/mame/video/konicdev.h @@ -748,6 +748,7 @@ WRITE32_DEVICE_HANDLER( k037122_char_w ); READ32_DEVICE_HANDLER( k037122_reg_r ); WRITE32_DEVICE_HANDLER( k037122_reg_w ); +#define K056832_DRAW_FLAG_MIRROR 0x00800000 // debug handlers READ16_DEVICE_HANDLER( k056832_word_r ); // VACSET diff --git a/src/mame/video/lethal.c b/src/mame/video/lethal.c index a02946bda3d..52c0238f3d5 100644 --- a/src/mame/video/lethal.c +++ b/src/mame/video/lethal.c @@ -109,14 +109,14 @@ SCREEN_UPDATE(lethalen) bitmap_fill(bitmap, cliprect, 7168); bitmap_fill(screen->machine().priority_bitmap, cliprect, 0); - k056832_tilemap_draw(state->m_k056832, bitmap, cliprect, 3, 0, 1); - k056832_tilemap_draw(state->m_k056832, bitmap, cliprect, 2, 0, 2); - k056832_tilemap_draw(state->m_k056832, bitmap, cliprect, 1, 0, 4); + k056832_tilemap_draw(state->m_k056832, bitmap, cliprect, 3, K056832_DRAW_FLAG_MIRROR, 1); + k056832_tilemap_draw(state->m_k056832, bitmap, cliprect, 2, K056832_DRAW_FLAG_MIRROR, 2); + k056832_tilemap_draw(state->m_k056832, bitmap, cliprect, 1, K056832_DRAW_FLAG_MIRROR, 4); k053245_sprites_draw_lethal(state->m_k053244, bitmap, cliprect); // force "A" layer over top of everything - k056832_tilemap_draw(state->m_k056832, bitmap, cliprect, 0, 0, 0); + k056832_tilemap_draw(state->m_k056832, bitmap, cliprect, 0, K056832_DRAW_FLAG_MIRROR, 0); return 0; }