diff options
author | 2014-06-07 19:03:13 +0000 | |
---|---|---|
committer | 2014-06-07 19:03:13 +0000 | |
commit | 8f27213971b8bf6bd19393ea8c3dc04984a51a99 (patch) | |
tree | 264455b08a9e199785fcad416432cd9d92563fd3 | |
parent | ebd08d36fc6be3e58a277f2d6df582afb6897a21 (diff) |
(MESS) msx.c: Added preliminary support for the Midisaurus BM-012 Midi interface cartridge (nw)
-rw-r--r-- | .gitattributes | 2 | ||||
-rw-r--r-- | src/emu/bus/bus.mak | 1 | ||||
-rw-r--r-- | src/emu/bus/msx_cart/bm_012.c | 147 | ||||
-rw-r--r-- | src/emu/bus/msx_cart/bm_012.h | 38 | ||||
-rw-r--r-- | src/emu/bus/msx_cart/cartridge.c | 2 | ||||
-rw-r--r-- | src/emu/machine/z80pio.c | 6 | ||||
-rw-r--r-- | src/emu/machine/z80pio.h | 3 |
7 files changed, 199 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes index dfb64307c33..f19aad187b9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -995,6 +995,8 @@ src/emu/bus/msx_cart/arc.c svneol=native#text/plain src/emu/bus/msx_cart/arc.h svneol=native#text/plain src/emu/bus/msx_cart/ascii.c svneol=native#text/plain src/emu/bus/msx_cart/ascii.h svneol=native#text/plain +src/emu/bus/msx_cart/bm_012.c svneol=native#text/plain +src/emu/bus/msx_cart/bm_012.h svneol=native#text/plain src/emu/bus/msx_cart/cartridge.c svneol=native#text/plain src/emu/bus/msx_cart/cartridge.h svneol=native#text/plain src/emu/bus/msx_cart/crossblaim.c svneol=native#text/plain diff --git a/src/emu/bus/bus.mak b/src/emu/bus/bus.mak index 46525786b05..ff23b708922 100644 --- a/src/emu/bus/bus.mak +++ b/src/emu/bus/bus.mak @@ -409,6 +409,7 @@ BUSOBJS += $(BUSOBJ)/msx_slot/sony08.o OBJDIRS += $(BUSOBJ)/msx_cart BUSOBJS += $(BUSOBJ)/msx_cart/arc.o BUSOBJS += $(BUSOBJ)/msx_cart/ascii.o +BUSOBJS += $(BUSOBJ)/msx_cart/bm_012.o BUSOBJS += $(BUSOBJ)/msx_cart/cartridge.o BUSOBJS += $(BUSOBJ)/msx_cart/crossblaim.o BUSOBJS += $(BUSOBJ)/msx_cart/dooly.o diff --git a/src/emu/bus/msx_cart/bm_012.c b/src/emu/bus/msx_cart/bm_012.c new file mode 100644 index 00000000000..19b0ba671d7 --- /dev/null +++ b/src/emu/bus/msx_cart/bm_012.c @@ -0,0 +1,147 @@ +/*********************************************************************************** + +Emulation for the MSX BM-012 Midi cartridge that was sold together with Midisaurus. + +TODO: +- hook up all the other signals for the CTC, SIO +- which type of SIO hookup is used? tmpz84c015af supports SIO/0, SIO/1, and SIO/2 +- since the SIO signals are not hooked up, the midi in/thru/out ports are also not + implemented yet +- proper irq handling taking the irq priority into account is not implemented +- the hookup between 2 PIOs is educated guess work; it could be incorrect + +***********************************************************************************/ + +#include "emu.h" +#include "bm_012.h" +#include "cpu/z80/z80.h" + + +const device_type MSX_CART_BM_012 = &device_creator<msx_cart_bm_012>; + + +msx_cart_bm_012::msx_cart_bm_012(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, MSX_CART_BM_012, "MSX Cartridge - BM-012", tag, owner, clock, "msx_cart_bm_012", __FILE__) + , msx_cart_interface(mconfig, *this) + , m_tmpz84c015af_pio(*this, "tmpz84_pio") + , m_tmpz84c015af_ctc(*this, "tmpz84_ctc") + , m_tmpz84c015af_sio(*this, "tmpz84_sio") + , m_irq_priority(0) + , m_bm012_pio(*this, "bm012_pio") +{ +} + + +static ADDRESS_MAP_START( bm_012_memory_map, AS_PROGRAM, 8, msx_cart_bm_012 ) + AM_RANGE(0x0000, 0x7fff) AM_ROM + AM_RANGE(0xe000, 0xffff) AM_RAM +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( bm_012_io_map, AS_IO, 8, msx_cart_bm_012 ) + ADDRESS_MAP_UNMAP_HIGH + ADDRESS_MAP_GLOBAL_MASK(0xff) + + // 10-13 - CTC channels 0-3 + AM_RANGE(0x10, 0x13) AM_DEVREADWRITE("tmpz84_ctc", z80ctc_device, read, write) + + // 18-1B - SIO + AM_RANGE(0x18, 0x1b) AM_DEVREADWRITE("tmpz84_sio", z80dart_device, ba_cd_r, ba_cd_w) + + // 1C-1F - PIO + AM_RANGE(0x1c, 0x1f) AM_DEVREADWRITE("tmpz84_pio", z80pio_device, read_alt, write_alt) + + // F0-F1 - WDT + // F4 - IRQ priority + AM_RANGE(0xf4, 0xf4) AM_WRITE(tmpz84c015af_f4_w) +ADDRESS_MAP_END + + +static const z80_daisy_config bm_012_daisy_chain[] = +{ + { "tmpz84_pio" }, + { "tmpz84_sio" }, + { "tmpz84_ctc" }, + { NULL } +}; + + +static MACHINE_CONFIG_FRAGMENT( msx_cart_bm_012 ) + // 12MHz XTAL @ X1 + // Toshiba TMPZ84C015AF-6 (@U5) components: + // - Z80 + // - CTC + // - SIO + // - PIO + // - CGC + // - WDT + MCFG_CPU_ADD("tmpz84_cpu", Z80, XTAL_12MHz/2) /* 6 MHz */ + MCFG_CPU_PROGRAM_MAP(bm_012_memory_map) + MCFG_CPU_IO_MAP(bm_012_io_map) + MCFG_CPU_CONFIG(bm_012_daisy_chain) + + MCFG_DEVICE_ADD("tmpz84_pio", Z80PIO, XTAL_12MHz/2) + MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("tmpz84_cpu", INPUT_LINE_IRQ0)) + MCFG_Z80PIO_IN_PA_CB(DEVREAD8("bm012_pio", z80pio_device, pa_r)) + MCFG_Z80PIO_OUT_PA_CB(DEVWRITE8("bm012_pio", z80pio_device, pa_w)) + MCFG_Z80PIO_IN_PB_CB(DEVREAD8("bm012_pio", z80pio_device, pb_r)) + MCFG_Z80PIO_OUT_PB_CB(DEVWRITE8("bm012_pio", z80pio_device, pb_w)) + MCFG_Z80PIO_OUT_BRDY_CB(DEVWRITELINE("bm012_pio", z80pio_device, strobe_b)) + + MCFG_DEVICE_ADD("tmpz84_ctc", Z80CTC, XTAL_12MHz/2) + MCFG_Z80CTC_INTR_CB(INPUTLINE("tmpz84_cpu", INPUT_LINE_IRQ0)) + + MCFG_Z80SIO0_ADD("tmpz84_sio", XTAL_12MHz/2, 0, 0, 0, 0) + MCFG_Z80DART_OUT_INT_CB(INPUTLINE("tmpz84_cpu", INPUT_LINE_IRQ0)) + + // Sony CXK5864BSP-10L (8KB ram) + // Sharp LH0081A Z80A-PIO-0 - For communicating between the MSX and the TMP + MCFG_DEVICE_ADD("bm012_pio", Z80PIO, XTAL_3_579545MHz) // ????? + MCFG_Z80PIO_OUT_PA_CB(DEVWRITE8("tmpz84_pio", z80pio_device, pa_w)) + MCFG_Z80PIO_IN_PA_CB(DEVREAD8("tmpz84_pio", z80pio_device, pa_r)) + MCFG_Z80PIO_OUT_PB_CB(DEVWRITE8("tmpz84_pio", z80pio_device, pb_w)) + MCFG_Z80PIO_IN_PB_CB(DEVREAD8("tmpz84_pio", z80pio_device, pb_r)) + MCFG_Z80PIO_OUT_BRDY_CB(DEVWRITELINE("tmpz84_pio", z80pio_device, strobe_b)) + +MACHINE_CONFIG_END + + +machine_config_constructor msx_cart_bm_012::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( msx_cart_bm_012 ); +} + + +ROM_START( msx_cart_bm_012 ) + ROM_REGION(0x8000, "tmpz84_cpu", 0) + // The rom chip at U4 is a 27256, but it contains the same 8KB duplicated 4 times + ROM_LOAD("midi_v1.00.u4", 0x0, 0x8000, CRC(840c9e74) SHA1(6d07637ad3a61b509221ed4650eed18442371010)) +ROM_END + + +const rom_entry *msx_cart_bm_012::device_rom_region() const +{ + return ROM_NAME( msx_cart_bm_012 ); +} + + +void msx_cart_bm_012::device_start() +{ + // Install IO read/write handlers + address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO); + space.install_write_handler(0x70, 0x73, write8_delegate(FUNC(z80pio_device::write_alt), m_bm012_pio.target())); + space.install_read_handler(0x70, 0x73, read8_delegate(FUNC(z80pio_device::read_alt), m_bm012_pio.target())); +} + + +void msx_cart_bm_012::device_reset() +{ +} + + +WRITE8_MEMBER(msx_cart_bm_012::tmpz84c015af_f4_w) +{ + m_irq_priority = data; +} + + diff --git a/src/emu/bus/msx_cart/bm_012.h b/src/emu/bus/msx_cart/bm_012.h new file mode 100644 index 00000000000..9c8031b317a --- /dev/null +++ b/src/emu/bus/msx_cart/bm_012.h @@ -0,0 +1,38 @@ +#ifndef __MSX_CART_BM_012_H +#define __MSX_CART_BM_012_H + +#include "bus/msx_cart/cartridge.h" +#include "machine/z80pio.h" +#include "machine/z80ctc.h" +#include "machine/z80dart.h" + + +extern const device_type MSX_CART_BM_012; + + +class msx_cart_bm_012 : public device_t + , public msx_cart_interface +{ +public: + msx_cart_bm_012(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // device-level overrides + virtual machine_config_constructor device_mconfig_additions() const; + virtual const rom_entry *device_rom_region() const; + virtual void device_start(); + virtual void device_reset(); + + DECLARE_WRITE8_MEMBER(tmpz84c015af_f4_w); + +private: + // TMPZ84C015AF related + required_device<z80pio_device> m_tmpz84c015af_pio; + required_device<z80ctc_device> m_tmpz84c015af_ctc; + required_device<z80dart_device> m_tmpz84c015af_sio; + UINT8 m_irq_priority; + + required_device<z80pio_device> m_bm012_pio; +}; + + +#endif diff --git a/src/emu/bus/msx_cart/cartridge.c b/src/emu/bus/msx_cart/cartridge.c index 74a3614d327..fcec997d0d1 100644 --- a/src/emu/bus/msx_cart/cartridge.c +++ b/src/emu/bus/msx_cart/cartridge.c @@ -3,6 +3,7 @@ #include "cartridge.h" #include "arc.h" #include "ascii.h" +#include "bm_012.h" #include "crossblaim.h" #include "dooly.h" #include "fmpac.h" @@ -53,6 +54,7 @@ SLOT_INTERFACE_START(msx_cart) SLOT_INTERFACE_INTERNAL("dooly", MSX_CART_DOOLY) SLOT_INTERFACE_INTERNAL("halnote", MSX_CART_HALNOTE) SLOT_INTERFACE_INTERNAL("arc", MSX_CART_ARC) + SLOT_INTERFACE("bm_012", MSX_CART_BM_012) SLOT_INTERFACE_END diff --git a/src/emu/machine/z80pio.c b/src/emu/machine/z80pio.c index 6b396328943..d4596ea28aa 100644 --- a/src/emu/machine/z80pio.c +++ b/src/emu/machine/z80pio.c @@ -660,6 +660,12 @@ void z80pio_device::pio_port::control_write(UINT8 data) // next word is mask control m_next_control_word = MASK; } + else + { + // set interrupt enable + m_ie = BIT(m_icw, 7) ? true : false; + check_interrupts(); + } break; case 0x03: // set interrupt enable flip-flop diff --git a/src/emu/machine/z80pio.h b/src/emu/machine/z80pio.h index c6f614837db..3dc71316126 100644 --- a/src/emu/machine/z80pio.h +++ b/src/emu/machine/z80pio.h @@ -123,6 +123,9 @@ public: void port_a_write(UINT8 data) { port_write(PORT_A, data); } void port_b_write(UINT8 data) { port_write(PORT_B, data); } DECLARE_WRITE8_MEMBER( pa_w ) { port_a_write(data); } + DECLARE_READ8_MEMBER( pa_r ) { return port_a_read(); } + DECLARE_WRITE8_MEMBER( pb_w ) { port_b_write(data); } + DECLARE_READ8_MEMBER( pb_r ) { return port_b_read(); } // standard read/write, with C/D in bit 1, B/A in bit 0 DECLARE_READ8_MEMBER( read ); |