Super-80: added sounds for the cassette relay

This commit is contained in:
Robbbert 2016-05-27 10:57:15 +10:00
parent cfdec4e84f
commit 96674c9a81
3 changed files with 27 additions and 3 deletions

View File

@ -678,6 +678,15 @@ static SLOT_INTERFACE_START( super80_floppies )
SLOT_INTERFACE_END
static const char *const relay_sample_names[] =
{
"*relay",
"relayoff",
"relayon",
nullptr
};
static MACHINE_CONFIG_START( super80, super80_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", Z80, MASTER_CLOCK/6) /* 2 MHz */
@ -710,6 +719,10 @@ static MACHINE_CONFIG_START( super80, super80_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.05)
MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MCFG_SOUND_ADD("samples", SAMPLES, 0)
MCFG_SAMPLES_CHANNELS(1)
MCFG_SAMPLES_NAMES(relay_sample_names)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
/* printer */
MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer")
@ -798,6 +811,10 @@ static MACHINE_CONFIG_START( super80v, super80_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.05)
MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MCFG_SOUND_ADD("samples", SAMPLES, 0)
MCFG_SAMPLES_CHANNELS(1)
MCFG_SAMPLES_NAMES(relay_sample_names)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
/* printer */
MCFG_CENTRONICS_ADD("centronics", centronics_devices, "printer")

View File

@ -7,6 +7,7 @@
#include "imagedev/snapquik.h"
#include "imagedev/cassette.h"
#include "sound/speaker.h"
#include "sound/samples.h"
#include "machine/buffer.h"
#include "bus/centronics/ctronics.h"
#include "video/mc6845.h"
@ -31,6 +32,7 @@ public:
, m_pio(*this, "z80pio")
, m_cassette(*this, "cassette")
, m_wave(*this, WAVE_TAG)
, m_samples(*this, "samples")
, m_speaker(*this, "speaker")
, m_centronics(*this, "centronics")
, m_cent_data_out(*this, "cent_data_out")
@ -104,11 +106,12 @@ private:
UINT8 m_mc6845_ind;
UINT8 *m_p_ram;
void mc6845_cursor_configure();
void super80_cassette_motor(UINT8 data);
void super80_cassette_motor(bool data);
required_device<cpu_device> m_maincpu;
required_device<z80pio_device> m_pio;
required_device<cassette_image_device> m_cassette;
required_device<wave_device> m_wave;
required_device<samples_device> m_samples;
required_device<speaker_sound_device> m_speaker;
required_device<centronics_device> m_centronics;
required_device<output_latch_device> m_cent_data_out;

View File

@ -31,9 +31,13 @@ READ8_MEMBER( super80_state::pio_port_b_r )
/**************************** CASSETTE ROUTINES *****************************************************************/
void super80_state::super80_cassette_motor( UINT8 data )
void super80_state::super80_cassette_motor( bool motor_state )
{
if (data)
// relay sound
if (BIT(m_last_data, 1) != motor_state)
m_samples->start(0, motor_state ? 0 : 1);
if (motor_state)
m_cassette->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR);
else
m_cassette->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);