From 3f3275dcf39acb804c81458394cb110ff4e49680 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Mon, 17 Jun 2024 22:32:59 +0200 Subject: New working clones ------------------ Little Casino (set 2) [Siftware] Little Casino II (v18.1, set 2) [Siftware] New clones marked not working ----------------------------- Secret Service (4.0, Europe) [inkochnito, PinMAME] - irem/m52.cpp: consolidated driver in single file --- src/mame/irem/m52.cpp | 714 +++++++++++++++++++++++++++++++++++++++------ src/mame/irem/m52.h | 106 ------- src/mame/irem/m52_v.cpp | 477 ------------------------------ src/mame/mame.lst | 7 +- src/mame/misc/ltcasino.cpp | 157 ++++++---- src/mame/pinball/de_2.cpp | 33 ++- 6 files changed, 758 insertions(+), 736 deletions(-) delete mode 100644 src/mame/irem/m52.h delete mode 100644 src/mame/irem/m52_v.cpp diff --git a/src/mame/irem/m52.cpp b/src/mame/irem/m52.cpp index 7b37a496edd..33a7db88572 100644 --- a/src/mame/irem/m52.cpp +++ b/src/mame/irem/m52.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:Nicola Salmoria +// copyright-holders: Nicola Salmoria + /*************************************************************************** Irem M52 hardware @@ -40,17 +41,571 @@ ***************************************************************************** - Locations based on m58.c driver + Locations based on m58.cpp driver ***************************************************************************/ #include "emu.h" -#include "cpu/z80/z80.h" + #include "irem.h" #include "iremipt.h" -#include "m52.h" -#define MASTER_CLOCK XTAL(18'432'000) +#include "cpu/z80/z80.h" +#include "video/resnet.h" + +#include "emupal.h" +#include "screen.h" +#include "tilemap.h" + + +namespace { + +class m52_state : public driver_device +{ +public: + m52_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_screen(*this, "screen"), + m_videoram(*this, "videoram"), + m_colorram(*this, "colorram"), + m_spriteram(*this, "spriteram"), + m_sp_gfxdecode(*this, "sp_gfxdecode"), + m_tx_gfxdecode(*this, "tx_gfxdecode"), + m_bg_gfxdecode(*this, "bg_gfxdecode"), + m_sp_palette(*this, "sp_palette"), + m_tx_palette(*this, "tx_palette"), + m_bg_palette(*this, "bg_palette"), + m_dsw2(*this, "DSW2") + { } + + void m52(machine_config &config); + +protected: + virtual void machine_reset() override; + virtual void video_start() override; + virtual void scroll_w(uint8_t data); + + // board mod changes? + int m_spritelimit = 0; + bool m_do_bg_fills = false; + + tilemap_t *m_tx_tilemap = nullptr; + + required_device m_maincpu; + required_device m_screen; + + required_shared_ptr m_videoram; + required_shared_ptr m_colorram; + required_shared_ptr m_spriteram; + + void videoram_w(offs_t offset, uint8_t data); + void colorram_w(offs_t offset, uint8_t data); + uint8_t protection_r(); + +private: + required_device m_sp_gfxdecode; + required_device m_tx_gfxdecode; + required_device m_bg_gfxdecode; + required_device m_sp_palette; + required_device m_tx_palette; + required_device m_bg_palette; + + required_ioport m_dsw2; + + // video-related + uint8_t m_bgxpos[2]{}; + uint8_t m_bgypos[2]{}; + uint8_t m_bgcontrol = 0U; + + template void bgypos_w(uint8_t data); + template void bgxpos_w(uint8_t data); + void bgcontrol_w(uint8_t data); + void flipscreen_w(uint8_t data); + TILE_GET_INFO_MEMBER(get_tile_info); + void init_palette(); + template + void init_sprite_palette(const int *resistances_3, const int *resistances_2, double (&weights_r)[N], double (&weights_g)[O], double (&weights_b)[P], double scale); + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect, int xpos, int ypos, int image); + void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int initoffs); + + void main_map(address_map &map); + void main_portmap(address_map &map); +}; + +class alpha1v_state : public m52_state +{ +public: + alpha1v_state(const machine_config &mconfig, device_type type, const char *tag) + : m52_state(mconfig, type, tag) + { } + + void alpha1v(machine_config &config); + + void main_map(address_map &map); + +protected: + virtual void video_start() override; + virtual void scroll_w(uint8_t data) override; + +private: + void flipscreen_w(uint8_t data); + +}; + + +/************************************* + * + * Palette configuration + * + *************************************/ + +void m52_state::init_palette() +{ + constexpr int resistances_3[3] = { 1000, 470, 220 }; + constexpr int resistances_2[2] = { 470, 220 }; + double weights_r[3], weights_g[3], weights_b[3], scale; + + // compute palette information for characters/backgrounds + scale = compute_resistor_weights(0, 255, -1.0, + 3, resistances_3, weights_r, 0, 0, + 3, resistances_3, weights_g, 0, 0, + 2, resistances_2, weights_b, 0, 0); + + // character palette + const uint8_t *char_pal = memregion("tx_pal")->base(); + for (int i = 0; i < 512; i++) + { + uint8_t const promval = char_pal[i]; + int const r = combine_weights(weights_r, BIT(promval, 0), BIT(promval, 1), BIT(promval, 2)); + int const g = combine_weights(weights_g, BIT(promval, 3), BIT(promval, 4), BIT(promval, 5)); + int const b = combine_weights(weights_b, BIT(promval, 6), BIT(promval, 7)); + + m_tx_palette->set_pen_color(i, rgb_t(r, g, b)); + } + + // background palette + const uint8_t *back_pal = memregion("bg_pal")->base(); + for (int i = 0; i < 32; i++) + { + uint8_t promval = back_pal[i]; + int r = combine_weights(weights_r, BIT(promval, 0), BIT(promval, 1), BIT(promval, 2)); + int g = combine_weights(weights_g, BIT(promval, 3), BIT(promval, 4), BIT(promval, 5)); + int b = combine_weights(weights_b, BIT(promval, 6), BIT(promval, 7)); + + m_bg_palette->set_indirect_color(i, rgb_t(r, g, b)); + } + + /* background + the palette is a 32x8 PROM with many colors repeated. The address of + the colors to pick is as follows: + xbb00: mountains + 0xxbb: hills + 1xxbb: city + + this seems hacky, surely all bytes in the PROM should be used, not just picking the ones that give the colours we want? + + */ + m_bg_palette->set_pen_indirect(0 * 4 + 0, 0); + m_bg_palette->set_pen_indirect(0 * 4 + 1, 4); + m_bg_palette->set_pen_indirect(0 * 4 + 2, 8); + m_bg_palette->set_pen_indirect(0 * 4 + 3, 12); + m_bg_palette->set_pen_indirect(1 * 4 + 0, 0); + m_bg_palette->set_pen_indirect(1 * 4 + 1, 1); + m_bg_palette->set_pen_indirect(1 * 4 + 2, 2); + m_bg_palette->set_pen_indirect(1 * 4 + 3, 3); + m_bg_palette->set_pen_indirect(2 * 4 + 0, 0); + m_bg_palette->set_pen_indirect(2 * 4 + 1, 16 + 1); + m_bg_palette->set_pen_indirect(2 * 4 + 2, 16 + 2); + m_bg_palette->set_pen_indirect(2 * 4 + 3, 16 + 3); + + init_sprite_palette(resistances_3, resistances_2, weights_r, weights_g, weights_b, scale); +} + +template +void m52_state::init_sprite_palette(const int *resistances_3, const int *resistances_2, double (&weights_r)[N], double (&weights_g)[O], double (&weights_b)[P], double scale) +{ + const uint8_t *sprite_pal = memregion("spr_pal")->base(); + const uint8_t *sprite_table = memregion("spr_clut")->base(); + + // compute palette information for sprites + compute_resistor_weights(0, 255, scale, + 2, resistances_2, weights_r, 470, 0, + 3, resistances_3, weights_g, 470, 0, + 3, resistances_3, weights_b, 470, 0); + + // sprite palette + for (int i = 0; i < 32; i++) + { + uint8_t const promval = sprite_pal[i]; + int const r = combine_weights(weights_r, BIT(promval, 6), BIT(promval, 7)); + int const g = combine_weights(weights_g, BIT(promval, 3), BIT(promval, 4), BIT(promval, 5)); + int const b = combine_weights(weights_b, BIT(promval, 0), BIT(promval, 1), BIT(promval, 2)); + + m_sp_palette->set_indirect_color(i, rgb_t(r, g, b)); + } + + // sprite lookup table + for (int i = 0; i < 256; i++) + { + uint8_t promval = sprite_table[i]; + m_sp_palette->set_pen_indirect(i, promval); + } +} + + +/************************************* + * + * Tilemap info callback + * + *************************************/ + +TILE_GET_INFO_MEMBER(m52_state::get_tile_info) +{ + uint8_t video = m_videoram[tile_index]; + uint8_t const color = m_colorram[tile_index]; + + int flag = 0; + int code = 0; + + code = video; + + if (color & 0x80) + { + code |= 0x100; + } + + if (tile_index / 32 <= 6) + { + flag |= TILE_FORCE_LAYER0; // lines 0 to 6 are opaqe? + } + + tileinfo.set(0, code, color & 0x7f, flag); +} + + + +/************************************* + * + * Video startup + * + *************************************/ + +void m52_state::video_start() +{ + m_tx_tilemap = &machine().tilemap().create(*m_tx_gfxdecode, tilemap_get_info_delegate(*this, FUNC(m52_state::get_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + + m_tx_tilemap->set_transparent_pen(0); + m_tx_tilemap->set_scrolldx(127, 127); + m_tx_tilemap->set_scrolldy(16, 16); + m_tx_tilemap->set_scroll_rows(4); // only lines 192-256 scroll + + init_palette(); + + save_item(NAME(m_bgxpos)); + save_item(NAME(m_bgypos)); + save_item(NAME(m_bgcontrol)); + + m_spritelimit = 0x100 - 4; + m_do_bg_fills = true; +} + +void alpha1v_state::video_start() +{ + m52_state::video_start(); + + // is the limit really just higher anyway or is this a board mod? + m_spritelimit = 0x200 - 4; + m_do_bg_fills = false; // or you get solid green areas below the stars bg image. does the doubled up tilemap ROM maybe mean double height instead? + + // the scrolling orange powerups 'orbs' are a single tile in the tilemap, your ship is huge, it is unclear where the hitboxes are meant to be + // using the same value as mpatrol puts the collision at the very back of your ship + // maybe the sprite positioning is incorrect instead or this is just how the game is designed + //m_tx_tilemap->set_scrolldx(127 + 8, 127 - 8); +} + + + +/************************************* + * + * Scroll registers + * + *************************************/ + +void m52_state::scroll_w(uint8_t data) +{ +/* + According to the schematics there is only one video register that holds the X scroll value + with a NAND gate on the V64 and V128 lines to control when it's read, and when + 255 (via 8 pull up resistors) is used. + + So we set the first 3 quarters to 255 and the last to the scroll value +*/ + m_tx_tilemap->set_scrollx(0, 255); + m_tx_tilemap->set_scrollx(1, 255); + m_tx_tilemap->set_scrollx(2, 255); + m_tx_tilemap->set_scrollx(3, -(data + 1)); +} + +void alpha1v_state::scroll_w(uint8_t data) +{ +/* + alpha1v must have some board mod to invert scroll register use, as it expects only the first block to remain static + the scrolling powerups are part of the tx layer! + + TODO: check if this configuration works with Moon Patrol, maybe the schematics were read incorrectly? +*/ + m_tx_tilemap->set_scrollx(0, 255); + m_tx_tilemap->set_scrollx(1, -(data + 1)); + m_tx_tilemap->set_scrollx(2, -(data + 1)); + m_tx_tilemap->set_scrollx(3, -(data + 1)); +} + + +/************************************* + * + * Video RAM write handlers + * + *************************************/ + +void m52_state::videoram_w(offs_t offset, uint8_t data) +{ + m_videoram[offset] = data; + m_tx_tilemap->mark_tile_dirty(offset); +} + + +void m52_state::colorram_w(offs_t offset, uint8_t data) +{ + m_colorram[offset] = data; + m_tx_tilemap->mark_tile_dirty(offset); +} + + + +/************************************* + * + * Custom protection + * + *************************************/ + +/* This looks like some kind of protection implemented by a custom chip on the + scroll board. It mangles the value written to the port bg1xpos_w, as + follows: result = popcount(value & 0x7f) ^ (value >> 7) */ +uint8_t m52_state::protection_r() +{ + int popcount = 0; + + for (int temp = m_bgxpos[0] & 0x7f; temp != 0; temp >>= 1) + popcount += temp & 1; + return popcount ^ (m_bgxpos[0] >> 7); +} + + + +/************************************* + * + * Background control write handlers + * + *************************************/ + +template +void m52_state::bgypos_w(uint8_t data) +{ + m_bgypos[Which] = data; +} + +template +void m52_state::bgxpos_w(uint8_t data) +{ + m_bgxpos[Which] = data; +} + +void m52_state::bgcontrol_w(uint8_t data) +{ + m_bgcontrol = data; +} + + + +/************************************* + * + * Outputs + * + *************************************/ + +void m52_state::flipscreen_w(uint8_t data) +{ + // screen flip is handled both by software and hardware + flip_screen_set((data & 0x01) ^ (~m_dsw2->read() & 0x01)); + + machine().bookkeeping().coin_counter_w(0, data & 0x02); + machine().bookkeeping().coin_counter_w(1, data & 0x20); +} + +void alpha1v_state::flipscreen_w(uint8_t data) +{ + flip_screen_set(data & 0x01); +} + + + +/************************************* + * + * Background rendering + * + *************************************/ + +void m52_state::draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect, int xpos, int ypos, int image) +{ + rectangle rect; + const rectangle &visarea = m_screen->visible_area(); + const pen_t *paldata = m_bg_palette->pens(); + constexpr uint8_t BGHEIGHT = 128; + + + if (flip_screen()) + { + xpos = 264 - xpos; + ypos = 264 - ypos - BGHEIGHT; + } + + xpos += 124; + + // this may not be correct + ypos += 16; + + + m_bg_gfxdecode->gfx(image)->transpen(bitmap, cliprect, + 0, 0, + flip_screen(), + flip_screen(), + xpos, + ypos, 0); + + + m_bg_gfxdecode->gfx(image)->transpen(bitmap, cliprect, + 0, 0, + flip_screen(), + flip_screen(), + xpos - 256, + ypos, 0); + + // create a solid fill below the 64 pixel high bg images + if (m_do_bg_fills) + { + rect.min_x = visarea.min_x; + rect.max_x = visarea.max_x; + + if (flip_screen()) + { + rect.min_y = ypos - BGHEIGHT; + rect.max_y = ypos - 1; + } + else + { + rect.min_y = ypos + BGHEIGHT; + rect.max_y = ypos + 2 * BGHEIGHT - 1; + } + + bitmap.fill(paldata[m_bg_gfxdecode->gfx(image)->colorbase() + 3], rect); + } +} + + + +/************************************* + * + * Sprites rendering + * + *************************************/ + +void m52_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int initoffs) +{ + // draw the sprites + for (int offs = initoffs; offs >= (initoffs & 0xc0); offs -= 4) + { + int sy = 257 - m_spriteram[offs]; + int const color = m_spriteram[offs + 1] & 0x3f; + int flipx = m_spriteram[offs + 1] & 0x40; + int flipy = m_spriteram[offs + 1] & 0x80; + int const code = m_spriteram[offs + 2]; + int sx = m_spriteram[offs + 3]; + + // sprites from offsets $00-$7F are processed in the upper half of the frame + // sprites from offsets $80-$FF are processed in the lower half of the frame + rectangle clip = cliprect; + if (!(offs & 0x80)) + clip.min_y = 0, clip.max_y = 127; + else + clip.min_y = 128, clip.max_y = 255; + + // adjust for flipping + if (flip_screen()) + { + int temp = clip.min_y; + clip.min_y = 255 - clip.max_y; + clip.max_y = 255 - temp; + flipx = !flipx; + flipy = !flipy; + sx = 238 - sx; + sy = 282 - sy; + } + + sx += 129; + + // in theory anyways; in practice, some of the molecule-looking guys get clipped +#ifdef SPLIT_SPRITES + sect_rect(&clip, cliprect); +#else + clip = cliprect; +#endif + + m_sp_gfxdecode->gfx(0)->transmask(bitmap, clip, + code, color, flipx, flipy, sx, sy, + m_sp_palette->transpen_mask(*m_sp_gfxdecode->gfx(0), color, 0)); + } +} + + + +/************************************* + * + * Video render + * + *************************************/ + +uint32_t m52_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + const pen_t *paldata = m_sp_palette->pens(); + + bitmap.fill(paldata[0], cliprect); + + if (!(m_bgcontrol & 0x20)) + { + if (!(m_bgcontrol & 0x10)) + draw_background(bitmap, cliprect, m_bgxpos[1], m_bgypos[1], 0); // distant mountains + + // only one of these be drawn at once (they share the same scroll register) (alpha1v leaves everything enabled) + if (!(m_bgcontrol & 0x02)) + draw_background(bitmap, cliprect, m_bgxpos[0], m_bgypos[0], 1); // hills + else if (!(m_bgcontrol & 0x04)) + draw_background(bitmap, cliprect, m_bgxpos[0], m_bgypos[0], 2); // cityscape + } + + m_tx_tilemap->set_flip(flip_screen() ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0); + + m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0); + + // draw the sprites + for (int offs = 0x3c; offs <= m_spritelimit; offs += 0x40) + draw_sprites(bitmap, cliprect, offs); + + return 0; +} + + /************************************* * @@ -61,12 +616,12 @@ void m52_state::main_map(address_map &map) { map(0x0000, 0x3fff).rom(); - map(0x8000, 0x83ff).ram().w(FUNC(m52_state::m52_videoram_w)).share("videoram"); - map(0x8400, 0x87ff).ram().w(FUNC(m52_state::m52_colorram_w)).share("colorram"); - map(0x8800, 0x8800).mirror(0x07ff).r(FUNC(m52_state::m52_protection_r)); - map(0xc800, 0xcbff).mirror(0x0400).writeonly().share("spriteram"); // only 0x100 of this used by video code? + map(0x8000, 0x83ff).ram().w(FUNC(m52_state::videoram_w)).share(m_videoram); + map(0x8400, 0x87ff).ram().w(FUNC(m52_state::colorram_w)).share(m_colorram); + map(0x8800, 0x8800).mirror(0x07ff).r(FUNC(m52_state::protection_r)); + map(0xc800, 0xcbff).mirror(0x0400).writeonly().share(m_spriteram); // only 0x100 of this used by video code? map(0xd000, 0xd000).mirror(0x07fc).w("irem_audio", FUNC(irem_audio_device::cmd_w)); - map(0xd001, 0xd001).mirror(0x07fc).w(FUNC(m52_state::m52_flipscreen_w)); /* + coin counters */ + map(0xd001, 0xd001).mirror(0x07fc).w(FUNC(m52_state::flipscreen_w)); // + coin counters map(0xd000, 0xd000).mirror(0x07f8).portr("IN0"); map(0xd001, 0xd001).mirror(0x07f8).portr("IN1"); map(0xd002, 0xd002).mirror(0x07f8).portr("IN2"); @@ -76,15 +631,15 @@ void m52_state::main_map(address_map &map) } -void m52_alpha1v_state::alpha1v_map(address_map &map) +void alpha1v_state::main_map(address_map &map) { map(0x0000, 0x6fff).rom(); - map(0x8000, 0x83ff).ram().w(FUNC(m52_state::m52_videoram_w)).share("videoram"); - map(0x8400, 0x87ff).ram().w(FUNC(m52_state::m52_colorram_w)).share("colorram"); - map(0x8800, 0x8800).mirror(0x07ff).r(FUNC(m52_state::m52_protection_r)); // result is ignored - map(0xc800, 0xc9ff).writeonly().share("spriteram"); + map(0x8000, 0x83ff).ram().w(FUNC(alpha1v_state::videoram_w)).share(m_videoram); + map(0x8400, 0x87ff).ram().w(FUNC(alpha1v_state::colorram_w)).share(m_colorram); + map(0x8800, 0x8800).mirror(0x07ff).r(FUNC(alpha1v_state::protection_r)); // result is ignored + map(0xc800, 0xc9ff).writeonly().share(m_spriteram); map(0xd000, 0xd000).portr("IN0").w("irem_audio", FUNC(irem_audio_device::cmd_w)); - map(0xd001, 0xd001).portr("IN1").w(FUNC(m52_alpha1v_state::alpha1v_flipscreen_w)); + map(0xd001, 0xd001).portr("IN1").w(FUNC(alpha1v_state::flipscreen_w)); map(0xd002, 0xd002).portr("IN2"); map(0xd003, 0xd003).portr("DSW1"); map(0xd004, 0xd004).portr("DSW2"); @@ -95,12 +650,12 @@ void m52_alpha1v_state::alpha1v_map(address_map &map) void m52_state::main_portmap(address_map &map) { map.global_mask(0xff); - map(0x00, 0x00).mirror(0x1f).w(FUNC(m52_state::m52_scroll_w)); - map(0x40, 0x40).mirror(0x1f).w(FUNC(m52_state::m52_bg1xpos_w)); - map(0x60, 0x60).mirror(0x1f).w(FUNC(m52_state::m52_bg1ypos_w)); - map(0x80, 0x80).mirror(0x1f).w(FUNC(m52_state::m52_bg2xpos_w)); - map(0xa0, 0xa0).mirror(0x1f).w(FUNC(m52_state::m52_bg2ypos_w)); - map(0xc0, 0xc0).mirror(0x1f).w(FUNC(m52_state::m52_bgcontrol_w)); + map(0x00, 0x00).mirror(0x1f).w(FUNC(m52_state::scroll_w)); + map(0x40, 0x40).mirror(0x1f).w(FUNC(m52_state::bgxpos_w<0>)); + map(0x60, 0x60).mirror(0x1f).w(FUNC(m52_state::bgypos_w<0>)); + map(0x80, 0x80).mirror(0x1f).w(FUNC(m52_state::bgxpos_w<1>)); + map(0xa0, 0xa0).mirror(0x1f).w(FUNC(m52_state::bgypos_w<1>)); + map(0xc0, 0xc0).mirror(0x1f).w(FUNC(m52_state::bgcontrol_w)); } @@ -110,14 +665,14 @@ void m52_state::main_portmap(address_map &map) * *************************************/ -/* Same as m57, m58 and m62 (IREM Z80 hardware) */ +// Same as m57, m58 and m62 (IREM Z80 hardware) static INPUT_PORTS_START( m52 ) PORT_START("IN0") /* Start 1 & 2 also restarts and freezes the game with stop mode on - and are used in test mode to enter and esc the various tests */ + and are used in test mode to enter and exit the various tests */ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) - /* coin input must be active for 19 frames to be consistently recognized */ + // coin input must be active for 19 frames to be consistently recognized PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_IMPULSE(19) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) @@ -142,7 +697,7 @@ static INPUT_PORTS_START( m52 ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL - /* DSW1 is so different from game to game that it isn't included here */ + // DSW1 is so different from game to game that it isn't included here PORT_START("DSW2") PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:1") @@ -170,18 +725,18 @@ static INPUT_PORTS_START( mpatrol ) PORT_MODIFY("IN1") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) /* IPT_JOYSTICK_DOWN */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) /* IPT_JOYSTICK_UP */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) // IPT_JOYSTICK_DOWN + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) // IPT_JOYSTICK_UP PORT_MODIFY("IN2") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) /* IPT_JOYSTICK_DOWN PORT_COCKTAIL */ - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) /* IPT_JOYSTICK_UP PORT_COCKTAIL */ + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) // IPT_JOYSTICK_DOWN PORT_COCKTAIL + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) // IPT_JOYSTICK_UP PORT_COCKTAIL PORT_MODIFY("DSW2") - PORT_DIPUNUSED_DIPLOC( 0x08, IP_ACTIVE_LOW, "SW2:4" ) /* should have been "slow motion" but no conditional jump at 0x00c3 */ - /* In stop mode, press 2 to stop and 1 to restart */ + PORT_DIPUNUSED_DIPLOC( 0x08, IP_ACTIVE_LOW, "SW2:4" ) // should have been "slow motion" but no conditional jump at 0x00c3 + // In stop mode, press 2 to stop and 1 to restart PORT_DIPNAME( 0x10, 0x10, "Stop Mode (Cheat)") PORT_DIPLOCATION("SW2:5") PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) @@ -262,7 +817,7 @@ static INPUT_PORTS_START( alpha1v ) PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW ) PORT_START("DSW2") - PORT_DIPNAME( 0x0f, 0x00, DEF_STR( Coin_A ) ) /* table at 0x5ef4 - 16 bytes (coins) + 16 bytes (credits) */ + PORT_DIPNAME( 0x0f, 0x00, DEF_STR( Coin_A ) ) // table at 0x5ef4 - 16 bytes (coins) + 16 bytes (credits) PORT_DIPSETTING( 0x0b, DEF_STR( 4C_1C ) ) PORT_DIPSETTING( 0x0c, DEF_STR( 3C_1C ) ) // PORT_DIPSETTING( 0x08, DEF_STR( 2C_1C ) ) @@ -279,7 +834,7 @@ static INPUT_PORTS_START( alpha1v ) // PORT_DIPSETTING( 0x02, DEF_STR( 1C_1C ) ) // PORT_DIPSETTING( 0x01, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) - PORT_DIPNAME( 0xf0, 0x00, DEF_STR( Coin_B ) ) /* table at 0x5f14 - 16 bytes (coins) + 16 bytes (credits) */ + PORT_DIPNAME( 0xf0, 0x00, DEF_STR( Coin_B ) ) // table at 0x5f14 - 16 bytes (coins) + 16 bytes (credits) // PORT_DIPSETTING( 0xf0, "1 Coin/0 Credit" ) // PORT_DIPSETTING( 0x70, DEF_STR( 1C_1C ) ) // PORT_DIPSETTING( 0x60, DEF_STR( 1C_1C ) ) @@ -305,17 +860,6 @@ INPUT_PORTS_END * *************************************/ -static const gfx_layout charlayout = -{ - 8,8, - RGN_FRAC(1,2), - 2, - { RGN_FRAC(0,2), RGN_FRAC(1,2) }, - { STEP8(0,1) }, - { STEP8(0,8) }, - 8 * 8 -}; - static const gfx_layout spritelayout = { 16,16, @@ -354,10 +898,10 @@ static const uint32_t bgcharlayout_yoffset[128] = static const gfx_layout bgcharlayout = { - 256, 128, /* 256x64 image format */ - 1, /* 1 image */ - 2, /* 2 bits per pixel */ - { 4, 0 }, /* the two bitplanes for 4 pixels are packed into one byte */ + 256, 128, // 256x64 image format + 1, // 1 image + 2, // 2 bits per pixel + { 4, 0 }, // the two bitplanes for 4 pixels are packed into one byte EXTENDED_XOFFS, EXTENDED_YOFFS, 0x8000, @@ -371,7 +915,7 @@ static GFXDECODE_START(gfx_m52_sp) GFXDECODE_END static GFXDECODE_START(gfx_m52_tx) - GFXDECODE_ENTRY("tx", 0x0000, charlayout, 0, 128) + GFXDECODE_ENTRY("tx", 0x0000, gfx_8x8x2_planar, 0, 128) GFXDECODE_END static GFXDECODE_START(gfx_m52_bg) @@ -391,22 +935,22 @@ GFXDECODE_END void m52_state::machine_reset() { - m_bg1xpos = 0; - m_bg1ypos = 0; - m_bg2xpos = 0; - m_bg2ypos = 0; + m_bgxpos[0] = 0; + m_bgypos[0] = 0; + m_bgxpos[1] = 0; + m_bgypos[1] = 0; m_bgcontrol = 0; } void m52_state::m52(machine_config &config) { - /* basic machine hardware */ - Z80(config, m_maincpu, MASTER_CLOCK / 6); + // basic machine hardware + Z80(config, m_maincpu, 18.432_MHz_XTAL / 6); m_maincpu->set_addrmap(AS_PROGRAM, &m52_state::main_map); m_maincpu->set_addrmap(AS_IO, &m52_state::main_portmap); m_maincpu->set_vblank_int("screen", FUNC(m52_state::irq0_line_hold)); - /* video hardware */ + // video hardware PALETTE(config, m_sp_palette).set_entries(256, 32); GFXDECODE(config, m_sp_gfxdecode, m_sp_palette, gfx_m52_sp); @@ -417,21 +961,21 @@ void m52_state::m52(machine_config &config) GFXDECODE(config, m_bg_gfxdecode, m_bg_palette, gfx_m52_bg); SCREEN(config, m_screen, SCREEN_TYPE_RASTER); - m_screen->set_raw(MASTER_CLOCK / 3, 384, 136, 376, 282, 22, 274); - m_screen->set_screen_update(FUNC(m52_state::screen_update_m52)); + m_screen->set_raw(18.432_MHz_XTAL / 3, 384, 136, 376, 282, 22, 274); + m_screen->set_screen_update(FUNC(m52_state::screen_update)); - /* sound hardware */ + // sound hardware IREM_M52_SOUNDC_AUDIO(config, "irem_audio", 0); } -void m52_alpha1v_state::alpha1v(machine_config &config) +void alpha1v_state::alpha1v(machine_config &config) { m52(config); - /* basic machine hardware */ - m_maincpu->set_addrmap(AS_PROGRAM, &m52_alpha1v_state::alpha1v_map); - m_screen->set_raw(MASTER_CLOCK / 3, 384, 136, 376, 282, 16, 272); + // basic machine hardware + m_maincpu->set_addrmap(AS_PROGRAM, &alpha1v_state::main_map); + m_screen->set_raw(18.432_MHz_XTAL / 3, 384, 136, 376, 282, 16, 272); } @@ -453,15 +997,15 @@ ROM_START(mpatrol) ROM_LOAD("mp-s1.1a", 0x7000, 0x1000, CRC(561d3108) SHA1(4998c68a9e9a8002251fa8f07aa1082444a9dc80)) ROM_REGION(0x2000, "tx", 0) - ROM_LOAD("mpe-5.3e", 0x0000, 0x1000, CRC(e3ee7f75) SHA1(b03d0d56150d3e9da4a4c871338097b4f450b649)) - ROM_LOAD("mpe-4.3f", 0x1000, 0x1000, CRC(cca6d023) SHA1(fecb3059fb09897a096add9452b50aec55c07545)) + ROM_LOAD("mpe-4.3f", 0x0000, 0x1000, CRC(cca6d023) SHA1(fecb3059fb09897a096add9452b50aec55c07545)) + ROM_LOAD("mpe-5.3e", 0x1000, 0x1000, CRC(e3ee7f75) SHA1(b03d0d56150d3e9da4a4c871338097b4f450b649)) - /* 0x2000-0x2fff is intentionally left as 0x00 fill, unused bitplane */ + // 0x2000-0x2fff is intentionally left as 0x00 fill, unused bitplane ROM_REGION(0x3000, "sp", ROMREGION_ERASE00) ROM_LOAD("mpb-2.3m", 0x0000, 0x1000, CRC(707ace5e) SHA1(93c682e13e74bce29ced3a87bffb29569c114c3b)) ROM_LOAD("mpb-1.3n", 0x1000, 0x1000, CRC(9b72133a) SHA1(1393ef92ae1ad58a4b62ca1660c0793d30a8b5e2)) - /* 0x1000-01fff is intentionally left as 0xff fill for the bg regions */ + // 0x1000-01fff is intentionally left as 0xff fill for the bg regions ROM_REGION(0x2000, "bg0", ROMREGION_ERASEFF) ROM_LOAD("mpe-1.3l", 0x0000, 0x1000, CRC(c46a7f72) SHA1(8bb7c9acaf6833fb6c0575b015991b873a305a84)) @@ -498,15 +1042,15 @@ ROM_START(mpatrolw) ROM_LOAD("mp-s1.1a", 0x7000, 0x1000, CRC(561d3108) SHA1(4998c68a9e9a8002251fa8f07aa1082444a9dc80)) ROM_REGION(0x2000, "tx", 0) - ROM_LOAD("mpe-5w.3e", 0x0000, 0x1000, CRC(f56e01fe) SHA1(93f582d63b9cd5c6dca207aa57b213c939cdda1d)) - ROM_LOAD("mpe-4w.3f", 0x1000, 0x1000, CRC(caaba2d9) SHA1(7016a26c2d01e3209749598e993cd8ce91f12c88)) + ROM_LOAD("mpe-4w.3f", 0x0000, 0x1000, CRC(caaba2d9) SHA1(7016a26c2d01e3209749598e993cd8ce91f12c88)) + ROM_LOAD("mpe-5w.3e", 0x1000, 0x1000, CRC(f56e01fe) SHA1(93f582d63b9cd5c6dca207aa57b213c939cdda1d)) - /* 0x2000-0x2fff is intentionally left as 0x00 fill, unused bitplane */ + // 0x2000-0x2fff is intentionally left as 0x00 fill, unused bitplane ROM_REGION(0x3000, "sp", ROMREGION_ERASE00) ROM_LOAD("mpb-2.3m", 0x0000, 0x1000, CRC(707ace5e) SHA1(93c682e13e74bce29ced3a87bffb29569c114c3b)) ROM_LOAD("mpb-1.3n", 0x1000, 0x1000, CRC(9b72133a) SHA1(1393ef92ae1ad58a4b62ca1660c0793d30a8b5e2)) - /* 0x1000-01fff is intentionally left as 0xff fill for the bg regions */ + // 0x1000-01fff is intentionally left as 0xff fill for the bg regions ROM_REGION(0x2000, "bg0", ROMREGION_ERASEFF) ROM_LOAD("mpe-1.3l", 0x0000, 0x1000, CRC(c46a7f72) SHA1(8bb7c9acaf6833fb6c0575b015991b873a305a84)) @@ -543,15 +1087,15 @@ ROM_START(mranger) ROM_LOAD("mp-s1.1a", 0x7000, 0x1000, CRC(561d3108) SHA1(4998c68a9e9a8002251fa8f07aa1082444a9dc80)) ROM_REGION(0x2000, "tx", 0) - ROM_LOAD("mpe-5.3e", 0x0000, 0x1000, CRC(e3ee7f75) SHA1(b03d0d56150d3e9da4a4c871338097b4f450b649)) - ROM_LOAD("mpe-4.3f", 0x1000, 0x1000, CRC(cca6d023) SHA1(fecb3059fb09897a096add9452b50aec55c07545)) + ROM_LOAD("mpe-4.3f", 0x0000, 0x1000, CRC(cca6d023) SHA1(fecb3059fb09897a096add9452b50aec55c07545)) + ROM_LOAD("mpe-5.3e", 0x1000, 0x1000, CRC(e3ee7f75) SHA1(b03d0d56150d3e9da4a4c871338097b4f450b649)) - /* 0x2000-0x2fff is intentionally left as 0x00 fill, unused bitplane */ + // 0x2000-0x2fff is intentionally left as 0x00 fill, unused bitplane ROM_REGION(0x3000, "sp", ROMREGION_ERASE00) ROM_LOAD("mpb-2.3m", 0x0000, 0x1000, CRC(707ace5e) SHA1(93c682e13e74bce29ced3a87bffb29569c114c3b)) ROM_LOAD("mpb-1.3n", 0x1000, 0x1000, CRC(9b72133a) SHA1(1393ef92ae1ad58a4b62ca1660c0793d30a8b5e2)) - /* 0x1000-01fff is intentionally left as 0xff fill for the bg regions */ + // 0x1000-01fff is intentionally left as 0xff fill for the bg regions ROM_REGION(0x2000, "bg0", ROMREGION_ERASEFF) ROM_LOAD("mpe-1.3l", 0x0000, 0x1000, CRC(c46a7f72) SHA1(8bb7c9acaf6833fb6c0575b015991b873a305a84)) @@ -589,17 +1133,17 @@ ROM_START(alpha1v) ROM_LOAD("1-a1", 0x7000, 0x1000, CRC(9e07fdd5) SHA1(ed4f462fcfe91fa8e88bfeaaba0a0c11fa0b4601)) ROM_REGION(0x2000, "tx", 0) - ROM_LOAD("14-e3", 0x0000, 0x1000, CRC(cf00c737) SHA1(415e90289039cac4d04cb1d559f1378ca6a32132)) - ROM_LOAD("13-f3", 0x1000, 0x1000, CRC(4b799229) SHA1(42cbdcf787b08b041d30504d699a12c378224933)) + ROM_LOAD("13-f3", 0x0000, 0x1000, CRC(4b799229) SHA1(42cbdcf787b08b041d30504d699a12c378224933)) + ROM_LOAD("14-e3", 0x1000, 0x1000, CRC(cf00c737) SHA1(415e90289039cac4d04cb1d559f1378ca6a32132)) ROM_REGION(0x3000, "sp", 0) // 3bpp (mpatrol is 2bpp) ROM_LOAD("15-n3", 0x0000, 0x1000, CRC(dc26df76) SHA1(dd1cff7935f5559f9d1b440e02d5e5aa521b0054)) ROM_LOAD("16-l3", 0x1000, 0x1000, CRC(39b9863b) SHA1(da9da9a1066188f050c422dfed1bbbd3ba612ccc)) ROM_LOAD("17-k3", 0x2000, 0x1000, CRC(cfd90773) SHA1(052e126888b6de636db9c521a090699c282b620b)) - /* all the background roms just contain stars, looks like it wants 2x128 px high images, instead of 3x64, arrangement unclear */ + // all the background ROMs just contain stars, looks like it wants 2x128 px high images, instead of 3x64, arrangement unclear ROM_REGION(0x2000, "bg0", ROMREGION_ERASEFF) - ROM_LOAD("11-k3", 0x0000, 0x1000, CRC(7659440a) SHA1(2efd27c82913513dd03e799f1ed3c10b0863677d)) // rom is duplicated + ROM_LOAD("11-k3", 0x0000, 0x1000, CRC(7659440a) SHA1(2efd27c82913513dd03e799f1ed3c10b0863677d)) // ROM is duplicated ROM_LOAD("12-jh3", 0x1000, 0x1000, CRC(7659440a) SHA1(2efd27c82913513dd03e799f1ed3c10b0863677d)) ROM_REGION(0x2000, "bg1", ROMREGION_ERASEFF) @@ -622,6 +1166,8 @@ ROM_START(alpha1v) ROM_LOAD("mb7052-h2", 0x0000, 0x0100, CRC(ce9f0ef9) SHA1(3afb94ed033f272983bbed22a59856df7824ef8a)) ROM_END +} // anonymous namespace + /************************************* * @@ -629,8 +1175,8 @@ ROM_END * *************************************/ -GAME(1982, mpatrol, 0, m52, mpatrol, m52_state, empty_init, ROT0, "Irem", "Moon Patrol", MACHINE_SUPPORTS_SAVE) -GAME(1982, mpatrolw, mpatrol, m52, mpatrolw, m52_state, empty_init, ROT0, "Irem (Williams license)", "Moon Patrol (Williams)", MACHINE_SUPPORTS_SAVE) // USA -GAME(1982, mranger, mpatrol, m52, mpatrol, m52_state, empty_init, ROT0, "bootleg", "Moon Ranger (bootleg of Moon Patrol)", MACHINE_SUPPORTS_SAVE) // Italy +GAME(1982, mpatrol, 0, m52, mpatrol, m52_state, empty_init, ROT0, "Irem", "Moon Patrol", MACHINE_SUPPORTS_SAVE) +GAME(1982, mpatrolw, mpatrol, m52, mpatrolw, m52_state, empty_init, ROT0, "Irem (Williams license)", "Moon Patrol (Williams)", MACHINE_SUPPORTS_SAVE) // USA +GAME(1982, mranger, mpatrol, m52, mpatrol, m52_state, empty_init, ROT0, "bootleg", "Moon Ranger (bootleg of Moon Patrol)", MACHINE_SUPPORTS_SAVE) // Italy -GAME(1988, alpha1v, 0, alpha1v, alpha1v, m52_alpha1v_state, empty_init, ROT0, "Vision Electronics", "Alpha One (Vision Electronics)", MACHINE_SUPPORTS_SAVE) +GAME(1988, alpha1v, 0, alpha1v, alpha1v, alpha1v_state, empty_init, ROT0, "Vision Electronics", "Alpha One (Vision Electronics)", MACHINE_SUPPORTS_SAVE) diff --git a/src/mame/irem/m52.h b/src/mame/irem/m52.h deleted file mode 100644 index cab7da9b2a1..00000000000 --- a/src/mame/irem/m52.h +++ /dev/null @@ -1,106 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria -#ifndef MAME_IREM_M52_H -#define MAME_IREM_M52_H - -#pragma once - -#include "emupal.h" -#include "screen.h" -#include "tilemap.h" - -class m52_state : public driver_device -{ -public: - m52_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_screen(*this, "screen"), - m_videoram(*this, "videoram"), - m_colorram(*this, "colorram"), - m_spriteram(*this, "spriteram"), - m_sp_gfxdecode(*this, "sp_gfxdecode"), - m_tx_gfxdecode(*this, "tx_gfxdecode"), - m_bg_gfxdecode(*this, "bg_gfxdecode"), - m_sp_palette(*this, "sp_palette"), - m_tx_palette(*this, "tx_palette"), - m_bg_palette(*this, "bg_palette") - { } - - void m52(machine_config &config); - - void m52_videoram_w(offs_t offset, uint8_t data); - void m52_colorram_w(offs_t offset, uint8_t data); - uint8_t m52_protection_r(); - -protected: - virtual void machine_reset() override; - virtual void video_start() override; - virtual void m52_scroll_w(uint8_t data); - - /* board mod changes? */ - int m_spritelimit = 0; - bool m_do_bg_fills = false; - - tilemap_t* m_tx_tilemap = nullptr; - - required_device m_maincpu; - required_device m_screen; - -private: - /* memory pointers */ - required_shared_ptr m_videoram; - required_shared_ptr m_colorram; - optional_shared_ptr m_spriteram; - - /* video-related */ - uint8_t m_bg1xpos = 0U; - uint8_t m_bg1ypos = 0U; - uint8_t m_bg2xpos = 0U; - uint8_t m_bg2ypos = 0U; - uint8_t m_bgcontrol = 0U; - - required_device m_sp_gfxdecode; - required_device m_tx_gfxdecode; - required_device m_bg_gfxdecode; - required_device m_sp_palette; - required_device m_tx_palette; - required_device m_bg_palette; - - void m52_bg1ypos_w(uint8_t data); - void m52_bg1xpos_w(uint8_t data); - void m52_bg2xpos_w(uint8_t data); - void m52_bg2ypos_w(uint8_t data); - void m52_bgcontrol_w(uint8_t data); - void m52_flipscreen_w(uint8_t data); - TILE_GET_INFO_MEMBER(get_tile_info); - void init_palette(); - template - void init_sprite_palette(const int *resistances_3, const int *resistances_2, double (&weights_r)[N], double (&weights_g)[O], double (&weights_b)[P], double scale); - uint32_t screen_update_m52(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - void draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect, int xpos, int ypos, int image); - void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int initoffs); - - void main_map(address_map &map); - void main_portmap(address_map &map); -}; - -class m52_alpha1v_state : public m52_state -{ -public: - m52_alpha1v_state(const machine_config &mconfig, device_type type, const char *tag) - : m52_state(mconfig, type, tag) - { } - - void alpha1v(machine_config &config); - - void alpha1v_map(address_map &map); - -protected: - virtual void video_start() override; - virtual void m52_scroll_w(uint8_t data) override; - void alpha1v_flipscreen_w(uint8_t data); - -}; - -#endif // MAME_IREM_M52_H diff --git a/src/mame/irem/m52_v.cpp b/src/mame/irem/m52_v.cpp deleted file mode 100644 index ecc1599a339..00000000000 --- a/src/mame/irem/m52_v.cpp +++ /dev/null @@ -1,477 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Nicola Salmoria -/*************************************************************************** - - Irem M52 hardware - -***************************************************************************/ - -#include "emu.h" -#include "video/resnet.h" -#include "m52.h" - -#define BGHEIGHT 128 - - -/************************************* - * - * Palette configuration - * - *************************************/ - -void m52_state::init_palette() -{ - constexpr int resistances_3[3] = { 1000, 470, 220 }; - constexpr int resistances_2[2] = { 470, 220 }; - double weights_r[3], weights_g[3], weights_b[3], scale; - - /* compute palette information for characters/backgrounds */ - scale = compute_resistor_weights(0, 255, -1.0, - 3, resistances_3, weights_r, 0, 0, - 3, resistances_3, weights_g, 0, 0, - 2, resistances_2, weights_b, 0, 0); - - /* character palette */ - const uint8_t *char_pal = memregion("tx_pal")->base(); - for (int i = 0; i < 512; i++) - { - uint8_t const promval = char_pal[i]; - int const r = combine_weights(weights_r, BIT(promval, 0), BIT(promval, 1), BIT(promval, 2)); - int const g = combine_weights(weights_g, BIT(promval, 3), BIT(promval, 4), BIT(promval, 5)); - int const b = combine_weights(weights_b, BIT(promval, 6), BIT(promval, 7)); - - m_tx_palette->set_pen_color(i, rgb_t(r, g, b)); - } - - /* background palette */ - const uint8_t *back_pal = memregion("bg_pal")->base(); - for (int i = 0; i < 32; i++) - { - uint8_t promval = back_pal[i]; - int r = combine_weights(weights_r, BIT(promval, 0), BIT(promval, 1), BIT(promval, 2)); - int g = combine_weights(weights_g, BIT(promval, 3), BIT(promval, 4), BIT(promval, 5)); - int b = combine_weights(weights_b, BIT(promval, 6), BIT(promval, 7)); - - m_bg_palette->set_indirect_color(i, rgb_t(r, g, b)); - } - - /* background - the palette is a 32x8 PROM with many colors repeated. The address of - the colors to pick is as follows: - xbb00: mountains - 0xxbb: hills - 1xxbb: city - - this seems hacky, surely all bytes in the PROM should be used, not just picking the ones that give the colours we want? - - */ - m_bg_palette->set_pen_indirect(0 * 4 + 0, 0); - m_bg_palette->set_pen_indirect(0 * 4 + 1, 4); - m_bg_palette->set_pen_indirect(0 * 4 + 2, 8); - m_bg_palette->set_pen_indirect(0 * 4 + 3, 12); - m_bg_palette->set_pen_indirect(1 * 4 + 0, 0); - m_bg_palette->set_pen_indirect(1 * 4 + 1, 1); - m_bg_palette->set_pen_indirect(1 * 4 + 2, 2); - m_bg_palette->set_pen_indirect(1 * 4 + 3, 3); - m_bg_palette->set_pen_indirect(2 * 4 + 0, 0); - m_bg_palette->set_pen_indirect(2 * 4 + 1, 16 + 1); - m_bg_palette->set_pen_indirect(2 * 4 + 2, 16 + 2); - m_bg_palette->set_pen_indirect(2 * 4 + 3, 16 + 3); - - init_sprite_palette(resistances_3, resistances_2, weights_r, weights_g, weights_b, scale); -} - -template -void m52_state::init_sprite_palette(const int *resistances_3, const int *resistances_2, double (&weights_r)[N], double (&weights_g)[O], double (&weights_b)[P], double scale) -{ - const uint8_t *sprite_pal = memregion("spr_pal")->base(); - const uint8_t *sprite_table = memregion("spr_clut")->base(); - - /* compute palette information for sprites */ - compute_resistor_weights(0, 255, scale, - 2, resistances_2, weights_r, 470, 0, - 3, resistances_3, weights_g, 470, 0, - 3, resistances_3, weights_b, 470, 0); - - /* sprite palette */ - for (int i = 0; i < 32; i++) - { - uint8_t const promval = sprite_pal[i]; - int const r = combine_weights(weights_r, BIT(promval, 6), BIT(promval, 7)); - int const g = combine_weights(weights_g, BIT(promval, 3), BIT(promval, 4), BIT(promval, 5)); - int const b = combine_weights(weights_b, BIT(promval, 0), BIT(promval, 1), BIT(promval, 2)); - - m_sp_palette->set_indirect_color(i, rgb_t(r, g, b)); - } - - /* sprite lookup table */ - for (int i = 0; i < 256; i++) - { - uint8_t promval = sprite_table[i]; - m_sp_palette->set_pen_indirect(i, promval); - } -} - - -/************************************* - * - * Tilemap info callback - * - *************************************/ - -TILE_GET_INFO_MEMBER(m52_state::get_tile_info) -{ - uint8_t video = m_videoram[tile_index]; - uint8_t color = m_colorram[tile_index]; - - int flag = 0; - int code = 0; - - code = video; - - if (color & 0x80) - { - code |= 0x100; - } - - if (tile_index / 32 <= 6) - { - flag |= TILE_FORCE_LAYER0; /* lines 0 to 6 are opaqe? */ - } - - tileinfo.set(0, code, color & 0x7f, flag); -} - - - -/************************************* - * - * Video startup - * - *************************************/ - -void m52_state::video_start() -{ - m_tx_tilemap = &machine().tilemap().create(*m_tx_gfxdecode, tilemap_get_info_delegate(*this, FUNC(m52_state::get_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - - m_tx_tilemap->set_transparent_pen(0); - m_tx_tilemap->set_scrolldx(127, 127); - m_tx_tilemap->set_scrolldy(16, 16); - m_tx_tilemap->set_scroll_rows(4); /* only lines 192-256 scroll */ - - init_palette(); - - save_item(NAME(m_bg1xpos)); - save_item(NAME(m_bg1ypos)); - save_item(NAME(m_bg2xpos)); - save_item(NAME(m_bg2ypos)); - save_item(NAME(m_bgcontrol)); - - m_spritelimit = 0x100-4; - m_do_bg_fills = true; -} - -void m52_alpha1v_state::video_start() -{ - m52_state::video_start(); - - // is the limit really just higher anyway or is this a board mod? - m_spritelimit = 0x200-4; - m_do_bg_fills = false; // or you get solid green areas below the stars bg image. does the doubled up tilemap ROM maybe mean double height instead? - - // the scrolling orange powerups 'orbs' are a single tile in the tilemap, your ship is huge, it is unclear where the hitboxes are meant to be - // using the same value as mpatrol puts the collision at the very back of your ship - // maybe the sprite positioning is incorrect instead or this is just how the game is designed - //m_tx_tilemap->set_scrolldx(127+8, 127-8); -} - - - -/************************************* - * - * Scroll registers - * - *************************************/ - -void m52_state::m52_scroll_w(uint8_t data) -{ -/* - According to the schematics there is only one video register that holds the X scroll value - with a NAND gate on the V64 and V128 lines to control when it's read, and when - 255 (via 8 pull up resistors) is used. - - So we set the first 3 quarters to 255 and the last to the scroll value -*/ - m_tx_tilemap->set_scrollx(0, 255); - m_tx_tilemap->set_scrollx(1, 255); - m_tx_tilemap->set_scrollx(2, 255); - m_tx_tilemap->set_scrollx(3, -(data + 1)); -} - -void m52_alpha1v_state::m52_scroll_w(uint8_t data) -{ -/* - alpha1v must have some board mod to invert scroll register use, as it expects only the first block to remain static - the scrolling powerups are part of the tx layer! - - TODO: check if this configuration works with Moon Patrol, maybe the schematics were read incorrectly? -*/ - m_tx_tilemap->set_scrollx(0, 255); - m_tx_tilemap->set_scrollx(1, -(data + 1)); - m_tx_tilemap->set_scrollx(2, -(data + 1)); - m_tx_tilemap->set_scrollx(3, -(data + 1)); -} - - -/************************************* - * - * Video RAM write handlers - * - *************************************/ - -void m52_state::m52_videoram_w(offs_t offset, uint8_t data) -{ - m_videoram[offset] = data; - m_tx_tilemap->mark_tile_dirty(offset); -} - - -void m52_state::m52_colorram_w(offs_t offset, uint8_t data) -{ - m_colorram[offset] = data; - m_tx_tilemap->mark_tile_dirty(offset); -} - - - -/************************************* - * - * Custom protection - * - *************************************/ - -/* This looks like some kind of protection implemented by a custom chip on the - scroll board. It mangles the value written to the port m52_bg1xpos_w, as - follows: result = popcount(value & 0x7f) ^ (value >> 7) */ -uint8_t m52_state::m52_protection_r() -{ - int popcount = 0; - int temp; - - for (temp = m_bg1xpos & 0x7f; temp != 0; temp >>= 1) - popcount += temp & 1; - return popcount ^ (m_bg1xpos >> 7); -} - - - -/************************************* - * - * Background control write handlers - * - *************************************/ - -void m52_state::m52_bg1ypos_w(uint8_t data) -{ - m_bg1ypos = data; -} - -void m52_state::m52_bg1xpos_w(uint8_t data) -{ - m_bg1xpos = data; -} - -void m52_state::m52_bg2xpos_w(uint8_t data) -{ - m_bg2xpos = data; -} - -void m52_state::m52_bg2ypos_w(uint8_t data) -{ - m_bg2ypos = data; -} - -void m52_state::m52_bgcontrol_w(uint8_t data) -{ - m_bgcontrol = data; -} - - - -/************************************* - * - * Outputs - * - *************************************/ - -void m52_state::m52_flipscreen_w(uint8_t data) -{ - /* screen flip is handled both by software and hardware */ - flip_screen_set((data & 0x01) ^ (~ioport("DSW2")->read() & 0x01)); - - machine().bookkeeping().coin_counter_w(0, data & 0x02); - machine().bookkeeping().coin_counter_w(1, data & 0x20); -} - -void m52_alpha1v_state::alpha1v_flipscreen_w(uint8_t data) -{ - flip_screen_set(data & 0x01); -} - - - -/************************************* - * - * Background rendering - * - *************************************/ - -void m52_state::draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect, int xpos, int ypos, int image) -{ - rectangle rect; - const rectangle &visarea = m_screen->visible_area(); - const pen_t *paldata = m_bg_palette->pens(); - - - if (flip_screen()) - { - xpos = 264 - xpos; - ypos = 264 - ypos - BGHEIGHT; - } - - xpos += 124; - - /* this may not be correct */ - ypos += 16; - - - m_bg_gfxdecode->gfx(image)->transpen(bitmap,cliprect, - 0, 0, - flip_screen(), - flip_screen(), - xpos, - ypos, 0); - - - m_bg_gfxdecode->gfx(image)->transpen(bitmap,cliprect, - 0, 0, - flip_screen(), - flip_screen(), - xpos - 256, - ypos, 0); - - // create a solid fill below the 64 pixel high bg images - if (m_do_bg_fills) - { - rect.min_x = visarea.min_x; - rect.max_x = visarea.max_x; - - if (flip_screen()) - { - rect.min_y = ypos - BGHEIGHT; - rect.max_y = ypos - 1; - } - else - { - rect.min_y = ypos + BGHEIGHT; - rect.max_y = ypos + 2 * BGHEIGHT - 1; - } - - bitmap.fill(paldata[m_bg_gfxdecode->gfx(image)->colorbase() + 3], rect); - } -} - - - -/************************************* - * - * Sprites rendering - * - *************************************/ - -void m52_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int initoffs) -{ - int offs; - - /* draw the sprites */ - for (offs = initoffs; offs >= (initoffs & 0xc0); offs -= 4) - { - int sy = 257 - m_spriteram[offs]; - int color = m_spriteram[offs + 1] & 0x3f; - int flipx = m_spriteram[offs + 1] & 0x40; - int flipy = m_spriteram[offs + 1] & 0x80; - int code = m_spriteram[offs + 2]; - int sx = m_spriteram[offs + 3]; - - /* sprites from offsets $00-$7F are processed in the upper half of the frame */ - /* sprites from offsets $80-$FF are processed in the lower half of the frame */ - rectangle clip = cliprect; - if (!(offs & 0x80)) - clip.min_y = 0, clip.max_y = 127; - else - clip.min_y = 128, clip.max_y = 255; - - /* adjust for flipping */ - if (flip_screen()) - { - int temp = clip.min_y; - clip.min_y = 255 - clip.max_y; - clip.max_y = 255 - temp; - flipx = !flipx; - flipy = !flipy; - sx = 238 - sx; - sy = 282 - sy; - } - - sx += 129; - - /* in theory anyways; in practice, some of the molecule-looking guys get clipped */ -#ifdef SPLIT_SPRITES - sect_rect(&clip, cliprect); -#else - clip = cliprect; -#endif - - m_sp_gfxdecode->gfx(0)->transmask(bitmap,clip, - code, color, flipx, flipy, sx, sy, - m_sp_palette->transpen_mask(*m_sp_gfxdecode->gfx(0), color, 0)); - } -} - - - -/************************************* - * - * Video render - * - *************************************/ - -uint32_t m52_state::screen_update_m52(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) -{ - int offs; - const pen_t *paldata = m_sp_palette->pens(); - - bitmap.fill(paldata[0], cliprect); - - if (!(m_bgcontrol & 0x20)) - { - if (!(m_bgcontrol & 0x10)) - draw_background(bitmap, cliprect, m_bg2xpos, m_bg2ypos, 0); /* distant mountains */ - - // only one of these be drawn at once (they share the same scroll register) (alpha1v leaves everything enabled) - if (!(m_bgcontrol & 0x02)) - draw_background(bitmap, cliprect, m_bg1xpos, m_bg1ypos, 1); /* hills */ - else if (!(m_bgcontrol & 0x04)) - draw_background(bitmap, cliprect, m_bg1xpos, m_bg1ypos, 2); /* cityscape */ - } - - m_tx_tilemap->set_flip(flip_screen() ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0); - - m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0); - - /* draw the sprites */ - for (offs = 0x3c; offs <= m_spritelimit; offs += 0x40) - draw_sprites(bitmap, cliprect, offs); - - return 0; -} diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 807a8fe6bf8..c039bd2bcb8 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -30679,7 +30679,9 @@ spotty // (c) 2001 Prince Co. @source:misc/ltcasino.cpp ltcasin2 // (c) 1984 Digital Controls Inc ltcasin2a // (c) 1984 Digital Controls Inc +ltcasin2b // (c) 1984 Digital Controls Inc ltcasino // (c) 1982 Digital Controls Inc +ltcasinoa // (c) 1982 Digital Controls Inc mv4in1 // (c) 1983 Entertainment Enterprises @source:misc/luckybal.cpp @@ -36403,16 +36405,17 @@ mnfb_c27 // mnfb_c29 // play_a24 // poto_a29 // -poto_a32 // poto_a31 // +poto_a32 // robo_a29 // robo_a30 // robo_a34 // simp_a20 // simp_a27 // ssvc_a26 // -ssvc_b26 // ssvc_a42 // +ssvc_b26 // +ssvc_e40 // tmac_a18 // tmac_a24 // tmac_g18 // diff --git a/src/mame/misc/ltcasino.cpp b/src/mame/misc/ltcasino.cpp index 3c74c9fda0f..a938ebb9ac1 100644 --- a/src/mame/misc/ltcasino.cpp +++ b/src/mame/misc/ltcasino.cpp @@ -1,5 +1,6 @@ // license: BSD-3-Clause // copyright-holders: Pierpaolo Prazzoli, David Haywood, Dirk Best + /*************************************************************************** Little Casino @@ -68,12 +69,14 @@ Other: Hitachi HD46821P 1MHz NMOS Peripheral Interface Adapter (PIA) x 2 ***************************************************************************/ #include "emu.h" + #include "cpu/m6502/m6502.h" #include "machine/6821pia.h" #include "machine/input_merger.h" #include "machine/nvram.h" #include "sound/ay8910.h" #include "video/tms9927.h" + #include "emupal.h" #include "screen.h" #include "speaker.h" @@ -108,13 +111,11 @@ public: m_tilemap(nullptr) { } - void init_mv4in1(); - void ltcasino(machine_config &config); - void ltcasin2(machine_config &config); - void mv4in1(machine_config &config); -private: +protected: + virtual void machine_start() override; + required_device m_maincpu; required_device_array m_pia; required_device m_vtc; @@ -129,15 +130,11 @@ private: tilemap_t *m_tilemap; +private: void main_map(address_map &map); - void ltcasin2_palette(palette_device &palette) const; uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TILE_GET_INFO_MEMBER(ltcasino_tile_info); - TILE_GET_INFO_MEMBER(ltcasin2_tile_info); - - void machine_start_ltcasino(); - void machine_start_ltcasin2(); + TILE_GET_INFO_MEMBER(tile_info); uint8_t input_q_r(); uint8_t input_s_r(); @@ -146,6 +143,23 @@ private: void output_t_w(uint8_t data); }; +class ltcasin2_state : public ltcasino_state +{ +public: + using ltcasino_state::ltcasino_state; + + void init_mv4in1(); + + void ltcasin2(machine_config &config); + void mv4in1(machine_config &config); + +protected: + virtual void machine_start() override; + +private: + void palette(palette_device &palette) const; + TILE_GET_INFO_MEMBER(tile_info); +}; //************************************************************************** // ADDRESS MAPS @@ -347,7 +361,7 @@ INPUT_PORTS_END // VIDEO EMULATION //************************************************************************** -void ltcasino_state::ltcasin2_palette(palette_device &palette) const +void ltcasin2_state::palette(palette_device &palette) const { for (int i = 0; i < 8; i++) { @@ -369,22 +383,22 @@ void ltcasino_state::ltcasin2_palette(palette_device &palette) const ---- x--- unknown (used by ltcasino) ---- -xxx background color */ -TILE_GET_INFO_MEMBER(ltcasino_state::ltcasino_tile_info) +TILE_GET_INFO_MEMBER(ltcasino_state::tile_info) { uint16_t code = m_video_ram[tile_index]; // +1 on attribute offset otherwise glitches occurs on left side of objects? - uint8_t attr = m_attribute_ram[(tile_index + 1) & 0x7ff]; + uint8_t const attr = m_attribute_ram[(tile_index + 1) & 0x7ff]; code |= BIT(attr, 7) << 8; tileinfo.set(0, code, 0, 0); } -TILE_GET_INFO_MEMBER(ltcasino_state::ltcasin2_tile_info) +TILE_GET_INFO_MEMBER(ltcasin2_state::tile_info) { uint16_t code = m_video_ram[tile_index]; // +1 on attribute offset otherwise glitches occurs on left side of objects? - uint8_t attr = m_attribute_ram[(tile_index + 1) & 0x7ff]; + uint8_t const attr = m_attribute_ram[(tile_index + 1) & 0x7ff]; code |= BIT(attr, 7) << 8; @@ -411,11 +425,11 @@ static const gfx_layout tiles8x8_layout = }; static GFXDECODE_START( gfx_ltcasino ) - GFXDECODE_ENTRY("gfx1", 0, tiles8x8_layout, 0, 1) + GFXDECODE_ENTRY("tiles", 0, tiles8x8_layout, 0, 1) GFXDECODE_END static GFXDECODE_START( gfx_ltcasin2 ) - GFXDECODE_ENTRY("gfx1", 0, tiles8x8_layout, 0, 64) + GFXDECODE_ENTRY("tiles", 0, tiles8x8_layout, 0, 64) GFXDECODE_END @@ -423,22 +437,22 @@ GFXDECODE_END // MACHINE EMULATION //************************************************************************** -void ltcasino_state::init_mv4in1() +void ltcasin2_state::init_mv4in1() { uint8_t *rom = memregion("maincpu")->base(); for (int i = 0; i < 0x10000; i++) rom[i] = bitswap<8>(rom[i], 7, 6, 5, 4, 3, 1, 2, 0); } -void ltcasino_state::machine_start_ltcasino() +void ltcasino_state::machine_start() { - m_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ltcasino_state::ltcasino_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); + m_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ltcasino_state::tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); m_lamps.resolve(); } -void ltcasino_state::machine_start_ltcasin2() +void ltcasin2_state::machine_start() { - m_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ltcasino_state::ltcasin2_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); + m_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(ltcasin2_state::tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); m_lamps.resolve(); } @@ -514,8 +528,6 @@ void ltcasino_state::ltcasino(machine_config &config) m_pia[1]->readpa_handler().set(FUNC(ltcasino_state::input_s_r)); m_pia[1]->writepb_handler().set(FUNC(ltcasino_state::output_t_w)); - MCFG_MACHINE_START_OVERRIDE(ltcasino_state, ltcasino) - // video hardware CRT5037(config, m_vtc, 18_MHz_XTAL/16); // this clock gives about 60/50 hz m_vtc->set_char_width(8); @@ -541,27 +553,24 @@ void ltcasino_state::ltcasino(machine_config &config) m_ay->add_route(ALL_OUTPUTS, "mono", 0.4); } -void ltcasino_state::ltcasin2(machine_config &config) +void ltcasin2_state::ltcasin2(machine_config &config) { ltcasino(config); - MCFG_MACHINE_START_OVERRIDE(ltcasino_state, ltcasin2) - - config.device_remove("palette"); - PALETTE(config, "palette", FUNC(ltcasino_state::ltcasin2_palette), 128, 8); + PALETTE(config.replace(), "palette", FUNC(ltcasin2_state::palette), 128, 8); m_gfxdecode->set_info(gfx_ltcasin2); } -void ltcasino_state::mv4in1(machine_config &config) +void ltcasin2_state::mv4in1(machine_config &config) { ltcasin2(config); // different XTAL - m_maincpu->set_clock(18.432_MHz_XTAL/16); - m_vtc->set_clock(18.432_MHz_XTAL/16); - m_screen->set_raw(18.432_MHz_XTAL/2, 560, 48, 464, 268, 0, 256); - m_ay->set_clock(18.432_MHz_XTAL/16); + m_maincpu->set_clock(18.432_MHz_XTAL / 16); + m_vtc->set_clock(18.432_MHz_XTAL / 16); + m_screen->set_raw(18.432_MHz_XTAL / 2, 560, 48, 464, 268, 0, 256); + m_ay->set_clock(18.432_MHz_XTAL / 16); } @@ -580,10 +589,25 @@ ROM_START( ltcasino ) ROM_LOAD( "e", 0xc800, 0x0800, CRC(5f9e103a) SHA1(b0e9ace4c3962c06e5250fac16a245dca711350f) ) ROM_LOAD( "f", 0xf000, 0x1000, CRC(7345aada) SHA1(6640f5eb1130c8f1cb197eb12b8e6403c7f8d34d) ) - ROM_REGION( 0x0800, "gfx1", 0 ) + ROM_REGION( 0x0800, "tiles", 0 ) ROM_LOAD( "v", 0x0000, 0x0800, CRC(f1f75675) SHA1(8f3777e6b2a3f824f94b28669cac501ec02bbf36) ) ROM_END +// Selection text: "SELECT GAME DESIRED!" +// Games: Black Jack, Draw Poker, Craps, Hi-Lo +ROM_START( ltcasinoa ) // all labels handwritten, tile ROM without label + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "a1", 0x8000, 0x1000, CRC(14909fee) SHA1(bf53fa65da7f013ea1ac6b4942cdfdb34ef16252) ) + ROM_LOAD( "b1", 0x9800, 0x0800, CRC(1473f854) SHA1(eadaec1f6d653e61458bc262945c20140f4530eb) ) + ROM_LOAD( "c1", 0xa800, 0x0800, CRC(7a07004b) SHA1(62bd0f3d12b7eada6fc271abea60569aca7262b0) ) + ROM_LOAD( "d1", 0xb800, 0x0800, CRC(5148cafc) SHA1(124039f48784bf032f612714db73fb67a216a1e7) ) + ROM_LOAD( "e1", 0xc800, 0x0800, CRC(5f9e103a) SHA1(b0e9ace4c3962c06e5250fac16a245dca711350f) ) + ROM_LOAD( "f1", 0xf000, 0x1000, CRC(37265ddf) SHA1(f6ec12f8836a280c7a06cc19f740b39c5149eabc) ) // only different ROM + + ROM_REGION( 0x0800, "tiles", 0 ) + ROM_LOAD( "g", 0x0000, 0x0800, CRC(f1f75675) SHA1(8f3777e6b2a3f824f94b28669cac501ec02bbf36) ) +ROM_END + // Selection text: "PLAY YOUR FAVORITES" // Games: 21, Draw Poker, Dice, Red-Dog ROM_START( mv4in1 ) @@ -595,7 +619,7 @@ ROM_START( mv4in1 ) ROM_LOAD( "c.ic17", 0xc000, 0x1000, CRC(e384edf4) SHA1(99042528ce2b35191248d90162ca06a1a585667c) ) ROM_LOAD( "b.ic18", 0xf000, 0x1000, CRC(3450b862) SHA1(816d13fd8d03c299c1dbecf971ee5fae2f1d64bc) ) - ROM_REGION( 0x1000, "gfx1", 0 ) + ROM_REGION( 0x1000, "tiles", 0 ) ROM_LOAD( "a.ic19", 0x0000, 0x1000, CRC(a25c125e) SHA1(e0ba83ccddbd82a2bf52585ae0accb9192cbb00e) ) ROM_END @@ -604,14 +628,14 @@ ROM_END // Board was marked version 18.1 (C)1984 ROM_START( ltcasin2 ) ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "v18_10_ra.bin", 0x8000, 0x1000, CRC(f0c5cc96) SHA1(ec50918ba2a2487df70694f9e1a52d4b8d1bc7e2) ) - ROM_LOAD( "v18_10_rb.bin", 0x9000, 0x1000, CRC(2ece16e4) SHA1(ef6adc45be2ecc510cd8b2e9682635066013a5e4) ) - ROM_LOAD( "v18_10_rc.bin", 0xa000, 0x1000, CRC(16bae5c9) SHA1(e5cb61d9dcae3c46c7139f3494d1bf981ec8821f) ) - ROM_LOAD( "v18_10_rd.bin", 0xb000, 0x1000, CRC(d12f2d6b) SHA1(e3544bf6b778c21b704a01f1ed06d6517ca01604) ) - ROM_LOAD( "v18_10_re.bin", 0xc000, 0x1000, CRC(2acdad10) SHA1(2732b791fea0a9d1c6e4c174739381466f2b0270) ) - ROM_LOAD( "v18_10_rf.bin", 0xf000, 0x1000, CRC(b711c779) SHA1(2bab84cab174a35fccfd23003a8a41aa241d4595) ) - - ROM_REGION( 0x1000, "gfx1", 0 ) + ROM_LOAD( "v18_10_ra.bin", 0x8000, 0x1000, CRC(f0c5cc96) SHA1(ec50918ba2a2487df70694f9e1a52d4b8d1bc7e2) ) // 18.01.01 in test mode + ROM_LOAD( "v18_10_rb.bin", 0x9000, 0x1000, CRC(2ece16e4) SHA1(ef6adc45be2ecc510cd8b2e9682635066013a5e4) ) // 18.01.01 in test mode + ROM_LOAD( "v18_10_rc.bin", 0xa000, 0x1000, CRC(16bae5c9) SHA1(e5cb61d9dcae3c46c7139f3494d1bf981ec8821f) ) // 18.01.00 in test mode + ROM_LOAD( "v18_10_rd.bin", 0xb000, 0x1000, CRC(d12f2d6b) SHA1(e3544bf6b778c21b704a01f1ed06d6517ca01604) ) // 18.01.00 in test mode + ROM_LOAD( "v18_10_re.bin", 0xc000, 0x1000, CRC(2acdad10) SHA1(2732b791fea0a9d1c6e4c174739381466f2b0270) ) // 18.01.00 in test mode + ROM_LOAD( "v18_10_rf.bin", 0xf000, 0x1000, CRC(b711c779) SHA1(2bab84cab174a35fccfd23003a8a41aa241d4595) ) // 18.01.02 in test mode + + ROM_REGION( 0x1000, "tiles", 0 ) ROM_LOAD( "v18_10_rv.bin", 0x0000, 0x1000, CRC(7209898d) SHA1(94bd7e8c3a544429af721e9564c11cc56d7805be) ) ROM_END @@ -619,17 +643,32 @@ ROM_END // Games: Black Jack, Draw Poker, Craps, Hi-Lo, Horse ROM_START( ltcasin2a ) ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "v17_00_ra.bin", 0x8000, 0x1000, CRC(1a595442) SHA1(b8fe3e5ed2024a57187c0ce547c1bbef2429ed63) ) - ROM_LOAD( "v17_00_rb.bin", 0x9000, 0x1000, CRC(4f5502c1) SHA1(cd1b7c08d26fed71c45e44ebd208bd18dc262e8f) ) - ROM_LOAD( "v17_00_rc.bin", 0xa000, 0x1000, CRC(990283b8) SHA1(8a3fe5be8381894b8e8dd14c7d42190e60a25600) ) - ROM_LOAD( "v17_00_rd.bin", 0xb000, 0x1000, CRC(884f39dc) SHA1(fe149faf118279205e82760c5052cefb88a2f5be) ) - ROM_LOAD( "v17_00_re.bin", 0xc000, 0x1000, CRC(fae38204) SHA1(e5908734cee0a89d873ab3761ded285f8ae138d3) ) - ROM_LOAD( "v17_00_rf.bin", 0xf000, 0x1000, CRC(7e8ad9d3) SHA1(8cbe342af7d9f32b2214664db318edd3d2e75630) ) - - ROM_REGION( 0x1000, "gfx1", 0 ) + ROM_LOAD( "v17_00_ra.bin", 0x8000, 0x1000, CRC(1a595442) SHA1(b8fe3e5ed2024a57187c0ce547c1bbef2429ed63) ) // 17.00.00 in test mode + ROM_LOAD( "v17_00_rb.bin", 0x9000, 0x1000, CRC(4f5502c1) SHA1(cd1b7c08d26fed71c45e44ebd208bd18dc262e8f) ) // 17.00.00 in test mode + ROM_LOAD( "v17_00_rc.bin", 0xa000, 0x1000, CRC(990283b8) SHA1(8a3fe5be8381894b8e8dd14c7d42190e60a25600) ) // 17.00.00 in test mode + ROM_LOAD( "v17_00_rd.bin", 0xb000, 0x1000, CRC(884f39dc) SHA1(fe149faf118279205e82760c5052cefb88a2f5be) ) // 17.00.00 in test mode + ROM_LOAD( "v17_00_re.bin", 0xc000, 0x1000, CRC(fae38204) SHA1(e5908734cee0a89d873ab3761ded285f8ae138d3) ) // 17.00.00 in test mode + ROM_LOAD( "v17_00_rf.bin", 0xf000, 0x1000, CRC(7e8ad9d3) SHA1(8cbe342af7d9f32b2214664db318edd3d2e75630) ) // 17.00.00 in test mode + + ROM_REGION( 0x1000, "tiles", 0 ) ROM_LOAD( "v17_00_rv.bin", 0x0000, 0x1000, CRC(84cbee7b) SHA1(742831d5ae0db6c7c644a18a837831ee0474d472) ) ROM_END +// Selection text: "PLEASE MAKE SELECTION!" +// Games: Black Jack, Draw Poker, Craps, Slots, Horse +ROM_START( ltcasin2b ) // all labels peeled off + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "a.bin", 0x8000, 0x1000, CRC(8d446c26) SHA1(d5b78fd17798bf69fbac5e060f020799bb10cf64) ) // 30.00.00 in test mode + ROM_LOAD( "b.bin", 0x9000, 0x1000, CRC(38ca5193) SHA1(715add68a633b78eceabe149a7564aa2fb513837) ) // 30.00.00 in test mode + ROM_LOAD( "c.bin", 0xa000, 0x1000, CRC(f05095db) SHA1(61c5c9bef20c057348ce1321c71195d340dc0cd6) ) // 30.00.00 in test mode + ROM_LOAD( "d.bin", 0xb000, 0x1000, CRC(53e534dc) SHA1(3d964f51b254f9bd0bd3fb4926f57aa7d5224968) ) // 30.00.00 in test mode + ROM_LOAD( "e.bin", 0xc000, 0x1000, CRC(972fd4ab) SHA1(f91556588315e0836a860f138730314688f99ec7) ) // 30.00.00 in test mode + ROM_LOAD( "f.bin", 0xf000, 0x1000, CRC(b711c779) SHA1(2bab84cab174a35fccfd23003a8a41aa241d4595) ) // same as ltcasin2, 18.01.02 in test mode + + ROM_REGION( 0x1000, "tiles", 0 ) + ROM_LOAD( "g.bin", 0x0000, 0x1000, CRC(135ec308) SHA1(699711ceaeb5a00f31ccd88b7be7e9f0055fa58b) ) +ROM_END + } // anonymous namespace @@ -637,8 +676,10 @@ ROM_END // SYSTEM DRIVERS //************************************************************************** -// YEAR NAME PARENT MACHINE INPUT CLASS INIT ROTATION COMPANY FULLNAME FLAGS -GAMEL( 1982, ltcasino, 0, ltcasino, ltcasino, ltcasino_state, empty_init, ROT0, "Digital Controls Inc.", "Little Casino", MACHINE_SUPPORTS_SAVE, layout_ltcasino ) -GAMEL( 1983, mv4in1, 0, mv4in1, mv4in1, ltcasino_state, init_mv4in1, ROT0, "Entertainment Enterprises, Ltd.", "Mini Vegas 4in1", MACHINE_SUPPORTS_SAVE, layout_ltcasinn ) -GAMEL( 1984, ltcasin2, 0, ltcasin2, ltcasin2, ltcasino_state, empty_init, ROT0, "Digital Controls Inc.", "Little Casino II v18.1", MACHINE_SUPPORTS_SAVE, layout_ltcasinn ) -GAMEL( 1984, ltcasin2a, ltcasin2, ltcasin2, ltcasin2a, ltcasino_state, empty_init, ROT0, "Digital Controls Inc.", "Little Casino II v17.0", MACHINE_SUPPORTS_SAVE, layout_ltcasinn ) +// YEAR NAME PARENT MACHINE INPUT CLASS INIT ROTATION COMPANY FULLNAME FLAGS +GAMEL( 1982, ltcasino, 0, ltcasino, ltcasino, ltcasino_state, empty_init, ROT0, "Digital Controls Inc.", "Little Casino (set 1)", MACHINE_SUPPORTS_SAVE, layout_ltcasino ) +GAMEL( 1982, ltcasinoa, ltcasino, ltcasino, ltcasino, ltcasino_state, empty_init, ROT0, "Digital Controls Inc.", "Little Casino (set 2)", MACHINE_SUPPORTS_SAVE, layout_ltcasino ) +GAMEL( 1983, mv4in1, 0, mv4in1, mv4in1, ltcasin2_state, init_mv4in1, ROT0, "Entertainment Enterprises, Ltd.", "Mini Vegas 4in1", MACHINE_SUPPORTS_SAVE, layout_ltcasinn ) +GAMEL( 1984, ltcasin2, 0, ltcasin2, ltcasin2, ltcasin2_state, empty_init, ROT0, "Digital Controls Inc.", "Little Casino II (v18.1, set 1)", MACHINE_SUPPORTS_SAVE, layout_ltcasinn ) +GAMEL( 1984, ltcasin2a, ltcasin2, ltcasin2, ltcasin2a, ltcasin2_state, empty_init, ROT0, "Digital Controls Inc.", "Little Casino II (v17.0)", MACHINE_SUPPORTS_SAVE, layout_ltcasinn ) +GAMEL( 1984, ltcasin2b, ltcasin2, ltcasin2, ltcasin2, ltcasin2_state, empty_init, ROT0, "Digital Controls Inc.", "Little Casino II (v18.1, set 2)", MACHINE_SUPPORTS_SAVE, layout_ltcasinn ) diff --git a/src/mame/pinball/de_2.cpp b/src/mame/pinball/de_2.cpp index f214151c65c..e914773a6c7 100644 --- a/src/mame/pinball/de_2.cpp +++ b/src/mame/pinball/de_2.cpp @@ -55,6 +55,7 @@ ToDo: #include "cpu/m6809/m6809.h" #include "sound/msm5205.h" #include "sound/ymopm.h" + #include "speaker.h" #include "de1.lh" @@ -82,10 +83,11 @@ public: void de_type2_alpha3(machine_config &config); void de_type3(machine_config &config); -private: +protected: virtual void machine_start() override; virtual void machine_reset() override; +private: void de_bg_audio(machine_config &config); void audio_map(address_map &map); @@ -557,7 +559,7 @@ void de_2_state::lamps_w(offs_t offset, uint8_t data) void de_2_state::de_bg_audio(machine_config &config) { - /* sound CPU */ + // sound CPU MC6809E(config, m_audiocpu, XTAL(8'000'000) / 4); // MC68B09E m_audiocpu->set_addrmap(AS_PROGRAM, &de_2_state::audio_map); @@ -575,7 +577,7 @@ void de_2_state::de_bg_audio(machine_config &config) void de_2_state::de_type1(machine_config &config) { - /* basic machine hardware */ + // basic machine hardware decocpu_type1_device &decocpu(DECOCPU1(config, "decocpu", XTAL(8'000'000) / 2, "maincpu")); decocpu.display_read_callback().set(FUNC(de_2_state::display_r)); decocpu.display_write_callback().set(FUNC(de_2_state::display_w)); @@ -584,7 +586,7 @@ void de_2_state::de_type1(machine_config &config) decocpu.switch_write_callback().set(FUNC(de_2_state::switch_w)); decocpu.lamp_write_callback().set(FUNC(de_2_state::lamps_w)); - /* Video */ + // Video config.set_default_layout(layout_de1); genpin_audio(config); @@ -593,7 +595,7 @@ void de_2_state::de_type1(machine_config &config) void de_2_state::de_type2(machine_config &config) { - /* basic machine hardware */ + // basic machine hardware decocpu_type2_device &decocpu(DECOCPU2(config, "decocpu", XTAL(8'000'000) / 2, "maincpu")); decocpu.display_read_callback().set(FUNC(de_2_state::display_r)); decocpu.display_write_callback().set(FUNC(de_2_state::display_w)); @@ -602,7 +604,7 @@ void de_2_state::de_type2(machine_config &config) decocpu.switch_write_callback().set(FUNC(de_2_state::switch_w)); decocpu.lamp_write_callback().set(FUNC(de_2_state::lamps_w)); - /* Video */ + // Video config.set_default_layout(layout_de2); genpin_audio(config); @@ -611,7 +613,7 @@ void de_2_state::de_type2(machine_config &config) void de_2_state::de_type2_alpha3(machine_config &config) { - /* basic machine hardware */ + // basic machine hardware de_type2(config); subdevice("decocpu")->display_write_callback().set(FUNC(de_2_state::type2alpha3_display_w)); config.set_default_layout(layout_de2a3); @@ -619,7 +621,7 @@ void de_2_state::de_type2_alpha3(machine_config &config) void de_2_state::de_type3(machine_config &config) { - /* basic machine hardware */ + // basic machine hardware decocpu_type3_device &decocpu(DECOCPU3(config, "decocpu", XTAL(8'000'000) / 2, "maincpu")); decocpu.display_read_callback().set(FUNC(de_2_state::display_r)); decocpu.display_write_callback().set(FUNC(de_2_state::type3_display_w)); @@ -629,7 +631,7 @@ void de_2_state::de_type3(machine_config &config) decocpu.lamp_write_callback().set(FUNC(de_2_state::lamps_w)); decocpu.solenoid_write_callback().set(FUNC(de_2_state::sol_w)); - /* Video */ + // Video config.set_default_layout(layout_de2a3); genpin_audio(config); @@ -891,6 +893,18 @@ ROM_START(ssvc_a42) ROM_LOAD("ssv2f4.rom", 0x10000, 0x10000, CRC(53832d16) SHA1(2227eb784e0221f1bf2bdf7ea48ecd122433f1ea)) ROM_END +ROM_START(ssvc_e40) + ROM_REGION(0x10000, "maincpu", 0) + ROM_LOAD("ssvce4-0.b5", 0x0000, 0x8000, CRC(1109be9b) SHA1(b0058d63868d6b97967fe8ee681f0a807d55cdaf)) + ROM_LOAD("ssvce4-0.c5", 0x8000, 0x8000, CRC(4162833b) SHA1(1699287c7b25262053ce42bf38e5608bb8b0670c)) + ROM_REGION(0x10000, "audiocpu", 0) + ROM_LOAD("sssndf7.rom", 0x8000, 0x8000, CRC(980778d0) SHA1(7c1f14d327b6d0e6d0fef058f96bb1cb440c9330)) + ROM_REGION(0x20000, "sound1", 0) + ROM_LOAD("ssv1f6.rom", 0x00000, 0x10000, CRC(ccbc72f8) SHA1(c5c13fb8d05d7fb4005636655073d88b4d12d65e)) + ROM_LOAD("ssv2f4.rom", 0x10000, 0x10000, CRC(53832d16) SHA1(2227eb784e0221f1bf2bdf7ea48ecd122433f1ea)) +ROM_END + + /*------------------------------------------------------------------------ / The Simpsons - CPU Rev 3 /Alpha Type 3 16/32K Roms - 32/128K Sound Roms /------------------------------------------------------------------------*/ @@ -1000,6 +1014,7 @@ GAME( 1989, robo_a29, robo_a34, de_type3, de2, de_2_state, empty_init, RO GAME( 1988, ssvc_a26, 0, de_type2, de2, de_2_state, empty_init, ROT0, "Data East", "Secret Service (2.6)", MACHINE_IS_SKELETON_MECHANICAL | MACHINE_SUPPORTS_SAVE ) GAME( 1988, ssvc_b26, ssvc_a26, de_type2, de2, de_2_state, empty_init, ROT0, "Data East", "Secret Service (2.6 alternate sound)", MACHINE_IS_SKELETON_MECHANICAL | MACHINE_SUPPORTS_SAVE ) GAME( 1988, ssvc_a42, ssvc_a26, de_type2, de2, de_2_state, empty_init, ROT0, "Data East", "Secret Service (4.2 alternate sound)", MACHINE_IS_SKELETON_MECHANICAL | MACHINE_SUPPORTS_SAVE ) +GAME( 1988, ssvc_e40, ssvc_a26, de_type2, de2, de_2_state, empty_init, ROT0, "Data East", "Secret Service (4.0, Europe)", MACHINE_IS_SKELETON_MECHANICAL | MACHINE_SUPPORTS_SAVE ) GAME( 1990, simp_a27, 0, de_type3, de2, de_2_state, empty_init, ROT0, "Data East", "The Simpsons (2.7)", MACHINE_IS_SKELETON_MECHANICAL | MACHINE_SUPPORTS_SAVE ) GAME( 1990, simp_a20, simp_a27, de_type3, de2, de_2_state, empty_init, ROT0, "Data East", "The Simpsons (2.0)", MACHINE_IS_SKELETON_MECHANICAL | MACHINE_SUPPORTS_SAVE ) GAME( 1988, tmac_a24, 0, de_type2, de2, de_2_state, empty_init, ROT0, "Data East", "Time Machine (2.4)", MACHINE_IS_SKELETON_MECHANICAL | MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3