trunk/src/mame/drivers/namcos22.c
| r20673 | r20674 | |
| 2675 | 2675 | switch (offset) |
| 2676 | 2676 | { |
| 2677 | 2677 | 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 | | |
| 2695 | 2678 | return (ddx & 0xff); |
| 2696 | 2679 | case 1: |
| 2697 | 2680 | return (ddx>>8); |
| r20673 | r20674 | |
| 3089 | 3072 | MCFG_MACHINE_START_OVERRIDE(namcos22_state,adillor) |
| 3090 | 3073 | MACHINE_CONFIG_END |
| 3091 | 3074 | |
| 3075 | |
| 3076 | TIMER_DEVICE_CALLBACK_MEMBER(namcos22_state::propcycl_pedal_interrupt) |
| 3077 | { |
| 3078 | generic_pulse_irq_line(m_mcu, M37710_LINE_TIMERA3TICK, 1); |
| 3079 | } |
| 3080 | |
| 3081 | TIMER_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 | |
| 3109 | static 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) |
| 3114 | MACHINE_CONFIG_END |
| 3115 | |
| 3092 | 3116 | /*********************************************************************************/ |
| 3093 | 3117 | |
| 3094 | 3118 | /* Namco System 22 */ |
| r20673 | r20674 | |
| 5270 | 5294 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 5271 | 5295 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 5272 | 5296 | |
| 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) |
| 5280 | 5299 | |
| 5281 | 5300 | PORT_START("STICKX") |
| 5282 | 5301 | PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE |
| r20673 | r20674 | |
| 5925 | 5944 | GAME( 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 |
| 5926 | 5945 | GAME( 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 |
| 5927 | 5946 | GAME( 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 |
| 5928 | | GAME( 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 |
| 5947 | GAME( 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 |
| 5929 | 5948 | GAME( 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? |
| 5930 | 5949 | GAME( 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? |
| 5931 | 5950 | GAME( 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 |