From 6d024daf64998b9a7a0355e6d7382c73e548ba5b Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Tue, 6 Sep 2022 17:58:12 +0200 Subject: - midw8080/8080bw_a.cpp: confirmed ozmawars has 2 SN76477 [Guru] - orca/espial.cpp, orca/funkybee.cpp, orca/marineb.cpp, orca/vastar.cpp, orca/zodiack.cpp, pacific/mrflea.cpp, pacific/thief.cpp: consolidated drivers in single files, minor cleanups --- src/mame/midw8080/8080bw_a.cpp | 8 +- src/mame/orca/espial.cpp | 473 +++++++++++++++++++----- src/mame/orca/espial.h | 90 ----- src/mame/orca/espial_v.cpp | 226 ------------ src/mame/orca/funkybee.cpp | 309 +++++++++++++--- src/mame/orca/funkybee.h | 60 --- src/mame/orca/funkybee_v.cpp | 160 -------- src/mame/orca/marineb.cpp | 808 ++++++++++++++++++++++++++++++++++------- src/mame/orca/marineb.h | 91 ----- src/mame/orca/marineb_v.cpp | 462 ----------------------- src/mame/orca/vastar.cpp | 464 ++++++++++++++++++----- src/mame/orca/vastar.h | 109 ------ src/mame/orca/vastar_v.cpp | 210 ----------- src/mame/orca/zodiack.cpp | 94 +++-- src/mame/orca/zodiack.h | 45 --- src/mame/pacific/mrflea.cpp | 279 +++++++++++--- src/mame/pacific/mrflea.h | 67 ---- src/mame/pacific/mrflea_v.cpp | 108 ------ src/mame/pacific/thief.cpp | 631 ++++++++++++++++++++++++++------ src/mame/pacific/thief.h | 71 ---- src/mame/pacific/thief_v.cpp | 277 -------------- 21 files changed, 2506 insertions(+), 2536 deletions(-) delete mode 100644 src/mame/orca/espial.h delete mode 100644 src/mame/orca/espial_v.cpp delete mode 100644 src/mame/orca/funkybee.h delete mode 100644 src/mame/orca/funkybee_v.cpp delete mode 100644 src/mame/orca/marineb.h delete mode 100644 src/mame/orca/marineb_v.cpp delete mode 100644 src/mame/orca/vastar.h delete mode 100644 src/mame/orca/vastar_v.cpp delete mode 100644 src/mame/orca/zodiack.h delete mode 100644 src/mame/pacific/mrflea.h delete mode 100644 src/mame/pacific/mrflea_v.cpp delete mode 100644 src/mame/pacific/thief.h delete mode 100644 src/mame/pacific/thief_v.cpp diff --git a/src/mame/midw8080/8080bw_a.cpp b/src/mame/midw8080/8080bw_a.cpp index 62190de0ac8..44070f8421a 100644 --- a/src/mame/midw8080/8080bw_a.cpp +++ b/src/mame/midw8080/8080bw_a.cpp @@ -151,7 +151,7 @@ void _8080bw_state::invadpt2_sh_port_2_w(uint8_t data) /* */ /* SNK "Ozma Wars" */ /* No schematic or manual could be found. */ -/* Suspected of having a SN76577 for the enemy */ +/* It has a SN76477 for the enemy */ /* movement sounds, another for the enemy death */ /* sounds, and analog circuits for the shooting and */ /* explosion sounds. */ @@ -208,10 +208,10 @@ void ozmawars_state::ozmawars_port04_w(uint8_t data) if (data == 0x15) m_samples->start(4, 10, 1); // stage with invaders if (data == 0x17) m_samples->start(3, 9); // meteor hit if (data == 0x1f) m_samples->start(4, 14, 1); // meteor stage - //if (data == 0x35) m_samples->start(4, 12, 1); // - //if (data == 0x3f) m_samples->start(4, 11, 1); // + //if (data == 0x35) m_samples->start(4, 12, 1); // + //if (data == 0x3f) m_samples->start(4, 11, 1); // } - if (data == 0) m_samples->stop(4); // + if (data == 0) m_samples->stop(4); // } void ozmawars_state::ozmawars_port05_w(uint8_t data) diff --git a/src/mame/orca/espial.cpp b/src/mame/orca/espial.cpp index 3088624e55a..3c0c0c9e36f 100644 --- a/src/mame/orca/espial.cpp +++ b/src/mame/orca/espial.cpp @@ -1,14 +1,15 @@ // license:BSD-3-Clause -// copyright-holders:Brad Oliver +// copyright-holders: Brad Oliver + /*************************************************************************** Espial hardware games Espial: The Orca logo is displayed, but looks to be "blacked out" via the - color proms by having 0x1c & 0x1d set to black. + color PROMs by having 0x1c & 0x1d set to black. TODO: -- merge with zodiack.c +- merge with orca/zodiack.cpp Stephh's notes (based on the games Z80 code and some tests) : @@ -39,15 +40,314 @@ Stephh's notes (based on the games Z80 code and some tests) : ***************************************************************************/ #include "emu.h" -#include "espial.h" #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" +#include "machine/timer.h" #include "machine/watchdog.h" #include "sound/ay8910.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" + + +namespace { + +class espial_state : public driver_device +{ +public: + espial_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_videoram(*this, "videoram"), + m_attributeram(*this, "attributeram"), + m_scrollram(*this, "scrollram"), + m_spriteram(*this, "spriteram%u", 1U), + m_colorram(*this, "colorram"), + m_maincpu(*this, "maincpu"), + m_audiocpu(*this, "audiocpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch") + { } + + void espial(machine_config &config); + void netwars(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + + required_shared_ptr m_videoram; + required_shared_ptr m_attributeram; + required_shared_ptr m_scrollram; + required_shared_ptr_array m_spriteram; + required_shared_ptr m_colorram; + + // video-related + tilemap_t *m_bg_tilemap = nullptr; + uint8_t m_flipscreen = 0U; + + // sound-related + uint8_t m_main_nmi_enabled = 0U; + uint8_t m_sound_nmi_enabled = 0U; + + // devices + required_device m_maincpu; + required_device m_audiocpu; + required_device m_gfxdecode; + required_device m_palette; + required_device m_soundlatch; + + void master_interrupt_mask_w(uint8_t data); + void master_soundlatch_w(uint8_t data); + void sound_nmi_mask_w(uint8_t data); + void videoram_w(offs_t offset, uint8_t data); + void colorram_w(offs_t offset, uint8_t data); + void attributeram_w(offs_t offset, uint8_t data); + void scrollram_w(offs_t offset, uint8_t data); + void flipscreen_w(uint8_t data); + TILE_GET_INFO_MEMBER(get_tile_info); + void palette(palette_device &palette) const; + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + INTERRUPT_GEN_MEMBER(sound_nmi_gen); + TIMER_DEVICE_CALLBACK_MEMBER(scanline); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + void main_map(address_map &map); + void sound_io_map(address_map &map); + void sound_map(address_map &map); +}; + +class netwars_state : public espial_state +{ +public: + using espial_state::espial_state; + + void netwars(machine_config &config); + +protected: + virtual void video_start() override; + +private: + void main_map(address_map &map); +}; + + +// video + +/*************************************************************************** + + Convert the color PROMs into a more useable format. + + Espial has two 256x4 palette PROMs. + + I don't know for sure how the palette PROMs are connected to the RGB + output, but it's probably the usual: + + bit 3 -- 220 ohm resistor -- BLUE + -- 470 ohm resistor -- BLUE + -- 220 ohm resistor -- GREEN + bit 0 -- 470 ohm resistor -- GREEN + bit 3 -- 1 kohm resistor -- GREEN + -- 220 ohm resistor -- RED + -- 470 ohm resistor -- RED + bit 0 -- 1 kohm resistor -- RED + +***************************************************************************/ + +void espial_state::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 + palette.entries()], 0); + bit2 = BIT(color_prom[i + palette.entries()], 1); + int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + // blue component + bit0 = 0; + bit1 = BIT(color_prom[i + palette.entries()], 2); + bit2 = BIT(color_prom[i + palette.entries()], 3); + int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + palette.set_pen_color(i, rgb_t(r, g, b)); + } +} + + + +/*************************************************************************** + + Callbacks for the TileMap code + +***************************************************************************/ + +TILE_GET_INFO_MEMBER(espial_state::get_tile_info) +{ + uint8_t const code = m_videoram[tile_index]; + uint8_t const col = m_colorram[tile_index]; + uint8_t const attr = m_attributeram[tile_index]; + tileinfo.set(0, + code | ((attr & 0x03) << 8), + col & 0x3f, + TILE_FLIPYX(attr >> 2)); +} + + + +/************************************* + * + * Video system start + * + *************************************/ + +void espial_state::video_start() +{ + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(espial_state::get_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + m_bg_tilemap->set_scroll_cols(32); + + save_item(NAME(m_flipscreen)); +} + +void netwars_state::video_start() +{ + // Net Wars has a tile map that's twice as big as Espial's + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(netwars_state::get_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 64); + + m_bg_tilemap->set_scroll_cols(32); + m_bg_tilemap->set_scrolldy(0, 0x100); + + save_item(NAME(m_flipscreen)); +} + + +/************************************* + * + * Memory handlers + * + *************************************/ + +void espial_state::videoram_w(offs_t offset, uint8_t data) +{ + m_videoram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + + +void espial_state::colorram_w(offs_t offset, uint8_t data) +{ + m_colorram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + + +void espial_state::attributeram_w(offs_t offset, uint8_t data) +{ + m_attributeram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + + +void espial_state::scrollram_w(offs_t offset, uint8_t data) +{ + m_scrollram[offset] = data; + m_bg_tilemap->set_scrolly(offset, data); +} + + +void espial_state::flipscreen_w(uint8_t data) +{ + m_flipscreen = data; + m_bg_tilemap->set_flip(m_flipscreen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0); +} + +/************************************* + * + * Video update + * + *************************************/ +void espial_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + /* Note that it is important to draw them exactly in this + order, to have the correct priorities. */ + for (int offs = 0; offs < 16; offs++) + { + int const sx = m_spriteram[0][offs + 16]; + int sy = m_spriteram[1][offs]; + int const code = m_spriteram[0][offs] >> 1; + int const color = m_spriteram[1][offs + 16]; + int flipx = m_spriteram[2][offs] & 0x04; + int flipy = m_spriteram[2][offs] & 0x08; + + if (m_flipscreen) + { + flipx = !flipx; + flipy = !flipy; + } + else + { + sy = 240 - sy; + } + + if (m_spriteram[0][offs] & 1) // double height + { + if (m_flipscreen) + { + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, + code, color, + flipx, flipy, + sx, sy + 16, 0); + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, + code + 1, + color, + flipx, flipy, + sx, sy, 0); + } + else + { + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, + code, color, + flipx, flipy, + sx, sy - 16, 0); + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, + code + 1, color, + flipx, flipy, + sx, sy, 0); + } + } + else + { + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, + code, color, + flipx, flipy, + sx, sy, 0); + } + } +} + + +uint32_t espial_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + draw_sprites(bitmap, cliprect); + return 0; +} + + +// machine void espial_state::machine_reset() { @@ -59,49 +359,48 @@ void espial_state::machine_reset() void espial_state::machine_start() { - //save_item(NAME(mcu_out[1])); save_item(NAME(m_sound_nmi_enabled)); } -void espial_state::espial_master_interrupt_mask_w(uint8_t data) +void espial_state::master_interrupt_mask_w(uint8_t data) { m_main_nmi_enabled = ~(data & 1); } -void espial_state::espial_sound_nmi_mask_w(uint8_t data) +void espial_state::sound_nmi_mask_w(uint8_t data) { m_sound_nmi_enabled = data & 1; } -TIMER_DEVICE_CALLBACK_MEMBER(espial_state::espial_scanline) +TIMER_DEVICE_CALLBACK_MEMBER(espial_state::scanline) { - int scanline = param; + int const scanline = param; - if(scanline == 240 && m_main_nmi_enabled) // vblank-out irq + if (scanline == 240 && m_main_nmi_enabled) // vblank-out irq m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero); - if(scanline == 16) // timer irq, checks soundlatch port then updates some sound related work RAM buffers + if (scanline == 16) // timer irq, checks soundlatch port then updates some sound related work RAM buffers m_maincpu->set_input_line(0, HOLD_LINE); } -INTERRUPT_GEN_MEMBER(espial_state::espial_sound_nmi_gen) +INTERRUPT_GEN_MEMBER(espial_state::sound_nmi_gen) { if (m_sound_nmi_enabled) m_audiocpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero); } -void espial_state::espial_master_soundlatch_w(uint8_t data) +void espial_state::master_soundlatch_w(uint8_t data) { m_soundlatch->write(data); m_audiocpu->set_input_line(0, HOLD_LINE); } -void espial_state::espial_map(address_map &map) +void espial_state::main_map(address_map &map) { map(0x0000, 0x4fff).rom(); map(0x5800, 0x5fff).ram(); @@ -109,25 +408,25 @@ void espial_state::espial_map(address_map &map) map(0x6082, 0x6082).portr("DSW1"); map(0x6083, 0x6083).portr("IN1"); map(0x6084, 0x6084).portr("IN2"); - map(0x6090, 0x6090).r("soundlatch2", FUNC(generic_latch_8_device::read)).w(FUNC(espial_state::espial_master_soundlatch_w)); + map(0x6090, 0x6090).r("soundlatch2", FUNC(generic_latch_8_device::read)).w(FUNC(espial_state::master_soundlatch_w)); map(0x7000, 0x7000).rw("watchdog", FUNC(watchdog_timer_device::reset_r), FUNC(watchdog_timer_device::reset_w)); - map(0x7100, 0x7100).w(FUNC(espial_state::espial_master_interrupt_mask_w)); - map(0x7200, 0x7200).w(FUNC(espial_state::espial_flipscreen_w)); - map(0x8000, 0x801f).ram().share("spriteram_1"); + map(0x7100, 0x7100).w(FUNC(espial_state::master_interrupt_mask_w)); + map(0x7200, 0x7200).w(FUNC(espial_state::flipscreen_w)); + map(0x8000, 0x801f).ram().share(m_spriteram[0]); map(0x8020, 0x803f).readonly(); - map(0x8400, 0x87ff).ram().w(FUNC(espial_state::espial_videoram_w)).share("videoram"); - map(0x8800, 0x880f).writeonly().share("spriteram_3"); - map(0x8c00, 0x8fff).ram().w(FUNC(espial_state::espial_attributeram_w)).share("attributeram"); - map(0x9000, 0x901f).ram().share("spriteram_2"); - map(0x9020, 0x903f).ram().w(FUNC(espial_state::espial_scrollram_w)).share("scrollram"); - map(0x9400, 0x97ff).ram().w(FUNC(espial_state::espial_colorram_w)).share("colorram"); + map(0x8400, 0x87ff).ram().w(FUNC(espial_state::videoram_w)).share(m_videoram); + map(0x8800, 0x880f).writeonly().share(m_spriteram[2]); + map(0x8c00, 0x8fff).ram().w(FUNC(espial_state::attributeram_w)).share(m_attributeram); + map(0x9000, 0x901f).ram().share(m_spriteram[1]); + map(0x9020, 0x903f).ram().w(FUNC(espial_state::scrollram_w)).share(m_scrollram); + map(0x9400, 0x97ff).ram().w(FUNC(espial_state::colorram_w)).share(m_colorram); map(0xc000, 0xcfff).rom(); } /* there are a lot of unmapped reads from all over memory as the code uses POP instructions in a delay loop */ -void espial_state::netwars_map(address_map &map) +void netwars_state::main_map(address_map &map) { map(0x0000, 0x3fff).rom(); map(0x5800, 0x5fff).ram(); @@ -135,42 +434,42 @@ void espial_state::netwars_map(address_map &map) map(0x6082, 0x6082).portr("DSW1"); map(0x6083, 0x6083).portr("IN1"); map(0x6084, 0x6084).portr("IN2"); - map(0x6090, 0x6090).r("soundlatch2", FUNC(generic_latch_8_device::read)).w(FUNC(espial_state::espial_master_soundlatch_w)); + map(0x6090, 0x6090).r("soundlatch2", FUNC(generic_latch_8_device::read)).w(FUNC(netwars_state::master_soundlatch_w)); map(0x7000, 0x7000).rw("watchdog", FUNC(watchdog_timer_device::reset_r), FUNC(watchdog_timer_device::reset_w)); - map(0x7100, 0x7100).w(FUNC(espial_state::espial_master_interrupt_mask_w)); - map(0x7200, 0x7200).w(FUNC(espial_state::espial_flipscreen_w)); - map(0x8000, 0x87ff).ram().w(FUNC(espial_state::espial_videoram_w)).share("videoram"); - map(0x8000, 0x801f).ram().share("spriteram_1"); - map(0x8800, 0x8fff).ram().w(FUNC(espial_state::espial_attributeram_w)).share("attributeram"); - map(0x8800, 0x880f).ram().share("spriteram_3"); - map(0x9000, 0x97ff).ram().w(FUNC(espial_state::espial_colorram_w)).share("colorram"); - map(0x9000, 0x901f).ram().share("spriteram_2"); - map(0x9020, 0x903f).ram().w(FUNC(espial_state::espial_scrollram_w)).share("scrollram"); + map(0x7100, 0x7100).w(FUNC(netwars_state::master_interrupt_mask_w)); + map(0x7200, 0x7200).w(FUNC(netwars_state::flipscreen_w)); + map(0x8000, 0x87ff).ram().w(FUNC(netwars_state::videoram_w)).share(m_videoram); + map(0x8000, 0x801f).ram().share(m_spriteram[0]); + map(0x8800, 0x8fff).ram().w(FUNC(netwars_state::attributeram_w)).share(m_attributeram); + map(0x8800, 0x880f).ram().share(m_spriteram[2]); + map(0x9000, 0x97ff).ram().w(FUNC(netwars_state::colorram_w)).share(m_colorram); + map(0x9000, 0x901f).ram().share(m_spriteram[1]); + map(0x9020, 0x903f).ram().w(FUNC(netwars_state::scrollram_w)).share(m_scrollram); } -void espial_state::espial_sound_map(address_map &map) +void espial_state::sound_map(address_map &map) { map(0x0000, 0x1fff).rom(); map(0x2000, 0x23ff).ram(); - map(0x4000, 0x4000).w(FUNC(espial_state::espial_sound_nmi_mask_w)); + map(0x4000, 0x4000).w(FUNC(espial_state::sound_nmi_mask_w)); map(0x6000, 0x6000).r(m_soundlatch, FUNC(generic_latch_8_device::read)).w("soundlatch2", FUNC(generic_latch_8_device::write)); } -void espial_state::espial_sound_io_map(address_map &map) +void espial_state::sound_io_map(address_map &map) { map.global_mask(0xff); map(0x00, 0x01).w("aysnd", FUNC(ay8910_device::address_data_w)); } -/* verified from Z80 code */ +// verified from Z80 code static INPUT_PORTS_START( espial ) PORT_START("IN0") PORT_DIPNAME( 0x01, 0x00, "Number of Buttons" ) PORT_DIPSETTING( 0x01, "1" ) PORT_DIPSETTING( 0x00, "2" ) - PORT_DIPNAME( 0x02, 0x02, "Enemy Bullets Vulnerable" ) /* you can shoot bullets */ + PORT_DIPNAME( 0x02, 0x02, "Enemy Bullets Vulnerable" ) // you can shoot bullets PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x02, DEF_STR( On ) ) PORT_DIPUNUSED( 0x04, IP_ACTIVE_HIGH ) @@ -195,9 +494,9 @@ static INPUT_PORTS_START( espial ) PORT_DIPSETTING( 0x0c, DEF_STR( 1C_4C ) ) PORT_DIPSETTING( 0x10, DEF_STR( 1C_6C ) ) PORT_DIPSETTING( 0x1c, DEF_STR( Free_Play ) ) - PORT_DIPNAME( 0x20, 0x00, DEF_STR( Bonus_Life ) ) /* code at 0x43e1 in 'espial' and 0x44b5 in 'espialu' */ - PORT_DIPSETTING( 0x00, "20k 70k 70k+" ) /* last bonus life at 980k : max. 15 bonus lives */ - PORT_DIPSETTING( 0x20, "50k 100k 100k+" ) /* last bonus life at 900k : max. 10 bonus lives */ + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Bonus_Life ) ) // code at 0x43e1 in 'espial' and 0x44b5 in 'espialu' + PORT_DIPSETTING( 0x00, "20k 70k 70k+" ) // last bonus life at 980k : max. 15 bonus lives + PORT_DIPSETTING( 0x20, "50k 100k 100k+" ) // last bonus life at 900k : max. 10 bonus lives PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ) ) PORT_DIPSETTING( 0x40, DEF_STR( Upright ) ) PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) @@ -227,15 +526,15 @@ static INPUT_PORTS_START( espial ) INPUT_PORTS_END -/* verified from Z80 code */ +// verified from Z80 code static INPUT_PORTS_START( netwars ) PORT_START("IN0") PORT_DIPUNUSED( 0x01, IP_ACTIVE_HIGH ) - PORT_DIPNAME( 0x02, 0x00, DEF_STR( Difficulty ) ) /* when enemies shoot - code at 0x2216 */ + PORT_DIPNAME( 0x02, 0x00, DEF_STR( Difficulty ) ) // when enemies shoot - code at 0x2216 PORT_DIPSETTING( 0x00, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x02, DEF_STR( Hard ) ) PORT_DIPUNUSED( 0x04, IP_ACTIVE_HIGH ) - PORT_DIPUNUSED( 0x08, IP_ACTIVE_HIGH ) /* no effect due to code at 0x0e0a */ + PORT_DIPUNUSED( 0x08, IP_ACTIVE_HIGH ) // no effect due to code at 0x0e0a PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) @@ -256,7 +555,7 @@ static INPUT_PORTS_START( netwars ) PORT_DIPSETTING( 0x0c, DEF_STR( 1C_4C ) ) PORT_DIPSETTING( 0x10, DEF_STR( 1C_6C ) ) PORT_DIPSETTING( 0x1c, DEF_STR( Free_Play ) ) - PORT_DIPNAME( 0x20, 0x00, DEF_STR( Bonus_Life ) ) /* code at 0x2383 */ + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Bonus_Life ) ) // code at 0x2383 PORT_DIPSETTING( 0x00, "20k and 50k" ) PORT_DIPSETTING( 0x20, "40k and 70k" ) PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ) ) @@ -312,8 +611,8 @@ static const gfx_layout spritelayout = static GFXDECODE_START( gfx_espial ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 64 ) - GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 0, 64 ) + GFXDECODE_ENTRY( "tiles", 0, charlayout, 0, 64 ) + GFXDECODE_ENTRY( "sprites", 0, spritelayout, 0, 64 ) GFXDECODE_END @@ -321,51 +620,48 @@ GFXDECODE_END void espial_state::espial(machine_config &config) { - /* basic machine hardware */ - Z80(config, m_maincpu, 3072000); /* 3.072 MHz */ - m_maincpu->set_addrmap(AS_PROGRAM, &espial_state::espial_map); - TIMER(config, "scantimer").configure_scanline(FUNC(espial_state::espial_scanline), "screen", 0, 1); + // basic machine hardware + Z80(config, m_maincpu, 3'072'000); // 3.072 MHz + m_maincpu->set_addrmap(AS_PROGRAM, &espial_state::main_map); + TIMER(config, "scantimer").configure_scanline(FUNC(espial_state::scanline), "screen", 0, 1); - Z80(config, m_audiocpu, 3072000); /* 2 MHz?????? */ - m_audiocpu->set_addrmap(AS_PROGRAM, &espial_state::espial_sound_map); - m_audiocpu->set_addrmap(AS_IO, &espial_state::espial_sound_io_map); - m_audiocpu->set_periodic_int(FUNC(espial_state::espial_sound_nmi_gen), attotime::from_hz(4*60)); + Z80(config, m_audiocpu, 3'072'000); // 2 MHz?????? + m_audiocpu->set_addrmap(AS_PROGRAM, &espial_state::sound_map); + m_audiocpu->set_addrmap(AS_IO, &espial_state::sound_io_map); + m_audiocpu->set_periodic_int(FUNC(espial_state::sound_nmi_gen), attotime::from_hz(4 * 60)); 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(32*8, 32*8); screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1); - screen.set_screen_update(FUNC(espial_state::screen_update_espial)); + screen.set_screen_update(FUNC(espial_state::screen_update)); screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_espial); - PALETTE(config, m_palette, FUNC(espial_state::espial_palette), 256); + PALETTE(config, m_palette, FUNC(espial_state::palette), 256); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, m_soundlatch); GENERIC_LATCH_8(config, "soundlatch2"); - AY8910(config, "aysnd", 1500000).add_route(ALL_OUTPUTS, "mono", 0.50); + AY8910(config, "aysnd", 1'500'000).add_route(ALL_OUTPUTS, "mono", 0.50); } -void espial_state::netwars(machine_config &config) +void netwars_state::netwars(machine_config &config) { espial(config); - /* basic machine hardware */ + // basic machine hardware + m_maincpu->set_addrmap(AS_PROGRAM, &netwars_state::main_map); - m_maincpu->set_addrmap(AS_PROGRAM, &espial_state::netwars_map); - - /* video hardware */ + // video hardware subdevice("screen")->set_size(32*8, 64*8); - - MCFG_VIDEO_START_OVERRIDE(espial_state,netwars) } @@ -387,17 +683,17 @@ ROM_START( espial ) ROM_LOAD( "esp1.4n", 0x0000, 0x1000, CRC(fc7729e9) SHA1(96dfec574521fa4fe2588fbac2ef1caba6c1b884) ) ROM_LOAD( "esp2.4r", 0x1000, 0x1000, CRC(e4e256da) SHA1(8007471405bdcf90e29657a3ac2c2f84c9db7c9b) ) - ROM_REGION( 0x3000, "gfx1", 0 ) + ROM_REGION( 0x3000, "tiles", 0 ) ROM_LOAD( "espial8.4b", 0x0000, 0x2000, CRC(2f43036f) SHA1(316e9fab778d6c0abb0b6673aba33dfbe44b1262) ) ROM_LOAD( "espial7.4a", 0x2000, 0x1000, CRC(ebfef046) SHA1(5aa6efb7254fb42e814c1a29c5363f2d0727452f) ) - ROM_REGION( 0x2000, "gfx2", 0 ) + ROM_REGION( 0x2000, "sprites", 0 ) ROM_LOAD( "espial10.4e", 0x0000, 0x1000, CRC(de80fbc1) SHA1(f5601eac8cb35a92c51bf81e5ac5a2b79bcde28f) ) ROM_LOAD( "espial9.4d", 0x1000, 0x1000, CRC(48c258a0) SHA1(55e72b9072ddc05f848e5a6fae159c554102010b) ) - ROM_REGION( 0x0200, "proms", 0 ) /* The MMI6301 Bipolar PROM is compatible to the 82s129 */ - ROM_LOAD( "mmi6301.1f", 0x0000, 0x0100, CRC(d12de557) SHA1(53e8a57dfab677cc5b9cdd83d2fbeb93169bcefd) ) /* palette low 4 bits */ - ROM_LOAD( "mmi6301.1h", 0x0100, 0x0100, CRC(4c84fe70) SHA1(7ac52bd5b19663b9526ecb678e61db9939d2285d) ) /* palette high 4 bits */ + ROM_REGION( 0x0200, "proms", 0 ) // The MMI6301 Bipolar PROM is compatible to the 82s129 + ROM_LOAD( "mmi6301.1f", 0x0000, 0x0100, CRC(d12de557) SHA1(53e8a57dfab677cc5b9cdd83d2fbeb93169bcefd) ) // palette low 4 bits + ROM_LOAD( "mmi6301.1h", 0x0100, 0x0100, CRC(4c84fe70) SHA1(7ac52bd5b19663b9526ecb678e61db9939d2285d) ) // palette high 4 bits ROM_END ROM_START( espialu ) @@ -411,17 +707,17 @@ ROM_START( espialu ) ROM_LOAD( "espial1.4n", 0x0000, 0x1000, CRC(1e5ec20b) SHA1(f3bee38737321edf2d1ea753124421416441666e) ) ROM_LOAD( "espial2.4r", 0x1000, 0x1000, CRC(3431bb97) SHA1(97343bfb5e49cd1d26799723d8c5a31eff7b1170) ) - ROM_REGION( 0x3000, "gfx1", 0 ) + ROM_REGION( 0x3000, "tiles", 0 ) ROM_LOAD( "espial8.4b", 0x0000, 0x2000, CRC(2f43036f) SHA1(316e9fab778d6c0abb0b6673aba33dfbe44b1262) ) ROM_LOAD( "espial7.4a", 0x2000, 0x1000, CRC(ebfef046) SHA1(5aa6efb7254fb42e814c1a29c5363f2d0727452f) ) - ROM_REGION( 0x2000, "gfx2", 0 ) + ROM_REGION( 0x2000, "sprites", 0 ) ROM_LOAD( "espial10.4e", 0x0000, 0x1000, CRC(de80fbc1) SHA1(f5601eac8cb35a92c51bf81e5ac5a2b79bcde28f) ) ROM_LOAD( "espial9.4d", 0x1000, 0x1000, CRC(48c258a0) SHA1(55e72b9072ddc05f848e5a6fae159c554102010b) ) - ROM_REGION( 0x0200, "proms", 0 ) /* The MMI6301 Bipolar PROM is compatible to the 82s129 */ - ROM_LOAD( "mmi6301.1f", 0x0000, 0x0100, CRC(d12de557) SHA1(53e8a57dfab677cc5b9cdd83d2fbeb93169bcefd) ) /* palette low 4 bits */ - ROM_LOAD( "mmi6301.1h", 0x0100, 0x0100, CRC(4c84fe70) SHA1(7ac52bd5b19663b9526ecb678e61db9939d2285d) ) /* palette high 4 bits */ + ROM_REGION( 0x0200, "proms", 0 ) // The MMI6301 Bipolar PROM is compatible to the 82s129 + ROM_LOAD( "mmi6301.1f", 0x0000, 0x0100, CRC(d12de557) SHA1(53e8a57dfab677cc5b9cdd83d2fbeb93169bcefd) ) // palette low 4 bits + ROM_LOAD( "mmi6301.1h", 0x0100, 0x0100, CRC(4c84fe70) SHA1(7ac52bd5b19663b9526ecb678e61db9939d2285d) ) // palette high 4 bits ROM_END ROM_START( netwars ) @@ -433,21 +729,22 @@ ROM_START( netwars ) ROM_LOAD( "netw1.4n", 0x0000, 0x1000, CRC(53939e16) SHA1(938f505db0cfcfafb751378ae0c139b7f32404cb) ) ROM_LOAD( "netw2.4r", 0x1000, 0x1000, CRC(c096317a) SHA1(e61a3e9107481fd80309172a1a9a431903e02489) ) - ROM_REGION( 0x4000, "gfx1", 0 ) + ROM_REGION( 0x4000, "tiles", 0 ) ROM_LOAD( "netw8.4b", 0x0000, 0x2000, CRC(2320277e) SHA1(4e05f6833de89f8f7cc0a0d1cbec03656f8b54a1) ) ROM_LOAD( "netw7.4a", 0x2000, 0x2000, CRC(25cc5b7f) SHA1(2e089c3d5f8ebba676a959ba71bc9c1750312721) ) - ROM_REGION( 0x2000, "gfx2", 0 ) + ROM_REGION( 0x2000, "sprites", 0 ) ROM_LOAD( "netw10.4e", 0x0000, 0x1000, CRC(87b65625) SHA1(a702726c0fbe7669604f48bf2c19a54031645731) ) ROM_LOAD( "netw9.4d", 0x1000, 0x1000, CRC(830d0218) SHA1(c726a4a9dd1f10279f79cbe5fdd693a62d9d3ac5) ) - ROM_REGION( 0x0200, "proms", 0 ) /* The MMI6301 Bipolar PROM is compatible to the 82s129 */ - ROM_LOAD( "mmi6301.1f", 0x0000, 0x0100, CRC(f3ae1fe2) SHA1(4f259f8da3c9ecdc6010f83b6abc1371366bd0ab) ) /* palette low 4 bits */ - ROM_LOAD( "mmi6301.1h", 0x0100, 0x0100, CRC(c44c3771) SHA1(c86125fac28fafc744957258bf3bb5a6dc664b54) ) /* palette high 4 bits */ + ROM_REGION( 0x0200, "proms", 0 ) // The MMI6301 Bipolar PROM is compatible to the 82s129 + ROM_LOAD( "mmi6301.1f", 0x0000, 0x0100, CRC(f3ae1fe2) SHA1(4f259f8da3c9ecdc6010f83b6abc1371366bd0ab) ) // palette low 4 bits + ROM_LOAD( "mmi6301.1h", 0x0100, 0x0100, CRC(c44c3771) SHA1(c86125fac28fafc744957258bf3bb5a6dc664b54) ) // palette high 4 bits ROM_END +} // anonymous namespace -GAME( 1983, espial, 0, espial, espial, espial_state, empty_init, ROT0, "Orca / Thunderbolt", "Espial (Europe)", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, espialu, espial, espial, espial, espial_state, empty_init, ROT0, "Orca / Thunderbolt", "Espial (US?)", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, netwars, 0, netwars, netwars, espial_state, empty_init, ROT90, "Orca (Esco Trading Co license)", "Net Wars", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, espial, 0, espial, espial, espial_state, empty_init, ROT0, "Orca / Thunderbolt", "Espial (Europe)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, espialu, espial, espial, espial, espial_state, empty_init, ROT0, "Orca / Thunderbolt", "Espial (US?)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, netwars, 0, netwars, netwars, netwars_state, empty_init, ROT90, "Orca (Esco Trading Co license)", "Net Wars", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/orca/espial.h b/src/mame/orca/espial.h deleted file mode 100644 index 1866247718b..00000000000 --- a/src/mame/orca/espial.h +++ /dev/null @@ -1,90 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Brad Oliver - -/*************************************************************************** - - Espial hardware games (drivers: espial.cpp) - -***************************************************************************/ -#ifndef MAME_INCLUDES_ESPIAL_H -#define MAME_INCLUDES_ESPIAL_H - -#pragma once - -#include "machine/gen_latch.h" -#include "machine/timer.h" -#include "emupal.h" -#include "tilemap.h" - -class espial_state : public driver_device -{ -public: - espial_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_videoram(*this, "videoram"), - m_attributeram(*this, "attributeram"), - m_scrollram(*this, "scrollram"), - m_spriteram_1(*this, "spriteram_1"), - m_spriteram_2(*this, "spriteram_2"), - m_spriteram_3(*this, "spriteram_3"), - m_colorram(*this, "colorram"), - m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_soundlatch(*this, "soundlatch") - { } - - void espial(machine_config &config); - void netwars(machine_config &config); - -private: - required_shared_ptr m_videoram; - required_shared_ptr m_attributeram; - required_shared_ptr m_scrollram; - required_shared_ptr m_spriteram_1; - required_shared_ptr m_spriteram_2; - required_shared_ptr m_spriteram_3; - required_shared_ptr m_colorram; - - /* video-related */ - tilemap_t *m_bg_tilemap = nullptr; - tilemap_t *m_fg_tilemap = nullptr; - int m_flipscreen = 0; - - /* sound-related */ - uint8_t m_main_nmi_enabled = 0U; - uint8_t m_sound_nmi_enabled = 0U; - - /* devices */ - required_device m_maincpu; - required_device m_audiocpu; - required_device m_gfxdecode; - required_device m_palette; - required_device m_soundlatch; - - void espial_master_interrupt_mask_w(uint8_t data); - void espial_master_soundlatch_w(uint8_t data); - void espial_sound_nmi_mask_w(uint8_t data); - void espial_videoram_w(offs_t offset, uint8_t data); - void espial_colorram_w(offs_t offset, uint8_t data); - void espial_attributeram_w(offs_t offset, uint8_t data); - void espial_scrollram_w(offs_t offset, uint8_t data); - void espial_flipscreen_w(uint8_t data); - TILE_GET_INFO_MEMBER(get_tile_info); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - void espial_palette(palette_device &palette) const; - DECLARE_VIDEO_START(netwars); - uint32_t screen_update_espial(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(espial_sound_nmi_gen); - TIMER_DEVICE_CALLBACK_MEMBER(espial_scanline); - void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); - void espial_map(address_map &map); - void espial_sound_io_map(address_map &map); - void espial_sound_map(address_map &map); - void netwars_map(address_map &map); -}; - -#endif // MAME_INCLUDES_ESPIAL_H diff --git a/src/mame/orca/espial_v.cpp b/src/mame/orca/espial_v.cpp deleted file mode 100644 index 580c40c2bc3..00000000000 --- a/src/mame/orca/espial_v.cpp +++ /dev/null @@ -1,226 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Brad Oliver -/*************************************************************************** - - video.c - - Functions to emulate the video hardware of the machine. - -***************************************************************************/ - -#include "emu.h" -#include "espial.h" - -/*************************************************************************** - - Convert the color PROMs into a more useable format. - - Espial has two 256x4 palette PROMs. - - I don't know for sure how the palette PROMs are connected to the RGB - output, but it's probably the usual: - - bit 3 -- 220 ohm resistor -- BLUE - -- 470 ohm resistor -- BLUE - -- 220 ohm resistor -- GREEN - bit 0 -- 470 ohm resistor -- GREEN - bit 3 -- 1 kohm resistor -- GREEN - -- 220 ohm resistor -- RED - -- 470 ohm resistor -- RED - bit 0 -- 1 kohm resistor -- RED - -***************************************************************************/ - -void espial_state::espial_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 + palette.entries()], 0); - bit2 = BIT(color_prom[i + palette.entries()], 1); - int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - // blue component - bit0 = 0; - bit1 = BIT(color_prom[i + palette.entries()], 2); - bit2 = BIT(color_prom[i + palette.entries()], 3); - int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - palette.set_pen_color(i, rgb_t(r, g, b)); - } -} - - - -/*************************************************************************** - - Callbacks for the TileMap code - -***************************************************************************/ - -TILE_GET_INFO_MEMBER(espial_state::get_tile_info) -{ - uint8_t code = m_videoram[tile_index]; - uint8_t col = m_colorram[tile_index]; - uint8_t attr = m_attributeram[tile_index]; - tileinfo.set(0, - code | ((attr & 0x03) << 8), - col & 0x3f, - TILE_FLIPYX(attr >> 2)); -} - - - -/************************************* - * - * Video system start - * - *************************************/ - -void espial_state::video_start() -{ - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(espial_state::get_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - m_bg_tilemap->set_scroll_cols(32); - - save_item(NAME(m_flipscreen)); -} - -VIDEO_START_MEMBER(espial_state,netwars) -{ - /* Net Wars has a tile map that's twice as big as Espial's */ - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(espial_state::get_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 64); - - m_bg_tilemap->set_scroll_cols(32); - m_bg_tilemap->set_scrolldy(0, 0x100); - - save_item(NAME(m_flipscreen)); -} - - -/************************************* - * - * Memory handlers - * - *************************************/ - -void espial_state::espial_videoram_w(offs_t offset, uint8_t data) -{ - m_videoram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - - -void espial_state::espial_colorram_w(offs_t offset, uint8_t data) -{ - m_colorram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - - -void espial_state::espial_attributeram_w(offs_t offset, uint8_t data) -{ - m_attributeram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - - -void espial_state::espial_scrollram_w(offs_t offset, uint8_t data) -{ - m_scrollram[offset] = data; - m_bg_tilemap->set_scrolly(offset, data); -} - - -void espial_state::espial_flipscreen_w(uint8_t data) -{ - m_flipscreen = data; - m_bg_tilemap->set_flip(m_flipscreen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0); -} - - -/************************************* - * - * Video update - * - *************************************/ - -void espial_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - int offs; - - /* Note that it is important to draw them exactly in this */ - /* order, to have the correct priorities. */ - for (offs = 0; offs < 16; offs++) - { - int sx, sy, code, color, flipx, flipy; - - - sx = m_spriteram_1[offs + 16]; - sy = m_spriteram_2[offs]; - code = m_spriteram_1[offs] >> 1; - color = m_spriteram_2[offs + 16]; - flipx = m_spriteram_3[offs] & 0x04; - flipy = m_spriteram_3[offs] & 0x08; - - if (m_flipscreen) - { - flipx = !flipx; - flipy = !flipy; - } - else - { - sy = 240 - sy; - } - - if (m_spriteram_1[offs] & 1) /* double height */ - { - if (m_flipscreen) - { - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, - code,color, - flipx,flipy, - sx,sy + 16,0); - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, - code + 1, - color, - flipx,flipy, - sx,sy,0); - } - else - { - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, - code,color, - flipx,flipy, - sx,sy - 16,0); - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, - code + 1,color, - flipx,flipy, - sx,sy,0); - } - } - else - { - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, - code,color, - flipx,flipy, - sx,sy,0); - } - } -} - - -uint32_t espial_state::screen_update_espial(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - draw_sprites(bitmap, cliprect); - return 0; -} diff --git a/src/mame/orca/funkybee.cpp b/src/mame/orca/funkybee.cpp index a5e57eff67f..4ff953cc40c 100644 --- a/src/mame/orca/funkybee.cpp +++ b/src/mame/orca/funkybee.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:Zsolt Vasvari +// copyright-holders: Zsolt Vasvari + /*************************************************************************** Funky Bee/Sky Lancer memory map (preliminary) @@ -10,9 +11,9 @@ MAIN CPU: 0000-4fff ROM 8000-87ff RAM -a000-bfff video RAM (only 0x20 bytes of each 0x100 byte block is used) +a000-bfff video RAM (only 0x20 bytes of each 0x100 byte block are used) (also contains sprite RAM) -c000-dfff color RAM (only 0x20 bytes of each 0x100 byte block is used) +c000-dfff color RAM (only 0x20 bytes of each 0x100 byte block are used) (also contains sprite RAM) read: @@ -62,7 +63,7 @@ Stephh's notes (based on the games Z80 code and some tests) : - Possible "Lives" settings : 1, 2, 3 or 4 (code at 0x0601) - Bonus life routine at 0x1ef6 (test on DSW bit 5 !) - I can't tell if it's an ingame bug or if this was done on purpose, + I can't tell if it's an in-game bug or if this was done on purpose, but "Bonus Life" settings depend on the starting number of lives. DSW bit 6 has no effect because of this. @@ -74,41 +75,241 @@ Stephh's notes (based on the games Z80 code and some tests) : ***************************************************************************/ #include "emu.h" -#include "funkybee.h" #include "cpu/z80/z80.h" #include "machine/74259.h" +#include "machine/watchdog.h" #include "sound/ay8910.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" + +namespace { -uint8_t funkybee_state::funkybee_input_port_0_r() +class funkybee_state : public driver_device { - m_watchdog->watchdog_reset(); - return ioport("IN0")->read(); +public: + funkybee_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_videoram(*this, "videoram"), + m_colorram(*this, "colorram"), + m_maincpu(*this, "maincpu"), + m_watchdog(*this, "watchdog"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_in0(*this, "IN0") + { } + + void funkybee(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void video_start() override; + +private: + // memory pointers + required_shared_ptr m_videoram; + required_shared_ptr m_colorram; + + // devices + required_device m_maincpu; + required_device m_watchdog; + required_device m_gfxdecode; + required_device m_palette; + + // I/O + required_ioport m_in0; + + // video-related + tilemap_t *m_bg_tilemap = nullptr; + uint8_t m_gfx_bank = 0U; + uint8_t input_port_0_r(); + template DECLARE_WRITE_LINE_MEMBER(coin_counter_w); + void videoram_w(offs_t offset, uint8_t data); + void colorram_w(offs_t offset, uint8_t data); + DECLARE_WRITE_LINE_MEMBER(gfx_bank_w); + void scroll_w(uint8_t data); + TILE_GET_INFO_MEMBER(get_bg_tile_info); + TILEMAP_MAPPER_MEMBER(tilemap_scan); + void palette(palette_device &palette) const; + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_columns(bitmap_ind16 &bitmap, const rectangle &cliprect); + + void prg_map(address_map &map); + void io_map(address_map &map); +}; + + +// video + +void funkybee_state::palette(palette_device &palette) const +{ + const uint8_t *color_prom = memregion("proms")->base(); + + // first, the character/sprite palette + for (int i = 0; i < 32; i++) + { + int bit0, bit1, bit2; + + // red component + bit0 = BIT(*color_prom, 0); + bit1 = BIT(*color_prom, 1); + bit2 = BIT(*color_prom, 2); + int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + // green component + bit0 = BIT(*color_prom, 3); + bit1 = BIT(*color_prom, 4); + bit2 = BIT(*color_prom, 5); + int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + // blue component + bit0 = 0; + bit1 = BIT(*color_prom, 6); + bit2 = BIT(*color_prom, 7); + int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + palette.set_pen_color(i, rgb_t(r, g, b)); + color_prom++; + } +} + +void funkybee_state::videoram_w(offs_t offset, uint8_t data) +{ + m_videoram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); } -WRITE_LINE_MEMBER(funkybee_state::coin_counter_1_w) +void funkybee_state::colorram_w(offs_t offset, uint8_t data) { - machine().bookkeeping().coin_counter_w(0, state); + m_colorram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); } -WRITE_LINE_MEMBER(funkybee_state::coin_counter_2_w) +WRITE_LINE_MEMBER(funkybee_state::gfx_bank_w) { - machine().bookkeeping().coin_counter_w(1, state); + m_gfx_bank = state; + machine().tilemap().mark_all_dirty(); } -void funkybee_state::funkybee_map(address_map &map) +void funkybee_state::scroll_w(uint8_t data) +{ + m_bg_tilemap->set_scrollx(0, flip_screen() ? -data : data); +} + +TILE_GET_INFO_MEMBER(funkybee_state::get_bg_tile_info) +{ + int const code = m_videoram[tile_index] + ((m_colorram[tile_index] & 0x80) << 1); + int const color = m_colorram[tile_index] & 0x03; + + tileinfo.set(m_gfx_bank, code, color, 0); +} + +TILEMAP_MAPPER_MEMBER(funkybee_state::tilemap_scan) +{ + // logical (col,row) -> memory offset + return 256 * row + col; +} + +void funkybee_state::video_start() +{ + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(funkybee_state::get_bg_tile_info)), tilemap_mapper_delegate(*this, FUNC(funkybee_state::tilemap_scan)), 8, 8, 32, 32); +} + +void funkybee_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for (int offs = 0x0f; offs >= 0; offs--) + { + int const offs2 = offs + 0x1e00; + int const attr = m_videoram[offs2]; + int const code = (attr >> 2) | ((attr & 2) << 5); + int const color = m_colorram[offs2 + 0x10]; + int flipx = 0; + int const flipy = attr & 0x01; + int const sx = m_videoram[offs2 + 0x10]; + int sy = 224 - m_colorram[offs2]; + + if (flip_screen()) + { + sy += 32; + flipx = !flipx; + } + + m_gfxdecode->gfx(2 + m_gfx_bank)->transpen(bitmap, cliprect, + code, color, + flipx, flipy, + sx, sy, 0); + } +} + +void funkybee_state::draw_columns(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for (int offs = 0x1f; offs >= 0; offs--) + { + int const flip = flip_screen(); + int code = m_videoram[0x1c00 + offs]; + int color = m_colorram[0x1f10] & 0x03; + int sx = flip ? m_videoram[0x1f1f] : m_videoram[0x1f10]; + int sy = offs * 8; + + if (flip) + sy = 248 - sy; + + m_gfxdecode->gfx(m_gfx_bank)->transpen(bitmap, cliprect, + code, color, + flip, flip, + sx, sy, 0); + + code = m_videoram[0x1d00 + offs]; + color = m_colorram[0x1f11] & 0x03; + sx = flip ? m_videoram[0x1f1e] : m_videoram[0x1f11]; + sy = offs * 8; + + if (flip) + sy = 248 - sy; + + m_gfxdecode->gfx(m_gfx_bank)->transpen(bitmap, cliprect, + code, color, + flip, flip, + sx, sy, 0); + } +} + +uint32_t funkybee_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + draw_sprites(bitmap, cliprect); + draw_columns(bitmap, cliprect); + return 0; +} + + +// machine + +uint8_t funkybee_state::input_port_0_r() +{ + m_watchdog->watchdog_reset(); + return m_in0->read(); +} + +template +WRITE_LINE_MEMBER(funkybee_state::coin_counter_w) +{ + machine().bookkeeping().coin_counter_w(Which, state); +} + +void funkybee_state::prg_map(address_map &map) { map(0x0000, 0x4fff).rom(); map(0x8000, 0x87ff).ram(); - map(0xa000, 0xbfff).ram().w(FUNC(funkybee_state::funkybee_videoram_w)).share("videoram"); - map(0xc000, 0xdfff).ram().w(FUNC(funkybee_state::funkybee_colorram_w)).share("colorram"); - map(0xe000, 0xe000).w(FUNC(funkybee_state::funkybee_scroll_w)); + map(0xa000, 0xbfff).ram().w(FUNC(funkybee_state::videoram_w)).share(m_videoram); + map(0xc000, 0xdfff).ram().w(FUNC(funkybee_state::colorram_w)).share(m_colorram); + map(0xe000, 0xe000).w(FUNC(funkybee_state::scroll_w)); map(0xe800, 0xe807).w("mainlatch", FUNC(ls259_device::write_d0)); - map(0xf000, 0xf000).nopr(); /* IRQ Ack */ - map(0xf800, 0xf800).r(FUNC(funkybee_state::funkybee_input_port_0_r)).w(m_watchdog, FUNC(watchdog_timer_device::reset_w)); + map(0xf000, 0xf000).nopr(); // IRQ Ack + map(0xf800, 0xf800).r(FUNC(funkybee_state::input_port_0_r)).w(m_watchdog, FUNC(watchdog_timer_device::reset_w)); map(0xf801, 0xf801).portr("IN1"); map(0xf802, 0xf802).portr("IN2"); } @@ -219,11 +420,11 @@ static INPUT_PORTS_START( skylancr ) PORT_DIPSETTING( 0x0c, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x04, DEF_STR( 2C_3C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_6C ) ) - PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:4,3") /* Also affects bonus life */ - PORT_DIPSETTING( 0x30, "1" ) /* Bonus life at 20000 and 50000 */ - PORT_DIPSETTING( 0x20, "2" ) /* Bonus life at 20000 and 50000 */ - PORT_DIPSETTING( 0x10, "3" ) /* Bonus life at 40000 and 70000 */ - PORT_DIPSETTING( 0x00, "4" ) /* Bonus life at 40000 and 70000 */ + PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:4,3") // Also affects bonus life + PORT_DIPSETTING( 0x30, "1" ) // Bonus life at 20000 and 50000 + PORT_DIPSETTING( 0x20, "2" ) // Bonus life at 20000 and 50000 + PORT_DIPSETTING( 0x10, "3" ) // Bonus life at 40000 and 70000 + PORT_DIPSETTING( 0x00, "4" ) // Bonus life at 40000 and 70000 PORT_DIPUNUSED_DIPLOC( 0x40, IP_ACTIVE_LOW, "SW1:2" ) PORT_DIPNAME( 0x80, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:1") PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) @@ -234,14 +435,14 @@ static INPUT_PORTS_START( skylancre ) PORT_INCLUDE(skylancr) PORT_MODIFY("DSW") - PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:4,3") /* Also affects bonus life */ + PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:4,3") // Also affects bonus life PORT_DIPSETTING( 0x30, "3" ) PORT_DIPSETTING( 0x20, "4" ) PORT_DIPSETTING( 0x10, "5" ) PORT_DIPSETTING( 0x00, "6" ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW1:2") /* Manual calls this "Excent Play" (Excellent or extended?) */ - PORT_DIPSETTING( 0x40, "20000 50000" ) /* Manual calls this "Normal Level" */ - PORT_DIPSETTING( 0x00, "40000 70000" ) /* Manual calls this "High Level" */ + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW1:2") // Manual calls this "Excent Play" (Excellent or extended?) + PORT_DIPSETTING( 0x40, "20000 50000" ) // Manual calls this "Normal Level" + PORT_DIPSETTING( 0x00, "40000 70000" ) // Manual calls this "High Level" INPUT_PORTS_END @@ -271,10 +472,10 @@ static const gfx_layout spritelayout = }; static GFXDECODE_START( gfx_funkybee ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 8 ) - GFXDECODE_ENTRY( "gfx2", 0, charlayout, 0, 8 ) - GFXDECODE_ENTRY( "gfx1", 0, spritelayout, 16, 4 ) - GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 16, 4 ) + GFXDECODE_ENTRY( "gfxbank1", 0, charlayout, 0, 8 ) + GFXDECODE_ENTRY( "gfxbank2", 0, charlayout, 0, 8 ) + GFXDECODE_ENTRY( "gfxbank1", 0, spritelayout, 16, 4 ) + GFXDECODE_ENTRY( "gfxbank2", 0, spritelayout, 16, 4 ) GFXDECODE_END @@ -287,36 +488,36 @@ void funkybee_state::machine_start() void funkybee_state::funkybee(machine_config &config) { - /* basic machine hardware */ - Z80(config, m_maincpu, 3072000); /* 3.072 MHz */ - m_maincpu->set_addrmap(AS_PROGRAM, &funkybee_state::funkybee_map); + // basic machine hardware + Z80(config, m_maincpu, 3'072'000); // 3.072 MHz + m_maincpu->set_addrmap(AS_PROGRAM, &funkybee_state::prg_map); m_maincpu->set_addrmap(AS_IO, &funkybee_state::io_map); m_maincpu->set_vblank_int("screen", FUNC(funkybee_state::irq0_line_hold)); ls259_device &mainlatch(LS259(config, "mainlatch")); - mainlatch.q_out_cb<0>().set(FUNC(funkybee_state::flipscreen_w)); - mainlatch.q_out_cb<2>().set(FUNC(funkybee_state::coin_counter_1_w)); - mainlatch.q_out_cb<3>().set(FUNC(funkybee_state::coin_counter_2_w)); + mainlatch.q_out_cb<0>().set(FUNC(funkybee_state::flip_screen_set)); + mainlatch.q_out_cb<2>().set(FUNC(funkybee_state::coin_counter_w<0>)); + mainlatch.q_out_cb<3>().set(FUNC(funkybee_state::coin_counter_w<1>)); mainlatch.q_out_cb<5>().set(FUNC(funkybee_state::gfx_bank_w)); WATCHDOG_TIMER(config, m_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(32*8, 32*8); screen.set_visarea(12, 32*8-8-1, 0*8, 28*8-1); - screen.set_screen_update(FUNC(funkybee_state::screen_update_funkybee)); + screen.set_screen_update(FUNC(funkybee_state::screen_update)); screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_funkybee); - PALETTE(config, m_palette, FUNC(funkybee_state::funkybee_palette), 32); + PALETTE(config, m_palette, FUNC(funkybee_state::palette), 32); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); - ay8912_device &ay8912(AY8912(config, "aysnd", 1500000)); // AY-3-8912 verified for Sky Lancer + ay8912_device &ay8912(AY8912(config, "aysnd", 1'500'000)); // AY-3-8912 verified for Sky Lancer ay8912.port_a_read_callback().set_ioport("DSW"); ay8912.add_route(ALL_OUTPUTS, "mono", 0.50); } @@ -335,10 +536,10 @@ ROM_START( funkybee ) ROM_LOAD( "funkybee.2", 0x2000, 0x1000, CRC(8cc0fe8e) SHA1(416d97db0a2219ea46f2caa55787253e16a5ef32) ) ROM_LOAD( "funkybee.4", 0x3000, 0x1000, CRC(1e1aac26) SHA1(a2974e6a8da5568f91aa44adb58941b0a60b1536) ) - ROM_REGION( 0x2000, "gfx1", 0 ) + ROM_REGION( 0x2000, "gfxbank1", 0 ) ROM_LOAD( "funkybee.5", 0x0000, 0x2000, CRC(86126655) SHA1(d91682121d7f6a70f10a946ab81b248cc29bdf8c) ) - ROM_REGION( 0x2000, "gfx2", 0 ) + ROM_REGION( 0x2000, "gfxbank2", 0 ) ROM_LOAD( "funkybee.6", 0x0000, 0x2000, CRC(5fffd323) SHA1(9de9c869bd1e2daab3b94275444ecbe904bcd6aa) ) ROM_REGION( 0x0020, "proms", 0 ) @@ -346,8 +547,7 @@ ROM_START( funkybee ) ROM_END /* This is a bootleg of "Funky Bee", where ORCA copyright has been removed and difficulty is harder, - there are 2 lives less then in the original game - TODO: insert correct DIPSWITCH, where lives is "1,2,3,4" instead of "3,4,5,6" */ + there are 2 lives less then in the original game */ ROM_START( funkybeeb ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "senza_orca.fb1", 0x0000, 0x1000, CRC(7f2e7f85) SHA1(d4b63add3a97fc80aeafcd72a261302ab52d60a7) ) @@ -355,10 +555,10 @@ ROM_START( funkybeeb ) ROM_LOAD( "funkybee.2", 0x2000, 0x1000, CRC(8cc0fe8e) SHA1(416d97db0a2219ea46f2caa55787253e16a5ef32) ) ROM_LOAD( "senza_orca.fb4", 0x3000, 0x1000, CRC(53c2db3b) SHA1(0bda1eb87d7c41b67a5ff00b6675defdc8fe9274) ) - ROM_REGION( 0x2000, "gfx1", 0 ) + ROM_REGION( 0x2000, "gfxbank1", 0 ) ROM_LOAD( "funkybee.5", 0x0000, 0x2000, CRC(86126655) SHA1(d91682121d7f6a70f10a946ab81b248cc29bdf8c) ) - ROM_REGION( 0x2000, "gfx2", 0 ) + ROM_REGION( 0x2000, "gfxbank2", 0 ) ROM_LOAD( "funkybee.6", 0x0000, 0x2000, CRC(5fffd323) SHA1(9de9c869bd1e2daab3b94275444ecbe904bcd6aa) ) ROM_REGION( 0x0020, "proms", 0 ) @@ -401,10 +601,10 @@ ROM_START( skylancr ) ROM_LOAD( "2sl.5c", 0x2000, 0x2000, CRC(9d70567b) SHA1(05ff6f0c4b4d928e937556d9943a76f6cbc0f05f) ) ROM_LOAD( "3sl.5d", 0x4000, 0x2000, CRC(64c39457) SHA1(b54a57a8576c2f852b765350c4504ccc3f5a431c) ) - ROM_REGION( 0x2000, "gfx1", 0 ) + ROM_REGION( 0x2000, "gfxbank1", 0 ) ROM_LOAD( "4sl.6a", 0x0000, 0x2000, CRC(9b4469a5) SHA1(a0964e6d4fbdd15153be258f0d78680559a962f2) ) - ROM_REGION( 0x2000, "gfx2", 0 ) + ROM_REGION( 0x2000, "gfxbank2", 0 ) ROM_LOAD( "5sl.6c", 0x0000, 0x2000, CRC(29afa134) SHA1(d94f483b4d234fe0b1d406322409417daec092f2) ) ROM_REGION( 0x0020, "proms", 0 ) @@ -417,16 +617,19 @@ ROM_START( skylancre ) ROM_LOAD( "2.5c", 0x2000, 0x2000, CRC(dff3a682) SHA1(e3197e106c2c6d198d2769b63701222d48a196d1) ) ROM_LOAD( "3.5d", 0x4000, 0x1000, CRC(7c006ee6) SHA1(22719d4d0ad5c4f534a1613e0d74cab73973bab7) ) - ROM_REGION( 0x2000, "gfx1", 0 ) + ROM_REGION( 0x2000, "gfxbank1", 0 ) ROM_LOAD( "4.6a", 0x0000, 0x2000, CRC(0f8ede07) SHA1(e04456fe12e2282191aee4823941f23ad8bda99d) ) - ROM_REGION( 0x2000, "gfx2", 0 ) + ROM_REGION( 0x2000, "gfxbank2", 0 ) ROM_LOAD( "5.6b", 0x0000, 0x2000, CRC(24cec070) SHA1(2b7977b07acbe1394765675cd469db13a3b495f2) ) ROM_REGION( 0x0020, "proms", 0 ) ROM_LOAD( "18s030.1a", 0x0000, 0x0020, CRC(e645bacb) SHA1(5f4c299c4cf165fd229731c0e5799a34892bf28e) ) ROM_END +} // anonymous namespace + + GAME( 1982, funkybee, 0, funkybee, funkybee, funkybee_state, empty_init, ROT90, "Orca", "Funky Bee", MACHINE_SUPPORTS_SAVE ) GAME( 1982, funkybeeb, funkybee, funkybee, funkybeeb, funkybee_state, empty_init, ROT90, "bootleg", "Funky Bee (bootleg, harder)", MACHINE_SUPPORTS_SAVE ) GAME( 1983, skylancr, 0, funkybee, skylancr, funkybee_state, empty_init, ROT90, "Orca", "Sky Lancer", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/orca/funkybee.h b/src/mame/orca/funkybee.h deleted file mode 100644 index 557113ef059..00000000000 --- a/src/mame/orca/funkybee.h +++ /dev/null @@ -1,60 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Zsolt Vasvari -#ifndef MAME_INCLUDES_FUNKYBEE_H -#define MAME_INCLUDES_FUNKYBEE_H - -#pragma once - -#include "machine/watchdog.h" -#include "emupal.h" -#include "tilemap.h" - - -class funkybee_state : public driver_device -{ -public: - funkybee_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_videoram(*this, "videoram"), - m_colorram(*this, "colorram"), - m_maincpu(*this, "maincpu"), - m_watchdog(*this, "watchdog"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") - { } - - void funkybee(machine_config &config); - -private: - /* memory pointers */ - required_shared_ptr m_videoram; - required_shared_ptr m_colorram; - - /* video-related */ - tilemap_t *m_bg_tilemap = nullptr; - int m_gfx_bank = 0; - uint8_t funkybee_input_port_0_r(); - DECLARE_WRITE_LINE_MEMBER(coin_counter_1_w); - DECLARE_WRITE_LINE_MEMBER(coin_counter_2_w); - void funkybee_videoram_w(offs_t offset, uint8_t data); - void funkybee_colorram_w(offs_t offset, uint8_t data); - DECLARE_WRITE_LINE_MEMBER(gfx_bank_w); - void funkybee_scroll_w(uint8_t data); - DECLARE_WRITE_LINE_MEMBER(flipscreen_w); - TILE_GET_INFO_MEMBER(get_bg_tile_info); - TILEMAP_MAPPER_MEMBER(funkybee_tilemap_scan); - virtual void machine_start() override; - virtual void video_start() override; - void funkybee_palette(palette_device &palette) const; - uint32_t screen_update_funkybee(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); - void draw_columns( bitmap_ind16 &bitmap, const rectangle &cliprect ); - required_device m_maincpu; - required_device m_watchdog; - required_device m_gfxdecode; - required_device m_palette; - void funkybee_map(address_map &map); - void io_map(address_map &map); -}; - -#endif // MAME_INCLUDES_FUNKYBEE_H diff --git a/src/mame/orca/funkybee_v.cpp b/src/mame/orca/funkybee_v.cpp deleted file mode 100644 index 27ee49107fa..00000000000 --- a/src/mame/orca/funkybee_v.cpp +++ /dev/null @@ -1,160 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Zsolt Vasvari -/*************************************************************************** - - video.c - - Functions to emulate the video hardware of the machine. - -***************************************************************************/ - -#include "emu.h" -#include "funkybee.h" - -void funkybee_state::funkybee_palette(palette_device &palette) const -{ - const uint8_t *color_prom = memregion("proms")->base(); - - // first, the character/sprite palette - for (int i = 0; i < 32; i++) - { - int bit0, bit1, bit2; - - // red component - bit0 = BIT(*color_prom, 0); - bit1 = BIT(*color_prom, 1); - bit2 = BIT(*color_prom, 2); - int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - // green component - bit0 = BIT(*color_prom, 3); - bit1 = BIT(*color_prom, 4); - bit2 = BIT(*color_prom, 5); - int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - // blue component - bit0 = 0; - bit1 = BIT(*color_prom, 6); - bit2 = BIT(*color_prom, 7); - int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - palette.set_pen_color(i, rgb_t(r, g, b)); - color_prom++; - } -} - -void funkybee_state::funkybee_videoram_w(offs_t offset, uint8_t data) -{ - m_videoram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -void funkybee_state::funkybee_colorram_w(offs_t offset, uint8_t data) -{ - m_colorram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -WRITE_LINE_MEMBER(funkybee_state::gfx_bank_w) -{ - m_gfx_bank = state; - machine().tilemap().mark_all_dirty(); -} - -void funkybee_state::funkybee_scroll_w(uint8_t data) -{ - m_bg_tilemap->set_scrollx(0, flip_screen() ? -data : data); -} - -WRITE_LINE_MEMBER(funkybee_state::flipscreen_w) -{ - flip_screen_set(state); -} - -TILE_GET_INFO_MEMBER(funkybee_state::get_bg_tile_info) -{ - int code = m_videoram[tile_index] + ((m_colorram[tile_index] & 0x80) << 1); - int color = m_colorram[tile_index] & 0x03; - - tileinfo.set(m_gfx_bank, code, color, 0); -} - -TILEMAP_MAPPER_MEMBER(funkybee_state::funkybee_tilemap_scan) -{ - /* logical (col,row) -> memory offset */ - return 256 * row + col; -} - -void funkybee_state::video_start() -{ - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(funkybee_state::get_bg_tile_info)), tilemap_mapper_delegate(*this, FUNC(funkybee_state::funkybee_tilemap_scan)), 8, 8, 32, 32); -} - -void funkybee_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - int offs; - - for (offs = 0x0f; offs >= 0; offs--) - { - int offs2 = offs + 0x1e00; - int attr = m_videoram[offs2]; - int code = (attr >> 2) | ((attr & 2) << 5); - int color = m_colorram[offs2 + 0x10]; - int flipx = 0; - int flipy = attr & 0x01; - int sx = m_videoram[offs2 + 0x10]; - int sy = 224 - m_colorram[offs2]; - - if (flip_screen()) - { - sy += 32; - flipx = !flipx; - } - - m_gfxdecode->gfx(2 + m_gfx_bank)->transpen(bitmap,cliprect, - code, color, - flipx, flipy, - sx, sy, 0); - } -} - -void funkybee_state::draw_columns( bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - int offs; - - for (offs = 0x1f; offs >= 0; offs--) - { - int const flip = flip_screen(); - int code = m_videoram[0x1c00 + offs]; - int color = m_colorram[0x1f10] & 0x03; - int sx = flip ? m_videoram[0x1f1f] : m_videoram[0x1f10]; - int sy = offs * 8; - - if (flip) - sy = 248 - sy; - - m_gfxdecode->gfx(m_gfx_bank)->transpen(bitmap,cliprect, - code, color, - flip, flip, - sx, sy,0); - - code = m_videoram[0x1d00 + offs]; - color = m_colorram[0x1f11] & 0x03; - sx = flip ? m_videoram[0x1f1e] : m_videoram[0x1f11]; - sy = offs * 8; - - if (flip) - sy = 248 - sy; - - m_gfxdecode->gfx(m_gfx_bank)->transpen(bitmap,cliprect, - code, color, - flip, flip, - sx, sy,0); - } -} - -uint32_t funkybee_state::screen_update_funkybee(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - draw_sprites(bitmap, cliprect); - draw_columns(bitmap, cliprect); - return 0; -} diff --git a/src/mame/orca/marineb.cpp b/src/mame/orca/marineb.cpp index 0a4c2cf8c22..ab192722183 100644 --- a/src/mame/orca/marineb.cpp +++ b/src/mame/orca/marineb.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:Zsolt Vasvari +// copyright-holders: Zsolt Vasvari + /*************************************************************************** Marine Boy hardware memory map (preliminary) @@ -38,16 +39,549 @@ write ***************************************************************************/ #include "emu.h" -#include "marineb.h" #include "cpu/z80/z80.h" +#include "machine/74259.h" +#include "machine/watchdog.h" #include "sound/ay8910.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" + + +namespace { + +class marineb_state : public driver_device +{ +public: + marineb_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_videoram(*this, "videoram"), + m_spriteram(*this, "spriteram"), + m_colorram(*this, "colorram"), + m_system(*this, "SYSTEM"), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_outlatch(*this, "outlatch"), + m_watchdog(*this, "watchdog") + { } + + void springer(machine_config &config); + void wanted(machine_config &config); + void hopprobo(machine_config &config); + void marineb(machine_config &config); + void bcruzm12(machine_config &config); + void hoccer(machine_config &config); + void changes(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + +private: + required_shared_ptr m_videoram; + required_shared_ptr m_spriteram; + required_shared_ptr m_colorram; + required_ioport m_system; + + // video-related + tilemap_t *m_bg_tilemap = nullptr; + uint8_t m_palette_bank = 0; + uint8_t m_column_scroll = 0; + uint8_t m_flipscreen_x = 0; + uint8_t m_flipscreen_y = 0; + + // devices + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_palette; + required_device m_outlatch; + required_device m_watchdog; + + bool m_irq_mask = false; + + // common methods + void videoram_w(offs_t offset, uint8_t data); + void colorram_w(offs_t offset, uint8_t data); + void column_scroll_w(uint8_t data); + void palette_bank_0_w(uint8_t data); + void palette_bank_1_w(uint8_t data); + DECLARE_WRITE_LINE_MEMBER(flipscreen_x_w); + DECLARE_WRITE_LINE_MEMBER(flipscreen_y_w); + TILE_GET_INFO_MEMBER(get_tile_info); + void palette(palette_device &palette) const; + void set_tilemap_scrolly(int cols); + + // game specific screen update methods + uint32_t screen_update_marineb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update_changes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update_springer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update_hoccer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update_hopprobo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + + // marineb, changes, springer, hoccer, hopprobo + DECLARE_WRITE_LINE_MEMBER(nmi_mask_w); + uint8_t system_watchdog_r(); + DECLARE_WRITE_LINE_MEMBER(marineb_vblank_irq); + void marineb_map(address_map &map); + void marineb_io_map(address_map &map); + + // wanted, bcruzm12 + DECLARE_WRITE_LINE_MEMBER(irq_mask_w); + DECLARE_WRITE_LINE_MEMBER(wanted_vblank_irq); + void wanted_map(address_map &map); + void wanted_io_map(address_map &map); +}; + + +// video + +void marineb_state::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) & 0x01; + bit1 = BIT(color_prom[i + palette.entries()], 0); + bit2 = BIT(color_prom[i + palette.entries()], 1); + int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + // blue component + bit0 = 0; + bit1 = BIT(color_prom[i + palette.entries()], 2); + bit2 = BIT(color_prom[i + palette.entries()], 3); + int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + palette.set_pen_color(i, rgb_t(r, g, b)); + } +} + +/*************************************************************************** + + Callbacks for the TileMap code + +***************************************************************************/ + +TILE_GET_INFO_MEMBER(marineb_state::get_tile_info) +{ + uint8_t const code = m_videoram[tile_index]; + uint8_t const col = m_colorram[tile_index]; + + tileinfo.set(0, + code | ((col & 0xc0) << 2), + (col & 0x0f) | (m_palette_bank << 4), + TILE_FLIPXY((col >> 4) & 0x03)); +} + + + +/************************************* + * + * Video system start + * + *************************************/ -#define MASTER_CLOCK (XTAL(12'000'000)) -#define CPU_CLOCK (MASTER_CLOCK/4) -#define SOUND_CLOCK (MASTER_CLOCK/8) +void marineb_state::video_start() +{ + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(marineb_state::get_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + m_bg_tilemap->set_scroll_cols(32); + + save_item(NAME(m_palette_bank)); + save_item(NAME(m_column_scroll)); + save_item(NAME(m_flipscreen_x)); + save_item(NAME(m_flipscreen_y)); +} + + + +/************************************* + * + * Memory handlers + * + *************************************/ + +void marineb_state::videoram_w(offs_t offset, uint8_t data) +{ + m_videoram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + + +void marineb_state::colorram_w(offs_t offset, uint8_t data) +{ + m_colorram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + + +void marineb_state::column_scroll_w(uint8_t data) +{ + m_column_scroll = data; +} + + +void marineb_state::palette_bank_0_w(uint8_t data) +{ + uint8_t const old = m_palette_bank; + + m_palette_bank = (m_palette_bank & 0x02) | (data & 0x01); + + if (old != m_palette_bank) + { + m_bg_tilemap->mark_all_dirty(); + } +} + + +void marineb_state::palette_bank_1_w(uint8_t data) +{ + uint8_t const old = m_palette_bank; + + m_palette_bank = (m_palette_bank & 0x01) | ((data & 0x01) << 1); + + if (old != m_palette_bank) + { + m_bg_tilemap->mark_all_dirty(); + } +} + + +WRITE_LINE_MEMBER(marineb_state::flipscreen_x_w) +{ + m_flipscreen_x = state; + m_bg_tilemap->set_flip((m_flipscreen_x ? TILEMAP_FLIPX : 0) | (m_flipscreen_y ? TILEMAP_FLIPY : 0)); +} + + +WRITE_LINE_MEMBER(marineb_state::flipscreen_y_w) +{ + m_flipscreen_y = state; + m_bg_tilemap->set_flip((m_flipscreen_x ? TILEMAP_FLIPX : 0) | (m_flipscreen_y ? TILEMAP_FLIPY : 0)); +} + + + +/************************************* + * + * Video update + * + *************************************/ + +void marineb_state::set_tilemap_scrolly(int cols) +{ + int col; + + for (col = 0; col < cols; col++) + m_bg_tilemap->set_scrolly(col, m_column_scroll); + + for (; col < 32; col++) + m_bg_tilemap->set_scrolly(col, 0); +} + + +uint32_t marineb_state::screen_update_marineb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + set_tilemap_scrolly(24); + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + + // draw the sprites + for (int offs = 0x0f; offs >= 0; offs--) + { + if ((offs == 0) || (offs == 2)) + continue; // no sprites here + + int offs2; + + if (offs < 8) + offs2 = 0x0018 + offs; + else + offs2 = 0x03d8 - 8 + offs; + + int code = m_videoram[offs2]; + int sx = m_videoram[offs2 + 0x20]; + int sy = m_colorram[offs2]; + int const col = (m_colorram[offs2 + 0x20] & 0x0f) + 16 * m_palette_bank; + int const flipx = code & 0x02; + int flipy = !(code & 0x01); + + int gfx; + + if (offs < 4) + { + // big sprite + gfx = 2; + code = (code >> 4) | ((code & 0x0c) << 2); + } + else + { + // small sprite + gfx = 1; + code >>= 2; + } + + if (!m_flipscreen_y) + { + sy = 256 - m_gfxdecode->gfx(gfx)->width() - sy; + flipy = !flipy; + } + + if (m_flipscreen_x) + { + sx++; + } + + m_gfxdecode->gfx(gfx)->transpen(bitmap, cliprect, + code, + col, + flipx, flipy, + sx, sy, 0); + } + return 0; +} + + +uint32_t marineb_state::screen_update_changes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int sx, sy, code, col, flipx, flipy; + + set_tilemap_scrolly(26); + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + + // draw the small sprites + for (int offs = 0x05; offs >= 0; offs--) + { + int const offs2 = 0x001a + offs; + + code = m_videoram[offs2]; + sx = m_videoram[offs2 + 0x20]; + sy = m_colorram[offs2]; + col = (m_colorram[offs2 + 0x20] & 0x0f) + 16 * m_palette_bank; + flipx = code & 0x02; + flipy = !(code & 0x01); + + if (!m_flipscreen_y) + { + sy = 256 - m_gfxdecode->gfx(1)->width() - sy; + flipy = !flipy; + } + + if (m_flipscreen_x) + { + sx++; + } + + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, + code >> 2, + col, + flipx, flipy, + sx, sy, 0); + } + + // draw the big sprite + + code = m_videoram[0x3df]; + sx = m_videoram[0x3ff]; + sy = m_colorram[0x3df]; + col = m_colorram[0x3ff]; + flipx = code & 0x02; + flipy = !(code & 0x01); + + if (!m_flipscreen_y) + { + sy = 256 - m_gfxdecode->gfx(2)->width() - sy; + flipy = !flipy; + } + + if (m_flipscreen_x) + { + sx++; + } + + code >>= 4; + + m_gfxdecode->gfx(2)->transpen(bitmap, cliprect, + code, + col, + flipx, flipy, + sx, sy, 0); + + // draw again for wrap around + + m_gfxdecode->gfx(2)->transpen(bitmap, cliprect, + code, + col, + flipx, flipy, + sx - 256, sy, 0); + return 0; +} + + +uint32_t marineb_state::screen_update_springer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + set_tilemap_scrolly(0); + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + + // draw the sprites + for (int offs = 0x0f; offs >= 0; offs--) + { + if ((offs == 0) || (offs == 2)) + continue; // no sprites here + + int const offs2 = 0x0010 + offs; + + int code = m_videoram[offs2]; + int sx = 240 - m_videoram[offs2 + 0x20]; + int sy = m_colorram[offs2]; + int const col = (m_colorram[offs2 + 0x20] & 0x0f) + 16 * m_palette_bank; + int const flipx = !(code & 0x02); + int flipy = !(code & 0x01); + + int gfx; + + if (offs < 4) + { + // big sprite + sx -= 0x10; + gfx = 2; + code = (code >> 4) | ((code & 0x0c) << 2); + } + else + { + // small sprite + gfx = 1; + code >>= 2; + } + + if (!m_flipscreen_y) + { + sy = 256 - m_gfxdecode->gfx(gfx)->width() - sy; + flipy = !flipy; + } + + if (!m_flipscreen_x) + { + sx--; + } + + m_gfxdecode->gfx(gfx)->transpen(bitmap, cliprect, + code, + col, + flipx, flipy, + sx, sy, 0); + } + return 0; +} + + +uint32_t marineb_state::screen_update_hoccer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + set_tilemap_scrolly(0); + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + + // draw the sprites + for (int offs = 0x07; offs >= 0; offs--) + { + int const offs2 = 0x0018 + offs; + + int const code = m_spriteram[offs2]; + int sx = m_spriteram[offs2 + 0x20]; + int sy = m_colorram[offs2]; + int const col = m_colorram[offs2 + 0x20]; + int flipx = code & 0x02; + int flipy = !(code & 0x01); + + if (!m_flipscreen_y) + { + sy = 256 - m_gfxdecode->gfx(1)->width() - sy; + flipy = !flipy; + } + + if (m_flipscreen_x) + { + sx = 256 - m_gfxdecode->gfx(1)->width() - sx; + flipx = !flipx; + } + + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, + code >> 2, + col, + flipx, flipy, + sx, sy, 0); + } + return 0; +} + + +uint32_t marineb_state::screen_update_hopprobo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + set_tilemap_scrolly(0); + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + + // draw the sprites + for (int offs = 0x0f; offs >= 0; offs--) + { + if ((offs == 0) || (offs == 2)) + continue; // no sprites here + + int const offs2 = 0x0010 + offs; + + int code = m_videoram[offs2]; + int sx = m_videoram[offs2 + 0x20]; + int sy = m_colorram[offs2]; + int const col = (m_colorram[offs2 + 0x20] & 0x0f) + 16 * m_palette_bank; + int const flipx = code & 0x02; + int flipy = !(code & 0x01); + + int gfx; + + if (offs < 4) + { + // big sprite + gfx = 2; + code = (code >> 4) | ((code & 0x0c) << 2); + } + else + { + // small sprite + gfx = 1; + code >>= 2; + } + + if (!m_flipscreen_y) + { + sy = 256 - m_gfxdecode->gfx(gfx)->width() - sy; + flipy = !flipy; + } + + if (!m_flipscreen_x) + { + sx--; + } + + m_gfxdecode->gfx(gfx)->transpen(bitmap, cliprect, + code, + col, + flipx, flipy, + sx, sy, 0); + } + return 0; +} + + +// machine void marineb_state::machine_reset() { @@ -88,12 +622,12 @@ void marineb_state::marineb_map(address_map &map) { map(0x0000, 0x7fff).rom(); map(0x8000, 0x87ff).ram(); - map(0x8800, 0x8bff).ram().w(FUNC(marineb_state::marineb_videoram_w)).share("videoram"); - map(0x8c00, 0x8c3f).ram().share("spriteram"); /* Hoccer only */ - map(0x9000, 0x93ff).ram().w(FUNC(marineb_state::marineb_colorram_w)).share("colorram"); - map(0x9800, 0x9800).w(FUNC(marineb_state::marineb_column_scroll_w)); - map(0x9a00, 0x9a00).w(FUNC(marineb_state::marineb_palette_bank_0_w)); - map(0x9c00, 0x9c00).w(FUNC(marineb_state::marineb_palette_bank_1_w)); + map(0x8800, 0x8bff).ram().w(FUNC(marineb_state::videoram_w)).share(m_videoram); + map(0x8c00, 0x8c3f).ram().share(m_spriteram); // Hoccer only + map(0x9000, 0x93ff).ram().w(FUNC(marineb_state::colorram_w)).share(m_colorram); + map(0x9800, 0x9800).w(FUNC(marineb_state::column_scroll_w)); + map(0x9a00, 0x9a00).w(FUNC(marineb_state::palette_bank_0_w)); + map(0x9c00, 0x9c00).w(FUNC(marineb_state::palette_bank_1_w)); map(0xa000, 0xa007).w(m_outlatch, FUNC(ls259_device::write_d0)); map(0xa000, 0xa000).portr("P2"); map(0xa800, 0xa800).portr("P1"); @@ -143,9 +677,9 @@ static INPUT_PORTS_START( marineb ) PORT_DIPSETTING( 0x01, "4" ) PORT_DIPSETTING( 0x02, "5" ) PORT_DIPSETTING( 0x03, "6" ) - PORT_DIPNAME( 0x1c, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:3,4,5") /* coinage doesn't work?? - always 1C / 1C or Free Play?? */ + PORT_DIPNAME( 0x1c, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:3,4,5") // coinage doesn't work?? - always 1C / 1C or Free Play?? PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) -// PORT_DIPSETTING( 0x14, DEF_STR( 2C_1C ) ) /* This is the correct Coinage according to manual */ +// PORT_DIPSETTING( 0x14, DEF_STR( 2C_1C ) ) // This is the correct Coinage according to manual // PORT_DIPSETTING( 0x18, DEF_STR( 3C_2C ) ) // PORT_DIPSETTING( 0x04, DEF_STR( 1C_2C ) ) // PORT_DIPSETTING( 0x08, DEF_STR( 1C_3C ) ) @@ -193,8 +727,8 @@ static INPUT_PORTS_START( changes ) PORT_DIPSETTING( 0x01, "4" ) PORT_DIPSETTING( 0x02, "5" ) PORT_DIPSETTING( 0x03, "6" ) - PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:3,4") /* coinage doesn't work?? - always 1C / 1C or Free Play?? */ -// PORT_DIPSETTING( 0x08, DEF_STR( 2C_1C ) ) /* This is the correct Coinage according to manual */ + PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:3,4") // coinage doesn't work?? - always 1C / 1C or Free Play?? +// PORT_DIPSETTING( 0x08, DEF_STR( 2C_1C ) ) // This is the correct Coinage according to manual PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) // PORT_DIPSETTING( 0x04, DEF_STR( 1C_2C ) ) PORT_DIPSETTING( 0x0c, DEF_STR( Free_Play ) ) @@ -313,7 +847,7 @@ static INPUT_PORTS_START( wanted ) PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x80, DEF_STR( On ) ) - PORT_START("SYSTEM") /* we use same tags as above, to simplify reads */ + PORT_START("SYSTEM") // we use same tags as above, to simplify reads PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) ) PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x01, DEF_STR( On ) ) @@ -385,7 +919,7 @@ static INPUT_PORTS_START( bcruzm12 ) PORT_DIPSETTING( 0x40, DEF_STR( On ) ) PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW2:8" ) - PORT_START("SYSTEM") /* we use same tags as above, to simplify reads */ + PORT_START("SYSTEM") // we use same tags as above, to simplify reads PORT_DIPNAME( 0x03, 0x01, "2nd Bonus Life" ) PORT_DIPLOCATION("SW1:1,2") PORT_DIPSETTING( 0x00, DEF_STR( None ) ) PORT_DIPSETTING( 0x01, "60000" ) @@ -417,56 +951,56 @@ INPUT_PORTS_END static const gfx_layout marineb_charlayout = { - 8,8, /* 8*8 characters */ - 512, /* 512 characters */ - 2, /* 2 bits per pixel */ - { 0, 4 }, /* the two bitplanes for 4 pixels are packed into one byte */ - { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3 }, /* bits are packed in groups of four */ + 8,8, // 8*8 characters + 512, // 512 characters + 2, // 2 bits per pixel + { 0, 4 }, // the two bitplanes for 4 pixels are packed into one byte + { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3 }, // bits are packed in groups of four { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 16*8 /* every char takes 16 bytes */ + 16*8 // every char takes 16 bytes }; static const gfx_layout wanted_charlayout = { - 8,8, /* 8*8 characters */ - 1024, /* 1024 characters */ - 2, /* 2 bits per pixel */ - { 4, 0 }, /* the two bitplanes for 4 pixels are packed into one byte */ - { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3 }, /* bits are packed in groups of four */ + 8,8, // 8*8 characters + 1024, // 1024 characters + 2, // 2 bits per pixel + { 4, 0 }, // the two bitplanes for 4 pixels are packed into one byte + { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3 }, // bits are packed in groups of four { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 16*8 /* every char takes 16 bytes */ + 16*8 // every char takes 16 bytes }; static const gfx_layout hopprobo_charlayout = { - 8,8, /* 8*8 characters */ - 1024, /* 1024 characters */ - 2, /* 2 bits per pixel */ - { 0, 4 }, /* the two bitplanes for 4 pixels are packed into one byte */ - { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3 }, /* bits are packed in groups of four */ + 8,8, // 8*8 characters + 1024, // 1024 characters + 2, // 2 bits per pixel + { 0, 4 }, // the two bitplanes for 4 pixels are packed into one byte + { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3 }, // bits are packed in groups of four { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 16*8 /* every char takes 16 bytes */ + 16*8 // every char takes 16 bytes }; static const gfx_layout marineb_small_spritelayout = { - 16,16, /* 16*16 sprites */ - 64, /* 64 sprites */ - 2, /* 2 bits per pixel */ - { 0, 256*32*8 }, /* the two bitplanes are separated */ + 16,16, // 16*16 sprites + 64, // 64 sprites + 2, // 2 bits per pixel + { 0, 256*32*8 }, // the two bitplanes are separated { 0, 1, 2, 3, 4, 5, 6, 7, 8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8 }, - 32*8 /* every sprite takes 32 consecutive bytes */ + 32*8 // every sprite takes 32 consecutive bytes }; static const gfx_layout marineb_big_spritelayout = { - 32,32, /* 32*32 sprites */ - 64, /* 64 sprites */ - 2, /* 2 bits per pixel */ - { 0, 256*32*8 }, /* the two bitplanes are separated */ + 32,32, // 32*32 sprites + 64, // 64 sprites + 2, // 2 bits per pixel + { 0, 256*32*8 }, // the two bitplanes are separated { 0, 1, 2, 3, 4, 5, 6, 7, 8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7, 32*8+0, 32*8+1, 32*8+2, 32*8+3, 32*8+4, 32*8+5, 32*8+6, 32*8+7, @@ -475,28 +1009,28 @@ static const gfx_layout marineb_big_spritelayout = 16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8, 64*8, 65*8, 66*8, 67*8, 68*8, 69*8, 70*8, 71*8, 80*8, 81*8, 82*8, 83*8, 84*8, 85*8, 86*8, 87*8 }, - 4*32*8 /* every sprite takes 128 consecutive bytes */ + 4*32*8 // every sprite takes 128 consecutive bytes }; static const gfx_layout changes_small_spritelayout = { - 16,16, /* 16*16 sprites */ - 64, /* 64 sprites */ - 2, /* 2 bits per pixel */ - { 0, 4 }, /* the two bitplanes for 4 pixels are packed into one byte */ + 16,16, // 16*16 sprites + 64, // 64 sprites + 2, // 2 bits per pixel + { 0, 4 }, // the two bitplanes for 4 pixels are packed into one byte { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3, 16*8+0, 16*8+1, 16*8+2, 16*8+3, 24*8+0, 24*8+1, 24*8+2, 24*8+3 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 }, - 64*8 /* every sprite takes 64 consecutive bytes */ + 64*8 // every sprite takes 64 consecutive bytes }; static const gfx_layout changes_big_spritelayout = { - 32,32, /* 32*3 sprites */ - 16, /* 32 sprites */ - 2, /* 2 bits per pixel */ - { 0, 4 }, /* the two bitplanes for 4 pixels are packed into one byte */ + 32,32, // 32*3 sprites + 16, // 32 sprites + 2, // 2 bits per pixel + { 0, 4 }, // the two bitplanes for 4 pixels are packed into one byte { 0, 1, 2, 3, 8*8+0, 8*8+1, 8*8+2, 8*8+3, 16*8+0, 16*8+1, 16*8+2, 16*8+3, 24*8+0, 24*8+1, 24*8+2, 24*8+3, 64*8+0, 64*8+1, 64*8+2, 64*8+3, 72*8+0, 72*8+1, 72*8+2, 72*8+3, @@ -505,37 +1039,37 @@ static const gfx_layout changes_big_spritelayout = 32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8, 128*8, 129*8, 130*8, 131*8, 132*8, 133*8, 134*8, 135*8, 160*8, 161*8, 162*8, 163*8, 164*8, 165*8, 166*8, 167*8 }, - 4*64*8 /* every sprite takes 256 consecutive bytes */ + 4*64*8 // every sprite takes 256 consecutive bytes }; static GFXDECODE_START( gfx_marineb ) - GFXDECODE_ENTRY( "gfx1", 0x0000, marineb_charlayout, 0, 64 ) - GFXDECODE_ENTRY( "gfx2", 0x0000, marineb_small_spritelayout, 0, 64 ) - GFXDECODE_ENTRY( "gfx2", 0x0000, marineb_big_spritelayout, 0, 64 ) + GFXDECODE_ENTRY( "tiles", 0x0000, marineb_charlayout, 0, 64 ) + GFXDECODE_ENTRY( "sprites", 0x0000, marineb_small_spritelayout, 0, 64 ) + GFXDECODE_ENTRY( "sprites", 0x0000, marineb_big_spritelayout, 0, 64 ) GFXDECODE_END static GFXDECODE_START( gfx_wanted ) - GFXDECODE_ENTRY( "gfx1", 0x0000, wanted_charlayout, 0, 64 ) - GFXDECODE_ENTRY( "gfx2", 0x0000, marineb_small_spritelayout, 0, 64 ) - GFXDECODE_ENTRY( "gfx2", 0x0000, marineb_big_spritelayout, 0, 64 ) + GFXDECODE_ENTRY( "tiles", 0x0000, wanted_charlayout, 0, 64 ) + GFXDECODE_ENTRY( "sprites", 0x0000, marineb_small_spritelayout, 0, 64 ) + GFXDECODE_ENTRY( "sprites", 0x0000, marineb_big_spritelayout, 0, 64 ) GFXDECODE_END static GFXDECODE_START( gfx_changes ) - GFXDECODE_ENTRY( "gfx1", 0x0000, marineb_charlayout, 0, 64 ) - GFXDECODE_ENTRY( "gfx2", 0x0000, changes_small_spritelayout, 0, 64 ) - GFXDECODE_ENTRY( "gfx2", 0x1000, changes_big_spritelayout, 0, 64 ) + GFXDECODE_ENTRY( "tiles", 0x0000, marineb_charlayout, 0, 64 ) + GFXDECODE_ENTRY( "sprites", 0x0000, changes_small_spritelayout, 0, 64 ) + GFXDECODE_ENTRY( "sprites", 0x1000, changes_big_spritelayout, 0, 64 ) GFXDECODE_END static GFXDECODE_START( gfx_hoccer ) - GFXDECODE_ENTRY( "gfx1", 0x0000, marineb_charlayout, 0, 16 ) /* no palette banks */ - GFXDECODE_ENTRY( "gfx2", 0x0000, changes_small_spritelayout, 0, 16 ) /* no palette banks */ + GFXDECODE_ENTRY( "tiles", 0x0000, marineb_charlayout, 0, 16 ) // no palette banks + GFXDECODE_ENTRY( "sprites", 0x0000, changes_small_spritelayout, 0, 16 ) // no palette banks GFXDECODE_END static GFXDECODE_START( gfx_hopprobo ) - GFXDECODE_ENTRY( "gfx1", 0x0000, hopprobo_charlayout, 0, 64 ) - GFXDECODE_ENTRY( "gfx2", 0x0000, marineb_small_spritelayout, 0, 64 ) - GFXDECODE_ENTRY( "gfx2", 0x0000, marineb_big_spritelayout, 0, 64 ) + GFXDECODE_ENTRY( "tiles", 0x0000, hopprobo_charlayout, 0, 64 ) + GFXDECODE_ENTRY( "sprites", 0x0000, marineb_small_spritelayout, 0, 64 ) + GFXDECODE_ENTRY( "sprites", 0x0000, marineb_big_spritelayout, 0, 64 ) GFXDECODE_END WRITE_LINE_MEMBER(marineb_state::marineb_vblank_irq) @@ -551,10 +1085,14 @@ WRITE_LINE_MEMBER(marineb_state::wanted_vblank_irq) } +static constexpr XTAL MASTER_CLOCK = XTAL(12'000'000); +static constexpr XTAL CPU_CLOCK = MASTER_CLOCK / 4; +static constexpr XTAL SOUND_CLOCK = MASTER_CLOCK / 8; + void marineb_state::marineb(machine_config &config) { - /* basic machine hardware */ - Z80(config, m_maincpu, CPU_CLOCK); /* 3 MHz? */ + // basic machine hardware + Z80(config, m_maincpu, CPU_CLOCK); // 3 MHz? m_maincpu->set_addrmap(AS_PROGRAM, &marineb_state::marineb_map); m_maincpu->set_addrmap(AS_IO, &marineb_state::marineb_io_map); @@ -565,10 +1103,10 @@ void marineb_state::marineb(machine_config &config) WATCHDOG_TIMER(config, m_watchdog).set_vblank_count("screen", 16); - /* 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(5000) /* frames per second, vblank duration */); + screen.set_vblank_time(ATTOSECONDS_IN_USEC(5000)); // frames per second, vblank duration screen.set_size(32*8, 32*8); screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1); screen.set_screen_update(FUNC(marineb_state::screen_update_marineb)); @@ -576,9 +1114,9 @@ void marineb_state::marineb(machine_config &config) screen.screen_vblank().set(FUNC(marineb_state::marineb_vblank_irq)); GFXDECODE(config, m_gfxdecode, m_palette, gfx_marineb); - PALETTE(config, m_palette, FUNC(marineb_state::marineb_palette), 256); + PALETTE(config, m_palette, FUNC(marineb_state::palette), 256); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); AY8910(config, "ay1", SOUND_CLOCK).add_route(ALL_OUTPUTS, "mono", 0.50); } @@ -588,7 +1126,7 @@ void marineb_state::changes(machine_config &config) { marineb(config); - /* video hardware */ + // video hardware m_gfxdecode->set_info(gfx_changes); subdevice("screen")->set_screen_update(FUNC(marineb_state::screen_update_changes)); } @@ -609,7 +1147,7 @@ void marineb_state::hoccer(machine_config &config) { marineb(config); - /* video hardware */ + // video hardware m_gfxdecode->set_info(gfx_hoccer); subdevice("screen")->set_screen_update(FUNC(marineb_state::screen_update_hoccer)); } @@ -619,13 +1157,13 @@ void marineb_state::wanted(machine_config &config) { marineb(config); - /* basic machine hardware */ + // basic machine hardware m_maincpu->set_addrmap(AS_PROGRAM, &marineb_state::wanted_map); m_maincpu->set_addrmap(AS_IO, &marineb_state::wanted_io_map); m_outlatch->q_out_cb<0>().set(FUNC(marineb_state::irq_mask_w)); - /* video hardware */ + // video hardware m_gfxdecode->set_info(gfx_wanted); subdevice("screen")->set_screen_update(FUNC(marineb_state::screen_update_springer)); subdevice("screen")->screen_vblank().set(FUNC(marineb_state::wanted_vblank_irq)); @@ -641,7 +1179,7 @@ void marineb_state::hopprobo(machine_config &config) { marineb(config); - /* video hardware */ + // video hardware m_gfxdecode->set_info(gfx_hopprobo); subdevice("screen")->set_screen_update(FUNC(marineb_state::screen_update_hopprobo)); } @@ -669,16 +1207,16 @@ ROM_START( marineb ) ROM_LOAD( "marineb.4", 0x3000, 0x1000, CRC(a157a283) SHA1(741e44c75636e5349ad43308076e1a8533255711) ) ROM_LOAD( "marineb.5", 0x4000, 0x1000, CRC(9ffff9c0) SHA1(55fa22f28e56c69cee50d4054206cb7f63e24590) ) - ROM_REGION( 0x2000, "gfx1", 0 ) + ROM_REGION( 0x2000, "tiles", 0 ) ROM_LOAD( "marineb.6", 0x0000, 0x2000, CRC(ee53ec2e) SHA1(a8aab0ad70a20884e30420a6956b503cf7fdfbb8) ) - ROM_REGION( 0x4000, "gfx2", 0 ) + ROM_REGION( 0x4000, "sprites", 0 ) ROM_LOAD( "marineb.8", 0x0000, 0x2000, CRC(dc8bc46c) SHA1(5ac945d7632dbc24a47d4dd8816b931b5615e2cd) ) ROM_LOAD( "marineb.7", 0x2000, 0x2000, CRC(9d2e19ab) SHA1(a64460c9222447cc63094350f910a9f73c423edd) ) ROM_REGION( 0x0200, "proms", 0 ) - ROM_LOAD( "marineb.1b", 0x0000, 0x0100, CRC(f32d9472) SHA1(b965eabb313cdfa0d10f8f25f659e20b0abe9a97) ) /* palette low 4 bits */ - ROM_LOAD( "marineb.1c", 0x0100, 0x0100, CRC(93c69d3e) SHA1(d13720fa4947e5058d4d699990b9a731e25e5595) ) /* palette high 4 bits */ + ROM_LOAD( "marineb.1b", 0x0000, 0x0100, CRC(f32d9472) SHA1(b965eabb313cdfa0d10f8f25f659e20b0abe9a97) ) // palette low 4 bits + ROM_LOAD( "marineb.1c", 0x0100, 0x0100, CRC(93c69d3e) SHA1(d13720fa4947e5058d4d699990b9a731e25e5595) ) // palette high 4 bits ROM_END ROM_START( changes ) @@ -689,15 +1227,15 @@ ROM_START( changes ) ROM_LOAD( "changes.4", 0x3000, 0x1000, CRC(a8e9aa22) SHA1(fbccf017851eb099960ad51ef3060a16bc0107a5) ) ROM_LOAD( "changes.5", 0x4000, 0x1000, CRC(f4198e9e) SHA1(4a9aea2b38d3bf093d9e97c884a7a9d16c203a46) ) - ROM_REGION( 0x2000, "gfx1", 0 ) + ROM_REGION( 0x2000, "tiles", 0 ) ROM_LOAD( "changes.7", 0x0000, 0x2000, CRC(2204194e) SHA1(97ee40dd804158e92a2a1034f8e910f1057a7b54) ) - ROM_REGION( 0x2000, "gfx2", 0 ) + ROM_REGION( 0x2000, "sprites", 0 ) ROM_LOAD( "changes.6", 0x0000, 0x2000, CRC(985c9db4) SHA1(d95a8794b96aec9133fd49b7d5724c161c5478bf) ) ROM_REGION( 0x0200, "proms", 0 ) - ROM_LOAD( "changes.1b", 0x0000, 0x0100, CRC(f693c153) SHA1(463426b580fa02f00baf2fff9f42d34b52bd6be4) ) /* palette low 4 bits */ - ROM_LOAD( "changes.1c", 0x0100, 0x0100, CRC(f8331705) SHA1(cbead7ed85f96219af14b6552301906f32260b69) ) /* palette high 4 bits */ + ROM_LOAD( "changes.1b", 0x0000, 0x0100, CRC(f693c153) SHA1(463426b580fa02f00baf2fff9f42d34b52bd6be4) ) // palette low 4 bits + ROM_LOAD( "changes.1c", 0x0100, 0x0100, CRC(f8331705) SHA1(cbead7ed85f96219af14b6552301906f32260b69) ) // palette high 4 bits ROM_END ROM_START( changesa ) @@ -708,15 +1246,15 @@ ROM_START( changesa ) ROM_LOAD( "changes.4", 0x3000, 0x1000, CRC(a8e9aa22) SHA1(fbccf017851eb099960ad51ef3060a16bc0107a5) ) ROM_LOAD( "changes3.5", 0x4000, 0x1000, CRC(c197e64a) SHA1(86b9f5f51f208bc9cdda3d13176147dbcafdc913) ) - ROM_REGION( 0x2000, "gfx1", 0 ) + ROM_REGION( 0x2000, "tiles", 0 ) ROM_LOAD( "changes.7", 0x0000, 0x2000, CRC(2204194e) SHA1(97ee40dd804158e92a2a1034f8e910f1057a7b54) ) - ROM_REGION( 0x2000, "gfx2", 0 ) + ROM_REGION( 0x2000, "sprites", 0 ) ROM_LOAD( "changes.6", 0x0000, 0x2000, CRC(985c9db4) SHA1(d95a8794b96aec9133fd49b7d5724c161c5478bf) ) ROM_REGION( 0x0200, "proms", 0 ) - ROM_LOAD( "changes.1b", 0x0000, 0x0100, CRC(f693c153) SHA1(463426b580fa02f00baf2fff9f42d34b52bd6be4) ) /* palette low 4 bits */ - ROM_LOAD( "changes.1c", 0x0100, 0x0100, CRC(f8331705) SHA1(cbead7ed85f96219af14b6552301906f32260b69) ) /* palette high 4 bits */ + ROM_LOAD( "changes.1b", 0x0000, 0x0100, CRC(f693c153) SHA1(463426b580fa02f00baf2fff9f42d34b52bd6be4) ) // palette low 4 bits + ROM_LOAD( "changes.1c", 0x0100, 0x0100, CRC(f8331705) SHA1(cbead7ed85f96219af14b6552301906f32260b69) ) // palette high 4 bits ROM_END ROM_START( looper ) @@ -727,15 +1265,15 @@ ROM_START( looper ) ROM_LOAD( "changes.4", 0x3000, 0x1000, CRC(a8e9aa22) SHA1(fbccf017851eb099960ad51ef3060a16bc0107a5) ) ROM_LOAD( "changes.5", 0x4000, 0x1000, CRC(f4198e9e) SHA1(4a9aea2b38d3bf093d9e97c884a7a9d16c203a46) ) - ROM_REGION( 0x2000, "gfx1", 0 ) + ROM_REGION( 0x2000, "tiles", 0 ) ROM_LOAD( "looper_7.bin", 0x0000, 0x2000, CRC(71a89975) SHA1(798b50af7348b20487c1c37a3e1b9b26585d50f6) ) - ROM_REGION( 0x2000, "gfx2", 0 ) + ROM_REGION( 0x2000, "sprites", 0 ) ROM_LOAD( "looper_6.bin", 0x0000, 0x2000, CRC(1f3f70c2) SHA1(c3c04892961e83e3be7773fca8304651b98046cf) ) ROM_REGION( 0x0200, "proms", 0 ) - ROM_LOAD( "changes.1b", 0x0000, 0x0100, CRC(f693c153) SHA1(463426b580fa02f00baf2fff9f42d34b52bd6be4) ) /* palette low 4 bits */ - ROM_LOAD( "changes.1c", 0x0100, 0x0100, CRC(f8331705) SHA1(cbead7ed85f96219af14b6552301906f32260b69) ) /* palette high 4 bits */ + ROM_LOAD( "changes.1b", 0x0000, 0x0100, CRC(f693c153) SHA1(463426b580fa02f00baf2fff9f42d34b52bd6be4) ) // palette low 4 bits + ROM_LOAD( "changes.1c", 0x0100, 0x0100, CRC(f8331705) SHA1(cbead7ed85f96219af14b6552301906f32260b69) ) // palette high 4 bits ROM_END ROM_START( springer ) @@ -746,19 +1284,19 @@ ROM_START( springer ) ROM_LOAD( "springer.4", 0x3000, 0x1000, CRC(859d1bf5) SHA1(0f90e0c22d1a0fdf61b87738cd2c4113e1e9178f) ) ROM_LOAD( "springer.5", 0x4000, 0x1000, CRC(72adbbe3) SHA1(5e9d65eb524f7e0e8ea84eeebc698d8bdae6606c) ) - ROM_REGION( 0x2000, "gfx1", 0 ) + ROM_REGION( 0x2000, "tiles", 0 ) ROM_LOAD( "springer.6", 0x0000, 0x1000, CRC(6a961833) SHA1(38f4b0ec73e404b3ec750a2f0c1e502dd75e3ee3) ) ROM_LOAD( "springer.7", 0x1000, 0x1000, CRC(95ab8fc0) SHA1(74dad6fe1edd38b22656cf6cd9e4a57012bf0d60) ) - ROM_REGION( 0x4000, "gfx2", 0 ) + ROM_REGION( 0x4000, "sprites", 0 ) ROM_LOAD( "springer.9", 0x0000, 0x1000, CRC(fa302775) SHA1(412afdc620be95e70b3b782d1a08e4a46777e710) ) - /* 0x1000-0x1fff empty for my convinience */ + // 0x1000-0x1fff empty for my convenience ROM_LOAD( "springer.8", 0x2000, 0x1000, CRC(a54bafdc) SHA1(70f1a9ab116dc2a195aa9026ed1004101897d274) ) - /* 0x3000-0x3fff empty for my convinience */ + // 0x3000-0x3fff empty for my convenience ROM_REGION( 0x0200, "proms", 0 ) - ROM_LOAD( "1b.vid", 0x0000, 0x0100, CRC(a2f935aa) SHA1(575b0b0e67aeff664bdf00f1bfd9dc68fdf88074) ) /* palette low 4 bits */ - ROM_LOAD( "1c.vid", 0x0100, 0x0100, CRC(b95421f4) SHA1(48ddf33d1094eb4343b7c54a2a221050f83b749b) ) /* palette high 4 bits */ + ROM_LOAD( "1b.vid", 0x0000, 0x0100, CRC(a2f935aa) SHA1(575b0b0e67aeff664bdf00f1bfd9dc68fdf88074) ) // palette low 4 bits + ROM_LOAD( "1c.vid", 0x0100, 0x0100, CRC(b95421f4) SHA1(48ddf33d1094eb4343b7c54a2a221050f83b749b) ) // palette high 4 bits ROM_END ROM_START( hoccer ) @@ -768,15 +1306,15 @@ ROM_START( hoccer ) ROM_LOAD( "hr3.cpu", 0x4000, 0x2000, CRC(048a0659) SHA1(7dc0ba2046f8985d4e3bfbba5284090dd4382aa1) ) ROM_LOAD( "hr4.cpu", 0x6000, 0x2000, CRC(9a788a2c) SHA1(a49efa5bbebcb9f7cbe22a85494f24af9965b4dc) ) - ROM_REGION( 0x2000, "gfx1", 0 ) + ROM_REGION( 0x2000, "tiles", 0 ) ROM_LOAD( "hr.d", 0x0000, 0x2000, CRC(d33aa980) SHA1(ba6cc0eed87a1561a584058bdcaac2c0a375e235) ) - ROM_REGION( 0x2000, "gfx2", 0 ) + ROM_REGION( 0x2000, "sprites", 0 ) ROM_LOAD( "hr.c", 0x0000, 0x2000, CRC(02808294) SHA1(c4f5c6a8e3fbb156917821b4e7b1b25d23418ca3) ) ROM_REGION( 0x0200, "proms", 0 ) - ROM_LOAD( "hr.1b", 0x0000, 0x0100, CRC(896521d7) SHA1(54b295b4bb7357ffdb8916ff9618570867a950b2) ) /* palette low 4 bits */ - ROM_LOAD( "hr.1c", 0x0100, 0x0100, CRC(2efdd70b) SHA1(1b4fc9e52aaa4600c535b04d40aac1e0dd85fd7b) ) /* palette high 4 bits */ + ROM_LOAD( "hr.1b", 0x0000, 0x0100, CRC(896521d7) SHA1(54b295b4bb7357ffdb8916ff9618570867a950b2) ) // palette low 4 bits + ROM_LOAD( "hr.1c", 0x0100, 0x0100, CRC(2efdd70b) SHA1(1b4fc9e52aaa4600c535b04d40aac1e0dd85fd7b) ) // palette high 4 bits ROM_END ROM_START( hoccer2 ) @@ -786,15 +1324,15 @@ ROM_START( hoccer2 ) ROM_LOAD( "hr.3", 0x4000, 0x2000, CRC(4e67b0be) SHA1(2c2e6a7798325621d1b67ee90fc2f198731b4ab1) ) ROM_LOAD( "hr.4", 0x6000, 0x2000, CRC(d2b44f58) SHA1(6a3666b1b5f4da5a72f6712db8d242281ea634fa) ) - ROM_REGION( 0x2000, "gfx1", 0 ) + ROM_REGION( 0x2000, "tiles", 0 ) ROM_LOAD( "hr.d", 0x0000, 0x2000, CRC(d33aa980) SHA1(ba6cc0eed87a1561a584058bdcaac2c0a375e235) ) - ROM_REGION( 0x2000, "gfx2", 0 ) + ROM_REGION( 0x2000, "sprites", 0 ) ROM_LOAD( "hr.c", 0x0000, 0x2000, CRC(02808294) SHA1(c4f5c6a8e3fbb156917821b4e7b1b25d23418ca3) ) ROM_REGION( 0x0200, "proms", 0 ) - ROM_LOAD( "hr.1b", 0x0000, 0x0100, CRC(896521d7) SHA1(54b295b4bb7357ffdb8916ff9618570867a950b2) ) /* palette low 4 bits */ - ROM_LOAD( "hr.1c", 0x0100, 0x0100, CRC(2efdd70b) SHA1(1b4fc9e52aaa4600c535b04d40aac1e0dd85fd7b) ) /* palette high 4 bits */ + ROM_LOAD( "hr.1b", 0x0000, 0x0100, CRC(896521d7) SHA1(54b295b4bb7357ffdb8916ff9618570867a950b2) ) // palette low 4 bits + ROM_LOAD( "hr.1c", 0x0100, 0x0100, CRC(2efdd70b) SHA1(1b4fc9e52aaa4600c535b04d40aac1e0dd85fd7b) ) // palette high 4 bits ROM_END ROM_START( wanted ) @@ -803,17 +1341,17 @@ ROM_START( wanted ) ROM_LOAD( "prg-2", 0x2000, 0x2000, CRC(67ac0210) SHA1(29fd01289c9ba5a3a992ac6740badbf2e37f05ac) ) ROM_LOAD( "prg-3", 0x4000, 0x2000, CRC(373c7d82) SHA1(e68e1fd1d5e48c709280a714d7df330fc29df03a) ) - ROM_REGION( 0x4000, "gfx1", 0 ) + ROM_REGION( 0x4000, "tiles", 0 ) ROM_LOAD( "vram-1", 0x0000, 0x2000, CRC(c4226e54) SHA1(4eb59db4d9688f62ecbaee7dde4cf3117e8f942d) ) ROM_LOAD( "vram-2", 0x2000, 0x2000, CRC(2a9b1e36) SHA1(daaf90753477f22dba8f9a9d28799c63622351a5) ) - ROM_REGION( 0x4000, "gfx2", 0 ) + ROM_REGION( 0x4000, "sprites", 0 ) ROM_LOAD( "obj-a", 0x0000, 0x2000, CRC(90b60771) SHA1(67cf20fa47439a16f9ebe07aa128cb267b256704) ) ROM_LOAD( "obj-b", 0x2000, 0x2000, CRC(e14ee689) SHA1(797985c9b5b9a2c39c98defae56d119ce41714d6) ) ROM_REGION( 0x0200, "proms", 0 ) - ROM_LOAD( "wanted.k7", 0x0000, 0x0100, CRC(2ba90a00) SHA1(ec545b4682be2875f4e6440a28306a36c6f1771d) ) /* palette low 4 bits */ - ROM_LOAD( "wanted.k6", 0x0100, 0x0100, CRC(a93d87cc) SHA1(73920a2a2842efc8678f280e3b30177f4ca6ea9c) ) /* palette high 4 bits */ + ROM_LOAD( "wanted.k7", 0x0000, 0x0100, CRC(2ba90a00) SHA1(ec545b4682be2875f4e6440a28306a36c6f1771d) ) // palette low 4 bits + ROM_LOAD( "wanted.k6", 0x0100, 0x0100, CRC(a93d87cc) SHA1(73920a2a2842efc8678f280e3b30177f4ca6ea9c) ) // palette high 4 bits ROM_END /* @@ -827,8 +1365,8 @@ SND 2 x AY-3-8912 XTAL: 12.000MHz DIPS: 2 x 8 position -All roms type 2764 -Both proms type MB7052 (compatible to 82s129) +All ROMs type 2764 +Both PROMs type MB7052 (compatible to 82s129) RAM: 1 x 8416, 1 x AM9122, 2 x D2125, 4 x M5L2114 The topmost row is entirely unpopulated. This includes a space (at 19D) for @@ -855,17 +1393,17 @@ ROM_START( bcruzm12 ) ROM_LOAD( "d-84_2.12b", 0x2000, 0x2000, CRC(1a788d1f) SHA1(5029f93f45d328a282d56e010eee68287b6b9306) ) ROM_LOAD( "d-84_1.12ab", 0x4000, 0x2000, CRC(9d5b3017) SHA1(bced3f39faf94ce25cba382010f2c2ed322e9d7b) ) - ROM_REGION( 0x4000, "gfx1", 0 ) + ROM_REGION( 0x4000, "tiles", 0 ) ROM_LOAD( "d-84_5.17f", 0x0000, 0x2000, CRC(2e963f6a) SHA1(dcc32ab4a4fa241b6f4a211642d00f6e0438f466) ) ROM_LOAD( "d-84_4.17ef", 0x2000, 0x2000, CRC(fe186459) SHA1(3b0ee1fe98c835271f5b67de5ca0507827e25d71) ) - ROM_REGION( 0x4000, "gfx2", 0 ) + ROM_REGION( 0x4000, "sprites", 0 ) ROM_LOAD( "d-84_6.17fh", 0x0000, 0x2000, CRC(1337dc01) SHA1(c55bfc6dd15a499dd71da0acc5016035a7c51f16) ) ROM_LOAD( "d-84_7.17h", 0x2000, 0x2000, CRC(a5be90ef) SHA1(6037d924296ba62999aafe665396fef142d73df2) ) ROM_REGION( 0x0200, "proms", 0 ) - ROM_LOAD( "bcm12col.7k", 0x0000, 0x0100, CRC(bf4f2671) SHA1(dde6da568ecf0121910f4b507c83fe6230b07c8d) ) /* palette low 4 bits */ - ROM_LOAD( "bcm12col.6k", 0x0100, 0x0100, CRC(59f955f6) SHA1(6d6d784971569e0af7cec8bd36659f24a652cd6a) ) /* palette high 4 bits */ + ROM_LOAD( "bcm12col.7k", 0x0000, 0x0100, CRC(bf4f2671) SHA1(dde6da568ecf0121910f4b507c83fe6230b07c8d) ) // palette low 4 bits + ROM_LOAD( "bcm12col.6k", 0x0100, 0x0100, CRC(59f955f6) SHA1(6d6d784971569e0af7cec8bd36659f24a652cd6a) ) // palette high 4 bits ROM_END ROM_START( hopprobo ) @@ -876,29 +1414,31 @@ ROM_START( hopprobo ) ROM_LOAD( "hopper04.3p", 0x3000, 0x1000, CRC(0f4f3ca8) SHA1(22976fb63a8931c7db000ccf9de51417c0d512fe) ) ROM_LOAD( "hopper05.3r", 0x4000, 0x1000, CRC(9d77a37b) SHA1(a63419382cb86e3f762637692c646bbd6b1b664d) ) - ROM_REGION( 0x4000, "gfx1", 0 ) + ROM_REGION( 0x4000, "tiles", 0 ) ROM_LOAD( "hopper06.5c", 0x0000, 0x2000, CRC(68f79bc8) SHA1(17a9891c98c34935831493e27bd0cf3239644de0) ) ROM_LOAD( "hopper07.5d", 0x2000, 0x1000, CRC(33d82411) SHA1(b112d76c9d35a2dbd051825e7818e894e8d9259f) ) ROM_RELOAD( 0x3000, 0x1000 ) - ROM_REGION( 0x4000, "gfx2", 0 ) + ROM_REGION( 0x4000, "sprites", 0 ) ROM_LOAD( "hopper09.6k", 0x0000, 0x2000, CRC(047921c7) SHA1(8ef4722a98be540e4b5c67965599c400511b4a52) ) ROM_LOAD( "hopper08.6f", 0x2000, 0x2000, CRC(06d37e64) SHA1(c0923a1a40dca43b66e14d755dacf7767d62ab8b) ) ROM_REGION( 0x0200, "proms", 0 ) - ROM_LOAD( "7052hop.1b", 0x0000, 0x0100, CRC(94450775) SHA1(e15fcf6d1cd7cfc0d98e82bd0559b6d342aac9ed) ) /* palette low 4 bits */ - ROM_LOAD( "7052hop.1c", 0x0100, 0x0100, CRC(a76bbd51) SHA1(5c61d93ab1e9c80b30cfbc2cbd13ede32f0f4f61) ) /* palette high 4 bits */ + ROM_LOAD( "7052hop.1b", 0x0000, 0x0100, CRC(94450775) SHA1(e15fcf6d1cd7cfc0d98e82bd0559b6d342aac9ed) ) // palette low 4 bits + ROM_LOAD( "7052hop.1c", 0x0100, 0x0100, CRC(a76bbd51) SHA1(5c61d93ab1e9c80b30cfbc2cbd13ede32f0f4f61) ) // palette high 4 bits ROM_END +} // anonymous namespace + -/* year name parent machine inputs */ -GAME( 1982, marineb, 0, marineb, marineb, marineb_state, empty_init, ROT0, "Orca", "Marine Boy", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, changes, 0, changes, changes, marineb_state, empty_init, ROT0, "Orca", "Changes", MACHINE_SUPPORTS_SAVE ) +// year name parent machine inputs +GAME( 1982, marineb, 0, marineb, marineb, marineb_state, empty_init, ROT0, "Orca", "Marine Boy", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, changes, 0, changes, changes, marineb_state, empty_init, ROT0, "Orca", "Changes", MACHINE_SUPPORTS_SAVE ) GAME( 1982, changesa, changes, changes, changes, marineb_state, empty_init, ROT0, "Orca (Eastern Micro Electronics, Inc. license)", "Changes (EME license)", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, looper, changes, changes, changes, marineb_state, empty_init, ROT0, "Orca", "Looper", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, springer, 0, springer, marineb, marineb_state, empty_init, ROT270, "Orca", "Springer", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, hoccer, 0, hoccer, hoccer, marineb_state, empty_init, ROT90, "Eastern Micro Electronics, Inc.", "Hoccer (set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, hoccer2, hoccer, hoccer, hoccer, marineb_state, empty_init, ROT90, "Eastern Micro Electronics, Inc.", "Hoccer (set 2)" , MACHINE_SUPPORTS_SAVE ) /* earlier */ -GAME( 1983, bcruzm12, 0, bcruzm12, bcruzm12, marineb_state, empty_init, ROT90, "Sigma Enterprises Inc.", "Battle Cruiser M-12", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, hopprobo, 0, hopprobo, marineb, marineb_state, empty_init, ROT90, "Sega", "Hopper Robo", MACHINE_SUPPORTS_SAVE ) -GAME( 1984, wanted, 0, wanted, wanted, marineb_state, empty_init, ROT90, "Sigma Enterprises Inc.", "Wanted", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, looper, changes, changes, changes, marineb_state, empty_init, ROT0, "Orca", "Looper", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, springer, 0, springer, marineb, marineb_state, empty_init, ROT270, "Orca", "Springer", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, hoccer, 0, hoccer, hoccer, marineb_state, empty_init, ROT90, "Eastern Micro Electronics, Inc.", "Hoccer (newer)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, hoccer2, hoccer, hoccer, hoccer, marineb_state, empty_init, ROT90, "Eastern Micro Electronics, Inc.", "Hoccer (earlier)" , MACHINE_SUPPORTS_SAVE ) +GAME( 1983, bcruzm12, 0, bcruzm12, bcruzm12, marineb_state, empty_init, ROT90, "Sigma Enterprises Inc.", "Battle Cruiser M-12", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, hopprobo, 0, hopprobo, marineb, marineb_state, empty_init, ROT90, "Sega", "Hopper Robo", MACHINE_SUPPORTS_SAVE ) +GAME( 1984, wanted, 0, wanted, wanted, marineb_state, empty_init, ROT90, "Sigma Enterprises Inc.", "Wanted", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/orca/marineb.h b/src/mame/orca/marineb.h deleted file mode 100644 index 1fb9c171593..00000000000 --- a/src/mame/orca/marineb.h +++ /dev/null @@ -1,91 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Zsolt Vasvari -#ifndef MAME_INCLUDES_MARINEB_H -#define MAME_INCLUDES_MARINEB_H - -#pragma once - -#include "machine/74259.h" -#include "machine/watchdog.h" -#include "emupal.h" -#include "tilemap.h" - -class marineb_state : public driver_device -{ -public: - marineb_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_videoram(*this, "videoram"), - m_spriteram(*this, "spriteram"), - m_colorram(*this, "colorram"), - m_system(*this, "SYSTEM"), - m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_outlatch(*this, "outlatch"), - m_watchdog(*this, "watchdog") - { } - - void springer(machine_config &config); - void wanted(machine_config &config); - void hopprobo(machine_config &config); - void marineb(machine_config &config); - void bcruzm12(machine_config &config); - void hoccer(machine_config &config); - void changes(machine_config &config); - -private: - required_shared_ptr m_videoram; - required_shared_ptr m_spriteram; - required_shared_ptr m_colorram; - required_ioport m_system; - - /* video-related */ - tilemap_t *m_bg_tilemap = nullptr; - tilemap_t *m_fg_tilemap = nullptr; - uint8_t m_palette_bank = 0; - uint8_t m_column_scroll = 0; - uint8_t m_flipscreen_x = 0; - uint8_t m_flipscreen_y = 0; - - /* devices */ - required_device m_maincpu; - optional_device m_audiocpu; - required_device m_gfxdecode; - required_device m_palette; - required_device m_outlatch; - required_device m_watchdog; - - bool m_irq_mask = false; - DECLARE_WRITE_LINE_MEMBER(irq_mask_w); - DECLARE_WRITE_LINE_MEMBER(nmi_mask_w); - void marineb_videoram_w(offs_t offset, uint8_t data); - void marineb_colorram_w(offs_t offset, uint8_t data); - void marineb_column_scroll_w(uint8_t data); - void marineb_palette_bank_0_w(uint8_t data); - void marineb_palette_bank_1_w(uint8_t data); - DECLARE_WRITE_LINE_MEMBER(flipscreen_x_w); - DECLARE_WRITE_LINE_MEMBER(flipscreen_y_w); - uint8_t system_watchdog_r(); - TILE_GET_INFO_MEMBER(get_tile_info); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - void marineb_palette(palette_device &palette) const; - uint32_t screen_update_marineb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_changes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_springer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_hoccer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - uint32_t screen_update_hopprobo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - DECLARE_WRITE_LINE_MEMBER(marineb_vblank_irq); - DECLARE_WRITE_LINE_MEMBER(wanted_vblank_irq); - void set_tilemap_scrolly( int cols ); - - void marineb_map(address_map &map); - void marineb_io_map(address_map &map); - void wanted_map(address_map &map); - void wanted_io_map(address_map &map); -}; - -#endif // MAME_INCLUDES_MARINEB_H diff --git a/src/mame/orca/marineb_v.cpp b/src/mame/orca/marineb_v.cpp deleted file mode 100644 index 939c6bc11a0..00000000000 --- a/src/mame/orca/marineb_v.cpp +++ /dev/null @@ -1,462 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Zsolt Vasvari -/*************************************************************************** - - video.c - - Functions to emulate the video hardware of the machine. - -***************************************************************************/ - -#include "emu.h" -#include "marineb.h" - - -void marineb_state::marineb_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) & 0x01; - bit1 = BIT(color_prom[i + palette.entries()], 0); - bit2 = BIT(color_prom[i + palette.entries()], 1); - int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - // blue component - bit0 = 0; - bit1 = BIT(color_prom[i + palette.entries()], 2); - bit2 = BIT(color_prom[i + palette.entries()], 3); - int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - palette.set_pen_color(i, rgb_t(r, g, b)); - } -} - -/*************************************************************************** - - Callbacks for the TileMap code - -***************************************************************************/ - -TILE_GET_INFO_MEMBER(marineb_state::get_tile_info) -{ - uint8_t code = m_videoram[tile_index]; - uint8_t col = m_colorram[tile_index]; - - tileinfo.set(0, - code | ((col & 0xc0) << 2), - (col & 0x0f) | (m_palette_bank << 4), - TILE_FLIPXY((col >> 4) & 0x03)); -} - - - -/************************************* - * - * Video system start - * - *************************************/ - -void marineb_state::video_start() -{ - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(marineb_state::get_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - m_bg_tilemap->set_scroll_cols(32); - - save_item(NAME(m_palette_bank)); - save_item(NAME(m_column_scroll)); - save_item(NAME(m_flipscreen_x)); - save_item(NAME(m_flipscreen_y)); -} - - - -/************************************* - * - * Memory handlers - * - *************************************/ - -void marineb_state::marineb_videoram_w(offs_t offset, uint8_t data) -{ - m_videoram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - - -void marineb_state::marineb_colorram_w(offs_t offset, uint8_t data) -{ - m_colorram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - - -void marineb_state::marineb_column_scroll_w(uint8_t data) -{ - m_column_scroll = data; -} - - -void marineb_state::marineb_palette_bank_0_w(uint8_t data) -{ - uint8_t old = m_palette_bank; - - m_palette_bank = (m_palette_bank & 0x02) | (data & 0x01); - - if (old != m_palette_bank) - { - m_bg_tilemap->mark_all_dirty(); - } -} - - -void marineb_state::marineb_palette_bank_1_w(uint8_t data) -{ - uint8_t old = m_palette_bank; - - m_palette_bank = (m_palette_bank & 0x01) | ((data & 0x01) << 1); - - if (old != m_palette_bank) - { - m_bg_tilemap->mark_all_dirty(); - } -} - - -WRITE_LINE_MEMBER(marineb_state::flipscreen_x_w) -{ - m_flipscreen_x = state; - m_bg_tilemap->set_flip((m_flipscreen_x ? TILEMAP_FLIPX : 0) | (m_flipscreen_y ? TILEMAP_FLIPY : 0)); -} - - -WRITE_LINE_MEMBER(marineb_state::flipscreen_y_w) -{ - m_flipscreen_y = state; - m_bg_tilemap->set_flip((m_flipscreen_x ? TILEMAP_FLIPX : 0) | (m_flipscreen_y ? TILEMAP_FLIPY : 0)); -} - - - -/************************************* - * - * Video update - * - *************************************/ - -void marineb_state::set_tilemap_scrolly( int cols ) -{ - int col; - - for (col = 0; col < cols; col++) - m_bg_tilemap->set_scrolly(col, m_column_scroll); - - for (; col < 32; col++) - m_bg_tilemap->set_scrolly(col, 0); -} - - -uint32_t marineb_state::screen_update_marineb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int offs; - - set_tilemap_scrolly(24); - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - - /* draw the sprites */ - for (offs = 0x0f; offs >= 0; offs--) - { - int gfx, sx, sy, code, col, flipx, flipy, offs2; - - if ((offs == 0) || (offs == 2)) - continue; /* no sprites here */ - - if (offs < 8) - offs2 = 0x0018 + offs; - else - offs2 = 0x03d8 - 8 + offs; - - code = m_videoram[offs2]; - sx = m_videoram[offs2 + 0x20]; - sy = m_colorram[offs2]; - col = (m_colorram[offs2 + 0x20] & 0x0f) + 16 * m_palette_bank; - flipx = code & 0x02; - flipy = !(code & 0x01); - - if (offs < 4) - { - /* big sprite */ - gfx = 2; - code = (code >> 4) | ((code & 0x0c) << 2); - } - else - { - /* small sprite */ - gfx = 1; - code >>= 2; - } - - if (!m_flipscreen_y) - { - sy = 256 - m_gfxdecode->gfx(gfx)->width() - sy; - flipy = !flipy; - } - - if (m_flipscreen_x) - { - sx++; - } - - m_gfxdecode->gfx(gfx)->transpen(bitmap,cliprect, - code, - col, - flipx,flipy, - sx,sy,0); - } - return 0; -} - - -uint32_t marineb_state::screen_update_changes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int offs, sx, sy, code, col, flipx, flipy; - - set_tilemap_scrolly(26); - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - - /* draw the small sprites */ - for (offs = 0x05; offs >= 0; offs--) - { - int offs2; - - offs2 = 0x001a + offs; - - code = m_videoram[offs2]; - sx = m_videoram[offs2 + 0x20]; - sy = m_colorram[offs2]; - col = (m_colorram[offs2 + 0x20] & 0x0f) + 16 * m_palette_bank; - flipx = code & 0x02; - flipy = !(code & 0x01); - - if (!m_flipscreen_y) - { - sy = 256 - m_gfxdecode->gfx(1)->width() - sy; - flipy = !flipy; - } - - if (m_flipscreen_x) - { - sx++; - } - - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, - code >> 2, - col, - flipx,flipy, - sx,sy,0); - } - - /* draw the big sprite */ - - code = m_videoram[0x3df]; - sx = m_videoram[0x3ff]; - sy = m_colorram[0x3df]; - col = m_colorram[0x3ff]; - flipx = code & 0x02; - flipy = !(code & 0x01); - - if (!m_flipscreen_y) - { - sy = 256 - m_gfxdecode->gfx(2)->width() - sy; - flipy = !flipy; - } - - if (m_flipscreen_x) - { - sx++; - } - - code >>= 4; - - m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, - code, - col, - flipx,flipy, - sx,sy,0); - - /* draw again for wrap around */ - - m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, - code, - col, - flipx,flipy, - sx-256,sy,0); - return 0; -} - - -uint32_t marineb_state::screen_update_springer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int offs; - - set_tilemap_scrolly(0); - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - - /* draw the sprites */ - for (offs = 0x0f; offs >= 0; offs--) - { - int gfx, sx, sy, code, col, flipx, flipy, offs2; - - if ((offs == 0) || (offs == 2)) - continue; /* no sprites here */ - - offs2 = 0x0010 + offs; - - code = m_videoram[offs2]; - sx = 240 - m_videoram[offs2 + 0x20]; - sy = m_colorram[offs2]; - col = (m_colorram[offs2 + 0x20] & 0x0f) + 16 * m_palette_bank; - flipx = !(code & 0x02); - flipy = !(code & 0x01); - - if (offs < 4) - { - /* big sprite */ - sx -= 0x10; - gfx = 2; - code = (code >> 4) | ((code & 0x0c) << 2); - } - else - { - /* small sprite */ - gfx = 1; - code >>= 2; - } - - if (!m_flipscreen_y) - { - sy = 256 - m_gfxdecode->gfx(gfx)->width() - sy; - flipy = !flipy; - } - - if (!m_flipscreen_x) - { - sx--; - } - - m_gfxdecode->gfx(gfx)->transpen(bitmap,cliprect, - code, - col, - flipx,flipy, - sx,sy,0); - } - return 0; -} - - -uint32_t marineb_state::screen_update_hoccer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int offs; - - set_tilemap_scrolly(0); - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - - /* draw the sprites */ - for (offs = 0x07; offs >= 0; offs--) - { - int sx, sy, code, col, flipx, flipy, offs2; - - offs2 = 0x0018 + offs; - - code = m_spriteram[offs2]; - sx = m_spriteram[offs2 + 0x20]; - sy = m_colorram[offs2]; - col = m_colorram[offs2 + 0x20]; - flipx = code & 0x02; - flipy = !(code & 0x01); - - if (!m_flipscreen_y) - { - sy = 256 - m_gfxdecode->gfx(1)->width() - sy; - flipy = !flipy; - } - - if (m_flipscreen_x) - { - sx = 256 - m_gfxdecode->gfx(1)->width() - sx; - flipx = !flipx; - } - - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, - code >> 2, - col, - flipx,flipy, - sx,sy,0); - } - return 0; -} - - -uint32_t marineb_state::screen_update_hopprobo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - int offs; - - set_tilemap_scrolly(0); - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - - /* draw the sprites */ - for (offs = 0x0f; offs >= 0; offs--) - { - int gfx, sx, sy, code, col, flipx, flipy, offs2; - - if ((offs == 0) || (offs == 2)) - continue; /* no sprites here */ - - offs2 = 0x0010 + offs; - - code = m_videoram[offs2]; - sx = m_videoram[offs2 + 0x20]; - sy = m_colorram[offs2]; - col = (m_colorram[offs2 + 0x20] & 0x0f) + 16 * m_palette_bank; - flipx = code & 0x02; - flipy = !(code & 0x01); - - if (offs < 4) - { - /* big sprite */ - gfx = 2; - code = (code >> 4) | ((code & 0x0c) << 2); - } - else - { - /* small sprite */ - gfx = 1; - code >>= 2; - } - - if (!m_flipscreen_y) - { - sy = 256 - m_gfxdecode->gfx(gfx)->width() - sy; - flipy = !flipy; - } - - if (!m_flipscreen_x) - { - sx--; - } - - m_gfxdecode->gfx(gfx)->transpen(bitmap,cliprect, - code, - col, - flipx,flipy, - sx,sy,0); - } - return 0; -} diff --git a/src/mame/orca/vastar.cpp b/src/mame/orca/vastar.cpp index ab34ca7ff6f..33e5ca5df3e 100644 --- a/src/mame/orca/vastar.cpp +++ b/src/mame/orca/vastar.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:Allard van der Bas +// copyright-holders: Allard van der Bas + /*************************************************************************** Vastar memory map (preliminary) @@ -73,24 +74,24 @@ Bottom Bord DVL/B-V The PCB seems to be a bootleg/prototype: On the upper board there are some pads for jumpers , some empty spaces left unpopulated for additional TTLs and an XTAL. -All 5 sockets for 2732 eproms were modified to accept 2764 eproms. +All 5 sockets for 2732 EPROMs were modified to accept 2764 EPROMs. The AY8910 pin 26 (TEST 2) is grounded with a flying wire Lack of manufacturer on title/copyright screen (there is room in the ROM - 15 characters - after the year string for a copyright message, however it is filled with the 'string termination' character rather than a string.) Upper board chips: -5x 2764 eproms -1x 2128 static ram (2k ram) +5x 2764 EPROMs +1x 2128 static RAM (2k RAM) 2x z80B 1x AY8910 2x 8 positions dipswitches Bottom Board chips: -5x 2764 eproms -2x 2128 static ram (2kx8 ram) -4x 93422 DRAM (256x4 dram) +5x 2764 EPROMs +2x 2128 static RAM (2kx8 RAM) +4x 93422 DRAM (256x4 DRAM) 1x 6301 PROM (probably used for background ?) -3x 82s129 Colour PROMS (connected to resistors) +3x 82s129 Colour PROMs (connected to resistors) Clocks measured: @@ -103,16 +104,305 @@ Vsync : 60.58hz #include "emu.h" -#include "vastar.h" + +#include "orca40c.h" #include "cpu/z80/z80.h" #include "machine/74259.h" #include "machine/watchdog.h" #include "sound/ay8910.h" -#include "orca40c.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" + + +// configurable logging +#define LOG_PRIORITY (1U << 1) + +//#define VERBOSE (LOG_GENERAL | LOG_PRIORITY) + +#include "logmacro.h" + +#define LOGPRIORITY(...) LOGMASKED(LOG_PRIORITY, __VA_ARGS__) + + +namespace { + +class vastar_common_state : public driver_device +{ +public: + vastar_common_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_subcpu(*this, "sub"), + m_sharedram(*this, "sharedram") + { } + + void common(machine_config &config); + +protected: + virtual void machine_start() override; + + required_device m_maincpu; + required_device m_subcpu; + + required_shared_ptr m_sharedram; + + uint8_t m_nmi_mask = 0; + + DECLARE_WRITE_LINE_MEMBER(nmi_mask_w); + INTERRUPT_GEN_MEMBER(vblank_irq); + + void cpu2_map(address_map &map); + void cpu2_port_map(address_map &map); + void main_port_map(address_map &map); +}; + +class vastar_state : public vastar_common_state +{ +public: + vastar_state(const machine_config &mconfig, device_type type, const char *tag) : + vastar_common_state(mconfig, type, tag), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_bgvideoram(*this, "bg%uvideoram", 1U), + m_fgvideoram(*this, "fgvideoram"), + m_sprite_priority(*this, "sprite_priority") + { } + + void vastar(machine_config &config); + +protected: + virtual void machine_reset() override; + virtual void video_start() override; + +private: + required_device m_gfxdecode; + required_device m_palette; + + required_shared_ptr_array m_bgvideoram; + required_shared_ptr m_fgvideoram; + required_shared_ptr m_sprite_priority; + + // these are pointers into m_fgvideoram + uint8_t* m_bg_scroll[2]{}; + uint8_t* m_spriteram[3]{}; + + tilemap_t *m_fg_tilemap = nullptr; + tilemap_t *m_bg_tilemap[2]{}; + + void fgvideoram_w(offs_t offset, uint8_t data); + template void bgvideoram_w(offs_t offset, uint8_t data); + + TILE_GET_INFO_MEMBER(get_fg_tile_info); + template TILE_GET_INFO_MEMBER(get_bg_tile_info); + + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + + void main_map(address_map &map); +}; + +class dogfightp_state : public vastar_common_state +{ +public: + dogfightp_state(const machine_config &mconfig, device_type type, const char *tag) : + vastar_common_state(mconfig, type, tag) + { } + + void dogfightp(machine_config &config); + +private: + void main_map(address_map &map); +}; + + +// video + +/*************************************************************************** + + Callbacks for the TileMap code + +***************************************************************************/ + +TILE_GET_INFO_MEMBER(vastar_state::get_fg_tile_info) +{ + int const code = m_fgvideoram[tile_index + 0x800] | (m_fgvideoram[tile_index + 0x400] << 8); + int const color = m_fgvideoram[tile_index]; + int const fxy = (code & 0xc00) >> 10; // maybe, based on the other layers + tileinfo.set(0, + code, + color & 0x3f, + TILE_FLIPXY(fxy)); +} + +template +TILE_GET_INFO_MEMBER(vastar_state::get_bg_tile_info) +{ + int const code = m_bgvideoram[Which][tile_index + 0x800] | (m_bgvideoram[Which][tile_index] << 8); + int const color = m_bgvideoram[Which][tile_index + 0xc00]; + int fxy = (code & 0xc00) >> 10; + tileinfo.set(4 - Which, + code, + color & 0x3f, + TILE_FLIPXY(fxy)); +} + + +/*************************************************************************** + Start the video hardware emulation. + +***************************************************************************/ + +void vastar_state::video_start() +{ + m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(vastar_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8,8, 32,32); + m_bg_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(vastar_state::get_bg_tile_info<0>)), TILEMAP_SCAN_ROWS, 8,8, 32,32); + m_bg_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(vastar_state::get_bg_tile_info<1>)), TILEMAP_SCAN_ROWS, 8,8, 32,32); + + m_fg_tilemap->set_transparent_pen(0); + m_bg_tilemap[0]->set_transparent_pen(0); + m_bg_tilemap[1]->set_transparent_pen(0); + + m_bg_tilemap[0]->set_scroll_cols(32); + m_bg_tilemap[1]->set_scroll_cols(32); +} + + +/*************************************************************************** + + Memory handlers + +***************************************************************************/ + +void vastar_state::fgvideoram_w(offs_t offset, uint8_t data) +{ + m_fgvideoram[offset] = data; + m_fg_tilemap->mark_tile_dirty(offset & 0x3ff); +} + +template +void vastar_state::bgvideoram_w(offs_t offset, uint8_t data) +{ + m_bgvideoram[Which][offset] = data; + m_bg_tilemap[Which]->mark_tile_dirty(offset & 0x3ff); +} + + +/*************************************************************************** + + Display refresh + +***************************************************************************/ + +// I wouldn't rule out the possibility of there being 2 sprite chips due to +// "offs & 0x20" being used to select the tile bank. +// +// for Planet Probe more cases appear correct if we draw the list in reverse +// order, but it's also possible we should be drawing 2 swapped lists in +// forward order instead +void vastar_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ +// for (int offs = 0; offs < 0x40; offs += 2) + for (int offs = 0x40 - 2; offs >= 0; offs -= 2) + { + int const code = ((m_spriteram[2][offs] & 0xfc) >> 2) + ((m_spriteram[1][offs] & 0x01) << 6) + + ((offs & 0x20) << 2); + + int const sx = m_spriteram[2][offs + 1]; + int sy = m_spriteram[0][offs]; + int const color = m_spriteram[0][offs + 1] & 0x3f; + int flipx = m_spriteram[2][offs] & 0x02; + int flipy = m_spriteram[2][offs] & 0x01; + + if (flip_screen()) + { + flipx = !flipx; + flipy = !flipy; + } + + if (m_spriteram[1][offs] & 0x08) // double width + { + if (!flip_screen()) + sy = 224 - sy; + + m_gfxdecode->gfx(2)->transpen(bitmap, cliprect, + code / 2, + color, + flipx, flipy, + sx, sy, 0); + // redraw with wraparound + m_gfxdecode->gfx(2)->transpen(bitmap, cliprect, + code / 2, + color, + flipx, flipy, + sx, sy + 256, 0); + } + else + { + if (!flip_screen()) + sy = 240 - sy; + + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, + code, + color, + flipx, flipy, + sx, sy, 0); + } + } +} + +uint32_t vastar_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + for (int i = 0;i < 32;i++) + { + m_bg_tilemap[0]->set_scrolly(i, m_bg_scroll[0][i]); + m_bg_tilemap[1]->set_scrolly(i, m_bg_scroll[1][i]); + } + + switch (*m_sprite_priority) + { + case 0: + m_bg_tilemap[0]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); + draw_sprites(bitmap, cliprect); + m_bg_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0); + m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + break; + + case 1: // ?? planet probe + m_bg_tilemap[0]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); + m_bg_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0); + draw_sprites(bitmap, cliprect); + m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + break; + + case 2: + m_bg_tilemap[0]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); + draw_sprites(bitmap, cliprect); + m_bg_tilemap[0]->draw(screen, bitmap, cliprect, 0, 0); + m_bg_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0); + m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + break; + + case 3: + m_bg_tilemap[0]->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); + m_bg_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0); + m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + draw_sprites(bitmap, cliprect); + break; + + default: + LOGPRIORITY("Unimplemented priority %X\n", *m_sprite_priority); + break; + } + return 0; +} + + +// machine void vastar_common_state::machine_start() { @@ -123,16 +413,11 @@ void vastar_state::machine_reset() { m_sprite_priority[0] = 0; - m_spriteram1 = m_fgvideoram + 0x000; - m_bg1_scroll = m_fgvideoram + 0x3c0; - m_bg2_scroll = m_fgvideoram + 0x3e0; - m_spriteram2 = m_fgvideoram + 0x400; - m_spriteram3 = m_fgvideoram + 0x800; -} - -WRITE_LINE_MEMBER(vastar_state::flip_screen_w) -{ - flip_screen_set(state); + m_spriteram[0] = m_fgvideoram + 0x000; + m_bg_scroll[0] = m_fgvideoram + 0x3c0; + m_bg_scroll[1] = m_fgvideoram + 0x3e0; + m_spriteram[1] = m_fgvideoram + 0x400; + m_spriteram[2] = m_fgvideoram + 0x800; } WRITE_LINE_MEMBER(vastar_common_state::nmi_mask_w) @@ -144,12 +429,12 @@ WRITE_LINE_MEMBER(vastar_common_state::nmi_mask_w) void vastar_state::main_map(address_map &map) { map(0x0000, 0x7fff).rom(); - map(0x8000, 0x8fff).ram().w(FUNC(vastar_state::bg2videoram_w)).share("bg2videoram").mirror(0x2000); - map(0x9000, 0x9fff).ram().w(FUNC(vastar_state::bg1videoram_w)).share("bg1videoram").mirror(0x2000); - map(0xc000, 0xc000).writeonly().share("sprite_priority"); /* sprite/BG priority */ - map(0xc400, 0xcfff).ram().w(FUNC(vastar_state::fgvideoram_w)).share("fgvideoram"); // fg videoram + sprites + map(0x8000, 0x8fff).ram().w(FUNC(vastar_state::bgvideoram_w<1>)).share(m_bgvideoram[1]).mirror(0x2000); + map(0x9000, 0x9fff).ram().w(FUNC(vastar_state::bgvideoram_w<0>)).share(m_bgvideoram[0]).mirror(0x2000); + map(0xc000, 0xc000).writeonly().share(m_sprite_priority); // sprite / BG priority + map(0xc400, 0xcfff).ram().w(FUNC(vastar_state::fgvideoram_w)).share(m_fgvideoram); // fg videoram + sprites map(0xe000, 0xe000).rw("watchdog", FUNC(watchdog_timer_device::reset_r), FUNC(watchdog_timer_device::reset_w)); - map(0xf000, 0xf7ff).ram().share("sharedram"); + map(0xf000, 0xf7ff).ram().share(m_sharedram); } void vastar_common_state::main_port_map(address_map &map) @@ -162,7 +447,7 @@ void vastar_common_state::main_port_map(address_map &map) void vastar_common_state::cpu2_map(address_map &map) { map(0x0000, 0x1fff).rom(); - map(0x4000, 0x47ff).ram().share("sharedram"); + map(0x4000, 0x47ff).ram().share(m_sharedram); map(0x8000, 0x8000).portr("P2"); map(0x8040, 0x8040).portr("P1"); map(0x8080, 0x8080).portr("SYSTEM"); @@ -175,7 +460,7 @@ void vastar_common_state::cpu2_port_map(address_map &map) map(0x02, 0x02).r("aysnd", FUNC(ay8910_device::data_r)); } -void dogfightp_state::dogfightp_main_map(address_map &map) +void dogfightp_state::main_map(address_map &map) { map(0x0000, 0x7fff).rom(); map(0x9000, 0x903f).ram().w("videopcb", FUNC(orca_ovg_40c_device::attributes_w)).share("videopcb:attributeram"); @@ -185,7 +470,7 @@ void dogfightp_state::dogfightp_main_map(address_map &map) map(0xa000, 0xa3ff).ram().w("videopcb", FUNC(orca_ovg_40c_device::videoram_w)).share("videopcb:videoram"); map(0xb000, 0xb3ff).ram().w("videopcb", FUNC(orca_ovg_40c_device::videoram2_w)).share("videopcb:videoram_2"); map(0xe000, 0xe000).rw("watchdog", FUNC(watchdog_timer_device::reset_r), FUNC(watchdog_timer_device::reset_w)); - map(0xf000, 0xf7ff).ram().share("sharedram"); + map(0xf000, 0xf7ff).ram().share(m_sharedram); } static INPUT_PORTS_START( vastar ) @@ -414,11 +699,11 @@ static const gfx_layout spritelayoutdw = }; static GFXDECODE_START( gfx_vastar ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 64 ) - GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 0, 64 ) - GFXDECODE_ENTRY( "gfx2", 0, spritelayoutdw, 0, 64 ) - GFXDECODE_ENTRY( "gfx3", 0, charlayout, 0, 64 ) - GFXDECODE_ENTRY( "gfx4", 0, charlayout, 0, 64 ) + GFXDECODE_ENTRY( "fgtiles", 0, charlayout, 0, 64 ) + GFXDECODE_ENTRY( "sprites", 0, spritelayout, 0, 64 ) + GFXDECODE_ENTRY( "sprites", 0, spritelayoutdw, 0, 64 ) + GFXDECODE_ENTRY( "bgtiles0", 0, charlayout, 0, 64 ) + GFXDECODE_ENTRY( "bgtiles1", 0, charlayout, 0, 64 ) GFXDECODE_END @@ -430,16 +715,16 @@ INTERRUPT_GEN_MEMBER(vastar_common_state::vblank_irq) void vastar_common_state::common(machine_config &config) { - /* basic machine hardware */ - Z80(config, m_maincpu, XTAL(18'432'000)/6); + // basic machine hardware + Z80(config, m_maincpu, XTAL(18'432'000) / 6); m_maincpu->set_addrmap(AS_IO, &vastar_common_state::main_port_map); - Z80(config, m_subcpu, XTAL(18'432'000)/6); + Z80(config, m_subcpu, XTAL(18'432'000) / 6); m_subcpu->set_addrmap(AS_PROGRAM, &vastar_common_state::cpu2_map); m_subcpu->set_addrmap(AS_IO, &vastar_common_state::cpu2_port_map); - m_subcpu->set_periodic_int(FUNC(vastar_common_state::irq0_line_hold), attotime::from_hz(242)); /* 4 * vsync_freq(60.58) measured, it is not known yet how long it is asserted so we'll use HOLD_LINE for now */ + m_subcpu->set_periodic_int(FUNC(vastar_common_state::irq0_line_hold), attotime::from_hz(242)); // 4 * vsync_freq(60.58) measured, it is not known yet how long it is asserted so we'll use HOLD_LINE for now - config.set_maximum_quantum(attotime::from_hz(600)); /* 10 CPU slices per frame - seems enough to ensure proper synchronization of the CPUs */ + config.set_maximum_quantum(attotime::from_hz(600)); // 10 CPU slices per frame - seems enough to ensure proper synchronization of the CPUs ls259_device &mainlatch(LS259(config, "mainlatch")); mainlatch.q_out_cb<0>().set(FUNC(vastar_common_state::nmi_mask_w)); @@ -447,10 +732,10 @@ void vastar_common_state::common(machine_config &config) WATCHDOG_TIMER(config, "watchdog"); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); - ay8910_device &aysnd(AY8910(config, "aysnd", XTAL(18'432'000)/12)); + ay8910_device &aysnd(AY8910(config, "aysnd", XTAL(18'432'000) / 12)); aysnd.port_a_read_callback().set_ioport("DSW1"); aysnd.port_b_read_callback().set_ioport("DSW2"); aysnd.add_route(ALL_OUTPUTS, "mono", 0.50); @@ -461,12 +746,12 @@ void vastar_state::vastar(machine_config &config) common(config); m_maincpu->set_addrmap(AS_PROGRAM, &vastar_state::main_map); - m_maincpu->set_vblank_int("screen", FUNC(vastar_common_state::vblank_irq)); + m_maincpu->set_vblank_int("screen", FUNC(vastar_state::vblank_irq)); ls259_device &mainlatch(*subdevice("mainlatch")); - mainlatch.q_out_cb<1>().set(FUNC(vastar_state::flip_screen_w)); + mainlatch.q_out_cb<1>().set(FUNC(vastar_state::flip_screen_set)); - /* video hardware */ + // video hardware screen_device& screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60.58); screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); @@ -483,8 +768,8 @@ void dogfightp_state::dogfightp(machine_config &config) { common(config); - m_maincpu->set_addrmap(AS_PROGRAM, &dogfightp_state::dogfightp_main_map); - m_maincpu->set_vblank_int("screen", FUNC(vastar_common_state::vblank_irq)); + m_maincpu->set_addrmap(AS_PROGRAM, &dogfightp_state::main_map); + m_maincpu->set_vblank_int("screen", FUNC(dogfightp_state::vblank_irq)); ls259_device &mainlatch(*subdevice("mainlatch")); mainlatch.q_out_cb<1>().set("videopcb", FUNC(orca_ovg_40c_device::flipscreen_w)); @@ -513,30 +798,30 @@ ROM_START( vastar ) ROM_LOAD( "e_n7.rom", 0x6000, 0x1000, CRC(31b6be39) SHA1(be0d03db9c6c8982b2f38ad534a6e213bbde1802) ) ROM_LOAD( "e_n5.rom", 0x7000, 0x1000, CRC(f63f0e78) SHA1(a029e340b11b358dbe0dcf2d1a0e6c6c093bbc9d) ) - ROM_REGION( 0x10000, "sub", 0 ) /* 64k for the second CPU */ + ROM_REGION( 0x10000, "sub", 0 ) ROM_LOAD( "e_f2.rom", 0x0000, 0x1000, CRC(713478d8) SHA1(9cbd1fb689d93a8964f48e59d4effaa4878b2945) ) ROM_LOAD( "e_j2.rom", 0x1000, 0x1000, CRC(e4535442) SHA1(280d93bec5cf6183250827ce70ed5ddff968bba5) ) - ROM_REGION( 0x2000, "gfx1", 0 ) + ROM_REGION( 0x2000, "fgtiles", 0 ) ROM_LOAD( "c_c9.rom", 0x0000, 0x2000, CRC(34f067b6) SHA1(45d7f8be5bd1dc9e5e511aa2e99c216c5ff12273) ) - ROM_REGION( 0x4000, "gfx2", 0 ) + ROM_REGION( 0x4000, "sprites", 0 ) ROM_LOAD( "c_f7.rom", 0x0000, 0x2000, CRC(edbf3b13) SHA1(9d6ddf16e83c68c831fec28607584471b5cbcbd2) ) ROM_LOAD( "c_f9.rom", 0x2000, 0x2000, CRC(8f309e22) SHA1(f5bbc5cf70687415061a0674e273e20fbfcc1f8f) ) - ROM_REGION( 0x2000, "gfx3", 0 ) + ROM_REGION( 0x2000, "bgtiles0", 0 ) ROM_LOAD( "c_n4.rom", 0x0000, 0x2000, CRC(b5f9c866) SHA1(17fc38cd40638e4f5d25c0cae70df3b8f03425dd) ) - ROM_REGION( 0x2000, "gfx4", 0 ) + ROM_REGION( 0x2000, "bgtiles1", 0 ) ROM_LOAD( "c_s4.rom", 0x0000, 0x2000, CRC(c9fbbfc9) SHA1(7c6ace0e2eae8420a31d9054ad5dd94924273d5f) ) ROM_REGION( 0x0300, "proms", 0 ) - ROM_LOAD( "tbp24s10.6p", 0x0000, 0x0100, CRC(a712d73a) SHA1(a65fa5928431d8631fb04e01ad0a0d2de849bf1d) ) /* red component */ - ROM_LOAD( "tbp24s10.6s", 0x0100, 0x0100, CRC(0a7d48ec) SHA1(400e0b271c241712e7b7502e96e4f8a609e078e1) ) /* green component */ - ROM_LOAD( "tbp24s10.6m", 0x0200, 0x0100, CRC(4c3db907) SHA1(03bcbc4763dcf49f4a06f499042e36183aa8b762) ) /* blue component */ + ROM_LOAD( "tbp24s10.6p", 0x0000, 0x0100, CRC(a712d73a) SHA1(a65fa5928431d8631fb04e01ad0a0d2de849bf1d) ) // red component + ROM_LOAD( "tbp24s10.6s", 0x0100, 0x0100, CRC(0a7d48ec) SHA1(400e0b271c241712e7b7502e96e4f8a609e078e1) ) // green component + ROM_LOAD( "tbp24s10.6m", 0x0200, 0x0100, CRC(4c3db907) SHA1(03bcbc4763dcf49f4a06f499042e36183aa8b762) ) // blue component ROM_REGION( 0x0100, "unkprom", 0 ) - ROM_LOAD( "tbp24s10.8n", 0x0000, 0x0100, CRC(b5297a3b) SHA1(a5a512f86097b7d892f6d11e8492e8a379c07f60) ) /* ???? */ + ROM_LOAD( "tbp24s10.8n", 0x0000, 0x0100, CRC(b5297a3b) SHA1(a5a512f86097b7d892f6d11e8492e8a379c07f60) ) // ???? ROM_END ROM_START( vastar2 ) @@ -550,30 +835,30 @@ ROM_START( vastar2 ) ROM_LOAD( "10.6n", 0x6000, 0x1000, CRC(80df74ba) SHA1(5cbc75fb96ad6d63186ec42a5e9af6aae209d78f) ) ROM_LOAD( "9.5n", 0x7000, 0x1000, CRC(239ec84e) SHA1(8b516c63d858d5c4acc3701a9abf9c3d53ddf7ff) ) - ROM_REGION( 0x10000, "sub", 0 ) /* 64k for the second CPU */ + ROM_REGION( 0x10000, "sub", 0 ) ROM_LOAD( "e_f2.rom", 0x0000, 0x1000, CRC(713478d8) SHA1(9cbd1fb689d93a8964f48e59d4effaa4878b2945) ) ROM_LOAD( "e_j2.rom", 0x1000, 0x1000, CRC(e4535442) SHA1(280d93bec5cf6183250827ce70ed5ddff968bba5) ) - ROM_REGION( 0x2000, "gfx1", 0 ) + ROM_REGION( 0x2000, "fgtiles", 0 ) ROM_LOAD( "c_c9.rom", 0x0000, 0x2000, CRC(34f067b6) SHA1(45d7f8be5bd1dc9e5e511aa2e99c216c5ff12273) ) - ROM_REGION( 0x4000, "gfx2", 0 ) + ROM_REGION( 0x4000, "sprites", 0 ) ROM_LOAD( "c_f7.rom", 0x0000, 0x2000, CRC(edbf3b13) SHA1(9d6ddf16e83c68c831fec28607584471b5cbcbd2) ) ROM_LOAD( "c_f9.rom", 0x2000, 0x2000, CRC(8f309e22) SHA1(f5bbc5cf70687415061a0674e273e20fbfcc1f8f) ) - ROM_REGION( 0x2000, "gfx3", 0 ) + ROM_REGION( 0x2000, "bgtiles0", 0 ) ROM_LOAD( "c_n4.rom", 0x0000, 0x2000, CRC(b5f9c866) SHA1(17fc38cd40638e4f5d25c0cae70df3b8f03425dd) ) - ROM_REGION( 0x2000, "gfx4", 0 ) + ROM_REGION( 0x2000, "bgtiles1", 0 ) ROM_LOAD( "c_s4.rom", 0x0000, 0x2000, CRC(c9fbbfc9) SHA1(7c6ace0e2eae8420a31d9054ad5dd94924273d5f) ) ROM_REGION( 0x0300, "proms", 0 ) - ROM_LOAD( "tbp24s10.6p", 0x0000, 0x0100, CRC(a712d73a) SHA1(a65fa5928431d8631fb04e01ad0a0d2de849bf1d) ) /* red component */ - ROM_LOAD( "tbp24s10.6s", 0x0100, 0x0100, CRC(0a7d48ec) SHA1(400e0b271c241712e7b7502e96e4f8a609e078e1) ) /* green component */ - ROM_LOAD( "tbp24s10.6m", 0x0200, 0x0100, CRC(4c3db907) SHA1(03bcbc4763dcf49f4a06f499042e36183aa8b762) ) /* blue component */ + ROM_LOAD( "tbp24s10.6p", 0x0000, 0x0100, CRC(a712d73a) SHA1(a65fa5928431d8631fb04e01ad0a0d2de849bf1d) ) // red component + ROM_LOAD( "tbp24s10.6s", 0x0100, 0x0100, CRC(0a7d48ec) SHA1(400e0b271c241712e7b7502e96e4f8a609e078e1) ) // green component + ROM_LOAD( "tbp24s10.6m", 0x0200, 0x0100, CRC(4c3db907) SHA1(03bcbc4763dcf49f4a06f499042e36183aa8b762) ) // blue component ROM_REGION( 0x0100, "unkprom", 0 ) - ROM_LOAD( "tbp24s10.8n", 0x0000, 0x0100, CRC(b5297a3b) SHA1(a5a512f86097b7d892f6d11e8492e8a379c07f60) ) /* ???? */ + ROM_LOAD( "tbp24s10.8n", 0x0000, 0x0100, CRC(b5297a3b) SHA1(a5a512f86097b7d892f6d11e8492e8a379c07f60) ) // ???? ROM_END ROM_START( vastar3 ) @@ -582,7 +867,7 @@ ROM_START( vastar3 ) ROM_LOAD( "vst_3.4h", 0x2000, 0x2000, CRC(2276c5d0) SHA1(1070a952c4e8a8d97036511b48656602ce8e6848) ) ROM_LOAD( "vst_4.4j", 0x4000, 0x2000, CRC(deca2aa1) SHA1(88920ae4c4094a748d3f3c37093186e05f1ed284) ) ROM_LOAD( "vst_5.6n", 0x6000, 0x2000, CRC(743ed1c7) SHA1(34b2e952113c6c2137dc0c8916276ae344a7c9df) ) - /* same roms but split?? + /* same ROMs but split?? ROM_LOAD( "e_f4.rom", 0x0000, 0x1000, CRC(fecb46d6) SHA1(2d03af431f44ff13f535e1659c1cb15cd99da4a8) ) ROM_LOAD( "e_k4.rom", 0x1000, 0x1000, CRC(cd45a64d) SHA1(dd08f12df013c36218a827b6423acd33b7aa6cbf) ) ROM_LOAD( "e_h4.rom", 0x2000, 0x1000, CRC(9b0aee71) SHA1(0439706e5f7029dea316a497fb2a0c60a358c9f5) ) @@ -593,33 +878,33 @@ ROM_START( vastar3 ) ROM_LOAD( "e_n5.rom", 0x7000, 0x1000, CRC(896af6c8) SHA1(b262ee3b161ec00541d629f02ece6f978beea0ac) ) */ - ROM_REGION( 0x10000, "sub", 0 ) /* 64k for the second CPU */ + ROM_REGION( 0x10000, "sub", 0 ) ROM_LOAD( "vst_0.2f", 0x0000, 0x1000, CRC(713478d8) SHA1(9cbd1fb689d93a8964f48e59d4effaa4878b2945) ) ROM_LOAD( "vst_1.2j", 0x1000, 0x1000, CRC(e4535442) SHA1(280d93bec5cf6183250827ce70ed5ddff968bba5) ) - ROM_REGION( 0x2000, "gfx1", 0 ) + ROM_REGION( 0x2000, "fgtiles", 0 ) ROM_LOAD( "c_c9.rom", 0x0000, 0x2000, CRC(34f067b6) SHA1(45d7f8be5bd1dc9e5e511aa2e99c216c5ff12273) ) - ROM_REGION( 0x4000, "gfx2", 0 ) + ROM_REGION( 0x4000, "sprites", 0 ) ROM_LOAD( "c_f7.rom", 0x0000, 0x2000, CRC(edbf3b13) SHA1(9d6ddf16e83c68c831fec28607584471b5cbcbd2) ) ROM_LOAD( "c_f9.rom", 0x2000, 0x2000, CRC(8f309e22) SHA1(f5bbc5cf70687415061a0674e273e20fbfcc1f8f) ) - ROM_REGION( 0x2000, "gfx3", 0 ) + ROM_REGION( 0x2000, "bgtiles0", 0 ) ROM_LOAD( "c_n4.rom", 0x0000, 0x2000, CRC(b5f9c866) SHA1(17fc38cd40638e4f5d25c0cae70df3b8f03425dd) ) - ROM_REGION( 0x2000, "gfx4", 0 ) + ROM_REGION( 0x2000, "bgtiles1", 0 ) ROM_LOAD( "c_s4.rom", 0x0000, 0x2000, CRC(c9fbbfc9) SHA1(7c6ace0e2eae8420a31d9054ad5dd94924273d5f) ) ROM_REGION( 0x0300, "proms", 0 ) - ROM_LOAD( "tbp24s10.6p", 0x0000, 0x0100, CRC(a712d73a) SHA1(a65fa5928431d8631fb04e01ad0a0d2de849bf1d) ) /* red component */ - ROM_LOAD( "tbp24s10.6s", 0x0100, 0x0100, CRC(0a7d48ec) SHA1(400e0b271c241712e7b7502e96e4f8a609e078e1) ) /* green component */ - ROM_LOAD( "tbp24s10.6m", 0x0200, 0x0100, CRC(4c3db907) SHA1(03bcbc4763dcf49f4a06f499042e36183aa8b762) ) /* blue component */ + ROM_LOAD( "tbp24s10.6p", 0x0000, 0x0100, CRC(a712d73a) SHA1(a65fa5928431d8631fb04e01ad0a0d2de849bf1d) ) // red component + ROM_LOAD( "tbp24s10.6s", 0x0100, 0x0100, CRC(0a7d48ec) SHA1(400e0b271c241712e7b7502e96e4f8a609e078e1) ) // green component + ROM_LOAD( "tbp24s10.6m", 0x0200, 0x0100, CRC(4c3db907) SHA1(03bcbc4763dcf49f4a06f499042e36183aa8b762) ) // blue component ROM_REGION( 0x0100, "unkprom", 0 ) - ROM_LOAD( "tbp24s10.8n", 0x0000, 0x0100, CRC(b5297a3b) SHA1(a5a512f86097b7d892f6d11e8492e8a379c07f60) ) /* ???? */ + ROM_LOAD( "tbp24s10.8n", 0x0000, 0x0100, CRC(b5297a3b) SHA1(a5a512f86097b7d892f6d11e8492e8a379c07f60) ) // ???? ROM_END -ROM_START( vastar4 ) /* minimal changes (2 bytes) from parent set */ +ROM_START( vastar4 ) // minimal changes (2 bytes) from parent set ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "3.bin", 0x0000, 0x1000, CRC(d2b8f177) SHA1(c45941cc59873d9d2fc1ae0ce36bf76c9b8ed040) ) ROM_LOAD( "e_k4.rom", 0x1000, 0x1000, CRC(84531982) SHA1(bf2fd92d821734f64ad72e13f4e1aae8e055aa43) ) @@ -630,30 +915,30 @@ ROM_START( vastar4 ) /* minimal changes (2 bytes) from parent set */ ROM_LOAD( "e_n7.rom", 0x6000, 0x1000, CRC(31b6be39) SHA1(be0d03db9c6c8982b2f38ad534a6e213bbde1802) ) ROM_LOAD( "e_n5.rom", 0x7000, 0x1000, CRC(f63f0e78) SHA1(a029e340b11b358dbe0dcf2d1a0e6c6c093bbc9d) ) - ROM_REGION( 0x10000, "sub", 0 ) /* 64k for the second CPU */ + ROM_REGION( 0x10000, "sub", 0 ) ROM_LOAD( "e_f2.rom", 0x0000, 0x1000, CRC(713478d8) SHA1(9cbd1fb689d93a8964f48e59d4effaa4878b2945) ) ROM_LOAD( "e_j2.rom", 0x1000, 0x1000, CRC(e4535442) SHA1(280d93bec5cf6183250827ce70ed5ddff968bba5) ) - ROM_REGION( 0x2000, "gfx1", 0 ) + ROM_REGION( 0x2000, "fgtiles", 0 ) ROM_LOAD( "c_c9.rom", 0x0000, 0x2000, CRC(34f067b6) SHA1(45d7f8be5bd1dc9e5e511aa2e99c216c5ff12273) ) - ROM_REGION( 0x4000, "gfx2", 0 ) + ROM_REGION( 0x4000, "sprites", 0 ) ROM_LOAD( "c_f7.rom", 0x0000, 0x2000, CRC(edbf3b13) SHA1(9d6ddf16e83c68c831fec28607584471b5cbcbd2) ) ROM_LOAD( "c_f9.rom", 0x2000, 0x2000, CRC(8f309e22) SHA1(f5bbc5cf70687415061a0674e273e20fbfcc1f8f) ) - ROM_REGION( 0x2000, "gfx3", 0 ) + ROM_REGION( 0x2000, "bgtiles0", 0 ) ROM_LOAD( "c_n4.rom", 0x0000, 0x2000, CRC(b5f9c866) SHA1(17fc38cd40638e4f5d25c0cae70df3b8f03425dd) ) - ROM_REGION( 0x2000, "gfx4", 0 ) + ROM_REGION( 0x2000, "bgtiles1", 0 ) ROM_LOAD( "c_s4.rom", 0x0000, 0x2000, CRC(c9fbbfc9) SHA1(7c6ace0e2eae8420a31d9054ad5dd94924273d5f) ) ROM_REGION( 0x0300, "proms", 0 ) - ROM_LOAD( "tbp24s10.6p", 0x0000, 0x0100, CRC(a712d73a) SHA1(a65fa5928431d8631fb04e01ad0a0d2de849bf1d) ) /* red component */ - ROM_LOAD( "tbp24s10.6s", 0x0100, 0x0100, CRC(0a7d48ec) SHA1(400e0b271c241712e7b7502e96e4f8a609e078e1) ) /* green component */ - ROM_LOAD( "tbp24s10.6m", 0x0200, 0x0100, CRC(4c3db907) SHA1(03bcbc4763dcf49f4a06f499042e36183aa8b762) ) /* blue component */ + ROM_LOAD( "tbp24s10.6p", 0x0000, 0x0100, CRC(a712d73a) SHA1(a65fa5928431d8631fb04e01ad0a0d2de849bf1d) ) // red component + ROM_LOAD( "tbp24s10.6s", 0x0100, 0x0100, CRC(0a7d48ec) SHA1(400e0b271c241712e7b7502e96e4f8a609e078e1) ) // green component + ROM_LOAD( "tbp24s10.6m", 0x0200, 0x0100, CRC(4c3db907) SHA1(03bcbc4763dcf49f4a06f499042e36183aa8b762) ) // blue component ROM_REGION( 0x0100, "unkprom", 0 ) - ROM_LOAD( "tbp24s10.8n", 0x0000, 0x0100, CRC(b5297a3b) SHA1(a5a512f86097b7d892f6d11e8492e8a379c07f60) ) /* ???? */ + ROM_LOAD( "tbp24s10.8n", 0x0000, 0x0100, CRC(b5297a3b) SHA1(a5a512f86097b7d892f6d11e8492e8a379c07f60) ) // ???? ROM_END ROM_START( dogfightp ) // all 2732 @@ -689,17 +974,17 @@ ROM_START( pprobe ) ROM_REGION( 0x10000, "sub", 0 ) ROM_LOAD( "pb1.bin", 0x0000, 0x2000, CRC(cd624df9) SHA1(0645ce8dc1b361904da4f6e7adc9b7de109b2d14) ) - ROM_REGION( 0x2000, "gfx1", 0 ) + ROM_REGION( 0x2000, "fgtiles", 0 ) ROM_LOAD( "pb9.bin", 0x0000, 0x2000, CRC(82294dd6) SHA1(24b8eac3d476d4a4d91dd169e26bd075b0d1bf45) ) - ROM_REGION( 0x4000, "gfx2", 0 ) + ROM_REGION( 0x4000, "sprites", 0 ) ROM_LOAD( "pb8.bin", 0x0000, 0x2000, CRC(8d809e45) SHA1(70f99626acdceaadbe03de49bcf778266ddff893) ) ROM_LOAD( "pb10.bin", 0x2000, 0x2000, CRC(895f9dd3) SHA1(919861482598aa35a9ad476da19f9efa30904cd4) ) - ROM_REGION( 0x2000, "gfx3", 0 ) + ROM_REGION( 0x2000, "bgtiles0", 0 ) ROM_LOAD( "pb6.bin", 0x0000, 0x2000, CRC(ff309239) SHA1(4e52833fafd54d4502ad09091fbfb1a8a2ff8828) ) - ROM_REGION( 0x2000, "gfx4", 0 ) + ROM_REGION( 0x2000, "bgtiles1", 0 ) ROM_LOAD( "pb7.bin", 0x0000, 0x2000, CRC(439978f7) SHA1(ba80dd919a9bb6f8c516d4eb794c02ae0f0dea00) ) ROM_REGION( 0x0300, "proms", 0 ) @@ -708,9 +993,12 @@ ROM_START( pprobe ) ROM_LOAD( "dm74s287.2", 0x0200, 0x0100, CRC(64fea033) SHA1(19bbb325f71cb17ea069958b3c246fa908f0008e) ) ROM_REGION( 0x0100, "unkprom", 0 ) - ROM_LOAD( "mmi6301-1.bin", 0x0000, 0x0100, CRC(b5297a3b) SHA1(a5a512f86097b7d892f6d11e8492e8a379c07f60) ) /* ???? == vastar - tbp24s10.8n */ + ROM_LOAD( "mmi6301-1.bin", 0x0000, 0x0100, CRC(b5297a3b) SHA1(a5a512f86097b7d892f6d11e8492e8a379c07f60) ) // ???? == vastar - tbp24s10.8n ROM_END +} // anonymous namespace + + GAME( 1983, vastar, 0, vastar, vastar, vastar_state, empty_init, ROT90, "Orca (Sesame Japan license)", "Vastar (set 1)", MACHINE_SUPPORTS_SAVE ) // Sesame Japan was a brand of Fujikousan GAME( 1983, vastar2, vastar, vastar, vastar, vastar_state, empty_init, ROT90, "Orca (Sesame Japan license)", "Vastar (set 2)", MACHINE_SUPPORTS_SAVE ) GAME( 1983, vastar3, vastar, vastar, vastar, vastar_state, empty_init, ROT90, "Orca (Sesame Japan license)", "Vastar (set 3)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/orca/vastar.h b/src/mame/orca/vastar.h deleted file mode 100644 index 000ed51c5db..00000000000 --- a/src/mame/orca/vastar.h +++ /dev/null @@ -1,109 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Allard van der Bas -#ifndef MAME_INCLUDES_VASTAR_H -#define MAME_INCLUDES_VASTAR_H - -#pragma once - -#include "emupal.h" -#include "tilemap.h" - -class vastar_common_state : public driver_device -{ -public: - vastar_common_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_subcpu(*this, "sub"), - m_sharedram(*this, "sharedram") - { } - - void common(machine_config &config); - - INTERRUPT_GEN_MEMBER(vblank_irq); - -protected: - virtual void machine_start() override; - - required_device m_maincpu; - required_device m_subcpu; - - required_shared_ptr m_sharedram; - - uint8_t m_nmi_mask = 0; - - DECLARE_WRITE_LINE_MEMBER(nmi_mask_w); - - void cpu2_map(address_map &map); - void cpu2_port_map(address_map &map); - void main_port_map(address_map &map); -}; - -class vastar_state : public vastar_common_state -{ -public: - vastar_state(const machine_config &mconfig, device_type type, const char *tag) : - vastar_common_state(mconfig, type, tag), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_bg1videoram(*this, "bg1videoram"), - m_bg2videoram(*this, "bg2videoram"), - m_fgvideoram(*this, "fgvideoram"), - m_sprite_priority(*this, "sprite_priority") - { } - - void vastar(machine_config &config); - -protected: - virtual void machine_reset() override; - virtual void video_start() override; - -private: - required_device m_gfxdecode; - required_device m_palette; - - required_shared_ptr m_bg1videoram; - required_shared_ptr m_bg2videoram; - required_shared_ptr m_fgvideoram; - required_shared_ptr m_sprite_priority; - - // these are pointers into m_fgvideoram - uint8_t* m_bg1_scroll = nullptr; - uint8_t* m_bg2_scroll = nullptr; - uint8_t* m_spriteram1 = nullptr; - uint8_t* m_spriteram2 = nullptr; - uint8_t* m_spriteram3 = nullptr; - - tilemap_t *m_fg_tilemap = nullptr; - tilemap_t *m_bg1_tilemap = nullptr; - tilemap_t *m_bg2_tilemap = nullptr; - - DECLARE_WRITE_LINE_MEMBER(flip_screen_w); - void fgvideoram_w(offs_t offset, uint8_t data); - void bg1videoram_w(offs_t offset, uint8_t data); - void bg2videoram_w(offs_t offset, uint8_t data); - - TILE_GET_INFO_MEMBER(get_fg_tile_info); - TILE_GET_INFO_MEMBER(get_bg1_tile_info); - TILE_GET_INFO_MEMBER(get_bg2_tile_info); - - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); - - void main_map(address_map &map); -}; - -class dogfightp_state : public vastar_common_state -{ -public: - dogfightp_state(const machine_config &mconfig, device_type type, const char *tag) : - vastar_common_state(mconfig, type, tag) - { } - - void dogfightp(machine_config &config); - -private: - void dogfightp_main_map(address_map &map); -}; - -#endif // MAME_INCLUDES_VASTAR_H diff --git a/src/mame/orca/vastar_v.cpp b/src/mame/orca/vastar_v.cpp deleted file mode 100644 index 2e7eea0c887..00000000000 --- a/src/mame/orca/vastar_v.cpp +++ /dev/null @@ -1,210 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Allard van der Bas -/*************************************************************************** - - vastar.cpp - - Functions to emulate the video hardware of the machine. - -***************************************************************************/ - -#include "emu.h" -#include "vastar.h" - - -/*************************************************************************** - - Callbacks for the TileMap code - -***************************************************************************/ - -TILE_GET_INFO_MEMBER(vastar_state::get_fg_tile_info) -{ - int code = m_fgvideoram[tile_index + 0x800] | (m_fgvideoram[tile_index + 0x400] << 8); - int color = m_fgvideoram[tile_index]; - int fxy = (code & 0xc00) >> 10; // maybe, based on the other layers - tileinfo.set(0, - code, - color & 0x3f, - TILE_FLIPXY(fxy)); -} - -TILE_GET_INFO_MEMBER(vastar_state::get_bg1_tile_info) -{ - int code = m_bg1videoram[tile_index + 0x800] | (m_bg1videoram[tile_index] << 8); - int color = m_bg1videoram[tile_index + 0xc00]; - int fxy = (code & 0xc00) >> 10; - tileinfo.set(4, - code, - color & 0x3f, - TILE_FLIPXY(fxy)); -} - -TILE_GET_INFO_MEMBER(vastar_state::get_bg2_tile_info) -{ - int code = m_bg2videoram[tile_index + 0x800] | (m_bg2videoram[tile_index] << 8); - int color = m_bg2videoram[tile_index + 0xc00]; - int fxy = (code & 0xc00) >> 10; - tileinfo.set(3, - code, - color & 0x3f, - TILE_FLIPXY(fxy)); -} - - -/*************************************************************************** - - Start the video hardware emulation. - -***************************************************************************/ - -void vastar_state::video_start() -{ - m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(vastar_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8,8, 32,32); - m_bg1_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(vastar_state::get_bg1_tile_info)), TILEMAP_SCAN_ROWS, 8,8, 32,32); - m_bg2_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(vastar_state::get_bg2_tile_info)), TILEMAP_SCAN_ROWS, 8,8, 32,32); - - m_fg_tilemap->set_transparent_pen(0); - m_bg1_tilemap->set_transparent_pen(0); - m_bg2_tilemap->set_transparent_pen(0); - - m_bg1_tilemap->set_scroll_cols(32); - m_bg2_tilemap->set_scroll_cols(32); -} - - -/*************************************************************************** - - Memory handlers - -***************************************************************************/ - -void vastar_state::fgvideoram_w(offs_t offset, uint8_t data) -{ - m_fgvideoram[offset] = data; - m_fg_tilemap->mark_tile_dirty(offset & 0x3ff); -} - -void vastar_state::bg1videoram_w(offs_t offset, uint8_t data) -{ - m_bg1videoram[offset] = data; - m_bg1_tilemap->mark_tile_dirty(offset & 0x3ff); -} - -void vastar_state::bg2videoram_w(offs_t offset, uint8_t data) -{ - m_bg2videoram[offset] = data; - m_bg2_tilemap->mark_tile_dirty(offset & 0x3ff); -} - - - - -/*************************************************************************** - - Display refresh - -***************************************************************************/ - -// I wouldn't rule out the possibility of there being 2 sprite chips due to -// "offs & 0x20" being used to select the tile bank. -// -// for Planet Probe more cases appear correct if we draw the list in reverse -// order, but it's also possible we should be drawing 2 swapped lists in -// forward order instead -void vastar_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) -{ -// for (int offs = 0; offs < 0x40; offs += 2) - for (int offs = 0x40-2; offs >=0; offs -= 2) - { - int code = ((m_spriteram3[offs] & 0xfc) >> 2) + ((m_spriteram2[offs] & 0x01) << 6) - + ((offs & 0x20) << 2); - - int sx = m_spriteram3[offs + 1]; - int sy = m_spriteram1[offs]; - int color = m_spriteram1[offs + 1] & 0x3f; - int flipx = m_spriteram3[offs] & 0x02; - int flipy = m_spriteram3[offs] & 0x01; - - if (flip_screen()) - { - flipx = !flipx; - flipy = !flipy; - } - - if (m_spriteram2[offs] & 0x08) /* double width */ - { - if (!flip_screen()) - sy = 224 - sy; - - m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, - code/2, - color, - flipx,flipy, - sx,sy,0); - /* redraw with wraparound */ - m_gfxdecode->gfx(2)->transpen(bitmap,cliprect, - code/2, - color, - flipx,flipy, - sx,sy+256,0); - } - else - { - if (!flip_screen()) - sy = 240 - sy; - - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, - code, - color, - flipx,flipy, - sx,sy,0); - } - } -} - -uint32_t vastar_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - for (int i = 0;i < 32;i++) - { - m_bg1_tilemap->set_scrolly(i,m_bg1_scroll[i]); - m_bg2_tilemap->set_scrolly(i,m_bg2_scroll[i]); - } - - switch (*m_sprite_priority) - { - case 0: - m_bg1_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0); - draw_sprites(bitmap,cliprect); - m_bg2_tilemap->draw(screen, bitmap, cliprect, 0,0); - m_fg_tilemap->draw(screen, bitmap, cliprect, 0,0); - break; - - case 1: // ?? planet probe - m_bg1_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0); - m_bg2_tilemap->draw(screen, bitmap, cliprect, 0,0); - draw_sprites(bitmap,cliprect); - m_fg_tilemap->draw(screen, bitmap, cliprect, 0,0); - break; - - case 2: - m_bg1_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0); - draw_sprites(bitmap,cliprect); - m_bg1_tilemap->draw(screen, bitmap, cliprect, 0,0); - m_bg2_tilemap->draw(screen, bitmap, cliprect, 0,0); - m_fg_tilemap->draw(screen, bitmap, cliprect, 0,0); - break; - - case 3: - m_bg1_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0); - m_bg2_tilemap->draw(screen, bitmap, cliprect, 0,0); - m_fg_tilemap->draw(screen, bitmap, cliprect, 0,0); - draw_sprites(bitmap,cliprect); - break; - - default: - logerror("Unimplemented priority %X\n", *m_sprite_priority); - break; - } - return 0; -} diff --git a/src/mame/orca/zodiack.cpp b/src/mame/orca/zodiack.cpp index b1c83c75d81..33fd1fb8b08 100644 --- a/src/mame/orca/zodiack.cpp +++ b/src/mame/orca/zodiack.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:Zsolt Vasvari +// copyright-holders: Zsolt Vasvari + /*************************************************************************** Zodiack/Dogfight (c) 1983 Orca @@ -26,7 +27,7 @@ Notes: TODO: - improve video emulation (especially moguchan colors) - where do the sound related irqs come from exactly? -- can eventually be merged with espial.c +- can eventually be merged with orca/espial.cpp ============================================================================ @@ -87,23 +88,68 @@ Notes: ALL PROMs MMI 6331 Bounty2: -- First 0x100 bytes of the first rom contains a screen that appears if the protection fails. +- First 0x100 bytes of the first ROM contain a screen that appears if the protection fails. - The PCB uses a large CPU epoxy module marked "CPU PACKII". A battery can be spotted through the epoxy. - If you copy the first 0x100 bytes from "bounty" then the game works. - Therefore, it can be surmised that the epoxy blob contains a static ram or similar with - the first 256 bytes of the real game's rom, for as long as the battery lasts. + the first 256 bytes of the real game's ROM, for as long as the battery lasts. ***************************************************************************/ #include "emu.h" -#include "zodiack.h" +#include "orca40c.h" + +#include "cpu/z80/z80.h" +#include "machine/gen_latch.h" #include "machine/watchdog.h" #include "sound/ay8910.h" -#include "orca40c.h" + #include "speaker.h" +namespace { + +class zodiack_state : public driver_device +{ +public: + zodiack_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_soundlatch(*this, "soundlatch") + { } + + void zodiack(machine_config &config); + void percuss(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + +private: + void nmi_mask_w(uint8_t data); + void sound_nmi_enable_w(uint8_t data); + void master_soundlatch_w(uint8_t data); + void control_w(uint8_t data); + + // devices + required_device m_maincpu; + required_device m_audiocpu; + required_device m_soundlatch; + + // state + uint8_t m_main_nmi_enabled = 0; + uint8_t m_sound_nmi_enabled = 0; + + INTERRUPT_GEN_MEMBER(sound_nmi_gen); + DECLARE_WRITE_LINE_MEMBER(vblank_main_nmi_w); + + void io_map(address_map &map); + void main_map(address_map &map); + void sound_map(address_map &map); +}; + void zodiack_state::nmi_mask_w(uint8_t data) { m_main_nmi_enabled = (data & 1) ^ 1; @@ -120,7 +166,7 @@ WRITE_LINE_MEMBER(zodiack_state::vblank_main_nmi_w) m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero); } -INTERRUPT_GEN_MEMBER(zodiack_state::zodiack_sound_nmi_gen) +INTERRUPT_GEN_MEMBER(zodiack_state::sound_nmi_gen) { if (m_sound_nmi_enabled) m_audiocpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero); @@ -135,10 +181,10 @@ void zodiack_state::master_soundlatch_w(uint8_t data) void zodiack_state::control_w(uint8_t data) { - /* Bit 0-1 - coin counters */ + // Bit 0-1 - coin counters machine().bookkeeping().coin_counter_w(0, data & 0x02); machine().bookkeeping().coin_counter_w(1, data & 0x01); - /* Bit 2 - ???? */ + // Bit 2 - ???? } @@ -151,7 +197,7 @@ void zodiack_state::main_map(address_map &map) map(0x6083, 0x6083).portr("IN0"); map(0x6084, 0x6084).portr("IN1"); map(0x6090, 0x6090).r(m_soundlatch, FUNC(generic_latch_8_device::read)).w(FUNC(zodiack_state::master_soundlatch_w)); - map(0x7000, 0x7000).nopr().w("watchdog", FUNC(watchdog_timer_device::reset_w)); /* NOP??? */ + map(0x7000, 0x7000).nopr().w("watchdog", FUNC(watchdog_timer_device::reset_w)); // NOP??? map(0x7100, 0x7100).w(FUNC(zodiack_state::nmi_mask_w)); map(0x7200, 0x7200).w("videopcb", FUNC(orca_ovg_40c_device::flipscreen_w)); map(0x9000, 0x903f).ram().w("videopcb", FUNC(orca_ovg_40c_device::attributes_w)).share("videopcb:attributeram"); @@ -180,7 +226,7 @@ void zodiack_state::io_map(address_map &map) static INPUT_PORTS_START( zodiack ) - PORT_START("DSW0") /* never read in this game */ + PORT_START("DSW0") // never read in this game PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_START("DSW1") @@ -204,7 +250,7 @@ static INPUT_PORTS_START( zodiack ) PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:7") PORT_DIPSETTING( 0x40, DEF_STR( Upright ) ) PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) - PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8") /* Manual shows this one as Service Mode */ + PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8") // Manual shows this one as Service Mode PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x80, DEF_STR( On ) ) @@ -249,10 +295,10 @@ static INPUT_PORTS_START( dogfight ) PORT_DIPSETTING( 0x18, DEF_STR( 3C_4C ) ) PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) ) PORT_DIPSETTING( 0x10, DEF_STR( 1C_3C ) ) - PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) /* most likely unused */ + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) // most likely unused PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x40, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) /* most likely unused */ + PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) // most likely unused PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x80, DEF_STR( On ) ) @@ -347,8 +393,8 @@ static INPUT_PORTS_START( moguchan ) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_COCKTAIL /* these are read, but are they */ - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 ) /* ever used? */ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_COCKTAIL // these are read, but are they + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 ) // ever used? PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY INPUT_PORTS_END @@ -506,15 +552,15 @@ void zodiack_state::machine_reset() void zodiack_state::zodiack(machine_config &config) { - /* basic machine hardware */ - Z80(config, m_maincpu, XTAL(18'432'000)/6); + // basic machine hardware + Z80(config, m_maincpu, XTAL(18'432'000) / 6); m_maincpu->set_addrmap(AS_PROGRAM, &zodiack_state::main_map); - m_maincpu->set_periodic_int(FUNC(zodiack_state::irq0_line_hold), attotime::from_hz(1*60)); // sound related - unknown source, timing is guessed + m_maincpu->set_periodic_int(FUNC(zodiack_state::irq0_line_hold), attotime::from_hz(1 * 60)); // sound related - unknown source, timing is guessed - Z80(config, m_audiocpu, XTAL(18'432'000)/6); + Z80(config, m_audiocpu, XTAL(18'432'000) / 6); m_audiocpu->set_addrmap(AS_PROGRAM, &zodiack_state::sound_map); m_audiocpu->set_addrmap(AS_IO, &zodiack_state::io_map); - m_audiocpu->set_periodic_int(FUNC(zodiack_state::zodiack_sound_nmi_gen), attotime::from_hz(8*60)); // sound tempo - unknown source, timing is guessed + m_audiocpu->set_periodic_int(FUNC(zodiack_state::sound_nmi_gen), attotime::from_hz(8 * 60)); // sound tempo - unknown source, timing is guessed WATCHDOG_TIMER(config, "watchdog"); @@ -523,12 +569,12 @@ void zodiack_state::zodiack(machine_config &config) orca_ovg_40c_device &videopcb(ORCA_OVG_40C(config, "videopcb", 0)); videopcb.set_screen("screen"); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, m_soundlatch); - AY8910(config, "aysnd", XTAL(18'432'000)/12).add_route(ALL_OUTPUTS, "mono", 0.50); + AY8910(config, "aysnd", XTAL(18'432'000) / 12).add_route(ALL_OUTPUTS, "mono", 0.50); } void zodiack_state::percuss(machine_config &config) @@ -666,6 +712,8 @@ ROM_START( bounty2 ) // The PCB uses a large CPU epoxy module marked "CPU PACKII ROM_LOAD( "mb7051.2b", 0x0020, 0x0020, CRC(465e31d4) SHA1(d47a4aa0e8931dcd8f85017ef04c2f6ad79f5725) ) ROM_END +} // anonymous namespace + GAME( 1983, zodiack, 0, zodiack, zodiack, zodiack_state, empty_init, ROT270, "Orca (Esco Trading Co., Inc. license)", "Zodiack", MACHINE_IMPERFECT_COLORS | MACHINE_SUPPORTS_SAVE ) /* bullet color needs to be verified */ GAME( 1983, dogfight, 0, zodiack, dogfight, zodiack_state, empty_init, ROT270, "Orca / Thunderbolt", "Dog Fight (Thunderbolt)", MACHINE_IMPERFECT_COLORS | MACHINE_SUPPORTS_SAVE ) /* bullet color needs to be verified */ diff --git a/src/mame/orca/zodiack.h b/src/mame/orca/zodiack.h deleted file mode 100644 index 2a89dc1165e..00000000000 --- a/src/mame/orca/zodiack.h +++ /dev/null @@ -1,45 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Zsolt Vasvari - -#include "cpu/z80/z80.h" -#include "machine/gen_latch.h" - -class zodiack_state : public driver_device -{ -public: - zodiack_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_soundlatch(*this, "soundlatch") - { } - - void zodiack(machine_config &config); - void percuss(machine_config &config); - -protected: - virtual void machine_start() override; - virtual void machine_reset() override; - -private: - void nmi_mask_w(uint8_t data); - void sound_nmi_enable_w(uint8_t data); - void master_soundlatch_w(uint8_t data); - void control_w(uint8_t data); - - // devices - required_device m_maincpu; - required_device m_audiocpu; - required_device m_soundlatch; - - // state - uint8_t m_main_nmi_enabled = 0; - uint8_t m_sound_nmi_enabled = 0; - - INTERRUPT_GEN_MEMBER(zodiack_sound_nmi_gen); - DECLARE_WRITE_LINE_MEMBER(vblank_main_nmi_w); - - void io_map(address_map &map); - void main_map(address_map &map); - void sound_map(address_map &map); -}; diff --git a/src/mame/pacific/mrflea.cpp b/src/mame/pacific/mrflea.cpp index 291ccff3a64..0937a92a819 100644 --- a/src/mame/pacific/mrflea.cpp +++ b/src/mame/pacific/mrflea.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:Phil Stroffolino +// copyright-holders: Phil Stroffolino + /****************************************************************** Mr F Lea @@ -63,23 +64,192 @@ Stephh's notes (based on the games Z80 code and some tests) : ******************************************************************/ #include "emu.h" -#include "mrflea.h" #include "cpu/z80/z80.h" #include "machine/i8255.h" +#include "machine/pic8259.h" +#include "machine/timer.h" #include "sound/ay8910.h" + +#include "emupal.h" +#include "screen.h" #include "speaker.h" +// configurable logging +#define LOG_GFXBANK (1U << 1) + +//#define VERBOSE (LOG_GENERAL | LOG_GFXBANK) + +#include "logmacro.h" + +#define LOGGFXBANK(...) LOGMASKED(LOG_GFXBANK, __VA_ARGS__) + + +namespace { + +class mrflea_state : public driver_device +{ +public: + mrflea_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_videoram(*this, "videoram"), + m_spriteram(*this, "spriteram"), + m_maincpu(*this, "maincpu"), + m_subcpu(*this, "subcpu"), + m_pic(*this, "pic"), + m_gfxdecode(*this, "gfxdecode"), + m_screen(*this, "screen"), + m_palette(*this, "palette") + { } + + void mrflea(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + +private: + // memory pointers + required_shared_ptr m_videoram; + required_shared_ptr m_spriteram; + + // video-related + uint8_t m_gfx_bank = 0; + + // devices + required_device m_maincpu; + required_device m_subcpu; + required_device m_pic; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + + void data1_w(uint8_t data); + void gfx_bank_w(uint8_t data); + void videoram_w(offs_t offset, uint8_t data); + void spriteram_w(offs_t offset, uint8_t data); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER(slave_interrupt); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect); + void master_io_map(address_map &map); + void master_map(address_map &map); + void slave_io_map(address_map &map); + void slave_map(address_map &map); +}; + + +// video + + +void mrflea_state::gfx_bank_w(uint8_t data) +{ + m_gfx_bank = data; + + if (data & ~0x14) + LOGGFXBANK("unknown gfx bank: 0x%02x\n", data); +} + +void mrflea_state::videoram_w(offs_t offset, uint8_t data) +{ + int const bank = offset / 0x400; + + offset &= 0x3ff; + m_videoram[offset] = data; + m_videoram[offset + 0x400] = bank; + /* the address range that tile data is written to sets one bit of + the bank select. The remaining bits are from a video register. */ +} + +void mrflea_state::spriteram_w(offs_t offset, uint8_t data) +{ + if (offset & 2) + { + // tile_number + m_spriteram[offset | 1] = offset & 1; + offset &= ~1; + } + + m_spriteram[offset] = data; +} + +void mrflea_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + gfx_element *gfx = m_gfxdecode->gfx(0); + const uint8_t *source = m_spriteram; + const uint8_t *finish = source + 0x100; + rectangle clip = m_screen->visible_area(); + + clip.max_x -= 24; + clip.min_x += 16; + + while (source < finish) + { + int const xpos = source[1] - 3; + int const ypos = source[0] - 16 + 3; + int const tile_number = source[2] + source[3] * 0x100; + + gfx->transpen(bitmap, clip, + tile_number, + 0, // color + 0, 0, // no flip + xpos, ypos, 0); + gfx->transpen(bitmap, clip, + tile_number, + 0, // color + 0, 0, // no flip + xpos, 256 + ypos, 0); + source += 4; + } +} + +void mrflea_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + const uint8_t *source = m_videoram; + gfx_element *gfx = m_gfxdecode->gfx(1); + int base = 0; + + if (BIT(m_gfx_bank, 2)) + base |= 0x400; + + if (BIT(m_gfx_bank, 4)) + base |= 0x200; + + for (int sy = 0; sy < 256; sy += 8) + { + for (int sx = 0; sx < 256; sx += 8) + { + int const tile_number = base + source[0] + source[0x400] * 0x100; + source++; + + gfx->opaque(bitmap, cliprect, + tile_number, + 0, // color + 0, 0, // no flip + sx, sy); + } + } +} + +uint32_t mrflea_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + draw_background(bitmap, cliprect); + draw_sprites(bitmap, cliprect); + return 0; +} + +// machine + /************************************* * * Memory handlers * *************************************/ -TIMER_DEVICE_CALLBACK_MEMBER(mrflea_state::mrflea_slave_interrupt) +TIMER_DEVICE_CALLBACK_MEMBER(mrflea_state::slave_interrupt) { - int scanline = param; + int const scanline = param; if (scanline == 248) m_pic->ir1_w(ASSERT_LINE); @@ -87,7 +257,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(mrflea_state::mrflea_slave_interrupt) m_pic->ir1_w(CLEAR_LINE); } -void mrflea_state::mrflea_data1_w(uint8_t data) +void mrflea_state::data1_w(uint8_t data) { } @@ -97,36 +267,36 @@ void mrflea_state::mrflea_data1_w(uint8_t data) * *************************************/ -void mrflea_state::mrflea_master_map(address_map &map) +void mrflea_state::master_map(address_map &map) { map(0x0000, 0xbfff).rom(); map(0xc000, 0xcfff).ram(); - map(0xe000, 0xe7ff).ram().w(FUNC(mrflea_state::mrflea_videoram_w)).share("videoram"); + map(0xe000, 0xe7ff).ram().w(FUNC(mrflea_state::videoram_w)).share(m_videoram); map(0xe800, 0xe83f).ram().w(m_palette, FUNC(palette_device::write8)).share("palette"); - map(0xec00, 0xecff).ram().w(FUNC(mrflea_state::mrflea_spriteram_w)).share("spriteram"); + map(0xec00, 0xecff).ram().w(FUNC(mrflea_state::spriteram_w)).share(m_spriteram); } -void mrflea_state::mrflea_master_io_map(address_map &map) +void mrflea_state::master_io_map(address_map &map) { map.global_mask(0xff); - map(0x00, 0x00).nopw(); /* watchdog? */ + map(0x00, 0x00).nopw(); // watchdog? map(0x40, 0x43).rw("mainppi", FUNC(i8255_device::read), FUNC(i8255_device::write)); - map(0x60, 0x60).w(FUNC(mrflea_state::mrflea_gfx_bank_w)); + map(0x60, 0x60).w(FUNC(mrflea_state::gfx_bank_w)); } -void mrflea_state::mrflea_slave_map(address_map &map) +void mrflea_state::slave_map(address_map &map) { map(0x0000, 0x0fff).rom(); map(0x2000, 0x3fff).rom(); map(0x8000, 0x80ff).ram(); - map(0x9000, 0x905a).ram(); /* ? */ + map(0x9000, 0x905a).ram(); // ? } -void mrflea_state::mrflea_slave_io_map(address_map &map) +void mrflea_state::slave_io_map(address_map &map) { map.global_mask(0xff); - map(0x00, 0x00).nopw(); /* watchdog */ + map(0x00, 0x00).nopw(); // watchdog map(0x10, 0x11).rw(m_pic, FUNC(pic8259_device::read), FUNC(pic8259_device::write)); map(0x20, 0x23).rw("subppi", FUNC(i8255_device::read), FUNC(i8255_device::write)); map(0x40, 0x40).rw("ay1", FUNC(ay8910_device::data_r), FUNC(ay8910_device::data_w)); @@ -145,9 +315,9 @@ void mrflea_state::mrflea_slave_io_map(address_map &map) * *************************************/ -/* verified from Z80 code */ +// verified from Z80 code static INPUT_PORTS_START( mrflea ) - /* AY1 port 1 -> 0x807d (CPU1) -> 0xcabe (CPU0) with bits in reverse order */ + // AY1 port 1 -> 0x807d (CPU1) -> 0xcabe (CPU0) with bits in reverse order PORT_START("IN0") PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY @@ -158,14 +328,14 @@ static INPUT_PORTS_START( mrflea ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) - /* AY1 port 0 -> 0x807e (CPU1) -> 0xcabf (CPU0) with bits in reverse order */ + // AY1 port 0 -> 0x807e (CPU1) -> 0xcabf (CPU0) with bits in reverse order PORT_START("IN1") PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0xfb, IP_ACTIVE_LOW, IPT_UNUSED ) - /* AY2 port 1, cpl'ed -> 0x807f (CPU1) -> 0xcac1 (CPU0) */ + // AY2 port 1, cpl'ed -> 0x807f (CPU1) -> 0xcac1 (CPU0) PORT_START("DSW1") - PORT_DIPNAME( 0x0f, 0x07, DEF_STR( Bonus_Life ) ) /* see notes - table of tables at 0x3475 (4 * 1 word, LSB first) */ + PORT_DIPNAME( 0x0f, 0x07, DEF_STR( Bonus_Life ) ) // see notes - table of tables at 0x3475 (4 * 1 word, LSB first) PORT_DIPSETTING( 0x07, "Every 10k" ) PORT_DIPSETTING( 0x06, "Every 20k" ) PORT_DIPSETTING( 0x05, "Every 30k" ) @@ -180,9 +350,9 @@ static INPUT_PORTS_START( mrflea ) PORT_DIPUNUSED( 0x40, 0x40 ) PORT_DIPUNUSED( 0x80, 0x80 ) - /* AY2 port 0, cpl'ed -> 0x8080 (CPU1) -> 0xcac0 (CPU0) */ + // AY2 port 0, cpl'ed -> 0x8080 (CPU1) -> 0xcac0 (CPU0) PORT_START("DSW2") - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) ) /* see notes */ + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) ) // see notes PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) ) PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 2C_3C ) ) @@ -192,7 +362,7 @@ static INPUT_PORTS_START( mrflea ) PORT_DIPSETTING( 0x08, "4" ) PORT_DIPSETTING( 0x04, "5" ) PORT_DIPSETTING( 0x00, "7" ) - PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) ) /* see notes */ + PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) ) // see notes PORT_DIPSETTING( 0x30, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x20, DEF_STR( Medium ) ) PORT_DIPSETTING( 0x10, DEF_STR( Hard ) ) @@ -211,19 +381,9 @@ INPUT_PORTS_END * *************************************/ -static const gfx_layout tile_layout = { - 8,8, - 0x800, /* number of tiles */ - 4, - { 0,1,2,3 }, - { 0*4,1*4,2*4,3*4, 4*4,5*4,6*4,7*4 }, - { 0*32,1*32,2*32,3*32, 4*32,5*32,6*32,7*32 }, - 8*32 -}; - static const gfx_layout sprite_layout = { 16,16, - 0x200, /* number of sprites */ + 0x200, // number of sprites 4, { 0*0x4000*8,1*0x4000*8,2*0x4000*8,3*0x4000*8 }, { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 }, @@ -235,8 +395,8 @@ static const gfx_layout sprite_layout = { }; static GFXDECODE_START( gfx_mrflea ) - GFXDECODE_ENTRY( "gfx1", 0, sprite_layout, 0x10, 1 ) - GFXDECODE_ENTRY( "gfx2", 0, tile_layout, 0x00, 1 ) + GFXDECODE_ENTRY( "sprites", 0, sprite_layout, 0x10, 1 ) + GFXDECODE_ENTRY( "chars", 0, gfx_8x8x4_packed_msb, 0x00, 1 ) GFXDECODE_END /************************************* @@ -257,16 +417,16 @@ void mrflea_state::machine_reset() void mrflea_state::mrflea(machine_config &config) { - /* basic machine hardware */ - Z80(config, m_maincpu, 4000000); /* 4 MHz? */ - m_maincpu->set_addrmap(AS_PROGRAM, &mrflea_state::mrflea_master_map); - m_maincpu->set_addrmap(AS_IO, &mrflea_state::mrflea_master_io_map); - m_maincpu->set_vblank_int("screen", FUNC(mrflea_state::irq0_line_hold)); /* NMI resets the game */ + // basic machine hardware + Z80(config, m_maincpu, 4'000'000); // 4 MHz? + m_maincpu->set_addrmap(AS_PROGRAM, &mrflea_state::master_map); + m_maincpu->set_addrmap(AS_IO, &mrflea_state::master_io_map); + m_maincpu->set_vblank_int("screen", FUNC(mrflea_state::irq0_line_hold)); // NMI resets the game - Z80(config, m_subcpu, 6000000); // runs in IM 1, so doesn't use 8259 INTA - m_subcpu->set_addrmap(AS_PROGRAM, &mrflea_state::mrflea_slave_map); - m_subcpu->set_addrmap(AS_IO, &mrflea_state::mrflea_slave_io_map); - TIMER(config, "scantimer").configure_scanline(FUNC(mrflea_state::mrflea_slave_interrupt), "screen", 0, 1); + Z80(config, m_subcpu, 6'000'000); // runs in IM 1, so doesn't use 8259 INTA + m_subcpu->set_addrmap(AS_PROGRAM, &mrflea_state::slave_map); + m_subcpu->set_addrmap(AS_IO, &mrflea_state::slave_io_map); + TIMER(config, "scantimer").configure_scanline(FUNC(mrflea_state::slave_interrupt), "screen", 0, 1); config.set_maximum_quantum(attotime::from_hz(6000)); @@ -284,36 +444,36 @@ void mrflea_state::mrflea(machine_config &config) PIC8259(config, m_pic, 0); m_pic->out_int_callback().set_inputline(m_subcpu, 0); - /* video hardware */ + // video hardware SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_refresh_hz(60); m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0)); m_screen->set_size(32*8, 32*8); m_screen->set_visarea(0*8, 32*8-1, 0*8, 31*8-1); - m_screen->set_screen_update(FUNC(mrflea_state::screen_update_mrflea)); + m_screen->set_screen_update(FUNC(mrflea_state::screen_update)); m_screen->set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_mrflea); PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 32); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); - ay8910_device &ay1(AY8910(config, "ay1", 2000000)); + ay8910_device &ay1(AY8910(config, "ay1", 2'000'000)); ay1.port_a_read_callback().set_ioport("IN1"); ay1.port_b_read_callback().set_ioport("IN0"); ay1.add_route(ALL_OUTPUTS, "mono", 0.25); - AY8910(config, "ay2", 2000000).add_route(ALL_OUTPUTS, "mono", 0.25); // not used for sound? + AY8910(config, "ay2", 2'000'000).add_route(ALL_OUTPUTS, "mono", 0.25); // not used for sound? - ay8910_device &ay3(AY8910(config, "ay3", 2000000)); + ay8910_device &ay3(AY8910(config, "ay3", 2'000'000)); ay3.port_a_read_callback().set_ioport("DSW2"); ay3.port_b_read_callback().set_ioport("DSW1"); ay3.add_route(ALL_OUTPUTS, "mono", 0.25); - ay8910_device &ay4(AY8910(config, "ay4", 2000000)); + ay8910_device &ay4(AY8910(config, "ay4", 2'000'000)); ay4.port_a_read_callback().set_ioport("UNKNOWN"); - ay4.port_b_write_callback().set(FUNC(mrflea_state::mrflea_data1_w)); + ay4.port_b_write_callback().set(FUNC(mrflea_state::data1_w)); ay4.add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -324,7 +484,7 @@ void mrflea_state::mrflea(machine_config &config) *************************************/ ROM_START( mrflea ) - ROM_REGION( 0x10000, "maincpu", 0 ) /* Z80 code; main CPU */ + ROM_REGION( 0x10000, "maincpu", 0 ) // Z80 code ROM_LOAD( "cpu_d1", 0x0000, 0x2000, CRC(d286217c) SHA1(d750d64bb70f735a38b737881abb9a5fbde1c98c) ) ROM_LOAD( "cpu_d3", 0x2000, 0x2000, CRC(95cf94bc) SHA1(dd0a51d79b0b28952e6177f36af93f296b3cd954) ) ROM_LOAD( "cpu_d5", 0x4000, 0x2000, CRC(466ca77e) SHA1(513f41a888166a057d28bdc572571a713d77ae5f) ) @@ -332,12 +492,12 @@ ROM_START( mrflea ) ROM_LOAD( "cpu_b3", 0x8000, 0x2000, CRC(f55b01e4) SHA1(93689fa02aab9d1f1acd55b305eafe542ee447b8) ) ROM_LOAD( "cpu_b5", 0xa000, 0x2000, CRC(79f560aa) SHA1(7326693d7369682f5770bf80df0181d603212900) ) - ROM_REGION( 0x10000, "subcpu", 0 ) /* Z80 code; IO CPU */ + ROM_REGION( 0x10000, "subcpu", 0 ) // Z80 code; IO CPU ROM_LOAD( "io_a11", 0x0000, 0x1000, CRC(7a20c3ee) SHA1(8e0d5770881e6d3d1df17a2ede5a8823ca9d78e3) ) ROM_LOAD( "io_c11", 0x2000, 0x1000, CRC(8d26e0c8) SHA1(e90e37bd64e991dc47ab80394337073c69b450da) ) ROM_LOAD( "io_d11", 0x3000, 0x1000, CRC(abd9afc0) SHA1(873314164707ee84739ec76c6119a65a17001620) ) - ROM_REGION( 0x10000, "gfx1", 0 ) /* sprites */ + ROM_REGION( 0x10000, "sprites", 0 ) ROM_LOAD( "vd_l10", 0x0000, 0x2000, CRC(48b2adf9) SHA1(91390cdbd8df610edec87c1681db1576e2f3c58d) ) ROM_LOAD( "vd_l11", 0x2000, 0x2000, CRC(2ff168c0) SHA1(e24b6a33e9ce50771983db8b8de7e79a1e87929c) ) ROM_LOAD( "vd_l6", 0x4000, 0x2000, CRC(100158ca) SHA1(83a619e5897a2b379eb7a72fde3e1bc08b7a34c4) ) @@ -347,7 +507,7 @@ ROM_START( mrflea ) ROM_LOAD( "vd_j6", 0xc000, 0x2000, CRC(2b4b110e) SHA1(37644113b2ce7bd525697ebb2fc8cb295c228a60) ) ROM_LOAD( "vd_j7", 0xe000, 0x2000, CRC(3a3c8b1e) SHA1(5991d80990212ffe92c546b0e4b4e01c68fdd0cd) ) - ROM_REGION( 0x10000, "gfx2", 0 ) /* characters */ + ROM_REGION( 0x10000, "chars", 0 ) ROM_LOAD( "vd_k1", 0x0000, 0x2000, CRC(7540e3a7) SHA1(e292e7ec47eaefee8bec1585ec33ea4e6cb64e81) ) ROM_LOAD( "vd_k2", 0x2000, 0x2000, CRC(6c688219) SHA1(323640b99d9e39b327f500ff2ae6a7f8d0da3ada) ) ROM_LOAD( "vd_k3", 0x4000, 0x2000, CRC(15e96f3c) SHA1(e57a219666dd440909d3fb75d9a5708cbb904389) ) @@ -358,10 +518,13 @@ ROM_START( mrflea ) ROM_LOAD( "vd_l4", 0xe000, 0x2000, CRC(423735a5) SHA1(4ee93f93cd2b08560e148525e08880d64c64fcd2) ) ROM_END +} // anonymous namespace + + /************************************* * * Game driver(s) * *************************************/ -GAME( 1982, mrflea, 0, mrflea, mrflea, mrflea_state, empty_init, ROT270, "Pacific Novelty", "The Amazing Adventures of Mr. F. Lea" , MACHINE_SUPPORTS_SAVE ) +GAME( 1982, mrflea, 0, mrflea, mrflea, mrflea_state, empty_init, ROT270, "Pacific Novelty", "The Amazing Adventures of Mr. F. Lea" , MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/pacific/mrflea.h b/src/mame/pacific/mrflea.h deleted file mode 100644 index 2b6a19185bd..00000000000 --- a/src/mame/pacific/mrflea.h +++ /dev/null @@ -1,67 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Phil Stroffolino -/************************************************************************* - - Mr. Flea - -*************************************************************************/ -#ifndef MAME_INCLUDES_MRFLEA_H -#define MAME_INCLUDES_MRFLEA_H - -#pragma once - -#include "machine/pic8259.h" -#include "machine/timer.h" -#include "emupal.h" -#include "screen.h" - -class mrflea_state : public driver_device -{ -public: - mrflea_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_videoram(*this, "videoram"), - m_spriteram(*this, "spriteram"), - m_maincpu(*this, "maincpu"), - m_subcpu(*this, "subcpu"), - m_pic(*this, "pic"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette") - { } - - void mrflea(machine_config &config); - -private: - /* memory pointers */ - required_shared_ptr m_videoram; - required_shared_ptr m_spriteram; - - /* video-related */ - int m_gfx_bank = 0; - - /* devices */ - required_device m_maincpu; - required_device m_subcpu; - required_device m_pic; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - - void mrflea_data1_w(uint8_t data); - void mrflea_gfx_bank_w(uint8_t data); - void mrflea_videoram_w(offs_t offset, uint8_t data); - void mrflea_spriteram_w(offs_t offset, uint8_t data); - virtual void machine_start() override; - virtual void machine_reset() override; - uint32_t screen_update_mrflea(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(mrflea_slave_interrupt); - void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); - void draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect ); - void mrflea_master_io_map(address_map &map); - void mrflea_master_map(address_map &map); - void mrflea_slave_io_map(address_map &map); - void mrflea_slave_map(address_map &map); -}; - -#endif // MAME_INCLUDES_MRFLEA_H diff --git a/src/mame/pacific/mrflea_v.cpp b/src/mame/pacific/mrflea_v.cpp deleted file mode 100644 index 9e723d55170..00000000000 --- a/src/mame/pacific/mrflea_v.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Phil Stroffolino -/****************************************************************** - -Mr. F. Lea -(C) 1983 PACIFIC NOVELTY MFG. INC. - -******************************************************************/ - -#include "emu.h" -#include "mrflea.h" - -void mrflea_state::mrflea_gfx_bank_w(uint8_t data) -{ - m_gfx_bank = data; - - if (data & ~0x14) - logerror("unknown gfx bank: 0x%02x\n", data); -} - -void mrflea_state::mrflea_videoram_w(offs_t offset, uint8_t data) -{ - int bank = offset / 0x400; - - offset &= 0x3ff; - m_videoram[offset] = data; - m_videoram[offset + 0x400] = bank; - /* the address range that tile data is written to sets one bit of - the bank select. The remaining bits are from a video register. */ -} - -void mrflea_state::mrflea_spriteram_w(offs_t offset, uint8_t data) -{ - if (offset & 2) - { - /* tile_number */ - m_spriteram[offset | 1] = offset & 1; - offset &= ~1; - } - - m_spriteram[offset] = data; -} - -void mrflea_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - gfx_element *gfx = m_gfxdecode->gfx(0); - const uint8_t *source = m_spriteram; - const uint8_t *finish = source + 0x100; - rectangle clip = m_screen->visible_area(); - - clip.max_x -= 24; - clip.min_x += 16; - - while (source < finish) - { - int xpos = source[1] - 3; - int ypos = source[0] - 16 + 3; - int tile_number = source[2] + source[3] * 0x100; - - gfx->transpen(bitmap,clip, - tile_number, - 0, /* color */ - 0,0, /* no flip */ - xpos,ypos,0 ); - gfx->transpen(bitmap,clip, - tile_number, - 0, /* color */ - 0,0, /* no flip */ - xpos,256+ypos,0 ); - source += 4; - } -} - -void mrflea_state::draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - const uint8_t *source = m_videoram; - gfx_element *gfx = m_gfxdecode->gfx(1); - int sx, sy; - int base = 0; - - if (BIT(m_gfx_bank, 2)) - base |= 0x400; - - if (BIT(m_gfx_bank, 4)) - base |= 0x200; - - for (sy = 0; sy < 256; sy += 8) - { - for (sx = 0; sx < 256; sx += 8) - { - int tile_number = base + source[0] + source[0x400] * 0x100; - source++; - - gfx->opaque(bitmap,cliprect, - tile_number, - 0, /* color */ - 0,0, /* no flip */ - sx,sy ); - } - } -} - -uint32_t mrflea_state::screen_update_mrflea(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - draw_background(bitmap, cliprect); - draw_sprites(bitmap, cliprect); - return 0; -} diff --git a/src/mame/pacific/thief.cpp b/src/mame/pacific/thief.cpp index 30428e63885..04843fcf391 100644 --- a/src/mame/pacific/thief.cpp +++ b/src/mame/pacific/thief.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:Victor Trucco, Mike Balfour, Phil Stroffolino +// copyright-holders: Victor Trucco, Mike Balfour, Phil Stroffolino + /****************************************************************** Shark Attack @@ -20,27 +21,441 @@ Credits: - Nato Defense gfx ROMs may be hooked up wrong; see screenshots from flyers +- Coprocessor needs identification and actual emulation + ******************************************************************/ #include "emu.h" -#include "thief.h" #include "cpu/z80/z80.h" #include "machine/i8255.h" #include "sound/ay8910.h" #include "sound/samples.h" +#include "video/tms9927.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +namespace { + +class sharkatt_state : public driver_device +{ +public: + sharkatt_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag) , + m_maincpu(*this, "maincpu"), + m_samples(*this, "samples"), + m_screen(*this, "screen"), + m_tms(*this, "tms"), + m_palette(*this, "palette"), + m_videoram(*this, "videoram", 0x2000 * 4 * 2, ENDIANNESS_LITTLE), + m_ioport(*this, { "DSW1", "DSW2", "P1", "P2" }) + { } + + void sharkatt(machine_config &config); + + DECLARE_WRITE_LINE_MEMBER(slam_w); + +protected: + virtual void video_start() override; + + uint8_t videoram_r(offs_t offset); + void videoram_w(offs_t offset, uint8_t data); + + void main_map(address_map &map); + + required_device m_maincpu; + required_device m_samples; + required_device m_screen; + +private: + required_device m_tms; + required_device m_palette; + + memory_share_creator m_videoram; + + required_ioport_array<4> m_ioport; + + uint8_t m_input_select = 0; + uint8_t m_read_mask = 0; + uint8_t m_write_mask = 0; + uint8_t m_video_control = 0; + + void input_select_w(uint8_t data); + uint8_t io_r(); + void video_control_w(uint8_t data); + void color_map_w(offs_t offset, uint8_t data); + void color_plane_w(uint8_t data); + void tape_control_w(uint8_t data); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + IRQ_CALLBACK_MEMBER(iack); + void tape_set_audio(int track, int bon); + void tape_set_motor(int bon); + + void io_map(address_map &map); +}; + +class thief_state : public sharkatt_state +{ +public: + thief_state(const machine_config &mconfig, device_type type, const char *tag) : + sharkatt_state(mconfig, type, tag) , + m_blitrom(*this, "blitter"), + m_coprocessor(*this) + { } + + void natodef(machine_config &config); + void thief(machine_config &config); + +protected: + virtual void video_start() override; + +private: + required_region_ptr m_blitrom; + + struct coprocessor + { + coprocessor(device_t &host) : context_ram(host, "context_ram", 0x400, ENDIANNESS_LITTLE), + bank(0), + image_ram(host, "image_ram", 0x2000, ENDIANNESS_LITTLE), + param{} + { } + + memory_share_creator context_ram; + uint8_t bank; + memory_share_creator image_ram; + uint8_t param[0x9]; + }; + + coprocessor m_coprocessor; + + uint8_t context_ram_r(offs_t offset); + void context_ram_w(offs_t offset, uint8_t data); + void context_bank_w(uint8_t data); + void blit_w(uint8_t data); + uint8_t coprocessor_r(offs_t offset); + void coprocessor_w(offs_t offset, uint8_t data); + + uint16_t fetch_image_addr(); + + void main_map(address_map &map); +}; + + +// video + +enum { + IMAGE_ADDR_LO, //0xe000 + IMAGE_ADDR_HI, //0xe001 + SCREEN_XPOS, //0xe002 + SCREEN_YPOS, //0xe003 + BLIT_WIDTH, //0xe004 + BLIT_HEIGHT, //0xe005 + GFX_PORT, //0xe006 + BARL_PORT, //0xe007 + BLIT_ATTRIBUTES //0xe008 +}; + +/***************************************************************************/ + +uint8_t thief_state::context_ram_r(offs_t offset) +{ + return m_coprocessor.context_ram[0x40 * m_coprocessor.bank + offset]; +} + +void thief_state::context_ram_w(offs_t offset, uint8_t data) +{ + m_coprocessor.context_ram[0x40 * m_coprocessor.bank + offset] = data; +} + +void thief_state::context_bank_w(uint8_t data) +{ + m_coprocessor.bank = data & 0xf; +} + +/***************************************************************************/ + +void sharkatt_state::video_control_w(uint8_t data) +{ + m_video_control = data; +/* + bit 0: screen flip + bit 1: working page + bit 2: visible page + bit 3: mirrors bit 1 + bit 4: mirrors bit 2 +*/ +} + +void sharkatt_state::color_map_w(offs_t offset, uint8_t data) +{ +/* + --xx---- blue + ----xx-- green + ------xx red +*/ + static const uint8_t intensity[4] = {0x00, 0x55, 0xaa, 0xff}; + int const r = intensity[(data & 0x03) >> 0]; + int const g = intensity[(data & 0x0c) >> 2]; + int const b = intensity[(data & 0x30) >> 4]; + + m_palette->set_pen_color(offset, rgb_t(r, g, b)); +} + +/***************************************************************************/ + +void sharkatt_state::color_plane_w(uint8_t data) +{ +/* + --xx---- selects bitplane to read from (0..3) + ----xxxx selects bitplane(s) to write to (0x0 = none, 0xf = all) +*/ + m_write_mask = data & 0xf; + m_read_mask = (data >> 4) & 3; +} + +uint8_t sharkatt_state::videoram_r(offs_t offset) +{ + uint8_t *source = &m_videoram[offset]; + + if (m_video_control & 0x02) + source += 0x2000 * 4; // foreground / background + + return source[m_read_mask * 0x2000]; +} + +void sharkatt_state::videoram_w(offs_t offset, uint8_t data) +{ + uint8_t *dest = &m_videoram[offset]; + + if (m_video_control & 0x02) + dest += 0x2000 * 4; // foreground / background + + for (int i = 0; i < 4; i++) + if (BIT(m_write_mask, i)) + dest[0x2000 * i] = data; +} + +/***************************************************************************/ + +void sharkatt_state::video_start() +{ + save_item(NAME(m_input_select)); + save_item(NAME(m_read_mask)); + save_item(NAME(m_write_mask)); + save_item(NAME(m_video_control)); +} + +void thief_state::video_start() +{ + sharkatt_state::video_start(); + + save_item(NAME(m_coprocessor.bank)); + save_item(NAME(m_coprocessor.param)); +} + +uint32_t sharkatt_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + int const flipscreen = m_video_control & 1; + const uint8_t *source = m_videoram.target(); + + if (m_tms->screen_reset()) + { + bitmap.fill(m_palette->black_pen(), cliprect); + return 0; + } + + if (m_video_control & 4) // visible page + source += 0x2000 * 4; + + for (uint32_t offs = 0; offs < 0x2000; offs++) + { + int const ypos = offs / 32; + int const xpos = (offs % 32) * 8; + int const plane0 = source[0x2000 * 0 + offs]; + int const plane1 = source[0x2000 * 1 + offs]; + int const plane2 = source[0x2000 * 2 + offs]; + int const plane3 = source[0x2000 * 3 + offs]; + if (flipscreen) + { + for (int bit = 0; bit < 8; bit++) + { + bitmap.pix(0xff - ypos, 0xff - (xpos + bit)) = + (((plane0 << bit) & 0x80) >> 7) | + (((plane1 << bit) & 0x80) >> 6) | + (((plane2 << bit) & 0x80) >> 5) | + (((plane3 << bit) & 0x80) >> 4); + } + } + else + { + for (int bit = 0; bit < 8; bit++) + { + bitmap.pix(ypos, xpos + bit) = + (((plane0 << bit) & 0x80) >> 7) | + (((plane1 << bit) & 0x80) >> 6) | + (((plane2 << bit) & 0x80) >> 5) | + (((plane3 << bit) & 0x80) >> 4); + } + } + } + return 0; +} + +/***************************************************************************/ + +uint16_t thief_state::fetch_image_addr() +{ + int const addr = m_coprocessor.param[IMAGE_ADDR_LO] + 256 * m_coprocessor.param[IMAGE_ADDR_HI]; + + // auto-increment + m_coprocessor.param[IMAGE_ADDR_LO]++; + + if (m_coprocessor.param[IMAGE_ADDR_LO] == 0x00) + m_coprocessor.param[IMAGE_ADDR_HI]++; + + return addr; +} + +void thief_state::blit_w(uint8_t data) +{ + uint8_t x = m_coprocessor.param[SCREEN_XPOS]; + uint8_t y = m_coprocessor.param[SCREEN_YPOS]; + uint8_t const width = m_coprocessor.param[BLIT_WIDTH]; + uint8_t height = m_coprocessor.param[BLIT_HEIGHT]; + uint8_t attributes = m_coprocessor.param[BLIT_ATTRIBUTES]; + + int xor_blit = data; + /* making the xor behavior selectable fixes score display, + but causes minor glitches on the playfield */ + + x -= width * 8; + int const xoffset = x & 7; + int dy; + + if (attributes & 0x10) + { + y += 7 - height; + dy = 1; + } + else + dy = -1; + + height++; + + while (height--) + { + for (int i = 0; i <= width; i++) + { + int addr = fetch_image_addr(); + + if (addr < 0x2000) + data = m_coprocessor.image_ram[addr]; + else + { + addr -= 0x2000; + if (addr < 0x2000 * 3) + data = m_blitrom[addr]; + } + + int offs = (y * 32 + x / 8 + i) & 0x1fff; + uint8_t old_data = videoram_r(offs); + + if (xor_blit) + videoram_w(offs, old_data ^ (data >> xoffset)); + else + videoram_w(offs, (old_data & (0xff00 >> xoffset)) | (data >> xoffset)); + + offs = (offs + 1) & 0x1fff; + old_data = videoram_r(offs); + + if (xor_blit) + videoram_w(offs, old_data ^ ((data << (8 - xoffset)) & 0xff)); + else + videoram_w(offs, (old_data & (0xff >> xoffset)) | ((data << (8 - xoffset)) & 0xff)); + } + + y += dy; + } +} + +uint8_t thief_state::coprocessor_r(offs_t offset) +{ + switch (offset) + { + case SCREEN_XPOS: + case SCREEN_YPOS: + { + // XLAT: given (x,y) coordinate, return byte address in videoram + int const addr = m_coprocessor.param[SCREEN_XPOS] + 256 * m_coprocessor.param[SCREEN_YPOS]; + int const result = 0xc000 | (addr >> 3); + + return (offset == 0x03) ? (result >> 8) : (result & 0xff); + } + + case GFX_PORT: + { + int addr = fetch_image_addr(); + + if (addr < 0x2000) + return m_coprocessor.image_ram[addr]; + else + { + addr -= 0x2000; + + if (addr < 0x6000) + return m_blitrom[addr]; + } + } + break; + + case BARL_PORT: + { + // return bitmask for addressed pixel + int const dx = m_coprocessor.param[SCREEN_XPOS] & 0x7; + + if (m_coprocessor.param[BLIT_ATTRIBUTES] & 0x01) + return 0x01 << dx; // flipx + else + return 0x80 >> dx; // no flip + } + } + + return m_coprocessor.param[offset]; +} + +void thief_state::coprocessor_w(offs_t offset, uint8_t data) +{ + switch (offset) + { + case GFX_PORT: + { + int const addr = fetch_image_addr(); + + if (addr < 0x2000) + m_coprocessor.image_ram[addr] = data; + } + break; + + default: + m_coprocessor.param[offset] = data; + break; + } +} -WRITE_LINE_MEMBER(thief_state::slam_w) + +// machine + +WRITE_LINE_MEMBER(sharkatt_state::slam_w) { - /* SLAM switch causes an NMI if it's pressed */ + // SLAM switch causes an NMI if it's pressed m_maincpu->set_input_line(INPUT_LINE_NMI, state ? CLEAR_LINE : ASSERT_LINE); } -IRQ_CALLBACK_MEMBER(thief_state::iack) +IRQ_CALLBACK_MEMBER(sharkatt_state::iack) { m_maincpu->set_input_line(0, CLEAR_LINE); return 0xff; @@ -60,49 +475,49 @@ IRQ_CALLBACK_MEMBER(thief_state::iack) enum { - kTalkTrack, kCrashTrack + ktalktrack, kcrashtrack }; -void thief_state::tape_set_audio( int track, int bOn ) +void sharkatt_state::tape_set_audio(int track, int bon) { - m_samples->set_volume(track, bOn ? 1.0 : 0.0 ); + m_samples->set_volume(track, bon ? 1.0 : 0.0); } -void thief_state::tape_set_motor( int bOn ) +void sharkatt_state::tape_set_motor(int bon) { - if( bOn ) + if (bon) { - /* If talk track is not playing, start it. */ - if (! m_samples->playing( kTalkTrack )) - m_samples->start( 0, kTalkTrack, true ); + // If talk track is not playing, start it. + if (!m_samples->playing(ktalktrack)) + m_samples->start(0, ktalktrack, true); - /* Resume playback of talk track. */ - m_samples->pause( kTalkTrack, false); + // Resume playback of talk track. + m_samples->pause(ktalktrack, false); - /* If crash track is not playing, start it. */ - if (! m_samples->playing( kCrashTrack )) - m_samples->start( 1, kCrashTrack, true ); + // If crash track is not playing, start it. + if (!m_samples->playing(kcrashtrack)) + m_samples->start(1, kcrashtrack, true); - /* Resume playback of crash track. */ - m_samples->pause( kCrashTrack, false); + // Resume playback of crash track. + m_samples->pause(kcrashtrack, false); } else { - /* Pause both the talk and crash tracks. */ - m_samples->pause( kTalkTrack, true ); - m_samples->pause( kCrashTrack, true ); + // Pause both the talk and crash tracks. + m_samples->pause(ktalktrack, true); + m_samples->pause(kcrashtrack, true); } } /***********************************************************/ -void thief_state::thief_input_select_w(uint8_t data) +void sharkatt_state::input_select_w(uint8_t data) { m_input_select = data; } -void thief_state::tape_control_w(uint8_t data) +void sharkatt_state::tape_control_w(uint8_t data) { // avoid bogus coin counts after reset if (data == 0x00) @@ -116,75 +531,73 @@ void thief_state::tape_control_w(uint8_t data) machine().bookkeeping().coin_counter_w(0, BIT(data, 1) ? 0 : 1); - tape_set_audio(kTalkTrack, BIT(data, 4) ? 0 : 1); + tape_set_audio(ktalktrack, BIT(data, 4) ? 0 : 1); tape_set_motor(BIT(data, 5) ? 0 : 1); - tape_set_audio(kCrashTrack, BIT(data, 6) ? 0 : 1); + tape_set_audio(kcrashtrack, BIT(data, 6) ? 0 : 1); } -uint8_t thief_state::thief_io_r() +uint8_t sharkatt_state::io_r() { uint8_t data = 0xff; - if (BIT(m_input_select, 0)) data &= ioport("DSW1")->read(); - if (BIT(m_input_select, 1)) data &= ioport("DSW2")->read(); - if (BIT(m_input_select, 2)) data &= ioport("P1")->read(); - if (BIT(m_input_select, 3)) data &= ioport("P2")->read(); + for (int i = 0; i < 4; i++) + if (BIT(m_input_select, i)) + data &= m_ioport[i]->read(); return data; } -void thief_state::sharkatt_main_map(address_map &map) +void sharkatt_state::main_map(address_map &map) { map(0x0000, 0x7fff).rom(); - map(0x8000, 0x8fff).ram(); /* 2114 */ - map(0xc000, 0xdfff).rw(FUNC(thief_state::thief_videoram_r), FUNC(thief_state::thief_videoram_w)); /* 4116 */ + map(0x8000, 0x8fff).ram(); // 2114 + map(0xc000, 0xdfff).rw(FUNC(sharkatt_state::videoram_r), FUNC(sharkatt_state::videoram_w)); // 4116 } -void thief_state::thief_main_map(address_map &map) +void thief_state::main_map(address_map &map) { - map(0x0000, 0x0000).w(FUNC(thief_state::thief_blit_w)); - map(0x0000, 0x7fff).rom(); - map(0x8000, 0x8fff).ram(); /* 2114 */ - map(0xa000, 0xafff).rom(); /* NATO Defense diagnostic ROM */ - map(0xc000, 0xdfff).rw(FUNC(thief_state::thief_videoram_r), FUNC(thief_state::thief_videoram_w)); /* 4116 */ - map(0xe000, 0xe008).rw(FUNC(thief_state::thief_coprocessor_r), FUNC(thief_state::thief_coprocessor_w)); - map(0xe010, 0xe02f).rom(); - map(0xe080, 0xe0bf).rw(FUNC(thief_state::thief_context_ram_r), FUNC(thief_state::thief_context_ram_w)); - map(0xe0c0, 0xe0c0).w(FUNC(thief_state::thief_context_bank_w)); + sharkatt_state::main_map(map); + + map(0x0000, 0x0000).w(FUNC(thief_state::blit_w)); + map(0xa000, 0xafff).rom(); // NATO Defense diagnostic ROM + map(0xe000, 0xe008).rw(FUNC(thief_state::coprocessor_r), FUNC(thief_state::coprocessor_w)); + map(0xe010, 0xe02f).rom().region("copro", 0x290); + map(0xe080, 0xe0bf).rw(FUNC(thief_state::context_ram_r), FUNC(thief_state::context_ram_w)); + map(0xe0c0, 0xe0c0).w(FUNC(thief_state::context_bank_w)); } -void thief_state::io_map(address_map &map) +void sharkatt_state::io_map(address_map &map) { map.global_mask(0xff); - map(0x00, 0x00).nopw(); /* watchdog */ - map(0x10, 0x10).w(FUNC(thief_state::thief_video_control_w)); + map(0x00, 0x00).nopw(); // watchdog + map(0x10, 0x10).w(FUNC(sharkatt_state::video_control_w)); map(0x30, 0x33).mirror(0x0c).rw("ppi", FUNC(i8255_device::read), FUNC(i8255_device::write)); map(0x40, 0x41).w("ay1", FUNC(ay8910_device::address_data_w)); map(0x41, 0x41).r("ay1", FUNC(ay8910_device::data_r)); map(0x42, 0x43).w("ay2", FUNC(ay8910_device::address_data_w)); map(0x43, 0x43).r("ay2", FUNC(ay8910_device::data_r)); - map(0x50, 0x50).w(FUNC(thief_state::thief_color_plane_w)); + map(0x50, 0x50).w(FUNC(sharkatt_state::color_plane_w)); map(0x60, 0x6f).rw(m_tms, FUNC(tms9927_device::read), FUNC(tms9927_device::write)); - map(0x70, 0x7f).w(FUNC(thief_state::thief_color_map_w)); + map(0x70, 0x7f).w(FUNC(sharkatt_state::color_map_w)); } /**********************************************************/ static INPUT_PORTS_START( sharkatt ) - PORT_START("DSW1") /* IN0 */ + PORT_START("DSW1") // IN0 PORT_DIPNAME( 0x7f, 0x7f, DEF_STR( Coinage ) ) PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) ) PORT_DIPSETTING( 0x7f, DEF_STR( 1C_1C ) ) // if any are set PORT_SERVICE( 0x80, IP_ACTIVE_HIGH ) - PORT_START("DSW2") /* IN1 */ + PORT_START("DSW2") // IN1 PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) ) PORT_DIPSETTING( 0x00, "3" ) PORT_DIPSETTING( 0x01, "4" ) PORT_DIPSETTING( 0x02, "5" ) -// PORT_DIPSETTING( 0x03, "5" ) + PORT_DIPSETTING( 0x03, "5" ) PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) PORT_DIPSETTING( 0x00, DEF_STR( No ) ) PORT_DIPSETTING( 0x04, DEF_STR( Yes ) ) @@ -204,7 +617,7 @@ static INPUT_PORTS_START( sharkatt ) PORT_DIPSETTING( 0x00, DEF_STR( No ) ) PORT_DIPSETTING( 0x80, DEF_STR( Yes ) ) - PORT_START("P1") /* IN2 */ + PORT_START("P1") // IN2 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY @@ -214,12 +627,12 @@ static INPUT_PORTS_START( sharkatt ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_START("P2") /* IN3 */ + PORT_START("P2") // IN3 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_TILT ) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, thief_state, slam_w) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_TILT ) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, sharkatt_state, slam_w) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL @@ -369,7 +782,7 @@ static const char *const sharkatt_sample_names[] = "*sharkatt", "talk", "crash", - nullptr /* end of array */ + nullptr // end of array }; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -379,7 +792,7 @@ static const char *const thief_sample_names[] = "*thief", "talk", "crash", - nullptr /* end of array */ + nullptr // end of array }; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -389,29 +802,29 @@ static const char *const natodef_sample_names[] = "*natodef", "talk", "crash", - nullptr /* end of array */ + nullptr // end of array }; -void thief_state::thief(machine_config &config) +void sharkatt_state::sharkatt(machine_config &config) { - Z80(config, m_maincpu, XTAL(8'000'000)/2); - m_maincpu->set_addrmap(AS_PROGRAM, &thief_state::thief_main_map); - m_maincpu->set_addrmap(AS_IO, &thief_state::io_map); - m_maincpu->set_irq_acknowledge_callback(FUNC(thief_state::iack)); + Z80(config, m_maincpu, XTAL(8'000'000) / 2); + m_maincpu->set_addrmap(AS_PROGRAM, &sharkatt_state::main_map); + m_maincpu->set_addrmap(AS_IO, &sharkatt_state::io_map); + m_maincpu->set_irq_acknowledge_callback(FUNC(sharkatt_state::iack)); i8255_device &ppi(I8255A(config, "ppi")); - ppi.out_pa_callback().set(FUNC(thief_state::thief_input_select_w)); - ppi.in_pb_callback().set(FUNC(thief_state::thief_io_r)); - ppi.out_pc_callback().set(FUNC(thief_state::tape_control_w)); + ppi.out_pa_callback().set(FUNC(sharkatt_state::input_select_w)); + ppi.in_pb_callback().set(FUNC(sharkatt_state::io_r)); + ppi.out_pc_callback().set(FUNC(sharkatt_state::tape_control_w)); // video hardware SCREEN(config, m_screen, SCREEN_TYPE_RASTER); - m_screen->set_raw(XTAL(20'000'000)/4, 320, 0, 256, 272, 0, 256); - m_screen->set_screen_update(FUNC(thief_state::screen_update_thief)); + m_screen->set_raw(XTAL(20'000'000) / 4, 320, 0, 256, 272, 0, 192); + m_screen->set_screen_update(FUNC(sharkatt_state::screen_update)); m_screen->set_palette(m_palette); - TMS9927(config, m_tms, XTAL(20'000'000)/4/8); + TMS9927(config, m_tms, XTAL(20'000'000) / 4 / 8); m_tms->set_char_width(8); m_tms->vsyn_callback().set_inputline("maincpu", 0, ASSERT_LINE); @@ -420,29 +833,31 @@ void thief_state::thief(machine_config &config) // sound hardware SPEAKER(config, "mono").front_center(); - AY8910(config, "ay1", XTAL(8'000'000)/2/4).add_route(ALL_OUTPUTS, "mono", 0.50); + AY8910(config, "ay1", XTAL(8'000'000) / 2 / 4).add_route(ALL_OUTPUTS, "mono", 0.50); - AY8910(config, "ay2", XTAL(8'000'000)/2/4).add_route(ALL_OUTPUTS, "mono", 0.50); + AY8910(config, "ay2", XTAL(8'000'000 )/ 2 / 4).add_route(ALL_OUTPUTS, "mono", 0.50); SAMPLES(config, m_samples); m_samples->set_channels(2); - m_samples->set_samples_names(thief_sample_names); + m_samples->set_samples_names(sharkatt_sample_names); m_samples->add_route(ALL_OUTPUTS, "mono", 0.50); } -void thief_state::sharkatt(machine_config &config) +void thief_state::thief(machine_config &config) { - thief(config); - m_maincpu->set_addrmap(AS_PROGRAM, &thief_state::sharkatt_main_map); + sharkatt(config); - m_screen->set_visarea(0*8, 32*8-1, 0*8, 24*8-1); + m_maincpu->set_addrmap(AS_PROGRAM, &thief_state::main_map); - m_samples->set_samples_names(sharkatt_sample_names); + m_screen->set_visarea(0*8, 32*8-1, 0*8, 32*8-1); + + m_samples->set_samples_names(thief_sample_names); } void thief_state::natodef(machine_config &config) { thief(config); + m_samples->set_samples_names(natodef_sample_names); } @@ -467,7 +882,7 @@ ROM_START( sharkatt ) ROM_END ROM_START( thief ) - ROM_REGION( 0x10000, "maincpu", 0 ) /* Z80 code */ + ROM_REGION( 0x10000, "maincpu", 0 ) // Z80 code ROM_LOAD( "t8a0ah0a", 0x0000, 0x1000, CRC(edbbf71c) SHA1(9f13841c54fbe5449280c24954a45517014a834e) ) ROM_LOAD( "t2662h2", 0x1000, 0x1000, CRC(85b4f6ff) SHA1(8e007bfff2f27809e7a9881bc3b2587bf35cff6d) ) ROM_LOAD( "tc162h4", 0x2000, 0x1000, CRC(70478a82) SHA1(547bad88a44c63657bf8f65f2877ab1323515521) ) @@ -475,22 +890,22 @@ ROM_START( thief ) ROM_LOAD( "tc707h8", 0x4000, 0x1000, CRC(ea8dd847) SHA1(eab24621abe3735902f03463ee536a0cbfeb7407) ) ROM_LOAD( "t857bh10", 0x5000, 0x1000, CRC(403c33b7) SHA1(d1422e74c9ecdadbc238b155f853294f6bb83992) ) ROM_LOAD( "t606bh12", 0x6000, 0x1000, CRC(4ca2748b) SHA1(07df2fac63471d716923f859105421e22e5e970e) ) - ROM_LOAD( "tae4bh14", 0x7000, 0x1000, CRC(22e7dcc3) SHA1(fd4302688905bbd47dfdc1d7cdb55212a5e99f81) ) /* diagnostics ROM */ + ROM_LOAD( "tae4bh14", 0x7000, 0x1000, CRC(22e7dcc3) SHA1(fd4302688905bbd47dfdc1d7cdb55212a5e99f81) ) // diagnostics ROM - ROM_REGION( 0x400, "cpu1", 0 ) /* coprocessor */ + ROM_REGION( 0x400, "copro", 0 ) // coprocessor ROM_LOAD( "b8", 0x000, 0x0200, CRC(fe865b2a) SHA1(b29144b05cb2846ea9c868ebf843d74d94c7bcc6) ) - /* B8 is a function dispatch table for the coprocessor (unused) */ + // B8 is a function dispatch table for the coprocessor (unused) ROM_LOAD( "c8", 0x200, 0x0200, CRC(7ed5c923) SHA1(35757d50bfa9ea3cf916576a148064a0f9be8732) ) - /* C8 is mapped (banked) in CPU1's address space; it contains Z80 code */ + // C8 is mapped (banked) in the coprocessor's address space; it contains Z80 code - ROM_REGION( 0x6000, "gfx1", 0 ) /* image ROMs for coprocessor */ + ROM_REGION( 0x6000, "blitter", 0 ) // image ROMs for coprocessor ROM_LOAD16_BYTE( "t079ahd4" , 0x0001, 0x1000, CRC(928bd8ef) SHA1(3a2de005176ef012c0411d7752a69c03fb165b28) ) ROM_LOAD16_BYTE( "tdda7hh4" , 0x0000, 0x1000, CRC(b48f0862) SHA1(c62ccf407e819fe7fa94a4353a17da47b91f0606) ) - /* next 0x4000 bytes are unmapped (used by Nato Defense) */ + // next 0x4000 bytes are unmapped (used by Nato Defense) ROM_END ROM_START( natodef ) - ROM_REGION( 0x10000, "maincpu", 0 ) /* Z80 code */ + ROM_REGION( 0x10000, "maincpu", 0 ) // Z80 code ROM_LOAD( "natodef.cp0", 0x0000, 0x1000, CRC(8397c787) SHA1(5957613f1ace7dc4612f28f6fba3a7374be905ac) ) ROM_LOAD( "natodef.cp2", 0x1000, 0x1000, CRC(8cfbf26f) SHA1(a15f0d5d82cd96b80ee91dc91858b660c5895f34) ) ROM_LOAD( "natodef.cp4", 0x2000, 0x1000, CRC(b4c90fb2) SHA1(3ff4691415433863bfe74d51b9f3aa428f3bf88f) ) @@ -499,14 +914,14 @@ ROM_START( natodef ) ROM_LOAD( "natodef.cpa", 0x5000, 0x1000, CRC(888ecd42) SHA1(5af638d7e299046d5803d2764bf42ea44a80374c) ) ROM_LOAD( "natodef.cpc", 0x6000, 0x1000, CRC(cf713bc9) SHA1(0687755a6cfd76a920c210bf11530ef4c59d92b0) ) ROM_LOAD( "natodef.cpe", 0x7000, 0x1000, CRC(4eef6bf4) SHA1(ab094198ea4d2267194ace5d382abb78d568983a) ) - ROM_LOAD( "natodef.cp5", 0xa000, 0x1000, CRC(65c3601b) SHA1(c7bf31e6cb781405b3665b3aa93644ed57616256) ) /* diagnostics ROM */ + ROM_LOAD( "natodef.cp5", 0xa000, 0x1000, CRC(65c3601b) SHA1(c7bf31e6cb781405b3665b3aa93644ed57616256) ) // diagnostics ROM - ROM_REGION( 0x400, "cpu1", 0 ) /* coprocessor */ + ROM_REGION( 0x400, "copro", 0 ) // coprocessor ROM_LOAD( "b8", 0x000, 0x0200, CRC(fe865b2a) SHA1(b29144b05cb2846ea9c868ebf843d74d94c7bcc6) ) ROM_LOAD( "c8", 0x200, 0x0200, CRC(7ed5c923) SHA1(35757d50bfa9ea3cf916576a148064a0f9be8732) ) - /* C8 is mapped (banked) in CPU1's address space; it contains Z80 code */ + // C8 is mapped (banked) in the coprocessor's address space; it contains Z80 code - ROM_REGION( 0x6000, "gfx1", 0 ) /* image ROMs for coprocessor */ + ROM_REGION( 0x6000, "blitter", 0 ) // image ROMs for coprocessor ROM_LOAD16_BYTE( "natodef.o4", 0x0001, 0x1000, CRC(39a868f8) SHA1(870795f18cd8f831b714b809a380e30b5d323a5f) ) ROM_LOAD16_BYTE( "natodef.e1", 0x0000, 0x1000, CRC(b6d1623d) SHA1(0aa15db0e1459a6cc7d2a5bc8e588fd514b71d85) ) ROM_LOAD16_BYTE( "natodef.o2", 0x2001, 0x1000, CRC(77cc9cfd) SHA1(1bbed3cb834b844fb2d9d48a3a142edaeb33ccc6) ) @@ -516,7 +931,7 @@ ROM_START( natodef ) ROM_END ROM_START( natodefa ) - ROM_REGION( 0x10000, "maincpu", 0 ) /* Z80 code */ + ROM_REGION( 0x10000, "maincpu", 0 ) // Z80 code ROM_LOAD( "natodef.cp0", 0x0000, 0x1000, CRC(8397c787) SHA1(5957613f1ace7dc4612f28f6fba3a7374be905ac) ) ROM_LOAD( "natodef.cp2", 0x1000, 0x1000, CRC(8cfbf26f) SHA1(a15f0d5d82cd96b80ee91dc91858b660c5895f34) ) ROM_LOAD( "natodef.cp4", 0x2000, 0x1000, CRC(b4c90fb2) SHA1(3ff4691415433863bfe74d51b9f3aa428f3bf88f) ) @@ -525,34 +940,26 @@ ROM_START( natodefa ) ROM_LOAD( "natodef.cpa", 0x5000, 0x1000, CRC(888ecd42) SHA1(5af638d7e299046d5803d2764bf42ea44a80374c) ) ROM_LOAD( "natodef.cpc", 0x6000, 0x1000, CRC(cf713bc9) SHA1(0687755a6cfd76a920c210bf11530ef4c59d92b0) ) ROM_LOAD( "natodef.cpe", 0x7000, 0x1000, CRC(4eef6bf4) SHA1(ab094198ea4d2267194ace5d382abb78d568983a) ) - ROM_LOAD( "natodef.cp5", 0xa000, 0x1000, CRC(65c3601b) SHA1(c7bf31e6cb781405b3665b3aa93644ed57616256) ) /* diagnostics ROM */ + ROM_LOAD( "natodef.cp5", 0xa000, 0x1000, CRC(65c3601b) SHA1(c7bf31e6cb781405b3665b3aa93644ed57616256) ) // diagnostics ROM - ROM_REGION( 0x400, "cpu1", 0 ) /* coprocessor */ + ROM_REGION( 0x400, "copro", 0 ) // coprocessor ROM_LOAD( "b8", 0x000, 0x0200, CRC(fe865b2a) SHA1(b29144b05cb2846ea9c868ebf843d74d94c7bcc6) ) ROM_LOAD( "c8", 0x200, 0x0200, CRC(7ed5c923) SHA1(35757d50bfa9ea3cf916576a148064a0f9be8732) ) - /* C8 is mapped (banked) in CPU1's address space; it contains Z80 code */ + // C8 is mapped (banked) in the coprocessor's address space; it contains Z80 code - ROM_REGION( 0x6000, "gfx1", 0 ) /* image ROMs for coprocessor */ + ROM_REGION( 0x6000, "blitter", 0 ) // image ROMs for coprocessor ROM_LOAD16_BYTE( "natodef.o4", 0x0001, 0x1000, CRC(39a868f8) SHA1(870795f18cd8f831b714b809a380e30b5d323a5f) ) ROM_LOAD16_BYTE( "natodef.e1", 0x0000, 0x1000, CRC(b6d1623d) SHA1(0aa15db0e1459a6cc7d2a5bc8e588fd514b71d85) ) - ROM_LOAD16_BYTE( "natodef.o3", 0x2001, 0x1000, CRC(b217909a) SHA1(a26eb5bf2c92d79a75376deb6278710426b34cc5) ) /* same ROMs as natodef, */ - ROM_LOAD16_BYTE( "natodef.e2", 0x2000, 0x1000, CRC(886c3f05) SHA1(306c8621455d2d6b7b2f545500b27e56a7159a1b) ) /* but in a different */ - ROM_LOAD16_BYTE( "natodef.o2", 0x4001, 0x1000, CRC(77cc9cfd) SHA1(1bbed3cb834b844fb2d9d48a3a142edaeb33ccc6) ) /* order to give */ - ROM_LOAD16_BYTE( "natodef.e3", 0x4000, 0x1000, CRC(5302410d) SHA1(e166c151d948f474c134802e3f891982bf370596) ) /* different mazes */ + ROM_LOAD16_BYTE( "natodef.o3", 0x2001, 0x1000, CRC(b217909a) SHA1(a26eb5bf2c92d79a75376deb6278710426b34cc5) ) // same ROMs as natodef, + ROM_LOAD16_BYTE( "natodef.e2", 0x2000, 0x1000, CRC(886c3f05) SHA1(306c8621455d2d6b7b2f545500b27e56a7159a1b) ) // but in a different + ROM_LOAD16_BYTE( "natodef.o2", 0x4001, 0x1000, CRC(77cc9cfd) SHA1(1bbed3cb834b844fb2d9d48a3a142edaeb33ccc6) ) // order to give + ROM_LOAD16_BYTE( "natodef.e3", 0x4000, 0x1000, CRC(5302410d) SHA1(e166c151d948f474c134802e3f891982bf370596) ) // different mazes ROM_END - -void thief_state::init_thief() -{ - uint8_t *dest = memregion("maincpu")->base(); - const uint8_t *source = memregion("cpu1")->base(); - - /* C8 is mapped (banked) in CPU1's address space; it contains Z80 code */ - memcpy(&dest[0xe010], &source[0x290], 0x20); -} +} // anonymous namespace -GAME( 1980, sharkatt, 0, sharkatt, sharkatt, thief_state, empty_init, ROT0, "Pacific Novelty", "Shark Attack", 0 ) -GAME( 1981, thief, 0, thief, thief, thief_state, init_thief, ROT0, "Pacific Novelty", "Thief", 0 ) -GAME( 1982, natodef, 0, natodef, natodef, thief_state, init_thief, ROT0, "Pacific Novelty", "NATO Defense" , 0 ) -GAME( 1982, natodefa, natodef, natodef, natodef, thief_state, init_thief, ROT0, "Pacific Novelty", "NATO Defense (alternate mazes)" , 0 ) +GAME( 1980, sharkatt, 0, sharkatt, sharkatt, sharkatt_state, empty_init, ROT0, "Pacific Novelty", "Shark Attack", MACHINE_SUPPORTS_SAVE ) +GAME( 1981, thief, 0, thief, thief, thief_state, empty_init, ROT0, "Pacific Novelty", "Thief", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, natodef, 0, natodef, natodef, thief_state, empty_init, ROT0, "Pacific Novelty", "NATO Defense" , MACHINE_SUPPORTS_SAVE ) +GAME( 1982, natodefa, natodef, natodef, natodef, thief_state, empty_init, ROT0, "Pacific Novelty", "NATO Defense (alternate mazes)" , MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/pacific/thief.h b/src/mame/pacific/thief.h deleted file mode 100644 index 7ebb072753d..00000000000 --- a/src/mame/pacific/thief.h +++ /dev/null @@ -1,71 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Victor Trucco, Mike Balfour, Phil Stroffolino -#include "sound/samples.h" -#include "video/tms9927.h" -#include "emupal.h" -#include "screen.h" - -struct coprocessor_t { - std::unique_ptr context_ram; - uint8_t bank; - std::unique_ptr image_ram; - uint8_t param[0x9]; -}; - -class thief_state : public driver_device -{ -public: - thief_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , - m_maincpu(*this, "maincpu"), - m_samples(*this, "samples"), - m_tms(*this, "tms"), - m_screen(*this, "screen"), - m_palette(*this, "palette") { } - - void natodef(machine_config &config); - void sharkatt(machine_config &config); - void thief(machine_config &config); - - void init_thief(); - - DECLARE_WRITE_LINE_MEMBER(slam_w); - -private: - std::unique_ptr m_videoram; - uint8_t m_input_select = 0; - uint8_t m_read_mask = 0; - uint8_t m_write_mask = 0; - uint8_t m_video_control = 0; - coprocessor_t m_coprocessor; - void thief_input_select_w(uint8_t data); - uint8_t thief_io_r(); - uint8_t thief_context_ram_r(offs_t offset); - void thief_context_ram_w(offs_t offset, uint8_t data); - void thief_context_bank_w(uint8_t data); - void thief_video_control_w(uint8_t data); - void thief_color_map_w(offs_t offset, uint8_t data); - void thief_color_plane_w(uint8_t data); - uint8_t thief_videoram_r(offs_t offset); - void thief_videoram_w(offs_t offset, uint8_t data); - void thief_blit_w(uint8_t data); - uint8_t thief_coprocessor_r(offs_t offset); - void thief_coprocessor_w(offs_t offset, uint8_t data); - void tape_control_w(uint8_t data); - virtual void video_start() override; - uint32_t screen_update_thief(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - IRQ_CALLBACK_MEMBER(iack); - uint16_t fetch_image_addr( coprocessor_t &thief_coprocessor ); - void tape_set_audio( int track, int bOn ); - void tape_set_motor( int bOn ); - required_device m_maincpu; - required_device m_samples; - required_device m_tms; - required_device m_screen; - required_device m_palette; - - void io_map(address_map &map); - void sharkatt_main_map(address_map &map); - void thief_main_map(address_map &map); -}; diff --git a/src/mame/pacific/thief_v.cpp b/src/mame/pacific/thief_v.cpp deleted file mode 100644 index 3f4bb9784d4..00000000000 --- a/src/mame/pacific/thief_v.cpp +++ /dev/null @@ -1,277 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Victor Trucco, Mike Balfour, Phil Stroffolino -/* video hardware for Pacific Novelty games: -** Thief/Nato Defense -*/ - -#include "emu.h" -#include "thief.h" - - -enum { - IMAGE_ADDR_LO, //0xe000 - IMAGE_ADDR_HI, //0xe001 - SCREEN_XPOS, //0xe002 - SCREEN_YPOS, //0xe003 - BLIT_WIDTH, //0xe004 - BLIT_HEIGHT, //0xe005 - GFX_PORT, //0xe006 - BARL_PORT, //0xe007 - BLIT_ATTRIBUTES //0xe008 -}; - -/***************************************************************************/ - -uint8_t thief_state::thief_context_ram_r(offs_t offset){ - return m_coprocessor.context_ram[0x40*m_coprocessor.bank+offset]; -} - -void thief_state::thief_context_ram_w(offs_t offset, uint8_t data){ - m_coprocessor.context_ram[0x40*m_coprocessor.bank+offset] = data; -} - -void thief_state::thief_context_bank_w(uint8_t data){ - m_coprocessor.bank = data&0xf; -} - -/***************************************************************************/ - -void thief_state::thief_video_control_w(uint8_t data){ - m_video_control = data; -/* - bit 0: screen flip - bit 1: working page - bit 2: visible page - bit 3: mirrors bit 1 - bit 4: mirrors bit 2 -*/ -} - -void thief_state::thief_color_map_w(offs_t offset, uint8_t data){ -/* - --xx---- blue - ----xx-- green - ------xx red -*/ - static const uint8_t intensity[4] = {0x00,0x55,0xAA,0xFF}; - int r = intensity[(data & 0x03) >> 0]; - int g = intensity[(data & 0x0C) >> 2]; - int b = intensity[(data & 0x30) >> 4]; - m_palette->set_pen_color( offset,rgb_t(r,g,b) ); -} - -/***************************************************************************/ - -void thief_state::thief_color_plane_w(uint8_t data){ -/* - --xx---- selects bitplane to read from (0..3) - ----xxxx selects bitplane(s) to write to (0x0 = none, 0xf = all) -*/ - m_write_mask = data&0xf; - m_read_mask = (data>>4)&3; -} - -uint8_t thief_state::thief_videoram_r(offs_t offset){ - uint8_t *videoram = m_videoram.get(); - uint8_t *source = &videoram[offset]; - if( m_video_control&0x02 ) source+=0x2000*4; /* foreground/background */ - return source[m_read_mask*0x2000]; -} - -void thief_state::thief_videoram_w(offs_t offset, uint8_t data){ - uint8_t *videoram = m_videoram.get(); - uint8_t *dest = &videoram[offset]; - if( m_video_control&0x02 ) - dest+=0x2000*4; /* foreground/background */ - if( m_write_mask&0x1 ) dest[0x2000*0] = data; - if( m_write_mask&0x2 ) dest[0x2000*1] = data; - if( m_write_mask&0x4 ) dest[0x2000*2] = data; - if( m_write_mask&0x8 ) dest[0x2000*3] = data; -} - -/***************************************************************************/ - -void thief_state::video_start(){ - memset( &m_coprocessor, 0x00, sizeof(m_coprocessor) ); - - m_videoram = make_unique_clear(0x2000*4*2 ); - - m_coprocessor.image_ram = std::make_unique(0x2000 ); - m_coprocessor.context_ram = std::make_unique(0x400 ); -} - -uint32_t thief_state::screen_update_thief(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ - int flipscreen = m_video_control&1; - const uint8_t *source = m_videoram.get(); - - if (m_tms->screen_reset()) - { - bitmap.fill(m_palette->black_pen(), cliprect); - return 0; - } - - if( m_video_control&4 ) /* visible page */ - source += 0x2000*4; - - for( uint32_t offs=0; offs<0x2000; offs++ ){ - int ypos = offs/32; - int xpos = (offs%32)*8; - int plane0 = source[0x2000*0+offs]; - int plane1 = source[0x2000*1+offs]; - int plane2 = source[0x2000*2+offs]; - int plane3 = source[0x2000*3+offs]; - if( flipscreen ){ - for( int bit=0; bit<8; bit++ ){ - bitmap.pix(0xff - ypos, 0xff - (xpos+bit)) = - (((plane0<>7) | - (((plane1<>6) | - (((plane2<>5) | - (((plane3<>4); - } - } - else { - for( int bit=0; bit<8; bit++ ){ - bitmap.pix(ypos, xpos+bit) = - (((plane0<>7) | - (((plane1<>6) | - (((plane2<>5) | - (((plane3<>4); - } - } - } - return 0; -} - -/***************************************************************************/ - -uint16_t thief_state::fetch_image_addr( coprocessor_t &thief_coprocessor ) -{ - int addr = thief_coprocessor.param[IMAGE_ADDR_LO]+256*thief_coprocessor.param[IMAGE_ADDR_HI]; - /* auto-increment */ - thief_coprocessor.param[IMAGE_ADDR_LO]++; - if( thief_coprocessor.param[IMAGE_ADDR_LO]==0x00 ){ - thief_coprocessor.param[IMAGE_ADDR_HI]++; - } - return addr; -} - -void thief_state::thief_blit_w(uint8_t data){ - coprocessor_t &thief_coprocessor = m_coprocessor; - int i, offs, xoffset, dy; - uint8_t *gfx_rom = memregion( "gfx1" )->base(); - uint8_t x = thief_coprocessor.param[SCREEN_XPOS]; - uint8_t y = thief_coprocessor.param[SCREEN_YPOS]; - uint8_t width = thief_coprocessor.param[BLIT_WIDTH]; - uint8_t height = thief_coprocessor.param[BLIT_HEIGHT]; - uint8_t attributes = thief_coprocessor.param[BLIT_ATTRIBUTES]; - - uint8_t old_data; - int xor_blit = data; - /* making the xor behavior selectable fixes score display, - but causes minor glitches on the playfield */ - - x -= width*8; - xoffset = x&7; - - if( attributes&0x10 ){ - y += 7-height; - dy = 1; - } - else { - dy = -1; - } - height++; - while( height-- ){ - for( i=0; i<=width; i++ ){ - int addr = fetch_image_addr(thief_coprocessor); - if( addr<0x2000 ){ - data = thief_coprocessor.image_ram[addr]; - } - else { - addr -= 0x2000; - if( addr<0x2000*3 ) data = gfx_rom[addr]; - } - offs = (y*32+x/8+i)&0x1fff; - old_data = thief_videoram_r(offs); - if( xor_blit ){ - thief_videoram_w(offs, old_data^(data>>xoffset)); - } - else { - thief_videoram_w(offs, - (old_data&(0xff00>>xoffset)) | (data>>xoffset) - ); - } - offs = (offs+1)&0x1fff; - old_data = thief_videoram_r(offs); - if( xor_blit ){ - thief_videoram_w(offs, old_data^((data<<(8-xoffset))&0xff)); - } - else { - thief_videoram_w(offs, - (old_data&(0xff>>xoffset)) | ((data<<(8-xoffset))&0xff) - ); - } - } - y+=dy; - } -} - -uint8_t thief_state::thief_coprocessor_r(offs_t offset){ - coprocessor_t &thief_coprocessor = m_coprocessor; - switch( offset ){ - case SCREEN_XPOS: /* xpos */ - case SCREEN_YPOS: /* ypos */ - { - /* XLAT: given (x,y) coordinate, return byte address in videoram */ - int addr = thief_coprocessor.param[SCREEN_XPOS]+256*thief_coprocessor.param[SCREEN_YPOS]; - int result = 0xc000 | (addr>>3); - return (offset==0x03)?(result>>8):(result&0xff); - } - - case GFX_PORT: - { - int addr = fetch_image_addr(thief_coprocessor); - if( addr<0x2000 ){ - return thief_coprocessor.image_ram[addr]; - } - else { - uint8_t *gfx_rom = memregion( "gfx1" )->base(); - addr -= 0x2000; - if( addr<0x6000 ) return gfx_rom[addr]; - } - } - break; - - case BARL_PORT: - { - /* return bitmask for addressed pixel */ - int dx = thief_coprocessor.param[SCREEN_XPOS]&0x7; - if( thief_coprocessor.param[BLIT_ATTRIBUTES]&0x01 ){ - return 0x01<>dx; // no flip - } - } - } - - return thief_coprocessor.param[offset]; -} - -void thief_state::thief_coprocessor_w(offs_t offset, uint8_t data){ - coprocessor_t &thief_coprocessor = m_coprocessor; - switch( offset ){ - case GFX_PORT: - { - int addr = fetch_image_addr(thief_coprocessor); - if( addr<0x2000 ){ - thief_coprocessor.image_ram[addr] = data; - } - } - break; - - default: - thief_coprocessor.param[offset] = data; - break; - } -} -- cgit v1.2.3