diff --git a/.gitattributes b/.gitattributes index e399b47055c..5897618b849 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1324,6 +1324,8 @@ src/emu/bus/pet/c2n.c svneol=native#text/plain src/emu/bus/pet/c2n.h svneol=native#text/plain src/emu/bus/pet/cass.c svneol=native#text/plain src/emu/bus/pet/cass.h svneol=native#text/plain +src/emu/bus/pet/cb2snd.c svneol=native#text/plain +src/emu/bus/pet/cb2snd.h svneol=native#text/plain src/emu/bus/pet/diag.c svneol=native#text/plain src/emu/bus/pet/diag.h svneol=native#text/plain src/emu/bus/pet/diag264_lb_tape.c svneol=native#text/plain diff --git a/src/emu/bus/bus.mak b/src/emu/bus/bus.mak index 88ebcf22f52..a8605a7ec47 100644 --- a/src/emu/bus/bus.mak +++ b/src/emu/bus/bus.mak @@ -510,6 +510,7 @@ BUSOBJS += $(BUSOBJ)/pet/superpet.o BUSOBJS += $(BUSOBJ)/pet/user.o BUSOBJS += $(BUSOBJ)/pet/diag.o BUSOBJS += $(BUSOBJ)/pet/petuja.o +BUSOBJS += $(BUSOBJ)/pet/cb2snd.o endif diff --git a/src/emu/bus/pet/cb2snd.c b/src/emu/bus/pet/cb2snd.c new file mode 100644 index 00000000000..b9e916b0e49 --- /dev/null +++ b/src/emu/bus/pet/cb2snd.c @@ -0,0 +1,68 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/********************************************************************** + + Commodore PET userport "CB2 sound" audio device emulation + + http://zimmers.net/cbmpics/cbm/PETx/petfaq.html + + Copyright MESS Team. + Visit http://mamedev.org for licensing and usage restrictions. + +**********************************************************************/ + +#include "cb2snd.h" + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +const device_type PET_USERPORT_CB2_SOUND_DEVICE = &device_creator; + +#define DAC_TAG "dac" + +MACHINE_CONFIG_FRAGMENT( cb2snd ) + MCFG_SPEAKER_STANDARD_MONO("cb2spkr") + MCFG_SOUND_ADD(DAC_TAG, DAC, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "cb2spkr", 1.00) +MACHINE_CONFIG_END + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor pet_userport_cb2_sound_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( cb2snd ); +} + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// pet_userport_cb2_sound_device - constructor +//------------------------------------------------- + +pet_userport_cb2_sound_device::pet_userport_cb2_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : + device_t(mconfig, PET_USERPORT_CB2_SOUND_DEVICE, "PET Userport 'CB2 Sound' Device", tag, owner, clock, "petucb2", __FILE__), + device_pet_user_port_interface(mconfig, *this), + m_dac(*this, DAC_TAG) +{ +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void pet_userport_cb2_sound_device::device_start() +{ +} + +DECLARE_WRITE_LINE_MEMBER( pet_userport_cb2_sound_device::input_m ) +{ + m_dac->write_unsigned8(state ? 0xff : 0x00); +} + diff --git a/src/emu/bus/pet/cb2snd.h b/src/emu/bus/pet/cb2snd.h new file mode 100644 index 00000000000..23c8a2c0f53 --- /dev/null +++ b/src/emu/bus/pet/cb2snd.h @@ -0,0 +1,47 @@ +// license:BSD-3-Clause +// copyright-holders:R. Belmont +/********************************************************************** + + Commodore PET userport "CB2 sound" audio device emulation + + Copyright MESS Team. + Visit http://mamedev.org for licensing and usage restrictions. + +**********************************************************************/ + +#pragma once + +#ifndef __PETUSER_CB2__ +#define __PETUSER_CB2__ + +#include "emu.h" +#include "user.h" +#include "sound/dac.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class pet_userport_cb2_sound_device : public device_t, + public device_pet_user_port_interface +{ +public: + // construction/destruction + pet_userport_cb2_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + virtual machine_config_constructor device_mconfig_additions() const; + + virtual DECLARE_WRITE_LINE_MEMBER( input_m ); + + required_device m_dac; + +protected: + // device-level overrides + virtual void device_start(); +}; + + +// device type definition +extern const device_type PET_USERPORT_CB2_SOUND_DEVICE; + +#endif diff --git a/src/emu/bus/pet/user.c b/src/emu/bus/pet/user.c index d6f8252230e..b4e93ec8463 100644 --- a/src/emu/bus/pet/user.c +++ b/src/emu/bus/pet/user.c @@ -124,8 +124,10 @@ device_pet_user_port_interface::~device_pet_user_port_interface() #include "diag.h" #include "petuja.h" +#include "cb2snd.h" SLOT_INTERFACE_START( pet_user_port_cards ) SLOT_INTERFACE("diag", PET_USERPORT_DIAGNOSTIC_CONNECTOR) SLOT_INTERFACE("petuja", PET_USERPORT_JOYSTICK_ADAPTER) + SLOT_INTERFACE("cb2snd", PET_USERPORT_CB2_SOUND_DEVICE) SLOT_INTERFACE_END