From 683079c400063e0c3bc9e63e81910cbae9ba6080 Mon Sep 17 00:00:00 2001 From: r09 Date: Thu, 4 Jan 2018 21:59:30 +0100 Subject: [PATCH] fmtowns: fix missing pixels in single-layer modes --- src/mame/includes/fmtowns.h | 2 +- src/mame/video/fmtowns.cpp | 71 ++++++++----------------------------- 2 files changed, 15 insertions(+), 58 deletions(-) diff --git a/src/mame/includes/fmtowns.h b/src/mame/includes/fmtowns.h index c356edb10e3..9b410af2ede 100644 --- a/src/mame/includes/fmtowns.h +++ b/src/mame/includes/fmtowns.h @@ -378,7 +378,7 @@ public: void render_sprite_16(uint32_t poffset, uint16_t x, uint16_t y, bool xflip, bool yflip, bool xhalfsize, bool yhalfsize, bool rotation, const rectangle* rect); void draw_sprites(const rectangle* rect); void towns_crtc_draw_scan_layer_hicolour(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline); - void towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline); + void towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rectangle* rect,int line,int scanline); void towns_crtc_draw_scan_layer_16(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline); void towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* rect,int layer); void render_text_char(uint8_t x, uint8_t y, uint8_t ascii, uint16_t jis, uint8_t attr); diff --git a/src/mame/video/fmtowns.cpp b/src/mame/video/fmtowns.cpp index 388d3edf2a2..44d4e89a8f6 100644 --- a/src/mame/video/fmtowns.cpp +++ b/src/mame/video/fmtowns.cpp @@ -1089,7 +1089,7 @@ void towns_state::towns_crtc_draw_scan_layer_hicolour(bitmap_rgb32 &bitmap,const else off &= 0x7ffff; // 1 layer colour = (m_towns_gfxvram[off+(layer*0x40000)+1] << 8) | m_towns_gfxvram[off+(layer*0x40000)]; - if(colour < 0x8000) + if(colour < 0x8000 || !(m_video.towns_video_reg[0] & 0x10)) { for (pixel = 0; pixel < hzoom; pixel++) bitmap.pix32(scanline, x+pixel) = @@ -1103,7 +1103,7 @@ void towns_state::towns_crtc_draw_scan_layer_hicolour(bitmap_rgb32 &bitmap,const } } -void towns_state::towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rectangle* rect,int layer,int line,int scanline) +void towns_state::towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rectangle* rect,int line,int scanline) { int off = 0; int x; @@ -1120,57 +1120,26 @@ void towns_state::towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rect page = 1; } - bool bottom_layer = (m_video.towns_video_reg[1] & 0x01) != layer; - -// if((layer == 1) && (m_video.towns_sprite_reg[1] & 0x80) && (m_video.towns_sprite_page == 1)) -// off = 0x20000; - - if(layer == 0) - linesize = m_video.towns_crtc_reg[20] * 8; - else - linesize = m_video.towns_crtc_reg[24] * 8; + linesize = m_video.towns_crtc_reg[20] * 8; - if(layer != 0) - { - if(!(m_video.towns_video_reg[0] & 0x10)) - return; - if(!(m_video.towns_crtc_reg[28] & 0x10)) - off += m_video.towns_crtc_reg[21] << 3; // initial offset - else - { - scroll = ((m_video.towns_crtc_reg[21] & 0xfc00) << 3) | (((m_video.towns_crtc_reg[21] & 0x3ff) << 3)); - off += scroll; - } - hzoom = ((m_video.towns_crtc_reg[27] & 0x0f00) >> 8) + 1; - off += (m_video.towns_crtc_reg[11] - m_video.towns_crtc_reg[22]) / hzoom; - } + if(!(m_video.towns_crtc_reg[28] & 0x20)) + off += m_video.towns_crtc_reg[17] << 3; // initial offset else { - if(!(m_video.towns_crtc_reg[28] & 0x20)) - off += m_video.towns_crtc_reg[17] << 3; // initial offset - else - { - scroll = ((m_video.towns_crtc_reg[17] & 0xfc00) << 3) | (((m_video.towns_crtc_reg[17] & 0x3ff) << 3)); - off += scroll; - } - hzoom = (m_video.towns_crtc_reg[27] & 0x000f) + 1; - off += (m_video.towns_crtc_reg[9] - m_video.towns_crtc_reg[18]) / hzoom; + scroll = ((m_video.towns_crtc_reg[17] & 0xfc00) << 3) | (((m_video.towns_crtc_reg[17] & 0x3ff) << 3)); + off += scroll; } + hzoom = (m_video.towns_crtc_reg[27] & 0x000f) + 1; + off += (m_video.towns_crtc_reg[9] - m_video.towns_crtc_reg[18]) / hzoom; off += line * linesize; for(x=rect->min_x;xmax_x;x+=hzoom) { - if(m_video.towns_video_reg[0] & 0x10) - off &= 0x3ffff; // 2 layers - else - off &= 0x7ffff; // 1 layer - colour = m_towns_gfxvram[off+(layer*0x40000)]; - if(colour != 0 || bottom_layer) - { - for (pixel = 0; pixel < hzoom; pixel++) - bitmap.pix32(scanline, x+pixel) = m_palette->pen(colour); - } + off &= 0x7ffff; // 256 color mode is single-layer only + colour = m_towns_gfxvram[off]; + for (pixel = 0; pixel < hzoom; pixel++) + bitmap.pix32(scanline, x+pixel) = m_palette->pen(colour); off++; if ((off - (page * 0x20000)) % linesize == 0) off -= linesize; @@ -1295,7 +1264,7 @@ void towns_state::towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* re { do { - towns_crtc_draw_scan_layer_256(bitmap,rect,layer,line,scanline); + towns_crtc_draw_scan_layer_256(bitmap,rect,line,scanline); scanline++; count++; } while(count < zoom); @@ -1339,18 +1308,6 @@ void towns_state::towns_crtc_draw_layer(bitmap_rgb32 &bitmap,const rectangle* re count = 0; } break; - case 0x08: - for(line=top;line<=bottom;line++) - { - do - { - towns_crtc_draw_scan_layer_256(bitmap,rect,layer,line,scanline); - scanline++; - count++; - } while(count < zoom); - count = 0; - } - break; case 0x0c: for(line=top;line<=bottom;line++) {