diff --git a/src/mame/drivers/coolridr.c b/src/mame/drivers/coolridr.c index 4f640992e00..00bc5f5004e 100644 --- a/src/mame/drivers/coolridr.c +++ b/src/mame/drivers/coolridr.c @@ -337,6 +337,9 @@ public: DECLARE_READ16_MEMBER(h1_soundram2_r); DECLARE_WRITE16_MEMBER(h1_soundram_w); DECLARE_WRITE16_MEMBER(h1_soundram2_w); + DECLARE_READ8_MEMBER(analog_mux_r); + DECLARE_WRITE8_MEMBER(analog_mux_w); + UINT8 an_mux_data; DECLARE_WRITE_LINE_MEMBER(scsp_to_main_irq); DECLARE_DRIVER_INIT(coolridr); virtual void machine_start(); @@ -903,6 +906,20 @@ WRITE16_MEMBER( coolridr_state::h1_soundram2_w) COMBINE_DATA(&m_soundram2[offset]); } +READ8_MEMBER( coolridr_state::analog_mux_r ) +{ + static const char *const adcnames[] = { "AN0", "AN1", "AN2", "AN3", "AN4", "AN5", "AN6", "AN7" }; + UINT8 adc_data = ioport(adcnames[an_mux_data])->read_safe(0); + an_mux_data++; + an_mux_data &= 0x7; + return adc_data; +} + +WRITE8_MEMBER( coolridr_state::analog_mux_w ) +{ + an_mux_data = data; +} + static ADDRESS_MAP_START( coolridr_submap, AS_PROGRAM, 32, coolridr_state ) AM_RANGE(0x00000000, 0x0001ffff) AM_ROM AM_SHARE("share2") @@ -928,8 +945,8 @@ static ADDRESS_MAP_START( coolridr_submap, AS_PROGRAM, 32, coolridr_state ) AM_RANGE(0x0610000c, 0x0610000f) AM_READ_PORT("IN6") AM_RANGE(0x06100010, 0x06100013) AM_READ_PORT("IN2") AM_WRITENOP AM_RANGE(0x06100014, 0x06100017) AM_READ_PORT("IN3") - AM_RANGE(0x0610001c, 0x0610001f) AM_READ_PORT("IN4") AM_WRITENOP - AM_RANGE(0x06200000, 0x06200fff) AM_RAM //check this! + AM_RANGE(0x0610001c, 0x0610001f) AM_READWRITE8(analog_mux_r,analog_mux_w,0x000000ff) //AM_WRITENOP + AM_RANGE(0x06200000, 0x06200fff) AM_RAM //network related? AM_RANGE(0x07fff000, 0x07ffffff) AM_RAM AM_RANGE(0x20000000, 0x2001ffff) AM_ROM AM_SHARE("share2") @@ -1048,40 +1065,22 @@ static INPUT_PORTS_START( coolridr ) PORT_BIT( 0xff00ff00, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("IN1") - PORT_DIPNAME( 0x00000001, 0x00000001, "IN1-0" ) - PORT_DIPSETTING( 0x00000001, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00000002, 0x00000002, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00000002, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00000004, 0x00000004, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00000004, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00000008, 0x00000008, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00000008, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00000010, 0x00000010, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00000010, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00000020, 0x00000020, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00000020, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00000040, 0x00000040, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00000040, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00000080, 0x00000080, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00000080, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - /* Service port*/ - PORT_BIT(0x00010000, IP_ACTIVE_LOW, IPT_COIN1 ) - PORT_BIT(0x00020000, IP_ACTIVE_LOW, IPT_COIN2 ) + PORT_BIT( 0x00000003, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Music <<") + PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Music >>") + PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 Shift Up") + PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("P1 Shift Down") + PORT_BIT( 0x000000c0, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x0000ff00, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_NAME("P1 Coin") + PORT_BIT( 0x00020000, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_NAME("P2 Coin") PORT_SERVICE_NO_TOGGLE( 0x00040000, IP_ACTIVE_LOW ) - PORT_BIT(0x00080000, IP_ACTIVE_LOW, IPT_SERVICE1 ) - PORT_BIT(0x00100000, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT(0x00200000, IP_ACTIVE_LOW, IPT_START2 ) - PORT_BIT(0x00400000, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("1P Push Switch") PORT_CODE(KEYCODE_7) - PORT_BIT(0x00800000, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("2P Push Switch") PORT_CODE(KEYCODE_8) - PORT_BIT( 0xff00ff00, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x00080000, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("P1 Service Switch") + PORT_BIT( 0x00100000, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("P1 Start") + PORT_BIT( 0x00200000, IP_ACTIVE_LOW, IPT_START2 ) PORT_NAME("P2 Start") + PORT_BIT( 0x00400000, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_NAME("P2 Service Switch") + PORT_BIT( 0x00800000, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0xff000000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("IN2") PORT_DIPNAME( 0x00000001, 0x00000001, "IN2-0" ) @@ -1261,30 +1260,12 @@ static INPUT_PORTS_START( coolridr ) PORT_DIPNAME( 0x00000080, 0x00000080, DEF_STR( Unknown ) ) PORT_DIPSETTING( 0x00000080, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00010000, 0x00010000, "IN5-1" ) - PORT_DIPSETTING( 0x00010000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00020000, 0x00020000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00020000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00040000, 0x00040000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00040000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00080000, 0x00080000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00080000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00100000, 0x00100000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00100000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00200000, 0x00200000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00200000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00400000, 0x00400000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00400000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) - PORT_DIPNAME( 0x00800000, 0x00800000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x00800000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) + PORT_BIT( 0x00030000, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Music <<") + PORT_BIT( 0x00080000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Music >>") + PORT_BIT( 0x00100000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P2 Shift Up") + PORT_BIT( 0x00200000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P2 Shift Down") + PORT_BIT( 0x00c00000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0xff00ff00, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("IN6") @@ -1337,6 +1318,30 @@ static INPUT_PORTS_START( coolridr ) PORT_DIPSETTING( 0x00800000, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) PORT_BIT( 0xff00ff00, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("AN0") + PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(30) PORT_KEYDELTA(10) PORT_PLAYER(1) PORT_NAME("P1 Handle Bar") + + PORT_START("AN1") + PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(50) PORT_KEYDELTA(25) PORT_PLAYER(1) PORT_REVERSE PORT_NAME("P1 Throttle") + + PORT_START("AN2") + PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(50) PORT_KEYDELTA(25) PORT_PLAYER(1) PORT_REVERSE PORT_NAME("P1 Brake") + + PORT_START("AN3") + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("AN4") + PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(30) PORT_KEYDELTA(10) PORT_PLAYER(2) PORT_NAME("P2 Handle Bar") + + PORT_START("AN5") + PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(50) PORT_KEYDELTA(25) PORT_PLAYER(2) PORT_REVERSE PORT_NAME("P2 Throttle") + + PORT_START("AN6") + PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(50) PORT_KEYDELTA(25) PORT_PLAYER(2) PORT_REVERSE PORT_NAME("P2 Brake") + + PORT_START("AN7") + PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END