diff options
-rw-r--r-- | src/mame/konami/zr107.cpp | 87 |
1 files changed, 44 insertions, 43 deletions
diff --git a/src/mame/konami/zr107.cpp b/src/mame/konami/zr107.cpp index 5a00db6b395..607b0e50ec6 100644 --- a/src/mame/konami/zr107.cpp +++ b/src/mame/konami/zr107.cpp @@ -8,7 +8,7 @@ TODO: - segfaults on soft reset; - - jetwave: fix debug mode; + - jetwave motors/sensors Hardware overview: @@ -193,8 +193,8 @@ namespace { class zr107_state : public driver_device { public: - zr107_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + zr107_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_dsp(*this, "dsp"), @@ -231,7 +231,7 @@ protected: required_device<k001006_device> m_k001006_1; required_ioport_array<5> m_in; required_ioport m_out4, m_eepromout; - required_ioport_array<3> m_analog; + optional_ioport_array<3> m_analog; output_finder<2> m_pcb_digit; required_device<screen_device> m_screen; required_device<palette_device> m_palette; @@ -263,8 +263,8 @@ protected: class midnrun_state : public zr107_state { public: - midnrun_state(const machine_config &mconfig, device_type type, const char *tag) - : zr107_state(mconfig, type, tag), + midnrun_state(const machine_config &mconfig, device_type type, const char *tag) : + zr107_state(mconfig, type, tag), m_k056832(*this, "k056832") { } @@ -286,8 +286,8 @@ private: class jetwave_state : public zr107_state { public: - jetwave_state(const machine_config &mconfig, device_type type, const char *tag) - : zr107_state(mconfig, type, tag), + jetwave_state(const machine_config &mconfig, device_type type, const char *tag) : + zr107_state(mconfig, type, tag), m_k001604(*this, "k001604"), m_k001006_2(*this, "k001006_2") { } @@ -492,13 +492,13 @@ void midnrun_state::main_memmap(address_map &map) map(0x74060000, 0x7406003f).rw(FUNC(midnrun_state::ccu_r), FUNC(midnrun_state::ccu_w)); map(0x74080000, 0x74081fff).ram().w(m_palette, FUNC(palette_device::write32)).share("palette"); map(0x740a0000, 0x740a3fff).r(m_k056832, FUNC(k056832_device::rom_word_r)); - map(0x78000000, 0x7800ffff).rw(m_konppc, FUNC(konppc_device::cgboard_dsp_shared_r_ppc), FUNC(konppc_device::cgboard_dsp_shared_w_ppc)); // 21N 21K 23N 23K + map(0x78000000, 0x7800ffff).rw(m_konppc, FUNC(konppc_device::cgboard_dsp_shared_r_ppc), FUNC(konppc_device::cgboard_dsp_shared_w_ppc)); // 21N 21K 23N 23K map(0x78010000, 0x7801ffff).w(m_konppc, FUNC(konppc_device::cgboard_dsp_shared_w_ppc)); map(0x78040000, 0x7804000f).rw(m_k001006_1, FUNC(k001006_device::read), FUNC(k001006_device::write)); map(0x780c0000, 0x780c0007).rw(m_konppc, FUNC(konppc_device::cgboard_dsp_comm_r_ppc), FUNC(konppc_device::cgboard_dsp_comm_w_ppc)); map(0x7e000000, 0x7e003fff).rw(FUNC(midnrun_state::sysreg_r), FUNC(midnrun_state::sysreg_w)); map(0x7e008000, 0x7e009fff).m(m_k056230, FUNC(k056230_device::regs_map)); // LANC registers - map(0x7e00a000, 0x7e00bfff).rw(m_k056230, FUNC(k056230_device::ram_r), FUNC(k056230_device::ram_w)); // LANC Buffer RAM (27E) + map(0x7e00a000, 0x7e00bfff).rw(m_k056230, FUNC(k056230_device::ram_r), FUNC(k056230_device::ram_w)); // LANC Buffer RAM (27E) map(0x7e00c000, 0x7e00c00f).rw(m_k056800, FUNC(k056800_device::host_r), FUNC(k056800_device::host_w)); map(0x7f800000, 0x7f9fffff).rom().region("prgrom", 0); map(0x7fe00000, 0x7fffffff).rom().region("prgrom", 0); @@ -512,14 +512,14 @@ void jetwave_state::main_memmap(address_map &map) map(0x74010000, 0x7401ffff).ram().w(m_palette, FUNC(palette_device::write32)).share("palette"); map(0x74020000, 0x7403ffff).rw(m_k001604, FUNC(k001604_device::tile_r), FUNC(k001604_device::tile_w)); map(0x74040000, 0x7407ffff).rw(m_k001604, FUNC(k001604_device::char_r), FUNC(k001604_device::char_w)); - map(0x78000000, 0x7800ffff).rw(m_konppc, FUNC(konppc_device::cgboard_dsp_shared_r_ppc), FUNC(konppc_device::cgboard_dsp_shared_w_ppc)); // 21N 21K 23N 23K + map(0x78000000, 0x7800ffff).rw(m_konppc, FUNC(konppc_device::cgboard_dsp_shared_r_ppc), FUNC(konppc_device::cgboard_dsp_shared_w_ppc)); // 21N 21K 23N 23K map(0x78010000, 0x7801ffff).w(m_konppc, FUNC(konppc_device::cgboard_dsp_shared_w_ppc)); map(0x78040000, 0x7804000f).rw(m_k001006_1, FUNC(k001006_device::read), FUNC(k001006_device::write)); map(0x78080000, 0x7808000f).rw(m_k001006_2, FUNC(k001006_device::read), FUNC(k001006_device::write)); map(0x780c0000, 0x780c0007).rw(m_konppc, FUNC(konppc_device::cgboard_dsp_comm_r_ppc), FUNC(konppc_device::cgboard_dsp_comm_w_ppc)); map(0x7e000000, 0x7e003fff).rw(FUNC(jetwave_state::sysreg_r), FUNC(jetwave_state::sysreg_w)); map(0x7e008000, 0x7e009fff).m(m_k056230, FUNC(k056230_device::regs_map)); // LANC registers - map(0x7e00a000, 0x7e00bfff).rw(m_k056230, FUNC(k056230_device::ram_r), FUNC(k056230_device::ram_w)); // LANC Buffer RAM (27E) + map(0x7e00a000, 0x7e00bfff).rw(m_k056230, FUNC(k056230_device::ram_r), FUNC(k056230_device::ram_w)); // LANC Buffer RAM (27E) map(0x7e00c000, 0x7e00c00f).rw(m_k056800, FUNC(k056800_device::host_r), FUNC(k056800_device::host_w)); map(0x7f000000, 0x7f3fffff).rom().region("datarom", 0); map(0x7f800000, 0x7f9fffff).rom().region("prgrom", 0); @@ -541,7 +541,7 @@ void zr107_state::sound_ctrl_w(uint8_t data) void zr107_state::sound_memmap(address_map &map) { map(0x000000, 0x01ffff).rom(); - map(0x100000, 0x103fff).ram(); // Work RAM + map(0x100000, 0x103fff).ram(); // Work RAM map(0x200000, 0x2004ff).rw("k054539_1", FUNC(k054539_device::read), FUNC(k054539_device::write)).umask16(0xff00); map(0x200000, 0x2004ff).rw("k054539_2", FUNC(k054539_device::read), FUNC(k054539_device::write)).umask16(0x00ff); map(0x400000, 0x40001f).rw(m_k056800, FUNC(k056800_device::sound_r), FUNC(k056800_device::sound_w)).umask16(0x00ff); @@ -595,8 +595,8 @@ static INPUT_PORTS_START( midnrun ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_NAME("Shift Up") PORT_4WAY PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_NAME("Shift Down") PORT_4WAY PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_NAME("Auto Shift") PORT_4WAY PORT_TOGGLE PORT_CONDITION("IN3", 0x02, EQUALS, 0x02) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("AT/MT Switch") PORT_CONDITION("IN3", 0x02, EQUALS, 0x00) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Service Button") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("AT/MT Switch") PORT_CONDITION("IN3", 0x02, EQUALS, 0x00) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_BIT( 0x0b, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("IN3") @@ -614,16 +614,16 @@ static INPUT_PORTS_START( midnrun ) PORT_DIPSETTING( 0x00, "Button" ) PORT_DIPNAME( 0x01, 0x01, "CG Board Type" ) PORT_DIPLOCATION("SW:1") PORT_DIPSETTING( 0x01, "Single" ) - PORT_DIPSETTING( 0x00, "Twin" ) //unused + PORT_DIPSETTING( 0x00, "Twin" ) // unused PORT_START("ANALOG1") - PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_NAME("Steering Wheel") PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) + PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_NAME("Steering Wheel") PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(16) PORT_START("ANALOG2") - PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_NAME("Gas Pedal") PORT_MINMAX(0x00,0xf0) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) + PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_NAME("Gas Pedal") PORT_MINMAX(0x00,0x80) PORT_SENSITIVITY(25) PORT_KEYDELTA(16) PORT_START("ANALOG3") - PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_NAME("Brake Pedal") PORT_MINMAX(0x00,0xf0) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) + PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_NAME("Brake Pedal") PORT_MINMAX(0x00,0x80) PORT_SENSITIVITY(25) PORT_KEYDELTA(16) INPUT_PORTS_END static INPUT_PORTS_START( jetwave ) @@ -631,15 +631,20 @@ static INPUT_PORTS_START( jetwave ) PORT_START("IN0") PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Start/View") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("T-Center") //Non-analog acell - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Angle") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_NAME("Left Turn") //Non-analog left - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_NAME("Right Turn") //Non-analog right + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_CONDITION("IN0", 0x18, NOTEQUALS, 0x18) // T-Center + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Angle") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_NAME("Tilt Left") PORT_PLAYER(2) PORT_CONDITION("IN3", 0x01, EQUALS, 0x01) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_NAME("Tilt Right") PORT_PLAYER(2) PORT_CONDITION("IN3", 0x01, EQUALS, 0x01) PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_UNKNOWN ) + // digital controls when in dev mode + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Accelerator (Dev)") PORT_CONDITION("IN3", 0x01, EQUALS, 0x00) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_NAME("Handle Left (Dev)") PORT_CONDITION("IN3", 0x01, EQUALS, 0x00) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_NAME("Handle Right (Dev)") PORT_CONDITION("IN3", 0x01, EQUALS, 0x00) + PORT_START("IN3") PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Service Button") PORT_CODE(KEYCODE_9) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_DIPNAME( 0x0c, 0x0c, "Network ID" ) PORT_DIPLOCATION("SW:4,3") @@ -647,22 +652,18 @@ static INPUT_PORTS_START( jetwave ) PORT_DIPSETTING( 0x08, "2" ) PORT_DIPSETTING( 0x04, "3" ) PORT_DIPSETTING( 0x00, "4" ) - // TODO: make these two less confusing - PORT_DIPNAME( 0x02, 0x00, "Drive System" ) PORT_DIPLOCATION("SW:2") //Sensors for force feedback. Todo: "Disable" the sensors so this switch can be set to off without errors. + PORT_DIPNAME( 0x02, 0x00, "Drive System" ) PORT_DIPLOCATION("SW:2") + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) // Disables and bypasses all sensor checks. This disables the force feedback on actual hardware. PORT_DIPSETTING( 0x02, DEF_STR( On ) ) // Enables the sensors/normal use. - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) //Disables and bypasses all sensor checks. This disables the force feedback on actual hardware. PORT_DIPNAME( 0x01, 0x01, "Running Mode" ) PORT_DIPLOCATION("SW:1") - PORT_DIPSETTING( 0x01, "Product" ) //Enables the analog inputs; normal usage - PORT_DIPSETTING( 0x00, "Check" ) //Disables them for use with a JAMMA interface; intended for development purposes. + PORT_DIPSETTING( 0x01, "Production" ) // Enables the analog inputs; normal usage + PORT_DIPSETTING( 0x00, "Developer" ) // Disables them for use with a JAMMA interface; intended for development purposes. PORT_START("ANALOG1") - PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_NAME("Steering") PORT_MINMAX(0x20,0xe0) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_REVERSE + PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_NAME("Steering Handle") PORT_MINMAX(0x70,0x90) PORT_SENSITIVITY(25) PORT_KEYDELTA(4) PORT_REVERSE PORT_START("ANALOG2") - PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_NAME("Accelerator") PORT_MINMAX(0x00,0x90) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) - - PORT_START("ANALOG3") //actually required else MAME will crash if this port is removed. - PORT_BIT( 0xff, 0x00, IPT_UNUSED ) + PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_NAME("Accelerator") PORT_MINMAX(0x00,0x20) PORT_SENSITIVITY(25) PORT_KEYDELTA(4) INPUT_PORTS_END @@ -673,15 +674,15 @@ double zr107_state::adc0838_callback(uint8_t input) switch (input) { case ADC083X_CH0: - return (double)(5 * m_analog[0]->read()) / 255.0; + return (double)(5 * m_analog[0].read_safe(0)) / 255.0; case ADC083X_CH1: - return (double)(5 * m_analog[1]->read()) / 255.0; + return (double)(5 * m_analog[1].read_safe(0)) / 255.0; case ADC083X_CH2: - return (double)(5 * m_analog[2]->read()) / 255.0; + return (double)(5 * m_analog[2].read_safe(0)) / 255.0; case ADC083X_VREF: - return 5; - default: - return 0; + return 5.0; + case ADC083X_AGND: default: + return 0.0; } } @@ -724,9 +725,9 @@ void zr107_state::machine_reset() void zr107_state::zr107(machine_config &config) { // basic machine hardware - PPC403GA(config, m_maincpu, XTAL(64'000'000)/2); // PowerPC 403GA 32MHz + PPC403GA(config, m_maincpu, XTAL(64'000'000)/2); // PowerPC 403GA 32MHz - M68000(config, m_audiocpu, XTAL(64'000'000)/8); // 8MHz + M68000(config, m_audiocpu, XTAL(64'000'000)/8); // 8MHz m_audiocpu->set_addrmap(AS_PROGRAM, &zr107_state::sound_memmap); ADSP21062(config, m_dsp, XTAL(36'000'000)); @@ -804,7 +805,7 @@ void jetwave_state::jetwave(machine_config &config) // video hardware m_screen->set_size(1024, 1024); - m_screen->set_visarea(40, 511 + 40, 27, 383 + 27); // needs CRTC emulation + m_screen->set_visarea(40, 511 + 40, 27, 383 + 27); // needs CRTC emulation m_screen->set_screen_update(FUNC(jetwave_state::screen_update)); m_palette->set_format(4, raw_to_rgb_converter::standard_rgb_decoder<5,5,5, 10,5,0>, 16384); |