trunk/src/mame/drivers/namcos22.c
| r20844 | r20845 | |
| 1168 | 1168 | |
| 1169 | 1169 | /*********************************************************************************************/ |
| 1170 | 1170 | |
| 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 | | |
| 1180 | 1171 | /* TODO: REMOVE (THIS IS HANDLED BY "IOMCU") */ |
| 1181 | | static 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") */ |
| 1189 | 1172 | static UINT16 AnalogAsDigital( running_machine &machine ) |
| 1190 | 1173 | { |
| 1191 | 1174 | namcos22_state *state = machine.driver_data<namcos22_state>(); |
| r20844 | r20845 | |
| 1274 | 1257 | if( nthbyte(state->m_system_controller, 0x18) != 0 ) |
| 1275 | 1258 | { |
| 1276 | 1259 | 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; |
| 1279 | 1261 | |
| 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 | |
| 1280 | 1266 | switch (state->m_gametype) |
| 1281 | 1267 | { |
| 1282 | 1268 | case NAMCOS22_RIDGE_RACER: |
| r20844 | r20845 | |
| 1347 | 1333 | |
| 1348 | 1334 | /*********************************************************************************************/ |
| 1349 | 1335 | |
| 1350 | | static 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 | | |
| 1358 | 1336 | READ16_MEMBER(namcos22_state::pdp_status_r) |
| 1359 | 1337 | { |
| 1360 | 1338 | return m_MasterBIOZ; |
| r20844 | r20845 | |
| 1480 | 1458 | case 0xffff: /* "goto" command */ |
| 1481 | 1459 | offs = ReadFromCommRAM(offs); |
| 1482 | 1460 | if( offs == start ) |
| 1483 | | { /* most commands end with a "goto self" */ |
| 1461 | { |
| 1462 | /* most commands end with a "goto self" */ |
| 1484 | 1463 | return 0; |
| 1485 | 1464 | } |
| 1486 | 1465 | break; |
| r20844 | r20845 | |
| 2143 | 2122 | if (newreg != oldreg) |
| 2144 | 2123 | { |
| 2145 | 2124 | if( newreg == 0 ) |
| 2146 | | { /* disable DSPs */ |
| 2125 | { |
| 2126 | /* disable DSPs */ |
| 2147 | 2127 | m_master->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); /* master DSP */ |
| 2148 | 2128 | m_slave->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); /* slave DSP */ |
| 2149 | 2129 | namcos22_enable_slave_simulation(machine(), 0); |
| 2150 | 2130 | m_bEnableDspIrqs = 0; |
| 2151 | 2131 | } |
| 2152 | 2132 | else if( newreg == 1 ) |
| 2153 | | { /* enable dsp and rendering subsystem */ |
| 2133 | { |
| 2134 | /* enable dsp and rendering subsystem */ |
| 2154 | 2135 | m_master->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); |
| 2155 | 2136 | namcos22_enable_slave_simulation(machine(), 1); |
| 2156 | 2137 | m_bEnableDspIrqs = 1; |
| 2157 | 2138 | } |
| 2158 | 2139 | 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 */ |
| 2160 | 2142 | m_master->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); |
| 2161 | 2143 | m_bEnableDspIrqs = 0; |
| 2162 | 2144 | } |
| r20844 | r20845 | |
| 2271 | 2253 | if (newreg != oldreg) |
| 2272 | 2254 | { |
| 2273 | 2255 | if( newreg == 0 ) |
| 2274 | | { /* disable DSPs */ |
| 2256 | { |
| 2257 | /* disable DSPs */ |
| 2275 | 2258 | m_master->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); /* master DSP */ |
| 2276 | 2259 | m_slave->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); /* slave DSP */ |
| 2277 | 2260 | namcos22_enable_slave_simulation(machine(), 0); |
| 2278 | 2261 | m_bEnableDspIrqs = 0; |
| 2279 | 2262 | } |
| 2280 | 2263 | else if( newreg == 1 ) |
| 2281 | | { /* enable dsp and rendering subsystem */ |
| 2264 | { |
| 2265 | /* enable dsp and rendering subsystem */ |
| 2282 | 2266 | m_master->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); |
| 2283 | 2267 | namcos22_enable_slave_simulation(machine(), 1); |
| 2284 | 2268 | m_bEnableDspIrqs = 1; |
| 2285 | 2269 | } |
| 2286 | 2270 | 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 */ |
| 2288 | 2273 | m_master->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); |
| 2289 | 2274 | m_bEnableDspIrqs = 0; |
| 2290 | 2275 | } |
| r20844 | r20845 | |
| 2707 | 2692 | |
| 2708 | 2693 | READ8_MEMBER(namcos22_state::mcu_port4_s22_r) |
| 2709 | 2694 | { |
| 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; |
| 2711 | 2697 | } |
| 2712 | 2698 | |
| 2713 | 2699 | static ADDRESS_MAP_START( mcu_s22_io, AS_IO, 8, namcos22_state ) |
| r20844 | r20845 | |
| 2715 | 2701 | ADDRESS_MAP_END |
| 2716 | 2702 | |
| 2717 | 2703 | static ADDRESS_MAP_START( iomcu_s22_io, AS_IO, 8, namcos22_state ) |
| 2704 | AM_RANGE(M37710_PORT4, M37710_PORT4) AM_READ(mcu_port4_s22_r ) |
| 2718 | 2705 | AM_RANGE(0x00, 0xff) AM_NOP |
| 2719 | 2706 | ADDRESS_MAP_END |
| 2720 | 2707 | |
| r20844 | r20845 | |
| 2733 | 2720 | |
| 2734 | 2721 | void namcos22_state::machine_reset() |
| 2735 | 2722 | { |
| 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); |
| 2737 | 2726 | } |
| 2738 | 2727 | |
| 2739 | 2728 | void namcos22_state::machine_start() |
| r20844 | r20845 | |
| 4793 | 4782 | |
| 4794 | 4783 | PORT_START("ADC1") |
| 4795 | 4784 | PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_NAME("Steps Edge") |
| 4796 | | INPUT_PORTS_END /* Alpine Racer */ |
| 4785 | INPUT_PORTS_END |
| 4797 | 4786 | |
| 4798 | 4787 | static INPUT_PORTS_START( airco22 ) |
| 4799 | 4788 | PORT_START("DSW0") |
| r20844 | r20845 | |
| 4843 | 4832 | |
| 4844 | 4833 | PORT_START("ADC2") |
| 4845 | 4834 | PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) |
| 4846 | | INPUT_PORTS_END /* Air Combat22 */ |
| 4835 | INPUT_PORTS_END |
| 4847 | 4836 | |
| 4848 | 4837 | static INPUT_PORTS_START( cybrcycc ) |
| 4849 | 4838 | PORT_START("DSW0") |
| r20844 | r20845 | |
| 4893 | 4882 | |
| 4894 | 4883 | PORT_START("ADC2") |
| 4895 | 4884 | PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_NAME("Brake Pedal") |
| 4896 | | INPUT_PORTS_END /* Cyber Cycles */ |
| 4885 | INPUT_PORTS_END |
| 4897 | 4886 | |
| 4898 | 4887 | static INPUT_PORTS_START( dirtdash ) |
| 4899 | 4888 | PORT_START("DSW0") |
| r20844 | r20845 | |
| 4943 | 4932 | |
| 4944 | 4933 | PORT_START("ADC2") |
| 4945 | 4934 | PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_NAME("Brake Pedal") |
| 4946 | | INPUT_PORTS_END /* Dirt Dash */ |
| 4935 | INPUT_PORTS_END |
| 4947 | 4936 | |
| 4948 | 4937 | static INPUT_PORTS_START( tokyowar ) |
| 4949 | 4938 | PORT_START("DSW0") |
| r20844 | r20845 | |
| 4993 | 4982 | |
| 4994 | 4983 | PORT_START("ADC3") |
| 4995 | 4984 | PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_NAME("Brake Pedal") |
| 4996 | | INPUT_PORTS_END /* Tokyo Wars */ |
| 4985 | INPUT_PORTS_END |
| 4997 | 4986 | |
| 4998 | 4987 | static INPUT_PORTS_START( aquajet ) |
| 4999 | 4988 | PORT_START("DSW0") |
| r20844 | r20845 | |
| 5043 | 5032 | |
| 5044 | 5033 | PORT_START("ADC2") |
| 5045 | 5034 | PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE |
| 5046 | | INPUT_PORTS_END /* Aqua Jet */ |
| 5035 | INPUT_PORTS_END |
| 5047 | 5036 | |
| 5048 | 5037 | static INPUT_PORTS_START( adillor ) |
| 5049 | 5038 | PORT_START("DSW0") |
| r20844 | r20845 | |
| 5091 | 5080 | |
| 5092 | 5081 | PORT_START("TRACKY") |
| 5093 | 5082 | PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x01, 0xff) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_NAME("Trackball Y") |
| 5094 | | INPUT_PORTS_END /* Armadillo Racing */ |
| 5083 | INPUT_PORTS_END |
| 5095 | 5084 | |
| 5096 | 5085 | static INPUT_PORTS_START( propcycl ) |
| 5097 | 5086 | PORT_START("DSW0") /* DIP4 */ |
| r20844 | r20845 | |
| 5142 | 5131 | |
| 5143 | 5132 | PORT_START("PEDAL") |
| 5144 | 5133 | PORT_BIT( 0x7f, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) |
| 5145 | | INPUT_PORTS_END /* Prop Cycle */ |
| 5134 | INPUT_PORTS_END |
| 5146 | 5135 | |
| 5147 | 5136 | static INPUT_PORTS_START( timecris ) |
| 5148 | 5137 | PORT_START("DSW0") |
| r20844 | r20845 | |
| 5187 | 5176 | |
| 5188 | 5177 | PORT_START( "LIGHTY" ) // tuned for CRT - can't shoot below the statusbar? |
| 5189 | 5178 | 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) |
| 5190 | | INPUT_PORTS_END /* Time Crisis */ |
| 5179 | INPUT_PORTS_END |
| 5191 | 5180 | |
| 5192 | 5181 | /*****************************************************************************************************/ |
| 5193 | 5182 | |
| r20844 | r20845 | |
| 5274 | 5263 | PORT_DIPNAME( 0x8000, 0x8000, "DIP3-8" ) |
| 5275 | 5264 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) |
| 5276 | 5265 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 5277 | | INPUT_PORTS_END /* Cyber Commando */ |
| 5266 | INPUT_PORTS_END |
| 5278 | 5267 | |
| 5279 | 5268 | static INPUT_PORTS_START( acedrvr ) |
| 5280 | 5269 | PORT_START("INPUTS") |
| r20844 | r20845 | |
| 5295 | 5284 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 5296 | 5285 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Motion-Stop") |
| 5297 | 5286 | |
| 5298 | | DRIVING_ANALOG_PORTS |
| 5299 | | |
| 5300 | 5287 | PORT_START("DSW0") /* DIP2 and DIP3 */ |
| 5301 | 5288 | PORT_DIPNAME( 0x0001, 0x0001, "DIP2-1" ) |
| 5302 | 5289 | PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) |
| r20844 | r20845 | |
| 5346 | 5333 | PORT_DIPNAME( 0x8000, 0x8000, "DIP3-8 (TEST MODE?)" ) |
| 5347 | 5334 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) |
| 5348 | 5335 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 5349 | | INPUT_PORTS_END /* Ace Driver */ |
| 5350 | 5336 | |
| 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") |
| 5345 | INPUT_PORTS_END |
| 5346 | |
| 5351 | 5347 | static INPUT_PORTS_START( ridgera ) |
| 5352 | 5348 | PORT_START("INPUTS") |
| 5353 | 5349 | /* 1 3 5 When the cabinet is set to Deluxe, the stick shift is basically |
| r20844 | r20845 | |
| 5372 | 5368 | PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 5373 | 5369 | PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 5374 | 5370 | |
| 5375 | | DRIVING_ANALOG_PORTS |
| 5376 | | |
| 5377 | 5371 | PORT_START("DSW0") /* DIP2 and DIP3 */ |
| 5378 | 5372 | PORT_SERVICE( 0x0001, IP_ACTIVE_LOW ) PORT_NAME("DIP2-1 (Service Mode)") |
| 5379 | 5373 | PORT_DIPNAME( 0x0002, 0x0002, "DIP2-2" ) |
| r20844 | r20845 | |
| 5421 | 5415 | PORT_DIPNAME( 0x8000, 0x8000, "DIP3-8" ) |
| 5422 | 5416 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) |
| 5423 | 5417 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 5424 | | INPUT_PORTS_END /* Ridge Racer */ |
| 5425 | 5418 | |
| 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") |
| 5427 | INPUT_PORTS_END |
| 5428 | |
| 5426 | 5429 | static INPUT_PORTS_START( ridgeracf ) |
| 5427 | 5430 | PORT_INCLUDE( ridgera ) |
| 5428 | 5431 | |
| r20844 | r20845 | |
| 5445 | 5448 | PORT_DIPNAME( 0x8000, 0x8000, "DIP3-8 (Test Mode)" ) |
| 5446 | 5449 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) |
| 5447 | 5450 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 5448 | | INPUT_PORTS_END /* Ridge Racer Full Scale */ |
| 5451 | INPUT_PORTS_END |
| 5449 | 5452 | |
| 5450 | 5453 | static INPUT_PORTS_START( ridgera2 ) |
| 5451 | 5454 | PORT_INCLUDE( ridgera ) |
| r20844 | r20845 | |
| 5468 | 5471 | PORT_DIPNAME( 0x8000, 0x8000, "DIP3-8 (Test Mode)" ) |
| 5469 | 5472 | PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) |
| 5470 | 5473 | PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) |
| 5471 | | INPUT_PORTS_END /* Ridge Racer 2 */ |
| 5474 | INPUT_PORTS_END |
| 5472 | 5475 | |
| 5473 | 5476 | static INPUT_PORTS_START( raveracw ) |
| 5474 | 5477 | PORT_INCLUDE( ridgera ) |
| r20844 | r20845 | |
| 5482 | 5485 | PORT_DIPSETTING( 0x0100, "Twin" ) |
| 5483 | 5486 | PORT_DIPSETTING( 0x2000, DEF_STR( Standard ) ) |
| 5484 | 5487 | PORT_DIPSETTING( 0x2100, "Deluxe" ) |
| 5485 | | INPUT_PORTS_END /* Rave Racer */ |
| 5488 | INPUT_PORTS_END |
| 5486 | 5489 | |
| 5487 | 5490 | /*****************************************************************************************************/ |
| 5488 | 5491 | |