From aadaf0c303ceff7c00a3a25ec36f3f4f32bad7b9 Mon Sep 17 00:00:00 2001 From: arbee Date: Mon, 25 Dec 2017 22:27:02 -0500 Subject: [PATCH] mac: Support for "BootBug" NuBus remote debugger card [Al Kossow, R. Belmont] --- scripts/src/bus.lua | 2 + src/devices/bus/nubus/bootbug.cpp | 121 ++++++++++++++++++++++++++++++ src/devices/bus/nubus/bootbug.h | 46 ++++++++++++ src/mame/drivers/mac.cpp | 2 + 4 files changed, 171 insertions(+) create mode 100644 src/devices/bus/nubus/bootbug.cpp create mode 100644 src/devices/bus/nubus/bootbug.h diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index eb70f9523ba..23672aca0a3 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -1835,6 +1835,8 @@ if (BUSES["NUBUS"]~=null) then MAME_DIR .. "src/devices/bus/nubus/nubus_image.h", MAME_DIR .. "src/devices/bus/nubus/nubus_wsportrait.cpp", MAME_DIR .. "src/devices/bus/nubus/nubus_wsportrait.h", + MAME_DIR .. "src/devices/bus/nubus/bootbug.cpp", + MAME_DIR .. "src/devices/bus/nubus/bootbug.h", MAME_DIR .. "src/devices/bus/nubus/pds30_cb264.cpp", MAME_DIR .. "src/devices/bus/nubus/pds30_cb264.h", MAME_DIR .. "src/devices/bus/nubus/pds30_procolor816.cpp", diff --git a/src/devices/bus/nubus/bootbug.cpp b/src/devices/bus/nubus/bootbug.cpp new file mode 100644 index 00000000000..790d1373aad --- /dev/null +++ b/src/devices/bus/nubus/bootbug.cpp @@ -0,0 +1,121 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/*************************************************************************** + + Brigent BootBug card + + Debugger support card for creators of NuBus slot firmware and other + early-boot/low-level software. + + Basically a serial card with an overachieving declaration ROM. + +***************************************************************************/ + +#include "emu.h" +#include "bootbug.h" +#include "bus/rs232/rs232.h" +#include "bus/rs232/terminal.h" +#include "bus/rs232/null_modem.h" +#include "screen.h" + +static SLOT_INTERFACE_START(isa_com) + SLOT_INTERFACE("terminal", SERIAL_TERMINAL) + SLOT_INTERFACE("null_modem", NULL_MODEM) +SLOT_INTERFACE_END + +#define BOOTBUG_ROM_REGION "btbug_rom" + +ROM_START( bootbug ) + ROM_REGION(0x10000, BOOTBUG_ROM_REGION, 0) + ROM_LOAD( "bootbug1.5.bin", 0x000000, 0x010000, CRC(432badf0) SHA1(914ad4bb28946cac732cf8b178508b69e4c1aae2) ) +ROM_END + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +DEFINE_DEVICE_TYPE(NUBUS_BOOTBUG, nubus_bootbug_device, "nb_btbug", "Brigent BootBug debugger card") + + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +MACHINE_CONFIG_MEMBER( nubus_bootbug_device::device_add_mconfig ) + MCFG_DEVICE_ADD( "uart_0", NS16450, XTAL_1_8432MHz ) + MCFG_INS8250_OUT_TX_CB(DEVWRITELINE("serport0", rs232_port_device, write_txd)) + MCFG_INS8250_OUT_DTR_CB(DEVWRITELINE("serport0", rs232_port_device, write_dtr)) + MCFG_INS8250_OUT_RTS_CB(DEVWRITELINE("serport0", rs232_port_device, write_rts)) + //MCFG_INS8250_OUT_INT_CB(WRITELINE(nubus_bootbug, pc_com_interrupt_1)) + + MCFG_RS232_PORT_ADD( "serport0", isa_com, "terminal" ) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart_0", ins8250_uart_device, rx_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE("uart_0", ins8250_uart_device, dcd_w)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE("uart_0", ins8250_uart_device, dsr_w)) + MCFG_RS232_RI_HANDLER(DEVWRITELINE("uart_0", ins8250_uart_device, ri_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart_0", ins8250_uart_device, cts_w)) +MACHINE_CONFIG_END + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const tiny_rom_entry *nubus_bootbug_device::device_rom_region() const +{ + return ROM_NAME( bootbug ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// nubus_bootbug_device - constructor +//------------------------------------------------- + +nubus_bootbug_device::nubus_bootbug_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + nubus_bootbug_device(mconfig, NUBUS_BOOTBUG, tag, owner, clock) +{ +} + +nubus_bootbug_device::nubus_bootbug_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, type, tag, owner, clock), + device_nubus_card_interface(mconfig, *this), + m_uart(*this, "uart_0") +{ +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void nubus_bootbug_device::device_start() +{ + uint32_t slotspace; + + // set_nubus_device makes m_slot valid + set_nubus_device(); + install_declaration_rom(this, BOOTBUG_ROM_REGION); + + slotspace = get_slotspace(); + + m_nubus->install_device(slotspace, slotspace+0xff, read32_delegate(FUNC(nubus_bootbug_device::dev_r), this), write32_delegate(FUNC(nubus_bootbug_device::dev_w), this)); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void nubus_bootbug_device::device_reset() +{ +} + +WRITE32_MEMBER( nubus_bootbug_device::dev_w ) +{ + m_uart->ins8250_w(space, offset, data & 0xff); +} + +READ32_MEMBER( nubus_bootbug_device::dev_r ) +{ + return m_uart->ins8250_r(space, offset); +} diff --git a/src/devices/bus/nubus/bootbug.h b/src/devices/bus/nubus/bootbug.h new file mode 100644 index 00000000000..5dced2d119c --- /dev/null +++ b/src/devices/bus/nubus/bootbug.h @@ -0,0 +1,46 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +#ifndef MAME_BUS_NUBUS_BOOTBUG_H +#define MAME_BUS_NUBUS_BOOTBUG_H + +#pragma once + +#include "nubus.h" +#include "machine/ins8250.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> nubus_bootbug_device + +class nubus_bootbug_device : + public device_t, + public device_nubus_card_interface +{ +public: + // construction/destruction + nubus_bootbug_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + nubus_bootbug_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + + required_device m_uart; + + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; + virtual const tiny_rom_entry *device_rom_region() const override; + +private: + DECLARE_READ32_MEMBER(dev_r); + DECLARE_WRITE32_MEMBER(dev_w); +}; + +// device type definition +DECLARE_DEVICE_TYPE(NUBUS_BOOTBUG, nubus_bootbug_device) + +#endif // MAME_BUS_NUBUS_BOOTBUG_H diff --git a/src/mame/drivers/mac.cpp b/src/mame/drivers/mac.cpp index 79b75997ee4..7dc1d14c485 100644 --- a/src/mame/drivers/mac.cpp +++ b/src/mame/drivers/mac.cpp @@ -71,6 +71,7 @@ #include "bus/nubus/nubus_asntmc3b.h" #include "bus/nubus/nubus_image.h" #include "bus/nubus/nubus_m2video.h" +#include "bus/nubus/bootbug.h" #include "bus/nubus/pds30_cb264.h" #include "bus/nubus/pds30_procolor816.h" #include "bus/nubus/pds30_sigmalview.h" @@ -878,6 +879,7 @@ static SLOT_INTERFACE_START(mac_nubus_cards) SLOT_INTERFACE("asmc3nb", NUBUS_ASNTMC3NB) /* Asante MC3NB Ethernet card */ SLOT_INTERFACE("portrait", NUBUS_WSPORTRAIT) /* Apple Macintosh II Portrait video card */ SLOT_INTERFACE("enetnb", NUBUS_APPLEENET) /* Apple NuBus Ethernet */ + SLOT_INTERFACE("bootbug", NUBUS_BOOTBUG) /* Brigent BootBug debugger card */ SLOT_INTERFACE_END static SLOT_INTERFACE_START(mac_pds030_cards)