starwars, tomcat: use mos6530_new_device

This commit is contained in:
hap 2023-07-19 01:18:37 +02:00
parent cb0be6e6a0
commit 9b964f3d90
5 changed files with 50 additions and 108 deletions

View file

@ -2,8 +2,7 @@
// copyright-holders:Curt Coder
/**********************************************************************
MOS Technology 6530 Memory, I/O, Timer Array emulation
MOS Technology 6532 RAM, I/O, Timer Array emulation
MOS Technology 6530 MIOT, 6532 RIOT
**********************************************************************
_____ _____

View file

@ -41,14 +41,6 @@
#define CLOCK_3KHZ (MASTER_CLOCK / 4096)
void starwars_state::quad_pokeyn_w(offs_t offset, uint8_t data)
{
int pokey_num = (offset >> 3) & ~0x04;
int control = (offset & 0x20) >> 2;
int pokey_reg = (offset % 8) | control;
m_pokey[pokey_num]->write(pokey_reg, data);
}
/*************************************
*
@ -83,6 +75,21 @@ void starwars_state::irq_ack_w(uint8_t data)
*
*************************************/
uint8_t starwars_state::starwars_main_ready_flag_r()
{
/* only upper two flag bits mapped */
return (m_soundlatch->pending_r() << 7) | (m_mainlatch->pending_r() << 6);
}
void starwars_state::starwars_soundrst_w(uint8_t data)
{
m_soundlatch->acknowledge_w();
m_mainlatch->acknowledge_w();
/* reset sound CPU here */
m_audiocpu->pulse_input_line(INPUT_LINE_RESET, attotime::zero);
}
void starwars_state::main_map(address_map &map)
{
map(0x0000, 0x2fff).ram();
@ -128,12 +135,21 @@ void starwars_state::esb_main_map(address_map &map)
*
*************************************/
void starwars_state::quad_pokeyn_w(offs_t offset, uint8_t data)
{
int pokey_num = (offset >> 3) & ~0x04;
int control = (offset & 0x20) >> 2;
int pokey_reg = (offset % 8) | control;
m_pokey[pokey_num]->write(pokey_reg, data);
}
void starwars_state::sound_map(address_map &map)
{
map(0x0000, 0x07ff).w(m_mainlatch, FUNC(generic_latch_8_device::write));
map(0x0800, 0x0fff).r(m_soundlatch, FUNC(generic_latch_8_device::read)); /* SIN Read */
map(0x1000, 0x107f).ram(); /* 6532 ram */
map(0x1080, 0x109f).rw(m_riot, FUNC(riot6532_device::read), FUNC(riot6532_device::write));
map(0x1000, 0x107f).m(m_riot, FUNC(mos6532_new_device::ram_map));
map(0x1080, 0x109f).m(m_riot, FUNC(mos6532_new_device::io_map));
map(0x1800, 0x183f).w(FUNC(starwars_state::quad_pokeyn_w));
map(0x2000, 0x27ff).ram(); /* program RAM */
map(0x4000, 0x7fff).rom(); /* sound roms */
@ -222,7 +238,6 @@ static INPUT_PORTS_START( starwars )
PORT_DIPSETTING( 0x00, DEF_STR( None ) )
/* 0xc0 and 0xe0 None */
PORT_START("STICKY")
PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(70) PORT_KEYDELTA(30)
@ -272,12 +287,16 @@ void starwars_state::starwars(machine_config &config)
adc.in_callback<1>().set_ioport("STICKX"); // yaw
adc.in_callback<2>().set_constant(0); // thrust (unused)
RIOT6532(config, m_riot, MASTER_CLOCK / 8);
m_riot->in_pa_callback().set(FUNC(starwars_state::r6532_porta_r));
m_riot->out_pa_callback().set(FUNC(starwars_state::r6532_porta_w));
m_riot->in_pb_callback().set("tms", FUNC(tms5220_device::status_r));
m_riot->out_pb_callback().set("tms", FUNC(tms5220_device::data_w));
m_riot->irq_callback().set_inputline("audiocpu", M6809_IRQ_LINE);
MOS6532_NEW(config, m_riot, MASTER_CLOCK / 8);
m_riot->pa_wr_callback<0>().set(m_tms, FUNC(tms5220_device::wsq_w));
m_riot->pa_wr_callback<1>().set(m_tms, FUNC(tms5220_device::rsq_w));
m_riot->pa_rd_callback<2>().set(m_tms, FUNC(tms5220_device::readyq_r));
m_riot->pa_wr_callback<3>().set_nop(); // hold main CPU in reset? + enable delay circuit?
m_riot->pa_rd_callback<4>().set_constant(1); // not sound self test
m_riot->pa_wr_callback<5>().set_nop(); // mute speech
m_riot->pb_rd_callback().set("tms", FUNC(tms5220_device::status_r));
m_riot->pb_wr_callback().set("tms", FUNC(tms5220_device::data_w));
m_riot->irq_wr_callback().set_inputline("audiocpu", M6809_IRQ_LINE);
X2212(config, "x2212").set_auto_save(true); /* nvram */
@ -314,11 +333,11 @@ void starwars_state::starwars(machine_config &config)
TMS5220(config, m_tms, MASTER_CLOCK/2/9).add_route(ALL_OUTPUTS, "mono", 0.50);
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set(m_riot, FUNC(riot6532_device::pa7_w));
m_soundlatch->data_pending_callback().set(m_riot, FUNC(mos6532_new_device::pa7_w));
m_soundlatch->data_pending_callback().append([this](int state) { if (state) machine().scheduler().perfect_quantum(attotime::from_usec(100)); });
GENERIC_LATCH_8(config, m_mainlatch);
m_mainlatch->data_pending_callback().set(m_riot, FUNC(riot6532_device::pa6_w));
m_mainlatch->data_pending_callback().set(m_riot, FUNC(mos6532_new_device::pa6_w));
m_mainlatch->data_pending_callback().append([this](int state) { if (state) machine().scheduler().perfect_quantum(attotime::from_usec(100)); });
}
@ -344,7 +363,6 @@ void starwars_state::esb(machine_config &config)
*
*************************************/
ROM_START( starwars )
ROM_REGION( 0x12000, "maincpu", 0 ) /* 2 64k ROM spaces */
ROM_LOAD( "136021.214.1f", 0x6000, 0x2000, CRC(04f1876e) SHA1(c1d3637cb31ece0890c25f6122d6bcd27e6ffe0c) ) /* ROM 0 bank pages 0 and 1 */
@ -448,11 +466,7 @@ ROM_START( tomcatsw )
ROM_LOAD( "tcavg3.1l", 0x0000, 0x1000, CRC(27188aa9) SHA1(5d9a978a7ac1913b57586e81045a1b955db27b48) )
/* Sound ROMS */
ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "136021-107.1jk",0x4000, 0x2000, NO_DUMP ) /* Sound ROM 0 */
ROM_RELOAD( 0xc000, 0x2000 )
ROM_LOAD( "136021-208.1h", 0x6000, 0x2000, NO_DUMP ) /* Sound ROM 0 */
ROM_RELOAD( 0xe000, 0x2000 )
ROM_REGION( 0x10000, "audiocpu", ROMREGION_ERASE00 )
ROM_REGION( 0x100, "avg:prom", 0)
ROM_LOAD( "136021-109.4b", 0x0000, 0x0100, CRC(82fc3eb2) SHA1(184231c7baef598294860a7d2b8a23798c5c7da6) ) /* AVG PROM */

View file

@ -10,8 +10,8 @@
#pragma once
#include "machine/6532riot.h"
#include "machine/gen_latch.h"
#include "machine/mos6530n.h"
#include "slapstic.h"
#include "machine/x2212.h"
#include "sound/pokey.h"
@ -47,7 +47,7 @@ public:
private:
required_device<generic_latch_8_device> m_soundlatch;
required_device<generic_latch_8_device> m_mainlatch;
required_device<riot6532_device> m_riot;
required_device<mos6532_new_device> m_riot;
required_shared_ptr<uint8_t> m_mathram;
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
@ -88,8 +88,6 @@ private:
void quad_pokeyn_w(offs_t offset, uint8_t data);
virtual void machine_reset() override;
TIMER_CALLBACK_MEMBER(math_run_clear);
uint8_t r6532_porta_r();
void r6532_porta_w(uint8_t data);
void starwars_mproc_init();
void starwars_mproc_reset();

View file

@ -1,69 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Frank Palazzolo
/***************************************************************************
Atari Star Wars hardware
This file is Copyright Steve Baines.
Modified by Frank Palazzolo for sound support
***************************************************************************/
#include "emu.h"
#include "starwars.h"
/*************************************
*
* RIOT interfaces
*
*************************************/
uint8_t starwars_state::r6532_porta_r()
{
/* Configured as follows: */
/* d7 (in) Main Ready Flag */
/* d6 (in) Sound Ready Flag */
/* d5 (out) Mute Speech */
/* d4 (in) Not Sound Self Test */
/* d3 (out) Hold Main CPU in Reset? */
/* + enable delay circuit? */
/* d2 (in) TMS5220 Not Ready */
/* d1 (out) TMS5220 Not Read */
/* d0 (out) TMS5220 Not Write */
/* Note: bit 4 is always set to avoid sound self test */
uint8_t olddata = m_riot->porta_in_get();
return (olddata & 0xc0) | 0x10 | (m_tms->readyq_r() << 2);
}
void starwars_state::r6532_porta_w(uint8_t data)
{
/* handle 5220 read */
m_tms->rsq_w((data & 2)>>1);
/* handle 5220 write */
m_tms->wsq_w((data & 1)>>0);
}
/*************************************
*
* Sound CPU to/from main CPU
*
*************************************/
uint8_t starwars_state::starwars_main_ready_flag_r()
{
return m_riot->porta_in_get() & 0xc0; /* only upper two flag bits mapped */
}
void starwars_state::starwars_soundrst_w(uint8_t data)
{
m_soundlatch->acknowledge_w();
m_mainlatch->acknowledge_w();
/* reset sound CPU here */
m_audiocpu->pulse_input_line(INPUT_LINE_RESET, attotime::zero);
}

View file

@ -33,10 +33,10 @@
#include "video/vector.h"
#include "machine/74259.h"
#include "machine/adc0808.h"
#include "machine/mos6530n.h"
#include "machine/timekpr.h"
#include "machine/nvram.h"
#include "machine/watchdog.h"
#include "machine/6532riot.h"
#include "sound/pokey.h"
#include "sound/tms5220.h"
#include "sound/ymopm.h"
@ -270,8 +270,8 @@ void tomcat_state::sound_map(address_map &map)
map(0x2000, 0x2001).rw("ymsnd", FUNC(ym2151_device::read), FUNC(ym2151_device::write));
map(0x3000, 0x30df).w(FUNC(tomcat_state::soundlatches_w));
map(0x30e0, 0x30e0).noprw(); // COINRD Inputs: D7 = Coin L, D6 = Coin R, D5 = SOUNDFLAG
map(0x5000, 0x507f).ram(); // 6532 ram
map(0x5080, 0x509f).rw("riot", FUNC(riot6532_device::read), FUNC(riot6532_device::write));
map(0x5000, 0x507f).m("riot", FUNC(mos6532_new_device::ram_map));
map(0x5080, 0x509f).m("riot", FUNC(mos6532_new_device::io_map));
map(0x6000, 0x601f).rw("pokey1", FUNC(pokey_device::read), FUNC(pokey_device::write));
map(0x7000, 0x701f).rw("pokey2", FUNC(pokey_device::read), FUNC(pokey_device::write));
map(0x8000, 0xffff).noprw(); // main sound program rom
@ -330,7 +330,7 @@ void tomcat_state::tomcat(machine_config &config)
m_adc->in_callback<0>().set_ioport("STICKY");
m_adc->in_callback<1>().set_ioport("STICKX");
RIOT6532(config, "riot", 14.318181_MHz_XTAL / 8);
MOS6532_NEW(config, "riot", 14.318181_MHz_XTAL / 8);
/*
PA0 = /WS OUTPUT (TMS-5220 WRITE STROBE)
PA1 = /RS OUTPUT (TMS-5220 READ STROBE)