From 336bca03029b4962bc1813da089d2d076a25f6db Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 8 Nov 2014 19:33:05 +0100 Subject: [PATCH] added sega_315_5296_device --- src/mame/drivers/segas18.c | 234 ++++++++++++------------------------ src/mame/includes/segas18.h | 49 ++++---- src/mame/video/segas18.c | 18 +-- 3 files changed, 113 insertions(+), 188 deletions(-) diff --git a/src/mame/drivers/segas18.c b/src/mame/drivers/segas18.c index ba3114362ce..f6029ef0916 100644 --- a/src/mame/drivers/segas18.c +++ b/src/mame/drivers/segas18.c @@ -150,13 +150,12 @@ void segas18_state::init_generic(segas18_rom_board rom_board) m_vdp->set_vdp_pal(FALSE); m_vdp->set_framerate(60); m_vdp->set_total_scanlines(262); - m_vdp->stop_timers(); // 315-5124 timers + m_vdp->stop_timers(); // 315-5124 timers // save state save_item(NAME(m_mcu_data)); save_item(NAME(m_lghost_value)); save_item(NAME(m_lghost_select)); - save_item(NAME(m_misc_io_data)); save_item(NAME(m_wwally_last_x)); save_item(NAME(m_wwally_last_y)); } @@ -199,135 +198,45 @@ void segas18_state::machine_reset() * *************************************/ -READ16_MEMBER( segas18_state::io_chip_r ) +WRITE8_MEMBER( segas18_state::misc_outputs_w ) { - static const char *const portnames[] = { "P1", "P2", "PORTC", "PORTD", "SERVICE", "COINAGE", "DSW", "PORTH" }; - offset &= 0x1f/2; - - switch (offset) - { - // I/O ports - case 0x00/2: - case 0x02/2: - case 0x04/2: - case 0x06/2: - case 0x08/2: - case 0x0a/2: - case 0x0c/2: - case 0x0e/2: - // if the port is configured as an output, return the last thing written - if (m_misc_io_data[0x1e/2] & (1 << offset)) - return m_misc_io_data[offset]; - - // otherwise, return an input port - return ioport(portnames[offset])->read(); - - // 'SEGA' protection - case 0x10/2: - return 'S'; - case 0x12/2: - return 'E'; - case 0x14/2: - return 'G'; - case 0x16/2: - return 'A'; - - // CNT register & mirror - case 0x18/2: - case 0x1c/2: - return m_misc_io_data[0x1c/2]; - - // port direction register & mirror - case 0x1a/2: - case 0x1e/2: - return m_misc_io_data[0x1e/2]; - } - return 0xffff; -} - - -WRITE16_MEMBER( segas18_state::io_chip_w ) -{ - // generic implementation - offset &= 0x1f/2; - UINT8 old = m_misc_io_data[offset]; - m_misc_io_data[offset] = data; - - switch (offset) - { - // I/O ports - case 0x00/2: - case 0x02/2: - case 0x04/2: - case 0x08/2: - case 0x0a/2: - case 0x0c/2: - if (m_has_guns) - { - // outputs for lghost only - output_set_value("P1_Gun_Recoil",(~data & 0x01)); - output_set_value("P2_Gun_Recoil",(~data & 0x02)>>1); - output_set_value("P3_Gun_Recoil",(~data & 0x04)>>2); - } - break; - - // miscellaneous output - case 0x06/2: - set_grayscale(~data & 0x40); - m_segaic16vid->segaic16_tilemap_set_flip(0, data & 0x20); - m_sprites->set_flip(data & 0x20); -// These are correct according to cgfm's docs, but mwalker and ddcrew both -// enable the lockout and never turn it off -// coin_lockout_w(machine(), 1, data & 0x08); -// coin_lockout_w(machine(), 0, data & 0x04); - coin_counter_w(machine(), 1, data & 0x02); - coin_counter_w(machine(), 0, data & 0x01); - break; - - // tile banking - case 0x0e/2: - if (m_romboard == ROM_BOARD_171_5874 || m_romboard == ROM_BOARD_171_SHADOW) - for (int i = 0; i < 4; i++) - { - m_segaic16vid->segaic16_tilemap_set_bank(0, 0 + i, (data & 0xf) * 4 + i); - m_segaic16vid->segaic16_tilemap_set_bank(0, 4 + i, ((data >> 4) & 0xf) * 4 + i); - } - break; - - // CNT register - case 0x1c/2: - m_segaic16vid->segaic16_set_display_enable(data & 2); - if ((old ^ data) & 4) - set_vdp_enable(data & 4); - break; - } + // miscellaneous output + set_grayscale(~data & 0x40); + m_segaic16vid->segaic16_tilemap_set_flip(0, data & 0x20); + m_sprites->set_flip(data & 0x20); + // These are correct according to cgfm's docs, but mwalker and ddcrew both + // enable the lockout and never turn it off + // coin_lockout_w(machine(), 1, data & 0x08); + // coin_lockout_w(machine(), 0, data & 0x04); + coin_counter_w(machine(), 1, data & 0x02); + coin_counter_w(machine(), 0, data & 0x01); } READ16_MEMBER( segas18_state::misc_io_r ) { - static const char *const portnames[] = { "SERVICE", "COINAGE" }; - offset &= 0x1fff; - switch (offset & (0x3000/2)) { // I/O chip case 0x0000/2: case 0x1000/2: - return io_chip_r(space, offset, mem_mask); + return m_io->read(space, offset) | (open_bus_r(space, 0, mem_mask) & 0xff00); // video control latch case 0x2000/2: + { + static const char *const portnames[] = { "SERVICE", "COINAGE" }; return ioport(portnames[offset & 1])->read(); + } } + if (!m_custom_io_r.isnull()) return m_custom_io_r(space, offset, mem_mask); logerror("%06X:misc_io_r - unknown read access to address %04X\n", space.device().safe_pc(), offset * 2); return open_bus_r(space, 0, mem_mask); } - WRITE16_MEMBER( segas18_state::misc_io_w ) { offset &= 0x1fff; @@ -338,7 +247,7 @@ WRITE16_MEMBER( segas18_state::misc_io_w ) case 0x1000/2: if (ACCESSING_BITS_0_7) { - io_chip_w(space, offset, data, mem_mask); + m_io->write(space, offset, data); return; } break; @@ -352,6 +261,7 @@ WRITE16_MEMBER( segas18_state::misc_io_w ) } break; } + if (!m_custom_io_w.isnull()) { m_custom_io_w(space, offset, data, mem_mask); @@ -368,10 +278,24 @@ WRITE16_MEMBER( segas18_state::misc_io_w ) * *************************************/ +WRITE8_MEMBER( segas18_state::rom_5874_bank_w ) +{ + if (m_romboard == ROM_BOARD_171_5874 || m_romboard == ROM_BOARD_171_SHADOW) + { + for (int i = 0; i < 4; i++) + { + m_segaic16vid->segaic16_tilemap_set_bank(0, 0 + i, (data & 0xf) * 4 + i); + m_segaic16vid->segaic16_tilemap_set_bank(0, 4 + i, ((data >> 4) & 0xf) * 4 + i); + } + } +} + + WRITE16_MEMBER( segas18_state::rom_5987_bank_w ) { if (!ACCESSING_BITS_0_7) return; + offset &= 0xf; data &= 0xff; @@ -406,7 +330,6 @@ WRITE16_MEMBER( segas18_state::rom_837_7525_bank_w ) // tile banking if (offset < 8) { - // int maxbanks = m_gfxdecode->gfx(0)->elements() / 1024; data &= 0x9f; if (data & 0x80) data += 0x20; @@ -435,13 +358,13 @@ READ16_MEMBER( segas18_state::ddcrew_custom_io_r ) switch (offset) { case 0x3020/2: - return ioport("P3")->read(); + return ioport("EXP3")->read(); case 0x3022/2: - return ioport("P4")->read(); + return ioport("EXP4")->read(); case 0x3024/2: - return ioport("P34START")->read(); + return ioport("EXSERVICE")->read(); } return open_bus_r(space, 0, mem_mask); } @@ -470,7 +393,6 @@ READ16_MEMBER( segas18_state::lghost_custom_io_r ) return open_bus_r(space, 0, mem_mask); } - WRITE16_MEMBER( segas18_state::lghost_custom_io_w ) { switch (offset) @@ -498,6 +420,14 @@ WRITE16_MEMBER( segas18_state::lghost_custom_io_w ) } +WRITE8_MEMBER( segas18_state::lghost_gun_recoil_w ) +{ + output_set_value("P1_Gun_Recoil", (~data & 0x01)); + output_set_value("P2_Gun_Recoil", (~data & 0x02)>>1); + output_set_value("P3_Gun_Recoil", (~data & 0x04)>>2); +} + + /************************************* * @@ -575,22 +505,6 @@ WRITE8_MEMBER( segas18_state::mcu_data_w ) m_mcu->set_input_line(MCS51_INT1_LINE, HOLD_LINE); } -/************************************* - * - * VDP memory handlers - * - *************************************/ - -READ16_MEMBER( segas18_state::genesis_vdp_r ) -{ - return m_vdp->vdp_r(space, offset, mem_mask); -} - -WRITE16_MEMBER( segas18_state::genesis_vdp_w ) -{ - m_vdp->vdp_w(space, offset, data, mem_mask); -} - /************************************* @@ -681,10 +595,7 @@ static INPUT_PORTS_START( system18_generic ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL - PORT_START("PORTC") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("PORTD") + PORT_START("P3") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("SERVICE") @@ -709,9 +620,6 @@ static INPUT_PORTS_START( system18_generic ) PORT_DIPUNUSED_DIPLOC( 0x20, IP_ACTIVE_LOW, "SW2:6" ) PORT_DIPUNUSED_DIPLOC( 0x40, IP_ACTIVE_LOW, "SW2:7" ) PORT_DIPUNUSED_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW2:8" ) - - PORT_START("PORTH") - PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END @@ -725,7 +633,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( astorm ) PORT_INCLUDE( system18_generic ) - PORT_MODIFY("PORTC") + PORT_MODIFY("P3") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) @@ -877,7 +785,7 @@ static INPUT_PORTS_START( ddcrew ) PORT_DIPSETTING( 0x40, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) - PORT_START("P3") + PORT_START("EXP3") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) @@ -887,7 +795,7 @@ static INPUT_PORTS_START( ddcrew ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3) - PORT_START("P4") + PORT_START("EXP4") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4) @@ -897,7 +805,7 @@ static INPUT_PORTS_START( ddcrew ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4) - PORT_START("P34START") + PORT_START("EXSERVICE") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START3 ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START4 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 ) // individual mode @@ -936,7 +844,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( ddcrew3p ) PORT_INCLUDE( ddcrew2p ) - PORT_MODIFY("PORTC") + PORT_MODIFY("P3") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) @@ -955,7 +863,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( desertbr ) PORT_INCLUDE( system18_generic ) - PORT_MODIFY("PORTC") + PORT_MODIFY("P3") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) @@ -1101,7 +1009,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( mwalk ) PORT_INCLUDE( system18_generic ) - PORT_MODIFY("PORTC") + PORT_MODIFY("P3") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3) @@ -1281,10 +1189,7 @@ WRITE_LINE_MEMBER(segas18_state::vdp_lv4irqline_callback_s18) WRITE_LINE_MEMBER(segas18_state::ym3438_irq_handler) { - if (state) - m_soundcpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE ); - else - m_soundcpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE ); + m_soundcpu->set_input_line(INPUT_LINE_IRQ0, state ? ASSERT_LINE : CLEAR_LINE); } @@ -1303,6 +1208,17 @@ static MACHINE_CONFIG_START( system18, segas18_state ) MCFG_SEGA_315_5195_MAPPER_ADD("mapper", "maincpu", segas18_state, memory_mapper, mapper_sound_r, mapper_sound_w) + MCFG_DEVICE_ADD("io", SEGA_315_5296, 16000000) + MCFG_315_5296_IN_PORTA_CB(IOPORT("P1")) + MCFG_315_5296_IN_PORTB_CB(IOPORT("P2")) + MCFG_315_5296_IN_PORTC_CB(IOPORT("P3")) + MCFG_315_5296_OUT_PORTD_CB(WRITE8(segas18_state, misc_outputs_w)) + MCFG_315_5296_IN_PORTE_CB(IOPORT("SERVICE")) + MCFG_315_5296_IN_PORTF_CB(IOPORT("COINAGE")) + MCFG_315_5296_IN_PORTG_CB(IOPORT("DSW")) + MCFG_315_5296_OUT_PORTH_CB(WRITE8(segas18_state, rom_5874_bank_w)) + MCFG_315_5296_OUT_CNT1_CB(DEVWRITELINE("segaic16vid", segaic16_video_device, segaic16_set_display_enable)) + MCFG_315_5296_OUT_CNT2_CB(WRITELINE(segas18_state, set_vdp_enable)) MCFG_DEVICE_ADD("gen_vdp", SEGA315_5313, 0) MCFG_SEGA315_5313_IS_PAL(false) @@ -1315,10 +1231,9 @@ static MACHINE_CONFIG_START( system18, segas18_state ) MCFG_TIMER_DEVICE_ADD_SCANLINE("scantimer", "gen_vdp", sega315_5313_device, megadriv_scanline_timer_callback_alt_timing, "screen", 0, 1) - // video hardware MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(57.23) // verified on pcb + MCFG_SCREEN_REFRESH_RATE(57.23) // verified on pcb MCFG_SCREEN_SIZE(342,262) MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 28*8-1) MCFG_SCREEN_UPDATE_DRIVER(segas18_state, screen_update) @@ -1347,12 +1262,24 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( system18_fd1094, system18 ) + + // basic machine hardware MCFG_CPU_REPLACE("maincpu", FD1094, 10000000) MCFG_CPU_PROGRAM_MAP(system18_map) MCFG_CPU_VBLANK_INT_DRIVER("screen", segas18_state, irq4_line_hold) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( lghost, system18_fd1094 ) + + // basic machine hardware + MCFG_DEVICE_MODIFY("io") + MCFG_315_5296_OUT_PORTC_CB(WRITE8(segas18_state, lghost_gun_recoil_w)) +MACHINE_CONFIG_END + + static MACHINE_CONFIG_DERIVED( system18_fd1094_i8751, system18_fd1094 ) + + // basic machine hardware MCFG_CPU_MODIFY("maincpu") MCFG_CPU_VBLANK_INT_REMOVE() @@ -2403,7 +2330,6 @@ DRIVER_INIT_MEMBER(segas18_state,ddcrew) DRIVER_INIT_MEMBER(segas18_state,lghost) { - m_has_guns = true; init_generic_5987(); m_custom_io_r = read16_delegate(FUNC(segas18_state::lghost_custom_io_r), this); m_custom_io_w = write16_delegate(FUNC(segas18_state::lghost_custom_io_w), this); @@ -2440,8 +2366,8 @@ GAME( 1991, ddcrew1, ddcrew, system18_fd1094, ddcrew, segas18_state, GAME( 1991, ddcrewj, ddcrew, system18_fd1094, ddcrew, segas18_state, ddcrew, ROT0, "Sega", "D. D. Crew (Japan, 4 Players, FD1094 317-0185)", 0 ) GAME( 1991, ddcrewj2, ddcrew, system18_fd1094, ddcrew2p, segas18_state, ddcrew, ROT0, "Sega", "D. D. Crew (Japan, 2 Players, FD1094 317-0182)", 0 ) GAME( 1991, hamaway, 0, system18, hamaway, segas18_state, hamaway, ROT90, "Sega / Santos", "Hammer Away (Japan, prototype)", 0 ) -GAME( 1990, lghost, 0, system18_fd1094, lghost, segas18_state, lghost, ROT0, "Sega", "Laser Ghost (World, FD1094 317-0166)", 0 ) -GAME( 1990, lghostu, lghost, system18_fd1094, lghost, segas18_state, lghost, ROT0, "Sega", "Laser Ghost (US, FD1094 317-0165)", 0 ) +GAME( 1990, lghost, 0, lghost, lghost, segas18_state, lghost, ROT0, "Sega", "Laser Ghost (World, FD1094 317-0166)", 0 ) +GAME( 1990, lghostu, lghost, lghost, lghost, segas18_state, lghost, ROT0, "Sega", "Laser Ghost (US, FD1094 317-0165)", 0 ) GAME( 1990, mwalk, 0, system18_fd1094_i8751,mwalk, segas18_state, generic_5874, ROT0, "Sega", "Michael Jackson's Moonwalker (World, FD1094/8751 317-0159)", 0 ) GAME( 1990, mwalku, mwalk, system18_fd1094_i8751,mwalka, segas18_state, generic_5874, ROT0, "Sega", "Michael Jackson's Moonwalker (US, FD1094/8751 317-0158)", 0 ) GAME( 1990, mwalkj, mwalk, system18_fd1094_i8751,mwalk, segas18_state, generic_5874, ROT0, "Sega", "Michael Jackson's Moonwalker (Japan, FD1094/8751 317-0157)", 0 ) @@ -2449,5 +2375,5 @@ GAME( 1989, pontoon, 0, system18_fd1094, shdancer, segas18_state, GAME( 1989, shdancer, 0, system18, shdancer, segas18_state, generic_shad, ROT0, "Sega", "Shadow Dancer (World)", 0 ) GAME( 1989, shdancerj, shdancer, system18, shdancer, segas18_state, generic_shad, ROT0, "Sega", "Shadow Dancer (Japan)", 0 ) GAME( 1989, shdancer1, shdancer, system18, shdancer, segas18_state, generic_shad, ROT0, "Sega", "Shadow Dancer (US)", 0 ) -GAME( 1992, wwallyj, 0, system18_fd1094, wwally, segas18_state, wwally, ROT0, "Sega", "Wally wo Sagase! (rev B, Japan, FD1094 317-0197B)", 0) // the roms do contain an english logo so maybe there is a world / us set too +GAME( 1992, wwallyj, 0, system18_fd1094, wwally, segas18_state, wwally, ROT0, "Sega", "Wally wo Sagase! (rev B, Japan, FD1094 317-0197B)", 0 ) // the roms do contain an english logo so maybe there is a world / us set too GAME( 1992, wwallyja, wwallyj, system18_fd1094, wwally, segas18_state, wwally, ROT0, "Sega", "Wally wo Sagase! (rev A, Japan, FD1094 317-0197A)", 0 ) diff --git a/src/mame/includes/segas18.h b/src/mame/includes/segas18.h index 2cf27fddfbd..02d45bdf6e6 100644 --- a/src/mame/includes/segas18.h +++ b/src/mame/includes/segas18.h @@ -11,6 +11,7 @@ #include "cpu/z80/z80.h" #include "machine/nvram.h" #include "machine/segaic16.h" +#include "machine/315_5296.h" #include "video/315_5313.h" #include "video/segaic16.h" #include "video/sega16sp.h" @@ -29,21 +30,20 @@ public: m_soundcpu(*this, "soundcpu"), m_mcu(*this, "mcu"), m_vdp(*this, "gen_vdp"), + m_io(*this, "io"), m_nvram(*this, "nvram"), m_sprites(*this, "sprites"), m_segaic16vid(*this, "segaic16vid"), + m_gfxdecode(*this, "gfxdecode"), m_workram(*this, "workram"), m_romboard(ROM_BOARD_INVALID), - m_has_guns(false), m_grayscale_enable(false), m_vdp_enable(false), m_vdp_mixing(0), m_mcu_data(0), m_lghost_value(0), - m_lghost_select(0), - m_gfxdecode(*this, "gfxdecode") + m_lghost_select(0) { - memset(m_misc_io_data, 0, sizeof(m_misc_io_data)); memset(m_wwally_last_x, 0, sizeof(m_wwally_last_x)); memset(m_wwally_last_y, 0, sizeof(m_wwally_last_y)); } @@ -63,26 +63,21 @@ public: void mapper_sound_w(UINT8 data); // read/write handlers + DECLARE_WRITE8_MEMBER( rom_5874_bank_w ); DECLARE_WRITE16_MEMBER( rom_5987_bank_w ); DECLARE_WRITE16_MEMBER( rom_837_7525_bank_w ); - DECLARE_READ16_MEMBER( io_chip_r ); - DECLARE_WRITE16_MEMBER( io_chip_w ); + DECLARE_WRITE8_MEMBER( misc_outputs_w ); DECLARE_READ16_MEMBER( misc_io_r ); DECLARE_WRITE16_MEMBER( misc_io_w ); DECLARE_WRITE8_MEMBER( soundbank_w ); DECLARE_WRITE8_MEMBER( mcu_data_w ); - DECLARE_READ16_MEMBER( genesis_vdp_r ); - DECLARE_WRITE16_MEMBER( genesis_vdp_w ); - - DECLARE_WRITE_LINE_MEMBER(vdp_sndirqline_callback_s18); - DECLARE_WRITE_LINE_MEMBER(vdp_lv6irqline_callback_s18); - DECLARE_WRITE_LINE_MEMBER(vdp_lv4irqline_callback_s18); - + DECLARE_WRITE_LINE_MEMBER(ym3438_irq_handler); // custom I/O DECLARE_READ16_MEMBER( ddcrew_custom_io_r ); DECLARE_READ16_MEMBER( lghost_custom_io_r ); + DECLARE_WRITE8_MEMBER( lghost_gun_recoil_w ); DECLARE_WRITE16_MEMBER( lghost_custom_io_w ); DECLARE_READ16_MEMBER( wwally_custom_io_r ); DECLARE_WRITE16_MEMBER( wwally_custom_io_w ); @@ -90,11 +85,18 @@ public: // video rendering UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE16_MEMBER( sega_tileram_0_w ) { m_segaic16vid->segaic16_tileram_0_w(space,offset,data,mem_mask); }; - DECLARE_WRITE16_MEMBER( sega_textram_0_w ) { m_segaic16vid->segaic16_textram_0_w(space,offset,data,mem_mask); }; - - DECLARE_WRITE_LINE_MEMBER(ym3438_irq_handler); + DECLARE_WRITE_LINE_MEMBER(vdp_sndirqline_callback_s18); + DECLARE_WRITE_LINE_MEMBER(vdp_lv6irqline_callback_s18); + DECLARE_WRITE_LINE_MEMBER(vdp_lv4irqline_callback_s18); + DECLARE_READ16_MEMBER( genesis_vdp_r ) { return m_vdp->vdp_r(space, offset, mem_mask); } + DECLARE_WRITE16_MEMBER( genesis_vdp_w ) { m_vdp->vdp_w(space, offset, data, mem_mask); } + DECLARE_WRITE16_MEMBER( sega_tileram_0_w ) { m_segaic16vid->segaic16_tileram_0_w(space, offset, data, mem_mask); } + DECLARE_WRITE16_MEMBER( sega_textram_0_w ) { m_segaic16vid->segaic16_textram_0_w(space, offset, data, mem_mask); } + + DECLARE_WRITE_LINE_MEMBER(set_grayscale); + DECLARE_WRITE_LINE_MEMBER(set_vdp_enable); + protected: // timer IDs enum @@ -110,7 +112,6 @@ protected: ROM_BOARD_171_5874, // 171-5874 ROM_BOARD_171_5987, // 171-5987 ROM_BOARD_837_7525 // Hammer Away proto - }; // device overrides @@ -120,8 +121,6 @@ protected: // internal helpers void init_generic(segas18_rom_board rom_board); - void set_grayscale(bool enable); - void set_vdp_enable(bool enable); void set_vdp_mixing(UINT8 mixing); void draw_vdp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority); @@ -131,9 +130,11 @@ protected: required_device m_soundcpu; optional_device m_mcu; required_device m_vdp; + required_device m_io; required_device m_nvram; required_device m_sprites; required_device m_segaic16vid; + required_device m_gfxdecode; // memory pointers required_shared_ptr m_workram; @@ -142,21 +143,17 @@ protected: segas18_rom_board m_romboard; read16_delegate m_custom_io_r; write16_delegate m_custom_io_w; - bool m_has_guns; // internal state - bool m_grayscale_enable; - bool m_vdp_enable; + int m_grayscale_enable; + int m_vdp_enable; UINT8 m_vdp_mixing; bitmap_ind16 m_temp_bitmap; UINT8 m_mcu_data; - UINT8 m_misc_io_data[0x10]; // game-specific state UINT8 m_wwally_last_x[3]; UINT8 m_wwally_last_y[3]; UINT8 m_lghost_value; UINT8 m_lghost_select; - - required_device m_gfxdecode; }; diff --git a/src/mame/video/segas18.c b/src/mame/video/segas18.c index fe08ca27803..92b0f1daca8 100644 --- a/src/mame/video/segas18.c +++ b/src/mame/video/segas18.c @@ -29,8 +29,8 @@ void segas18_state::video_start() { m_temp_bitmap.allocate(m_screen->width(), m_screen->height()); - m_grayscale_enable = false; - m_vdp_enable = false; + m_grayscale_enable = 0; + m_vdp_enable = 0; m_vdp_mixing = 0; // initialize the tile/text layers @@ -50,23 +50,23 @@ void segas18_state::video_start() * *************************************/ -void segas18_state::set_grayscale(bool enable) +WRITE_LINE_MEMBER(segas18_state::set_grayscale) { - if (enable != m_grayscale_enable) + if (state != m_grayscale_enable) { m_screen->update_partial(m_screen->vpos()); - m_grayscale_enable = enable; + m_grayscale_enable = state; // osd_printf_debug("Grayscale = %02X\n", enable); } } -void segas18_state::set_vdp_enable(bool enable) +WRITE_LINE_MEMBER(segas18_state::set_vdp_enable) { - if (enable != m_vdp_enable) + if (state != m_vdp_enable) { m_screen->update_partial(m_screen->vpos()); - m_vdp_enable = enable; + m_vdp_enable = state; #if DEBUG_VDP osd_printf_debug("VDP enable = %02X\n", enable); #endif @@ -222,6 +222,7 @@ UINT32 segas18_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, // mix in sprites bitmap_ind16 &sprites = m_sprites->bitmap(); for (const sparse_dirty_rect *rect = m_sprites->first_dirty_rect(cliprect); rect != NULL; rect = rect->next()) + { for (int y = rect->min_y; y <= rect->max_y; y++) { UINT16 *dest = &bitmap.pix(y); @@ -248,6 +249,7 @@ UINT32 segas18_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, } } } + } #if DEBUG_VDP if (m_vdp_enable && machine().input().code_pressed(KEYCODE_V))