SPECTRA - added inputs and mech sounds

This commit is contained in:
Robbbert 2012-09-28 10:07:15 +00:00
parent 8701f68d97
commit ffa3dc7cfc

View File

@ -61,36 +61,36 @@ ADDRESS_MAP_END
static INPUT_PORTS_START( spectra )
PORT_START("X0")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Outhole") PORT_CODE(KEYCODE_X)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Outlane 1") PORT_CODE(KEYCODE_W)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("CR Hole") PORT_CODE(KEYCODE_E)
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("TR Hole") PORT_CODE(KEYCODE_R)
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Bumper") PORT_CODE(KEYCODE_Y)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("C Bumper") PORT_CODE(KEYCODE_U)
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Bumper") PORT_CODE(KEYCODE_I)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Triangle") PORT_CODE(KEYCODE_O)
PORT_START("X1")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Triangle") PORT_CODE(KEYCODE_A)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Outlane") PORT_CODE(KEYCODE_S)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Rollover") PORT_CODE(KEYCODE_D)
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Rollover") PORT_CODE(KEYCODE_F)
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Inside Target") PORT_CODE(KEYCODE_G)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("C Inside Target") PORT_CODE(KEYCODE_H)
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Inside Target") PORT_CODE(KEYCODE_J)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("CL Target") PORT_CODE(KEYCODE_K)
PORT_START("X2")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("CL Button") PORT_CODE(KEYCODE_Z)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("TL Button") PORT_CODE(KEYCODE_Q)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("TL Target") PORT_CODE(KEYCODE_C)
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Outlane 2") PORT_CODE(KEYCODE_V)
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Outlane 3") PORT_CODE(KEYCODE_B)
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Pentagon") PORT_CODE(KEYCODE_N)
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Pentagon") PORT_CODE(KEYCODE_M)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("TL Area") PORT_CODE(KEYCODE_COMMA)
PORT_START("X3")
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER)
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Area") PORT_CODE(KEYCODE_STOP)
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Area") PORT_CODE(KEYCODE_SLASH)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Inlane Button") PORT_CODE(KEYCODE_L)
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_COIN1)
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_START1)
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_TILT)
@ -108,9 +108,16 @@ void spectra_state::machine_reset()
READ8_MEMBER( spectra_state::porta_r )
{
char kbdrow[6];
UINT8 key=0, old=0, ret=0;
sprintf(kbdrow,"X%X",(m_porta & 0x18) >> 3);
UINT8 data = ioport(kbdrow)->read();
return ((BIT(data, m_porta & 7)) ? 0x40 : 0) | (m_porta & 0xbf);
key = ioport(kbdrow)->read();
ret = ((BIT(key, m_porta & 7)) ? 0x40 : 0) | (m_porta & 0xbf);
if (ret == 0x1b && old != ret && m_p_ram[0x7b] < 0x1E)
m_samples->start(2, 4); // coin
old = ret;
return ret;
}
READ8_MEMBER( spectra_state::portb_r )
@ -144,7 +151,7 @@ static const riot6532_interface riot6532_intf =
TIMER_DEVICE_CALLBACK_MEMBER( spectra_state::nmitimer)
{
if (m_t_c > 0x80)
if (m_t_c > 0x10)
m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
else
m_t_c++;
@ -164,6 +171,21 @@ TIMER_DEVICE_CALLBACK_MEMBER( spectra_state::outtimer)
UINT8 segments = patterns[data&15] | (BIT(data, 4) ? 0x80 : 0);
output_set_digit_value(m_out_offs, segments);
}
else
if (m_out_offs < 0x6f)
m_out_offs = 0x6f;
else
if (m_out_offs < 0x74)
{
if (m_p_ram[m_out_offs])
m_samples->start(0, 5); // holes
}
else
if (m_out_offs < 0x77)
{
if (m_p_ram[m_out_offs])
m_samples->start(1, 0); // bumpers
}
else
m_out_offs = 0xff;
}