summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--scripts/target/mame/virtual.lua1
-rw-r--r--src/devices/sound/ks0164.cpp58
-rw-r--r--src/devices/sound/ks0164.h20
-rw-r--r--src/mame/drivers/wavesynth.cpp68
-rw-r--r--src/mame/mame.lst3
-rw-r--r--src/mame/virtual.lst1
6 files changed, 149 insertions, 2 deletions
diff --git a/scripts/target/mame/virtual.lua b/scripts/target/mame/virtual.lua
index 7f386b34fec..90d458bf0d7 100644
--- a/scripts/target/mame/virtual.lua
+++ b/scripts/target/mame/virtual.lua
@@ -124,6 +124,7 @@ function createProjects_mame_virtual(_target, _subtarget)
createVirtualProjects(_target, _subtarget, "virtual")
files {
MAME_DIR .. "src/mame/drivers/vgmplay.cpp",
+ MAME_DIR .. "src/mame/drivers/wavesynth.cpp",
MAME_DIR .. "src/mame/drivers/ldplayer.cpp",
MAME_DIR .. "src/mame/machine/mega32x.cpp",
MAME_DIR .. "src/mame/machine/mega32x.h",
diff --git a/src/devices/sound/ks0164.cpp b/src/devices/sound/ks0164.cpp
index 2086b014478..bc3c480c29d 100644
--- a/src/devices/sound/ks0164.cpp
+++ b/src/devices/sound/ks0164.cpp
@@ -13,6 +13,8 @@ ks0164_device::ks0164_device(const machine_config &mconfig, const char *tag, dev
: device_t(mconfig, KS0164, tag, owner, clock),
device_sound_interface(mconfig, *this),
device_memory_interface(mconfig, *this),
+ device_serial_interface(mconfig, *this),
+ m_midi_tx(*this),
m_mem_region(*this, DEVICE_SELF),
m_cpu(*this, "cpu"),
m_mem_config("mem", ENDIANNESS_BIG, 16, 23)
@@ -54,6 +56,11 @@ void ks0164_device::device_start()
space().cache(m_mem_cache);
m_timer = timer_alloc(0);
+ m_midi_tx.resolve_safe();
+
+ set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1);
+ set_rate(clock(), 542);
+
save_item(NAME(m_bank1_base));
save_item(NAME(m_bank1_select));
save_item(NAME(m_bank2_base));
@@ -85,6 +92,8 @@ void ks0164_device::device_reset()
m_mpu_in = 0x00;
m_mpu_out = 0x00;
m_mpu_status = 0x00;
+ m_midi_in = 0x00;
+ m_midi_in_active = false;
m_timer->adjust(attotime::from_msec(1), 0, attotime::from_msec(1));
}
@@ -96,6 +105,50 @@ void ks0164_device::device_timer(emu_timer &timer, device_timer_id id, int param
m_cpu->set_input_line(14, ASSERT_LINE);
}
+void ks0164_device::tra_complete()
+{
+ logerror("transmit done\n");
+}
+
+void ks0164_device::rcv_complete()
+{
+ receive_register_extract();
+ m_midi_in = get_received_char();
+ m_midi_in_active = true;
+ m_cpu->set_input_line(6, ASSERT_LINE);
+
+ logerror("recieved %02x\n", m_midi_in);
+}
+
+void ks0164_device::tra_callback()
+{
+ m_midi_tx(transmit_register_get_data_bit());
+}
+
+u8 ks0164_device::midi_r()
+{
+ m_midi_in_active = false;
+ m_cpu->set_input_line(6, CLEAR_LINE);
+ return m_midi_in;
+}
+
+void ks0164_device::midi_w(u8 data)
+{
+ logerror("want to transmit %02x\n", data);
+}
+
+u8 ks0164_device::midi_status_r()
+{
+ // transmit done/tx empty on bit 1
+ return m_midi_in_active ? 1 : 0;
+}
+
+void ks0164_device::midi_status_w(u8 data)
+{
+ logerror("midi status_w %02x\n", data);
+}
+
+
void ks0164_device::mpuin_set(bool control, u8 data)
{
// logerror("mpu push %s %02x\n", control ? "ctrl" : "data", data);
@@ -289,6 +342,7 @@ u8 ks0164_device::irqen_76_r()
return m_irqen_76;
}
+// alternates 1e/5e
void ks0164_device::irqen_76_w(u8 data)
{
m_irqen_76 = data;
@@ -300,7 +354,7 @@ void ks0164_device::irqen_76_w(u8 data)
m_cpu->set_input_line(14, CLEAR_LINE);
}
- // logerror("irqen_76 = %02x (%04x)\n", m_irqen_76, m_cpu->pc());
+ // logerror("irqen_76 = %02x (%04x)\n", m_irqen_76, m_cpu->pc());
}
u8 ks0164_device::irqen_77_r()
@@ -348,6 +402,8 @@ void ks0164_device::cpu_map(address_map &map)
map(0x0068, 0x0068).rw(FUNC(ks0164_device::mpu401_r), FUNC(ks0164_device::mpu401_w));
map(0x0069, 0x0069).rw(FUNC(ks0164_device::mpu401_istatus_r), FUNC(ks0164_device::mpu401_istatus_w));
+ map(0x006c, 0x006c).rw(FUNC(ks0164_device::midi_r), FUNC(ks0164_device::midi_w));
+ map(0x006d, 0x006d).rw(FUNC(ks0164_device::midi_status_r), FUNC(ks0164_device::midi_status_w));
map(0x0076, 0x0076).rw(FUNC(ks0164_device::irqen_76_r), FUNC(ks0164_device::irqen_76_w));
map(0x0077, 0x0077).rw(FUNC(ks0164_device::irqen_77_r), FUNC(ks0164_device::irqen_77_w));
diff --git a/src/devices/sound/ks0164.h b/src/devices/sound/ks0164.h
index cc707699f2e..c82689f4ff1 100644
--- a/src/devices/sound/ks0164.h
+++ b/src/devices/sound/ks0164.h
@@ -9,8 +9,9 @@
#pragma once
#include "cpu/ks0164/ks0164.h"
+#include "diserial.h"
-class ks0164_device : public device_t, public device_sound_interface, public device_memory_interface
+class ks0164_device : public device_t, public device_sound_interface, public device_memory_interface, public device_serial_interface
{
public:
ks0164_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 16934400);
@@ -20,6 +21,9 @@ public:
u8 mpu401_data_r();
u8 mpu401_status_r();
+ void midi_rx(int state) { rx_w(state); }
+ auto midi_tx() { return m_midi_tx.bind(); }
+
protected:
virtual void device_start() override;
virtual void device_reset() override;
@@ -28,6 +32,10 @@ protected:
virtual space_config_vector memory_space_config() const override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
+ virtual void tra_callback() override;
+ virtual void tra_complete() override;
+ virtual void rcv_complete() override;
+
private:
enum {
MPUS_RX_FULL = 0x01,
@@ -37,6 +45,8 @@ private:
MPUS_RX_INT = 0x80
};
+ devcb_write_line m_midi_tx;
+
optional_memory_region m_mem_region;
required_device<ks0164_cpu_device> m_cpu;
address_space_config m_mem_config;
@@ -53,6 +63,9 @@ private:
u8 m_mpu_out;
u8 m_mpu_status;
+ u8 m_midi_in;
+ bool m_midi_in_active;
+
u8 m_unk60;
u8 m_voice_select;
u8 m_irqen_76, m_irqen_77;
@@ -88,6 +101,11 @@ private:
u8 mpu401_istatus_r();
void mpu401_istatus_w(u8 data);
+ u8 midi_r();
+ void midi_w(u8 data);
+ u8 midi_status_r();
+ void midi_status_w(u8 data);
+
static inline u16 uncomp_8_16(u8 value);
};
diff --git a/src/mame/drivers/wavesynth.cpp b/src/mame/drivers/wavesynth.cpp
new file mode 100644
index 00000000000..4e3f46e85c2
--- /dev/null
+++ b/src/mame/drivers/wavesynth.cpp
@@ -0,0 +1,68 @@
+// license:BSD-3-Clause
+// copyright-holders: Olivier Galibert
+
+// A "virtual" driver to turn waveblaster cards into a screen-less expander
+
+// Currently KS0164 only, and built-in. Evetually should be slot-based with
+// multiple possible cards
+
+#include "emu.h"
+#include "speaker.h"
+#include "bus/midi/midiinport.h"
+#include "bus/midi/midioutport.h"
+
+#include "sound/ks0164.h"
+
+class wavesynth_state : public driver_device
+{
+public:
+ wavesynth_state(const machine_config &mconfig, device_type type, const char *tag);
+
+ void wavesynth(machine_config &config);
+
+
+private:
+ virtual void machine_start() override;
+
+ required_device<ks0164_device> m_waveblaster;
+};
+
+
+wavesynth_state::wavesynth_state(const machine_config &mconfig, device_type type, const char *tag)
+ : driver_device(mconfig, type, tag)
+ , m_waveblaster(*this, "waveblaster")
+{
+}
+
+void wavesynth_state::machine_start()
+{
+}
+
+static INPUT_PORTS_START( wavesynth )
+INPUT_PORTS_END
+
+
+void wavesynth_state::wavesynth(machine_config &config)
+{
+ KS0164(config, m_waveblaster, 16.9344_MHz_XTAL);
+ m_waveblaster->add_route(0, "lspeaker", 1.0);
+ m_waveblaster->add_route(1, "rspeaker", 1.0);
+
+ SPEAKER(config, "lspeaker").front_left();
+ SPEAKER(config, "rspeaker").front_right();
+
+ auto &mdin(MIDI_PORT(config, "mdin"));
+ midiin_slot(mdin);
+ mdin.rxd_handler().set(m_waveblaster, FUNC(ks0164_device::midi_rx));
+
+ auto &mdout(MIDI_PORT(config, "mdout"));
+ midiout_slot(mdout);
+ m_waveblaster->midi_tx().set(mdout, FUNC(midi_port_device::write_txd));
+}
+
+ROM_START( wavesynth )
+ ROM_REGION( 0x100000, "waveblaster", 0)
+ ROM_LOAD16_WORD_SWAP("ks0174-1m04.bin", 0, 0x100000, CRC(3cabaa2f) SHA1(1e894c0345eaf0ea713f36a75b065f7ee419c63c))
+ROM_END
+
+CONS( 2020, wavesynth, 0, 0, wavesynth, wavesynth, wavesynth_state, empty_init, "MAME", "Waveblaster-based expander", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/mame.lst b/src/mame/mame.lst
index 3d300ea5959..9d14197da7e 100644
--- a/src/mame/mame.lst
+++ b/src/mame/mame.lst
@@ -43052,6 +43052,9 @@ palestra
@source:vgmplay.cpp
vgmplay
+@source:wavesynth.cpp
+wavesynth
+
@source:ldplayer.cpp
simldv1000 // Pioneer LD-V1000
simpr8210 // Pioneer PR-8210
diff --git a/src/mame/virtual.lst b/src/mame/virtual.lst
index beac20e0916..f53d1fff9d2 100644
--- a/src/mame/virtual.lst
+++ b/src/mame/virtual.lst
@@ -3,3 +3,4 @@
vgmplay
simldv1000
simpr8210
+wavesynth