From d425561eee01be8beb8e0544566b78c8846b5a5d Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Tue, 19 Jun 2018 17:56:37 +0200 Subject: ltcasino.cpp: updated notes, various minor clean-ups, hooked up ay8910 read ports (nw) --- src/mame/drivers/ltcasino.cpp | 215 ++++++++++++++++++++++++------------------ 1 file changed, 125 insertions(+), 90 deletions(-) diff --git a/src/mame/drivers/ltcasino.cpp b/src/mame/drivers/ltcasino.cpp index d52be7f517b..27bb96fd597 100644 --- a/src/mame/drivers/ltcasino.cpp +++ b/src/mame/drivers/ltcasino.cpp @@ -7,10 +7,11 @@ Mini Vegas 4in1 Non-Payout 'Gambling' style games. -todo: +TODO: -inputs -colours +inputs (dips multiplexed?) +colours (there are 2 flyers which show different colours?) +hook up TMS9937 and 2 x 6821 PIAs etc. Mini Vegas @@ -46,7 +47,7 @@ Sound: AY-3-8910 TC5514P-1 1KBx4 SRAM x 4 DSW: 3 8-switch dipswitches VR1: Volume pot -Other: Hitatchi HD46821P 1MHz NMOS Peripheral Interface Adapter (PIA) x 2 +Other: Hitachi HD46821P 1MHz NMOS Peripheral Interface Adapter (PIA) x 2 NEC uPA2003C Darlington Array 3.6v Battery D1 - Power On Diode @@ -72,20 +73,28 @@ public: m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode") { } - required_shared_ptr m_tile_num_ram; - required_shared_ptr m_tile_atr_ram; - tilemap_t *m_tilemap; - DECLARE_WRITE8_MEMBER(ltcasino_tile_num_w); - DECLARE_WRITE8_MEMBER(ltcasino_tile_atr_w); void init_mv4in1(); - TILE_GET_INFO_MEMBER(get_ltcasino_tile_info); + void ltcasino(machine_config &config); + +protected: virtual void video_start() override; - DECLARE_PALETTE_INIT(ltcasino); - uint32_t screen_update_ltcasino(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + +private: + required_shared_ptr m_tile_num_ram; + required_shared_ptr m_tile_atr_ram; required_device m_maincpu; required_device m_gfxdecode; - void ltcasino(machine_config &config); - void ltcasino_map(address_map &map); + + tilemap_t *m_tilemap; + + DECLARE_WRITE8_MEMBER(tile_num_w); + DECLARE_WRITE8_MEMBER(tile_atr_w); + + TILE_GET_INFO_MEMBER(get_tile_info); + DECLARE_PALETTE_INIT(ltcasino); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + void main_map(address_map &map); }; @@ -106,13 +115,11 @@ PALETTE_INIT_MEMBER(ltcasino_state, ltcasino) ---- x--- unknown (used by ltcasino) ---- -xxx background color */ -TILE_GET_INFO_MEMBER(ltcasino_state::get_ltcasino_tile_info) +TILE_GET_INFO_MEMBER(ltcasino_state::get_tile_info) { - int tileno, colour; - - tileno = m_tile_num_ram[tile_index]; + int tileno = m_tile_num_ram[tile_index]; // TODO: wtf +1 on attribute offset otherwise glitches occurs on left side of objects? - colour = m_tile_atr_ram[(tile_index+1) & 0x7ff]; + int colour = m_tile_atr_ram[(tile_index+1) & 0x7ff]; tileno += (colour & 0x80) << 1; @@ -121,48 +128,47 @@ TILE_GET_INFO_MEMBER(ltcasino_state::get_ltcasino_tile_info) void ltcasino_state::video_start() { - m_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(ltcasino_state::get_ltcasino_tile_info),this),TILEMAP_SCAN_ROWS,8, 8,64,32); + m_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(ltcasino_state::get_tile_info),this),TILEMAP_SCAN_ROWS,8, 8,64,32); } -uint32_t ltcasino_state::screen_update_ltcasino(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t ltcasino_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_tilemap->draw(screen, bitmap, cliprect, 0,0); return 0; } -WRITE8_MEMBER(ltcasino_state::ltcasino_tile_num_w) +WRITE8_MEMBER(ltcasino_state::tile_num_w) { m_tile_num_ram[offset] = data; m_tilemap->mark_tile_dirty(offset); } -WRITE8_MEMBER(ltcasino_state::ltcasino_tile_atr_w) +WRITE8_MEMBER(ltcasino_state::tile_atr_w) { m_tile_atr_ram[offset] = data; m_tilemap->mark_tile_dirty((offset + 1) & 0x7ff); } -void ltcasino_state::ltcasino_map(address_map &map) +void ltcasino_state::main_map(address_map &map) { map(0x0000, 0x7fff).ram(); map(0x8000, 0xcfff).rom(); - map(0xd000, 0xd7ff).ram().w(FUNC(ltcasino_state::ltcasino_tile_num_w)).share("tile_nuram"); + map(0xd000, 0xd7ff).ram().w(FUNC(ltcasino_state::tile_num_w)).share(m_tile_num_ram); map(0xd800, 0xdfff).ram(); - map(0xe000, 0xe7ff).ram().w(FUNC(ltcasino_state::ltcasino_tile_atr_w)).share("tile_atr_ram"); + map(0xe000, 0xe7ff).ram().w(FUNC(ltcasino_state::tile_atr_w)).share(m_tile_atr_ram); map(0xe800, 0xebff).ram(); - map(0xec00, 0xec00).portr("IN0"); + map(0xec00, 0xec00).portr("IN0"); // PIA 6821 n. 1 map(0xec01, 0xec01).portr("IN1"); map(0xec02, 0xec02).portr("IN2"); map(0xec03, 0xec03).portr("IN3"); - map(0xec10, 0xec10).portr("IN4"); + map(0xec10, 0xec10).portr("IN4"); // PIA 6821 n. 2 map(0xec12, 0xec12).portr("IN5"); - map(0xec20, 0xec20).r("aysnd", FUNC(ay8910_device::data_r)); - map(0xec21, 0xec21).portr("BUTTONS"); //ltcasino -> pc: F3F3 (A in service) and F3FD (B in service) + map(0xec20, 0xec21).r("aysnd", FUNC(ay8910_device::data_r)); map(0xec20, 0xec21).w("aysnd", FUNC(ay8910_device::data_address_w)); - map(0xec30, 0xec3f).ram(); + map(0xec30, 0xec3f).ram(); // TMS9937 map(0xec3e, 0xec3e).nopr(); //not used map(0xf000, 0xffff).rom(); } @@ -309,33 +315,33 @@ static INPUT_PORTS_START( ltcasino ) PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) -/* PORT_START("IN6") // A and B in service //is there a switch? - PORT_DIPNAME( 0x01, 0x01, "6" ) // from 1 to 0x40 seem affect the credit - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) ) //ok? - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) -*/ - PORT_START("BUTTONS") + PORT_START("IN6") // B in service + PORT_DIPNAME( 0x01, 0x01, "6" ) // from 1 to 0x40 seem affect the credit + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) ) //ok? + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("BUTTONS") // A in service PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) @@ -499,34 +505,34 @@ static INPUT_PORTS_START( ltcasinn ) PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) -/* PORT_START("IN6") // A and B in service //is there a switch? - PORT_DIPNAME( 0x01, 0x01, "6" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) -*/ + PORT_START("IN6") // B in service + PORT_DIPNAME( 0x01, 0x01, "6" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + - PORT_START("BUTTONS") + PORT_START("BUTTONS") // A in service PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) @@ -680,7 +686,33 @@ static INPUT_PORTS_START( mv4in1 ) PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_START("BUTTONS") + PORT_START("IN6") // B in service + PORT_DIPNAME( 0x01, 0x01, "6" ) // from 1 to 0x40 seem affect the credit + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) ) //ok? + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("BUTTONS") // A in service PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) @@ -711,8 +743,8 @@ GFXDECODE_END MACHINE_CONFIG_START(ltcasino_state::ltcasino) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M6502, XTAL(18'432'000)/9) /* 2.048MHz ?? (or 18.432MHz/8 = 2.304MHz) - not verified */ - MCFG_DEVICE_PROGRAM_MAP(ltcasino_map) + MCFG_DEVICE_ADD(m_maincpu, M6502, XTAL(18'432'000)/9) /* 2.048MHz ?? (or 18.432MHz/8 = 2.304MHz) - not verified */ + MCFG_DEVICE_PROGRAM_MAP(main_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", ltcasino_state, irq0_line_hold) /* video hardware */ @@ -721,10 +753,10 @@ MACHINE_CONFIG_START(ltcasino_state::ltcasino) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_SIZE(64*8, 32*8) MCFG_SCREEN_VISIBLE_AREA(6*8, 58*8-1, 0, 32*8-1) - MCFG_SCREEN_UPDATE_DRIVER(ltcasino_state, screen_update_ltcasino) + MCFG_SCREEN_UPDATE_DRIVER(ltcasino_state, screen_update) MCFG_SCREEN_PALETTE("palette") - MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ltcasino) + MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, "palette", gfx_ltcasino) MCFG_PALETTE_ADD("palette", 2*64) MCFG_PALETTE_INIT_OWNER(ltcasino_state, ltcasino) @@ -733,6 +765,9 @@ MACHINE_CONFIG_START(ltcasino_state::ltcasino) SPEAKER(config, "mono").front_center(); MCFG_DEVICE_ADD("aysnd", AY8910, XTAL(18'432'000)/18) /* 1.024MHz ?? (or 18.432MHz/16 = 1.152MHz) - not verified */ + MCFG_AY8910_PORT_A_READ_CB(IOPORT("BUTTONS")) + MCFG_AY8910_PORT_B_READ_CB(IOPORT("IN6")) + //ltcasino -> pc: F3F3 (A in service) and F3FD (B in service) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.4) MACHINE_CONFIG_END -- cgit v1.2.3