- atari/mhavoc.cpp: consolidated driver in single file

- galaxian/galaxian.cpp: fixed MT08630 [johnmcallister]

- taito/taitosj.cpp: fixed MT08631 [johnmcallister]
This commit is contained in:
Ivan Vangelista 2023-05-08 18:12:39 +02:00
parent 82394e8569
commit cc64f0ccc8
5 changed files with 656 additions and 606 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,104 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Mike Appolo
/*************************************************************************
Atari Major Havoc hardware
*************************************************************************/
#include "machine/timer.h"
#include "sound/pokey.h"
#include "sound/tms5220.h"
#define MHAVOC_CLOCK 10000000
#define MHAVOC_CLOCK_5M (MHAVOC_CLOCK/2)
#define MHAVOC_CLOCK_2_5M (MHAVOC_CLOCK/4)
#define MHAVOC_CLOCK_1_25M (MHAVOC_CLOCK/8)
#define MHAVOC_CLOCK_625K (MHAVOC_CLOCK/16)
#define MHAVOC_CLOCK_156K (MHAVOC_CLOCK_625K/4)
#define MHAVOC_CLOCK_5K (MHAVOC_CLOCK_625K/16/8)
#define MHAVOC_CLOCK_2_4K (MHAVOC_CLOCK_625K/16/16)
class mhavoc_state : public driver_device
{
public:
mhavoc_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_zram0(*this, "zram0"),
m_zram1(*this, "zram1"),
m_alpha(*this, "alpha"),
m_gamma(*this, "gamma"),
m_pokey(*this, "pokey%u", 1U),
m_tms(*this, "tms"),
m_lamps(*this, "lamp%u", 0U),
m_coin(*this, "COIN"),
m_service(*this, "SERVICE")
{ }
void alphaone(machine_config &config);
void mhavoc(machine_config &config);
void mhavocrv(machine_config &config);
void init_mhavocrv();
DECLARE_CUSTOM_INPUT_MEMBER(coin_service_r);
DECLARE_READ_LINE_MEMBER(gamma_rcvd_r);
DECLARE_READ_LINE_MEMBER(gamma_xmtd_r);
DECLARE_READ_LINE_MEMBER(alpha_rcvd_r);
DECLARE_READ_LINE_MEMBER(alpha_xmtd_r);
DECLARE_READ_LINE_MEMBER(clock_r);
private:
uint8_t dual_pokey_r(offs_t offset);
void dual_pokey_w(offs_t offset, uint8_t data);
void mhavoc_alpha_irq_ack_w(uint8_t data);
void mhavoc_gamma_irq_ack_w(uint8_t data);
void mhavoc_gamma_w(uint8_t data);
uint8_t mhavoc_alpha_r();
void mhavoc_alpha_w(uint8_t data);
uint8_t mhavoc_gamma_r();
void mhavoc_ram_banksel_w(uint8_t data);
void mhavoc_rom_banksel_w(uint8_t data);
void mhavoc_out_0_w(uint8_t data);
void alphaone_out_0_w(uint8_t data);
void mhavoc_out_1_w(uint8_t data);
void mhavocrv_speech_data_w(uint8_t data);
void mhavocrv_speech_strobe_w(uint8_t data);
uint8_t quad_pokeyn_r(offs_t offset);
void quad_pokeyn_w(offs_t offset, uint8_t data);
TIMER_CALLBACK_MEMBER(delayed_gamma_w);
TIMER_DEVICE_CALLBACK_MEMBER(mhavoc_cpu_irq_clock);
void alpha_map(address_map &map);
void alphaone_map(address_map &map);
void gamma_map(address_map &map);
virtual void machine_start() override;
virtual void machine_reset() override;
required_shared_ptr<uint8_t> m_zram0;
required_shared_ptr<uint8_t> m_zram1;
required_device<cpu_device> m_alpha;
optional_device<cpu_device> m_gamma;
optional_device_array<pokey_device, 4> m_pokey;
optional_device<tms5220_device> m_tms;
output_finder<2> m_lamps;
optional_ioport m_coin;
optional_ioport m_service;
uint8_t m_alpha_data = 0;
uint8_t m_alpha_rcvd = 0;
uint8_t m_alpha_xmtd = 0;
uint8_t m_gamma_data = 0;
uint8_t m_gamma_rcvd = 0;
uint8_t m_gamma_xmtd = 0;
uint8_t m_player_1 = 0;
uint8_t m_alpha_irq_clock = 0;
uint8_t m_alpha_irq_clock_enable = 0;
uint8_t m_gamma_irq_clock = 0;
uint8_t m_has_gamma_cpu = 0;
uint8_t m_speech_write_buffer = 0;
emu_timer *m_gamma_sync_timer = nullptr;
};

View File

@ -1,325 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Mike Appolo
/***************************************************************************
Atari Major Havoc hardware
***************************************************************************/
#include "emu.h"
#include "cpu/m6502/m6502.h"
#include "mhavoc.h"
/*************************************
*
* Interrupt handling
*
*************************************/
TIMER_DEVICE_CALLBACK_MEMBER(mhavoc_state::mhavoc_cpu_irq_clock)
{
/* clock the LS161 driving the alpha CPU IRQ */
if (m_alpha_irq_clock_enable)
{
m_alpha_irq_clock++;
if ((m_alpha_irq_clock & 0x0c) == 0x0c)
{
m_alpha->set_input_line(0, ASSERT_LINE);
m_alpha_irq_clock_enable = 0;
}
}
/* clock the LS161 driving the gamma CPU IRQ */
if (m_has_gamma_cpu)
{
m_gamma_irq_clock++;
m_gamma->set_input_line(0, (m_gamma_irq_clock & 0x08) ? ASSERT_LINE : CLEAR_LINE);
}
}
void mhavoc_state::mhavoc_alpha_irq_ack_w(uint8_t data)
{
/* clear the line and reset the clock */
m_alpha->set_input_line(0, CLEAR_LINE);
m_alpha_irq_clock = 0;
m_alpha_irq_clock_enable = 1;
}
void mhavoc_state::mhavoc_gamma_irq_ack_w(uint8_t data)
{
/* clear the line and reset the clock */
m_gamma->set_input_line(0, CLEAR_LINE);
m_gamma_irq_clock = 0;
}
/*************************************
*
* Machine init
*
*************************************/
void mhavoc_state::machine_start()
{
m_lamps.resolve();
save_item(NAME(m_alpha_data));
save_item(NAME(m_alpha_rcvd));
save_item(NAME(m_alpha_xmtd));
save_item(NAME(m_gamma_data));
save_item(NAME(m_gamma_rcvd));
save_item(NAME(m_gamma_xmtd));
save_item(NAME(m_player_1));
save_item(NAME(m_alpha_irq_clock));
save_item(NAME(m_alpha_irq_clock_enable));
save_item(NAME(m_gamma_irq_clock));
save_item(NAME(m_speech_write_buffer));
m_gamma_sync_timer = machine().scheduler().timer_alloc(timer_expired_delegate());
}
void mhavoc_state::machine_reset()
{
m_has_gamma_cpu = (m_gamma != nullptr);
membank("bank1")->configure_entry(0, m_zram0);
membank("bank1")->configure_entry(1, m_zram1);
membank("bank2")->configure_entries(0, 4, memregion("alpha")->base() + 0x10000, 0x2000);
/* reset RAM/ROM banks to 0 */
mhavoc_ram_banksel_w(0);
mhavoc_rom_banksel_w(0);
/* reset alpha comm status */
m_alpha_data = 0;
m_alpha_rcvd = 0;
m_alpha_xmtd = 0;
/* reset gamma comm status */
m_gamma_data = 0;
m_gamma_rcvd = 0;
m_gamma_xmtd = 0;
/* reset player 1 flag */
m_player_1 = 0;
/* reset IRQ clock states */
m_alpha_irq_clock = 0;
m_alpha_irq_clock_enable = 1;
m_gamma_irq_clock = 0;
}
/*************************************
*
* Alpha -> gamma communications
*
*************************************/
TIMER_CALLBACK_MEMBER(mhavoc_state::delayed_gamma_w)
{
/* mark the data received */
m_gamma_rcvd = 0;
m_alpha_xmtd = 1;
m_alpha_data = param;
/* signal with an NMI pulse */
m_gamma->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
/* the sound CPU needs to reply in 250microseconds (according to Neil Bradley) */
machine().scheduler().timer_set(attotime::from_usec(250), timer_expired_delegate());
}
void mhavoc_state::mhavoc_gamma_w(uint8_t data)
{
//logerror(" writing to gamma processor: %02x (%d %d)\n", data, m_gamma_rcvd, m_alpha_xmtd);
machine().scheduler().synchronize(timer_expired_delegate(FUNC(mhavoc_state::delayed_gamma_w),this), data);
}
uint8_t mhavoc_state::mhavoc_alpha_r()
{
//logerror("\t\t\t\t\treading from alpha processor: %02x (%d %d)\n", m_alpha_data, m_gamma_rcvd, m_alpha_xmtd);
m_gamma_rcvd = 1;
m_alpha_xmtd = 0;
return m_alpha_data;
}
/*************************************
*
* Gamma -> alpha communications
*
*************************************/
void mhavoc_state::mhavoc_alpha_w(uint8_t data)
{
//logerror("\t\t\t\t\twriting to alpha processor: %02x %d %d\n", data, m_alpha_rcvd, m_gamma_xmtd);
m_alpha_rcvd = 0;
m_gamma_xmtd = 1;
m_gamma_data = data;
}
uint8_t mhavoc_state::mhavoc_gamma_r()
{
//logerror(" reading from gamma processor: %02x (%d %d)\n", m_gamma_data, m_alpha_rcvd, m_gamma_xmtd);
m_alpha_rcvd = 1;
m_gamma_xmtd = 0;
return m_gamma_data;
}
/*************************************
*
* RAM/ROM banking
*
*************************************/
void mhavoc_state::mhavoc_ram_banksel_w(uint8_t data)
{
membank("bank1")->set_entry(data & 1);
}
void mhavoc_state::mhavoc_rom_banksel_w(uint8_t data)
{
membank("bank2")->set_entry(data & 3);
}
/*************************************
*
* Input ports
*
*************************************/
CUSTOM_INPUT_MEMBER(mhavoc_state::coin_service_r)
{
return (m_player_1 ? m_service : m_coin)->read() & 0x03;
}
READ_LINE_MEMBER(mhavoc_state::gamma_rcvd_r)
{
/* Gamma rcvd flag */
return m_gamma_rcvd;
}
READ_LINE_MEMBER(mhavoc_state::gamma_xmtd_r)
{
/* Gamma xmtd flag */
return m_gamma_xmtd;
}
READ_LINE_MEMBER(mhavoc_state::alpha_rcvd_r)
{
/* Alpha rcvd flag */
return (m_has_gamma_cpu && m_alpha_rcvd);
}
READ_LINE_MEMBER(mhavoc_state::alpha_xmtd_r)
{
/* Alpha xmtd flag */
return (m_has_gamma_cpu && m_alpha_xmtd);
}
/*************************************
*
* Output ports
*
*************************************/
void mhavoc_state::mhavoc_out_0_w(uint8_t data)
{
/* Bit 7 = Invert Y -- unemulated */
/* Bit 6 = Invert X -- unemulated */
/* Bit 5 = Player 1 */
m_player_1 = (data >> 5) & 1;
/* Bit 3 = Gamma reset */
m_gamma->set_input_line(INPUT_LINE_RESET, (data & 0x08) ? CLEAR_LINE : ASSERT_LINE);
if (!(data & 0x08))
{
//logerror("\t\t\t\t*** resetting gamma processor. ***\n");
m_alpha_rcvd = 0;
m_alpha_xmtd = 0;
m_gamma_rcvd = 0;
m_gamma_xmtd = 0;
}
/* Bit 2 = Beta reset */
/* this is the unpopulated processor in the corner of the pcb farthest from the quad pokey, not used on shipping boards */
/* Bit 0 = Roller light (Blinks on fatal errors) */
m_lamps[0] = BIT(data, 0);
}
void mhavoc_state::alphaone_out_0_w(uint8_t data)
{
/* Bit 5 = P2 lamp */
m_lamps[0] = BIT(~data, 5);
/* Bit 4 = P1 lamp */
m_lamps[1] = BIT(~data, 4);
/* Bit 1 = right coin counter */
machine().bookkeeping().coin_counter_w(1, data & 0x02);
/* Bit 0 = left coin counter */
machine().bookkeeping().coin_counter_w(0, data & 0x01);
//logerror("alphaone_out_0_w(%02X)\n", data);
}
void mhavoc_state::mhavoc_out_1_w(uint8_t data)
{
/* Bit 1 = left coin counter */
machine().bookkeeping().coin_counter_w(0, data & 0x02);
/* Bit 0 = right coin counter */
machine().bookkeeping().coin_counter_w(1, data & 0x01);
}
/*************************************
*
* Speech access
*
*************************************/
void mhavoc_state::mhavocrv_speech_data_w(uint8_t data)
{
m_speech_write_buffer = data;
}
void mhavoc_state::mhavocrv_speech_strobe_w(uint8_t data)
{
m_tms->data_w(m_speech_write_buffer);
}
/*************************************
*
* Driver-specific init
*
*************************************/
void mhavoc_state::init_mhavocrv()
{
// For Return to Vax, add support for the normally-unused speech module.
m_gamma->space(AS_PROGRAM).install_write_handler(0x5800, 0x5800, write8smo_delegate(*this, FUNC(mhavoc_state::mhavocrv_speech_data_w)));
m_gamma->space(AS_PROGRAM).install_write_handler(0x5900, 0x5900, write8smo_delegate(*this, FUNC(mhavoc_state::mhavocrv_speech_strobe_w)));
}

View File

@ -4870,9 +4870,9 @@ static INPUT_PORTS_START( jumpbug )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 )
PORT_DIPNAME( 0x40, 0x00, "Difficulty ?" )
PORT_DIPSETTING( 0x00, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x40, DEF_STR( Easy ) )
PORT_DIPNAME( 0x40, 0x00, "Difficulty" )
PORT_DIPSETTING( 0x00, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x40, DEF_STR( Hard ) )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
PORT_START("IN2")

View File

@ -806,9 +806,9 @@ static INPUT_PORTS_START( alpine )
PORT_DIPSETTING( 0x08, "1:30" )
PORT_DIPSETTING( 0x10, "2:00" )
PORT_DIPSETTING( 0x18, "2:30" )
PORT_DIPNAME( 0x20, 0x00, "End of Race Time Bonus" ) PORT_DIPLOCATION("SWA:6")
PORT_DIPSETTING( 0x20, "0:10" )
PORT_DIPSETTING( 0x00, "0:20" )
PORT_DIPNAME( 0x20, 0x20, "End of Race Time Bonus" ) PORT_DIPLOCATION("SWA:6")
PORT_DIPSETTING( 0x00, "0:10" )
PORT_DIPSETTING( 0x20, "0:20" )
PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SWA:7")
PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )