(MESS) mtx.c SN76489A_NEW, from Osso

This commit is contained in:
Michaël Banaan Ananas 2012-10-01 13:11:37 +00:00
parent fb3b148945
commit 6de4f3deac
3 changed files with 23 additions and 17 deletions

View File

@ -59,7 +59,7 @@ static ADDRESS_MAP_START( mtx_io, AS_IO, 8, mtx_state )
AM_RANGE(0x00, 0x00) AM_DEVREAD_LEGACY(CENTRONICS_TAG, mtx_strobe_r) AM_WRITE(mtx_bankswitch_w)
AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("tms9929a", tms9929a_device, vram_read, vram_write)
AM_RANGE(0x02, 0x02) AM_DEVREADWRITE("tms9929a", tms9929a_device, register_read, register_write)
AM_RANGE(0x03, 0x03) AM_DEVREAD_LEGACY(SN76489A_TAG, mtx_sound_strobe_r) AM_DEVWRITE_LEGACY(CASSETTE_TAG, mtx_cst_w)
AM_RANGE(0x03, 0x03) AM_READ(mtx_sound_strobe_r) AM_DEVWRITE_LEGACY(CASSETTE_TAG, mtx_cst_w)
AM_RANGE(0x04, 0x04) AM_DEVREAD_LEGACY(CENTRONICS_TAG, mtx_prt_r)
AM_RANGE(0x04, 0x04) AM_DEVWRITE(CENTRONICS_TAG, centronics_device, write)
AM_RANGE(0x05, 0x05) AM_READWRITE(mtx_key_lo_r, mtx_sense_w)
@ -334,6 +334,16 @@ static TMS9928A_INTERFACE(mtx_tms9928a_interface)
DEVCB_LINE(mtx_tms9929a_interrupt)
};
/*-------------------------------------------------
sn76496_config psg_intf
-------------------------------------------------*/
static const sn76496_config psg_intf =
{
DEVCB_NULL
};
/***************************************************************************
MACHINE DRIVERS
***************************************************************************/
@ -360,7 +370,8 @@ static MACHINE_CONFIG_START( mtx512, mtx_state )
/* sound hardware */
MCFG_SPEAKER_STANDARD_MONO("mono")
MCFG_SOUND_ADD(SN76489A_TAG, SN76489A, XTAL_4MHz)
MCFG_SOUND_ADD(SN76489A_TAG, SN76489A_NEW, XTAL_4MHz)
MCFG_SOUND_CONFIG(psg_intf)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
/* devices */

View File

@ -11,6 +11,7 @@
#include "imagedev/cassette.h"
#include "machine/ctronics.h"
#include "machine/z80ctc.h"
#include "sound/sn76496.h"
#define Z80_TAG "z80"
#define Z80CTC_TAG "z80ctc"
@ -26,7 +27,11 @@ class mtx_state : public driver_device
{
public:
mtx_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag) { }
: driver_device(mconfig, type, tag),
m_sn(*this, SN76489A_TAG)
{ }
required_device<sn76489a_new_device> m_sn;
/* keyboard state */
UINT8 m_key_sense;
@ -46,6 +51,8 @@ public:
/* timers */
device_t *m_cassette_timer;
DECLARE_READ8_MEMBER(mtx_sound_strobe_r);
DECLARE_WRITE8_MEMBER(mtx_bankswitch_w);
DECLARE_WRITE8_MEMBER(mtx_sound_latch_w);
DECLARE_WRITE8_MEMBER(mtx_sense_w);
@ -64,14 +71,8 @@ public:
/*----------- defined in machine/mtx.c -----------*/
SNAPSHOT_LOAD( mtx );
/* Sound */
DECLARE_READ8_DEVICE_HANDLER( mtx_sound_strobe_r );
/* Cassette */
DECLARE_WRITE8_DEVICE_HANDLER( mtx_cst_w );

View File

@ -114,11 +114,9 @@ WRITE8_MEMBER(mtx_state::mtx_bankswitch_w)
mtx_sound_strobe_r - sound strobe
-------------------------------------------------*/
READ8_DEVICE_HANDLER( mtx_sound_strobe_r )
READ8_MEMBER(mtx_state::mtx_sound_strobe_r)
{
mtx_state *state = space.machine().driver_data<mtx_state>();
sn76496_w(device, space, 0, state->m_sound_latch);
m_sn->write(space, 0, m_sound_latch);
return 0xff;
}
@ -129,7 +127,6 @@ READ8_DEVICE_HANDLER( mtx_sound_strobe_r )
WRITE8_MEMBER(mtx_state::mtx_sound_latch_w)
{
m_sound_latch = data;
}
@ -191,7 +188,6 @@ READ8_DEVICE_HANDLER( mtx_prt_r )
WRITE8_MEMBER(mtx_state::mtx_sense_w)
{
m_key_sense = data;
}
@ -201,7 +197,6 @@ WRITE8_MEMBER(mtx_state::mtx_sense_w)
READ8_MEMBER(mtx_state::mtx_key_lo_r)
{
UINT8 data = 0xff;
if (!(m_key_sense & 0x01)) data &= ioport("ROW0")->read();
@ -222,7 +217,6 @@ READ8_MEMBER(mtx_state::mtx_key_lo_r)
READ8_MEMBER(mtx_state::mtx_key_hi_r)
{
UINT8 data = ioport("country_code")->read();
if (!(m_key_sense & 0x01)) data &= ioport("ROW0")->read() >> 8;