mirror of
https://github.com/mamedev/mame.git
synced 2024-11-16 07:48:32 +01:00
segas16a.cpp, segas16b.cpp : Add save state, Partially fix reset behavior
Move dfjail related handlers/variables into dfjail_state, related to sound hardware differs
This commit is contained in:
parent
780039e23a
commit
f74774899c
4 changed files with 131 additions and 57 deletions
|
@ -7,7 +7,7 @@
|
|||
****************************************************************************
|
||||
|
||||
Known bugs:
|
||||
* none at this time
|
||||
* some games are stuck after reset when i8751 is present
|
||||
|
||||
DIP locations verified from manual for:
|
||||
* aceattaca
|
||||
|
@ -607,7 +607,14 @@ void segas16a_state::machine_reset()
|
|||
{
|
||||
// queue up a timer to either boost interleave or disable the MCU
|
||||
synchronize(TID_INIT_I8751);
|
||||
m_video_control = 0;
|
||||
m_mcu_control = 0x00;
|
||||
m_n7751_command = 0;
|
||||
m_n7751_rom_address = 0;
|
||||
m_last_buttons1 = 0;
|
||||
m_last_buttons2 = 0;
|
||||
m_read_port = 0;
|
||||
m_mj_input_num = 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1261,6 +1261,10 @@ INTERRUPT_GEN_MEMBER( segas16b_state::i8751_main_cpu_vblank )
|
|||
|
||||
void segas16b_state::machine_reset()
|
||||
{
|
||||
m_atomicp_sound_count = 0;
|
||||
m_hwc_input_value = 0;
|
||||
m_mj_input_num = 0;
|
||||
m_mj_last_val = 0;
|
||||
// if we have a hard-coded mapping configuration, set it now
|
||||
if (m_i8751_initial_config != nullptr)
|
||||
m_mapper->configure_explicit(m_i8751_initial_config);
|
||||
|
@ -1514,7 +1518,8 @@ READ16_MEMBER( segas16b_state::hwchamp_custom_io_r )
|
|||
{
|
||||
case 0x20/2:
|
||||
result = (m_hwc_input_value & 0x80) >> 7;
|
||||
m_hwc_input_value <<= 1;
|
||||
if (!machine().side_effects_disabled())
|
||||
m_hwc_input_value <<= 1;
|
||||
return result;
|
||||
}
|
||||
break;
|
||||
|
@ -1703,11 +1708,11 @@ void segas16b_state::system16b_bootleg_map(address_map &map)
|
|||
map(0xffc000, 0xffffff).ram().share("workram");
|
||||
}
|
||||
|
||||
void segas16b_state::dfjail_map(address_map &map)
|
||||
void dfjail_state::dfjail_map(address_map &map)
|
||||
{
|
||||
system16b_bootleg_map(map);
|
||||
map(0x000000, 0x07ffff).rom();
|
||||
map(0x840000, 0x840fff).ram().w(FUNC(segas16b_state::philko_paletteram_w)).share("paletteram");
|
||||
map(0x840000, 0x840fff).ram().w(FUNC(dfjail_state::philko_paletteram_w)).share("paletteram");
|
||||
|
||||
map(0xc40000, 0xc43fff).unmaprw();
|
||||
|
||||
|
@ -1872,14 +1877,14 @@ void segas16b_state::bootleg_sound_portmap(address_map &map)
|
|||
map(0xc0, 0xc0).mirror(0x3f).r(m_soundlatch, FUNC(generic_latch_8_device::read));
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(segas16b_state::dfjail_sound_control_w)
|
||||
WRITE8_MEMBER(dfjail_state::sound_control_w)
|
||||
{
|
||||
int size = memregion("soundcpu")->bytes() - 0x10000;
|
||||
|
||||
// NMI and presumably DAC output clear
|
||||
// TODO: identify which is which
|
||||
m_dfjail_nmi_enable = ((data & 0xc0) == 0);
|
||||
if (m_dfjail_nmi_enable == false)
|
||||
m_nmi_enable = ((data & 0xc0) == 0);
|
||||
if (m_nmi_enable == false)
|
||||
m_dac->write(0);
|
||||
//m_upd7759->start_w(BIT(data, 7));
|
||||
//m_upd7759->reset_w(BIT(data, 6));
|
||||
|
@ -1892,36 +1897,36 @@ WRITE8_MEMBER(segas16b_state::dfjail_sound_control_w)
|
|||
membank("soundbank")->set_base(memregion("soundcpu")->base() + 0x10000 + (bankoffs % size));
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(segas16b_state::dfjail_dac_data_w)
|
||||
WRITE8_MEMBER(dfjail_state::dac_data_w)
|
||||
{
|
||||
// TODO: understand how this is hooked up
|
||||
#if 0
|
||||
switch(offset)
|
||||
{
|
||||
case 0:
|
||||
m_dfjail_dac_data = (data & 0xf) << 0;
|
||||
m_dac_data = (data & 0xf) << 0;
|
||||
break;
|
||||
case 1:
|
||||
m_dfjail_dac_data |= (data & 0xf) << 4;
|
||||
m_dac_data |= (data & 0xf) << 4;
|
||||
break;
|
||||
case 2:
|
||||
m_dfjail_dac_data |= (data & 0xf) << 8;
|
||||
m_dac_data |= (data & 0xf) << 8;
|
||||
break;
|
||||
case 3:
|
||||
m_dfjail_dac_data |= (data & 0xf) << 12;
|
||||
m_dac->write(m_dfjail_dac_data);
|
||||
m_dac_data |= (data & 0xf) << 12;
|
||||
m_dac->write(m_dac_data);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void segas16b_state::dfjail_sound_iomap(address_map &map)
|
||||
void dfjail_state::dfjail_sound_iomap(address_map &map)
|
||||
{
|
||||
map.unmap_value_high();
|
||||
map.global_mask(0xff);
|
||||
map(0x00, 0x01).mirror(0x3e).rw(m_ym2151, FUNC(ym2151_device::read), FUNC(ym2151_device::write));
|
||||
map(0x40, 0x40).mirror(0x3f).w(FUNC(segas16b_state::dfjail_sound_control_w));
|
||||
map(0x80, 0x83).w(FUNC(segas16b_state::dfjail_dac_data_w));
|
||||
map(0x40, 0x40).mirror(0x3f).w(FUNC(dfjail_state::sound_control_w));
|
||||
map(0x80, 0x83).w(FUNC(dfjail_state::dac_data_w));
|
||||
map(0xc0, 0xc0).mirror(0x3f).r(m_soundlatch, FUNC(generic_latch_8_device::read));
|
||||
}
|
||||
|
||||
|
@ -4163,26 +4168,40 @@ void segas16b_state::atomicp(machine_config &config) // 10MHz CPU Clock verified
|
|||
config.device_remove("upd");
|
||||
}
|
||||
|
||||
INTERRUPT_GEN_MEMBER(segas16b_state::dfjail_soundirq_cb)
|
||||
INTERRUPT_GEN_MEMBER(dfjail_state::soundirq_cb)
|
||||
{
|
||||
if (m_dfjail_nmi_enable == true)
|
||||
if (m_nmi_enable == true)
|
||||
{
|
||||
m_soundcpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
|
||||
}
|
||||
}
|
||||
|
||||
void segas16b_state::dfjail(machine_config &config)
|
||||
void dfjail_state::machine_start()
|
||||
{
|
||||
segas16b_state::machine_start();
|
||||
save_item(NAME(m_nmi_enable));
|
||||
save_item(NAME(m_dac_data));
|
||||
}
|
||||
|
||||
void dfjail_state::machine_reset()
|
||||
{
|
||||
m_nmi_enable = false;
|
||||
m_dac_data = 0;
|
||||
segas16b_state::machine_reset();
|
||||
}
|
||||
|
||||
void dfjail_state::dfjail(machine_config &config)
|
||||
{
|
||||
system16b_split(config);
|
||||
M68000(config.replace(), m_maincpu, XTAL(16'000'000)/2); // ?
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &segas16b_state::dfjail_map);
|
||||
m_maincpu->set_vblank_int("screen", FUNC(segas16b_state::irq4_line_hold));
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &dfjail_state::dfjail_map);
|
||||
m_maincpu->set_vblank_int("screen", FUNC(dfjail_state::irq4_line_hold));
|
||||
|
||||
Z80(config.replace(), m_soundcpu, XTAL(16'000'000)/4); // ?
|
||||
m_soundcpu->set_addrmap(AS_PROGRAM, &segas16b_state::bootleg_sound_map);
|
||||
m_soundcpu->set_addrmap(AS_IO, &segas16b_state::dfjail_sound_iomap);
|
||||
m_soundcpu->set_addrmap(AS_PROGRAM, &dfjail_state::bootleg_sound_map);
|
||||
m_soundcpu->set_addrmap(AS_IO, &dfjail_state::dfjail_sound_iomap);
|
||||
// connected to a 74ls74 clock source
|
||||
m_soundcpu->set_periodic_int(FUNC(segas16b_state::dfjail_soundirq_cb), attotime::from_hz(4*60)); // TODO: timing
|
||||
m_soundcpu->set_periodic_int(FUNC(dfjail_state::soundirq_cb), attotime::from_hz(4*60)); // TODO: timing
|
||||
|
||||
//config.device_remove("ym2151");
|
||||
config.device_remove("upd");
|
||||
|
@ -9622,7 +9641,7 @@ GAME( 1990, atomicp, 0, atomicp, atomicp, segas16b_stat
|
|||
GAME( 1990, snapper, 0, atomicp, snapper, segas16b_state, init_snapper, ROT0, "Philko", "Snapper (Korea)", 0) // korean clone board..
|
||||
// board marked 'System 4' and has Philko custom chip - various hw changes (4bpp tiles for example)
|
||||
GAME( 1991, lockonph, 0, lockonph, lockonph, segas16b_state, init_lockonph, ROT0, "Philko", "Lock On (Philko)", MACHINE_IMPERFECT_SOUND ) // Copyright not shown in game, but has 'PHILKO' in the startup warning and tiles / PCB. 1991 is the name entry for the lowest high score. Clipping issues on left edge in attract look like original game bugs.
|
||||
GAME( 199?, dfjail, 0, dfjail, dfjail, segas16b_state, init_generic_korean, ROT0, "Philko", "The Destroyer From Jail (Korea)", MACHINE_IMPERFECT_SOUND | MACHINE_NO_COCKTAIL ) // dips, check sound, not extensively tested
|
||||
GAME( 199?, dfjail, 0, dfjail, dfjail, dfjail_state, init_generic_korean, ROT0, "Philko", "The Destroyer From Jail (Korea)", MACHINE_IMPERFECT_SOUND | MACHINE_NO_COCKTAIL ) // dips, check sound, not extensively tested
|
||||
|
||||
// decrypted bootleg / 'suicide repair' sets
|
||||
|
||||
|
@ -10118,6 +10137,19 @@ INPUT_PORTS_END
|
|||
|
||||
void isgsm_state::machine_reset()
|
||||
{
|
||||
m_cart_addrlatch = 0;
|
||||
m_cart_addr = 0;
|
||||
m_data_type = 0;
|
||||
m_data_addr = 0;
|
||||
m_data_mode = 0;
|
||||
m_addr_latch = 0;
|
||||
m_security_value = 0;
|
||||
m_security_latch = 0;
|
||||
m_rle_control_position = 0;
|
||||
m_rle_control_byte = 0;
|
||||
m_rle_latched = 0;
|
||||
m_rle_byte = 0;
|
||||
|
||||
m_segaic16vid->tilemap_reset(*m_screen);
|
||||
|
||||
// configure sprite banks
|
||||
|
@ -10128,6 +10160,23 @@ void isgsm_state::machine_reset()
|
|||
membank(ISGSM_MAIN_BANK)->set_base(memregion("bios")->base());
|
||||
}
|
||||
|
||||
void isgsm_state::machine_start()
|
||||
{
|
||||
segas16b_state::machine_start();
|
||||
save_item(NAME(m_cart_addrlatch));
|
||||
save_item(NAME(m_cart_addr));
|
||||
save_item(NAME(m_data_type));
|
||||
save_item(NAME(m_data_addr));
|
||||
save_item(NAME(m_data_mode));
|
||||
save_item(NAME(m_addr_latch));
|
||||
save_item(NAME(m_security_value));
|
||||
save_item(NAME(m_security_latch));
|
||||
save_item(NAME(m_rle_control_position));
|
||||
save_item(NAME(m_rle_control_byte));
|
||||
save_item(NAME(m_rle_latched));
|
||||
save_item(NAME(m_rle_byte));
|
||||
}
|
||||
|
||||
|
||||
void isgsm_state::isgsm(machine_config &config)
|
||||
{
|
||||
|
|
|
@ -196,9 +196,9 @@ class afighter_16a_analog_state : public segas16a_state
|
|||
public:
|
||||
// construction/destruction
|
||||
afighter_16a_analog_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: segas16a_state(mconfig, type, tag),
|
||||
m_accel(*this, "ACCEL"),
|
||||
m_steer(*this, "STEER")
|
||||
: segas16a_state(mconfig, type, tag)
|
||||
, m_accel(*this, "ACCEL")
|
||||
, m_steer(*this, "STEER")
|
||||
{ }
|
||||
|
||||
DECLARE_CUSTOM_INPUT_MEMBER(afighter_accel_r);
|
||||
|
|
|
@ -44,7 +44,6 @@ public:
|
|||
, m_ym2151(*this, "ym2151")
|
||||
, m_ym2413(*this, "ym2413")
|
||||
, m_upd7759(*this, "upd")
|
||||
, m_dac(*this, "dac")
|
||||
, m_multiplier(*this, "multiplier")
|
||||
, m_cmptimer_1(*this, "cmptimer_1")
|
||||
, m_cmptimer_2(*this, "cmptimer_2")
|
||||
|
@ -97,7 +96,6 @@ public:
|
|||
void system16b_fd1094(machine_config &config);
|
||||
void fpointbl(machine_config &config);
|
||||
void lockonph(machine_config &config);
|
||||
void dfjail(machine_config &config);
|
||||
|
||||
// ROM board-specific driver init
|
||||
void init_generic_5521();
|
||||
|
@ -154,13 +152,6 @@ protected:
|
|||
DECLARE_READ8_MEMBER( upd7759_status_r );
|
||||
DECLARE_WRITE16_MEMBER( sound_w16 );
|
||||
|
||||
// dfjail
|
||||
DECLARE_WRITE8_MEMBER( dfjail_sound_control_w );
|
||||
DECLARE_WRITE8_MEMBER( dfjail_dac_data_w );
|
||||
INTERRUPT_GEN_MEMBER( dfjail_soundirq_cb );
|
||||
bool m_dfjail_nmi_enable;
|
||||
uint16_t m_dfjail_dac_data;
|
||||
|
||||
// other callbacks
|
||||
DECLARE_WRITE_LINE_MEMBER(upd7759_generate_nmi);
|
||||
INTERRUPT_GEN_MEMBER( i8751_main_cpu_vblank );
|
||||
|
@ -181,7 +172,6 @@ protected:
|
|||
void fpointbl_map(address_map &map);
|
||||
void fpointbl_sound_map(address_map &map);
|
||||
void lockonph_map(address_map &map);
|
||||
void dfjail_map(address_map &map);
|
||||
void lockonph_sound_iomap(address_map &map);
|
||||
void lockonph_sound_map(address_map &map);
|
||||
void map_fpointbla(address_map &map);
|
||||
|
@ -191,7 +181,6 @@ protected:
|
|||
void sound_portmap(address_map &map);
|
||||
void bootleg_sound_map(address_map &map);
|
||||
void bootleg_sound_portmap(address_map &map);
|
||||
void dfjail_sound_iomap(address_map &map);
|
||||
void system16b_bootleg_map(address_map &map);
|
||||
void system16b_map(address_map &map);
|
||||
void system16c_map(address_map &map);
|
||||
|
@ -252,7 +241,6 @@ protected:
|
|||
optional_device<ym2151_device> m_ym2151;
|
||||
optional_device<ym2413_device> m_ym2413;
|
||||
optional_device<upd7759_device> m_upd7759;
|
||||
optional_device<dac_word_interface> m_dac; // dfjail
|
||||
optional_device<sega_315_5248_multiplier_device> m_multiplier;
|
||||
optional_device<sega_315_5250_compare_timer_device> m_cmptimer_1;
|
||||
optional_device<sega_315_5250_compare_timer_device> m_cmptimer_2;
|
||||
|
@ -296,14 +284,43 @@ protected:
|
|||
output_finder<2> m_lamps;
|
||||
};
|
||||
|
||||
class dfjail_state : public segas16b_state
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
dfjail_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: segas16b_state(mconfig, type, tag)
|
||||
, m_nmi_enable(false)
|
||||
, m_dac_data(0)
|
||||
, m_dac(*this, "dac")
|
||||
{ }
|
||||
|
||||
void dfjail(machine_config &config);
|
||||
|
||||
protected:
|
||||
DECLARE_WRITE8_MEMBER( sound_control_w );
|
||||
DECLARE_WRITE8_MEMBER( dac_data_w );
|
||||
INTERRUPT_GEN_MEMBER( soundirq_cb );
|
||||
bool m_nmi_enable;
|
||||
uint16_t m_dac_data;
|
||||
|
||||
void dfjail_map(address_map &map);
|
||||
void dfjail_sound_iomap(address_map &map);
|
||||
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
|
||||
required_device<dac_word_interface> m_dac;
|
||||
};
|
||||
|
||||
class afighter_16b_analog_state : public segas16b_state
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
afighter_16b_analog_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: segas16b_state(mconfig, type, tag),
|
||||
m_accel(*this, "ACCEL"),
|
||||
m_steer(*this, "STEER")
|
||||
: segas16b_state(mconfig, type, tag)
|
||||
, m_accel(*this, "ACCEL")
|
||||
, m_steer(*this, "STEER")
|
||||
{ }
|
||||
|
||||
DECLARE_CUSTOM_INPUT_MEMBER(afighter_accel_r);
|
||||
|
@ -323,20 +340,20 @@ class isgsm_state : public segas16b_state
|
|||
public:
|
||||
// construction/destruction
|
||||
isgsm_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: segas16b_state(mconfig, type, tag),
|
||||
m_read_xor(0),
|
||||
m_cart_addrlatch(0),
|
||||
m_cart_addr(0),
|
||||
m_data_type(0),
|
||||
m_data_addr(0),
|
||||
m_data_mode(0),
|
||||
m_addr_latch(0),
|
||||
m_security_value(0),
|
||||
m_security_latch(0),
|
||||
m_rle_control_position(8),
|
||||
m_rle_control_byte(0),
|
||||
m_rle_latched(false),
|
||||
m_rle_byte(0)
|
||||
: segas16b_state(mconfig, type, tag)
|
||||
, m_read_xor(0)
|
||||
, m_cart_addrlatch(0)
|
||||
, m_cart_addr(0)
|
||||
, m_data_type(0)
|
||||
, m_data_addr(0)
|
||||
, m_data_mode(0)
|
||||
, m_addr_latch(0)
|
||||
, m_security_value(0)
|
||||
, m_security_latch(0)
|
||||
, m_rle_control_position(8)
|
||||
, m_rle_control_byte(0)
|
||||
, m_rle_latched(false)
|
||||
, m_rle_byte(0)
|
||||
{ }
|
||||
|
||||
void isgsm(machine_config &config);
|
||||
|
@ -367,6 +384,7 @@ private:
|
|||
uint32_t tetrbx_security(uint32_t input);
|
||||
|
||||
// driver overrides
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
|
||||
// configuration
|
||||
|
|
Loading…
Reference in a new issue