Previous 199869 Revisions Next

r36352 Tuesday 10th March, 2015 at 00:07:18 UTC by hap
added ssfball and splasfgt i/o
[src/mess/drivers]hh_ucom4.c

trunk/src/mess/drivers/hh_ucom4.c
r244863r244864
4949
5050   // devices
5151   required_device<cpu_device> m_maincpu;
52   optional_ioport_array<3> m_inp_matrix; // max 3
52   optional_ioport_array<5> m_inp_matrix; // max 5
5353   optional_device<speaker_sound_device> m_speaker;
5454   
5555   // misc common
56   UINT8 m_port[9];
5657   UINT16 m_inp_mux;
5758
5859   UINT8 read_inputs(int columns);
r244863r244864
7778   void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety);
7879
7980   // game-specific handlers
81   void ssfball_display();
82   DECLARE_READ8_MEMBER(ssfball_input_b_r);
83   DECLARE_WRITE8_MEMBER(ssfball_grid_w);
84   DECLARE_WRITE8_MEMBER(ssfball_plate_w);
85
86   void splasfgt_display();
87   DECLARE_READ8_MEMBER(splasfgt_input_b_r);
88   DECLARE_WRITE8_MEMBER(splasfgt_grid_w);
89   DECLARE_WRITE8_MEMBER(splasfgt_plate_w);
90
8091   DECLARE_WRITE8_MEMBER(edracula_grid_w);
8192   DECLARE_WRITE8_MEMBER(edracula_plate_w);
82   DECLARE_WRITE8_MEMBER(edracula_port_i_w);
8393   
8494   DECLARE_READ8_MEMBER(tmtennis_input_r);
8595   DECLARE_WRITE8_MEMBER(tmtennis_grid_w);
r244863r244864
92102   void tmpacman_display();
93103   DECLARE_WRITE8_MEMBER(tmpacman_grid_w);
94104   DECLARE_WRITE8_MEMBER(tmpacman_plate_w);
95   DECLARE_WRITE8_MEMBER(tmpacman_port_e_w);
96105   
97106   DECLARE_READ8_MEMBER(alnchase_input_r);
98   DECLARE_WRITE8_MEMBER(alnchase_display_w);
99   DECLARE_WRITE8_MEMBER(alnchase_port_e_w);
107   DECLARE_WRITE8_MEMBER(alnchase_output_w);
100108};
101109
102110
r244863r244864
108116   memset(m_display_decay, 0, sizeof(m_display_decay));
109117   memset(m_7seg_mask, 0, sizeof(m_7seg_mask));
110118   
119   memset(m_port, 0, sizeof(m_port));
111120   m_inp_mux = 0;
112121   m_grid = 0;
113122   m_plate = 0;
r244863r244864
122131   save_item(NAME(m_display_decay));
123132   save_item(NAME(m_7seg_mask));
124133
134   save_item(NAME(m_port));
125135   save_item(NAME(m_inp_mux));
126136   save_item(NAME(m_grid));
127137   save_item(NAME(m_plate));
r244863r244864
229239
230240***************************************************************************/
231241
242void hh_ucom4_state::ssfball_display()
243{
244   UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,11,7,3,12,17,13,18,16,14,15,10,9,8,0,1,2,4,5,6);
245   display_matrix(16, 9, plate, m_grid);
246}
247
248READ8_MEMBER(hh_ucom4_state::ssfball_input_b_r)
249{
250   // B: input port 2, where B3 is multiplexed
251   return m_inp_matrix[2]->read() | read_inputs(2);
252}
253
254WRITE8_MEMBER(hh_ucom4_state::ssfball_grid_w)
255{
256   // C,D(,E): vfd matrix grid 0-7(,8)
257   int shift = (offset - NEC_UCOM4_PORTC) * 4;
258   m_grid = (m_grid & ~(0xf << shift)) | (data << shift);
259
260   ssfball_display();
261}
262
263WRITE8_MEMBER(hh_ucom4_state::ssfball_plate_w)
264{
265   m_port[offset] = data;
266   
267   // E,F,G,H,I(not all!): vfd matrix plate
268   int shift = (offset - NEC_UCOM4_PORTE) * 4;
269   m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
270   
271   // F3,G3: input mux + speaker
272   m_inp_mux = (m_port[NEC_UCOM4_PORTF] >> 3 & 1) | (m_port[NEC_UCOM4_PORTG] >> 2 & 2);
273   m_speaker->level_w(m_inp_mux);
274   
275   // E3: vfd matrix grid 8
276   if (offset == NEC_UCOM4_PORTE)
277      ssfball_grid_w(space, offset, data >> 3 & 1);
278   else
279      ssfball_display();
280}
281
282
232283static INPUT_PORTS_START( ssfball )
284   PORT_START("IN.0") // F3 port B3
285   PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_UNUSED )
286   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON8 )
287
288   PORT_START("IN.1") // G3 port B3
289   PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_UNUSED )
290   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON9 )
291
292   PORT_START("IN.2") // port B
293   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON5 )
294   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON6 )
295   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON7 )
296   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) // multiplexed, handled in ssfball_input_b_r
297
298   PORT_START("IN.3") // port A
299   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )
300   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 )
301   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 )
302   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 )
233303INPUT_PORTS_END
234304
235305
306static const INT16 ssfball_speaker_levels[] = { 0, 32767, -32768, 0 };
307
236308static MACHINE_CONFIG_START( ssfball, hh_ucom4_state )
237309
238310   /* basic machine hardware */
239311   MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_400kHz)
312   MCFG_UCOM4_READ_A_CB(IOPORT("IN.3"))
313   MCFG_UCOM4_READ_B_CB(READ8(hh_ucom4_state, ssfball_input_b_r))
314   MCFG_UCOM4_WRITE_C_CB(WRITE8(hh_ucom4_state, ssfball_grid_w))
315   MCFG_UCOM4_WRITE_D_CB(WRITE8(hh_ucom4_state, ssfball_grid_w))
316   MCFG_UCOM4_WRITE_E_CB(WRITE8(hh_ucom4_state, ssfball_plate_w))
317   MCFG_UCOM4_WRITE_F_CB(WRITE8(hh_ucom4_state, ssfball_plate_w))
318   MCFG_UCOM4_WRITE_G_CB(WRITE8(hh_ucom4_state, ssfball_plate_w))
319   MCFG_UCOM4_WRITE_H_CB(WRITE8(hh_ucom4_state, ssfball_plate_w))
320   MCFG_UCOM4_WRITE_I_CB(WRITE8(hh_ucom4_state, ssfball_plate_w))
240321
241//   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1))
322   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1))
242323   MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test)
243324
244325   /* no video! */
r244863r244864
246327   /* sound hardware */
247328   MCFG_SPEAKER_STANDARD_MONO("mono")
248329   MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
330   MCFG_SPEAKER_LEVELS(4, ssfball_speaker_levels)
249331   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
250332MACHINE_CONFIG_END
251333
r244863r244864
264346
265347***************************************************************************/
266348
349void hh_ucom4_state::splasfgt_display()
350{
351   UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,18,17,13,1,0,8,6,0,10,11,14,15,16,9,5,7,4,2,3);
352   display_matrix(16, 9, plate, m_grid);
353}
354
355READ8_MEMBER(hh_ucom4_state::splasfgt_input_b_r)
356{
357   // B: multiplexed buttons
358   return read_inputs(4);
359}
360
361WRITE8_MEMBER(hh_ucom4_state::splasfgt_grid_w)
362{
363   // G,H,I0: vfd matrix grid
364   int shift = (offset - NEC_UCOM4_PORTG) * 4;
365   m_grid = (m_grid & ~(0xf << shift)) | (data << shift);
366   
367   // G(grid 0-3): input mux
368   m_inp_mux = m_grid & 0xf;
369   
370   // I2: vfd matrix plate 6
371   if (offset == NEC_UCOM4_PORTI)
372      m_plate = (m_plate & 0xffff) | (data << 14 & 0x10000);
373
374   splasfgt_display();
375}
376
377WRITE8_MEMBER(hh_ucom4_state::splasfgt_plate_w)
378{
379   // C,D,E,F23: vfd matrix plate
380   int shift = (offset - NEC_UCOM4_PORTC) * 4;
381   m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
382   
383   // F01: speaker out
384   if (offset == NEC_UCOM4_PORTF)
385      m_speaker->level_w(data & 3);
386   
387   ssfball_display();
388}
389
390
267391static INPUT_PORTS_START( splasfgt )
392   PORT_START("IN.0") // G0 port B
393   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )
394   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 )
395   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 )
396   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
397
398   PORT_START("IN.1") // G1 port B
399   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 )
400   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON5 )
401   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON6 )
402   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
403
404   PORT_START("IN.2") // G2 port B
405   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON7 )
406   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON8 )
407   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON9 )
408   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
409
410   PORT_START("IN.3") // G3 port B
411   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON10 )
412   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON11 )
413   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON12 )
414   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
415
416   PORT_START("IN.4") // port A
417   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON13 )
418   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON14 )
419   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON15 ) // start
420   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
268421INPUT_PORTS_END
269422
270423
424static const INT16 splasfgt_speaker_levels[] = { 0, 32767, -32768, 0 };
425
271426static MACHINE_CONFIG_START( splasfgt, hh_ucom4_state )
272427
273428   /* basic machine hardware */
274429   MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_400kHz)
430   MCFG_UCOM4_READ_A_CB(IOPORT("IN.4"))
431   MCFG_UCOM4_READ_B_CB(READ8(hh_ucom4_state, splasfgt_input_b_r))
432   MCFG_UCOM4_WRITE_C_CB(WRITE8(hh_ucom4_state, splasfgt_plate_w))
433   MCFG_UCOM4_WRITE_D_CB(WRITE8(hh_ucom4_state, splasfgt_plate_w))
434   MCFG_UCOM4_WRITE_E_CB(WRITE8(hh_ucom4_state, splasfgt_plate_w))
435   MCFG_UCOM4_WRITE_F_CB(WRITE8(hh_ucom4_state, splasfgt_plate_w))
436   MCFG_UCOM4_WRITE_G_CB(WRITE8(hh_ucom4_state, splasfgt_grid_w))
437   MCFG_UCOM4_WRITE_H_CB(WRITE8(hh_ucom4_state, splasfgt_grid_w))
438   MCFG_UCOM4_WRITE_I_CB(WRITE8(hh_ucom4_state, splasfgt_grid_w))
275439
276//   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1))
440   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1))
277441   MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test)
278442
279443   /* no video! */
r244863r244864
281445   /* sound hardware */
282446   MCFG_SPEAKER_STANDARD_MONO("mono")
283447   MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
448   MCFG_SPEAKER_LEVELS(4, splasfgt_speaker_levels)
284449   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
285450MACHINE_CONFIG_END
286451
r244863r244864
315480
316481WRITE8_MEMBER(hh_ucom4_state::edracula_plate_w)
317482{
318   // E-H,I01: vfd matrix plate
483   // I2: speaker out
484   if (offset == NEC_UCOM4_PORTI)
485      m_speaker->level_w(data >> 2 & 1);
486
487   // E,F,G,H,I01: vfd matrix plate
319488   int shift = (offset - NEC_UCOM4_PORTE) * 4;
320489   m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
321490
322491   display_matrix(18, 8, m_plate, m_grid);
323492}
324493
325WRITE8_MEMBER(hh_ucom4_state::edracula_port_i_w)
326{
327   edracula_plate_w(space, offset, data & 3);
328494
329   // I2: speaker out
330   m_speaker->level_w(data >> 2 & 1);
331}
332
333
334495static INPUT_PORTS_START( edracula )
335496   PORT_START("IN.0") // port A
336497   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SELECT )
r244863r244864
358519   MCFG_UCOM4_WRITE_F_CB(WRITE8(hh_ucom4_state, edracula_plate_w))
359520   MCFG_UCOM4_WRITE_G_CB(WRITE8(hh_ucom4_state, edracula_plate_w))
360521   MCFG_UCOM4_WRITE_H_CB(WRITE8(hh_ucom4_state, edracula_plate_w))
361   MCFG_UCOM4_WRITE_I_CB(WRITE8(hh_ucom4_state, edracula_port_i_w))
522   MCFG_UCOM4_WRITE_I_CB(WRITE8(hh_ucom4_state, edracula_plate_w))
362523
363524   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1))
364525   MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test)
r244863r244864
395556
396557READ8_MEMBER(hh_ucom4_state::tmtennis_input_r)
397558{
398   // A,B: buttons
559   // A,B: multiplexed buttons
399560   return ~read_inputs(2) >> (offset*4);
400561}
401562
402563WRITE8_MEMBER(hh_ucom4_state::tmtennis_grid_w)
403564{
404   // G-I: vfd matrix grid
565   // G,H,I: vfd matrix grid
405566   int shift = (offset - NEC_UCOM4_PORTG) * 4;
406567   m_grid = (m_grid & ~(0xf << shift)) | (data << shift);
407568
r244863r244864
410571
411572WRITE8_MEMBER(hh_ucom4_state::tmtennis_plate_w)
412573{
413   // C-F: vfd matrix plate
574   // C,D,F: vfd matrix plate
414575   if (offset == NEC_UCOM4_PORTF) offset--;
415576   int shift = (offset - NEC_UCOM4_PORTC) * 4;
416577   m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
r244863r244864
420581
421582WRITE8_MEMBER(hh_ucom4_state::tmtennis_port_e_w)
422583{
423   // E0,E1: input mux
584   // E01: input mux
424585   // E2: speaker out
425586   // E3: N/C
426587   m_inp_mux = data & 3;
r244863r244864
553714
554715WRITE8_MEMBER(hh_ucom4_state::tmpacman_plate_w)
555716{
556   // E023,F-I: vfd matrix plate
717   // E1: speaker out
718   if (offset == NEC_UCOM4_PORTE)
719      m_speaker->level_w(data >> 1 & 1);
720
721   // E023,F,G,H,I: vfd matrix plate
557722   int shift = (offset - NEC_UCOM4_PORTE) * 4;
558723   m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
559724
560725   tmpacman_display();
561726}
562727
563WRITE8_MEMBER(hh_ucom4_state::tmpacman_port_e_w)
564{
565   // E1: speaker out
566   m_speaker->level_w(data >> 1 & 1);
567728
568   tmpacman_plate_w(space, offset, data);
569}
570
571
572729static INPUT_PORTS_START( tmpacman )
573730   PORT_START("IN.0") // port A
574731   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY // 4 separate directional buttons, hence 16way
r244863r244864
592749   MCFG_UCOM4_READ_B_CB(IOPORT("IN.1"))
593750   MCFG_UCOM4_WRITE_C_CB(WRITE8(hh_ucom4_state, tmpacman_grid_w))
594751   MCFG_UCOM4_WRITE_D_CB(WRITE8(hh_ucom4_state, tmpacman_grid_w))
595   MCFG_UCOM4_WRITE_E_CB(WRITE8(hh_ucom4_state, tmpacman_port_e_w))
752   MCFG_UCOM4_WRITE_E_CB(WRITE8(hh_ucom4_state, tmpacman_plate_w))
596753   MCFG_UCOM4_WRITE_F_CB(WRITE8(hh_ucom4_state, tmpacman_plate_w))
597754   MCFG_UCOM4_WRITE_G_CB(WRITE8(hh_ucom4_state, tmpacman_plate_w))
598755   MCFG_UCOM4_WRITE_H_CB(WRITE8(hh_ucom4_state, tmpacman_plate_w))
r244863r244864
637794   return read_inputs(2);
638795}
639796
640WRITE8_MEMBER(hh_ucom4_state::alnchase_display_w)
797WRITE8_MEMBER(hh_ucom4_state::alnchase_output_w)
641798{
642799   if (offset <= NEC_UCOM4_PORTE)
643800   {
r244863r244864
648805      // C0(grid 0): input enable PL1
649806      // D0(grid 4): input enable PL2
650807      m_inp_mux = (m_grid & 1) | (m_grid >> 3 & 2);
808     
809      // E1: speaker out
810      if (offset == NEC_UCOM4_PORTE)
811         m_speaker->level_w(data >> 1 & 1);
651812   }
652813
653814   if (offset >= NEC_UCOM4_PORTE)
654815   {
655      // E23,F-I: vfd matrix plate
816      // E23,F,G,H,I: vfd matrix plate
656817      int shift = (offset - NEC_UCOM4_PORTE) * 4;
657818      m_plate = ((m_plate << 2 & ~(0xf << shift)) | (data << shift)) >> 2;
658819   }
r244863r244864
660821   display_matrix(17, 9, m_plate, m_grid);
661822}
662823
663WRITE8_MEMBER(hh_ucom4_state::alnchase_port_e_w)
664{
665   // E1: speaker out
666   m_speaker->level_w(data >> 1 & 1);
667824
668   alnchase_display_w(space, offset, data);
669}
670
671
672825/* physical button layout and labels is like this:
673826
674827    POWER SOUND LEVEL PLAYER
r244863r244864
713866   MCFG_CPU_ADD("maincpu", NEC_D553, XTAL_400kHz)
714867   MCFG_UCOM4_READ_A_CB(READ8(hh_ucom4_state, alnchase_input_r))
715868   MCFG_UCOM4_READ_B_CB(IOPORT("IN.2"))
716   MCFG_UCOM4_WRITE_C_CB(WRITE8(hh_ucom4_state, alnchase_display_w))
717   MCFG_UCOM4_WRITE_D_CB(WRITE8(hh_ucom4_state, alnchase_display_w))
718   MCFG_UCOM4_WRITE_E_CB(WRITE8(hh_ucom4_state, alnchase_port_e_w))
719   MCFG_UCOM4_WRITE_F_CB(WRITE8(hh_ucom4_state, alnchase_display_w))
720   MCFG_UCOM4_WRITE_G_CB(WRITE8(hh_ucom4_state, alnchase_display_w))
721   MCFG_UCOM4_WRITE_H_CB(WRITE8(hh_ucom4_state, alnchase_display_w))
722   MCFG_UCOM4_WRITE_I_CB(WRITE8(hh_ucom4_state, alnchase_display_w))
869   MCFG_UCOM4_WRITE_C_CB(WRITE8(hh_ucom4_state, alnchase_output_w))
870   MCFG_UCOM4_WRITE_D_CB(WRITE8(hh_ucom4_state, alnchase_output_w))
871   MCFG_UCOM4_WRITE_E_CB(WRITE8(hh_ucom4_state, alnchase_output_w))
872   MCFG_UCOM4_WRITE_F_CB(WRITE8(hh_ucom4_state, alnchase_output_w))
873   MCFG_UCOM4_WRITE_G_CB(WRITE8(hh_ucom4_state, alnchase_output_w))
874   MCFG_UCOM4_WRITE_H_CB(WRITE8(hh_ucom4_state, alnchase_output_w))
875   MCFG_UCOM4_WRITE_I_CB(WRITE8(hh_ucom4_state, alnchase_output_w))
723876
724877   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1))
725878   MCFG_DEFAULT_LAYOUT(layout_hh_ucom4_test)


Previous 199869 Revisions Next


© 1997-2024 The MAME Team