(MESS) apple3: Added speaker toggle, beep, and DAC sound. [R. Belmont]

This commit is contained in:
R. Belmont 2014-02-02 18:46:50 +00:00
parent fe7e1a0441
commit 2826419b47
3 changed files with 76 additions and 7 deletions

View File

@ -4,22 +4,22 @@
Apple ///
driver by Nathan Woods and R. Belmont
Driver is not working yet; seems to get caught in an infinite loop on
startup. Special thanks to Chris Smolinski (author of the Sara emulator)
for his input about this poorly known system.
Also thanks to Washington Apple Pi for the "Apple III DVD" containing the
technical manual, schematics, and software.
***************************************************************************/
#include "emu.h"
#include "cpu/m6502/m6502.h"
#include "includes/apple3.h"
#include "includes/apple2.h"
#include "imagedev/flopdrv.h"
#include "formats/ap2_dsk.h"
#include "machine/mos6551.h"
#include "machine/6522via.h"
#include "bus/a2bus/a2bus.h"
#include "machine/ram.h"
#include "machine/appldriv.h"
static ADDRESS_MAP_START( apple3_map, AS_PROGRAM, 8, apple3_state )
@ -90,6 +90,14 @@ static MACHINE_CONFIG_START( apple3, apple3_state )
MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(apple3_state, apple3_via_1_out_b))
MCFG_VIA6522_IRQ_HANDLER(WRITELINE(apple3_state, apple2_via_1_irq_func))
/* sound */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD(SPEAKER_TAG, SPEAKER_SOUND, 0)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
MCFG_SOUND_ADD(DAC_TAG, DAC, 0)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MCFG_TIMER_DRIVER_ADD_PERIODIC("c040", apple3_state, apple3_c040_tick, attotime::from_hz(2000))
/* internal ram */
MCFG_RAM_ADD(RAM_TAG)
MCFG_RAM_DEFAULT_SIZE("512K")

View File

@ -9,9 +9,15 @@
#ifndef APPLE3_H_
#define APPLE3_H_
#include "cpu/m6502/m6502.h"
#include "includes/apple2.h"
#include "machine/ram.h"
#include "bus/a2bus/a2bus.h"
#include "machine/applefdc.h"
#include "machine/mos6551.h"
#include "machine/6522via.h"
#include "sound/speaker.h"
#include "sound/dac.h"
#define VAR_VM0 0x0001
#define VAR_VM1 0x0002
@ -22,6 +28,8 @@
#define VAR_EXTPOWER 0x0040
#define VAR_EXTSIDE 0x0080
#define SPEAKER_TAG "a3spkr"
#define DAC_TAG "a3dac"
class apple3_state : public apple2_state
{
@ -29,12 +37,16 @@ public:
apple3_state(const machine_config &mconfig, device_type type, const char *tag)
: apple2_state(mconfig, type, tag),
m_via_0(*this, "via6522_0"),
m_via_1(*this, "via6522_1")
m_via_1(*this, "via6522_1"),
m_speaker(*this, SPEAKER_TAG),
m_dac(*this, DAC_TAG)
{
}
required_device<via6522_device> m_via_0;
required_device<via6522_device> m_via_1;
required_device<speaker_sound_device> m_speaker;
required_device<dac_device> m_dac;
UINT32 m_flags;
UINT8 m_via_0_a;
@ -90,6 +102,7 @@ public:
void apple3_update_memory();
void apple3_via_out(UINT8 *var, UINT8 data);
UINT8 *apple3_get_indexed_addr(offs_t offset);
TIMER_DEVICE_CALLBACK_MEMBER(apple3_c040_tick);
bool m_sync;
UINT8 m_indir_opcode;
@ -98,6 +111,8 @@ public:
UINT8 *m_bank2, *m_bank3, *m_bank4, *m_bank5, *m_bank8, *m_bank9;
UINT8 *m_bank10, *m_bank11;
UINT8 *m_bank6, *m_bank7;
int m_speaker_state;
int m_c040_time;
};

View File

@ -162,6 +162,23 @@ READ8_MEMBER(apple3_state::apple3_c0xx_r)
AY3600_anykey_clearstrobe_r(machine());
break;
case 0x30: case 0x31: case 0x32: case 0x33:
case 0x34: case 0x35: case 0x36: case 0x37:
case 0x38: case 0x39: case 0x3A: case 0x3B:
case 0x3C: case 0x3D: case 0x3E: case 0x3F:
m_speaker_state ^= 1;
m_speaker->level_w(m_speaker_state);
result = 0xff;
break;
case 0x40: case 0x41: case 0x42: case 0x43:
case 0x44: case 0x45: case 0x46: case 0x47:
case 0x48: case 0x49: case 0x4A: case 0x4B:
case 0x4C: case 0x4D: case 0x4E: case 0x4F:
m_c040_time = 200;
result = 0xff;
break;
case 0x50: case 0x51: case 0x52: case 0x53:
case 0x54: case 0x55: case 0x56: case 0x57:
/* graphics softswitches */
@ -235,6 +252,21 @@ WRITE8_MEMBER(apple3_state::apple3_c0xx_w)
AY3600_anykey_clearstrobe_r(machine());
break;
case 0x30: case 0x31: case 0x32: case 0x33:
case 0x34: case 0x35: case 0x36: case 0x37:
case 0x38: case 0x39: case 0x3A: case 0x3B:
case 0x3C: case 0x3D: case 0x3E: case 0x3F:
m_speaker_state ^= 1;
m_speaker->level_w(m_speaker_state);
break;
case 0x40: case 0x41: case 0x42: case 0x43:
case 0x44: case 0x45: case 0x46: case 0x47:
case 0x48: case 0x49: case 0x4A: case 0x4B:
case 0x4C: case 0x4D: case 0x4E: case 0x4F:
m_c040_time = 200;
break;
case 0x50: case 0x51: case 0x52: case 0x53:
case 0x54: case 0x55: case 0x56: case 0x57:
/* graphics softswitches */
@ -423,6 +455,7 @@ WRITE8_MEMBER(apple3_state::apple3_via_1_out_a)
WRITE8_MEMBER(apple3_state::apple3_via_1_out_b)
{
m_dac->write_unsigned8(data<<2);
apple3_via_out(&m_via_1_b, data);
}
@ -442,6 +475,9 @@ MACHINE_RESET_MEMBER(apple3_state,apple3)
{
m_indir_count = 0;
m_sync = false;
m_speaker_state = 0;
m_speaker->level_w(0);
m_c040_time = 0;
}
@ -861,3 +897,13 @@ WRITE_LINE_MEMBER(apple3_state::apple3_sync_w)
}
}
TIMER_DEVICE_CALLBACK_MEMBER(apple3_state::apple3_c040_tick)
{
if (m_c040_time > 0)
{
m_speaker_state ^= 1;
m_speaker->level_w(m_speaker_state);
m_c040_time--;
}
}