Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions scripts/src/bus.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
55 changes: 55 additions & 0 deletions src/devices/bus/vme/sys68k_cpu20.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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); }));
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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");
}
Expand Down Expand Up @@ -447,6 +462,9 @@ void vme_sys68k_cpu20_card_device_base::device_start()
read8_delegate(*subdevice<z80sio_device>("pit"), FUNC(z80sio_device::cb_r)), write8_delegate(*subdevice<z80sio_device>("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()
Expand All @@ -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
Copy link
Member

@happppp happppp Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks hacky IMO. Why does it need to know this? Is it only for aesthetics? I saw the same thing in your previous commit.

edit: maybe can be done with luascript in the .lay file? Still hacky, but better there than in the device.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be, since there are no possibility to view any cables when plugged in it is helpful to know what device is plugged in where so I just added some text to indicate that. Manuals usually talk about plugin the terminal in port p2 and printer in p4 or whatever. But there might be a better way to know that, apart from remember it

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);
}

//-------------------------------------------------
Expand Down
13 changes: 13 additions & 0 deletions src/devices/bus/vme/sys68k_cpu20.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
Expand All @@ -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);

Expand Down Expand Up @@ -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<rs232_port_device> m_rs232p1;
required_device<rs232_port_device> m_rs232p2;
};

//**************************************************************************
Expand Down
5 changes: 0 additions & 5 deletions src/emu/layout/sys68k_cpu1.lay
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,4 @@ Matches real hardware: RESET and ABORT pushbuttons, HALT LED, P3/P4/P5 connector
<screen tag="p4:terminal:terminal_screen"><bounds x="52" y="0" width="460" height="345" /></screen>
</view>

<!-- Terminal view: just the terminal screen (dropped if no terminal attached) -->
<view name="Terminal">
<screen tag="p4:terminal:terminal_screen"><bounds x="0" y="0" width="640" height="480" /></screen>
</view>

</mamelayout>
158 changes: 158 additions & 0 deletions src/emu/layout/sys68k_cpu21.lay
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
<?xml version="1.0"?>
<!--
license:CC0-1.0
copyright-holders:Joakim Larsson Edstrom

Force Computers SYS68K/CPU-21 front panel layout
-->
<mamelayout version="2">

<!-- Background colors -->
<element name="panel_bg">
<rect><color red="0.15" green="0.15" blue="0.15" /></rect>
</element>
<element name="silver">
<rect><color red="0.75" green="0.75" blue="0.75" /></rect>
</element>

<!-- LED element (green, active high) -->
<element name="led_green" defstate="0">
<disk state="0"><color red="0.1" green="0.2" blue="0.1" /></disk>
<disk state="1"><color red="0.0" green="1.0" blue="0.0" /></disk>
</element>

<!-- Text labels (white on dark) -->
<element name="txt_cpu21"><text string="CPU-21"><color red="0.9" green="0.9" blue="0.9" /></text></element>
<element name="txt_run"><text string="RUN"><color red="0.9" green="0.9" blue="0.9" /></text></element>
<element name="txt_hlt"><text string="HLT"><color red="0.9" green="0.9" blue="0.9" /></text></element>
<element name="txt_bm"><text string="BM"><color red="0.9" green="0.9" blue="0.9" /></text></element>
<element name="txt_flm"><text string="FLM"><color red="0.9" green="0.9" blue="0.9" /></text></element>
<element name="txt_epr"><text string="EPR"><color red="0.9" green="0.9" blue="0.9" /></text></element>
<element name="txt_2ws"><text string="2WS"><color red="0.9" green="0.9" blue="0.9" /></text></element>
<element name="txt_4ws"><text string="4WS"><color red="0.9" green="0.9" blue="0.9" /></text></element>
<element name="txt_6ws"><text string="6WS"><color red="0.9" green="0.9" blue="0.9" /></text></element>
<element name="txt_8ws"><text string="8WS"><color red="0.9" green="0.9" blue="0.9" /></text></element>
<element name="txt_12ws"><text string="12WS"><color red="0.9" green="0.9" blue="0.9" /></text></element>
<element name="txt_14ws"><text string="14WS"><color red="0.9" green="0.9" blue="0.9" /></text></element>
<element name="txt_csh"><text string="CSH"><color red="0.9" green="0.9" blue="0.9" /></text></element>
<element name="txt_rm"><text string="R/M"><color red="0.9" green="0.9" blue="0.9" /></text></element>
<element name="txt_rs232"><text string="RS232"><color red="0.9" green="0.9" blue="0.9" /></text></element>
<element name="txt_p4"><text string="P4"><color red="0.9" green="0.9" blue="0.9" /></text></element>
<element name="txt_p3"><text string="P3"><color red="0.9" green="0.9" blue="0.9" /></text></element>

<!-- Interactive button elements (two-state for press feedback) -->
<element name="btn_rst" defstate="0">
<rect state="0"><color red="0.25" green="0.25" blue="0.25" /></rect>
<rect state="1"><color red="0.40" green="0.40" blue="0.40" /></rect>
<text string="RST"><color red="0.9" green="0.9" blue="0.9" /></text>
</element>
<element name="btn_abt" defstate="0">
<rect state="0"><color red="0.25" green="0.25" blue="0.25" /></rect>
<rect state="1"><color red="0.40" green="0.40" blue="0.40" /></rect>
<text string="ABT"><color red="0.9" green="0.9" blue="0.9" /></text>
</element>

<!-- Non-interactive button elements -->
<element name="btn_dark">
<rect><color red="0.25" green="0.25" blue="0.25" /></rect>
</element>

<!-- DB25 connector rectangle -->
<element name="db25">
<rect><color red="0.60" green="0.60" blue="0.60" /></rect>
</element>

<!-- Connection status (4-state output) -->
<element name="conn_status" defstate="0">
<text state="0" string="--"><color red="0.5" green="0.5" blue="0.5" /></text>
<text state="1" string="TERMINAL"><color red="0.0" green="1.0" blue="0.0" /></text>
<text state="2" string="NULL MODEM"><color red="0.0" green="1.0" blue="0.0" /></text>
<text state="3" string="PRINTER"><color red="0.0" green="1.0" blue="0.0" /></text>
</element>

<!-- Front panel group (reusable across views) -->
<group name="panel">
<!-- Dark panel background -->
<element ref="panel_bg"><bounds x="0" y="0" width="46" height="345" /></element>
<!-- Silver accent strip -->
<element ref="silver"><bounds x="46" y="0" width="2" height="345" /></element>

<!-- Title -->
<element ref="txt_cpu21"><bounds x="3" y="5" width="40" height="14" /></element>

<!-- RST button (interactive) -->
<element ref="btn_rst" inputtag="PANEL" inputmask="0x01"><bounds x="8" y="30" width="30" height="16" /></element>

<!-- ABT button (interactive) -->
<element ref="btn_abt" inputtag="PANEL" inputmask="0x02"><bounds x="8" y="50" width="30" height="16" /></element>

<!-- LEDs with labels -->
<!-- RUN -->
<element name="led_run" ref="led_green"><bounds x="6" y="82" width="8" height="8" /></element>
<element ref="txt_run"><bounds x="16" y="81" width="26" height="10" /></element>
<!-- HLT -->
<element name="led_hlt" ref="led_green"><bounds x="6" y="96" width="8" height="8" /></element>
<element ref="txt_hlt"><bounds x="16" y="95" width="26" height="10" /></element>
<!-- BM -->
<element name="led_bm" ref="led_green"><bounds x="6" y="110" width="8" height="8" /></element>
<element ref="txt_bm"><bounds x="16" y="109" width="26" height="10" /></element>

<!-- FLM -->
<element name="led_flm" ref="led_green"><bounds x="6" y="132" width="8" height="8" /></element>
<element ref="txt_flm"><bounds x="16" y="131" width="26" height="10" /></element>
<!-- EPR -->
<element name="led_epr" ref="led_green"><bounds x="6" y="146" width="8" height="8" /></element>
<element ref="txt_epr"><bounds x="16" y="145" width="26" height="10" /></element>
<!-- 2WS -->
<element name="led_2ws" ref="led_green"><bounds x="6" y="160" width="8" height="8" /></element>
<element ref="txt_2ws"><bounds x="16" y="159" width="26" height="10" /></element>
<!-- 4WS -->
<element name="led_4ws" ref="led_green"><bounds x="6" y="174" width="8" height="8" /></element>
<element ref="txt_4ws"><bounds x="16" y="173" width="26" height="10" /></element>
<!-- 6WS -->
<element name="led_6ws" ref="led_green"><bounds x="6" y="188" width="8" height="8" /></element>
<element ref="txt_6ws"><bounds x="16" y="187" width="26" height="10" /></element>
<!-- 8WS -->
<element name="led_8ws" ref="led_green"><bounds x="6" y="202" width="8" height="8" /></element>
<element ref="txt_8ws"><bounds x="16" y="201" width="26" height="10" /></element>
<!-- 12WS -->
<element name="led_12ws" ref="led_green"><bounds x="6" y="216" width="8" height="8" /></element>
<element ref="txt_12ws"><bounds x="16" y="215" width="26" height="10" /></element>
<!-- 14WS -->
<element name="led_14ws" ref="led_green"><bounds x="6" y="230" width="8" height="8" /></element>
<element ref="txt_14ws"><bounds x="16" y="229" width="26" height="10" /></element>

<!-- CSH button -->
<element ref="btn_dark"><bounds x="8" y="254" width="30" height="16" /></element>
<element ref="txt_csh"><bounds x="8" y="256" width="30" height="12" /></element>

<!-- R/M button -->
<element ref="btn_dark"><bounds x="8" y="274" width="30" height="16" /></element>
<element ref="txt_rm"><bounds x="8" y="276" width="30" height="12" /></element>

<!-- Serial port area -->
<element ref="txt_rs232"><bounds x="3" y="298" width="40" height="10" /></element>

<!-- P4 connector (rs232p1 - terminal) -->
<element ref="txt_p4"><bounds x="3" y="312" width="18" height="8" /></element>
<element ref="db25"><bounds x="5" y="321" width="14" height="7" /></element>
<element name="p4_conn" ref="conn_status"><bounds x="1" y="330" width="22" height="8" /></element>

<!-- P3 connector (rs232p2) -->
<element ref="txt_p3"><bounds x="25" y="312" width="18" height="8" /></element>
<element ref="db25"><bounds x="27" y="321" width="14" height="7" /></element>
<element name="p3_conn" ref="conn_status"><bounds x="23" y="330" width="22" height="8" /></element>
</group>

<!-- Front Panel: standalone panel strip (always available) -->
<view name="Front Panel">
<group ref="panel"><bounds x="0" y="0" width="48" height="345" /></group>
</view>

<!-- Front Panel with Terminal: panel strip + terminal side by side (dropped if no terminal) -->
<view name="Front Panel with Terminal">
<group ref="panel"><bounds x="0" y="0" width="48" height="345" /></group>
<screen tag="rs232p1:terminal:terminal_screen"><bounds x="52" y="0" width="460" height="345" /></screen>
</view>

</mamelayout>
Loading