Previous 199869 Revisions Next

r33481 Friday 21st November, 2014 at 16:16:42 UTC by David Haywood
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.
[src/emu/video]315_5124.c 315_5124.h
[src/mame/drivers]megaplay.c

trunk/src/emu/video/315_5124.c
r241992r241993
160160   , m_int_cb(*this)
161161   , m_pause_cb(*this)
162162   , m_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, NULL, *ADDRESS_MAP_NAME(sega315_5124))
163   , m_draws_bitmap(1)
163164   , m_palette(*this, "palette")
164165   , m_xscroll_hpos(X_SCROLL_HPOS_5124)
165166{
r241992r241993
177178   , m_int_cb(*this)
178179   , m_pause_cb(*this)
179180   , m_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, NULL, *ADDRESS_MAP_NAME(sega315_5124))
181   , m_draws_bitmap(1)
180182   , m_palette(*this, "palette")
181183   , m_xscroll_hpos(xscroll_hpos)
182184{
r241992r241993
17531755
17541756UINT32 sega315_5124_device::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect )
17551757{
1756   copybitmap(bitmap, m_tmpbitmap, 0, 0, 0, 0, cliprect);
1758   if (m_draws_bitmap) copybitmap(bitmap, m_tmpbitmap, 0, 0, 0, 0, cliprect);
17571759   return 0;
17581760}
17591761
trunk/src/emu/video/315_5124.h
r241992r241993
4242
4343#define VRAM_SIZE             0x4000
4444
45#define MCFG_SEGA315_5124_SET_MANUAL_MIX \
46   sega315_5124_device::set_draws_bitmap(*device, 0);
4547
48
4649/***************************************************************************
4750    TYPE DEFINITIONS
4851***************************************************************************/
r241992r241993
6265   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);
6366
6467   static void set_signal_type(device_t &device, bool is_pal) { downcast<sega315_5124_device &>(device).m_is_pal = is_pal; }
68   
69   // allow manual mixing
70   static void set_draws_bitmap(device_t &device, int draws_bitmap)
71   {
72      sega315_5124_device &dev = downcast<sega315_5124_device &>(device);
73      dev.m_draws_bitmap = draws_bitmap;
74   }
75
6576   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); }
6677   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); }
6778
r241992r241993
179190   static const device_timer_id TIMER_NMI = 6;
180191   static const device_timer_id TIMER_FLAGS = 7;
181192
193   int m_draws_bitmap;
194
182195   required_device<palette_device> m_palette;
183196   const int        m_xscroll_hpos;
184197};
trunk/src/mame/drivers/megaplay.c
r241992r241993
9090   DECLARE_READ8_MEMBER(bios_6600_r);
9191   DECLARE_WRITE8_MEMBER(bios_6600_w);
9292   DECLARE_WRITE8_MEMBER(game_w);
93   DECLARE_READ8_MEMBER(vdp_count_r);
93   DECLARE_READ8_MEMBER(vdp1_count_r);
9494   DECLARE_WRITE_LINE_MEMBER(bios_int_callback);
9595
9696   DECLARE_DRIVER_INIT(megaplay);
r241992r241993
593593ADDRESS_MAP_END
594594
595595
596READ8_MEMBER(mplay_state::vdp_count_r)
596
597READ8_MEMBER(mplay_state::vdp1_count_r)
597598{
598599   address_space &prg = m_bioscpu->space(AS_PROGRAM);
599600   if (offset & 0x01)
600      return m_vdp->hcount_read(prg, offset);
601      return m_vdp1->hcount_read(prg, offset);
601602   else
602      return m_vdp->vcount_read(prg, offset);
603      return m_vdp1->vcount_read(prg, offset);
603604}
604605
605606static ADDRESS_MAP_START( megaplay_bios_io_map, AS_IO, 8, mplay_state )
606607   ADDRESS_MAP_GLOBAL_MASK(0xff)
607608   AM_RANGE(0x7f, 0x7f) AM_DEVWRITE("sn2", sn76496_device, write)
608609
609   AM_RANGE(0x40, 0x41) AM_MIRROR(0x3e) AM_READ(vdp_count_r)
610   AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_DEVREADWRITE("gen_vdp", sega315_5124_device, vram_read, vram_write)
611   AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_DEVREADWRITE("gen_vdp", sega315_5124_device, register_read, register_write)
610   AM_RANGE(0x40, 0x41) AM_MIRROR(0x3e) AM_READ(vdp1_count_r)
611   AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_DEVREADWRITE("vdp1", sega315_5124_device, vram_read, vram_write)
612   AM_RANGE(0x81, 0x81) AM_MIRROR(0x3e) AM_DEVREADWRITE("vdp1", sega315_5124_device, register_read, register_write)
612613ADDRESS_MAP_END
613614
614615
r241992r241993
616617{
617618   //printf("megplay vu\n");
618619   screen_update_megadriv(screen, bitmap, cliprect);
619//  m_vdp->screen_update(screen, bitmap, cliprect);
620   m_vdp1->screen_update(screen, bitmap, cliprect);
620621
622   // i'm not sure if the overlay (256 pixels wide) is meant to be stretched over the 320 resolution genesis output, or centered.
623   // 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
624
621625   // overlay, only drawn for pixels != 0
622626   for (int y = 0; y < 224; y++)
623627   {
624628      UINT32* lineptr = &bitmap.pix32(y);
625      UINT32* srcptr =  &m_vdp->get_bitmap().pix32(y + SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT);
629      UINT32* srcptr =  &m_vdp1->get_bitmap().pix32(y + SEGA315_5124_TBORDER_START + SEGA315_5124_NTSC_224_TBORDER_HEIGHT);
626630
627631      for (int x = 0; x < SEGA315_5124_WIDTH; x++)
628632      {
629633         UINT32 src = srcptr[x] & 0xffffff;
630634
631635         if (src)
632            lineptr[x] = src;
636         {
637            if (x>=16)
638               lineptr[x-16] = src;
639
640         }
633641      }
634642   }
643
635644   return 0;
636645}
637646
r241992r241993
671680      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)
672681   MCFG_SCREEN_UPDATE_DRIVER(mplay_state, screen_update_megplay)
673682
674   MCFG_DEVICE_MODIFY("gen_vdp")
675   MCFG_SEGA315_5313_INT_CB(WRITELINE(mplay_state, bios_int_callback))
683   // Megaplay has an additional SMS VDP as an overlay
684   MCFG_DEVICE_ADD("vdp1", SEGA315_5246, 0)
685   MCFG_SEGA315_5246_SET_SCREEN("megadriv")
686   MCFG_SEGA315_5246_IS_PAL(false)
687   MCFG_SEGA315_5246_INT_CB(WRITELINE(mplay_state, bios_int_callback))
688   MCFG_SEGA315_5124_SET_MANUAL_MIX
689
676690MACHINE_CONFIG_END
677691
678692


Previous 199869 Revisions Next


© 1997-2024 The MAME Team