From e4be985024a87863b5c4a9f93118f90a2cb76cc2 Mon Sep 17 00:00:00 2001 From: Curt Coder Date: Wed, 1 Feb 2017 20:03:45 +0200 Subject: [PATCH] vic20: Emulated the PPP SpeakEasy (Votrax SC-01-A) cartridge. [Curt Coder] --- scripts/src/bus.lua | 2 + src/devices/bus/vic20/exp.cpp | 2 + src/devices/bus/vic20/speakeasy.cpp | 103 ++++++++++++++++++++++++++++ src/devices/bus/vic20/speakeasy.h | 54 +++++++++++++++ 4 files changed, 161 insertions(+) create mode 100644 src/devices/bus/vic20/speakeasy.cpp create mode 100644 src/devices/bus/vic20/speakeasy.h diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 3f8f3f1d233..ed0a643d277 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -1425,6 +1425,8 @@ if (BUSES["VIC20"]~=null) then MAME_DIR .. "src/devices/bus/vic20/vic1112.h", MAME_DIR .. "src/devices/bus/vic20/vic1210.cpp", MAME_DIR .. "src/devices/bus/vic20/vic1210.h", + MAME_DIR .. "src/devices/bus/vic20/speakeasy.cpp", + MAME_DIR .. "src/devices/bus/vic20/speakeasy.h", MAME_DIR .. "src/devices/bus/vic20/user.cpp", MAME_DIR .. "src/devices/bus/vic20/user.h", MAME_DIR .. "src/devices/bus/vic20/4cga.cpp", diff --git a/src/devices/bus/vic20/exp.cpp b/src/devices/bus/vic20/exp.cpp index c95601773e3..b2d811d6204 100644 --- a/src/devices/bus/vic20/exp.cpp +++ b/src/devices/bus/vic20/exp.cpp @@ -202,6 +202,7 @@ void vic20_expansion_slot_device::cd_w(address_space &space, offs_t offset, uint #include "vic1111.h" #include "vic1112.h" #include "vic1210.h" +#include "speakeasy.h" SLOT_INTERFACE_START( vic20_expansion_cards ) SLOT_INTERFACE("exp", VIC1010) @@ -209,6 +210,7 @@ SLOT_INTERFACE_START( vic20_expansion_cards ) SLOT_INTERFACE("8k", VIC1110) SLOT_INTERFACE("16k", VIC1111) SLOT_INTERFACE("fe3", VIC20_FE3) + SLOT_INTERFACE("speakeasy", VIC20_SPEAKEASY) // the following need ROMs from the software list SLOT_INTERFACE_INTERNAL("standard", VIC20_STD) diff --git a/src/devices/bus/vic20/speakeasy.cpp b/src/devices/bus/vic20/speakeasy.cpp new file mode 100644 index 00000000000..45bb146847e --- /dev/null +++ b/src/devices/bus/vic20/speakeasy.cpp @@ -0,0 +1,103 @@ +// license:BSD-3-Clause +// copyright-holders:smf +/********************************************************************** + + Personal Peripheral Products SpeakEasy cartridge emulation + +**********************************************************************/ + +#include "speakeasy.h" + + + +//************************************************************************** +// MACROS/CONSTANTS +//************************************************************************** + +#define SC01A_TAG "sc01a" + + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type VIC20_SPEAKEASY = &device_creator; + + +//------------------------------------------------- +// MACHINE_DRIVER( speakeasy ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( speakeasy ) + MCFG_SPEAKER_ADD("mono", 0.0, 0.0, 1.0) + + MCFG_SOUND_ADD(SC01A_TAG, VOTRAX_SC01, 720000) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.85) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor vic20_speakeasy_t::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( speakeasy ); +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// vic20_speakeasy_t - constructor +//------------------------------------------------- + +vic20_speakeasy_t::vic20_speakeasy_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, VIC20_SPEAKEASY, "SpeakEasy", tag, owner, clock, "speakeasy", __FILE__), + device_vic20_expansion_card_interface(mconfig, *this), + m_votrax(*this, SC01A_TAG) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void vic20_speakeasy_t::device_start() +{ +} + + +//------------------------------------------------- +// vic20_cd_r - cartridge data read +//------------------------------------------------- + +uint8_t vic20_speakeasy_t::vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) +{ + if (!io2) + { + return m_votrax->request() << 7; + } + + return data; +} + + +//------------------------------------------------- +// vic20_cd_w - cartridge data write +//------------------------------------------------- + +void vic20_speakeasy_t::vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) +{ + if (!io2) + { + m_votrax->write(space, 0, data & 0x3f); + m_votrax->inflection_w(space, 0, data >> 6); + } +} diff --git a/src/devices/bus/vic20/speakeasy.h b/src/devices/bus/vic20/speakeasy.h new file mode 100644 index 00000000000..bf11cde72e5 --- /dev/null +++ b/src/devices/bus/vic20/speakeasy.h @@ -0,0 +1,54 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Personal Peripheral Products SpeakEasy cartridge emulation + +**********************************************************************/ + +#pragma once + +#ifndef __VIC20_SPEAKEASY__ +#define __VIC20_SPEAKEASY__ + +#include "emu.h" +#include "exp.h" +#include "sound/votrax.h" + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> vic20_speakeasy_t + +class vic20_speakeasy_t : public device_t, + public device_vic20_expansion_card_interface +{ +public: + // construction/destruction + vic20_speakeasy_t(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + // optional information overrides + virtual machine_config_constructor device_mconfig_additions() const override; + +protected: + // device-level overrides + virtual void device_start() override; + + // device_vic20_expansion_card_interface overrides + virtual uint8_t vic20_cd_r(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override; + virtual void vic20_cd_w(address_space &space, offs_t offset, uint8_t data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) override; + +private: + required_device m_votrax; +}; + + +// device type definition +extern const device_type VIC20_SPEAKEASY; + + + +#endif