From b0613ccfabac5fb2af9ad8fca272a8a919170adc Mon Sep 17 00:00:00 2001 From: angelosa Date: Wed, 5 Mar 2025 11:32:20 +0100 Subject: [PATCH] bus/cbus: add MIF-201 MIDI interface stub --- scripts/src/bus.lua | 2 + src/devices/bus/cbus/mif201.cpp | 70 ++++++++++++++++++++++++++++ src/devices/bus/cbus/mif201.h | 46 ++++++++++++++++++ src/devices/bus/cbus/pc9801_cbus.cpp | 28 ++++++----- src/mame/nec/pc88va.cpp | 9 ++-- src/mame/nec/pc88va.h | 3 +- 6 files changed, 141 insertions(+), 17 deletions(-) create mode 100644 src/devices/bus/cbus/mif201.cpp create mode 100644 src/devices/bus/cbus/mif201.h diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index e70daaaef9a..55ae9fb2424 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -5288,6 +5288,8 @@ if (BUSES["CBUS"]~=null) then files { MAME_DIR .. "src/devices/bus/cbus/amd98.cpp", MAME_DIR .. "src/devices/bus/cbus/amd98.h", + MAME_DIR .. "src/devices/bus/cbus/mif201.cpp", + MAME_DIR .. "src/devices/bus/cbus/mif201.h", MAME_DIR .. "src/devices/bus/cbus/mpu_pc98.cpp", MAME_DIR .. "src/devices/bus/cbus/mpu_pc98.h", MAME_DIR .. "src/devices/bus/cbus/pc9801_26.cpp", diff --git a/src/devices/bus/cbus/mif201.cpp b/src/devices/bus/cbus/mif201.cpp new file mode 100644 index 00000000000..4aa0ca7b94a --- /dev/null +++ b/src/devices/bus/cbus/mif201.cpp @@ -0,0 +1,70 @@ +// license:BSD-3-Clause +// copyright-holders: Angelo Salese +/************************************************************************************************** + +MIF-201 MIDI interface + +Bundled with Micro Musician VA + +References: +- https://mamedev.emulab.it/kale/fast/files/micromusician_va.jpg + +TODO: +- evasive, needs manual, dip-switch sheet and PCB pictures; + +**************************************************************************************************/ + +#include "emu.h" +#include "mif201.h" + +DEFINE_DEVICE_TYPE(MIF201, mif201_device, "mif201", "Micro Musician VA MIF-201 MIDI Interface") + +mif201_device::mif201_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, MIF201, tag, owner, clock) + , m_bus(*this, DEVICE_SELF_OWNER) + , m_uart(*this, "uart%u", 1U) + , m_pit(*this, "pit") +{ +} + +//void mif201_device::irq_out(int state) +//{ +// m_bus->int_w<2>(state); +//} + + +void mif201_device::device_add_mconfig(machine_config &config) +{ + // TODO: unknown clocks + I8251(config, m_uart[0], 1021800); + + I8251(config, m_uart[1], 1021800); + + PIT8253(config, m_pit, 1021800); +} + +void mif201_device::device_start() +{ + // sheet claims i8251-1 having swapped ports compared to i8251-2 but micromus just uses + // $e2d2 for control, assume typo. + m_bus->install_io(0xe2d0, 0xe2d3, + read8sm_delegate(*this, [this](offs_t offset) { return m_uart[0]->read(offset); }, "uart1_r"), + write8sm_delegate(*this, [this](offs_t offset, u8 data) { m_uart[0]->write(offset, data); }, "uart1_w") + ); + m_bus->install_io(0xe4d0, 0xe4d3, + read8sm_delegate(*this, [this](offs_t offset) { return m_uart[1]->read(offset); }, "uart2_r"), + write8sm_delegate(*this, [this](offs_t offset, u8 data) { m_uart[1]->write(offset, data); }, "uart2_w") + ); + m_bus->install_io(0xe6d0, 0xe6d3, + read8sm_delegate(*this, [this](offs_t offset) { return m_pit->read(offset); }, "pit_low_r"), + write8sm_delegate(*this, [this](offs_t offset, u8 data) { m_pit->write(offset, data); }, "pit_low_w") + ); + m_bus->install_io(0xe7d0, 0xe7d3, + read8sm_delegate(*this, [this](offs_t offset) { return m_pit->read(offset | 2); }, "pit_high_r"), + write8sm_delegate(*this, [this](offs_t offset, u8 data) { m_pit->write(offset | 2, data); }, "pit_high_w") + ); +} + +void mif201_device::device_reset() +{ +} diff --git a/src/devices/bus/cbus/mif201.h b/src/devices/bus/cbus/mif201.h new file mode 100644 index 00000000000..7270c146e4f --- /dev/null +++ b/src/devices/bus/cbus/mif201.h @@ -0,0 +1,46 @@ +// license:BSD-3-Clause +// copyright-holders: Angelo Salese +#ifndef MAME_BUS_CBUS_MIF201_H +#define MAME_BUS_CBUS_MIF201_H + +#pragma once + +#include "bus/cbus/pc9801_cbus.h" +#include "machine/i8251.h" +#include "machine/pit8253.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> mpu_pc98_device + +class mif201_device : public device_t +{ +public: + // construction/destruction + mif201_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + static constexpr feature_type unemulated_features() { return feature::SOUND; } + +protected: + // device-level overrides + virtual void device_start() override ATTR_COLD; + virtual void device_reset() override ATTR_COLD; + + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override ATTR_COLD; + +private: + required_device m_bus; + required_device_array m_uart; + required_device m_pit; + +// void map(address_map &map); +}; + + +// device type definition +DECLARE_DEVICE_TYPE(MIF201, mif201_device) + +#endif // MAME_BUS_CBUS_MIF201_H diff --git a/src/devices/bus/cbus/pc9801_cbus.cpp b/src/devices/bus/cbus/pc9801_cbus.cpp index 0471674aa68..33e1833d7e8 100644 --- a/src/devices/bus/cbus/pc9801_cbus.cpp +++ b/src/devices/bus/cbus/pc9801_cbus.cpp @@ -2,20 +2,24 @@ // copyright-holders:Angelo Salese /************************************************************************************************** - C-bus slot interface for PC-98xx family +C-bus slot interface for PC-98xx family - a.k.a. NEC version of the ISA bus. - C-bus -> Card Bus +a.k.a. NEC version of the ISA bus. +C-bus -> Compatible Bus - TODO: - - stub interface, checkout what actually belongs here. - Speculation is that C-bus has ROM / RAM slots always in the 0xc0000-0xdffff region, - and some opacity can be added if true. - - move pc9801_cbus_devices declaration from pc9801 driver in here; - - 8-bit I/O smearing should be handled here; - - INT# should be handled here too; - - Best way to inform user when it tries to install incompatible boards? - - Support for PCI bridging on later machines (cfr. pc9801cx3); +References: +- https://98epjunk.shakunage.net/sw/ext_card/ext_card.html +- https://ja.wikipedia.org/wiki/C%E3%83%90%E3%82%B9 +- https://www.pc-9800.net/db2/db2_ga_index.htm +- http://ookumaneko.s1005.xrea.com/pcibios.htm (PCI era mapping) + +TODO: +- stub interface, checkout what actually belongs here +- move pc9801_cbus_devices declaration from pc9801 driver in here; +- 8-bit I/O smearing should be handled here; +- INT# should be handled here too; +- Best way to inform user when it tries to install incompatible boards? +- Support for PCI bridging on later machines (cfr. pc9821cx3); **************************************************************************************************/ diff --git a/src/mame/nec/pc88va.cpp b/src/mame/nec/pc88va.cpp index e1c5212dfe8..0c702a53a99 100644 --- a/src/mame/nec/pc88va.cpp +++ b/src/mame/nec/pc88va.cpp @@ -753,11 +753,11 @@ void pc88va_state::io_map(address_map &map) ); map(0x0540, 0x0547).umask16(0x00ff).lrw8( NAME([this] (offs_t offset) { - LOGGFXCTRL("PATRH%d R\n", offset); + LOGGFXCTRL("Multiplane PATRH%d R\n", offset); return m_multiplane.patr[offset][1]; }), NAME([this] (offs_t offset, u8 data) { - LOGGFXCTRL("PATRH%d W %02x\n", offset, data); + LOGGFXCTRL("Multiplane PATRH%d W %02x\n", offset, data); m_multiplane.patr[offset][1] = data; }) ); @@ -802,11 +802,11 @@ void pc88va_state::io_map(address_map &map) ); map(0x0590, 0x0593).umask16(0x00ff).lrw8( NAME([this] (offs_t offset) { - LOGGFXCTRL("Singleplane PATRL%d R\n", offset); + LOGGFXCTRL("Singleplane PATR%d R\n", offset); return m_singleplane.patr[offset]; }), NAME([this] (offs_t offset, u8 data) { - LOGGFXCTRL("Singleplane PATRL%d W %02x\n", offset, data); + LOGGFXCTRL("Singleplane PATR%d W %02x\n", offset, data); m_singleplane.patr[offset] = data; }) ); @@ -1265,6 +1265,7 @@ static void pc88va_cbus_devices(device_slot_interface &device) { device.option_add("pc9801_55u", PC9801_55U); device.option_add("pc9801_55l", PC9801_55L); + device.option_add("mif_201", MIF201); device.option_add("mpu_pc98", MPU_PC98); } diff --git a/src/mame/nec/pc88va.h b/src/mame/nec/pc88va.h index 9271a5e1baa..c70fd076af3 100644 --- a/src/mame/nec/pc88va.h +++ b/src/mame/nec/pc88va.h @@ -29,11 +29,12 @@ #include "sound/ymopn.h" //#include "bus/cbus/amd98.h" +#include "bus/cbus/mif201.h" +#include "bus/cbus/mpu_pc98.h" //#include "bus/cbus/pc9801_26.h" #include "bus/cbus/pc9801_55.h" //#include "bus/cbus/pc9801_86.h" //#include "bus/cbus/pc9801_118.h" -#include "bus/cbus/mpu_pc98.h" //#include "bus/cbus/sb16_ct2720.h"