Previous 199869 Revisions Next

r18187 Friday 28th September, 2012 at 10:07:15 UTC by Robbbert
SPECTRA - added inputs and mech sounds
[src/mame/drivers]spectra.c

trunk/src/mame/drivers/spectra.c
r18186r18187
6161
6262static INPUT_PORTS_START( spectra )
6363   PORT_START("X0")
64   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER)
65   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER)
66   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER)
67   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER)
68   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER)
69   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER)
70   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER)
71   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER)
64   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Outhole") PORT_CODE(KEYCODE_X)
65   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Outlane 1") PORT_CODE(KEYCODE_W)
66   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("CR Hole") PORT_CODE(KEYCODE_E)
67   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("TR Hole") PORT_CODE(KEYCODE_R)
68   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Bumper") PORT_CODE(KEYCODE_Y)
69   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("C Bumper") PORT_CODE(KEYCODE_U)
70   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Bumper") PORT_CODE(KEYCODE_I)
71   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Triangle") PORT_CODE(KEYCODE_O)
7272   PORT_START("X1")
73   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER)
74   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER)
75   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER)
76   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER)
77   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER)
78   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER)
79   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER)
80   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER)
73   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Triangle") PORT_CODE(KEYCODE_A)
74   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Outlane") PORT_CODE(KEYCODE_S)
75   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Rollover") PORT_CODE(KEYCODE_D)
76   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Rollover") PORT_CODE(KEYCODE_F)
77   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Inside Target") PORT_CODE(KEYCODE_G)
78   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("C Inside Target") PORT_CODE(KEYCODE_H)
79   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Inside Target") PORT_CODE(KEYCODE_J)
80   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("CL Target") PORT_CODE(KEYCODE_K)
8181   PORT_START("X2")
82   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER)
83   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER)
84   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER)
85   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER)
86   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER)
87   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER)
88   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER)
89   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER)
82   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("CL Button") PORT_CODE(KEYCODE_Z)
83   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("TL Button") PORT_CODE(KEYCODE_Q)
84   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("TL Target") PORT_CODE(KEYCODE_C)
85   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Outlane 2") PORT_CODE(KEYCODE_V)
86   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Outlane 3") PORT_CODE(KEYCODE_B)
87   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Pentagon") PORT_CODE(KEYCODE_N)
88   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Pentagon") PORT_CODE(KEYCODE_M)
89   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("TL Area") PORT_CODE(KEYCODE_COMMA)
9090   PORT_START("X3")
91   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER)
92   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER)
93   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER)
91   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("L Area") PORT_CODE(KEYCODE_STOP)
92   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("R Area") PORT_CODE(KEYCODE_SLASH)
93   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Inlane Button") PORT_CODE(KEYCODE_L)
9494   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_COIN1)
9595   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_START1)
9696   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_TILT)
r18186r18187
108108READ8_MEMBER( spectra_state::porta_r )
109109{
110110   char kbdrow[6];
111   UINT8 key=0, old=0, ret=0;
111112   sprintf(kbdrow,"X%X",(m_porta & 0x18) >> 3);
112   UINT8 data = ioport(kbdrow)->read();
113   return ((BIT(data, m_porta & 7)) ? 0x40 : 0) | (m_porta & 0xbf);
113   key = ioport(kbdrow)->read();
114   ret = ((BIT(key, m_porta & 7)) ? 0x40 : 0) | (m_porta & 0xbf);
115
116   if (ret == 0x1b && old != ret && m_p_ram[0x7b] < 0x1E)
117      m_samples->start(2, 4); // coin
118   old = ret;
119
120   return ret;
114121}
115122
116123READ8_MEMBER( spectra_state::portb_r )
r18186r18187
144151
145152TIMER_DEVICE_CALLBACK_MEMBER( spectra_state::nmitimer)
146153{
147   if (m_t_c > 0x80)
154   if (m_t_c > 0x10)
148155      m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
149156   else
150157      m_t_c++;
r18186r18187
165172      output_set_digit_value(m_out_offs, segments);
166173   }
167174   else
175   if (m_out_offs < 0x6f)
176      m_out_offs = 0x6f;
177   else
178   if (m_out_offs < 0x74)
179   {
180      if (m_p_ram[m_out_offs])
181         m_samples->start(0, 5); // holes
182   }
183   else
184   if (m_out_offs < 0x77)
185   {
186      if (m_p_ram[m_out_offs])
187         m_samples->start(1, 0); // bumpers
188   }
189   else
168190      m_out_offs = 0xff;
169191}
170192

Previous 199869 Revisions Next


© 1997-2024 The MAME Team