diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 7ae85734f1e..fcc279fee3d 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -3087,3 +3087,23 @@ if (BUSES["PC1512"]~=null) then MAME_DIR .. "src/devices/bus/pc1512/mouse.h", } end + +--------------------------------------------------- +-- +--@src/devices/bus/cbus/pc9801_cbus.h,BUSES["CBUS"] = true +--------------------------------------------------- + +if (BUSES["CBUS"]~=null) then + files { + MAME_DIR .. "src/devices/bus/cbus/pc9801_26.cpp", + MAME_DIR .. "src/devices/bus/cbus/pc9801_26.h", + MAME_DIR .. "src/devices/bus/cbus/pc9801_86.cpp", + MAME_DIR .. "src/devices/bus/cbus/pc9801_86.h", + MAME_DIR .. "src/devices/bus/cbus/pc9801_118.cpp", + MAME_DIR .. "src/devices/bus/cbus/pc9801_118.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_cbus.cpp", + MAME_DIR .. "src/devices/bus/cbus/pc9801_cbus.h", + } +end diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index cdbd0eea109..55051303c8c 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -636,6 +636,7 @@ BUSES["BW2"] = true BUSES["C64"] = true BUSES["CBM2"] = true BUSES["CBMIEC"] = true +BUSES["CBUS"] = true BUSES["CENTRONICS"] = true BUSES["CGENIE_EXPANSION"] = true BUSES["CGENIE_PARALLEL"] = true @@ -2382,14 +2383,6 @@ files { MAME_DIR .. "src/mame/drivers/pc88va.cpp", MAME_DIR .. "src/mame/drivers/pc100.cpp", MAME_DIR .. "src/mame/drivers/pc9801.cpp", - MAME_DIR .. "src/mame/machine/pc9801_26.cpp", - MAME_DIR .. "src/mame/machine/pc9801_26.h", - MAME_DIR .. "src/mame/machine/pc9801_86.cpp", - MAME_DIR .. "src/mame/machine/pc9801_86.h", - MAME_DIR .. "src/mame/machine/pc9801_118.cpp", - MAME_DIR .. "src/mame/machine/pc9801_118.h", - MAME_DIR .. "src/mame/machine/pc9801_cbus.cpp", - MAME_DIR .. "src/mame/machine/pc9801_cbus.h", MAME_DIR .. "src/mame/machine/pc9801_kbd.cpp", MAME_DIR .. "src/mame/machine/pc9801_kbd.h", MAME_DIR .. "src/mame/machine/pc9801_cd.cpp", diff --git a/src/devices/bus/cbus/mpu_pc98.cpp b/src/devices/bus/cbus/mpu_pc98.cpp new file mode 100644 index 00000000000..0f26fe4ac94 --- /dev/null +++ b/src/devices/bus/cbus/mpu_pc98.cpp @@ -0,0 +1,84 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont,Kevin Horton +/*************************************************************************** + + MPU-401 MIDI device interface + +***************************************************************************/ + +#include "mpu_pc98.h" + +#include "emu.h" +#include "machine/pic8259.h" + +#define MPU_CORE_TAG "mpu401" + + +/* +DIP-SWs +1-2-3-4 + 0xc0d0 + 1 0xc4d0 + 1 0xc8d0 +... +1 0xe0d0 (default) +... +1 1 1 1 0xfcd0 + +5-6-7-8 +1 irq12 + 1 irq6 (default) + 1 irq5 + 1 irq3 +*/ + +WRITE_LINE_MEMBER( mpu_pc98_device::mpu_irq_out ) +{ +} + +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +DEFINE_DEVICE_TYPE(MPU_PC98, mpu_pc98_device, "mpu_pc98", "Roland MPU-401 MIDI Interface (CBUS)") + +//------------------------------------------------- +// device_add_mconfig - add device configuration +//------------------------------------------------- + +MACHINE_CONFIG_MEMBER( mpu_pc98_device::device_add_mconfig ) + MCFG_MPU401_ADD(MPU_CORE_TAG, WRITELINE(mpu_pc98_device, mpu_irq_out)) +MACHINE_CONFIG_END + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +mpu_pc98_device::mpu_pc98_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, MPU_PC98, tag, owner, clock) + , m_mpu401(*this, MPU_CORE_TAG) +{ +} + +DEVICE_ADDRESS_MAP_START(map, 16, mpu_pc98_device) + AM_RANGE(0, 3) AM_DEVREADWRITE8(MPU_CORE_TAG, mpu401_device, mpu_r, mpu_w, 0xff) +ADDRESS_MAP_END + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void mpu_pc98_device::device_start() +{ + address_space &iospace = machine().firstcpu->space(AS_IO); + iospace.install_device(0xe0d0, 0xe0d3, *this, map, 16, 0xffffffffffffffffU >> (64 - iospace.data_width())); +} + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void mpu_pc98_device::device_reset() +{ +} diff --git a/src/devices/bus/cbus/mpu_pc98.h b/src/devices/bus/cbus/mpu_pc98.h new file mode 100644 index 00000000000..2131f0e94b5 --- /dev/null +++ b/src/devices/bus/cbus/mpu_pc98.h @@ -0,0 +1,42 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont,Kevin Horton +#ifndef MAME_BUS_CBUS_MPU401_H +#define MAME_BUS_CBUS_MPU401_H + +#pragma once + +#include "bus/cbus/pc9801_cbus.h" +#include "machine/mpu401.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> isa8_mpu401_device + +class mpu_pc98_device : public device_t +{ +public: + // construction/destruction + mpu_pc98_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + DECLARE_ADDRESS_MAP(map, 8); +protected: + // 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; + +private: + // called back by the MPU401 core to set the IRQ line state + DECLARE_WRITE_LINE_MEMBER(mpu_irq_out); + + required_device m_mpu401; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(MPU_PC98, mpu_pc98_device) + +#endif // MAME_BUS_CBUS_MPU401_H diff --git a/src/mame/machine/pc9801_118.cpp b/src/devices/bus/cbus/pc9801_118.cpp similarity index 99% rename from src/mame/machine/pc9801_118.cpp rename to src/devices/bus/cbus/pc9801_118.cpp index 1681dfe5df4..d28ab186c2c 100644 --- a/src/mame/machine/pc9801_118.cpp +++ b/src/devices/bus/cbus/pc9801_118.cpp @@ -13,7 +13,7 @@ ***************************************************************************/ #include "emu.h" -#include "machine/pc9801_118.h" +#include "bus/cbus/pc9801_118.h" #include "machine/pic8259.h" #include "sound/2608intf.h" diff --git a/src/mame/machine/pc9801_118.h b/src/devices/bus/cbus/pc9801_118.h similarity index 94% rename from src/mame/machine/pc9801_118.h rename to src/devices/bus/cbus/pc9801_118.h index f9f66be540b..fd71c27c3bb 100644 --- a/src/mame/machine/pc9801_118.h +++ b/src/devices/bus/cbus/pc9801_118.h @@ -6,8 +6,8 @@ ***************************************************************************/ -#ifndef MAME_MACHINE_PC9801_118_H -#define MAME_MACHINE_PC9801_118_H +#ifndef MAME_BUS_CBUS_PC9801_118_H +#define MAME_BUS_CBUS_PC9801_118_H #pragma once @@ -68,4 +68,4 @@ DECLARE_DEVICE_TYPE(PC9801_118, pc9801_118_device) -#endif // MAME_MACHINE_PC9801_118_H +#endif // MAME_BUS_CBUS_PC9801_118_H diff --git a/src/mame/machine/pc9801_26.cpp b/src/devices/bus/cbus/pc9801_26.cpp similarity index 99% rename from src/mame/machine/pc9801_26.cpp rename to src/devices/bus/cbus/pc9801_26.cpp index ab509584137..7b16eea2d65 100644 --- a/src/mame/machine/pc9801_26.cpp +++ b/src/devices/bus/cbus/pc9801_26.cpp @@ -12,7 +12,7 @@ ***************************************************************************/ #include "emu.h" -#include "machine/pc9801_26.h" +#include "bus/cbus/pc9801_26.h" #include "machine/pic8259.h" #include "sound/2203intf.h" diff --git a/src/mame/machine/pc9801_26.h b/src/devices/bus/cbus/pc9801_26.h similarity index 94% rename from src/mame/machine/pc9801_26.h rename to src/devices/bus/cbus/pc9801_26.h index 67dbbf18c1a..a006daf9bac 100644 --- a/src/mame/machine/pc9801_26.h +++ b/src/devices/bus/cbus/pc9801_26.h @@ -6,8 +6,8 @@ Template for skeleton device ***************************************************************************/ -#ifndef MAME_MACHINE_PC9801_26_H -#define MAME_MACHINE_PC9801_26_H +#ifndef MAME_BUS_CBUS_PC9801_26_H +#define MAME_BUS_CBUS_PC9801_26_H #pragma once @@ -64,4 +64,4 @@ DECLARE_DEVICE_TYPE(PC9801_26, pc9801_26_device) -#endif // MAME_MACHINE_PC9801_26_H +#endif // MAME_BUS_CBUS_PC9801_26_H diff --git a/src/mame/machine/pc9801_86.cpp b/src/devices/bus/cbus/pc9801_86.cpp similarity index 99% rename from src/mame/machine/pc9801_86.cpp rename to src/devices/bus/cbus/pc9801_86.cpp index 29f94f2fa4c..547ddb634a6 100644 --- a/src/mame/machine/pc9801_86.cpp +++ b/src/devices/bus/cbus/pc9801_86.cpp @@ -16,7 +16,7 @@ ***************************************************************************/ #include "emu.h" -#include "machine/pc9801_86.h" +#include "bus/cbus/pc9801_86.h" #include "sound/volt_reg.h" #include "speaker.h" diff --git a/src/mame/machine/pc9801_86.h b/src/devices/bus/cbus/pc9801_86.h similarity index 95% rename from src/mame/machine/pc9801_86.h rename to src/devices/bus/cbus/pc9801_86.h index 4bb8de0701e..29d2e79c071 100644 --- a/src/mame/machine/pc9801_86.h +++ b/src/devices/bus/cbus/pc9801_86.h @@ -6,8 +6,8 @@ ***************************************************************************/ -#ifndef MAME_MACHINE_PC9801_86_H -#define MAME_MACHINE_PC9801_86_H +#ifndef MAME_BUS_CBUS_PC9801_86_H +#define MAME_BUS_CBUS_PC9801_86_H #pragma once @@ -77,4 +77,4 @@ DECLARE_DEVICE_TYPE(PC9801_86, pc9801_86_device) -#endif // MAME_MACHINE_PC9801_86_H +#endif // MAME_BUS_CBUS_PC9801_86_H diff --git a/src/mame/machine/pc9801_cbus.cpp b/src/devices/bus/cbus/pc9801_cbus.cpp similarity index 100% rename from src/mame/machine/pc9801_cbus.cpp rename to src/devices/bus/cbus/pc9801_cbus.cpp diff --git a/src/mame/machine/pc9801_cbus.h b/src/devices/bus/cbus/pc9801_cbus.h similarity index 100% rename from src/mame/machine/pc9801_cbus.h rename to src/devices/bus/cbus/pc9801_cbus.h diff --git a/src/mame/drivers/pc9801.cpp b/src/mame/drivers/pc9801.cpp index 200cd82133a..bba8da85dae 100644 --- a/src/mame/drivers/pc9801.cpp +++ b/src/mame/drivers/pc9801.cpp @@ -410,10 +410,11 @@ Keyboard TX commands: #include "video/upd7220.h" -#include "machine/pc9801_26.h" -#include "machine/pc9801_86.h" -#include "machine/pc9801_118.h" -#include "machine/pc9801_cbus.h" +#include "bus/cbus/pc9801_26.h" +#include "bus/cbus/pc9801_86.h" +#include "bus/cbus/pc9801_118.h" +#include "bus/cbus/mpu_pc98.h" +#include "bus/cbus/pc9801_cbus.h" #include "machine/pc9801_kbd.h" #include "machine/pc9801_cd.h" @@ -693,7 +694,7 @@ public: private: uint8_t m_sdip_read(uint16_t port, uint8_t sdip_offset); void m_sdip_write(uint16_t port, uint8_t sdip_offset,uint8_t data); - uint16_t egc_do_partial_op(int plane, uint16_t src, uint16_t pat, uint16_t dst); + uint16_t egc_do_partial_op(int plane, uint16_t src, uint16_t pat, uint16_t dst) const; uint16_t egc_shift(int plane, uint16_t val); public: DECLARE_MACHINE_START(pc9801_common); @@ -1326,7 +1327,7 @@ uint16_t pc9801_state::egc_shift(int plane, uint16_t val) return out; } -uint16_t pc9801_state::egc_do_partial_op(int plane, uint16_t src, uint16_t pat, uint16_t dst) +uint16_t pc9801_state::egc_do_partial_op(int plane, uint16_t src, uint16_t pat, uint16_t dst) const { uint16_t out = 0; @@ -1453,7 +1454,8 @@ uint16_t pc9801_state::egc_blit_r(uint32_t offset, uint16_t mem_mask) if(m_egc.first && !m_egc.init) { m_egc.leftover[0] = m_egc.leftover[1] = m_egc.leftover[2] = m_egc.leftover[3] = 0; - m_egc.init = true; + if(((m_egc.regs[6] >> 4) & 0xf) >= (m_egc.regs[6] & 0xf)) // check if we have enough bits + m_egc.init = true; } for(int i = 0; i < 4; i++) m_egc.src[i] = egc_shift(i, m_video_ram_2[plane_off + (((i + 1) & 3) * 0x4000)]); @@ -3002,6 +3004,7 @@ static SLOT_INTERFACE_START( pc9801_cbus ) // Speak Board // Spark Board // AMD-98 (AmuseMent boarD) + SLOT_INTERFACE( "mpu_pc98", MPU_PC98 ) SLOT_INTERFACE_END // Jast Sound, could be put independently