trunk/src/emu/bus/pet/cb2snd.c
| r0 | r31682 | |
| 1 | // license:BSD-3-Clause |
| 2 | // copyright-holders:R. Belmont |
| 3 | /********************************************************************** |
| 4 | |
| 5 | Commodore PET userport "CB2 sound" audio device emulation |
| 6 | |
| 7 | http://zimmers.net/cbmpics/cbm/PETx/petfaq.html |
| 8 | |
| 9 | Copyright MESS Team. |
| 10 | Visit http://mamedev.org for licensing and usage restrictions. |
| 11 | |
| 12 | **********************************************************************/ |
| 13 | |
| 14 | #include "cb2snd.h" |
| 15 | |
| 16 | //************************************************************************** |
| 17 | // DEVICE DEFINITIONS |
| 18 | //************************************************************************** |
| 19 | |
| 20 | const device_type PET_USERPORT_CB2_SOUND_DEVICE = &device_creator<pet_userport_cb2_sound_device>; |
| 21 | |
| 22 | #define DAC_TAG "dac" |
| 23 | |
| 24 | MACHINE_CONFIG_FRAGMENT( cb2snd ) |
| 25 | MCFG_SPEAKER_STANDARD_MONO("cb2spkr") |
| 26 | MCFG_SOUND_ADD(DAC_TAG, DAC, 0) |
| 27 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "cb2spkr", 1.00) |
| 28 | MACHINE_CONFIG_END |
| 29 | |
| 30 | //------------------------------------------------- |
| 31 | // machine_config_additions - device-specific |
| 32 | // machine configurations |
| 33 | //------------------------------------------------- |
| 34 | |
| 35 | machine_config_constructor pet_userport_cb2_sound_device::device_mconfig_additions() const |
| 36 | { |
| 37 | return MACHINE_CONFIG_NAME( cb2snd ); |
| 38 | } |
| 39 | |
| 40 | //************************************************************************** |
| 41 | // LIVE DEVICE |
| 42 | //************************************************************************** |
| 43 | |
| 44 | //------------------------------------------------- |
| 45 | // pet_userport_cb2_sound_device - constructor |
| 46 | //------------------------------------------------- |
| 47 | |
| 48 | pet_userport_cb2_sound_device::pet_userport_cb2_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 49 | device_t(mconfig, PET_USERPORT_CB2_SOUND_DEVICE, "PET Userport 'CB2 Sound' Device", tag, owner, clock, "petucb2", __FILE__), |
| 50 | device_pet_user_port_interface(mconfig, *this), |
| 51 | m_dac(*this, DAC_TAG) |
| 52 | { |
| 53 | } |
| 54 | |
| 55 | |
| 56 | //------------------------------------------------- |
| 57 | // device_start - device-specific startup |
| 58 | //------------------------------------------------- |
| 59 | |
| 60 | void pet_userport_cb2_sound_device::device_start() |
| 61 | { |
| 62 | } |
| 63 | |
| 64 | DECLARE_WRITE_LINE_MEMBER( pet_userport_cb2_sound_device::input_m ) |
| 65 | { |
| 66 | m_dac->write_unsigned8(state ? 0xff : 0x00); |
| 67 | } |
| 68 | |
trunk/src/emu/bus/pet/cb2snd.h
| r0 | r31682 | |
| 1 | // license:BSD-3-Clause |
| 2 | // copyright-holders:R. Belmont |
| 3 | /********************************************************************** |
| 4 | |
| 5 | Commodore PET userport "CB2 sound" audio device emulation |
| 6 | |
| 7 | Copyright MESS Team. |
| 8 | Visit http://mamedev.org for licensing and usage restrictions. |
| 9 | |
| 10 | **********************************************************************/ |
| 11 | |
| 12 | #pragma once |
| 13 | |
| 14 | #ifndef __PETUSER_CB2__ |
| 15 | #define __PETUSER_CB2__ |
| 16 | |
| 17 | #include "emu.h" |
| 18 | #include "user.h" |
| 19 | #include "sound/dac.h" |
| 20 | |
| 21 | //************************************************************************** |
| 22 | // TYPE DEFINITIONS |
| 23 | //************************************************************************** |
| 24 | |
| 25 | class pet_userport_cb2_sound_device : public device_t, |
| 26 | public device_pet_user_port_interface |
| 27 | { |
| 28 | public: |
| 29 | // construction/destruction |
| 30 | pet_userport_cb2_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 31 | |
| 32 | virtual machine_config_constructor device_mconfig_additions() const; |
| 33 | |
| 34 | virtual DECLARE_WRITE_LINE_MEMBER( input_m ); |
| 35 | |
| 36 | required_device<dac_device> m_dac; |
| 37 | |
| 38 | protected: |
| 39 | // device-level overrides |
| 40 | virtual void device_start(); |
| 41 | }; |
| 42 | |
| 43 | |
| 44 | // device type definition |
| 45 | extern const device_type PET_USERPORT_CB2_SOUND_DEVICE; |
| 46 | |
| 47 | #endif |