Merge pull request #1355 from ajrhacker/big10_inputs

big10: Various modest input/output improvements
This commit is contained in:
Vas Crabb 2016-09-01 14:53:53 +10:00 committed by GitHub
commit 8f0c90af03
2 changed files with 67 additions and 63 deletions

View File

@ -239,6 +239,7 @@ has twice the steps, happening twice as fast.
*************************************/ *************************************/
#define ENABLE_REGISTER_TEST (0) /* Enable preprogrammed registers */ #define ENABLE_REGISTER_TEST (0) /* Enable preprogrammed registers */
#define LOG_IGNORED_WRITES (0)
#define MAX_OUTPUT 0x7fff #define MAX_OUTPUT 0x7fff
@ -650,11 +651,13 @@ void ay8910_device::ay8910_write_reg(int r, int v)
if (!m_port_a_write_cb.isnull()) if (!m_port_a_write_cb.isnull())
m_port_a_write_cb((offs_t)0, m_regs[AY_PORTA]); m_port_a_write_cb((offs_t)0, m_regs[AY_PORTA]);
else else
logerror("warning - write %02x to 8910 '%s' Port A\n",m_regs[AY_PORTA],tag()); logerror("warning - write %02x to 8910 Port A\n", m_regs[AY_PORTA]);
} }
else else
{ {
logerror("warning: write to 8910 '%s' Port A set as input - ignored\n",tag()); #if LOG_IGNORED_WRITES
logerror("warning: write %02x to 8910 Port A set as input - ignored\n", v);
#endif
} }
break; break;
case AY_PORTB: case AY_PORTB:
@ -663,11 +666,13 @@ void ay8910_device::ay8910_write_reg(int r, int v)
if (!m_port_b_write_cb.isnull()) if (!m_port_b_write_cb.isnull())
m_port_b_write_cb((offs_t)0, m_regs[AY_PORTB]); m_port_b_write_cb((offs_t)0, m_regs[AY_PORTB]);
else else
logerror("warning - write %02x to 8910 '%s' Port B\n",m_regs[AY_PORTB],tag()); logerror("warning - write %02x to 8910 Port B\n", m_regs[AY_PORTB]);
} }
else else
{ {
logerror("warning: write to 8910 '%s' Port B set as input - ignored\n",tag()); #if LOG_IGNORED_WRITES
logerror("warning: write %02x to 8910 Port B set as input - ignored\n", v);
#endif
} }
break; break;
} }
@ -997,7 +1002,7 @@ int ay8910_device::ay8910_read_ym()
{ {
case AY_PORTA: case AY_PORTA:
if ((m_regs[AY_ENABLE] & 0x40) != 0) if ((m_regs[AY_ENABLE] & 0x40) != 0)
logerror("warning: read from 8910 '%s' Port A set as output\n",tag()); logerror("%s: warning - read from 8910 '%s' Port A set as output\n", machine().describe_context());
/* /*
even if the port is set as output, we still need to return the external even if the port is set as output, we still need to return the external
data. Some games, like kidniki, need this to work. data. Some games, like kidniki, need this to work.
@ -1011,15 +1016,15 @@ int ay8910_device::ay8910_read_ym()
if (!m_port_a_read_cb.isnull()) if (!m_port_a_read_cb.isnull())
m_regs[AY_PORTA] = m_port_a_read_cb(0); m_regs[AY_PORTA] = m_port_a_read_cb(0);
else else
logerror("%s: warning - read 8910 '%s' Port A\n",machine().describe_context(),tag()); logerror("%s: warning - read 8910 Port A\n", machine().describe_context());
break; break;
case AY_PORTB: case AY_PORTB:
if ((m_regs[AY_ENABLE] & 0x80) != 0) if ((m_regs[AY_ENABLE] & 0x80) != 0)
logerror("warning: read from 8910 '%s' Port B set as output\n",tag()); logerror("%s: warning - read from 8910 Port B set as output\n", machine().describe_context());
if (!m_port_b_read_cb.isnull()) if (!m_port_b_read_cb.isnull())
m_regs[AY_PORTB] = m_port_b_read_cb(0); m_regs[AY_PORTB] = m_port_b_read_cb(0);
else else
logerror("%s: warning - read 8910 '%s' Port B\n",machine().describe_context(),tag()); logerror("%s: warning - read 8910 Port B\n", machine().describe_context());
break; break;
} }

View File

@ -63,6 +63,7 @@
#include "sound/ay8910.h" #include "sound/ay8910.h"
#include "video/v9938.h" #include "video/v9938.h"
#include "machine/nvram.h" #include "machine/nvram.h"
#include "machine/ticket.h"
class big10_state : public driver_device class big10_state : public driver_device
@ -72,35 +73,24 @@ public:
: driver_device(mconfig, type, tag) : driver_device(mconfig, type, tag)
, m_v9938(*this, "v9938") , m_v9938(*this, "v9938")
, m_maincpu(*this, "maincpu") , m_maincpu(*this, "maincpu")
, m_in1(*this, "IN1") , m_hopper(*this, "hopper")
, m_in2(*this, "IN2") , m_in(*this, "IN%u", 1)
, m_in3(*this, "IN3")
{ } { }
required_device<v9938_device> m_v9938; required_device<v9938_device> m_v9938;
UINT8 m_mux_data; UINT8 m_mux_data;
DECLARE_READ8_MEMBER(mux_r); DECLARE_READ8_MEMBER(mux_r);
DECLARE_WRITE8_MEMBER(mux_w); DECLARE_WRITE8_MEMBER(mux_w);
virtual void machine_reset() override;
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_ioport m_in1; required_device<ticket_dispenser_device> m_hopper;
required_ioport m_in2; required_ioport_array<6> m_in;
required_ioport m_in3;
}; };
#define HOPPER_PULSE 40 // time between hopper pulses in milliseconds
#define VDP_MEM 0x40000 #define VDP_MEM 0x40000
/*************************************
* Machine Reset *
*************************************/
void big10_state::machine_reset()
{
}
/**************************************** /****************************************
* Input Ports Demux & Common Routines * * Input Ports Demux & Common Routines *
****************************************/ ****************************************/
@ -109,18 +99,18 @@ void big10_state::machine_reset()
WRITE8_MEMBER(big10_state::mux_w) WRITE8_MEMBER(big10_state::mux_w)
{ {
m_mux_data = ~data; m_mux_data = ~data;
m_hopper->write(space, 0, (data & 0x40) << 1);
machine().output().set_lamp_value(1, BIT(~data, 7)); // maybe a coin counter?
} }
READ8_MEMBER(big10_state::mux_r) READ8_MEMBER(big10_state::mux_r)
{ {
switch(m_mux_data) UINT8 result = 0xff;
{ for (int b = 0; b < 6; b++)
case 1: return m_in1->read(); if (BIT(m_mux_data, b))
case 2: return m_in2->read(); result &= m_in[b]->read();
case 4: return m_in3->read();
}
return m_mux_data; return result;
} }
@ -151,9 +141,9 @@ ADDRESS_MAP_END
static INPUT_PORTS_START( big10 ) static INPUT_PORTS_START( big10 )
PORT_START("SYSTEM") PORT_START("SYSTEM")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_TOGGLE /* Service Mode */ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) PORT_NAME("Analyze Mode") PORT_TOGGLE
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_R) PORT_NAME("Reset") PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MEMORY_RESET )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_W) PORT_NAME("Payout") PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // in test mode, go to the game whilst keep pressed. PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // in test mode, go to the game whilst keep pressed.
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // in test mode, go to the game whilst keep pressed. PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // in test mode, go to the game whilst keep pressed.
@ -161,46 +151,53 @@ static INPUT_PORTS_START( big10 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_IMPULSE(2) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_IMPULSE(2)
PORT_START("IN1") PORT_START("IN1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("Number 0") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("Number 0")
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("Number 1") PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("Number 1")
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("Number 2") PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("Number 2")
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("Number 3") PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("Number 3")
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON11 ) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("Number 4") PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("Number 4")
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON12 ) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("Number 5") PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("Number 5")
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON13 ) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("Number 6") PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("Number 6")
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON14 ) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("Number 7") PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("Number 7")
PORT_START("IN2") PORT_START("IN2")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON15 ) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("Number 8") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("Number 8")
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON16 ) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("Number 9") PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("Number 9")
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_F) PORT_NAME("Flip Flop") PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_F) PORT_NAME("Flip Flop")
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Select") PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("Select")
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_Z) PORT_NAME("Select 10") PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_Z) PORT_NAME("Select 10")
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("Cancel All") PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("Cancel All")
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_2) PORT_NAME("Start") PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("Start")
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_1) PORT_NAME("Bet") PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_BET )
PORT_START("IN3") PORT_START("IN3")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_3) PORT_NAME("Double Up") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_D_UP )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_CODE(KEYCODE_4) PORT_NAME("Take Score") PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_TAKE )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_CODE(KEYCODE_A) PORT_NAME("Big") PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_GAMBLE_HIGH ) PORT_NAME("Big")
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_CODE(KEYCODE_S) PORT_NAME("Small") PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_LOW ) PORT_NAME("Small")
PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // in test mode triggers a sound and screen turns black, hanging the game. PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // in test mode triggers a sound and screen turns black, hanging the game.
PORT_START("IN4")
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("IN5")
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("IN6")
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("DSW1") PORT_START("DSW1")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:8") PORT_DIPNAME( 0x03, 0x03, "Credit Limit?" ) PORT_DIPLOCATION("DSW1:8,7")
PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, "500" )
PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPSETTING( 0x01, "1000" )
PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:7") PORT_DIPSETTING( 0x02, "3000" )
PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x03, "9999" )
PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x0c, 0x0c, "Unknown" ) PORT_DIPLOCATION("DSW1:6,5") // $C17E
PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:6") PORT_DIPSETTING( 0x00, "0" )
PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x04, "1" )
PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPSETTING( 0x08, "2" )
PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DSW1:5") PORT_DIPSETTING( 0x0c, "3" )
PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x30, 0x30, "Main Game Rate" ) PORT_DIPLOCATION("DSW1:4,3") PORT_DIPNAME( 0x30, 0x30, "Main Game Rate" ) PORT_DIPLOCATION("DSW1:4,3")
PORT_DIPSETTING( 0x00, "60%" ) PORT_DIPSETTING( 0x00, "60%" )
PORT_DIPSETTING( 0x10, "70%" ) PORT_DIPSETTING( 0x10, "70%" )
@ -243,6 +240,8 @@ static MACHINE_CONFIG_START( big10, big10_state )
MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSW1")) MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSW1"))
MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(big10_state, mux_w)) MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(big10_state, mux_w))
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
MCFG_TICKET_DISPENSER_ADD("hopper", attotime::from_msec(HOPPER_PULSE), TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_LOW )
MACHINE_CONFIG_END MACHINE_CONFIG_END