summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author cracyc <cracyc@users.noreply.github.com>2018-02-07 15:31:32 -0600
committer cracyc <cracyc@users.noreply.github.com>2018-02-07 15:31:32 -0600
commitb95700a403857a301ac7f459d753634d0dcf21bf (patch)
treeb1a432901db5302728bcddcba0cdc6cd94f7af3b
parent304abd860c8f13f39979bcf300b9a3eb4b6aec47 (diff)
fmtowns: handle alternating layer memory layout used by simearth (nw)
-rw-r--r--src/mame/drivers/fmtowns.cpp3
-rw-r--r--src/mame/includes/fmtowns.h2
-rw-r--r--src/mame/video/fmtowns.cpp37
3 files changed, 33 insertions, 9 deletions
diff --git a/src/mame/drivers/fmtowns.cpp b/src/mame/drivers/fmtowns.cpp
index ecf653a5c91..17999700f26 100644
--- a/src/mame/drivers/fmtowns.cpp
+++ b/src/mame/drivers/fmtowns.cpp
@@ -2205,7 +2205,8 @@ static ADDRESS_MAP_START(towns_mem, AS_PROGRAM, 32, towns_state)
AM_RANGE(0x000f0000, 0x000f7fff) AM_RAM //READWRITE(SMH_BANK(12),SMH_BANK(12))
AM_RANGE(0x000f8000, 0x000fffff) AM_READ_BANK("bank11") AM_WRITE_BANK("bank12")
// AM_RANGE(0x00100000, 0x005fffff) AM_RAM // some extra RAM
- AM_RANGE(0x80000000, 0x8007ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffffffff) AM_MIRROR(0x180000) // VRAM
+ AM_RANGE(0x80000000, 0x8007ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffffffff) AM_MIRROR(0x80000) // VRAM
+ AM_RANGE(0x80100000, 0x8017ffff) AM_READWRITE8(towns_gfx_packed_r,towns_gfx_packed_w,0xffffffff) AM_MIRROR(0x80000) // VRAM
AM_RANGE(0x81000000, 0x8101ffff) AM_READWRITE8(towns_spriteram_r,towns_spriteram_w,0xffffffff) // Sprite RAM
AM_RANGE(0xc0000000, 0xc0ffffff) AM_DEVREADWRITE8("icmemcard", fmt_icmem_device, static_mem_read, static_mem_write, 0xffffffff)
AM_RANGE(0xc1000000, 0xc1ffffff) AM_DEVREADWRITE8("icmemcard", fmt_icmem_device, mem_read, mem_write, 0xffffffff)
diff --git a/src/mame/includes/fmtowns.h b/src/mame/includes/fmtowns.h
index e380f88cca9..e32d80226eb 100644
--- a/src/mame/includes/fmtowns.h
+++ b/src/mame/includes/fmtowns.h
@@ -282,6 +282,8 @@ class towns_state : public driver_device
DECLARE_READ8_MEMBER(towns_gfx_high_r);
DECLARE_WRITE8_MEMBER(towns_gfx_high_w);
+ DECLARE_READ8_MEMBER(towns_gfx_packed_r);
+ DECLARE_WRITE8_MEMBER(towns_gfx_packed_w);
DECLARE_READ8_MEMBER(towns_gfx_r);
DECLARE_WRITE8_MEMBER(towns_gfx_w);
DECLARE_READ8_MEMBER(towns_video_cff80_r);
diff --git a/src/mame/video/fmtowns.cpp b/src/mame/video/fmtowns.cpp
index 5be149f0e4b..3c81f8a870f 100644
--- a/src/mame/video/fmtowns.cpp
+++ b/src/mame/video/fmtowns.cpp
@@ -142,6 +142,20 @@ WRITE8_MEMBER( towns_state::towns_gfx_high_w )
m_towns_gfxvram[offset] = (mem & ~mask) | (data & mask);
}
+READ8_MEMBER( towns_state::towns_gfx_packed_r )
+{
+ return m_towns_gfxvram[bitswap<19>(offset,2,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,1,0)];
+}
+
+WRITE8_MEMBER( towns_state::towns_gfx_packed_w )
+{
+ u8 mask = m_vram_mask[offset & 3];
+ offset = bitswap<19>(offset,2,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,1,0);
+ u8 mem = m_towns_gfxvram[offset];
+ m_towns_gfxvram[offset] = (mem & ~mask) | (data & mask);
+}
+
+
READ8_MEMBER( towns_state::towns_gfx_r )
{
uint8_t ret = 0;
@@ -1140,28 +1154,35 @@ void towns_state::towns_crtc_draw_scan_layer_256(bitmap_rgb32 &bitmap,const rect
page = 1;
}
- linesize = m_video.towns_crtc_reg[20] * 8;
+ linesize = m_video.towns_crtc_reg[20] * 4;
if(!(m_video.towns_crtc_reg[28] & 0x20))
- off += m_video.towns_crtc_reg[17] << 3; // initial offset
+ off += m_video.towns_crtc_reg[17] << 2; // initial offset
else
{
- scroll = ((m_video.towns_crtc_reg[17] & 0xfc00) << 3) | (((m_video.towns_crtc_reg[17] & 0x3ff) << 3));
+ scroll = ((m_video.towns_crtc_reg[17] & 0xfc00) << 2) | (((m_video.towns_crtc_reg[17] & 0x3ff) << 2));
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;
+ int subpix = (m_video.towns_crtc_reg[9] - m_video.towns_crtc_reg[18]) / hzoom;
off += line * linesize;
+ off += (subpix >> 1) & ~3;
+ subpix = subpix & 7;
for(x=rect->min_x;x<rect->max_x;x+=hzoom)
{
- off &= 0x7ffff; // 256 color mode is single-layer only
- colour = m_towns_gfxvram[off];
+ off &= 0x3ffff;
+ colour = m_towns_gfxvram[off+(subpix >= 4 ? (subpix & 3)+0x40000 : subpix)];
for (pixel = 0; pixel < hzoom; pixel++)
bitmap.pix32(scanline, x+pixel) = m_palette->pen(colour);
- off++;
- if ((off - (page * 0x20000)) % linesize == 0)
+ subpix++;
+ if(subpix == 8)
+ {
+ off += 4;
+ subpix = 0;
+ }
+ if ((off - (page * 0x20000)) % linesize == 0 && subpix == 0)
off -= linesize;
}
}