trunk/src/emu/video/315_5124.c
| r241992 | r241993 | |
| 160 | 160 | , m_int_cb(*this) |
| 161 | 161 | , m_pause_cb(*this) |
| 162 | 162 | , m_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, NULL, *ADDRESS_MAP_NAME(sega315_5124)) |
| 163 | , m_draws_bitmap(1) |
| 163 | 164 | , m_palette(*this, "palette") |
| 164 | 165 | , m_xscroll_hpos(X_SCROLL_HPOS_5124) |
| 165 | 166 | { |
| r241992 | r241993 | |
| 177 | 178 | , m_int_cb(*this) |
| 178 | 179 | , m_pause_cb(*this) |
| 179 | 180 | , m_space_config("videoram", ENDIANNESS_LITTLE, 8, 14, 0, NULL, *ADDRESS_MAP_NAME(sega315_5124)) |
| 181 | , m_draws_bitmap(1) |
| 180 | 182 | , m_palette(*this, "palette") |
| 181 | 183 | , m_xscroll_hpos(xscroll_hpos) |
| 182 | 184 | { |
| r241992 | r241993 | |
| 1753 | 1755 | |
| 1754 | 1756 | UINT32 sega315_5124_device::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect ) |
| 1755 | 1757 | { |
| 1756 | | copybitmap(bitmap, m_tmpbitmap, 0, 0, 0, 0, cliprect); |
| 1758 | if (m_draws_bitmap) copybitmap(bitmap, m_tmpbitmap, 0, 0, 0, 0, cliprect); |
| 1757 | 1759 | return 0; |
| 1758 | 1760 | } |
| 1759 | 1761 | |
trunk/src/emu/video/315_5124.h
| r241992 | r241993 | |
| 42 | 42 | |
| 43 | 43 | #define VRAM_SIZE 0x4000 |
| 44 | 44 | |
| 45 | #define MCFG_SEGA315_5124_SET_MANUAL_MIX \ |
| 46 | sega315_5124_device::set_draws_bitmap(*device, 0); |
| 45 | 47 | |
| 48 | |
| 46 | 49 | /*************************************************************************** |
| 47 | 50 | TYPE DEFINITIONS |
| 48 | 51 | ***************************************************************************/ |
| r241992 | r241993 | |
| 62 | 65 | 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); |
| 63 | 66 | |
| 64 | 67 | 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 | |
| 65 | 76 | 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); } |
| 66 | 77 | 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); } |
| 67 | 78 | |
| r241992 | r241993 | |
| 179 | 190 | static const device_timer_id TIMER_NMI = 6; |
| 180 | 191 | static const device_timer_id TIMER_FLAGS = 7; |
| 181 | 192 | |
| 193 | int m_draws_bitmap; |
| 194 | |
| 182 | 195 | required_device<palette_device> m_palette; |
| 183 | 196 | const int m_xscroll_hpos; |
| 184 | 197 | }; |
trunk/src/mame/drivers/megaplay.c
| r241992 | r241993 | |
| 90 | 90 | DECLARE_READ8_MEMBER(bios_6600_r); |
| 91 | 91 | DECLARE_WRITE8_MEMBER(bios_6600_w); |
| 92 | 92 | DECLARE_WRITE8_MEMBER(game_w); |
| 93 | | DECLARE_READ8_MEMBER(vdp_count_r); |
| 93 | DECLARE_READ8_MEMBER(vdp1_count_r); |
| 94 | 94 | DECLARE_WRITE_LINE_MEMBER(bios_int_callback); |
| 95 | 95 | |
| 96 | 96 | DECLARE_DRIVER_INIT(megaplay); |
| r241992 | r241993 | |
| 593 | 593 | ADDRESS_MAP_END |
| 594 | 594 | |
| 595 | 595 | |
| 596 | | READ8_MEMBER(mplay_state::vdp_count_r) |
| 596 | |
| 597 | READ8_MEMBER(mplay_state::vdp1_count_r) |
| 597 | 598 | { |
| 598 | 599 | address_space &prg = m_bioscpu->space(AS_PROGRAM); |
| 599 | 600 | if (offset & 0x01) |
| 600 | | return m_vdp->hcount_read(prg, offset); |
| 601 | return m_vdp1->hcount_read(prg, offset); |
| 601 | 602 | else |
| 602 | | return m_vdp->vcount_read(prg, offset); |
| 603 | return m_vdp1->vcount_read(prg, offset); |
| 603 | 604 | } |
| 604 | 605 | |
| 605 | 606 | static ADDRESS_MAP_START( megaplay_bios_io_map, AS_IO, 8, mplay_state ) |
| 606 | 607 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 607 | 608 | AM_RANGE(0x7f, 0x7f) AM_DEVWRITE("sn2", sn76496_device, write) |
| 608 | 609 | |
| 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) |
| 612 | 613 | ADDRESS_MAP_END |
| 613 | 614 | |
| 614 | 615 | |
| r241992 | r241993 | |
| 616 | 617 | { |
| 617 | 618 | //printf("megplay vu\n"); |
| 618 | 619 | screen_update_megadriv(screen, bitmap, cliprect); |
| 619 | | // m_vdp->screen_update(screen, bitmap, cliprect); |
| 620 | m_vdp1->screen_update(screen, bitmap, cliprect); |
| 620 | 621 | |
| 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 | |
| 621 | 625 | // overlay, only drawn for pixels != 0 |
| 622 | 626 | for (int y = 0; y < 224; y++) |
| 623 | 627 | { |
| 624 | 628 | 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); |
| 626 | 630 | |
| 627 | 631 | for (int x = 0; x < SEGA315_5124_WIDTH; x++) |
| 628 | 632 | { |
| 629 | 633 | UINT32 src = srcptr[x] & 0xffffff; |
| 630 | 634 | |
| 631 | 635 | if (src) |
| 632 | | lineptr[x] = src; |
| 636 | { |
| 637 | if (x>=16) |
| 638 | lineptr[x-16] = src; |
| 639 | |
| 640 | } |
| 633 | 641 | } |
| 634 | 642 | } |
| 643 | |
| 635 | 644 | return 0; |
| 636 | 645 | } |
| 637 | 646 | |
| r241992 | r241993 | |
| 671 | 680 | 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) |
| 672 | 681 | MCFG_SCREEN_UPDATE_DRIVER(mplay_state, screen_update_megplay) |
| 673 | 682 | |
| 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 | |
| 676 | 690 | MACHINE_CONFIG_END |
| 677 | 691 | |
| 678 | 692 | |