mw8080bw.cpp: move more stuff out of the giant class and reduce runtime tag map lookups (nw)

This commit is contained in:
Vas Crabb 2019-10-10 01:32:15 +11:00
parent b31040b1a0
commit 29025a821d
9 changed files with 1346 additions and 1323 deletions

View File

@ -4,9 +4,11 @@
/* 8080bw.c *******************************************/
#include "emu.h"
#include "includes/8080bw.h"
#include "sound/samples.h"
#include "sound/discrete.h"
#include "includes/8080bw.h"
#include "speaker.h"
/*******************************************************/
@ -24,6 +26,67 @@ MACHINE_START_MEMBER(_8080bw_state,extra_8080bw_sh)
/*************************************
*
* Space Invaders
*
* Author : Tormod Tjaberg
* Created : 1997-04-09
* Description : Sound routines for the 'invaders' games
*
* Note:
* The samples were taken from Michael Strutt's (mstrutt@pixie.co.za)
* excellent space invader emulator and converted to signed samples so
* they would work under SEAL. The port info was also gleaned from
* his emulator. These sounds should also work on all the invader games.
*
*************************************/
static const char *const invaders_sample_names[] =
{
"*invaders",
"1", /* shot/missle */
"2", /* base hit/explosion */
"3", /* invader hit */
"4", /* fleet move 1 */
"5", /* fleet move 2 */
"6", /* fleet move 3 */
"7", /* fleet move 4 */
"8", /* UFO/saucer hit */
"9", /* bonus base */
nullptr
};
/* left in for all games that hack into invaders samples for audio */
void _8080bw_state::invaders_samples_audio(machine_config &config)
{
SPEAKER(config, "mono").front_center();
SN76477(config, m_sn);
m_sn->set_noise_params(0, 0, 0);
m_sn->set_decay_res(0);
m_sn->set_attack_params(0, RES_K(100));
m_sn->set_amp_res(RES_K(56));
m_sn->set_feedback_res(RES_K(10));
m_sn->set_vco_params(0, CAP_U(0.1), RES_K(8.2));
m_sn->set_pitch_voltage(5.0);
m_sn->set_slf_params(CAP_U(1.0), RES_K(120));
m_sn->set_oneshot_params(0, 0);
m_sn->set_vco_mode(1);
m_sn->set_mixer_params(0, 0, 0);
m_sn->set_envelope_params(1, 0);
m_sn->set_enable(1);
m_sn->add_route(ALL_OUTPUTS, "mono", 0.5);
SAMPLES(config, m_samples);
m_samples->set_channels(6);
m_samples->set_samples_names(invaders_sample_names);
m_samples->add_route(ALL_OUTPUTS, "mono", 1.0);
}
/*******************************************************/
/* */
/* Midway "Space Invaders Part II" */

File diff suppressed because it is too large Load Diff

View File

@ -158,6 +158,48 @@ private:
};
class invaders_audio_device : public device_t
{
public:
auto flip_screen_out() { return m_flip_screen_out.bind(); }
invaders_audio_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock = 0);
void p1_w(u8 data);
void p2_w(u8 data);
protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
private:
required_device<sn76477_device> m_sn;
required_device<discrete_sound_device> m_discrete;
devcb_write_line m_flip_screen_out;
u8 m_p2;
};
class invad2ct_audio_device : public device_t
{
public:
invad2ct_audio_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock = 0);
void p1_w(u8 data);
void p2_w(u8 data);
void p3_w(u8 data);
void p4_w(u8 data);
protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
private:
required_device<discrete_sound_device> m_discrete;
required_device_array<sn76477_device, 2> m_sn;
};
DECLARE_DEVICE_TYPE(SEAWOLF_AUDIO, seawolf_audio_device)
DECLARE_DEVICE_TYPE(GUNFIGHT_AUDIO, gunfight_audio_device)
DECLARE_DEVICE_TYPE(GMISSILE_AUDIO, gmissile_audio_device)
@ -165,5 +207,7 @@ DECLARE_DEVICE_TYPE(M4_AUDIO, m4_audio_device)
DECLARE_DEVICE_TYPE(CLOWNS_AUDIO, clowns_audio_device)
DECLARE_DEVICE_TYPE(SPCENCTR_AUDIO, spcenctr_audio_device)
DECLARE_DEVICE_TYPE(PHANTOM2_AUDIO, phantom2_audio_device)
DECLARE_DEVICE_TYPE(INVADERS_AUDIO, invaders_audio_device)
DECLARE_DEVICE_TYPE(INVAD2CT_AUDIO, invad2ct_audio_device)
#endif // MAME_AUDIO_MW8080BW_H

View File

@ -218,9 +218,10 @@
MACHINE_START_MEMBER(_8080bw_state,extra_8080bw)
{
mw8080bw_state::machine_start();
MACHINE_START_CALL_MEMBER(extra_8080bw_sh);
MACHINE_START_CALL_MEMBER(extra_8080bw_vh);
MACHINE_START_CALL_MEMBER(mw8080bw);
}
/*******************************************************/
@ -396,11 +397,11 @@ static INPUT_PORTS_START( invadpt2 )
PORT_DIPNAME( 0x01, 0x00, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:1")
PORT_DIPSETTING( 0x00, "3" )
PORT_DIPSETTING( 0x01, "4" )
/* SW1:2 doesn't seem to work? */
PORT_DIPNAME( 0x02, 0x00, "Rotate Images" ) PORT_DIPLOCATION("SW1:2") /* "When ON, the images on screen will be rotated. Default is ON." */
// SW1:2 doesn't seem to work?
PORT_DIPNAME( 0x02, 0x00, "Rotate Images" ) PORT_DIPLOCATION("SW1:2") // "When ON, the images on screen will be rotated. Default is ON."
PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x08, 0x00, "Preset Mode" ) PORT_DIPLOCATION("SW1:4") /* Preset Mode: "Switch for checking, when OFF checking can be done." */
PORT_DIPNAME( 0x08, 0x00, "Preset Mode" ) PORT_DIPLOCATION("SW1:4") // Preset Mode: "Switch for checking, when OFF checking can be done."
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x08, DEF_STR( On ) )
INPUT_PORTS_END
@ -562,8 +563,8 @@ void _8080bw_state::astropal_io_map(address_map &map)
map(0x01, 0x01).mirror(0x04).portr("IN1");
map(0x03, 0x03).mirror(0x04).portr("IN3");
map(0x03, 0x03).w(FUNC(_8080bw_state::invaders_audio_1_w));
map(0x05, 0x05).w(FUNC(_8080bw_state::invaders_audio_2_w));
map(0x03, 0x03).w("soundboard", FUNC(invaders_audio_device::p1_w));
map(0x05, 0x05).w("soundboard", FUNC(invaders_audio_device::p2_w));
map(0x06, 0x06).w(m_watchdog, FUNC(watchdog_timer_device::reset_w));
}
@ -812,8 +813,8 @@ void _8080bw_state::spacecom_map(address_map &map)
void _8080bw_state::spacecom_io_map(address_map &map)
{
map(0x41, 0x41).portr("IN0");
map(0x42, 0x42).portr("IN1").w(FUNC(_8080bw_state::invaders_audio_1_w));
map(0x44, 0x44).portr("IN2").w(FUNC(_8080bw_state::invaders_audio_2_w));
map(0x42, 0x42).portr("IN1").w("soundboard", FUNC(invaders_audio_device::p1_w));
map(0x44, 0x44).portr("IN2").w("soundboard", FUNC(invaders_audio_device::p2_w));
}
void _8080bw_state::spacecom(machine_config &config)
@ -825,7 +826,6 @@ void _8080bw_state::spacecom(machine_config &config)
m_maincpu->set_addrmap(AS_IO, &_8080bw_state::spacecom_io_map);
m_maincpu->set_irq_acknowledge_callback(FUNC(_8080bw_state::interrupt_vector));
MCFG_MACHINE_START_OVERRIDE(mw8080bw_state, mw8080bw)
MCFG_MACHINE_RESET_OVERRIDE(mw8080bw_state, mw8080bw)
/* video hardware */
@ -836,7 +836,8 @@ void _8080bw_state::spacecom(machine_config &config)
PALETTE(config, m_palette, palette_device::MONOCHROME);
/* sound hardware */
invaders_audio(config);
INVADERS_AUDIO(config, "soundboard"). // the flip screen line is only connected on the cocktail PCB
flip_screen_out().set([this] (int state) { if (invaders_is_cabinet_cocktail()) m_flip_screen = state ? 1 : 0; });
}
void _8080bw_state::init_spacecom()
@ -1236,12 +1237,6 @@ static INPUT_PORTS_START( cosmicmo )
PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNKNOWN )
INPUT_PORTS_END
WRITE8_MEMBER(_8080bw_state::cosmicmo_05_w)
{
invaders_audio_2_w(space, offset, data);
m_flip_screen = BIT(data, 5) & BIT(ioport("IN2")->read(), 2);
}
void _8080bw_state::cosmicmo_io_map(address_map &map)
{
map.global_mask(0x7);
@ -1251,9 +1246,9 @@ void _8080bw_state::cosmicmo_io_map(address_map &map)
map(0x03, 0x03).mirror(0x04).r(m_mb14241, FUNC(mb14241_device::shift_result_r));
map(0x02, 0x02).w(m_mb14241, FUNC(mb14241_device::shift_count_w));
map(0x03, 0x03).w(FUNC(_8080bw_state::invaders_audio_1_w));
map(0x03, 0x03).w("soundboard", FUNC(invaders_audio_device::p1_w));
map(0x04, 0x04).w(m_mb14241, FUNC(mb14241_device::shift_data_w));
map(0x05, 0x05).w(FUNC(_8080bw_state::cosmicmo_05_w));
map(0x05, 0x05).w("soundboard", FUNC(invaders_audio_device::p2_w));
map(0x06, 0x06).w(m_watchdog, FUNC(watchdog_timer_device::reset_w));
}
@ -1261,18 +1256,19 @@ void _8080bw_state::cosmicmo(machine_config &config)
{
mw8080bw_root(config);
/* basic machine hardware */
// basic machine hardware
m_maincpu->set_addrmap(AS_IO, &_8080bw_state::cosmicmo_io_map);
MCFG_MACHINE_START_OVERRIDE(_8080bw_state,extra_8080bw)
WATCHDOG_TIMER(config, m_watchdog).set_vblank_count("screen", 255);
/* add shifter */
// add shifter
MB14241(config, m_mb14241);
/* sound hardware */
invaders_audio(config);
// sound hardware
INVADERS_AUDIO(config, "soundboard").
flip_screen_out().set([this] (int state) { m_flip_screen = (state && BIT(ioport("IN2")->read(), 2)) ? 1 : 0; });
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_invaders));
@ -1399,12 +1395,12 @@ INPUT_PORTS_END
MACHINE_START_MEMBER(_8080bw_state,rollingc)
{
mw8080bw_state::machine_start();
m_scattered_colorram = std::make_unique<uint8_t []>(0x400);
m_scattered_colorram2 = std::make_unique<uint8_t []>(0x400);
save_pointer(&m_scattered_colorram[0], "m_scattered_colorram", 0x400);
save_pointer(&m_scattered_colorram2[0], "m_scattered_colorram2", 0x400);
MACHINE_START_CALL_MEMBER(mw8080bw);
}
void _8080bw_state::rollingc(machine_config &config)
@ -1535,11 +1531,12 @@ INPUT_PORTS_END
MACHINE_START_MEMBER(_8080bw_state,schaser)
{
mw8080bw_state::machine_start();
m_scattered_colorram = std::make_unique<uint8_t []>(0x800);
save_pointer(&m_scattered_colorram[0], "m_scattered_colorram", 0x800);
MACHINE_START_CALL_MEMBER(schaser_sh);
MACHINE_START_CALL_MEMBER(extra_8080bw_vh);
MACHINE_START_CALL_MEMBER(mw8080bw);
}
MACHINE_RESET_MEMBER(_8080bw_state,schaser)
@ -1676,12 +1673,13 @@ INPUT_PORTS_END
MACHINE_START_MEMBER(_8080bw_state,schasercv)
{
mw8080bw_state::machine_start();
m_scattered_colorram = std::make_unique<uint8_t []>(0x800);
save_pointer(&m_scattered_colorram[0], "m_scattered_colorram", 0x800);
MACHINE_START_CALL_MEMBER(extra_8080bw_sh);
MACHINE_START_CALL_MEMBER(extra_8080bw_vh);
MACHINE_START_CALL_MEMBER(mw8080bw);
}
void _8080bw_state::schasercv(machine_config &config)
@ -1784,10 +1782,10 @@ INPUT_PORTS_END
MACHINE_START_MEMBER(_8080bw_state,sflush)
{
mw8080bw_state::machine_start();
m_scattered_colorram = std::make_unique<uint8_t []>(0x800);
save_pointer(&m_scattered_colorram[0], "m_scattered_colorram", 0x800);
MACHINE_START_CALL_MEMBER(mw8080bw);
}
void _8080bw_state::sflush(machine_config &config)
@ -1977,12 +1975,12 @@ WRITE_LINE_MEMBER(_8080bw_state::polaris_60hz_w)
MACHINE_START_MEMBER(_8080bw_state,polaris)
{
mw8080bw_state::machine_start();
m_scattered_colorram = std::make_unique<uint8_t []>(0x800);
save_pointer(&m_scattered_colorram[0], "m_scattered_colorram", 0x800);
save_item(NAME(m_polaris_cloud_speed));
save_item(NAME(m_polaris_cloud_pos));
MACHINE_START_CALL_MEMBER(mw8080bw);
}
READ8_MEMBER(_8080bw_state::polaris_port00_r)
@ -2940,9 +2938,9 @@ void _8080bw_state::vortex_io_map(address_map &map)
map(0x01, 0x01).mirror(0x04).r(m_mb14241, FUNC(mb14241_device::shift_result_r));
map(0x00, 0x00).w(m_mb14241, FUNC(mb14241_device::shift_count_w));
map(0x01, 0x01).w(FUNC(_8080bw_state::invaders_audio_1_w));
map(0x01, 0x01).w("soundboard", FUNC(invaders_audio_device::p1_w));
map(0x06, 0x06).w(m_mb14241, FUNC(mb14241_device::shift_data_w));
map(0x07, 0x07).w(FUNC(_8080bw_state::invaders_audio_2_w));
map(0x07, 0x07).w("soundboard", FUNC(invaders_audio_device::p2_w));
map(0x04, 0x04).w(m_watchdog, FUNC(watchdog_timer_device::reset_w));
}
@ -2990,7 +2988,8 @@ void _8080bw_state::vortex(machine_config &config)
MB14241(config, m_mb14241);
/* audio hardware */
invaders_audio(config);
INVADERS_AUDIO(config, "soundboard"). // the flip screen line is only connected on the cocktail PCB
flip_screen_out().set([this] (int state) { if (invaders_is_cabinet_cocktail()) m_flip_screen = state ? 1 : 0; });
}
/* decrypt function for vortex */
@ -3273,10 +3272,10 @@ INPUT_PORTS_END
MACHINE_START_MEMBER(_8080bw_state, claybust)
{
mw8080bw_state::machine_start();
m_claybust_gun_pos = 0;
save_item(NAME(m_claybust_gun_pos));
MACHINE_START_CALL_MEMBER(mw8080bw);
}
void _8080bw_state::claybust(machine_config &config)
@ -3452,7 +3451,7 @@ static INPUT_PORTS_START( invmulti )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(mw8080bw_state, invaders_sw5_r)
PORT_START("IN1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(mw8080bw_state, invaders_coin_input_r)
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, mw8080bw_state, direct_coin_count, 0)
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
@ -3467,11 +3466,6 @@ static INPUT_PORTS_START( invmulti )
PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(mw8080bw_state, invaders_in2_control_r)
PORT_DIPUNUSED_DIPLOC( 0x80, 0x00, "SW:1" )
/* fake port for reading the coin input */
PORT_START(INVADERS_COIN_INPUT_PORT_TAG)
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
/* fake port for cabinet type */
PORT_START(INVADERS_CAB_TYPE_PORT_TAG)
PORT_CONFNAME( 0x01, 0x00, DEF_STR( Cabinet ) )

View File

@ -172,6 +172,12 @@
INPUT_CHANGED_MEMBER(mw8080bw_state::direct_coin_count)
{
machine().bookkeeping().coin_counter_w(0, newval);
}
/*************************************
*
* Special shifter circuit
@ -236,7 +242,6 @@ void mw8080bw_state::mw8080bw_root(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &mw8080bw_state::main_map);
m_maincpu->set_irq_acknowledge_callback(FUNC(mw8080bw_state::interrupt_vector));
MCFG_MACHINE_START_OVERRIDE(mw8080bw_state,mw8080bw)
MCFG_MACHINE_RESET_OVERRIDE(mw8080bw_state,mw8080bw)
/* video hardware */
@ -253,45 +258,42 @@ void mw8080bw_state::mw8080bw_root(machine_config &config)
*
*************************************/
#define SEAWOLF_ERASE_SW_PORT_TAG ("ERASESW")
#define SEAWOLF_ERASE_DIP_PORT_TAG ("ERASEDIP")
WRITE8_MEMBER(mw8080bw_state::seawolf_explosion_lamp_w)
void seawolf_state::machine_start()
{
/* D0-D3 are column drivers and D4-D7 are row drivers.
The following table shows values that light up individual lamps.
mw8080bw_state::machine_start();
D7 D6 D5 D4 D3 D2 D1 D0 Function
--------------------------------------------------------------------------------------
0 0 0 1 1 0 0 0 Explosion Lamp 0
0 0 0 1 0 1 0 0 Explosion Lamp 1
0 0 0 1 0 0 1 0 Explosion Lamp 2
0 0 0 1 0 0 0 1 Explosion Lamp 3
0 0 1 0 1 0 0 0 Explosion Lamp 4
0 0 1 0 0 1 0 0 Explosion Lamp 5
0 0 1 0 0 0 1 0 Explosion Lamp 6
0 0 1 0 0 0 0 1 Explosion Lamp 7
0 1 0 0 1 0 0 0 Explosion Lamp 8
0 1 0 0 0 1 0 0 Explosion Lamp 9
0 1 0 0 0 0 1 0 Explosion Lamp A
0 1 0 0 0 0 0 1 Explosion Lamp B
1 0 0 0 1 0 0 0 Explosion Lamp C
1 0 0 0 0 1 0 0 Explosion Lamp D
1 0 0 0 0 0 1 0 Explosion Lamp E
1 0 0 0 0 0 0 1 Explosion Lamp F
*/
int i;
m_exp_lamps.resolve();
m_torp_lamps.resolve();
m_ready_lamp.resolve();
m_reload_lamp.resolve();
}
static const char *const lamp_names[] =
{
"EXP_LAMP_0", "EXP_LAMP_1", "EXP_LAMP_2", "EXP_LAMP_3",
"EXP_LAMP_4", "EXP_LAMP_5", "EXP_LAMP_6", "EXP_LAMP_7",
"EXP_LAMP_8", "EXP_LAMP_9", "EXP_LAMP_A", "EXP_LAMP_B",
"EXP_LAMP_C", "EXP_LAMP_D", "EXP_LAMP_E", "EXP_LAMP_F"
};
static const uint8_t bits_for_lamps[] =
void seawolf_state::explosion_lamp_w(u8 data)
{
/* D0-D3 are column drivers and D4-D7 are row drivers.
The following table shows values that light up individual lamps.
D7 D6 D5 D4 D3 D2 D1 D0 Function
--------------------------------------------------------------------------------------
0 0 0 1 1 0 0 0 Explosion Lamp 0
0 0 0 1 0 1 0 0 Explosion Lamp 1
0 0 0 1 0 0 1 0 Explosion Lamp 2
0 0 0 1 0 0 0 1 Explosion Lamp 3
0 0 1 0 1 0 0 0 Explosion Lamp 4
0 0 1 0 0 1 0 0 Explosion Lamp 5
0 0 1 0 0 0 1 0 Explosion Lamp 6
0 0 1 0 0 0 0 1 Explosion Lamp 7
0 1 0 0 1 0 0 0 Explosion Lamp 8
0 1 0 0 0 1 0 0 Explosion Lamp 9
0 1 0 0 0 0 1 0 Explosion Lamp A
0 1 0 0 0 0 0 1 Explosion Lamp B
1 0 0 0 1 0 0 0 Explosion Lamp C
1 0 0 0 0 1 0 0 Explosion Lamp D
1 0 0 0 0 0 1 0 Explosion Lamp E
1 0 0 0 0 0 0 1 Explosion Lamp F
*/
static constexpr u8 BITS_FOR_LAMPS[] =
{
0x18, 0x14, 0x12, 0x11,
0x28, 0x24, 0x22, 0x21,
@ -299,56 +301,52 @@ WRITE8_MEMBER(mw8080bw_state::seawolf_explosion_lamp_w)
0x88, 0x84, 0x82, 0x81
};
/* set each lamp */
for (i = 0; i < 16; i++)
for (int i = 0; i < 16; i++)
{
uint8_t bits_for_lamp = bits_for_lamps[i];
output().set_value(lamp_names[i], (data & bits_for_lamp) == bits_for_lamp);
u8 const bits_for_lamp(BITS_FOR_LAMPS[i]);
m_exp_lamps[i] = ((data & bits_for_lamp) == bits_for_lamp) ? 1 : 0;
}
}
WRITE8_MEMBER(mw8080bw_state::seawolf_periscope_lamp_w)
void seawolf_state::periscope_lamp_w(u8 data)
{
/* the schematics and the connecting diagrams show the
torpedo light order differently, but this order is
confirmed by the software */
output().set_value("TORP_LAMP_4", (data >> 0) & 0x01);
output().set_value("TORP_LAMP_3", (data >> 1) & 0x01);
output().set_value("TORP_LAMP_2", (data >> 2) & 0x01);
output().set_value("TORP_LAMP_1", (data >> 3) & 0x01);
/* the schematics and the connecting diagrams show the torpedo light
order differently, but this order is confirmed by the software */
m_torp_lamps[3] = BIT(data, 0);
m_torp_lamps[2] = BIT(data, 1);
m_torp_lamps[1] = BIT(data, 2);
m_torp_lamps[0] = BIT(data, 3);
output().set_value("READY_LAMP", (data >> 4) & 0x01);
m_ready_lamp = BIT(data, 4);
output().set_value("RELOAD_LAMP", (data >> 5) & 0x01);
m_reload_lamp = BIT(data, 5);
}
CUSTOM_INPUT_MEMBER(mw8080bw_state::seawolf_erase_input_r)
CUSTOM_INPUT_MEMBER(seawolf_state::erase_input_r)
{
return ioport(SEAWOLF_ERASE_SW_PORT_TAG)->read() &
ioport(SEAWOLF_ERASE_DIP_PORT_TAG)->read();
return m_erase_sw->read() & m_erase_dip->read();
}
void mw8080bw_state::seawolf_io_map(address_map &map)
void seawolf_state::io_map(address_map &map)
{
map.global_mask(0x7);
map(0x00, 0x00).mirror(0x04).r(FUNC(mw8080bw_state::mw8080bw_shift_result_rev_r));
map(0x00, 0x00).mirror(0x04).r(FUNC(seawolf_state::mw8080bw_shift_result_rev_r));
map(0x01, 0x01).mirror(0x04).portr("IN0");
map(0x02, 0x02).mirror(0x04).portr("IN1");
map(0x03, 0x03).mirror(0x04).r(m_mb14241, FUNC(mb14241_device::shift_result_r));
map(0x01, 0x01).w(FUNC(mw8080bw_state::seawolf_explosion_lamp_w));
map(0x02, 0x02).w(FUNC(mw8080bw_state::seawolf_periscope_lamp_w));
map(0x01, 0x01).w(FUNC(seawolf_state::explosion_lamp_w));
map(0x02, 0x02).w(FUNC(seawolf_state::periscope_lamp_w));
map(0x03, 0x03).w(m_mb14241, FUNC(mb14241_device::shift_data_w));
map(0x04, 0x04).w(m_mb14241, FUNC(mb14241_device::shift_count_w));
map(0x05, 0x05).w("soundboard", FUNC(seawolf_audio_device::write));
}
/* the 30 position encoder is verified */
// the 30 position encoder is verified
static const ioport_value seawolf_controller_table[30] =
{
0x1e, 0x1c, 0x1d, 0x19, 0x18, 0x1a, 0x1b, 0x13,
@ -360,10 +358,10 @@ static const ioport_value seawolf_controller_table[30] =
static INPUT_PORTS_START( seawolf )
PORT_START("IN0")
/* the grey code is inverted by buffers */
/* The wiring diagram shows the encoder has 32 positions. */
/* But there is a hand written table on the game logic sheet showing only 30 positions. */
/* The actual commutator pcb (encoder) has 30 positions and works like the table says. */
// the grey code is inverted by buffers
// The wiring diagram shows the encoder has 32 positions.
// But there is a hand written table on the game logic sheet showing only 30 positions.
// The actual commutator pcb (encoder) has 30 positions and works like the table says.
PORT_BIT( 0x1f, 0x0f, IPT_POSITIONAL ) PORT_POSITIONS(30) PORT_REMAP_TABLE(seawolf_controller_table) PORT_INVERT PORT_SENSITIVITY(20) PORT_KEYDELTA(8) PORT_CENTERDELTA(0) PORT_NAME("Periscope axis") PORT_CROSSHAIR(X, ((float)MW8080BW_HPIXCOUNT - 28) / MW8080BW_HPIXCOUNT, 16.0 / MW8080BW_HPIXCOUNT, 32.0 / MW8080BW_VBSTART)
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_DIPNAME( 0xc0, 0x40, DEF_STR( Game_Time ) ) PORT_CONDITION("IN1", 0xe0, NOTEQUALS, 0xe0) PORT_DIPLOCATION("G4:1,2")
@ -384,7 +382,7 @@ static INPUT_PORTS_START( seawolf )
PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0c, DEF_STR( 2C_3C ) )
PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) )
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(mw8080bw_state, seawolf_erase_input_r)
PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(seawolf_state, erase_input_r)
PORT_DIPNAME( 0xe0, 0x60, "Extended Time At" ) PORT_DIPLOCATION("G4:6,7,8")
PORT_DIPSETTING( 0x00, DEF_STR( None ) )
PORT_DIPSETTING( 0x20, "2000" )
@ -395,7 +393,7 @@ static INPUT_PORTS_START( seawolf )
PORT_DIPSETTING( 0xc0, "7000" )
PORT_DIPSETTING( 0xe0, "Test Mode" )
/* 2 fake ports for the 'Reset High Score' input, which has a DIP to enable it */
// 2 fake ports for the 'Reset High Score' input, which has a DIP to enable it
PORT_START(SEAWOLF_ERASE_SW_PORT_TAG)
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Reset High Score") PORT_CODE(KEYCODE_F2)
PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
@ -408,18 +406,19 @@ static INPUT_PORTS_START( seawolf )
INPUT_PORTS_END
void mw8080bw_state::seawolf(machine_config &config)
void seawolf_state::seawolf(machine_config &config)
{
mw8080bw_root(config);
/* basic machine hardware */
m_maincpu->set_addrmap(AS_IO, &mw8080bw_state::seawolf_io_map);
/* there is no watchdog */
// basic machine hardware
m_maincpu->set_addrmap(AS_IO, &seawolf_state::io_map);
/* add shifter */
// there is no watchdog
// add shifter
MB14241(config, m_mb14241);
/* audio hardware */
// audio hardware
SEAWOLF_AUDIO(config, "soundboard");
}
@ -887,6 +886,8 @@ TIMER_CALLBACK_MEMBER(mw8080bw_state::maze_tone_timing_timer_callback)
MACHINE_START_MEMBER(mw8080bw_state,maze)
{
mw8080bw_state::machine_start();
/* create astable timer for IC B1 */
m_maze_tone_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mw8080bw_state::maze_tone_timing_timer_callback), this));
m_maze_tone_timer->adjust(MAZE_555_B1_PERIOD, 0, MAZE_555_B1_PERIOD);
@ -897,8 +898,6 @@ MACHINE_START_MEMBER(mw8080bw_state,maze)
/* setup for save states */
save_item(NAME(m_maze_tone_timing_state));
machine().save().register_postload(save_prepost_delegate(FUNC(mw8080bw_state::maze_update_discrete), this));
MACHINE_START_CALL_MEMBER(mw8080bw);
}
@ -982,10 +981,10 @@ void mw8080bw_state::maze(machine_config &config)
MACHINE_START_MEMBER(mw8080bw_state,boothill)
{
mw8080bw_state::machine_start();
/* setup for save states */
save_item(NAME(m_rev_shift_res));
MACHINE_START_CALL_MEMBER(mw8080bw);
}
@ -1185,10 +1184,10 @@ void mw8080bw_state::checkmat(machine_config &config)
MACHINE_START_MEMBER(mw8080bw_state,desertgu)
{
mw8080bw_state::machine_start();
/* setup for save states */
save_item(NAME(m_desertgun_controller_select));
MACHINE_START_CALL_MEMBER(mw8080bw);
}
@ -1514,10 +1513,10 @@ void mw8080bw_state::dplay(machine_config &config)
MACHINE_START_MEMBER(mw8080bw_state,gmissile)
{
mw8080bw_state::machine_start();
/* setup for save states */
save_item(NAME(m_rev_shift_res));
MACHINE_START_CALL_MEMBER(mw8080bw);
}
@ -1611,10 +1610,10 @@ void mw8080bw_state::gmissile(machine_config &config)
MACHINE_START_MEMBER(mw8080bw_state,m4)
{
mw8080bw_state::machine_start();
/* setup for save states */
save_item(NAME(m_rev_shift_res));
MACHINE_START_CALL_MEMBER(mw8080bw);
}
@ -1710,10 +1709,10 @@ void mw8080bw_state::m4(machine_config &config)
MACHINE_START_MEMBER(mw8080bw_state,clowns)
{
mw8080bw_state::machine_start();
/* setup for save states */
save_item(NAME(m_clowns_controller_select));
MACHINE_START_CALL_MEMBER(mw8080bw);
}
@ -1722,13 +1721,9 @@ CUSTOM_INPUT_MEMBER(mw8080bw_state::clowns_controller_r)
uint32_t ret;
if (m_clowns_controller_select)
{
ret = ioport(CLOWNS_CONTROLLER_P2_TAG)->read();
}
else
{
ret = ioport(CLOWNS_CONTROLLER_P1_TAG)->read();
}
return ret;
}
@ -2140,8 +2135,10 @@ void mw8080bw_state::dogpatch(machine_config &config)
*
*************************************/
MACHINE_START_MEMBER(spcenctr_state, spcenctr)
void spcenctr_state::machine_start()
{
mw8080bw_state::machine_start();
m_trench_width = 0U;
m_trench_center = 0U;
std::fill(std::begin(m_trench_slope), std::end(m_trench_slope), 0U);
@ -2153,8 +2150,6 @@ MACHINE_START_MEMBER(spcenctr_state, spcenctr)
save_item(NAME(m_trench_slope));
save_item(NAME(m_bright_control));
save_item(NAME(m_brightness));
MACHINE_START_CALL_MEMBER(mw8080bw);
}
@ -2257,8 +2252,6 @@ void spcenctr_state::spcenctr(machine_config &config)
// basic machine hardware
m_maincpu->set_addrmap(AS_IO, &spcenctr_state::io_map);
MCFG_MACHINE_START_OVERRIDE(spcenctr_state, spcenctr)
WATCHDOG_TIMER(config, m_watchdog).set_time(255 * attotime::from_hz(MW8080BW_60HZ));
// video hardware
@ -2279,10 +2272,10 @@ void spcenctr_state::spcenctr(machine_config &config)
MACHINE_START_MEMBER(mw8080bw_state,phantom2)
{
mw8080bw_state::machine_start();
/* setup for save states */
save_item(NAME(m_phantom2_cloud_counter));
MACHINE_START_CALL_MEMBER(mw8080bw);
}
@ -2505,70 +2498,48 @@ void mw8080bw_state::bowler(machine_config &config)
MACHINE_START_MEMBER(mw8080bw_state,invaders)
{
/* setup for save states */
mw8080bw_state::machine_start();
m_flip_screen = 0U;
save_item(NAME(m_flip_screen));
MACHINE_START_CALL_MEMBER(mw8080bw);
}
CUSTOM_INPUT_MEMBER(mw8080bw_state::invaders_coin_input_r)
{
uint32_t ret = ioport(INVADERS_COIN_INPUT_PORT_TAG)->read();
// FIXME: use PORT_CHANGED_MEMBER or PORT_WRITE_LINE_MEMBER instead of updating here
machine().bookkeeping().coin_counter_w(0, !ret);
return ret;
}
CUSTOM_INPUT_MEMBER(mw8080bw_state::invaders_sw6_sw7_r)
{
uint32_t ret;
/* upright PCB : switches visible
cocktail PCB: HI */
// upright PCB : switches visible
// cocktail PCB: HI
if (invaders_is_cabinet_cocktail())
ret = 0x03;
return 0x03;
else
ret = ioport(INVADERS_SW6_SW7_PORT_TAG)->read();
return ret;
return ioport(INVADERS_SW6_SW7_PORT_TAG)->read();
}
CUSTOM_INPUT_MEMBER(mw8080bw_state::invaders_sw5_r)
{
uint32_t ret;
/* upright PCB : switch visible
cocktail PCB: HI */
// upright PCB : switch visible
// cocktail PCB: HI
if (invaders_is_cabinet_cocktail())
ret = 0x01;
return 0x01;
else
ret = ioport(INVADERS_SW5_PORT_TAG)->read();
return ret;
return ioport(INVADERS_SW5_PORT_TAG)->read();
}
CUSTOM_INPUT_MEMBER(mw8080bw_state::invaders_in0_control_r)
{
uint32_t ret;
/* upright PCB : P1 controls
cocktail PCB: HI */
// upright PCB : P1 controls
// cocktail PCB: HI
if (invaders_is_cabinet_cocktail())
ret = 0x07;
return 0x07;
else
ret = ioport(INVADERS_P1_CONTROL_PORT_TAG)->read();
return ret;
return ioport(INVADERS_P1_CONTROL_PORT_TAG)->read();
}
@ -2580,17 +2551,13 @@ CUSTOM_INPUT_MEMBER(mw8080bw_state::invaders_in1_control_r)
CUSTOM_INPUT_MEMBER(mw8080bw_state::invaders_in2_control_r)
{
uint32_t ret;
/* upright PCB : P1 controls
cocktail PCB: P2 controls */
// upright PCB : P1 controls
// cocktail PCB: P2 controls
if (invaders_is_cabinet_cocktail())
ret = ioport(INVADERS_P2_CONTROL_PORT_TAG)->read();
return ioport(INVADERS_P2_CONTROL_PORT_TAG)->read();
else
ret = ioport(INVADERS_P1_CONTROL_PORT_TAG)->read();
return ret;
return ioport(INVADERS_P1_CONTROL_PORT_TAG)->read();
}
@ -2609,9 +2576,9 @@ void mw8080bw_state::invaders_io_map(address_map &map)
map(0x03, 0x03).mirror(0x04).r(m_mb14241, FUNC(mb14241_device::shift_result_r));
map(0x02, 0x02).w(m_mb14241, FUNC(mb14241_device::shift_count_w));
map(0x03, 0x03).w(FUNC(mw8080bw_state::invaders_audio_1_w));
map(0x03, 0x03).w("soundboard", FUNC(invaders_audio_device::p1_w));
map(0x04, 0x04).w(m_mb14241, FUNC(mb14241_device::shift_data_w));
map(0x05, 0x05).w(FUNC(mw8080bw_state::invaders_audio_2_w));
map(0x05, 0x05).w("soundboard", FUNC(invaders_audio_device::p2_w));
map(0x06, 0x06).w(m_watchdog, FUNC(watchdog_timer_device::reset_w));
}
@ -2627,7 +2594,7 @@ static INPUT_PORTS_START( invaders )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(mw8080bw_state, invaders_sw5_r)
PORT_START("IN1")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(mw8080bw_state, invaders_coin_input_r)
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, mw8080bw_state, direct_coin_count, 0)
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
@ -2649,11 +2616,6 @@ static INPUT_PORTS_START( invaders )
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
/* fake port for reading the coin input */
PORT_START(INVADERS_COIN_INPUT_PORT_TAG)
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
/* fake port for cabinet type */
PORT_START(INVADERS_CAB_TYPE_PORT_TAG)
PORT_CONFNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
@ -2695,21 +2657,22 @@ void mw8080bw_state::invaders(machine_config &config)
{
mw8080bw_root(config);
/* basic machine hardware */
// basic machine hardware
m_maincpu->set_addrmap(AS_IO, &mw8080bw_state::invaders_io_map);
MCFG_MACHINE_START_OVERRIDE(mw8080bw_state,invaders)
WATCHDOG_TIMER(config, m_watchdog).set_time(255 * attotime::from_hz(MW8080BW_60HZ));
/* video hardware */
// video hardware
m_screen->set_screen_update(FUNC(mw8080bw_state::screen_update_invaders));
/* add shifter */
// add shifter
MB14241(config, m_mb14241);
/* audio hardware */
invaders_audio(config);
// audio hardware
INVADERS_AUDIO(config, "soundboard"). // the flip screen line is only connected on the cocktail PCB
flip_screen_out().set([this] (int state) { if (invaders_is_cabinet_cocktail()) m_flip_screen = state ? 1 : 0; });
}
@ -2801,21 +2764,6 @@ void mw8080bw_state::blueshrk(machine_config &config)
*
*************************************/
#define INVAD2CT_COIN_INPUT_PORT_TAG ("COIN")
#ifdef UNUSED_FUNCTION
uint32_t mw8080bw_state::invad2ct_coin_input_r(void *param)
{
uint32_t ret = ioport(INVAD2CT_COIN_INPUT_PORT_TAG)->read();
coin_counter_w(machine, 0, !ret);
return ret;
}
#endif
void mw8080bw_state::invad2ct_io_map(address_map &map)
{
map.global_mask(0x7);
@ -2824,13 +2772,13 @@ void mw8080bw_state::invad2ct_io_map(address_map &map)
map(0x02, 0x02).mirror(0x04).portr("IN2");
map(0x03, 0x03).mirror(0x04).r(m_mb14241, FUNC(mb14241_device::shift_result_r));
map(0x01, 0x01).w(FUNC(mw8080bw_state::invad2ct_audio_3_w));
map(0x01, 0x01).w("soundboard", FUNC(invad2ct_audio_device::p3_w));
map(0x02, 0x02).w(m_mb14241, FUNC(mb14241_device::shift_count_w));
map(0x03, 0x03).w(FUNC(mw8080bw_state::invad2ct_audio_1_w));
map(0x03, 0x03).w("soundboard", FUNC(invad2ct_audio_device::p1_w));
map(0x04, 0x04).w(m_mb14241, FUNC(mb14241_device::shift_data_w));
map(0x05, 0x05).w(FUNC(mw8080bw_state::invad2ct_audio_2_w));
map(0x05, 0x05).w("soundboard", FUNC(invad2ct_audio_device::p2_w));
map(0x06, 0x06).w(m_watchdog, FUNC(watchdog_timer_device::reset_w));
map(0x07, 0x07).w(FUNC(mw8080bw_state::invad2ct_audio_4_w));
map(0x07, 0x07).w("soundboard", FUNC(invad2ct_audio_device::p4_w));
}
@ -2846,7 +2794,7 @@ static INPUT_PORTS_START( invad2ct )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("IN1")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(mw8080bw_state, invaders_coin_input_r)
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, mw8080bw_state, direct_coin_count, 0)
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED )
@ -2871,11 +2819,6 @@ static INPUT_PORTS_START( invad2ct )
PORT_DIPNAME( 0x80, 0x80, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW:1")
PORT_DIPSETTING( 0x80, "1500" )
PORT_DIPSETTING( 0x00, "2000" )
/* fake port for reading the coin input */
PORT_START(INVAD2CT_COIN_INPUT_PORT_TAG)
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
INPUT_PORTS_END
@ -2883,16 +2826,16 @@ void mw8080bw_state::invad2ct(machine_config &config)
{
mw8080bw_root(config);
/* basic machine hardware */
// basic machine hardware
m_maincpu->set_addrmap(AS_IO, &mw8080bw_state::invad2ct_io_map);
WATCHDOG_TIMER(config, m_watchdog).set_time(255 * attotime::from_hz(MW8080BW_60HZ));
/* add shifter */
// add shifter
MB14241(config, m_mb14241);
/* audio hardware */
invad2ct_audio(config);
// audio hardware
INVAD2CT_AUDIO(config, "soundboard");
}
@ -3218,8 +3161,8 @@ ROM_END
// PCB # year rom parent machine inp state init monitor company,fullname,flags
/* 596 */ GAMEL( 1976, seawolf, 0, seawolf, seawolf, mw8080bw_state, empty_init, ROT0, "Dave Nutting Associates / Midway", "Sea Wolf (set 1)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE, layout_seawolf )
/* 596 */ GAMEL( 1976, seawolfo, seawolf, seawolf, seawolf, mw8080bw_state, empty_init, ROT0, "Dave Nutting Associates / Midway", "Sea Wolf (set 2)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE, layout_seawolf )
/* 596 */ GAMEL( 1976, seawolf, 0, seawolf, seawolf, seawolf_state, empty_init, ROT0, "Dave Nutting Associates / Midway", "Sea Wolf (set 1)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE, layout_seawolf )
/* 596 */ GAMEL( 1976, seawolfo, seawolf, seawolf, seawolf, seawolf_state, empty_init, ROT0, "Dave Nutting Associates / Midway", "Sea Wolf (set 2)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE, layout_seawolf )
/* 597 */ GAMEL( 1975, gunfight, 0, gunfight, gunfight, gunfight_state, empty_init, ROT0, "Dave Nutting Associates / Midway", "Gun Fight (set 1)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE, layout_gunfight )
/* 597 */ GAMEL( 1975, gunfighto, gunfight, gunfight, gunfight, gunfight_state, empty_init, ROT0, "Dave Nutting Associates / Midway", "Gun Fight (set 2)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE, layout_gunfight )
/* 604 Gun Fight (cocktail, dump does not exist) */

View File

@ -34,9 +34,11 @@ public:
, m_audiocpu(*this, "audiocpu")
, m_schaser_effect_555_timer(*this, "schaser_sh_555")
, m_claybust_gun_on(*this, "claybust_gun")
, m_sn(*this, "snsnd")
, m_speaker(*this, "speaker")
, m_eeprom(*this, "eeprom")
, m_palette(*this, "palette")
, m_colorram(*this, "colorram")
, m_gunx(*this, "GUNX")
, m_guny(*this, "GUNY")
, m_timer_state(1)
@ -90,9 +92,11 @@ private:
optional_device<cpu_device> m_audiocpu;
optional_device<timer_device> m_schaser_effect_555_timer;
optional_device<timer_device> m_claybust_gun_on;
optional_device<sn76477_device> m_sn;
optional_device<speaker_sound_device> m_speaker;
optional_device<eeprom_serial_93cxx_device> m_eeprom;
optional_device<palette_device> m_palette;
optional_shared_ptr<uint8_t> m_colorram;
/* misc game specific */
optional_ioport m_gunx;
@ -101,6 +105,14 @@ private:
uint8_t m_screen_red;
uint8_t m_fleet_step;
std::unique_ptr<uint8_t[]> m_scattered_colorram;
std::unique_ptr<uint8_t[]> m_scattered_colorram2;
/* sound-related */
uint8_t m_port_1_last_extra;
uint8_t m_port_2_last_extra;
uint8_t m_port_3_last_extra;
attotime m_schaser_effect_555_time_remain;
int32_t m_schaser_effect_555_time_remain_savable;
int m_schaser_effect_555_is_low;
@ -124,7 +136,6 @@ private:
DECLARE_WRITE8_MEMBER(spcewars_sh_port_w);
DECLARE_WRITE8_MEMBER(lrescue_sh_port_1_w);
DECLARE_WRITE8_MEMBER(lrescue_sh_port_2_w);
DECLARE_WRITE8_MEMBER(cosmicmo_05_w);
DECLARE_WRITE8_MEMBER(cosmo_sh_port_2_w);
DECLARE_READ8_MEMBER(darthvdr_01_r);
DECLARE_WRITE8_MEMBER(darthvdr_00_w);
@ -215,6 +226,8 @@ private:
inline void set_8_pixels( bitmap_rgb32 &bitmap, uint8_t y, uint8_t x, uint8_t data, int fore_color, int back_color );
void clear_extra_columns( bitmap_rgb32 &bitmap, int color );
void invaders_samples_audio(machine_config &config);
void astropal_io_map(address_map &map);
void attackfc_io_map(address_map &map);
void ballbomb_io_map(address_map &map);

View File

@ -52,54 +52,33 @@ public:
m_mb14241(*this,"mb14241"),
m_watchdog(*this, "watchdog"),
m_main_ram(*this, "main_ram"),
m_colorram(*this, "colorram"),
m_colorram2(*this, "colorram2"),
m_discrete(*this, "discrete"),
m_samples(*this, "samples"),
m_sn1(*this, "sn1"),
m_sn2(*this, "sn2"),
m_sn(*this, "snsnd"),
m_screen(*this, "screen")
{ }
void blueshrk(machine_config &config);
void blueshrk_audio(machine_config &config);
void boothill(machine_config &config);
void boothill_audio(machine_config &config);
void bowler(machine_config &config);
void bowler_audio(machine_config &config);
void checkmat(machine_config &config);
void checkmat_audio(machine_config &config);
void clowns(machine_config &config);
void desertgu(machine_config &config);
void desertgu_audio(machine_config &config);
void dogpatch(machine_config &config);
void dogpatch_audio(machine_config &config);
void dplay(machine_config &config);
void dplay_audio(machine_config &config);
void gmissile(machine_config &config);
void invad2ct(machine_config &config);
void invad2ct_audio(machine_config &config);
void invaders(machine_config &config);
void invaders_audio(machine_config &config);
void invaders_samples_audio(machine_config &config);
void m4(machine_config &config);
void maze(machine_config &config);
void maze_audio(machine_config &config);
void mw8080bw_root(machine_config &config);
void phantom2(machine_config &config);
void seawolf(machine_config &config);
void shuffle(machine_config &config);
void shuffle_audio(machine_config &config);
void spacwalk(machine_config &config);
void spacwalk_audio(machine_config &config);
void tornbase(machine_config &config);
void tornbase_audio(machine_config &config);
void zzzap(machine_config &config);
void zzzap_audio(machine_config &config);
DECLARE_INPUT_CHANGED_MEMBER(direct_coin_count);
DECLARE_CUSTOM_INPUT_MEMBER(seawolf_erase_input_r);
DECLARE_CUSTOM_INPUT_MEMBER(tornbase_hit_left_input_r);
DECLARE_CUSTOM_INPUT_MEMBER(tornbase_hit_right_input_r);
DECLARE_CUSTOM_INPUT_MEMBER(tornbase_pitch_left_input_r);
@ -110,54 +89,42 @@ public:
DECLARE_CUSTOM_INPUT_MEMBER(dplay_pitch_left_input_r);
DECLARE_CUSTOM_INPUT_MEMBER(dplay_pitch_right_input_r);
DECLARE_CUSTOM_INPUT_MEMBER(clowns_controller_r);
DECLARE_CUSTOM_INPUT_MEMBER(invaders_coin_input_r);
DECLARE_CUSTOM_INPUT_MEMBER(blueshrk_coin_input_r);
DECLARE_CUSTOM_INPUT_MEMBER(invaders_sw6_sw7_r);
DECLARE_CUSTOM_INPUT_MEMBER(invaders_sw5_r);
DECLARE_CUSTOM_INPUT_MEMBER(blueshrk_coin_input_r);
DECLARE_CUSTOM_INPUT_MEMBER(invaders_in0_control_r);
DECLARE_CUSTOM_INPUT_MEMBER(invaders_in1_control_r);
DECLARE_CUSTOM_INPUT_MEMBER(invaders_in2_control_r);
DECLARE_MACHINE_START(mw8080bw);
DECLARE_MACHINE_RESET(mw8080bw);
IRQ_CALLBACK_MEMBER(interrupt_vector);
protected:
virtual void machine_start() override;
/* device/memory pointers */
DECLARE_READ8_MEMBER(mw8080bw_shift_result_rev_r);
int invaders_is_cabinet_cocktail();
uint32_t screen_update_invaders(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
uint32_t screen_update_mw8080bw(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
// device/memory pointers
required_device<cpu_device> m_maincpu;
optional_device<mb14241_device> m_mb14241;
optional_device<watchdog_timer_device> m_watchdog;
required_shared_ptr<uint8_t> m_main_ram;
optional_shared_ptr<uint8_t> m_colorram;
optional_shared_ptr<uint8_t> m_colorram2;
optional_device<discrete_sound_device> m_discrete;
/* other devices */
// other devices
optional_device<samples_device> m_samples;
optional_device<sn76477_device> m_sn1;
optional_device<sn76477_device> m_sn2;
optional_device<sn76477_device> m_sn;
required_device<screen_device> m_screen;
/* sound-related */
uint8_t m_port_1_last_extra;
uint8_t m_port_2_last_extra;
uint8_t m_port_3_last_extra;
/* misc game specific */
// misc game specific
uint8_t m_flip_screen;
DECLARE_WRITE8_MEMBER(invaders_audio_1_w);
DECLARE_WRITE8_MEMBER(invaders_audio_2_w);
std::unique_ptr<uint8_t[]> m_scattered_colorram;
std::unique_ptr<uint8_t[]> m_scattered_colorram2;
uint32_t screen_update_invaders(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
uint32_t screen_update_mw8080bw(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
private:
/* misc game specific */
uint16_t m_phantom2_cloud_counter;
@ -172,11 +139,8 @@ private:
attotime m_interrupt_time;
DECLARE_READ8_MEMBER(mw8080bw_shift_result_rev_r);
DECLARE_READ8_MEMBER(mw8080bw_reversable_shift_result_r);
DECLARE_WRITE8_MEMBER(mw8080bw_reversable_shift_count_w);
DECLARE_WRITE8_MEMBER(seawolf_explosion_lamp_w);
DECLARE_WRITE8_MEMBER(seawolf_periscope_lamp_w);
DECLARE_WRITE8_MEMBER(tornbase_io_w);
DECLARE_WRITE8_MEMBER(maze_coin_counter_w);
DECLARE_WRITE8_MEMBER(maze_io_w);
@ -218,10 +182,6 @@ private:
DECLARE_WRITE8_MEMBER(dogpatch_audio_w);
DECLARE_WRITE8_MEMBER(bowler_audio_1_w);
DECLARE_WRITE8_MEMBER(blueshrk_audio_w);
DECLARE_WRITE8_MEMBER(invad2ct_audio_1_w);
DECLARE_WRITE8_MEMBER(invad2ct_audio_2_w);
DECLARE_WRITE8_MEMBER(invad2ct_audio_3_w);
DECLARE_WRITE8_MEMBER(invad2ct_audio_4_w);
void maze_update_discrete();
void maze_write_discrete(uint8_t maze_tone_timing_state);
uint8_t vpos_to_vysnc_chain_counter( int vpos );
@ -229,7 +189,20 @@ private:
void mw8080bw_create_interrupt_timer( );
void mw8080bw_start_interrupt_timer( );
uint8_t tornbase_get_cabinet_type();
int invaders_is_cabinet_cocktail();
void blueshrk_audio(machine_config &config);
void boothill_audio(machine_config &config);
void bowler_audio(machine_config &config);
void checkmat_audio(machine_config &config);
void desertgu_audio(machine_config &config);
void dogpatch_audio(machine_config &config);
void dplay_audio(machine_config &config);
void maze_audio(machine_config &config);
void shuffle_audio(machine_config &config);
void spacwalk_audio(machine_config &config);
void tornbase_audio(machine_config &config);
void zzzap_audio(machine_config &config);
void blueshrk_io_map(address_map &map);
void boothill_io_map(address_map &map);
void bowler_io_map(address_map &map);
@ -245,7 +218,6 @@ private:
void main_map(address_map &map);
void maze_io_map(address_map &map);
void phantom2_io_map(address_map &map);
void seawolf_io_map(address_map &map);
void shuffle_io_map(address_map &map);
void spacwalk_io_map(address_map &map);
void tornbase_io_map(address_map &map);
@ -253,6 +225,45 @@ private:
};
#define SEAWOLF_ERASE_SW_PORT_TAG ("ERASESW")
#define SEAWOLF_ERASE_DIP_PORT_TAG ("ERASEDIP")
class seawolf_state : public mw8080bw_state
{
public:
seawolf_state(machine_config const &mconfig, device_type type, char const *tag) :
mw8080bw_state(mconfig, type, tag),
m_erase_sw(*this, SEAWOLF_ERASE_SW_PORT_TAG),
m_erase_dip(*this, SEAWOLF_ERASE_DIP_PORT_TAG),
m_exp_lamps(*this, "EXP_LAMP_%X", 0U),
m_torp_lamps(*this, "TORP_LAMP_%u", 1U),
m_ready_lamp(*this, "READY_LAMP"),
m_reload_lamp(*this, "RELOAD_LAMP")
{
}
void seawolf(machine_config &config);
DECLARE_CUSTOM_INPUT_MEMBER(erase_input_r);
protected:
virtual void machine_start() override;
private:
void explosion_lamp_w(u8 data);
void periscope_lamp_w(u8 data);
void io_map(address_map &map);
required_ioport m_erase_sw;
required_ioport m_erase_dip;
output_finder<15> m_exp_lamps;
output_finder<4> m_torp_lamps;
output_finder<> m_ready_lamp;
output_finder<> m_reload_lamp;
};
class gunfight_state : public mw8080bw_state
{
public:
@ -285,7 +296,7 @@ public:
void spcenctr(machine_config &config);
protected:
DECLARE_MACHINE_START(spcenctr);
virtual void machine_start() override;
private:
void io_w(offs_t offset, u8 data);
@ -303,8 +314,6 @@ private:
};
#define SEAWOLF_GUN_PORT_TAG ("GUN")
#define TORNBASE_CAB_TYPE_UPRIGHT_OLD (0)
#define TORNBASE_CAB_TYPE_UPRIGHT_NEW (1)
#define TORNBASE_CAB_TYPE_COCKTAIL (2)
@ -315,7 +324,6 @@ private:
#define INVADERS_CAB_TYPE_PORT_TAG ("CAB")
#define INVADERS_P1_CONTROL_PORT_TAG ("CONTP1")
#define INVADERS_P2_CONTROL_PORT_TAG ("CONTP2")
#define INVADERS_COIN_INPUT_PORT_TAG ("COIN")
#define INVADERS_SW6_SW7_PORT_TAG ("SW6SW7")
#define INVADERS_SW5_PORT_TAG ("SW5")

View File

@ -109,7 +109,7 @@ void mw8080bw_state::mw8080bw_start_interrupt_timer( )
*
*************************************/
MACHINE_START_MEMBER(mw8080bw_state,mw8080bw)
void mw8080bw_state::machine_start()
{
mw8080bw_create_interrupt_timer();
}

View File

@ -351,40 +351,37 @@ WRITE_LINE_MEMBER(mw8080bw_state::screen_vblank_phantom2)
*************************************/
/* the flip screen circuit is just a couple of relays on the monitor PCB */
// the flip screen circuit is just a couple of relays on the monitor PCB
uint32_t mw8080bw_state::screen_update_invaders(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
uint8_t x = 0;
uint8_t y = MW8080BW_VCOUNTER_START_NO_VBLANK;
uint8_t video_data = 0;
uint8_t flip = m_flip_screen;
while (1)
{
/* plot the current pixel */
// plot the current pixel
pen_t pen = (video_data & 0x01) ? rgb_t::white() : rgb_t::black();
if (flip)
if (m_flip_screen)
bitmap.pix32(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - x) = pen;
else
bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, x) = pen;
/* next pixel */
// next pixel
video_data = video_data >> 1;
x = x + 1;
/* end of line? */
// end of line?
if (x == 0)
{
/* yes, flush out the shift register */
int i;
for (i = 0; i < 4; i++)
// yes, flush out the shift register
for (int i = 0; i < 4; i++)
{
pen = (video_data & 0x01) ? rgb_t::white() : rgb_t::black();
if (flip)
if (m_flip_screen)
bitmap.pix32(MW8080BW_VBSTART - 1 - (y - MW8080BW_VCOUNTER_START_NO_VBLANK), MW8080BW_HPIXCOUNT - 1 - (256 + i)) = pen;
else
bitmap.pix32(y - MW8080BW_VCOUNTER_START_NO_VBLANK, 256 + i) = pen;
@ -392,18 +389,16 @@ uint32_t mw8080bw_state::screen_update_invaders(screen_device &screen, bitmap_rg
video_data = video_data >> 1;
}
/* next row, video_data is now 0, so the next line will start
with 4 blank pixels */
// next row, video_data is now 0, so the next line will start with 4 blank pixels
y = y + 1;
/* end of screen? */
// end of screen?
if (y == 0)
break;
}
/* the video RAM is read at every 8 pixels starting with pixel 4 */
else if ((x & 0x07) == 0x04)
else if ((x & 0x07) == 0x04) // the video RAM is read at every 8 pixels starting with pixel 4
{
offs_t offs = ((offs_t)y << 5) | (x >> 3);
offs_t const offs = (offs_t(y) << 5) | (x >> 3);
video_data = m_main_ram[offs];
}
}