From 810dd0af8c960d7d8bde342de25feaa9ce91d271 Mon Sep 17 00:00:00 2001 From: Sergey Svishchev Date: Sun, 17 Jul 2016 16:20:39 +0300 Subject: [PATCH] poisk1: B623 sound card (skeleton) and basic softlist --- hash/poisk1_flop.xml | 27 ++++ scripts/src/bus.lua | 2 + src/devices/bus/isa/p1_sound.cpp | 203 ++++++++++++++++++++++++++++++ src/devices/bus/isa/p1_sound.h | 73 +++++++++++ src/devices/bus/isa/xsu_cards.cpp | 1 + src/devices/bus/isa/xsu_cards.h | 1 + src/mame/drivers/poisk1.cpp | 5 + 7 files changed, 312 insertions(+) create mode 100644 hash/poisk1_flop.xml create mode 100644 src/devices/bus/isa/p1_sound.cpp create mode 100644 src/devices/bus/isa/p1_sound.h diff --git a/hash/poisk1_flop.xml b/hash/poisk1_flop.xml new file mode 100644 index 00000000000..ff1a2c9b597 --- /dev/null +++ b/hash/poisk1_flop.xml @@ -0,0 +1,27 @@ + + + + + + One Track System 1.4 (alternate OS) + 1991 + MMV + + + + + + + + + Software for B623 sound card + 1991 + Electronmash ??? + + + + + + + + diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 5fdd355a955..134f411b2ba 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -831,6 +831,8 @@ if (BUSES["ISA"]~=null) then MAME_DIR .. "src/devices/bus/isa/p1_hdc.h", MAME_DIR .. "src/devices/bus/isa/p1_rom.cpp", MAME_DIR .. "src/devices/bus/isa/p1_rom.h", + MAME_DIR .. "src/devices/bus/isa/p1_sound.cpp", + MAME_DIR .. "src/devices/bus/isa/p1_sound.h", MAME_DIR .. "src/devices/bus/isa/mc1502_fdc.cpp", MAME_DIR .. "src/devices/bus/isa/mc1502_fdc.h", MAME_DIR .. "src/devices/bus/isa/mc1502_rom.cpp", diff --git a/src/devices/bus/isa/p1_sound.cpp b/src/devices/bus/isa/p1_sound.cpp new file mode 100644 index 00000000000..7629ee6fb7d --- /dev/null +++ b/src/devices/bus/isa/p1_sound.cpp @@ -0,0 +1,203 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev +/********************************************************************** + + Poisk-1 sound card. DAC, ADC, MIDI in/out and 6 music channels. + + Memory-mapped, uses IRQ3 and IRQ7, no DMA. + + Copyright MESS Team. + Visit http://mamedev.org for licensing and usage restrictions. + +**********************************************************************/ + +#include "p1_sound.h" + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type P1_SOUND = &device_creator; + + +//------------------------------------------------- +// Machine config +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( p1_sound ) + MCFG_DEVICE_ADD("midi", I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE("mdout", midi_port_device, write_txd)) + MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE(":isa", isa8_device, irq3_w)) + + MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin") + MCFG_MIDI_RX_HANDLER(DEVWRITELINE("midi", i8251_device, write_rxd)) + + MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout") + + MCFG_DEVICE_ADD("d14", PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_12_5MHz/10) +// sampler at 10 KHz + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(p1_sound_device, sampler_sync)) + MCFG_PIT8253_CLK1(XTAL_12_5MHz/10) + MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("midi", i8251_device, write_txc)) + MCFG_PIT8253_CLK2(XTAL_12_5MHz/10) + MCFG_PIT8253_OUT2_HANDLER(DEVWRITELINE("midi", i8251_device, write_rxc)) + + MCFG_DEVICE_ADD("d16", PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_12_5MHz/10) +// MCFG_PIT8253_OUT0_HANDLER(XXX) + MCFG_PIT8253_CLK1(XTAL_12_5MHz/10) +// MCFG_PIT8253_OUT1_HANDLER(XXX) + MCFG_PIT8253_CLK2(XTAL_12_5MHz/10) +// MCFG_PIT8253_OUT2_HANDLER(XXX) + + MCFG_DEVICE_ADD("d17", PIT8253, 0) + MCFG_PIT8253_CLK0(XTAL_12_5MHz/10) +// MCFG_PIT8253_OUT0_HANDLER(XXX) + MCFG_PIT8253_CLK1(XTAL_12_5MHz/10) +// MCFG_PIT8253_OUT1_HANDLER(XXX) + MCFG_PIT8253_CLK2(XTAL_12_5MHz/10) +// MCFG_PIT8253_OUT2_HANDLER(XXX) + + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_DAC_ADD("dac") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "filter", 1.0) + MCFG_FILTER_RC_ADD("filter", 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor p1_sound_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( p1_sound ); +} + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// p1_sound_device - constructor +//------------------------------------------------- + +p1_sound_device::p1_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, P1_SOUND, "Poisk-1 sound card (B623)", tag, owner, clock, "p1_sound", __FILE__), + device_isa8_card_interface( mconfig, *this ), + m_dac(*this, "dac"), + m_filter(*this, "filter"), + m_midi(*this, "midi"), + m_d14(*this, "d14"), + m_d16(*this, "d16"), + m_d17(*this, "d17") +{ +} + +READ8_MEMBER( p1_sound_device::d14_r ) +{ + return m_d14->read(space, offset>>1); +} + +WRITE8_MEMBER( p1_sound_device::d14_w ) +{ + m_d14->write(space, offset>>1, data); +} + +READ8_MEMBER( p1_sound_device::d16_r ) +{ + return m_d16->read(space, offset>>1); +} + +WRITE8_MEMBER( p1_sound_device::d16_w ) +{ + m_d16->write(space, offset>>1, data); +} + +READ8_MEMBER( p1_sound_device::d17_r ) +{ + return m_d17->read(space, offset>>1); +} + +WRITE8_MEMBER( p1_sound_device::d17_w ) +{ + m_d17->write(space, offset>>1, data); +} + +READ8_MEMBER( p1_sound_device::adc_r ) +{ + return 0; +} + +WRITE8_MEMBER( p1_sound_device::dac_w ) +{ +// logerror("DAC write: %02x <- %02x\n", offset>>1, data); + m_dac_data[offset>>1] = data; + m_isa->irq7_w(CLEAR_LINE); +} + +WRITE_LINE_MEMBER( p1_sound_device::sampler_sync ) +{ + if (state) { + m_dac->write_unsigned8(m_dac_data[m_dac_ptr++]); + m_dac_ptr &= 7; + if ((m_dac_ptr % 8) == 0) { + m_isa->irq7_w(state); + } + } +} + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void p1_sound_device::device_start() +{ + set_isa_device(); + + // E8000..E9FFF -- ROM (not installed on any known board) + // EE400 -- ?? root tone measurement ?? + // EFC00 -- ADC output + + m_isa->install_memory(0xea000, 0xea01f, + read8_delegate(FUNC(p1_sound_device::adc_r), this), // XXX not really + write8_delegate(FUNC(p1_sound_device::dac_w), this)); + + m_isa->install_memory(0xee000, 0xee000, + read8_delegate(FUNC(i8251_device::data_r), (i8251_device*)m_midi), + write8_delegate(FUNC(i8251_device::data_w), (i8251_device*)m_midi)); + m_isa->install_memory(0xee002, 0xee002, + read8_delegate(FUNC(i8251_device::status_r), (i8251_device*)m_midi), + write8_delegate(FUNC(i8251_device::control_w), (i8251_device*)m_midi)); + + // sync generator + m_isa->install_memory(0xef000, 0xef007, + read8_delegate(FUNC(p1_sound_device::d14_r), this), + write8_delegate(FUNC(p1_sound_device::d14_w), this)); + + // 6 music channels + m_isa->install_memory(0xef400, 0xef407, + read8_delegate(FUNC(p1_sound_device::d16_r), this), + write8_delegate(FUNC(p1_sound_device::d16_w), this)); + m_isa->install_memory(0xef800, 0xef807, + read8_delegate(FUNC(p1_sound_device::d17_r), this), + write8_delegate(FUNC(p1_sound_device::d17_w), this)); +} + + +//------------------------------------------------- +// device_reset - device-specific reset +//------------------------------------------------- + +void p1_sound_device::device_reset() +{ + memset(m_dac_data, 0, sizeof(m_dac_data)); + m_dac_ptr = 0; + + // 5 kHz lowpass filter. XXX check schematics + m_filter->filter_rc_set_RC(FLT_RC_LOWPASS, 330, 0, 0, CAP_N(100) ); +} diff --git a/src/devices/bus/isa/p1_sound.h b/src/devices/bus/isa/p1_sound.h new file mode 100644 index 00000000000..d99669294c9 --- /dev/null +++ b/src/devices/bus/isa/p1_sound.h @@ -0,0 +1,73 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev +/********************************************************************** + + Poisk-1 sound card + + Copyright MESS Team. + Visit http://mamedev.org for licensing and usage restrictions. + +**********************************************************************/ + +#pragma once + +#ifndef __P1_SOUND__ +#define __P1_SOUND__ + +#include "emu.h" + +#include "bus/midi/midi.h" +#include "isa.h" +#include "machine/i8251.h" +#include "machine/pit8253.h" +#include "sound/dac.h" +#include "sound/flt_rc.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class p1_sound_device : public device_t, + public device_isa8_card_interface +{ +public: + // construction/destruction + p1_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // Optional information overrides + virtual machine_config_constructor device_mconfig_additions() const override; + + DECLARE_READ8_MEMBER(d14_r); + DECLARE_READ8_MEMBER(d16_r); + DECLARE_READ8_MEMBER(d17_r); + DECLARE_WRITE8_MEMBER(d14_w); + DECLARE_WRITE8_MEMBER(d16_w); + DECLARE_WRITE8_MEMBER(d17_w); + + DECLARE_WRITE_LINE_MEMBER(sampler_sync); + DECLARE_READ8_MEMBER(adc_r); + DECLARE_WRITE8_MEMBER(dac_w); + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + +private: + UINT8 m_dac_data[16]; + int m_dac_ptr; + + required_device m_dac; + optional_device m_filter; + required_device m_midi; + required_device m_d14; + required_device m_d16; + required_device m_d17; +}; + + +// device type definition +extern const device_type P1_SOUND; + + +#endif diff --git a/src/devices/bus/isa/xsu_cards.cpp b/src/devices/bus/isa/xsu_cards.cpp index 1a24062a9d1..acb49f1b965 100644 --- a/src/devices/bus/isa/xsu_cards.cpp +++ b/src/devices/bus/isa/xsu_cards.cpp @@ -13,6 +13,7 @@ SLOT_INTERFACE_START( p1_isa8_cards ) SLOT_INTERFACE("rom", P1_ROM) // B003 SLOT_INTERFACE("fdc", P1_FDC) // B504 SLOT_INTERFACE("hdc", P1_HDC) // B942 + SLOT_INTERFACE("sound", P1_SOUND) // B623 /* SLOT_INTERFACE("comlpt", P1_COMLPT) // B620 SLOT_INTERFACE("joy", P1_JOY) // B621 diff --git a/src/devices/bus/isa/xsu_cards.h b/src/devices/bus/isa/xsu_cards.h index 8ddd30f173d..e3a491a9e87 100644 --- a/src/devices/bus/isa/xsu_cards.h +++ b/src/devices/bus/isa/xsu_cards.h @@ -22,6 +22,7 @@ // misc #include "mc1502_rom.h" #include "p1_rom.h" +#include "p1_sound.h" // non-native #include "com.h" diff --git a/src/mame/drivers/poisk1.cpp b/src/mame/drivers/poisk1.cpp index 2f4ee7ebc7e..85f3c024706 100644 --- a/src/mame/drivers/poisk1.cpp +++ b/src/mame/drivers/poisk1.cpp @@ -23,6 +23,8 @@ #include "cpu/i86/i86.h" +#include "softlist.h" + #define CGA_PALETTE_SETS 83 /* one for colour, one for mono, 81 for colour composite */ @@ -641,6 +643,9 @@ static MACHINE_CONFIG_START( poisk1, p1_state ) MCFG_CASSETTE_ADD( "cassette" ) MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) + MCFG_SOFTWARE_LIST_ADD("flop_list","poisk1_flop") +// MCFG_SOFTWARE_LIST_ADD("cass_list","poisk1_cass") + MCFG_SPEAKER_STANDARD_MONO( "mono" ) MCFG_SOUND_ADD( "speaker", SPEAKER_SOUND, 0 ) MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 )