Previous 199869 Revisions Next

r20845 Friday 8th February, 2013 at 21:02:57 UTC by hap
(small cleanup)
[src/mame/drivers]namcos22.c

trunk/src/mame/drivers/namcos22.c
r20844r20845
11681168
11691169/*********************************************************************************************/
11701170
1171/* mask,default,type,sensitivity,delta,min,max */
1172#define DRIVING_ANALOG_PORTS \
1173   PORT_START("GAS") \
1174   PORT_BIT( 0xff, 0x00, IPT_PEDAL )  PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_NAME("Gas Pedal") \
1175   PORT_START("BRAKE") \
1176   PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_NAME("Brake Pedal") \
1177   PORT_START("STEER") \
1178   PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_NAME("Steering Wheel")
1179
11801171/* TODO: REMOVE (THIS IS HANDLED BY "IOMCU") */
1181static void ReadAnalogDrivingPorts( running_machine &machine, UINT16 *gas, UINT16 *brake, UINT16 *steer )
1182{
1183   *gas   = machine.root_device().ioport("GAS")->read();
1184   *brake = machine.root_device().ioport("BRAKE")->read();
1185   *steer = machine.root_device().ioport("STEER")->read();
1186}
1187
1188/* TODO: REMOVE (THIS IS HANDLED BY "IOMCU") */
11891172static UINT16 AnalogAsDigital( running_machine &machine )
11901173{
11911174   namcos22_state *state = machine.driver_data<namcos22_state>();
r20844r20845
12741257   if( nthbyte(state->m_system_controller, 0x18) != 0 )
12751258   {
12761259      UINT16 flags = state->ioport("INPUTS")->read();
1277      UINT16 gas, brake, steer, coinram_address_is_odd = 0;
1278      ReadAnalogDrivingPorts( machine, &gas, &brake, &steer );
1260      UINT16 coinram_address_is_odd = 0;
12791261
1262      UINT16 gas   = machine.root_device().ioport("GAS")->read();
1263      UINT16 brake = machine.root_device().ioport("BRAKE")->read();
1264      UINT16 steer = machine.root_device().ioport("STEER")->read();
1265
12801266      switch (state->m_gametype)
12811267      {
12821268         case NAMCOS22_RIDGE_RACER:
r20844r20845
13471333
13481334/*********************************************************************************************/
13491335
1350static void InitDSP( running_machine &machine )
1351{
1352   namcos22_state *state = machine.driver_data<namcos22_state>();
1353   state->m_master->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
1354   state->m_slave->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
1355   state->m_mcu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
1356}
1357
13581336READ16_MEMBER(namcos22_state::pdp_status_r)
13591337{
13601338   return m_MasterBIOZ;
r20844r20845
14801458         case 0xffff: /* "goto" command */
14811459            offs = ReadFromCommRAM(offs);
14821460            if( offs == start )
1483            { /* most commands end with a "goto self" */
1461            {
1462               /* most commands end with a "goto self" */
14841463               return 0;
14851464            }
14861465            break;
r20844r20845
21432122      if (newreg != oldreg)
21442123      {
21452124         if( newreg == 0 )
2146         { /* disable DSPs */
2125         {
2126            /* disable DSPs */
21472127            m_master->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); /* master DSP */
21482128            m_slave->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); /* slave DSP */
21492129            namcos22_enable_slave_simulation(machine(), 0);
21502130            m_bEnableDspIrqs = 0;
21512131         }
21522132         else if( newreg == 1 )
2153         { /* enable dsp and rendering subsystem */
2133         {
2134            /* enable dsp and rendering subsystem */
21542135            m_master->set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
21552136            namcos22_enable_slave_simulation(machine(), 1);
21562137            m_bEnableDspIrqs = 1;
21572138         }
21582139         else if( newreg == 0xff )
2159         { /* used to upload game-specific code to master/slave dsps */
2140         {
2141            /* used to upload game-specific code to master/slave dsps */
21602142            m_master->set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
21612143            m_bEnableDspIrqs = 0;
21622144         }
r20844r20845
22712253      if (newreg != oldreg)
22722254      {
22732255         if( newreg == 0 )
2274         { /* disable DSPs */
2256         {
2257            /* disable DSPs */
22752258            m_master->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); /* master DSP */
22762259            m_slave->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); /* slave DSP */
22772260            namcos22_enable_slave_simulation(machine(), 0);
22782261            m_bEnableDspIrqs = 0;
22792262         }
22802263         else if( newreg == 1 )
2281         { /* enable dsp and rendering subsystem */
2264         {
2265            /* enable dsp and rendering subsystem */
22822266            m_master->set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
22832267            namcos22_enable_slave_simulation(machine(), 1);
22842268            m_bEnableDspIrqs = 1;
22852269         }
22862270         else if( newreg == 0xff )
2287         { /* used to upload game-specific code to master/slave dsps */
2271         {
2272            /* used to upload game-specific code to master/slave dsps */
22882273            m_master->set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
22892274            m_bEnableDspIrqs = 0;
22902275         }
r20844r20845
27072692
27082693READ8_MEMBER(namcos22_state::mcu_port4_s22_r)
27092694{
2710   return 0x10; // for C74, 0x10 selects sound MCU role, 0x00 selects control-reading role
2695   // for C74, 0x10 selects sound MCU role, 0x00 selects control-reading role
2696   return (&space.device() == m_mcu) ? 0x10: 0x00;
27112697}
27122698
27132699static ADDRESS_MAP_START( mcu_s22_io, AS_IO, 8, namcos22_state )
r20844r20845
27152701ADDRESS_MAP_END
27162702
27172703static ADDRESS_MAP_START( iomcu_s22_io, AS_IO, 8, namcos22_state )
2704   AM_RANGE(M37710_PORT4, M37710_PORT4) AM_READ(mcu_port4_s22_r )
27182705   AM_RANGE(0x00, 0xff) AM_NOP
27192706ADDRESS_MAP_END
27202707
r20844r20845
27332720
27342721void namcos22_state::machine_reset()
27352722{
2736   InitDSP(machine());
2723   m_master->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
2724   m_slave->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
2725   m_mcu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
27372726}
27382727
27392728void namcos22_state::machine_start()
r20844r20845
47934782
47944783   PORT_START("ADC1")
47954784   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_NAME("Steps Edge")
4796INPUT_PORTS_END /* Alpine Racer */
4785INPUT_PORTS_END
47974786
47984787static INPUT_PORTS_START( airco22 )
47994788   PORT_START("DSW0")
r20844r20845
48434832
48444833   PORT_START("ADC2")
48454834   PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(100) PORT_KEYDELTA(4)
4846INPUT_PORTS_END /* Air Combat22 */
4835INPUT_PORTS_END
48474836
48484837static INPUT_PORTS_START( cybrcycc )
48494838   PORT_START("DSW0")
r20844r20845
48934882
48944883   PORT_START("ADC2")
48954884   PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_NAME("Brake Pedal")
4896INPUT_PORTS_END /* Cyber Cycles */
4885INPUT_PORTS_END
48974886
48984887static INPUT_PORTS_START( dirtdash )
48994888   PORT_START("DSW0")
r20844r20845
49434932
49444933   PORT_START("ADC2")
49454934   PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_NAME("Brake Pedal")
4946INPUT_PORTS_END /* Dirt Dash */
4935INPUT_PORTS_END
49474936
49484937static INPUT_PORTS_START( tokyowar )
49494938   PORT_START("DSW0")
r20844r20845
49934982
49944983   PORT_START("ADC3")
49954984   PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_NAME("Brake Pedal")
4996INPUT_PORTS_END /* Tokyo Wars */
4985INPUT_PORTS_END
49974986
49984987static INPUT_PORTS_START( aquajet )
49994988   PORT_START("DSW0")
r20844r20845
50435032
50445033   PORT_START("ADC2")
50455034   PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE
5046INPUT_PORTS_END /* Aqua Jet */
5035INPUT_PORTS_END
50475036
50485037static INPUT_PORTS_START( adillor )
50495038   PORT_START("DSW0")
r20844r20845
50915080
50925081   PORT_START("TRACKY")
50935082   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x01, 0xff) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_NAME("Trackball Y")
5094INPUT_PORTS_END /* Armadillo Racing */
5083INPUT_PORTS_END
50955084
50965085static INPUT_PORTS_START( propcycl )
50975086   PORT_START("DSW0")  /* DIP4 */
r20844r20845
51425131
51435132   PORT_START("PEDAL")
51445133   PORT_BIT( 0x7f, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10)
5145INPUT_PORTS_END /* Prop Cycle */
5134INPUT_PORTS_END
51465135
51475136static INPUT_PORTS_START( timecris )
51485137   PORT_START("DSW0")
r20844r20845
51875176
51885177   PORT_START( "LIGHTY" ) // tuned for CRT - can't shoot below the statusbar?
51895178   PORT_BIT( 0xfff, 43+241/2, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_MINMAX(43, 43+241) PORT_SENSITIVITY(64) PORT_KEYDELTA(4)
5190INPUT_PORTS_END /* Time Crisis */
5179INPUT_PORTS_END
51915180
51925181/*****************************************************************************************************/
51935182
r20844r20845
52745263   PORT_DIPNAME( 0x8000, 0x8000, "DIP3-8" )
52755264   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
52765265   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
5277INPUT_PORTS_END /* Cyber Commando */
5266INPUT_PORTS_END
52785267
52795268static INPUT_PORTS_START( acedrvr )
52805269   PORT_START("INPUTS")
r20844r20845
52955284   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
52965285   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Motion-Stop")
52975286
5298   DRIVING_ANALOG_PORTS
5299
53005287   PORT_START("DSW0") /* DIP2 and DIP3 */
53015288   PORT_DIPNAME( 0x0001, 0x0001, "DIP2-1" )
53025289   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
r20844r20845
53465333   PORT_DIPNAME( 0x8000, 0x8000, "DIP3-8 (TEST MODE?)" )
53475334   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
53485335   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
5349INPUT_PORTS_END /* Ace Driver */
53505336
5337   PORT_START("GAS")
5338   PORT_BIT( 0xff, 0x00, IPT_PEDAL )  PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_NAME("Gas Pedal")
5339
5340   PORT_START("BRAKE")
5341   PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_NAME("Brake Pedal")
5342
5343   PORT_START("STEER")
5344   PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_NAME("Steering Wheel")
5345INPUT_PORTS_END
5346
53515347static INPUT_PORTS_START( ridgera )
53525348   PORT_START("INPUTS")
53535349   /*  1 3 5   When the cabinet is set to Deluxe, the stick shift is basically
r20844r20845
53725368   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
53735369   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
53745370
5375   DRIVING_ANALOG_PORTS
5376
53775371   PORT_START("DSW0") /* DIP2 and DIP3 */
53785372   PORT_SERVICE( 0x0001, IP_ACTIVE_LOW ) PORT_NAME("DIP2-1 (Service Mode)")
53795373   PORT_DIPNAME( 0x0002, 0x0002, "DIP2-2" )
r20844r20845
54215415   PORT_DIPNAME( 0x8000, 0x8000, "DIP3-8" )
54225416   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
54235417   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
5424INPUT_PORTS_END /* Ridge Racer */
54255418
5419   PORT_START("GAS")
5420   PORT_BIT( 0xff, 0x00, IPT_PEDAL )  PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_NAME("Gas Pedal")
5421
5422   PORT_START("BRAKE")
5423   PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_NAME("Brake Pedal")
5424
5425   PORT_START("STEER")
5426   PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_NAME("Steering Wheel")
5427INPUT_PORTS_END
5428
54265429static INPUT_PORTS_START( ridgeracf )
54275430   PORT_INCLUDE( ridgera )
54285431
r20844r20845
54455448   PORT_DIPNAME( 0x8000, 0x8000, "DIP3-8 (Test Mode)" )
54465449   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
54475450   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
5448INPUT_PORTS_END /* Ridge Racer Full Scale */
5451INPUT_PORTS_END
54495452
54505453static INPUT_PORTS_START( ridgera2 )
54515454   PORT_INCLUDE( ridgera )
r20844r20845
54685471   PORT_DIPNAME( 0x8000, 0x8000, "DIP3-8 (Test Mode)" )
54695472   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
54705473   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
5471INPUT_PORTS_END /* Ridge Racer 2 */
5474INPUT_PORTS_END
54725475
54735476static INPUT_PORTS_START( raveracw )
54745477   PORT_INCLUDE( ridgera )
r20844r20845
54825485   PORT_DIPSETTING(      0x0100, "Twin" )
54835486   PORT_DIPSETTING(      0x2000, DEF_STR( Standard ) )
54845487   PORT_DIPSETTING(      0x2100, "Deluxe" )
5485INPUT_PORTS_END /* Rave Racer */
5488INPUT_PORTS_END
54865489
54875490/*****************************************************************************************************/
54885491

Previous 199869 Revisions Next


© 1997-2024 The MAME Team