Previous 199869 Revisions Next

r36291 Friday 6th March, 2015 at 19:18:26 UTC by hap
alnattck i/o
[src/mess/drivers]hh_hmcs40.c

trunk/src/mess/drivers/hh_hmcs40.c
r244802r244803
3131
3232   // devices
3333   required_device<cpu_device> m_maincpu;
34   optional_ioport_array<3> m_inp_matrix; // max 3
34   optional_ioport_array<7> m_inp_matrix; // max 7
3535   optional_device<speaker_sound_device> m_speaker;
3636   
3737   // misc common
3838   UINT16 m_inp_mux;
3939
40   UINT8 read_inputs(int columns);
40   UINT16 read_inputs(int columns);
4141
4242   virtual void machine_start();
4343
r244802r244803
5959   void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety);
6060
6161   // game-specific handlers
62   DECLARE_WRITE8_MEMBER(alnattck_plate_w);
63   DECLARE_READ16_MEMBER(alnattck_d_r);
64   DECLARE_WRITE16_MEMBER(alnattck_d_w);
6265};
6366
6467
r244802r244803
160163}
161164
162165
163UINT8 hh_hmcs40_state::read_inputs(int columns)
166UINT16 hh_hmcs40_state::read_inputs(int columns)
164167{
165   UINT8 ret = 0;
168   UINT16 ret = 0;
166169
167170   // read selected input rows
168171   for (int i = 0; i < columns; i++)
r244802r244803
190193
191194***************************************************************************/
192195
196WRITE8_MEMBER(hh_hmcs40_state::alnattck_plate_w)
197{
198   // R0x-R3x, D0-D3: vfd matrix plate
199   int shift = offset * 4;
200   m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
201
202   // update display
203   UINT32 plate = BITSWAP16((UINT16)m_plate,11,9,8,10,7,2,0,1,3,4,5,6,12,13,14,15) | (m_plate & 0xf0000);
204   
205   display_matrix(20, 10, plate, m_grid);
206}
207
208READ16_MEMBER(hh_hmcs40_state::alnattck_d_r)
209{
210   // D5: inputs
211   return (offset == 5) ? (read_inputs(7) << 5 & 0x20) : 0;
212}
213
214WRITE16_MEMBER(hh_hmcs40_state::alnattck_d_w)
215{
216   // D4: speaker out
217   m_speaker->level_w(data >> 4 & 1);
218   
219   // D7-D13: input mux
220   m_inp_mux = data >> 7 & 0x7f;
221
222   // D6-D15: vfd matrix grid
223   m_grid = data >> 6 & 0x3ff;
224   
225   // D0-D3: plate 16-19 (update display there)
226   alnattck_plate_w(space, 4, data & 0xf);
227}
228
229
193230static INPUT_PORTS_START( alnattck )
231   PORT_START("IN.0") // D5 D7
232   PORT_CONFNAME( 0x01, 0x00, "Skill" )
233   PORT_CONFSETTING(    0x00, "1" )
234   PORT_CONFSETTING(    0x01, "2" )
235
236   PORT_START("IN.1") // D5 D8
237   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )
238
239   PORT_START("IN.2") // D5 D9
240   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )
241
242   PORT_START("IN.3") // D5 D10
243   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )
244
245   PORT_START("IN.4") // D5 D11
246   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )
247
248   PORT_START("IN.5") // D5 D12
249   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Move")
250
251   PORT_START("IN.6") // D5 D13
252   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Fire")
194253INPUT_PORTS_END
195254
196255
r244802r244803
199258   /* basic machine hardware */
200259   MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation - RC osc.
201260
202//   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1))
261   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1))
203262   MCFG_DEFAULT_LAYOUT(layout_alnattck)
204263
205264   /* no video! */


Previous 199869 Revisions Next


© 1997-2024 The MAME Team