diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 3436ee589d4bd..1f1fd051f2b89 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -6194,9 +6194,11 @@ if BUSES["VME"] then dependency { { MAME_DIR .. "src/devices/bus/vme/sys68k_cpu1.cpp", GEN_DIR .. "emu/layout/sys68k_cpu1.lh" }, + { MAME_DIR .. "src/devices/bus/vme/sys68k_cpu20.cpp", GEN_DIR .. "emu/layout/sys68k_cpu21.lh" }, } custombuildtask { + layoutbuildtask("emu/layout", "sys68k_cpu21"), layoutbuildtask("emu/layout", "sys68k_cpu1"), } end diff --git a/src/devices/bus/vme/sys68k_cpu20.cpp b/src/devices/bus/vme/sys68k_cpu20.cpp index 2273a57920dba..3ae209a74ba14 100644 --- a/src/devices/bus/vme/sys68k_cpu20.cpp +++ b/src/devices/bus/vme/sys68k_cpu20.cpp @@ -187,6 +187,8 @@ #include "cpu/m68000/m68020.h" #include "bus/rs232/rs232.h" + +#include "sys68k_cpu21.lh" #include "machine/68230pit.h" #include "machine/68153bim.h" #include "machine/68561mpcc.h" @@ -241,6 +243,12 @@ static DEVICE_INPUT_DEFAULTS_START( terminal ) DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_2 ) DEVICE_INPUT_DEFAULTS_END +static INPUT_PORTS_START(sys68k_cpu20) + PORT_START("PANEL") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("RST") PORT_CODE(KEYCODE_F5) PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(vme_sys68k_cpu20_card_device_base::reset_button), 0) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("ABT") PORT_CODE(KEYCODE_F6) PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(vme_sys68k_cpu20_card_device_base::abort_button), 0) +INPUT_PORTS_END + void vme_sys68k_cpu20_card_device_base::cpu_space_map(address_map &map) { map(0xfffffff2, 0xffffffff).lr16(NAME([this](offs_t offset) -> u16 { return m_bim->iack(offset+1); })); @@ -307,6 +315,8 @@ void vme_sys68k_cpu20_card_device_base::device_add_mconfig(machine_config &confi rs232_port_device &rs232p3(RS232_PORT(config, RS232P3_TAG, default_rs232_devices, nullptr)); rs232p3.rxd_handler().set(m_mpcc3, FUNC(mpcc68561_device::write_rx)); rs232p3.cts_handler().set(m_mpcc3, FUNC(mpcc68561_device::cts_w)); + + config.set_default_layout(layout_sys68k_cpu21); } void vme_sys68k_cpu20_card_device::device_add_mconfig(machine_config &config) @@ -378,6 +388,11 @@ vme_sys68k_cpu20_card_device_base::vme_sys68k_cpu20_card_device_base(const machi , m_eprom (*this, "eprom") , m_ram (*this, "ram") , m_board_id(board_id) + , m_panel(*this, "PANEL") + , m_p4_conn(*this, "p4_conn") + , m_p3_conn(*this, "p3_conn") + , m_rs232p1(*this, "rs232p1") + , m_rs232p2(*this, "rs232p2") { LOG("vme_sys68k_cpu20_card_device_base ctor\n"); } @@ -447,6 +462,9 @@ void vme_sys68k_cpu20_card_device_base::device_start() read8_delegate(*subdevice("pit"), FUNC(z80sio_device::cb_r)), write8_delegate(*subdevice("pit"), FUNC(z80sio_device::cb_w)), 0x00ff); #endif m_arbiter_start = timer_alloc(FUNC(vme_sys68k_cpu20_card_device_base::grant_bus), this); + + m_p4_conn.resolve(); + m_p3_conn.resolve(); } void vme_sys68k_cpu20_card_device_base::device_reset() @@ -467,6 +485,43 @@ void vme_sys68k_cpu20_card_device_base::device_reset() m_boot_mph.remove(); } }); + + // Detect connected RS232 devices and update connector status outputs + auto detect_conn = [](rs232_port_device &port) -> int { + device_rs232_port_interface *dev = port.get_card_device(); + if (!dev) return 0; // nothing connected + std::string_view tag = dev->device().basetag(); + if (tag == "terminal") return 1; + if (tag == "null_modem") return 2; + if (tag == "printer") return 3; + return 0; + }; + m_p4_conn = detect_conn(*m_rs232p1); + m_p3_conn = detect_conn(*m_rs232p2); +} + +ioport_constructor vme_sys68k_cpu20_card_device_base::device_input_ports() const +{ + return INPUT_PORTS_NAME(sys68k_cpu20); +} + +INPUT_CHANGED_MEMBER(vme_sys68k_cpu20_card_device_base::reset_button) +{ + if (newval) + { + m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); + } + else + { + // Restore boot ROM mapping before releasing reset + device_reset(); + m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE); + } +} + +INPUT_CHANGED_MEMBER(vme_sys68k_cpu20_card_device_base::abort_button) +{ + m_maincpu->set_input_line(M68K_IRQ_7, newval ? ASSERT_LINE : CLEAR_LINE); } //------------------------------------------------- diff --git a/src/devices/bus/vme/sys68k_cpu20.h b/src/devices/bus/vme/sys68k_cpu20.h index 25f04980c2998..8f486c7f234bc 100644 --- a/src/devices/bus/vme/sys68k_cpu20.h +++ b/src/devices/bus/vme/sys68k_cpu20.h @@ -10,6 +10,8 @@ #include "machine/68230pit.h" #include "machine/68153bim.h" +class rs232_port_device; + DECLARE_DEVICE_TYPE(VME_SYS68K_CPU20, vme_sys68k_cpu20_card_device) DECLARE_DEVICE_TYPE(VME_SYS68K_CPU21S, vme_sys68k_cpu21s_card_device) DECLARE_DEVICE_TYPE(VME_SYS68K_CPU21, vme_sys68k_cpu21_card_device) @@ -23,6 +25,10 @@ DECLARE_DEVICE_TYPE(VME_SYS68K_CPU21YB, vme_sys68k_cpu21yb_card_device) //************************************************************************** class vme_sys68k_cpu20_card_device_base : public device_t, public device_vme_card_interface { +public: + DECLARE_INPUT_CHANGED_MEMBER(reset_button); + DECLARE_INPUT_CHANGED_MEMBER(abort_button); + protected: // PIT port C Board ID bits static constexpr unsigned CPU20 = 0x40; @@ -47,6 +53,7 @@ class vme_sys68k_cpu20_card_device_base : public device_t, public device_vme_ca // optional information overrides virtual void device_add_mconfig(machine_config &config) override ATTR_COLD; virtual const tiny_rom_entry *device_rom_region() const override ATTR_COLD; + virtual ioport_constructor device_input_ports() const override ATTR_COLD; TIMER_CALLBACK_MEMBER(grant_bus); @@ -80,6 +87,12 @@ class vme_sys68k_cpu20_card_device_base : public device_t, public device_vme_ca void update_irq_to_maincpu(); const fc_board_t m_board_id; + + required_ioport m_panel; + output_finder<> m_p4_conn; + output_finder<> m_p3_conn; + required_device m_rs232p1; + required_device m_rs232p2; }; //************************************************************************** diff --git a/src/emu/layout/sys68k_cpu1.lay b/src/emu/layout/sys68k_cpu1.lay index 1e5251fc51c10..d78c12531a3b3 100644 --- a/src/emu/layout/sys68k_cpu1.lay +++ b/src/emu/layout/sys68k_cpu1.lay @@ -105,9 +105,4 @@ Matches real hardware: RESET and ABORT pushbuttons, HALT LED, P3/P4/P5 connector - - - - - diff --git a/src/emu/layout/sys68k_cpu21.lay b/src/emu/layout/sys68k_cpu21.lay new file mode 100644 index 0000000000000..866a42b3d6191 --- /dev/null +++ b/src/emu/layout/sys68k_cpu21.lay @@ -0,0 +1,158 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +