taito/pkspirit.cpp, taito/taito_o.cpp: add TAITOIO_OPTO coin chutes

This commit is contained in:
angelosa 2023-11-20 21:42:16 +01:00
parent 1799afe5c8
commit 381061eef3
3 changed files with 60 additions and 28 deletions

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:
// copyright-holders:Angelo Salese
/**************************************************************************************************
Poker Spirit (c) 1992 Taito
@ -48,6 +48,8 @@ Video PCB:
#include "sound/okim6295.h"
#include "sound/ymopn.h"
#include "taitoio_opto.h"
#include "emupal.h"
#include "screen.h"
#include "speaker.h"
@ -59,14 +61,15 @@ namespace {
class pkspirit_state : public driver_device
{
public:
pkspirit_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_mainio(*this, "mainio"),
m_gfxdecode(*this, "gfxdecode"),
m_bg_videoram(*this, "bg_videoram"),
m_fg_videoram(*this, "fg_videoram"),
m_audiobank(*this, "audiobank")
pkspirit_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
, m_mainio(*this, "mainio")
, m_gfxdecode(*this, "gfxdecode")
, m_bg_videoram(*this, "bg_videoram")
, m_fg_videoram(*this, "fg_videoram")
, m_audiobank(*this, "audiobank")
, m_opto(*this, "opto%u", 1U)
{ }
void pkspirit(machine_config &config);
@ -84,6 +87,8 @@ private:
required_shared_ptr<uint16_t> m_fg_videoram;
required_memory_bank m_audiobank;
required_device_array<taitoio_opto_device, 2> m_opto;
tilemap_t *m_bg_tilemap = nullptr;
tilemap_t *m_fg_tilemap = nullptr;
@ -180,8 +185,12 @@ void pkspirit_state::sound_map(address_map &map) // TODO: verify everything
// TODO: verify some of these labels means anything in normal English, remap accordingly
// TODO: Opto labels are supposedly coin chutes
static INPUT_PORTS_START( pkspirit )
PORT_START("COIN")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_WRITE_LINE_DEVICE_MEMBER("opto1", taitoio_opto_device, coin_sense_w)
// FIXME: check error triggered if pressed for too long once video emulation is better
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_WRITE_LINE_DEVICE_MEMBER("opto2", taitoio_opto_device, coin_sense_w)
PORT_START("IN1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_NAME("1 Bet SW")
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Duabet SW")
@ -189,8 +198,8 @@ static INPUT_PORTS_START( pkspirit )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) PORT_NAME("Deal/Draw SW") // "DE/DR"
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_D_UP ) PORT_NAME("Double SW")
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) PORT_NAME("Payout SW")
PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Opto2 (H)")
PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Opto2 (L)")
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("opto2", taitoio_opto_device, opto_h_r)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("opto2", taitoio_opto_device, opto_l_r)
PORT_START("IN2")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_POKER_HOLD1 )
@ -199,8 +208,8 @@ static INPUT_PORTS_START( pkspirit )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD4 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_HOLD5 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Opto1 (H)")
PORT_BIT (0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Opto1 (L)")
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("opto1", taitoio_opto_device, opto_h_r)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("opto1", taitoio_opto_device, opto_l_r)
PORT_START("IN3")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Reset Key")
@ -264,6 +273,7 @@ static INPUT_PORTS_START( pkspirit )
PORT_DIPNAME( 0x4000, 0x4000, "Bell" ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x4000, DEF_STR( On ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
// debug/cheat option
PORT_DIPNAME( 0x8000, 0x8000, "Credit Pool 500" ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x8000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
@ -305,6 +315,9 @@ void pkspirit_state::pkspirit(machine_config &config)
m_mainio->in_port3_cb().set_ioport("IN3");
m_mainio->in_port4_cb().set_ioport("IN4");
for (auto & opto : m_opto)
TAITOIO_OPTO(config, opto, 0);
// video hardware
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); // TODO: wrong
screen.set_refresh_hz(60);

View File

@ -53,6 +53,8 @@ Notes:
#include "machine/watchdog.h"
#include "sound/ymopn.h"
#include "taitoio_opto.h"
#include "emupal.h"
#include "screen.h"
#include "speaker.h"
@ -71,7 +73,8 @@ public:
m_screen(*this, "screen"),
m_palette(*this, "palette"),
m_nvram(*this, "nvram"),
m_io_in(*this, "IN%u", 0U)
m_io_in(*this, "IN%u", 0U),
m_opto(*this, "opto%u", 1U)
{ }
void parentj(machine_config &config);
@ -86,6 +89,7 @@ private:
required_device<nvram_device> m_nvram;
required_ioport_array<2> m_io_in;
required_device_array<taitoio_opto_device, 2> m_opto;
u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(interrupt);
@ -140,18 +144,20 @@ void taitoo_state::prg_map(address_map &map)
map(0x100000, 0x10ffff).mirror(0x010000).ram().share("nvram");
// Unknown, definitely not TC0220IOC
map(0x200000, 0x200001).portr("IN0").lw16(
NAME([this] (offs_t offset, u16 data, u16 mem_mask) {
if (ACCESSING_BITS_8_15)
machine().bookkeeping().coin_lockout_w(0, !BIT(data, 11));
NAME([] (offs_t offset, u16 data, u16 mem_mask) {
//if (ACCESSING_BITS_8_15) {
// TODO: custom signal to opto's (will block input trigger in service mode)
// machine().bookkeeping().coin_lockout_w(0, !BIT(data, 11));
// }
// BIT(data, 10); goes high when "coin in reversed" is detected,
// denoted as "bell" in eibise
// denoted as "bell" in eibise (physical one?)
// m_hopper_io = BIT(data, 9);
})
);
map(0x200002, 0x200003).portr("IN1").lw16(
NAME([] (offs_t offset, u16 data, u16 mem_mask) {
// m_hop_stop_coil = BIT(data, 14);
// m_divider = BIT(data, 12); active low
// m_coin_divider = BIT(data, 12); active low
// lamps & 0x370f
// \- bet & 0x000f, not present in eibise
// \- deal & 0x1000
@ -165,6 +171,11 @@ void taitoo_state::prg_map(address_map &map)
}
static INPUT_PORTS_START( parentj )
PORT_START("COIN")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_WRITE_LINE_DEVICE_MEMBER("opto1", taitoio_opto_device, coin_sense_w)
// FIXME: never triggers
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_WRITE_LINE_DEVICE_MEMBER("opto2", taitoio_opto_device, coin_sense_w)
PORT_START("IN0")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_POKER_HOLD1 ) PORT_NAME("Bet 1")
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_POKER_HOLD2 ) PORT_NAME("Bet 2")
@ -180,13 +191,13 @@ static INPUT_PORTS_START( parentj )
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Reset Key")
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_NAME("Last Key")
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_SERVICE3 ) PORT_NAME("Meter Key")
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Opto 1H")
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Opto 1L")
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("opto1", taitoio_opto_device, opto_h_r)
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("opto1", taitoio_opto_device, opto_l_r)
PORT_START("IN1")
PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Hopper Over") // "Hop Over"?
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Opto 2H")
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Opto 2L")
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("opto2", taitoio_opto_device, opto_h_r)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("opto2", taitoio_opto_device, opto_l_r)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_SERVICE4 ) PORT_NAME("All Clear SW")
PORT_SERVICE_NO_TOGGLE(0x0010, IP_ACTIVE_LOW )
PORT_BIT( 0x00e0, IP_ACTIVE_LOW, IPT_UNKNOWN )
@ -231,6 +242,10 @@ static INPUT_PORTS_START( parentj )
INPUT_PORTS_END
static INPUT_PORTS_START( eibise )
PORT_START("COIN")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_WRITE_LINE_DEVICE_MEMBER("opto1", taitoio_opto_device, coin_sense_w)
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_WRITE_LINE_DEVICE_MEMBER("opto2", taitoio_opto_device, coin_sense_w)
PORT_START("IN0")
PORT_BIT( 0x001f, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) PORT_NAME("Payout Button")
@ -242,13 +257,13 @@ static INPUT_PORTS_START( eibise )
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Reset Key")
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_NAME("Last Key")
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_SERVICE3 ) PORT_NAME("Meter Key")
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Opto 1H")
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Opto 1L")
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("opto1", taitoio_opto_device, opto_h_r)
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("opto1", taitoio_opto_device, opto_l_r)
PORT_START("IN1")
PORT_BIT (0x0001, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Hopper Over") // "Hop Over"?
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Opto 2H")
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Opto 2L")
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("opto2", taitoio_opto_device, opto_h_r)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("opto2", taitoio_opto_device, opto_l_r)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_SERVICE4 ) PORT_NAME("All Clear SW")
PORT_SERVICE_NO_TOGGLE(0x0010, IP_ACTIVE_LOW )
PORT_BIT( 0x00e0, IP_ACTIVE_LOW, IPT_UNKNOWN )
@ -332,6 +347,9 @@ void taitoo_state::parentj(machine_config &config)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
for (auto & opto : m_opto)
TAITOIO_OPTO(config, opto, 0);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_refresh_hz(60);
m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500));

View File

@ -8,6 +8,7 @@ Detects coin weight tied to a non-JAMMA harness.
Parent Jack pinout has two input pins, labeled "in medal sen(sor?)" and "coin drop".
Used by Taito gambling/medal games:
- taito/cchance.cpp
- taito/pkspirit.cpp
- taito/sbmjb.cpp
- taito/taito_o.cpp