(MESS) Support PET user port "CB2 Sound" device [R. Belmont]

This commit is contained in:
R. Belmont 2014-08-17 17:15:06 +00:00
parent 2661953ca7
commit aa0f54be88
5 changed files with 120 additions and 0 deletions

2
.gitattributes vendored
View File

@ -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

View File

@ -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

68
src/emu/bus/pet/cb2snd.c Normal file
View File

@ -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<pet_userport_cb2_sound_device>;
#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);
}

47
src/emu/bus/pet/cb2snd.h Normal file
View File

@ -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<dac_device> m_dac;
protected:
// device-level overrides
virtual void device_start();
};
// device type definition
extern const device_type PET_USERPORT_CB2_SOUND_DEVICE;
#endif

View File

@ -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