diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index 243de5fca66..8ae6af39336 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -1802,8 +1802,6 @@ files { MAME_DIR .. "src/mame/includes/rohga.h", MAME_DIR .. "src/mame/video/rohga.cpp", MAME_DIR .. "src/mame/drivers/shootout.cpp", - MAME_DIR .. "src/mame/includes/shootout.h", - MAME_DIR .. "src/mame/video/shootout.cpp", MAME_DIR .. "src/mame/drivers/sidepckt.cpp", MAME_DIR .. "src/mame/includes/sidepckt.h", MAME_DIR .. "src/mame/video/sidepckt.cpp", @@ -2590,8 +2588,6 @@ files { MAME_DIR .. "src/mame/includes/rocnrope.h", MAME_DIR .. "src/mame/video/rocnrope.cpp", MAME_DIR .. "src/mame/drivers/rollerg.cpp", - MAME_DIR .. "src/mame/includes/rollerg.h", - MAME_DIR .. "src/mame/video/rollerg.cpp", MAME_DIR .. "src/mame/drivers/rungun.cpp", MAME_DIR .. "src/mame/includes/rungun.h", MAME_DIR .. "src/mame/video/rungun.cpp", diff --git a/src/mame/drivers/astinvad.cpp b/src/mame/drivers/astinvad.cpp index 128c9e3e1f8..b5c18154519 100644 --- a/src/mame/drivers/astinvad.cpp +++ b/src/mame/drivers/astinvad.cpp @@ -19,108 +19,148 @@ DIP locations verified for: ***************************************************************************/ #include "emu.h" + #include "cpu/z80/z80.h" #include "machine/i8255.h" #include "sound/samples.h" + #include "emupal.h" #include "screen.h" #include "speaker.h" -#define MASTER_CLOCK XTAL(2'000'000) -#define VIDEO_CLOCK XTAL(4'915'200) +namespace { - -/* sample sound IDs - must match sample file name table below */ -enum -{ - SND_UFO = 0, - SND_SHOT, - SND_BASEHIT, - SND_INVADERHIT, - SND_FLEET1, - SND_FLEET2, - SND_FLEET3, - SND_FLEET4, - SND_UFOHIT, - SND_BONUS -}; - - -class astinvad_state : public driver_device +class base_state : public driver_device { public: - astinvad_state(const machine_config &mconfig, device_type type, const char *tag) + base_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") - , m_ppi8255_0(*this, "ppi8255_0") - , m_ppi8255_1(*this, "ppi8255_1") , m_palette(*this, "palette") , m_videoram(*this, "videoram") , m_samples(*this, "samples") , m_screen(*this, "screen") , m_color_prom(*this, "proms") + , m_cabinet(*this, "CABINET") { } - void spcking2(machine_config &config); - void spaceint(machine_config &config); - void kamikaze(machine_config &config); +protected: + void plot_byte(bitmap_rgb32 &bitmap, uint8_t y, uint8_t x, uint8_t data, uint8_t color); - void init_kamikaze(); - void init_spcking2(); + uint8_t m_sound_state[2]{}; + uint8_t m_screen_flip = 0; - DECLARE_INPUT_CHANGED_MEMBER(spaceint_coin_inserted); - -private: - void color_latch_w(uint8_t data); - void spaceint_videoram_w(offs_t offset, uint8_t data); - uint8_t kamikaze_ppi_r(offs_t offset); - void kamikaze_ppi_w(offs_t offset, uint8_t data); - void spaceint_sound1_w(uint8_t data); - void spaceint_sound2_w(uint8_t data); - void kamikaze_sound1_w(uint8_t data); - void kamikaze_sound2_w(uint8_t data); - void spcking2_sound1_w(uint8_t data); - void spcking2_sound2_w(uint8_t data); - void spcking2_sound3_w(uint8_t data); - DECLARE_MACHINE_START(kamikaze); - DECLARE_MACHINE_RESET(kamikaze); - DECLARE_MACHINE_START(spaceint); - DECLARE_MACHINE_RESET(spaceint); - DECLARE_VIDEO_START(spaceint); - uint32_t screen_update_astinvad(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - uint32_t screen_update_spcking2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - uint32_t screen_update_spaceint(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(kamikaze_int_off); - TIMER_CALLBACK_MEMBER(kamikaze_int_gen); - - void kamikaze_map(address_map &map); - void kamikaze_portmap(address_map &map); - void spaceint_map(address_map &map); - void spaceint_portmap(address_map &map); - - void plot_byte( bitmap_rgb32 &bitmap, uint8_t y, uint8_t x, uint8_t data, uint8_t color ); - - std::unique_ptr m_colorram{}; - emu_timer *m_int_timer = nullptr; - emu_timer *m_int_off_timer = nullptr; - uint8_t m_sound_state[2]{}; - uint8_t m_screen_flip = 0; - uint8_t m_screen_red = 0; - uint8_t m_flip_yoffs = 0; - uint8_t m_color_latch = 0; - bool m_player = false; + // sample sound IDs - must match sample file name table below + enum + { + SND_UFO = 0, + SND_SHOT, + SND_BASEHIT, + SND_INVADERHIT, + SND_FLEET1, + SND_FLEET2, + SND_FLEET3, + SND_FLEET4, + SND_UFOHIT, + SND_BONUS + }; required_device m_maincpu; - optional_device m_ppi8255_0; - optional_device m_ppi8255_1; required_device m_palette; required_shared_ptr m_videoram; required_device m_samples; required_device m_screen; required_region_ptr m_color_prom; + + required_ioport m_cabinet; }; +class kamikaze_state : public base_state +{ +public: + kamikaze_state(const machine_config &mconfig, device_type type, const char *tag) + : base_state(mconfig, type, tag) + , m_ppi8255(*this, "ppi8255_%u", 0U) + { } + + void kamikaze(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + + required_device_array m_ppi8255; + uint8_t m_flip_yoffs = 32; // the flip screen logic adds 32 to the Y after flipping + uint8_t m_screen_red = 0; + +private: + uint8_t ppi_r(offs_t offset); + void ppi_w(offs_t offset, uint8_t data); + void sound1_w(uint8_t data); + void sound2_w(uint8_t data); + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(int_off); + TIMER_CALLBACK_MEMBER(int_gen); + + void prg_map(address_map &map); + void port_map(address_map &map); + + emu_timer *m_int_timer = nullptr; + emu_timer *m_int_off_timer = nullptr; +}; + +class spcking2_state : public kamikaze_state +{ +public: + spcking2_state(const machine_config &mconfig, device_type type, const char *tag) + : kamikaze_state(mconfig, type, tag) + { m_flip_yoffs = 0; } // don't have the schematics, but the blanking must center the screen here + + void spcking2(machine_config &config); + +protected: + virtual void machine_start() override; + +private: + void sound1_w(uint8_t data); + void sound2_w(uint8_t data); + void sound3_w(uint8_t data); + + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + bool m_player = false; +}; + +class spaceint_state : public base_state +{ +public: + spaceint_state(const machine_config &mconfig, device_type type, const char *tag) + : base_state(mconfig, type, tag) + , m_colorram(*this, "colorram", 0x2000, ENDIANNESS_LITTLE) + { } + + void spaceint(machine_config &config); + + DECLARE_INPUT_CHANGED_MEMBER(coin_inserted); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + +private: + void color_latch_w(uint8_t data); + void videoram_w(offs_t offset, uint8_t data); + void sound1_w(uint8_t data); + void sound2_w(uint8_t data); + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void prg_map(address_map &map); + void port_map(address_map &map); + + memory_share_creator m_colorram; + uint8_t m_color_latch = 0; +}; /************************************* * @@ -128,55 +168,39 @@ private: * *************************************/ -VIDEO_START_MEMBER(astinvad_state,spaceint) +void spaceint_state::video_start() { - m_colorram = std::make_unique(m_videoram.bytes()); - save_item(NAME(m_color_latch)); - save_pointer(NAME(m_colorram), m_videoram.bytes()); } -void astinvad_state::color_latch_w(uint8_t data) +void spaceint_state::color_latch_w(uint8_t data) { m_color_latch = data & 0x0f; } -void astinvad_state::spaceint_videoram_w(offs_t offset, uint8_t data) +void spaceint_state::videoram_w(offs_t offset, uint8_t data) { m_videoram[offset] = data; m_colorram[offset] = m_color_latch; } - -/************************************* - * - * Spaceint color RAM handling - * - *************************************/ - -void astinvad_state::plot_byte( bitmap_rgb32 &bitmap, uint8_t y, uint8_t x, uint8_t data, uint8_t color ) +void base_state::plot_byte(bitmap_rgb32 &bitmap, uint8_t y, uint8_t x, uint8_t data, uint8_t color) { uint8_t flip_xor = m_screen_flip & 7; - bitmap.pix(y, x + (0 ^ flip_xor)) = (data & 0x01) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix(y, x + (1 ^ flip_xor)) = (data & 0x02) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix(y, x + (2 ^ flip_xor)) = (data & 0x04) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix(y, x + (3 ^ flip_xor)) = (data & 0x08) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix(y, x + (4 ^ flip_xor)) = (data & 0x10) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix(y, x + (5 ^ flip_xor)) = (data & 0x20) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix(y, x + (6 ^ flip_xor)) = (data & 0x40) ? m_palette->pen_color(color) : rgb_t::black(); - bitmap.pix(y, x + (7 ^ flip_xor)) = (data & 0x80) ? m_palette->pen_color(color) : rgb_t::black(); + for (int i = 0; i < 8; i++) + bitmap.pix(y, x + (i ^ flip_xor)) = BIT(data, i) ? m_palette->pen_color(color) : rgb_t::black(); } -uint32_t astinvad_state::screen_update_astinvad(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +uint32_t kamikaze_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { uint8_t yoffs = m_flip_yoffs & m_screen_flip; - /* render the visible pixels */ + // render the visible pixels for (int y = cliprect.min_y; y <= cliprect.max_y; y++) for (int x = cliprect.min_x & ~7; x <= cliprect.max_x; x += 8) { @@ -189,7 +213,7 @@ uint32_t astinvad_state::screen_update_astinvad(screen_device &screen, bitmap_rg } -uint32_t astinvad_state::screen_update_spcking2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +uint32_t spcking2_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { uint8_t yoffs = m_flip_yoffs & m_screen_flip; @@ -206,14 +230,13 @@ uint32_t astinvad_state::screen_update_spcking2(screen_device &screen, bitmap_rg } -uint32_t astinvad_state::screen_update_spaceint(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +uint32_t spaceint_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint8_t x,y; - for (offs_t offs = 0; offs < m_videoram.bytes(); offs++) { uint8_t data = m_videoram[offs]; uint8_t color = m_colorram[offs]; + uint8_t x, y; if (m_screen_flip) { @@ -226,7 +249,7 @@ uint32_t astinvad_state::screen_update_spaceint(screen_device &screen, bitmap_rg x = offs >> 8 << 3; } - /* this is almost certainly wrong */ + // this is almost certainly wrong offs_t n = ((offs >> 5) & 0xf0) | color; color = m_color_prom[n] & 0x07; @@ -244,36 +267,36 @@ uint32_t astinvad_state::screen_update_spaceint(screen_device &screen, bitmap_rg * *************************************/ -TIMER_CALLBACK_MEMBER(astinvad_state::kamikaze_int_off) +TIMER_CALLBACK_MEMBER(kamikaze_state::int_off) { m_maincpu->set_input_line(0, CLEAR_LINE); } -TIMER_CALLBACK_MEMBER(astinvad_state::kamikaze_int_gen) +TIMER_CALLBACK_MEMBER(kamikaze_state::int_gen) { - /* interrupts are asserted on every state change of the 128V line */ + // interrupts are asserted on every state change of the 128V line m_maincpu->set_input_line(0, ASSERT_LINE); param ^= 128; m_int_timer->adjust(m_screen->time_until_pos(param), param); - /* an RC circuit turns the interrupt off after a short amount of time */ + // an RC circuit turns the interrupt off after a short amount of time m_int_off_timer->adjust(attotime::from_double(300 * 0.1e-6)); } -MACHINE_START_MEMBER(astinvad_state,kamikaze) +void kamikaze_state::machine_start() { - m_int_timer = timer_alloc(FUNC(astinvad_state::kamikaze_int_gen), this); + m_int_timer = timer_alloc(FUNC(kamikaze_state::int_gen), this); m_int_timer->adjust(m_screen->time_until_pos(128), 128); - m_int_off_timer = timer_alloc(FUNC(astinvad_state::kamikaze_int_off), this); + m_int_off_timer = timer_alloc(FUNC(kamikaze_state::int_off), this); save_item(NAME(m_screen_flip)); save_item(NAME(m_screen_red)); save_item(NAME(m_sound_state)); } -MACHINE_RESET_MEMBER(astinvad_state,kamikaze) +void kamikaze_state::machine_reset() { m_screen_flip = 0; m_screen_red = 0; @@ -282,13 +305,13 @@ MACHINE_RESET_MEMBER(astinvad_state,kamikaze) } -MACHINE_START_MEMBER(astinvad_state,spaceint) +void spaceint_state::machine_start() { save_item(NAME(m_screen_flip)); save_item(NAME(m_sound_state)); } -MACHINE_RESET_MEMBER(astinvad_state,spaceint) +void spaceint_state::machine_reset() { m_screen_flip = 0; m_sound_state[0] = 0; @@ -297,9 +320,17 @@ MACHINE_RESET_MEMBER(astinvad_state,spaceint) } -INPUT_CHANGED_MEMBER(astinvad_state::spaceint_coin_inserted) +void spcking2_state::machine_start() { - /* coin insertion causes an NMI */ + kamikaze_state::machine_start(); + + save_item(NAME(m_player)); +} + + +INPUT_CHANGED_MEMBER(spaceint_state::coin_inserted) +{ + // coin insertion causes an NMI m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? ASSERT_LINE : CLEAR_LINE); } @@ -311,26 +342,26 @@ INPUT_CHANGED_MEMBER(astinvad_state::spaceint_coin_inserted) * *************************************/ -uint8_t astinvad_state::kamikaze_ppi_r(offs_t offset) +uint8_t kamikaze_state::ppi_r(offs_t offset) { uint8_t result = 0xff; - /* the address lines are used for /CS; yes, they can overlap! */ + // the address lines are used for /CS; yes, they can overlap! if (!(offset & 4)) - result &= m_ppi8255_0->read(offset); + result &= m_ppi8255[0]->read(offset); if (!(offset & 8)) - result &= m_ppi8255_1->read(offset); + result &= m_ppi8255[1]->read(offset); return result; } -void astinvad_state::kamikaze_ppi_w(offs_t offset, uint8_t data) +void kamikaze_state::ppi_w(offs_t offset, uint8_t data) { - /* the address lines are used for /CS; yes, they can overlap! */ + // the address lines are used for /CS; yes, they can overlap! if (!(offset & 4)) - m_ppi8255_0->write(offset, data); + m_ppi8255[0]->write(offset, data); if (!(offset & 8)) - m_ppi8255_1->write(offset, data); + m_ppi8255[1]->write(offset, data); } @@ -342,9 +373,9 @@ void astinvad_state::kamikaze_ppi_w(offs_t offset, uint8_t data) *************************************/ // Kamikaze -void astinvad_state::kamikaze_sound1_w(uint8_t data) +void kamikaze_state::sound1_w(uint8_t data) { - // d0: ufo sound generator + // d0: UFO sound generator // d1: fire sound generator // d2: tank explosion sound generator // d3: invader destroyed sound generator @@ -365,11 +396,11 @@ void astinvad_state::kamikaze_sound1_w(uint8_t data) machine().sound().system_mute(!BIT(data, 5)); } -void astinvad_state::kamikaze_sound2_w(uint8_t data) +void kamikaze_state::sound2_w(uint8_t data) { // d0: red screen -> to video board // d1: invaders advancing sound generator - // d4: ufo destroyed sound generator + // d4: UFO destroyed sound generator // d5: flip screen -> to video board // other bits: unused @@ -379,12 +410,12 @@ void astinvad_state::kamikaze_sound2_w(uint8_t data) if (bits_gone_hi & 0x02) m_samples->start(5, SND_FLEET1); if (bits_gone_hi & 0x10) m_samples->start(4, SND_UFOHIT); - m_screen_flip = (ioport("CABINET")->read() & data & 0x20) ? 0xff : 0x00; + m_screen_flip = (m_cabinet->read() & data & 0x20) ? 0xff : 0x00; m_screen_red = data & 0x01; } // Space King 2 -void astinvad_state::spcking2_sound1_w(uint8_t data) +void spcking2_state::sound1_w(uint8_t data) { int bits_gone_hi = data & ~m_sound_state[0]; m_sound_state[0] = data; @@ -399,7 +430,7 @@ void astinvad_state::spcking2_sound1_w(uint8_t data) m_screen_red = data & 0x04; // ? } -void astinvad_state::spcking2_sound2_w(uint8_t data) +void spcking2_state::sound2_w(uint8_t data) { int bits_gone_hi = data & ~m_sound_state[1]; m_sound_state[1] = data; @@ -410,17 +441,17 @@ void astinvad_state::spcking2_sound2_w(uint8_t data) if (bits_gone_hi & 0x08) m_samples->start(5, SND_FLEET4); if (bits_gone_hi & 0x10) m_samples->start(4, SND_UFOHIT); - m_screen_flip = (ioport("CABINET")->read() & data & 0x20) ? 0xff : 0x00; + m_screen_flip = (m_cabinet->read() & data & 0x20) ? 0xff : 0x00; m_player = BIT(data, 5); } -void astinvad_state::spcking2_sound3_w(uint8_t data) +void spcking2_state::sound3_w(uint8_t data) { // ? } // Space Intruder -void astinvad_state::spaceint_sound1_w(uint8_t data) +void spaceint_state::sound1_w(uint8_t data) { int bits_gone_hi = data & ~m_sound_state[0]; m_sound_state[0] = data; @@ -437,7 +468,7 @@ void astinvad_state::spaceint_sound1_w(uint8_t data) if (bits_gone_hi & 0x80) m_samples->start(5, SND_FLEET4); } -void astinvad_state::spaceint_sound2_w(uint8_t data) +void spaceint_state::sound2_w(uint8_t data) { int bits_gone_hi = data & ~m_sound_state[1]; m_sound_state[1] = data; @@ -446,7 +477,7 @@ void astinvad_state::spaceint_sound2_w(uint8_t data) if (bits_gone_hi & 0x04) m_samples->start(3, SND_INVADERHIT); - m_screen_flip = (ioport("CABINET")->read() & data & 0x80) ? 0xff : 0x00; + m_screen_flip = (m_cabinet->read() & data & 0x80) ? 0xff : 0x00; } @@ -457,38 +488,38 @@ void astinvad_state::spaceint_sound2_w(uint8_t data) * *************************************/ -void astinvad_state::kamikaze_map(address_map &map) +void kamikaze_state::prg_map(address_map &map) { map.global_mask(0x3fff); map(0x0000, 0x1bff).rom(); map(0x1c00, 0x1fff).ram(); - map(0x2000, 0x3fff).ram().share("videoram"); + map(0x2000, 0x3fff).ram().share(m_videoram); } -void astinvad_state::spaceint_map(address_map &map) +void spaceint_state::prg_map(address_map &map) { map(0x0000, 0x1fff).rom(); map(0x2000, 0x23ff).ram(); - map(0x4000, 0x5fff).ram().w(FUNC(astinvad_state::spaceint_videoram_w)).share("videoram"); + map(0x4000, 0x5fff).ram().w(FUNC(spaceint_state::videoram_w)).share(m_videoram); } -void astinvad_state::kamikaze_portmap(address_map &map) +void kamikaze_state::port_map(address_map &map) { map.global_mask(0xff); - map(0x00, 0xff).rw(FUNC(astinvad_state::kamikaze_ppi_r), FUNC(astinvad_state::kamikaze_ppi_w)); + map(0x00, 0xff).rw(FUNC(kamikaze_state::ppi_r), FUNC(kamikaze_state::ppi_w)); } -void astinvad_state::spaceint_portmap(address_map &map) +void spaceint_state::port_map(address_map &map) { map.global_mask(0xff); map(0x00, 0x00).portr("IN0"); map(0x01, 0x01).portr("IN1"); - map(0x02, 0x02).w(FUNC(astinvad_state::spaceint_sound1_w)); - map(0x03, 0x03).w(FUNC(astinvad_state::color_latch_w)); - map(0x04, 0x04).w(FUNC(astinvad_state::spaceint_sound2_w)); + map(0x02, 0x02).w(FUNC(spaceint_state::sound1_w)); + map(0x03, 0x03).w(FUNC(spaceint_state::color_latch_w)); + map(0x04, 0x04).w(FUNC(spaceint_state::sound2_w)); } @@ -585,17 +616,17 @@ static INPUT_PORTS_START( spaceint ) PORT_START("IN1") PORT_DIPUNUSED( 0x01, IP_ACTIVE_HIGH ) - PORT_DIPNAME( 0x06, 0x00, DEF_STR( Lives ) ) /* code at 0x0d4a */ + PORT_DIPNAME( 0x06, 0x00, DEF_STR( Lives ) ) // code at 0x0d4a PORT_DIPSETTING( 0x00, "3" ) PORT_DIPSETTING( 0x04, "4" ) PORT_DIPSETTING( 0x02, "5" ) -// PORT_DIPSETTING( 0x06, "5" ) /* duplicate settings */ + PORT_DIPSETTING( 0x06, "5" ) // duplicate settings PORT_DIPNAME( 0x08, 0x00, DEF_STR( Coinage ) ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) ) PORT_START("IN2") - PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, astinvad_state,spaceint_coin_inserted, 0) + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, spaceint_state, coin_inserted, 0) PORT_START("CABINET") PORT_DIPNAME( 0xff, 0x00, DEF_STR( Cabinet ) ) @@ -607,11 +638,11 @@ static INPUT_PORTS_START( spaceintj ) PORT_INCLUDE( spaceint ) PORT_MODIFY("IN1") - PORT_DIPNAME( 0x06, 0x00, DEF_STR( Lives ) ) /* code at 0x0d37 */ + PORT_DIPNAME( 0x06, 0x00, DEF_STR( Lives ) ) // code at 0x0d37 PORT_DIPSETTING( 0x00, "3" ) PORT_DIPSETTING( 0x02, "5" ) -// PORT_DIPSETTING( 0x04, "5" ) /* duplicate settings */ -// PORT_DIPSETTING( 0x06, "5" ) /* duplicate settings */ + PORT_DIPSETTING( 0x04, "5" ) // duplicate settings + PORT_DIPSETTING( 0x06, "5" ) // duplicate settings INPUT_PORTS_END @@ -645,33 +676,30 @@ static const char *const astinvad_sample_names[] = * *************************************/ -void astinvad_state::kamikaze(machine_config &config) +void kamikaze_state::kamikaze(machine_config &config) { - /* basic machine hardware */ - Z80(config, m_maincpu, MASTER_CLOCK); - m_maincpu->set_addrmap(AS_PROGRAM, &astinvad_state::kamikaze_map); - m_maincpu->set_addrmap(AS_IO, &astinvad_state::kamikaze_portmap); + // basic machine hardware + Z80(config, m_maincpu, XTAL(2'000'000)); + m_maincpu->set_addrmap(AS_PROGRAM, &kamikaze_state::prg_map); + m_maincpu->set_addrmap(AS_IO, &kamikaze_state::port_map); - MCFG_MACHINE_START_OVERRIDE(astinvad_state, kamikaze) - MCFG_MACHINE_RESET_OVERRIDE(astinvad_state, kamikaze) + I8255A(config, m_ppi8255[0]); + m_ppi8255[0]->in_pa_callback().set_ioport("IN0"); + m_ppi8255[0]->in_pb_callback().set_ioport("IN1"); + m_ppi8255[0]->in_pc_callback().set_ioport("IN2"); - I8255A(config, m_ppi8255_0); - m_ppi8255_0->in_pa_callback().set_ioport("IN0"); - m_ppi8255_0->in_pb_callback().set_ioport("IN1"); - m_ppi8255_0->in_pc_callback().set_ioport("IN2"); + I8255A(config, m_ppi8255[1]); + m_ppi8255[1]->out_pa_callback().set(FUNC(kamikaze_state::sound1_w)); + m_ppi8255[1]->out_pb_callback().set(FUNC(kamikaze_state::sound2_w)); - I8255A(config, m_ppi8255_1); - m_ppi8255_1->out_pa_callback().set(FUNC(astinvad_state::kamikaze_sound1_w)); - m_ppi8255_1->out_pb_callback().set(FUNC(astinvad_state::kamikaze_sound2_w)); - - /* video hardware */ + // video hardware SCREEN(config, m_screen, SCREEN_TYPE_RASTER); - m_screen->set_raw(VIDEO_CLOCK, 320, 0, 256, 256, 32, 256); - m_screen->set_screen_update(FUNC(astinvad_state::screen_update_astinvad)); + m_screen->set_raw(XTAL(4'915'200), 320, 0, 256, 256, 32, 256); + m_screen->set_screen_update(FUNC(kamikaze_state::screen_update)); PALETTE(config, m_palette, palette_device::RBG_3BIT); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); SAMPLES(config, m_samples); @@ -680,43 +708,38 @@ void astinvad_state::kamikaze(machine_config &config) m_samples->add_route(ALL_OUTPUTS, "mono", 0.50); } -void astinvad_state::spcking2(machine_config &config) +void spcking2_state::spcking2(machine_config &config) { kamikaze(config); - /* basic machine hardware */ - m_ppi8255_1->out_pa_callback().set(FUNC(astinvad_state::spcking2_sound1_w)); - m_ppi8255_1->out_pb_callback().set(FUNC(astinvad_state::spcking2_sound2_w)); - m_ppi8255_1->out_pc_callback().set(FUNC(astinvad_state::spcking2_sound3_w)); + // basic machine hardware + m_ppi8255[1]->out_pa_callback().set(FUNC(spcking2_state::sound1_w)); + m_ppi8255[1]->out_pb_callback().set(FUNC(spcking2_state::sound2_w)); + m_ppi8255[1]->out_pc_callback().set(FUNC(spcking2_state::sound3_w)); - /* video hardware */ - m_screen->set_raw(VIDEO_CLOCK, 320, 0, 256, 256, 16, 240); - m_screen->set_screen_update(FUNC(astinvad_state::screen_update_spcking2)); + // video hardware + m_screen->set_raw(XTAL(4'915'200), 320, 0, 256, 256, 16, 240); + m_screen->set_screen_update(FUNC(spcking2_state::screen_update)); } -void astinvad_state::spaceint(machine_config &config) +void spaceint_state::spaceint(machine_config &config) { - /* basic machine hardware */ - Z80(config, m_maincpu, MASTER_CLOCK); /* a guess */ - m_maincpu->set_addrmap(AS_PROGRAM, &astinvad_state::spaceint_map); - m_maincpu->set_addrmap(AS_IO, &astinvad_state::spaceint_portmap); - m_maincpu->set_vblank_int("screen", FUNC(astinvad_state::irq0_line_hold)); - - MCFG_MACHINE_START_OVERRIDE(astinvad_state, spaceint) - MCFG_MACHINE_RESET_OVERRIDE(astinvad_state, spaceint) - - /* video hardware */ - MCFG_VIDEO_START_OVERRIDE(astinvad_state, spaceint) + // basic machine hardware + Z80(config, m_maincpu, 2'000'000); // a guess + m_maincpu->set_addrmap(AS_PROGRAM, &spaceint_state::prg_map); + m_maincpu->set_addrmap(AS_IO, &spaceint_state::port_map); + m_maincpu->set_vblank_int("screen", FUNC(spaceint_state::irq0_line_hold)); + // video hardware SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_size(32*8, 32*8); m_screen->set_visarea(0*8, 32*8-1, 1*8, 31*8-1); m_screen->set_refresh_hz(60); - m_screen->set_screen_update(FUNC(astinvad_state::screen_update_spaceint)); + m_screen->set_screen_update(FUNC(spaceint_state::screen_update)); PALETTE(config, m_palette, palette_device::RBG_3BIT); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); SAMPLES(config, m_samples); @@ -741,7 +764,7 @@ ROM_START( kamikaze ) ROM_LOAD( "km04", 0x1800, 0x0800, CRC(494e1f6d) SHA1(f9626072d80897a977c10fe9523a8b608f1f7b7c) ) ROM_REGION( 0x0400, "proms", 0 ) - ROM_LOAD( "ai_vid_c.rom", 0x0000, 0x0400, BAD_DUMP CRC(b45287ff) SHA1(7e558eaf402641d7ff60171f854030219fbf9a59) ) + ROM_LOAD( "ai_vid_c.rom", 0x0000, 0x0400, BAD_DUMP CRC(b45287ff) SHA1(7e558eaf402641d7ff60171f854030219fbf9a59) ) ROM_END ROM_START( astinvad ) @@ -772,6 +795,20 @@ ROM_START( kosmokil ) ROM_LOAD( "40.bin", 0x0000, 0x0400, CRC(d62a3e62) SHA1(00d42988203fbf167791cf5b887f06d1d015e942) ) ROM_END +ROM_START( betafrce ) // 3 ROMs are identical to the kosmokil ones + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "b1", 0x0000, 0x0400, CRC(d5e4ce6b) SHA1(19d8b9df8cbfe674ea45b0137d98951117a4b890) ) + ROM_LOAD( "2k", 0x0400, 0x0400, CRC(786599d2) SHA1(70db8dae052c3556948d75b741ef4346aa947479) ) + ROM_LOAD( "3k", 0x0800, 0x0400, CRC(12621222) SHA1(062b1dff3e129dff23e55bef0d29c72ac5f212c4) ) + ROM_LOAD( "4k", 0x0c00, 0x0400, CRC(0c5b8988) SHA1(a77fd2c58ee640973653b8af34b7ed3d81cae935) ) + ROM_LOAD( "5k", 0x1000, 0x0400, CRC(5e8b2b6f) SHA1(ec8499325d5a3dcb0d10e9f12b9d3a03f629bbfd) ) + ROM_LOAD( "6k", 0x1400, 0x0400, CRC(20cd429b) SHA1(a7d3216c005a7905b3549a4eee6c47fc5a9621fc) ) + ROM_LOAD( "7k", 0x1800, 0x0400, CRC(637bf292) SHA1(baf40f5a04331c4cf2b83830f3203bd65a2bb271) ) + + ROM_REGION( 0x0400, "proms", 0 ) + ROM_LOAD( "40.bin", 0x0000, 0x0400, BAD_DUMP CRC(d62a3e62) SHA1(00d42988203fbf167791cf5b887f06d1d015e942) ) // not dumped for this set, taken from kosmokil +ROM_END + ROM_START( spcking2 ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "1.bin", 0x0000, 0x0400, CRC(716fe9e0) SHA1(d5131abf6e3e6650ff9f649a999bf1d8ae8afb78) ) @@ -809,29 +846,7 @@ ROM_START( spaceintj ) ROM_LOAD( "clr", 0x0000, 0x0100, BAD_DUMP CRC(13c1803f) SHA1(da59bf63d9e84aca32904c107674bc89974648eb) ) ROM_END - - -/************************************* - * - * Driver initialization - * - *************************************/ - -void astinvad_state::init_kamikaze() -{ - /* the flip screen logic adds 32 to the Y after flipping */ - m_flip_yoffs = 32; -} - - -void astinvad_state::init_spcking2() -{ - /* don't have the schematics, but the blanking must center the screen here */ - m_flip_yoffs = 0; - - save_item(NAME(m_player)); -} - +} // anonymous namespace /************************************* @@ -840,9 +855,10 @@ void astinvad_state::init_spcking2() * *************************************/ -GAME( 1980, kamikaze, 0, kamikaze, kamikaze, astinvad_state, init_kamikaze, ROT270, "Leijac Corporation", "Kamikaze", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1980, astinvad, kamikaze, kamikaze, astinvad, astinvad_state, init_kamikaze, ROT270, "Leijac Corporation (Stern Electronics license)", "Astro Invader", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1980?, kosmokil, kamikaze, kamikaze, kamikaze, astinvad_state, init_kamikaze, ROT270, "bootleg (BEM)", "Kosmo Killer", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // says >BEM< Mi Italy but it looks hacked in, dif revision of game tho. -GAME( 1979, spcking2, 0, spcking2, spcking2, astinvad_state, init_spcking2, ROT270, "Konami", "Space King 2", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) -GAME( 1980, spaceint, 0, spaceint, spaceint, astinvad_state, empty_init, ROT90, "Shoei", "Space Intruder", MACHINE_IMPERFECT_SOUND | MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) -GAME( 1980, spaceintj, spaceint, spaceint, spaceintj, astinvad_state, empty_init, ROT90, "Shoei", "Space Intruder (Japan)", MACHINE_IMPERFECT_SOUND | MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) +GAME( 1980, kamikaze, 0, kamikaze, kamikaze, kamikaze_state, empty_init, ROT270, "Leijac Corporation", "Kamikaze", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1980, astinvad, kamikaze, kamikaze, astinvad, kamikaze_state, empty_init, ROT270, "Leijac Corporation (Stern Electronics license)", "Astro Invader", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1980?, kosmokil, kamikaze, kamikaze, kamikaze, kamikaze_state, empty_init, ROT270, "bootleg (BEM)", "Kosmo Killer", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // says >BEM< Mi Italy but it looks hacked in, different revision of game tho. +GAME( 1980?, betafrce, kamikaze, kamikaze, kamikaze, kamikaze_state, empty_init, ROT270, "bootleg (Omni)", "Beta Force", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1979, spcking2, 0, spcking2, spcking2, spcking2_state, empty_init, ROT270, "Konami", "Space King 2", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) +GAME( 1980, spaceint, 0, spaceint, spaceint, spaceint_state, empty_init, ROT90, "Shoei", "Space Intruder", MACHINE_IMPERFECT_SOUND | MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) +GAME( 1980, spaceintj, spaceint, spaceint, spaceintj, spaceint_state, empty_init, ROT90, "Shoei", "Space Intruder (Japan)", MACHINE_IMPERFECT_SOUND | MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/rollerg.cpp b/src/mame/drivers/rollerg.cpp index 20ba0ea1261..e5d155b4c19 100644 --- a/src/mame/drivers/rollerg.cpp +++ b/src/mame/drivers/rollerg.cpp @@ -13,9 +13,14 @@ ***************************************************************************/ #include "emu.h" -#include "includes/rollerg.h" +#include "video/k051316.h" +#include "video/k053244_k053245.h" +#include "video/konami_helper.h" + +#include "cpu/m6809/konami.h" // for the callback and the firq irq definition #include "cpu/z80/z80.h" +#include "machine/k053252.h" #include "machine/watchdog.h" #include "sound/k053260.h" #include "sound/ymopl.h" @@ -24,29 +29,137 @@ #include "speaker.h" +// configurable logging +#define LOG_UNKWRITE (1U << 1) + +//#define VERBOSE (LOG_GENERAL | LOG_UNKWRITE) + +#include "logmacro.h" + +#define LOGUNKWRITE(...) LOGMASKED(LOG_UNKWRITE, __VA_ARGS__) + + +namespace { + +class rollerg_state : public driver_device +{ +public: + rollerg_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_audiocpu(*this, "audiocpu"), + m_k053244(*this, "k053244"), + m_k051316(*this, "k051316"), + m_mainbank(*this, "mainbank"), + m_zoomroms_view(*this, "zoomroms_view") + { } + + void rollerg(machine_config &config); + +protected: + virtual void machine_start() override; + +private: + // devices + required_device m_maincpu; + required_device m_audiocpu; + required_device m_k053244; + required_device m_k051316; + + required_memory_bank m_mainbank; + + memory_view m_zoomroms_view; + + // misc + emu_timer *m_nmi_timer = nullptr; + + void ext_enable_w(uint8_t data); + void soundirq_w(uint8_t data); + void sound_arm_nmi_w(uint8_t data); + uint8_t pip_r(); + DECLARE_WRITE_LINE_MEMBER(irq_ack_w); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + K05324X_CB_MEMBER(sprite_callback); + K051316_CB_MEMBER(zoom_callback); + + void main_map(address_map &map); + void sound_map(address_map &map); + + TIMER_CALLBACK_MEMBER(sound_nmi); +}; + + +// video + +/*************************************************************************** + + Callbacks for the K053245 + +***************************************************************************/ + +K05324X_CB_MEMBER(rollerg_state::sprite_callback) +{ + enum { sprite_colorbase = 256 / 16 }; +#if 0 + if (machine().input().code_pressed(KEYCODE_Q) && (*color & 0x80)) *color = machine().rand(); + if (machine().input().code_pressed(KEYCODE_W) && (*color & 0x40)) *color = machine().rand(); + if (machine().input().code_pressed(KEYCODE_E) && (*color & 0x20)) *color = machine().rand(); + if (machine().input().code_pressed(KEYCODE_R) && (*color & 0x10)) *color = machine().rand(); +#endif + *priority = (*color & 0x10) ? 0 : 0x02; + *color = sprite_colorbase + (*color & 0x0f); +} + + +/*************************************************************************** + + Callbacks for the K051316 + +***************************************************************************/ + +K051316_CB_MEMBER(rollerg_state::zoom_callback) +{ + *flags = TILE_FLIPYX((*color & 0xc0) >> 6); + *code |= ((*color & 0x0f) << 8); + *color = ((*color & 0x30) >> 4); +} + + +/*************************************************************************** + + Display refresh + +***************************************************************************/ + +uint32_t rollerg_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int bg_colorbase = 16; + + screen.priority().fill(0, cliprect); + bitmap.fill(16 * bg_colorbase, cliprect); + m_k051316->zoom_draw(screen, bitmap, cliprect, 0, 1); + m_k053244->sprites_draw(bitmap, cliprect, screen.priority()); + return 0; +} + + +// machine + void rollerg_state::ext_enable_w(uint8_t data) { - logerror("%04x: write %02x to 0010\n",m_maincpu->pc(), data); + LOGUNKWRITE("%04x: write %02x to 0010\n", m_maincpu->pc(), data); - /* bits 0/1 are coin counters */ + // bits 0/1 are coin counters machine().bookkeeping().coin_counter_w(0, data & 0x01); machine().bookkeeping().coin_counter_w(1, data & 0x02); - /* bit 2 enables 051316 ROM reading */ - m_readzoomroms = data & 0x04; + // bit 2 enables 051316 ROM reading + BIT(data, 2) ? m_zoomroms_view.select(0) : m_zoomroms_view.disable(); - /* bit 5 enables 051316 wraparound */ + // bit 5 enables 051316 wraparound m_k051316->wraparound_enable(data & 0x20); - /* other bits unknown */ -} - -uint8_t rollerg_state::k051316_r(offs_t offset) -{ - if (m_readzoomroms) - return m_k051316->rom_r(offset); - else - return m_k051316->read(offset); + // other bits unknown } void rollerg_state::soundirq_w(uint8_t data) @@ -62,7 +175,7 @@ TIMER_CALLBACK_MEMBER(rollerg_state::sound_nmi) void rollerg_state::sound_arm_nmi_w(uint8_t data) { m_audiocpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); - m_nmi_timer->adjust(attotime::from_usec(50)); /* kludge until the K053260 is emulated correctly */ + m_nmi_timer->adjust(attotime::from_usec(50)); // kludge until the K053260 is emulated correctly } uint8_t rollerg_state::pip_r() @@ -81,16 +194,18 @@ void rollerg_state::main_map(address_map &map) map(0x0052, 0x0052).portr("DSW3"); map(0x0053, 0x0053).portr("DSW1"); map(0x0060, 0x0060).portr("DSW2"); - map(0x0061, 0x0061).r(FUNC(rollerg_state::pip_r)); /* ????? */ - map(0x0100, 0x010f).rw(m_k053252, FUNC(k053252_device::read), FUNC(k053252_device::write)); /* 053252? */ + map(0x0061, 0x0061).r(FUNC(rollerg_state::pip_r)); // ????? + map(0x0100, 0x010f).rw("k053252", FUNC(k053252_device::read), FUNC(k053252_device::write)); // 053252? map(0x0200, 0x020f).w(m_k051316, FUNC(k051316_device::ctrl_w)); map(0x0300, 0x030f).rw(m_k053244, FUNC(k05324x_device::k053244_r), FUNC(k05324x_device::k053244_w)); - map(0x0800, 0x0fff).r(FUNC(rollerg_state::k051316_r)).w(m_k051316, FUNC(k051316_device::write)); + map(0x0800, 0x0fff).rw(m_k051316, FUNC(k051316_device::read), FUNC(k051316_device::write)); + map(0x0800, 0x0fff).view(m_zoomroms_view); + m_zoomroms_view[0](0x0800, 0x0fff).r(m_k051316, FUNC(k051316_device::rom_r)); map(0x1000, 0x17ff).rw(m_k053244, FUNC(k05324x_device::k053245_r), FUNC(k05324x_device::k053245_w)); map(0x1800, 0x1fff).ram().w("palette", FUNC(palette_device::write8)).share("palette"); map(0x2000, 0x3aff).ram(); - map(0x4000, 0x7fff).bankr("bank1"); - map(0x8000, 0xffff).rom(); + map(0x4000, 0x7fff).bankr(m_mainbank); + map(0x8000, 0xffff).rom().region("maincpu", 0x18000); } void rollerg_state::sound_map(address_map &map) @@ -164,7 +279,7 @@ static INPUT_PORTS_START( rollerg ) PORT_DIPSETTING( 0xa0, DEF_STR( 1C_6C ) ) PORT_DIPSETTING( 0x90, DEF_STR( 1C_7C ) ) PORT_DIPSETTING( 0x00, "No Credits" ) - /* No Credits = both coin slots open, but no effect on coin counters */ + // No Credits = both coin slots open, but no effect on coin counters PORT_START("DSW2") PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2") @@ -172,7 +287,7 @@ static INPUT_PORTS_START( rollerg ) PORT_DIPSETTING( 0x02, "2" ) PORT_DIPSETTING( 0x01, "3" ) PORT_DIPSETTING( 0x00, "5" ) - PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x04, "SW2:3" ) /* Manual says it's unused */ + PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x04, "SW2:3" ) // Manual says it's unused PORT_DIPNAME( 0x18, 0x10, "Bonus Energy" ) PORT_DIPLOCATION("SW2:4,5") PORT_DIPSETTING( 0x00, "1/2 for Stage Winner" ) PORT_DIPSETTING( 0x08, "1/4 for Stage Winner" ) @@ -191,9 +306,9 @@ static INPUT_PORTS_START( rollerg ) PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW3:1") PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x02, "SW3:2" ) /* Manual says it's unused */ + PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x02, "SW3:2" ) // Manual says it's unused PORT_SERVICE_DIPLOC( 0x04, IP_ACTIVE_LOW, "SW3:3" ) - PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW3:4" ) /* Manual says it's unused */ + PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW3:4" ) // Manual says it's unused PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) @@ -208,7 +323,7 @@ INPUT_PORTS_END ***************************************************************************/ -WRITE_LINE_MEMBER(rollerg_state::rollerg_irq_ack_w) +WRITE_LINE_MEMBER(rollerg_state::irq_ack_w) { m_maincpu->set_input_line(0, CLEAR_LINE); } @@ -217,42 +332,31 @@ void rollerg_state::machine_start() { uint8_t *ROM = memregion("maincpu")->base(); - membank("bank1")->configure_entries(0, 6, &ROM[0x10000], 0x4000); - membank("bank1")->configure_entries(6, 2, &ROM[0x10000], 0x4000); - membank("bank1")->set_entry(0); + m_mainbank->configure_entries(0, 6, &ROM[0x00000], 0x4000); + m_mainbank->configure_entries(6, 2, &ROM[0x00000], 0x4000); + m_mainbank->set_entry(0); m_nmi_timer = timer_alloc(FUNC(rollerg_state::sound_nmi), this); - - save_item(NAME(m_readzoomroms)); } -void rollerg_state::machine_reset() -{ - m_readzoomroms = 0; -} - -void rollerg_state::banking_callback(uint8_t data) -{ - membank("bank1")->set_entry(data & 0x07); -} void rollerg_state::rollerg(machine_config &config) { - /* basic machine hardware */ - KONAMI(config, m_maincpu, 3000000); /* ? */ + // basic machine hardware + KONAMI(config, m_maincpu, 24_MHz_XTAL / 8); // divider not verified m_maincpu->set_addrmap(AS_PROGRAM, &rollerg_state::main_map); m_maincpu->set_vblank_int("screen", FUNC(rollerg_state::irq0_line_assert)); - m_maincpu->line().set(FUNC(rollerg_state::banking_callback)); + m_maincpu->line().set_membank(m_mainbank).mask(0x07); - Z80(config, m_audiocpu, 3579545); - m_audiocpu->set_addrmap(AS_PROGRAM, &rollerg_state::sound_map); /* NMIs are generated by the 053260 */ + Z80(config, m_audiocpu, 3.579545_MHz_XTAL); + m_audiocpu->set_addrmap(AS_PROGRAM, &rollerg_state::sound_map); // NMIs are generated by the 053260 WATCHDOG_TIMER(config, "watchdog"); - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60); - screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */ + screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate screen.set_size(64*8, 32*8); screen.set_visarea(14*8, (64-14)*8-1, 2*8, 30*8-1); screen.set_screen_update(FUNC(rollerg_state::screen_update)); @@ -270,15 +374,15 @@ void rollerg_state::rollerg(machine_config &config) m_k051316->set_offsets(22, 1); m_k051316->set_zoom_callback(FUNC(rollerg_state::zoom_callback)); - K053252(config, m_k053252, 3000000*2); - m_k053252->int1_ack().set(FUNC(rollerg_state::rollerg_irq_ack_w)); - m_k053252->set_offsets(14*8, 2*8); + k053252_device &k053252(K053252(config, "k053252", 3000000 * 2)); + k053252.int1_ack().set(FUNC(rollerg_state::irq_ack_w)); + k053252.set_offsets(14*8, 2*8); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); - YM3812(config, "ymsnd", 3579545).add_route(ALL_OUTPUTS, "mono", 1.0); - K053260(config, "k053260", 3579545).add_route(ALL_OUTPUTS, "mono", 0.70); + YM3812(config, "ymsnd", 3.579545_MHz_XTAL).add_route(ALL_OUTPUTS, "mono", 1.0); + K053260(config, "k053260", 3.579545_MHz_XTAL).add_route(ALL_OUTPUTS, "mono", 0.70); } @@ -290,45 +394,44 @@ void rollerg_state::rollerg(machine_config &config) ***************************************************************************/ ROM_START( rollerg ) - ROM_REGION( 0x28000, "maincpu", 0 ) /* code + banked roms */ - ROM_LOAD( "999m02.g7", 0x10000, 0x18000, CRC(3df8db93) SHA1(10c46d53d11b12b8f7cc6417601baef4638c1efe) ) - ROM_CONTINUE( 0x08000, 0x08000 ) + ROM_REGION( 0x20000, "maincpu", 0 ) + ROM_LOAD( "999m02.g7", 0x00000, 0x20000, CRC(3df8db93) SHA1(10c46d53d11b12b8f7cc6417601baef4638c1efe) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */ + ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "999m01.e11", 0x0000, 0x8000, CRC(1fcfb22f) SHA1(ef058a7de6ba7cf310b91975345113acc6078f8a) ) - ROM_REGION( 0x200000, "k053244", 0 ) - ROM_LOAD32_WORD( "999h06.k2", 0x000000, 0x100000, CRC(eda05130) SHA1(b52073a4a4651035d5f1e112601ceb2d004b2143) ) /* sprites */ + ROM_REGION( 0x200000, "k053244", 0 ) // sprites + ROM_LOAD32_WORD( "999h06.k2", 0x000000, 0x100000, CRC(eda05130) SHA1(b52073a4a4651035d5f1e112601ceb2d004b2143) ) ROM_LOAD32_WORD( "999h05.k8", 0x000002, 0x100000, CRC(5f321c7d) SHA1(d60a3480891b83ac109f2fecfe2b958bac310c15) ) - ROM_REGION( 0x080000, "k051316", 0 ) - ROM_LOAD( "999h03.d23", 0x000000, 0x040000, CRC(ea1edbd2) SHA1(a17d19f873384287e1e47222d46274e7408b40d4) ) /* zoom */ + ROM_REGION( 0x080000, "k051316", 0 ) // zoom + ROM_LOAD( "999h03.d23", 0x000000, 0x040000, CRC(ea1edbd2) SHA1(a17d19f873384287e1e47222d46274e7408b40d4) ) ROM_LOAD( "999h04.f23", 0x040000, 0x040000, CRC(c1a35355) SHA1(615606d30500a8f2be19171893e985b085fff2fc) ) - ROM_REGION( 0x80000, "k053260", 0 ) /* samples for 053260 */ + ROM_REGION( 0x80000, "k053260", 0 ) // samples ROM_LOAD( "999h09.c5", 0x000000, 0x080000, CRC(c5188783) SHA1(d9ab69e4197ba2b42e3b0bb713236c8037fc2ab3) ) ROM_END ROM_START( rollergj ) - ROM_REGION( 0x28000, "maincpu", 0 ) /* code + banked roms */ - ROM_LOAD( "999v02.bin", 0x10000, 0x18000, CRC(0dd8c3ac) SHA1(4c3d5514dec317c6640ceaaa06411766632f4412) ) - ROM_CONTINUE( 0x08000, 0x08000 ) + ROM_REGION( 0x20000, "maincpu", 0 ) + ROM_LOAD( "999v02.bin", 0x00000, 0x20000, CRC(0dd8c3ac) SHA1(4c3d5514dec317c6640ceaaa06411766632f4412) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for the sound CPU */ + ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "999m01.e11", 0x0000, 0x8000, CRC(1fcfb22f) SHA1(ef058a7de6ba7cf310b91975345113acc6078f8a) ) - ROM_REGION( 0x200000, "k053244", 0 ) - ROM_LOAD32_WORD( "999h06.k2", 0x000000, 0x100000, CRC(eda05130) SHA1(b52073a4a4651035d5f1e112601ceb2d004b2143) ) /* sprites */ + ROM_REGION( 0x200000, "k053244", 0 ) // sprites + ROM_LOAD32_WORD( "999h06.k2", 0x000000, 0x100000, CRC(eda05130) SHA1(b52073a4a4651035d5f1e112601ceb2d004b2143) ) ROM_LOAD32_WORD( "999h05.k8", 0x000002, 0x100000, CRC(5f321c7d) SHA1(d60a3480891b83ac109f2fecfe2b958bac310c15) ) - ROM_REGION( 0x080000, "k051316", 0 ) - ROM_LOAD( "999h03.d23", 0x000000, 0x040000, CRC(ea1edbd2) SHA1(a17d19f873384287e1e47222d46274e7408b40d4) ) /* zoom */ + ROM_REGION( 0x080000, "k051316", 0 ) // zoom + ROM_LOAD( "999h03.d23", 0x000000, 0x040000, CRC(ea1edbd2) SHA1(a17d19f873384287e1e47222d46274e7408b40d4) ) ROM_LOAD( "999h04.f23", 0x040000, 0x040000, CRC(c1a35355) SHA1(615606d30500a8f2be19171893e985b085fff2fc) ) - ROM_REGION( 0x80000, "k053260", 0 ) /* samples for 053260 */ + ROM_REGION( 0x80000, "k053260", 0 ) // samples ROM_LOAD( "999h09.c5", 0x000000, 0x080000, CRC(c5188783) SHA1(d9ab69e4197ba2b42e3b0bb713236c8037fc2ab3) ) ROM_END +} // anonymous namespace /*************************************************************************** diff --git a/src/mame/drivers/shootout.cpp b/src/mame/drivers/shootout.cpp index 32caab96293..750241dff83 100644 --- a/src/mame/drivers/shootout.cpp +++ b/src/mame/drivers/shootout.cpp @@ -29,7 +29,7 @@ TODO: - Lots of unmapped memory reads and writes (sprram or vram mirrors, perhaps...), bg_vram is also read. - - Does the korean bootleg really have the DECO 222 CPU? I think it should use the shootclr.003 prom to decrypt the opcodes. + - Does the Korean bootleg really have the DECO 222 CPU? I think it should use the shootclr.003 prom to decrypt the opcodes. Something like -> rom [addr] = (rom [addr] & 0x0F) | proms [rom [addr] >> 4]]); *******************************************************************************/ @@ -37,25 +37,285 @@ /* 2003-06-01 Added cocktail support to shootout - 2003-10-08 Added cocktail support to shootouj/shootoub + 2003-10-08 Added cocktail support to shootoutj/shootoub 2003-10-21 Removed input port hack */ #include "emu.h" -#include "includes/shootout.h" + +#include "machine/deco222.h" #include "cpu/m6502/m6502.h" +#include "machine/gen_latch.h" #include "sound/ymopn.h" -#include "machine/deco222.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" + + +namespace { + +class shootoutj_state : public driver_device +{ +public: + shootoutj_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_spriteram(*this, "spriteram"), + m_textram(*this, "textram"), + m_videoram(*this, "videoram"), + m_mainbank(*this, "mainbank") + { } + + void shootoutj(machine_config &config); + void shootoutk(machine_config &config); + + DECLARE_INPUT_CHANGED_MEMBER(coin_inserted); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + + required_shared_ptr m_spriteram; + required_shared_ptr m_textram; + required_shared_ptr m_videoram; + + required_memory_bank m_mainbank; + + uint8_t m_sprites_bank_bits = 2; + + void flipscreen_w(uint8_t data); + void coincounter_w(uint8_t data); + void videoram_w(offs_t offset, uint8_t data); + void textram_w(offs_t offset, uint8_t data); + + void palette(palette_device &palette) const; + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + +private: + + tilemap_t *m_background = nullptr; + tilemap_t *m_foreground = nullptr; + + uint8_t m_ccnt_old_val = 0; + + TILE_GET_INFO_MEMBER(get_bg_tile_info); + TILE_GET_INFO_MEMBER(get_fg_tile_info); + + void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + void main_map(address_map &map); +}; + +class shootout_state : public shootoutj_state +{ +public: + shootout_state(const machine_config &mconfig, device_type type, const char *tag) : + shootoutj_state(mconfig, type, tag), + m_audiocpu(*this, "audiocpu"), + m_soundlatch(*this, "soundlatch") + { m_sprites_bank_bits = 3; } // the World version has more sprites + + void shootout(machine_config &config); + +private: + required_device m_audiocpu; + required_device m_soundlatch; + + void bankswitch_w(uint8_t data); + uint8_t sound_cpu_command_r(); + void sound_cpu_command_w(uint8_t data); + + void main_map(address_map &map); + void audio_map(address_map &map); +}; + +// video + +void shootoutj_state::palette(palette_device &palette) const +{ + uint8_t const *const color_prom = memregion("proms")->base(); + + for (int i = 0; i < palette.entries(); i++) + { + // red component + int bit0 = BIT(color_prom[i], 0); + int bit1 = BIT(color_prom[i], 1); + int bit2 = BIT(color_prom[i], 2); + int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + // green component + bit0 = BIT(color_prom[i], 3); + bit1 = BIT(color_prom[i], 4); + bit2 = BIT(color_prom[i], 5); + int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + // blue component + bit0 = 0; + bit1 = BIT(color_prom[i], 6); + bit2 = BIT(color_prom[i], 7); + int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + palette.set_pen_color(i, rgb_t(r, g, b)); + } +} + + + +TILE_GET_INFO_MEMBER(shootoutj_state::get_bg_tile_info) +{ + int attributes = m_videoram[tile_index + 0x400]; // CCCC -TTT + int tile_number = m_videoram[tile_index] + 256 * (attributes & 7); + int color = attributes >> 4; + + tileinfo.set(2, + tile_number, + color, + 0); +} + +TILE_GET_INFO_MEMBER(shootoutj_state::get_fg_tile_info) +{ + int attributes = m_textram[tile_index + 0x400]; // CCCC --TT + int tile_number = m_textram[tile_index] + 256 * (attributes & 3); + int color = attributes >> 4; + + tileinfo.set(0, + tile_number, + color, + 0); +} + +void shootoutj_state::videoram_w(offs_t offset, uint8_t data) +{ + m_videoram[offset] = data; + m_background->mark_tile_dirty(offset & 0x3ff); +} + +void shootoutj_state::textram_w(offs_t offset, uint8_t data) +{ + m_textram[offset] = data; + m_foreground->mark_tile_dirty(offset & 0x3ff); +} + +void shootoutj_state::video_start() +{ + m_background = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(shootoutj_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + m_foreground = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(shootoutj_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + m_foreground->set_transparent_pen(0); + + save_item(NAME(m_ccnt_old_val)); +} + +void shootoutj_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + gfx_element *gfx = m_gfxdecode->gfx(1); + const uint8_t *source = m_spriteram + 127 * 4; + + bool bFlicker = (screen.frame_number () & 1) != 0; + + for (int count = 0; count < 128; count ++) + { + int attributes = source[1]; + /* + 76543210 + xxx----- bank + ---x---- vertical size + ----x--- priority + -----x-- horizontal flip + ------x- flicker + -------x enable + */ + if (attributes & 0x01) // visible + { + if (bFlicker || (attributes & 0x02) == 0) + { + int priority_mask = (attributes & 0x08) ? 0x2 : 0; + int sx = (240 - source[2]) & 0xff; + int sy = (240 - source[0]) & 0xff; + int vx, vy; + int number = source[3] | ((attributes << m_sprites_bank_bits) & 0x700); + int flipx = (attributes & 0x04); + int flipy = 0; + + if (flip_screen()) + { + flipx = !flipx; + flipy = !flipy; + } + + if (attributes & 0x10) // double height + { + number = number & (~1); + sy -= 16; + + vx = sx; + vy = sy; + if (flip_screen()) + { + vx = 240 - vx; + vy = 240 - vy; + } + + gfx->prio_transpen(bitmap, cliprect, + number, + 0, //color + flipx, flipy, + vx, vy, + screen.priority(), + priority_mask, 0); + + number++; + sy += 16; + } + + vx = sx; + vy = sy; + if (flip_screen()) + { + vx = 240 - vx; + vy = 240 - vy; + } + + gfx->prio_transpen(bitmap, cliprect, + number, + 0, //color + flipx, flipy, + vx, vy, + screen.priority(), + priority_mask, 0); + } + } + source -= 4; + } +} + +uint32_t shootoutj_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + screen.priority().fill(0, cliprect); + + m_background->draw(screen, bitmap, cliprect, 0, 0); + m_foreground->draw(screen, bitmap, cliprect, 0, 1); + draw_sprites(screen, bitmap, cliprect); + return 0; +} + + +// machine /*******************************************************************************/ void shootout_state::bankswitch_w(uint8_t data) { - membank("bank1")->set_entry(data & 0x0f); + m_mainbank->set_entry(data & 0x0f); } uint8_t shootout_state::sound_cpu_command_r() @@ -73,7 +333,7 @@ void shootout_state::sound_cpu_command_w(uint8_t data) m_maincpu->spin_until_time(attotime::from_usec(200)); } -void shootout_state::flipscreen_w(uint8_t data) +void shootoutj_state::flipscreen_w(uint8_t data) { flip_screen_set(~data & 0x01); } @@ -89,7 +349,7 @@ void shootout_state::flipscreen_w(uint8_t data) This should be an input for a BCD to 7-segment decoder (e.g. a 74LS47), but all the PCBs I've seen don't have 'onboard' display(s), so this was implemented as normal "coin counter" (after all, they both have the same goal: count credits ;)) */ -void shootout_state::coincounter_w(uint8_t data) +void shootoutj_state::coincounter_w(uint8_t data) { if (data != m_ccnt_old_val) { @@ -103,7 +363,7 @@ void shootout_state::coincounter_w(uint8_t data) /*******************************************************************************/ -void shootout_state::shootout_map(address_map &map) +void shootout_state::main_map(address_map &map) { map(0x0000, 0x0fff).ram(); map(0x1000, 0x1000).portr("DSW1").w(FUNC(shootout_state::bankswitch_w)); @@ -111,14 +371,14 @@ void shootout_state::shootout_map(address_map &map) map(0x1002, 0x1002).portr("P2").w(FUNC(shootout_state::coincounter_w)); map(0x1003, 0x1003).portr("DSW2").w(FUNC(shootout_state::sound_cpu_command_w)); map(0x1004, 0x17ff).ram(); - map(0x1800, 0x19ff).ram().share("spriteram"); - map(0x2000, 0x27ff).ram().w(FUNC(shootout_state::textram_w)).share("textram"); - map(0x2800, 0x2fff).ram().w(FUNC(shootout_state::videoram_w)).share("videoram"); - map(0x4000, 0x7fff).bankr("bank1"); + map(0x1800, 0x19ff).ram().share(m_spriteram); + map(0x2000, 0x27ff).ram().w(FUNC(shootout_state::textram_w)).share(m_textram); + map(0x2800, 0x2fff).ram().w(FUNC(shootout_state::videoram_w)).share(m_videoram); + map(0x4000, 0x7fff).bankr(m_mainbank); map(0x8000, 0xffff).rom().region("maincpu", 0x0000); } -void shootout_state::shootouj_map(address_map &map) +void shootoutj_state::main_map(address_map &map) { map(0x0000, 0x0fff).ram(); map(0x1000, 0x1000).portr("DSW1"); @@ -126,19 +386,19 @@ void shootout_state::shootouj_map(address_map &map) map(0x1002, 0x1002).portr("P2"); map(0x1003, 0x1003).portr("DSW2"); map(0x1004, 0x17ff).ram(); - map(0x1800, 0x1800).w(FUNC(shootout_state::coincounter_w)); - map(0x2000, 0x21ff).ram().share("spriteram"); + map(0x1800, 0x1800).w(FUNC(shootoutj_state::coincounter_w)); + map(0x2000, 0x21ff).ram().share(m_spriteram); map(0x2800, 0x2801).rw("ymsnd", FUNC(ym2203_device::read), FUNC(ym2203_device::write)); - map(0x3000, 0x37ff).ram().w(FUNC(shootout_state::textram_w)).share("textram"); - map(0x3800, 0x3fff).ram().w(FUNC(shootout_state::videoram_w)).share("videoram"); - map(0x4000, 0x7fff).bankr("bank1"); + map(0x3000, 0x37ff).ram().w(FUNC(shootoutj_state::textram_w)).share(m_textram); + map(0x3800, 0x3fff).ram().w(FUNC(shootoutj_state::videoram_w)).share(m_videoram); + map(0x4000, 0x7fff).bankr(m_mainbank); map(0x8000, 0xffff).rom().region("maincpu", 0x0000); } /*******************************************************************************/ -/* same as Tryout */ -void shootout_state::shootout_sound_map(address_map &map) +// same as Tryout +void shootout_state::audio_map(address_map &map) { map(0x0000, 0x07ff).ram(); map(0x4000, 0x4001).rw("ymsnd", FUNC(ym2203_device::read), FUNC(ym2203_device::write)); @@ -149,7 +409,7 @@ void shootout_state::shootout_sound_map(address_map &map) /*******************************************************************************/ -INPUT_CHANGED_MEMBER(shootout_state::coin_inserted) +INPUT_CHANGED_MEMBER(shootoutj_state::coin_inserted) { m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? ASSERT_LINE : CLEAR_LINE); } @@ -172,8 +432,8 @@ static INPUT_PORTS_START( shootout ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, shootout_state,coin_inserted, 0) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, shootout_state,coin_inserted, 0) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, shootoutj_state, coin_inserted, 0) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, shootoutj_state, coin_inserted, 0) PORT_START("DSW1") PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) ) PORT_DIPLOCATION( "DSW1:1,2" ) @@ -186,14 +446,14 @@ static INPUT_PORTS_START( shootout ) PORT_DIPSETTING( 0x0c, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) ) PORT_DIPSETTING( 0x04, DEF_STR( 1C_3C ) ) - PORT_DIPUNUSED_DIPLOC( 0x10, IP_ACTIVE_LOW, "DSW1:5" ) /* Manual lists this dip as "Unused" */ + PORT_DIPUNUSED_DIPLOC( 0x10, IP_ACTIVE_LOW, "DSW1:5" ) // Manual lists this dip as "Unused" PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION( "DSW1:6" ) PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x20, DEF_STR( On ) ) PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION( "DSW1:7" ) PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) PORT_DIPSETTING( 0x40, DEF_STR( Cocktail ) ) - PORT_DIPNAME( 0x80, 0x80, "Freeze" ) PORT_DIPLOCATION( "DSW1:8" ) /* Manual lists this dip as "Unused" */ + PORT_DIPNAME( 0x80, 0x80, "Freeze" ) PORT_DIPLOCATION( "DSW1:8" ) // Manual lists this dip as "Unused" PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) @@ -213,11 +473,11 @@ static INPUT_PORTS_START( shootout ) PORT_DIPSETTING( 0x20, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x10, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Very_Hard ) ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_CUSTOM ) // This needs to be low to allows both coins to be accepted... + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_CUSTOM ) // This needs to be low to allow both coins to be accepted... PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen") INPUT_PORTS_END -static INPUT_PORTS_START( shootouj ) +static INPUT_PORTS_START( shootoutj ) PORT_INCLUDE(shootout) PORT_MODIFY("DSW1") @@ -236,66 +496,71 @@ INPUT_PORTS_END static const gfx_layout char_layout = { - 8,8, /* 8*8 characters */ - 0x400, /* 1024 characters */ - 2, /* 2 bits per pixel */ - { 0,4 }, /* the bitplanes are packed in the same byte */ + 8,8, // 8*8 characters + 0x400, // 1024 characters + 2, // 2 bits per pixel + { 0,4 }, // the bitplanes are packed in the same byte { (0x2000*8)+0, (0x2000*8)+1, (0x2000*8)+2, (0x2000*8)+3, 0, 1, 2, 3 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 consecutive bytes */ + 8*8 // every char takes 8 consecutive bytes }; static const gfx_layout sprite_layout = { - 16,16, /* 16*16 sprites */ - 0x800, /* 2048 sprites */ - 3, /* 3 bits per pixel */ - { 0*0x10000*8, 1*0x10000*8, 2*0x10000*8 }, /* the bitplanes are separated */ + 16,16, // 16*16 sprites + 0x800, // 2048 sprites */ + 3, // 3 bits per pixel + { 0*0x10000*8, 1*0x10000*8, 2*0x10000*8 }, // the bitplanes are separated { 128+0, 128+1, 128+2, 128+3, 128+4, 128+5, 128+6, 128+7, 0, 1, 2, 3, 4, 5, 6, 7 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 32*8 /* every char takes 32 consecutive bytes */ + 32*8 // every char takes 32 consecutive bytes }; static const gfx_layout tile_layout = { - 8,8, /* 8*8 characters */ - 0x800, /* 2048 characters */ - 2, /* 2 bits per pixel */ - { 0,4 }, /* the bitplanes are packed in the same byte */ + 8,8, // 8*8 characters + 0x800, // 2048 characters + 2, // 2 bits per pixel + { 0,4 }, // the bitplanes are packed in the same byte */ { (0x4000*8)+0, (0x4000*8)+1, (0x4000*8)+2, (0x4000*8)+3, 0, 1, 2, 3 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 consecutive bytes */ + 8*8 // every char takes 8 consecutive bytes }; static GFXDECODE_START( gfx_shootout ) - GFXDECODE_ENTRY( "gfx1", 0, char_layout, 16*4+8*8, 16 ) /* characters */ - GFXDECODE_ENTRY( "gfx2", 0, sprite_layout, 16*4, 8 ) /* sprites */ - GFXDECODE_ENTRY( "gfx3", 0, tile_layout, 0, 16 ) /* tiles */ + GFXDECODE_ENTRY( "chars", 0, char_layout, 16*4+8*8, 16 ) + GFXDECODE_ENTRY( "sprites", 0, sprite_layout, 16*4, 8 ) + GFXDECODE_ENTRY( "tiles", 0, tile_layout, 0, 16 ) GFXDECODE_END -void shootout_state::machine_reset () +void shootoutj_state::machine_start() +{ + m_mainbank->configure_entries(0, 16, memregion("maincpu")->base() + 0x8000, 0x4000); +} + +void shootoutj_state::machine_reset() { m_ccnt_old_val = 0x40; } void shootout_state::shootout(machine_config &config) { - /* basic machine hardware */ + // basic machine hardware DECO_222(config, m_maincpu, XTAL(12'000'000) / 6); // 2 MHz? - m_maincpu->set_addrmap(AS_PROGRAM, &shootout_state::shootout_map); + m_maincpu->set_addrmap(AS_PROGRAM, &shootout_state::main_map); M6502(config, m_audiocpu, XTAL(12'000'000) / 8); // 1.5 MHz - m_audiocpu->set_addrmap(AS_PROGRAM, &shootout_state::shootout_sound_map); + m_audiocpu->set_addrmap(AS_PROGRAM, &shootout_state::audio_map); - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); // Guessed parameters based on the 12 MHz XTAL, but they seem reasonable (TODO: Real PCB measurements) screen.set_raw(XTAL(12'000'000) / 2, 384, 0, 256, 262, 8, 248); - screen.set_screen_update(FUNC(shootout_state::screen_update_shootout)); + screen.set_screen_update(FUNC(shootout_state::screen_update)); screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_shootout); - PALETTE(config, m_palette, FUNC(shootout_state::shootout_palette), 256); + PALETTE(config, m_palette, FUNC(shootout_state::palette), 256); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, m_soundlatch); @@ -306,73 +571,71 @@ void shootout_state::shootout(machine_config &config) } -void shootout_state::shootouj(machine_config &config) +void shootoutj_state::shootoutj(machine_config &config) { - /* basic machine hardware */ + // basic machine hardware M6502(config, m_maincpu, XTAL(12'000'000) / 6); // 2 MHz? (Assuming the same XTAL as DE-0219 pcb) - m_maincpu->set_addrmap(AS_PROGRAM, &shootout_state::shootouj_map); + m_maincpu->set_addrmap(AS_PROGRAM, &shootoutj_state::main_map); - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); // Guessed parameters based on the 12 MHz XTAL, but they seem reasonable (TODO: Real PCB measurements) screen.set_raw (XTAL(12'000'000) / 2, 384, 0, 256, 262, 8, 248); - screen.set_screen_update(FUNC(shootout_state::screen_update_shootouj)); + screen.set_screen_update(FUNC(shootoutj_state::screen_update)); screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_shootout); - PALETTE(config, m_palette, FUNC(shootout_state::shootout_palette), 256); + PALETTE(config, m_palette, FUNC(shootoutj_state::palette), 256); /* sound hardware */ SPEAKER(config, "mono").front_center(); - GENERIC_LATCH_8(config, m_soundlatch); - ym2203_device &ymsnd(YM2203(config, "ymsnd", XTAL(12'000'000) / 8)); // 1.5 MHz (Assuming the same XTAL as DE-0219 pcb) ymsnd.irq_handler().set_inputline(m_maincpu, M6502_IRQ_LINE); - ymsnd.port_a_write_callback().set(FUNC(shootout_state::bankswitch_w)); - ymsnd.port_b_write_callback().set(FUNC(shootout_state::flipscreen_w)); + ymsnd.port_a_write_callback().set_membank(m_mainbank).mask(0x0f); + ymsnd.port_b_write_callback().set(FUNC(shootoutj_state::flipscreen_w)); ymsnd.add_route(ALL_OUTPUTS, "mono", 1.00); } -void shootout_state::shootouk(machine_config &config) +void shootoutj_state::shootoutk(machine_config &config) { - shootouj(config); - /* the Korean 'bootleg' has the usual DECO222 style encryption */ + shootoutj(config); + // the Korean 'bootleg' has the usual DECO222 style encryption DECO_222(config.replace(), m_maincpu, XTAL(12'000'000) / 6); // 2 MHz? (Assuming the same XTAL as DE-0219 pcb) - m_maincpu->set_addrmap(AS_PROGRAM, &shootout_state::shootouj_map); + m_maincpu->set_addrmap(AS_PROGRAM, &shootoutj_state::main_map); } ROM_START( shootout ) ROM_REGION( 2 * 0x14000, "maincpu", 0 ) // 80k for code + 80k for decrypted opcodes - ROM_LOAD( "cu00.b1", 0x00000, 0x8000, CRC(090edeb6) SHA1(ab849d123dacf3947b1ebd29b70a20e066911a60) ) /* opcodes encrypted */ - ROM_LOAD( "cu02.c3", 0x08000, 0x8000, CRC(2a913730) SHA1(584488278d58c4d34a2eebeaf39518f87cf5eecd) ) /* opcodes encrypted */ - ROM_LOAD( "cu01.c1", 0x10000, 0x4000, CRC(8843c3ae) SHA1(c58ed4acac566f890cadf62bcbcced07a59243fc) ) /* opcodes encrypted */ + ROM_LOAD( "cu00.b1", 0x00000, 0x8000, CRC(090edeb6) SHA1(ab849d123dacf3947b1ebd29b70a20e066911a60) ) // opcodes encrypted + ROM_LOAD( "cu02.c3", 0x08000, 0x8000, CRC(2a913730) SHA1(584488278d58c4d34a2eebeaf39518f87cf5eecd) ) // opcodes encrypted + ROM_LOAD( "cu01.c1", 0x10000, 0x4000, CRC(8843c3ae) SHA1(c58ed4acac566f890cadf62bcbcced07a59243fc) ) // opcodes encrypted ROM_REGION( 0x4000, "audiocpu", 0 ) - ROM_LOAD( "cu09.j1", 0x00000, 0x4000, CRC(c4cbd558) SHA1(0e940ae99febc1161e5f35550aa75afca88cb5e9) ) /* Sound CPU */ + ROM_LOAD( "cu09.j1", 0x00000, 0x4000, CRC(c4cbd558) SHA1(0e940ae99febc1161e5f35550aa75afca88cb5e9) ) - ROM_REGION( 0x04000, "gfx1", 0 ) - ROM_LOAD( "cu11.h19", 0x00000, 0x4000, CRC(eff00460) SHA1(15daaa3d3125a981a26f31d43283faa5be26e96b) ) /* foreground characters */ + ROM_REGION( 0x04000, "chars", 0 ) + ROM_LOAD( "cu11.h19", 0x00000, 0x4000, CRC(eff00460) SHA1(15daaa3d3125a981a26f31d43283faa5be26e96b) ) - ROM_REGION( 0x30000, "gfx2", 0 ) - ROM_LOAD( "cu04.c7", 0x00000, 0x8000, CRC(ceea6b20) SHA1(9fe363668db2e2759b3c531b4d7f23c65f2e8035) ) /* sprites */ + ROM_REGION( 0x30000, "sprites", 0 ) + ROM_LOAD( "cu04.c7", 0x00000, 0x8000, CRC(ceea6b20) SHA1(9fe363668db2e2759b3c531b4d7f23c65f2e8035) ) ROM_LOAD( "cu03.c5", 0x08000, 0x8000, CRC(b786bb3e) SHA1(5a209f01914ca4b206138d738a34640e0bcb3185) ) ROM_LOAD( "cu06.c10", 0x10000, 0x8000, CRC(2ec1d17f) SHA1(74f0579a5ab3daf5d1290d3c15459f0f9b67bf79) ) ROM_LOAD( "cu05.c9", 0x18000, 0x8000, CRC(dd038b85) SHA1(b1c3c1ab17c36a1c77726b5e485fc01581a4d97d) ) ROM_LOAD( "cu08.c13", 0x20000, 0x8000, CRC(91290933) SHA1(60487f4eaf2e6c50b24c0f8fbd7abf92c04a342a) ) ROM_LOAD( "cu07.c12", 0x28000, 0x8000, CRC(19b6b94f) SHA1(292264811206916af41d133f81dfd93c44f59a96) ) - ROM_REGION( 0x08000, "gfx3", 0 ) - ROM_LOAD( "cu10.h17", 0x00000, 0x2000, CRC(3854c877) SHA1(2c8fe4591553ce798c907849e3dbd410e4fe424c) ) /* background tiles */ + ROM_REGION( 0x08000, "tiles", 0 ) + ROM_LOAD( "cu10.h17", 0x00000, 0x2000, CRC(3854c877) SHA1(2c8fe4591553ce798c907849e3dbd410e4fe424c) ) ROM_CONTINUE( 0x04000, 0x2000 ) ROM_CONTINUE( 0x02000, 0x2000 ) ROM_CONTINUE( 0x06000, 0x2000 ) ROM_REGION( 0x0200, "proms", 0 ) ROM_LOAD( "gb08.k10", 0x0000, 0x0100, CRC(509c65b6) SHA1(4cec37065a799ced4e7b6552f267aacc7f54ffe3) ) - ROM_LOAD( "gb09.k6", 0x0100, 0x0100, CRC(aa090565) SHA1(e289e77ec3402e86d93b873c0fa064f3e6277a62) ) /* priority encoder? (not used) */ + ROM_LOAD( "gb09.k6", 0x0100, 0x0100, CRC(aa090565) SHA1(e289e77ec3402e86d93b873c0fa064f3e6277a62) ) // priority encoder? (not used) ROM_END ROM_START( shootoutj ) @@ -381,23 +644,23 @@ ROM_START( shootoutj ) ROM_LOAD( "cg00.bin", 0x08000, 0x8000, CRC(ef6ced1e) SHA1(feea508c7a60fc6cde1efee52cba628accd26028) ) ROM_LOAD( "cg01.bin", 0x10000, 0x4000, CRC(74cf11ca) SHA1(59edbc4633cd560e7b928b33e4c42d0125332a1b) ) - ROM_REGION( 0x04000, "gfx1", 0 ) - ROM_LOAD( "cu11.h19", 0x00000, 0x4000, CRC(eff00460) SHA1(15daaa3d3125a981a26f31d43283faa5be26e96b) ) /* foreground characters */ + ROM_REGION( 0x04000, "chars", 0 ) + ROM_LOAD( "cu11.h19", 0x00000, 0x4000, CRC(eff00460) SHA1(15daaa3d3125a981a26f31d43283faa5be26e96b) ) - ROM_REGION( 0x30000, "gfx2", 0 ) - ROM_LOAD( "cg03.bin", 0x00000, 0x8000, CRC(5252ec19) SHA1(c6848a815badd8845f91e898b0a52b7f12ed8a39) ) /* sprites */ + ROM_REGION( 0x30000, "sprites", 0 ) + ROM_LOAD( "cg03.bin", 0x00000, 0x8000, CRC(5252ec19) SHA1(c6848a815badd8845f91e898b0a52b7f12ed8a39) ) ROM_LOAD( "cg04.bin", 0x10000, 0x8000, CRC(db06cfe9) SHA1(e13c16232f54fe8467c21e0218c87606a19dd25c) ) ROM_LOAD( "cg05.bin", 0x20000, 0x8000, CRC(d634d6b8) SHA1(e2ddd12b1b3fb0063104d414f0574b94dbfa0403) ) - ROM_REGION( 0x08000, "gfx3", 0 ) - ROM_LOAD( "cu10.h17", 0x00000, 0x2000, CRC(3854c877) SHA1(2c8fe4591553ce798c907849e3dbd410e4fe424c) ) /* background tiles */ + ROM_REGION( 0x08000, "tiles", 0 ) + ROM_LOAD( "cu10.h17", 0x00000, 0x2000, CRC(3854c877) SHA1(2c8fe4591553ce798c907849e3dbd410e4fe424c) ) ROM_CONTINUE( 0x04000, 0x2000 ) ROM_CONTINUE( 0x02000, 0x2000 ) ROM_CONTINUE( 0x06000, 0x2000 ) ROM_REGION( 0x0200, "proms", 0 ) ROM_LOAD( "gb08.k10", 0x0000, 0x0100, CRC(509c65b6) SHA1(4cec37065a799ced4e7b6552f267aacc7f54ffe3) ) - ROM_LOAD( "gb09.k6", 0x0100, 0x0100, CRC(aa090565) SHA1(e289e77ec3402e86d93b873c0fa064f3e6277a62) ) /* priority encoder? (not used) */ + ROM_LOAD( "gb09.k6", 0x0100, 0x0100, CRC(aa090565) SHA1(e289e77ec3402e86d93b873c0fa064f3e6277a62) ) // priority encoder? (not used) ROM_END ROM_START( shootoutb ) @@ -406,33 +669,30 @@ ROM_START( shootoutb ) ROM_LOAD( "shootout.008", 0x08000, 0x8000, CRC(9651b656) SHA1(e90eddf2833ef36fa73b7b8d81d28443d2f60220) ) ROM_LOAD( "cg01.bin", 0x10000, 0x4000, CRC(74cf11ca) SHA1(59edbc4633cd560e7b928b33e4c42d0125332a1b) ) - ROM_REGION( 0x04000, "gfx1", 0 ) - ROM_LOAD( "cu11.h19", 0x00000, 0x4000, CRC(eff00460) SHA1(15daaa3d3125a981a26f31d43283faa5be26e96b) ) /* foreground characters */ + ROM_REGION( 0x04000, "chars", 0 ) + ROM_LOAD( "cu11.h19", 0x00000, 0x4000, CRC(eff00460) SHA1(15daaa3d3125a981a26f31d43283faa5be26e96b) ) - ROM_REGION( 0x30000, "gfx2", 0 ) - ROM_LOAD( "shootout.005", 0x00000, 0x8000, CRC(e6357ba3) SHA1(1ceb46450a0c4f6f7f7109601ad6617f08364df5) ) /* sprites */ + ROM_REGION( 0x30000, "sprites", 0 ) + ROM_LOAD( "shootout.005", 0x00000, 0x8000, CRC(e6357ba3) SHA1(1ceb46450a0c4f6f7f7109601ad6617f08364df5) ) ROM_LOAD( "shootout.004", 0x10000, 0x8000, CRC(7f422c93) SHA1(97d9a17956e838801c416461b020876c780bf260) ) ROM_LOAD( "shootout.003", 0x20000, 0x8000, CRC(eea94535) SHA1(65819b7925ecd9ae6e62decb3b0164f627b73fe5) ) - ROM_REGION( 0x08000, "gfx3", 0 ) - ROM_LOAD( "cu10.h17", 0x00000, 0x2000, CRC(3854c877) SHA1(2c8fe4591553ce798c907849e3dbd410e4fe424c) ) /* background tiles */ + ROM_REGION( 0x08000, "tiles", 0 ) + ROM_LOAD( "cu10.h17", 0x00000, 0x2000, CRC(3854c877) SHA1(2c8fe4591553ce798c907849e3dbd410e4fe424c) ) ROM_CONTINUE( 0x04000, 0x2000 ) ROM_CONTINUE( 0x02000, 0x2000 ) ROM_CONTINUE( 0x06000, 0x2000 ) ROM_REGION( 0x0220, "proms", 0 ) ROM_LOAD( "gb08.k10", 0x0000, 0x0100, CRC(509c65b6) SHA1(4cec37065a799ced4e7b6552f267aacc7f54ffe3) ) - ROM_LOAD( "gb09.k6", 0x0100, 0x0100, CRC(aa090565) SHA1(e289e77ec3402e86d93b873c0fa064f3e6277a62) ) /* priority encoder? (not used) */ - ROM_LOAD( "shootclr.003", 0x0200, 0x0020, CRC(6b0c2942) SHA1(7d25acc753923b265792fc78f8fc70175c0e0ec2) ) /* opcode decrypt table (bootleg only) */ + ROM_LOAD( "gb09.k6", 0x0100, 0x0100, CRC(aa090565) SHA1(e289e77ec3402e86d93b873c0fa064f3e6277a62) ) // priority encoder? (not used) + ROM_LOAD( "shootclr.003", 0x0200, 0x0020, CRC(6b0c2942) SHA1(7d25acc753923b265792fc78f8fc70175c0e0ec2) ) // opcode decrypt table (bootleg only) ROM_END +} // anonymous namespace -void shootout_state::init_shootout() -{ - membank("bank1")->configure_entries(0, 16, memregion("maincpu")->base() + 0x8000, 0x4000); -} // ROT180 confirmed by Kold -GAME( 1985, shootout, 0, shootout, shootout, shootout_state, init_shootout, ROT180, "Data East USA", "Shoot Out (US)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, shootoutj, shootout, shootouj, shootouj, shootout_state, init_shootout, ROT180, "Data East Corporation", "Shoot Out (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, shootoutb, shootout, shootouk, shootout, shootout_state, init_shootout, ROT180, "bootleg", "Shoot Out (Korean Bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, shootout, 0, shootout, shootout, shootout_state, empty_init, ROT180, "Data East USA", "Shoot Out (US)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, shootoutj, shootout, shootoutj, shootoutj, shootoutj_state, empty_init, ROT180, "Data East Corporation", "Shoot Out (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1985, shootoutb, shootout, shootoutk, shootout, shootoutj_state, empty_init, ROT180, "bootleg", "Shoot Out (Korean Bootleg)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/vicdual.cpp b/src/mame/drivers/vicdual.cpp index 4ba3b0e23f5..1bbea1c472e 100644 --- a/src/mame/drivers/vicdual.cpp +++ b/src/mame/drivers/vicdual.cpp @@ -1294,6 +1294,22 @@ void tranqgun_state::tranqgun_prot_w(offs_t offset, uint8_t data) } } +uint8_t tranqgun_state::brdrlinet_prot_r() +{ + logerror("%s: brdrlinet_prot_r\n", machine().describe_context()); + + return m_tranqgun_prot_return; +} + +void tranqgun_state::brdrlinet_prot_w(uint8_t data) +{ + logerror("%s: brdrlinet_prot_w %02x\n", machine().describe_context(), data); + + if (data == 0xd8) + m_tranqgun_prot_return = 0x02; + else if (data == 0x3a) + m_tranqgun_prot_return = 0x01; +} void tranqgun_state::tranqgun_dualgame_map(address_map &map) { @@ -1301,6 +1317,13 @@ void tranqgun_state::tranqgun_dualgame_map(address_map &map) map(0x4000, 0x7fff).rw(FUNC(tranqgun_state::tranqgun_prot_r), FUNC(tranqgun_state::tranqgun_prot_w)); } +void tranqgun_state::brdrlinet_dualgame_map(address_map &map) +{ + vicdual_dualgame_map(map); + map(0x7800, 0x7800).r(FUNC(tranqgun_state::brdrlinet_prot_r)); + map(0xe9a8, 0xe9a8).w(FUNC(tranqgun_state::brdrlinet_prot_w)); +} + uint8_t carnivalh_state::carnivalh_prot_r(offs_t offset) { // There appear to be 2 protection functions in the code @@ -2413,6 +2436,12 @@ void tranqgun_state::tranqgun(machine_config &config) BORDERLINE_AUDIO(config, m_vicdual_sound, 0).add_route(ALL_OUTPUTS, "mono", 1.0); } +void tranqgun_state::brdrlinet(machine_config &config) +{ + tranqgun(config); + + m_maincpu->set_addrmap(AS_PROGRAM, &tranqgun_state::brdrlinet_dualgame_map); +} void vicdual_state::brdrline(machine_config &config) { @@ -3935,7 +3964,7 @@ ROM_START( brdrlinet ) ROM_LOAD( "1171a.u33", 0x0000, 0x0400, CRC(38dd9880) SHA1(1a879ce990129fd34e7265010872ac998d16accf) ) ROM_LOAD( "1172a.u32", 0x0400, 0x0400, CRC(1a3adff0) SHA1(3fab79688b739d6a5979638115629d0a61f8878b) ) ROM_LOAD( "1173a.u31", 0x0800, 0x0400, CRC(e668734d) SHA1(b01b06f4a107f14001c70e63e072c575cd97c89b) ) - ROM_LOAD( "1174a.u30.bad", 0x0c00, 0x0400, BAD_DUMP CRC(22c83ae4) SHA1(16da92afe068401a6f27f56b214b600b49d8019f) ) // chip was dead, need another + ROM_LOAD( "1174a.u30", 0x0c00, 0x0400, CRC(d1ca5d52) SHA1(2ed9368741a409f7483020c1f7a44edb0a190a46) ) ROM_LOAD( "1175a.u29", 0x1000, 0x0400, CRC(116517b8) SHA1(a7ded7cb53735e6cf4994ff70db35dead04828e6) ) ROM_LOAD( "1176a.u28", 0x1400, 0x0400, CRC(2b2c4ba8) SHA1(fe9ccb94b9d5d7fb9ec6170a7b71f859b22981d3) ) ROM_LOAD( "1177a.u27", 0x1800, 0x0400, CRC(d8cbcc1e) SHA1(632d2ba84d4276155960b176bf7ac514b214e481) ) @@ -4331,7 +4360,7 @@ GAME( 1981, brdrline, 0, brdrline, brdrline, vicdual_state, empty_i GAME( 1981, starrkr, brdrline, brdrline, starrkr, vicdual_state, empty_init, ROT270, "Sega", "Star Raker", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) GAME( 1981, brdrlins, brdrline, brdrline, brdrline, vicdual_state, empty_init, ROT270, "bootleg (Sidam)", "Borderline (Sidam bootleg)", MACHINE_SUPPORTS_SAVE ) GAME( 1981, brdrlinb, brdrline, brdrline, brdrline, vicdual_state, empty_init, ROT270, "bootleg (Karateco)", "Borderline (Karateco bootleg)", MACHINE_SUPPORTS_SAVE ) -GAME( 1981, brdrlinet, brdrline, tranqgun, tranqgun, tranqgun_state, empty_init, ROT270, "Sega", "Borderline (Tranquillizer Gun conversion)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // official factory conversion +GAME( 1981, brdrlinet, brdrline, brdrlinet, brdrline, tranqgun_state, empty_init, ROT270, "Sega", "Borderline (Tranquillizer Gun conversion)", MACHINE_SUPPORTS_SAVE ) // official factory conversion GAME( 198?, nostromo, 0, headons, startrks, vicdual_state, empty_init, ROT0, "bootleg", "Nostromo", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) // sound board probably differs GAME( 198?, startrks, nostromo, headons, startrks, vicdual_state, empty_init, ROT0, "bootleg (Sidam)", "Star Trek (Head On hardware)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) GAME( 1980, digger, 0, digger, digger, vicdual_state, empty_init, ROT270, "Sega", "Digger", MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/includes/rollerg.h b/src/mame/includes/rollerg.h deleted file mode 100644 index 354815bf04d..00000000000 --- a/src/mame/includes/rollerg.h +++ /dev/null @@ -1,65 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria -/************************************************************************* - - Rollergames - -*************************************************************************/ -#ifndef MAME_INCLUDES_ROLLERG_H -#define MAME_INCLUDES_ROLLERG_H - -#pragma once - -#include "cpu/m6809/konami.h" /* for the callback and the firq irq definition */ -#include "machine/k053252.h" -#include "video/k051316.h" -#include "video/k053244_k053245.h" -#include "video/konami_helper.h" - -class rollerg_state : public driver_device -{ -public: - rollerg_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), - m_k053244(*this, "k053244"), - m_k051316(*this, "k051316"), - m_k053252(*this, "k053252") - { } - - void rollerg(machine_config &config); - -private: - virtual void machine_start() override; - virtual void machine_reset() override; - - void main_map(address_map &map); - void sound_map(address_map &map); - - TIMER_CALLBACK_MEMBER(sound_nmi); - - /* misc */ - int m_readzoomroms = 0; - emu_timer *m_nmi_timer = nullptr; - - /* devices */ - required_device m_maincpu; - required_device m_audiocpu; - required_device m_k053244; - required_device m_k051316; - required_device m_k053252; - - void ext_enable_w(uint8_t data); - uint8_t k051316_r(offs_t offset); - void soundirq_w(uint8_t data); - void sound_arm_nmi_w(uint8_t data); - uint8_t pip_r(); - DECLARE_WRITE_LINE_MEMBER(rollerg_irq_ack_w); - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - K05324X_CB_MEMBER(sprite_callback); - K051316_CB_MEMBER(zoom_callback); - void banking_callback(uint8_t data); -}; - -#endif // MAME_INCLUDES_ROLLERG_H diff --git a/src/mame/includes/shootout.h b/src/mame/includes/shootout.h deleted file mode 100644 index 50f40c4b671..00000000000 --- a/src/mame/includes/shootout.h +++ /dev/null @@ -1,76 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ernesto Corvi, Phil Stroffolino, Bryan McPhail -#ifndef MAME_INCLUDES_SHOOTOUT_H -#define MAME_INCLUDES_SHOOTOUT_H - -#pragma once - -#include "machine/gen_latch.h" -#include "emupal.h" -#include "tilemap.h" - -class shootout_state : public driver_device -{ -public: - shootout_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_soundlatch(*this, "soundlatch"), - m_spriteram(*this, "spriteram"), - m_textram(*this, "textram"), - m_videoram(*this, "videoram") - { } - - void shootouj(machine_config &config); - void shootouk(machine_config &config); - void shootout(machine_config &config); - - void init_shootout(); - - DECLARE_INPUT_CHANGED_MEMBER(coin_inserted); - -private: - required_device m_maincpu; - optional_device m_audiocpu; - required_device m_gfxdecode; - required_device m_palette; - required_device m_soundlatch; - - required_shared_ptr m_spriteram; - required_shared_ptr m_textram; - required_shared_ptr m_videoram; - - tilemap_t *m_background = nullptr; - tilemap_t *m_foreground = nullptr; - - int m_ccnt_old_val = 0; - - void bankswitch_w(uint8_t data); - uint8_t sound_cpu_command_r(); - void sound_cpu_command_w(uint8_t data); - void flipscreen_w(uint8_t data); - void coincounter_w(uint8_t data); - void videoram_w(offs_t offset, uint8_t data); - void textram_w(offs_t offset, uint8_t data); - - virtual void machine_reset() override; - virtual void video_start() override; - - void shootout_palette(palette_device &palette) const; - - TILE_GET_INFO_MEMBER(get_bg_tile_info); - TILE_GET_INFO_MEMBER(get_fg_tile_info); - - uint32_t screen_update_shootout(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_shootouj(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int bank_bits ); - - void shootouj_map(address_map &map); - void shootout_map(address_map &map); - void shootout_sound_map(address_map &map); -}; - -#endif // MAME_INCLUDES_SHOOTOUT_H diff --git a/src/mame/includes/vicdual.h b/src/mame/includes/vicdual.h index 585e4f69412..b66a1118a48 100644 --- a/src/mame/includes/vicdual.h +++ b/src/mame/includes/vicdual.h @@ -206,6 +206,7 @@ public: vicdual_state(mconfig, type, tag) { } + void brdrlinet(machine_config &config); void tranqgun(machine_config &config); protected: @@ -218,9 +219,13 @@ private: uint8_t tranqgun_prot_r(offs_t offset); void tranqgun_prot_w(offs_t offset, uint8_t data); + void brdrlinet_dualgame_map(address_map &map); void tranqgun_dualgame_map(address_map &map); uint8_t m_tranqgun_prot_return = 0; + + uint8_t brdrlinet_prot_r(); + void brdrlinet_prot_w(uint8_t data); }; class nsub_state : public vicdual_state diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 8bef0b4aef6..30599e48764 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -2259,6 +2259,7 @@ spcrocks // J.Estevez (c) 1981 @source:astinvad.cpp astinvad // (c) 1980 Stern +betafrce // bootleg kamikaze // (c) 1979 Leijac Corporation kosmokil // bootleg spaceint // [1980] Shoei diff --git a/src/mame/video/rollerg.cpp b/src/mame/video/rollerg.cpp deleted file mode 100644 index 92bcf58a1fa..00000000000 --- a/src/mame/video/rollerg.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria -#include "emu.h" -#include "includes/rollerg.h" - -/*************************************************************************** - - Callbacks for the K053245 - -***************************************************************************/ - -K05324X_CB_MEMBER(rollerg_state::sprite_callback) -{ - enum { sprite_colorbase = 256 / 16 }; -#if 0 - if (machine().input().code_pressed(KEYCODE_Q) && (*color & 0x80)) *color = machine().rand(); - if (machine().input().code_pressed(KEYCODE_W) && (*color & 0x40)) *color = machine().rand(); - if (machine().input().code_pressed(KEYCODE_E) && (*color & 0x20)) *color = machine().rand(); - if (machine().input().code_pressed(KEYCODE_R) && (*color & 0x10)) *color = machine().rand(); -#endif - *priority = (*color & 0x10) ? 0 : 0x02; - *color = sprite_colorbase + (*color & 0x0f); -} - - -/*************************************************************************** - - Callbacks for the K051316 - -***************************************************************************/ - -K051316_CB_MEMBER(rollerg_state::zoom_callback) -{ - *flags = TILE_FLIPYX((*color & 0xc0) >> 6); - *code |= ((*color & 0x0f) << 8); - *color = ((*color & 0x30) >> 4); -} - - -/*************************************************************************** - - Display refresh - -***************************************************************************/ - -uint32_t rollerg_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int bg_colorbase = 16; - - screen.priority().fill(0, cliprect); - bitmap.fill(16 * bg_colorbase, cliprect); - m_k051316->zoom_draw(screen, bitmap, cliprect, 0, 1); - m_k053244->sprites_draw(bitmap, cliprect, screen.priority()); - return 0; -} diff --git a/src/mame/video/shootout.cpp b/src/mame/video/shootout.cpp deleted file mode 100644 index d5b671b1e49..00000000000 --- a/src/mame/video/shootout.cpp +++ /dev/null @@ -1,184 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ernesto Corvi, Phil Stroffolino, Bryan McPhail -/* - Video Hardware for Shoot Out - prom GB09.K6 may be related to background tile-sprite priority -*/ - -#include "emu.h" -#include "includes/shootout.h" -#include "screen.h" - - -void shootout_state::shootout_palette(palette_device &palette) const -{ - uint8_t const *const color_prom = memregion("proms")->base(); - - for (int i = 0; i < palette.entries(); i++) - { - int bit0, bit1, bit2; - - // red component - bit0 = BIT(color_prom[i], 0); - bit1 = BIT(color_prom[i], 1); - bit2 = BIT(color_prom[i], 2); - int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - // green component - bit0 = BIT(color_prom[i], 3); - bit1 = BIT(color_prom[i], 4); - bit2 = BIT(color_prom[i], 5); - int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - // blue component - bit0 = 0; - bit1 = BIT(color_prom[i], 6); - bit2 = BIT(color_prom[i], 7); - int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - palette.set_pen_color(i, rgb_t(r, g, b)); - } -} - - - -TILE_GET_INFO_MEMBER(shootout_state::get_bg_tile_info) -{ - int attributes = m_videoram[tile_index+0x400]; /* CCCC -TTT */ - int tile_number = m_videoram[tile_index] + 256*(attributes&7); - int color = attributes>>4; - - tileinfo.set(2, - tile_number, - color, - 0); -} - -TILE_GET_INFO_MEMBER(shootout_state::get_fg_tile_info) -{ - int attributes = m_textram[tile_index+0x400]; /* CCCC --TT */ - int tile_number = m_textram[tile_index] + 256*(attributes&0x3); - int color = attributes>>4; - - tileinfo.set(0, - tile_number, - color, - 0); -} - -void shootout_state::videoram_w(offs_t offset, uint8_t data) -{ - m_videoram[offset] = data; - m_background->mark_tile_dirty(offset&0x3ff ); -} - -void shootout_state::textram_w(offs_t offset, uint8_t data) -{ - m_textram[offset] = data; - m_foreground->mark_tile_dirty(offset&0x3ff ); -} - -void shootout_state::video_start() -{ - m_background = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(shootout_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - m_foreground = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(shootout_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - m_foreground->set_transparent_pen(0); - - save_item(NAME(m_ccnt_old_val)); -} - -void shootout_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int bank_bits ) -{ - gfx_element *gfx = m_gfxdecode->gfx(1); - const uint8_t *source = m_spriteram+127*4; - int count; - - bool m_bFlicker = (screen.frame_number () & 1) != 0; - - for( count=0; count<128; count++ ) - { - int attributes = source[1]; - /* - 76543210 - xxx----- bank - ---x---- vertical size - ----x--- priority - -----x-- horizontal flip - ------x- flicker - -------x enable - */ - if ( attributes & 0x01 ){ /* visible */ - if( m_bFlicker || (attributes&0x02)==0 ){ - int priority_mask = (attributes&0x08)?0x2:0; - int sx = (240 - source[2])&0xff; - int sy = (240 - source[0])&0xff; - int vx, vy; - int number = source[3] | ((attributes<prio_transpen(bitmap,cliprect, - number, - 0 /*color*/, - flipx,flipy, - vx,vy, - screen.priority(), - priority_mask,0); - - number++; - sy += 16; - } - - vx = sx; - vy = sy; - if (flip_screen()) { - vx = 240 - vx; - vy = 240 - vy; - } - - gfx->prio_transpen(bitmap,cliprect, - number, - 0 /*color*/, - flipx,flipy, - vx,vy, - screen.priority(), - priority_mask,0); - } - } - source -= 4; - } -} - -uint32_t shootout_state::screen_update_shootout(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - screen.priority().fill(0, cliprect); - - m_background->draw(screen, bitmap, cliprect, 0,0); - m_foreground->draw(screen, bitmap, cliprect, 0,1); - draw_sprites(screen, bitmap, cliprect,3/*bank bits */); - return 0; -} - -uint32_t shootout_state::screen_update_shootouj(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - screen.priority().fill(0, cliprect); - - m_background->draw(screen, bitmap, cliprect, 0,0); - m_foreground->draw(screen, bitmap, cliprect, 0,1); - draw_sprites(screen, bitmap, cliprect,2/*bank bits*/); - return 0; -}