Previous 199869 Revisions Next

r20674 Saturday 2nd February, 2013 at 18:41:49 UTC by hap
improved propcycl pedal too
[src/mame/drivers]namcos22.c
[src/mame/includes]namcos22.h

trunk/src/mame/includes/namcos22.h
r20673r20674
5353      m_vics_control(*this,"vics_control"),
5454      m_czattr(*this,"czattr"),
5555      m_tilemapattr(*this,"tilemapattr"),
56      m_czram(*this,"czram")
56      m_czram(*this,"czram"),
57      m_pc_pedal_interrupt(*this, "pc_p_int")
5758   { }
5859
5960   required_device<cpu_device> m_maincpu;
r20673r20674
7677   optional_shared_ptr<UINT32> m_czattr;
7778   required_shared_ptr<UINT32> m_tilemapattr;
7879   optional_shared_ptr<UINT32> m_czram;
80   optional_device<timer_device> m_pc_pedal_interrupt;
7981
8082   int m_bEnableDspIrqs;
8183   emu_timer *m_ar_tb_interrupt[2];
r20673r20674
267269   INTERRUPT_GEN_MEMBER(namcos22_interrupt);
268270   TIMER_DEVICE_CALLBACK_MEMBER(adillor_trackball_update);
269271   TIMER_CALLBACK_MEMBER(adillor_trackball_interrupt);
272   TIMER_DEVICE_CALLBACK_MEMBER(propcycl_pedal_update);
273   TIMER_DEVICE_CALLBACK_MEMBER(propcycl_pedal_interrupt);
270274   TIMER_CALLBACK_MEMBER(alpine_steplock_callback);
271275   TIMER_DEVICE_CALLBACK_MEMBER(dsp_master_serial_irq);
272276   TIMER_DEVICE_CALLBACK_MEMBER(dsp_slave_serial_irq);
trunk/src/mame/drivers/namcos22.c
r20673r20674
26752675   switch (offset)
26762676   {
26772677      case 0:
2678         // also update the pedal here
2679         //
2680         // this is a wee bit hackish: the way it actually works is like so:
2681         // the pedal has a simple 1-bit "light interrupted" sensor.  the faster you pedal,
2682         // the faster it pulses.  this is connected to the clock input for timer A3,
2683         // and timer A3 is configured by the MCU program to cause an interrupt each time
2684         // it's clocked.  by counting the number of interrupts in a frame, we can determine
2685         // how fast the user is pedaling.
2686         if( ioport("JOY")->read() & 0x10 )
2687         {
2688            int i;
2689            for (i = 0; i < 16; i++)
2690            {
2691               generic_pulse_irq_line(m_mcu, M37710_LINE_TIMERA3TICK, 1);
2692            }
2693         }
2694
26952678         return (ddx & 0xff);
26962679      case 1:
26972680         return (ddx>>8);
r20673r20674
30893072   MCFG_MACHINE_START_OVERRIDE(namcos22_state,adillor)
30903073MACHINE_CONFIG_END
30913074
3075
3076TIMER_DEVICE_CALLBACK_MEMBER(namcos22_state::propcycl_pedal_interrupt)
3077{
3078   generic_pulse_irq_line(m_mcu, M37710_LINE_TIMERA3TICK, 1);
3079}
3080
3081TIMER_DEVICE_CALLBACK_MEMBER(namcos22_state::propcycl_pedal_update)
3082{
3083   // arbitrary timer for reading optical pedal
3084   UINT8 i = ioport("PEDAL")->read();
3085   
3086   if (i != 0)
3087   {
3088      // the pedal has a simple 1-bit "light interrupted" sensor.  the faster you pedal,
3089      // the faster it pulses.  this is connected to the clock input for timer A3,
3090      // and timer A3 is configured by the MCU program to cause an interrupt each time
3091      // it's clocked.  by counting the number of interrupts in a frame, we can determine
3092      // how fast the user is pedaling.
3093
3094      // these values(in usec) may need tweaking:
3095      const int base = 1000;
3096      const int range = 10000;
3097
3098      attotime freq = attotime::from_usec(base + range * (1.0 / (double)i));
3099      m_pc_pedal_interrupt->adjust(min(freq, m_pc_pedal_interrupt->time_left()), 0, freq);
3100
3101   }
3102   else
3103   {
3104      // not moving
3105      m_pc_pedal_interrupt->adjust(attotime::never, 0, attotime::never);
3106   }
3107}
3108
3109static MACHINE_CONFIG_DERIVED( propcycl, namcos22s )
3110
3111   /* basic machine hardware */
3112   MCFG_TIMER_DRIVER_ADD_PERIODIC("pc_p_upd", namcos22_state, propcycl_pedal_update, attotime::from_msec(20))
3113   MCFG_TIMER_DRIVER_ADD("pc_p_int", namcos22_state, propcycl_pedal_interrupt)
3114MACHINE_CONFIG_END
3115
30923116/*********************************************************************************/
30933117
30943118/* Namco System 22 */
r20673r20674
52705294   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
52715295   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
52725296
5273   PORT_START("JOY")
5274   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )
5275   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )
5276   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )
5277   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )
5278   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
5279   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START1 )
5297   PORT_START("PEDAL")
5298   PORT_BIT( 0x7f, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10)
52805299
52815300   PORT_START("STICKX")
52825301   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE
r20673r20674
59255944GAME( 1995, dirtdash, 0,         namcos22s, dirtdash,  namcos22_state, dirtdash, ROT0, "Namco", "Dirt Dash (Rev. DT2)"                   , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS ) // 95/12/20 20:01:56
59265945GAME( 1995, timecris, 0,         timecris,  timecris,  namcos22_state, timecris, ROT0, "Namco", "Time Crisis (Rev. TS2 Ver.B)"           , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS ) // 96/04/02 18:48:00
59275946GAME( 1995, timecrisa,timecris,  timecris,  timecris,  namcos22_state, timecris, ROT0, "Namco", "Time Crisis (Rev. TS2 Ver.A)"           , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS ) // 96/01/08 18:56:09
5928GAME( 1996, propcycl, 0,         namcos22s, propcycl,  namcos22_state, propcycl, ROT0, "Namco", "Prop Cycle (Rev. PR2 Ver.A)"            , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS ) // 96/06/18 21:22:13
5947GAME( 1996, propcycl, 0,         propcycl, propcycl,  namcos22_state, propcycl, ROT0, "Namco", "Prop Cycle (Rev. PR2 Ver.A)"            , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS ) // 96/06/18 21:22:13
59295948GAME( 1996, alpinesa, 0,         namcos22s, alpiner,   namcos22_state, alpinesa, ROT0, "Namco", "Alpine Surfer (Rev. AF2 Ver.A)"         , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS|GAME_NOT_WORKING ) // 96/07/01 15:19:23. major gfx problems, slave dsp?
59305949GAME( 1996, tokyowar, 0,         namcos22s, tokyowar,  namcos22_state, tokyowar, ROT0, "Namco", "Tokyo Wars (Rev. TW2 Ver.A)"            , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS|GAME_NOT_WORKING ) // 96/09/03 14:08:47. near-invincible tanks, maybe related to timecris helicopter bug?
59315950GAME( 1996, aquajet,  0,         namcos22s, aquajet,   namcos22_state, aquajet,  ROT0, "Namco", "Aqua Jet (Rev. AJ2 Ver.B)"              , GAME_IMPERFECT_SOUND|GAME_IMPERFECT_GRAPHICS ) // 96/09/20 14:28:30

Previous 199869 Revisions Next


© 1997-2024 The MAME Team