summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author mamehaze <mamehaze@users.noreply.github.com>2014-11-21 16:16:42 +0000
committer mamehaze <mamehaze@users.noreply.github.com>2014-11-21 16:16:42 +0000
commit71e5ed36491316721bf4cde0427add3d5f0f1c49 (patch)
tree8665c4d69645ec26705b62cb95d0e602fcfad5a9
parentff011d20ef237f052ab8cbe343287f87ec72d36a (diff)
the Genesis VDP inherits the SMS vdp code so that it can run in SMS compatibility mode (a feature of the chip) not so that you can try and use it in both modes at the same time.
added an SMS VDP to Megaplay to use as the overlay. rather than abusing this feature of the Genesis VDP.
-rw-r--r--src/emu/video/315_5124.c4
-rw-r--r--src/emu/video/315_5124.h13
-rw-r--r--src/mame/drivers/megaplay.c38
3 files changed, 42 insertions, 13 deletions
diff --git a/src/emu/video/315_5124.c b/src/emu/video/315_5124.c
index 48aa0b670b9..32294e53c8f 100644
--- a/src/emu/video/315_5124.c
+++ b/src/emu/video/315_5124.c
@@ -160,6 +160,7 @@ sega315_5124_device::sega315_5124_device(const machine_config &mconfig, const ch
, m_int_cb(*this)
, m_pause_cb(*this)
, m_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, NULL, *ADDRESS_MAP_NAME(sega315_5124))
+ , m_draws_bitmap(1)
, m_palette(*this, "palette")
, m_xscroll_hpos(X_SCROLL_HPOS_5124)
{
@@ -177,6 +178,7 @@ sega315_5124_device::sega315_5124_device(const machine_config &mconfig, device_t
, m_int_cb(*this)
, m_pause_cb(*this)
, m_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, NULL, *ADDRESS_MAP_NAME(sega315_5124))
+ , m_draws_bitmap(1)
, m_palette(*this, "palette")
, m_xscroll_hpos(xscroll_hpos)
{
@@ -1753,7 +1755,7 @@ void sega315_5378_device::cram_write(UINT8 data)
UINT32 sega315_5124_device::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect )
{
- copybitmap(bitmap, m_tmpbitmap, 0, 0, 0, 0, cliprect);
+ if (m_draws_bitmap) copybitmap(bitmap, m_tmpbitmap, 0, 0, 0, 0, cliprect);
return 0;
}
diff --git a/src/emu/video/315_5124.h b/src/emu/video/315_5124.h
index e8d56f9bd68..08d47ece4ed 100644
--- a/src/emu/video/315_5124.h
+++ b/src/emu/video/315_5124.h
@@ -42,6 +42,9 @@
#define VRAM_SIZE 0x4000
+#define MCFG_SEGA315_5124_SET_MANUAL_MIX \
+ sega315_5124_device::set_draws_bitmap(*device, 0);
+
/***************************************************************************
TYPE DEFINITIONS
@@ -62,6 +65,14 @@ public:
sega315_5124_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT8 cram_size, UINT8 palette_offset, bool supports_224_240, const char *shortname, const char *source, int xscroll_hpos = X_SCROLL_HPOS_5124);
static void set_signal_type(device_t &device, bool is_pal) { downcast<sega315_5124_device &>(device).m_is_pal = is_pal; }
+
+ // allow manual mixing
+ static void set_draws_bitmap(device_t &device, int draws_bitmap)
+ {
+ sega315_5124_device &dev = downcast<sega315_5124_device &>(device);
+ dev.m_draws_bitmap = draws_bitmap;
+ }
+
template<class _Object> static devcb_base &set_int_callback(device_t &device, _Object object) { return downcast<sega315_5124_device &>(device).m_int_cb.set_callback(object); }
template<class _Object> static devcb_base &set_pause_callback(device_t &device, _Object object) { return downcast<sega315_5124_device &>(device).m_pause_cb.set_callback(object); }
@@ -179,6 +190,8 @@ protected:
static const device_timer_id TIMER_NMI = 6;
static const device_timer_id TIMER_FLAGS = 7;
+ int m_draws_bitmap;
+
required_device<palette_device> m_palette;
const int m_xscroll_hpos;
};
diff --git a/src/mame/drivers/megaplay.c b/src/mame/drivers/megaplay.c
index 5f33a2b066a..d9127cc6b31 100644
--- a/src/mame/drivers/megaplay.c
+++ b/src/mame/drivers/megaplay.c
@@ -90,7 +90,7 @@ public:
DECLARE_READ8_MEMBER(bios_6600_r);
DECLARE_WRITE8_MEMBER(bios_6600_w);
DECLARE_WRITE8_MEMBER(game_w);
- DECLARE_READ8_MEMBER(vdp_count_r);
+ DECLARE_READ8_MEMBER(vdp1_count_r);
DECLARE_WRITE_LINE_MEMBER(bios_int_callback);
DECLARE_DRIVER_INIT(megaplay);
@@ -593,22 +593,23 @@ static ADDRESS_MAP_START( megaplay_bios_map, AS_PROGRAM, 8, mplay_state )
ADDRESS_MAP_END
-READ8_MEMBER(mplay_state::vdp_count_r)
+
+READ8_MEMBER(mplay_state::vdp1_count_r)
{
address_space &prg = m_bioscpu->space(AS_PROGRAM);
if (offset & 0x01)
- return m_vdp->hcount_read(prg, offset);
+ return m_vdp1->hcount_read(prg, offset);
else
- return m_vdp->vcount_read(prg, offset);
+ return m_vdp1->vcount_read(prg, offset);
}
static ADDRESS_MAP_START( megaplay_bios_io_map, AS_IO, 8, mplay_state )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x7f, 0x7f) AM_DEVWRITE("sn2", sn76496_device, write)
- AM_RANGE(0x40, 0x41) AM_MIRROR(0x3e) AM_READ(vdp_count_r)
- AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_DEVREADWRITE("gen_vdp", sega315_5124_device, vram_read, vram_write)
- AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_DEVREADWRITE("gen_vdp", sega315_5124_device, register_read, register_write)
+ AM_RANGE(0x40, 0x41) AM_MIRROR(0x3e) AM_READ(vdp1_count_r)
+ AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_DEVREADWRITE("vdp1", sega315_5124_device, vram_read, vram_write)
+ AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_DEVREADWRITE("vdp1", sega315_5124_device, register_read, register_write)
ADDRESS_MAP_END
@@ -616,22 +617,30 @@ UINT32 mplay_state::screen_update_megplay(screen_device &screen, bitmap_rgb32 &b
{
//printf("megplay vu\n");
screen_update_megadriv(screen, bitmap, cliprect);
-// m_vdp->screen_update(screen, bitmap, cliprect);
+ m_vdp1->screen_update(screen, bitmap, cliprect);
+
+ // i'm not sure if the overlay (256 pixels wide) is meant to be stretched over the 320 resolution genesis output, or centered.
+ // if it's meant to be stretched we'll have to multiply the entire outut x4 for the Genesis VDP and x5 for the SMS VDP to get a common 1280 pixel wide image
// overlay, only drawn for pixels != 0
for (int y = 0; y < 224; y++)
{
UINT32* lineptr = &bitmap.pix32(y);
- UINT32* srcptr = &m_vdp->get_bitmap().pix32(y + SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT);
+ UINT32* srcptr = &m_vdp1->get_bitmap().pix32(y + SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT);
for (int x = 0; x < SEGA315_5124_WIDTH; x++)
{
UINT32 src = srcptr[x] & 0xffffff;
if (src)
- lineptr[x] = src;
+ {
+ if (x>=16)
+ lineptr[x-16] = src;
+
+ }
}
}
+
return 0;
}
@@ -671,8 +680,13 @@ static MACHINE_CONFIG_START( megaplay, mplay_state )
SEGA315_5124_HEIGHT_NTSC, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT, SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT + 224)
MCFG_SCREEN_UPDATE_DRIVER(mplay_state, screen_update_megplay)
- MCFG_DEVICE_MODIFY("gen_vdp")
- MCFG_SEGA315_5313_INT_CB(WRITELINE(mplay_state, bios_int_callback))
+ // Megaplay has an additional SMS VDP as an overlay
+ MCFG_DEVICE_ADD("vdp1", SEGA315_5246, 0)
+ MCFG_SEGA315_5246_SET_SCREEN("megadriv")
+ MCFG_SEGA315_5246_IS_PAL(false)
+ MCFG_SEGA315_5246_INT_CB(WRITELINE(mplay_state, bios_int_callback))
+ MCFG_SEGA315_5124_SET_MANUAL_MIX
+
MACHINE_CONFIG_END