Few minor cleanups.

This commit is contained in:
Aaron Giles 2013-01-19 22:27:56 +00:00
parent 2f37c1c0e3
commit 06e19f7d51
15 changed files with 305 additions and 366 deletions

View File

@ -5,26 +5,19 @@
****************************************************************************/ ****************************************************************************/
#include "emu.h" #include "emu.h"
#include "sound/dac.h"
#include "sound/2151intf.h" #include "sound/2151intf.h"
#include "machine/atarigen.h" #include "machine/atarigen.h"
#include "includes/cyberbal.h" #include "includes/cyberbal.h"
static void update_sound_68k_interrupts(running_machine &machine); void cyberbal_state::cyberbal_sound_reset()
void cyberbal_sound_reset(running_machine &machine)
{ {
cyberbal_state *state = machine.driver_data<cyberbal_state>();
/* reset the sound system */ /* reset the sound system */
state->m_bank_base = &state->memregion("audiocpu")->base()[0x10000]; m_bank_base = &memregion("audiocpu")->base()[0x10000];
state->membank("soundbank")->set_base(&state->m_bank_base[0x0000]); membank("soundbank")->set_base(&m_bank_base[0x0000]);
state->m_fast_68k_int = state->m_io_68k_int = 0; m_fast_68k_int = m_io_68k_int = 0;
state->m_sound_data_from_68k = state->m_sound_data_from_6502 = 0; m_sound_data_from_68k = m_sound_data_from_6502 = 0;
state->m_sound_data_from_68k_ready = state->m_sound_data_from_6502_ready = 0; m_sound_data_from_68k_ready = m_sound_data_from_6502_ready = 0;
} }
@ -35,7 +28,7 @@ void cyberbal_sound_reset(running_machine &machine)
* *
*************************************/ *************************************/
READ8_MEMBER(cyberbal_state::cyberbal_special_port3_r) READ8_MEMBER(cyberbal_state::special_port3_r)
{ {
int temp = ioport("JSAII")->read(); int temp = ioport("JSAII")->read();
if (!(ioport("IN0")->read() & 0x8000)) temp ^= 0x80; if (!(ioport("IN0")->read() & 0x8000)) temp ^= 0x80;
@ -45,7 +38,7 @@ READ8_MEMBER(cyberbal_state::cyberbal_special_port3_r)
} }
READ8_MEMBER(cyberbal_state::cyberbal_sound_6502_stat_r) READ8_MEMBER(cyberbal_state::sound_6502_stat_r)
{ {
int temp = 0xff; int temp = 0xff;
if (m_sound_data_from_6502_ready) temp ^= 0x80; if (m_sound_data_from_6502_ready) temp ^= 0x80;
@ -54,24 +47,24 @@ READ8_MEMBER(cyberbal_state::cyberbal_sound_6502_stat_r)
} }
WRITE8_MEMBER(cyberbal_state::cyberbal_sound_bank_select_w) WRITE8_MEMBER(cyberbal_state::sound_bank_select_w)
{ {
membank("soundbank")->set_base(&m_bank_base[0x1000 * ((data >> 6) & 3)]); membank("soundbank")->set_base(&m_bank_base[0x1000 * ((data >> 6) & 3)]);
coin_counter_w(machine(), 1, (data >> 5) & 1); coin_counter_w(machine(), 1, (data >> 5) & 1);
coin_counter_w(machine(), 0, (data >> 4) & 1); coin_counter_w(machine(), 0, (data >> 4) & 1);
machine().device("dac")->execute().set_input_line(INPUT_LINE_RESET, (data & 0x08) ? CLEAR_LINE : ASSERT_LINE); m_daccpu->set_input_line(INPUT_LINE_RESET, (data & 0x08) ? CLEAR_LINE : ASSERT_LINE);
if (!(data & 0x01)) machine().device("ymsnd")->reset(); if (!(data & 0x01)) machine().device("ymsnd")->reset();
} }
READ8_MEMBER(cyberbal_state::cyberbal_sound_68k_6502_r) READ8_MEMBER(cyberbal_state::sound_68k_6502_r)
{ {
m_sound_data_from_68k_ready = 0; m_sound_data_from_68k_ready = 0;
return m_sound_data_from_68k; return m_sound_data_from_68k;
} }
WRITE8_MEMBER(cyberbal_state::cyberbal_sound_68k_6502_w) WRITE8_MEMBER(cyberbal_state::sound_68k_6502_w)
{ {
m_sound_data_from_6502 = data; m_sound_data_from_6502 = data;
m_sound_data_from_6502_ready = 1; m_sound_data_from_6502_ready = 1;
@ -79,7 +72,7 @@ WRITE8_MEMBER(cyberbal_state::cyberbal_sound_68k_6502_w)
if (!m_io_68k_int) if (!m_io_68k_int)
{ {
m_io_68k_int = 1; m_io_68k_int = 1;
update_sound_68k_interrupts(machine()); update_sound_68k_interrupts();
} }
} }
@ -91,35 +84,34 @@ WRITE8_MEMBER(cyberbal_state::cyberbal_sound_68k_6502_w)
* *
*************************************/ *************************************/
static void update_sound_68k_interrupts(running_machine &machine) void cyberbal_state::update_sound_68k_interrupts()
{ {
cyberbal_state *state = machine.driver_data<cyberbal_state>(); m_daccpu->set_input_line(6, m_fast_68k_int ? ASSERT_LINE : CLEAR_LINE);
machine.device("dac")->execute().set_input_line(6, state->m_fast_68k_int ? ASSERT_LINE : CLEAR_LINE); m_daccpu->set_input_line(2, m_io_68k_int ? ASSERT_LINE : CLEAR_LINE);
machine.device("dac")->execute().set_input_line(2, state->m_io_68k_int ? ASSERT_LINE : CLEAR_LINE);
} }
INTERRUPT_GEN_MEMBER(cyberbal_state::cyberbal_sound_68k_irq_gen) INTERRUPT_GEN_MEMBER(cyberbal_state::sound_68k_irq_gen)
{ {
if (!m_fast_68k_int) if (!m_fast_68k_int)
{ {
m_fast_68k_int = 1; m_fast_68k_int = 1;
update_sound_68k_interrupts(machine()); update_sound_68k_interrupts();
} }
} }
WRITE16_MEMBER(cyberbal_state::cyberbal_io_68k_irq_ack_w) WRITE16_MEMBER(cyberbal_state::io_68k_irq_ack_w)
{ {
if (m_io_68k_int) if (m_io_68k_int)
{ {
m_io_68k_int = 0; m_io_68k_int = 0;
update_sound_68k_interrupts(machine()); update_sound_68k_interrupts();
} }
} }
READ16_MEMBER(cyberbal_state::cyberbal_sound_68k_r) READ16_MEMBER(cyberbal_state::sound_68k_r)
{ {
int temp = (m_sound_data_from_6502 << 8) | 0xff; int temp = (m_sound_data_from_6502 << 8) | 0xff;
@ -131,7 +123,7 @@ READ16_MEMBER(cyberbal_state::cyberbal_sound_68k_r)
} }
WRITE16_MEMBER(cyberbal_state::cyberbal_sound_68k_w) WRITE16_MEMBER(cyberbal_state::sound_68k_w)
{ {
if (ACCESSING_BITS_8_15) if (ACCESSING_BITS_8_15)
{ {
@ -141,14 +133,14 @@ WRITE16_MEMBER(cyberbal_state::cyberbal_sound_68k_w)
} }
WRITE16_MEMBER(cyberbal_state::cyberbal_sound_68k_dac_w) WRITE16_MEMBER(cyberbal_state::sound_68k_dac_w)
{ {
dac_device *dac = machine().device<dac_device>((offset & 8) ? "dac2" : "dac1"); dac_device *dac = (offset & 8) ? m_dac2 : m_dac1;
dac->write_unsigned16((((data >> 3) & 0x800) | ((data >> 2) & 0x7ff)) << 4); dac->write_unsigned16((((data >> 3) & 0x800) | ((data >> 2) & 0x7ff)) << 4);
if (m_fast_68k_int) if (m_fast_68k_int)
{ {
m_fast_68k_int = 0; m_fast_68k_int = 0;
update_sound_68k_interrupts(machine()); update_sound_68k_interrupts();
} }
} }

View File

@ -19,7 +19,6 @@
#include "emu.h" #include "emu.h"
#include "cpu/m68000/m68000.h"
#include "audio/atarijsa.h" #include "audio/atarijsa.h"
#include "video/atarirle.h" #include "video/atarirle.h"
#include "includes/atarig1.h" #include "includes/atarig1.h"
@ -34,8 +33,8 @@
void atarig1_state::update_interrupts() void atarig1_state::update_interrupts()
{ {
machine().device("maincpu")->execute().set_input_line(1, m_video_int_state ? ASSERT_LINE : CLEAR_LINE); m_maincpu->set_input_line(1, m_video_int_state ? ASSERT_LINE : CLEAR_LINE);
machine().device("maincpu")->execute().set_input_line(2, m_sound_int_state ? ASSERT_LINE : CLEAR_LINE); m_maincpu->set_input_line(2, m_sound_int_state ? ASSERT_LINE : CLEAR_LINE);
} }
@ -139,12 +138,14 @@ void atarig1_state::update_bank(int bank)
} }
static void pitfightb_state_postload(running_machine &machine) void atarig1_state::device_post_load()
{ {
atarig1_state *state = machine.driver_data<atarig1_state>(); if (m_bslapstic_base != NULL)
int bank = state->m_bslapstic_bank; {
state->m_bslapstic_bank = -1; int bank = m_bslapstic_bank;
state->update_bank(bank); m_bslapstic_bank = -1;
update_bank(bank);
}
} }
@ -157,37 +158,35 @@ READ16_MEMBER(atarig1_state::pitfightb_cheap_slapstic_r)
/* offset 0 primes the chip */ /* offset 0 primes the chip */
if (offset == 0) if (offset == 0)
m_bslapstic_primed = TRUE; m_bslapstic_primed = true;
/* one of 4 bankswitchers produces the result */ /* one of 4 bankswitchers produces the result */
else if (m_bslapstic_primed) else if (m_bslapstic_primed)
{ {
if (offset == 0x42) if (offset == 0x42)
update_bank(0), m_bslapstic_primed = FALSE; update_bank(0), m_bslapstic_primed = false;
else if (offset == 0x52) else if (offset == 0x52)
update_bank(1), m_bslapstic_primed = FALSE; update_bank(1), m_bslapstic_primed = false;
else if (offset == 0x62) else if (offset == 0x62)
update_bank(2), m_bslapstic_primed = FALSE; update_bank(2), m_bslapstic_primed = false;
else if (offset == 0x72) else if (offset == 0x72)
update_bank(3), m_bslapstic_primed = FALSE; update_bank(3), m_bslapstic_primed = false;
} }
return result; return result;
} }
static void pitfightb_cheap_slapstic_init(running_machine &machine) void atarig1_state::pitfightb_cheap_slapstic_init()
{ {
atarig1_state *state = machine.driver_data<atarig1_state>();
/* install a read handler */ /* install a read handler */
state->m_bslapstic_base = machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x038000, 0x03ffff, read16_delegate(FUNC(atarig1_state::pitfightb_cheap_slapstic_r),state)); m_bslapstic_base = m_maincpu->space(AS_PROGRAM).install_read_handler(0x038000, 0x03ffff, read16_delegate(FUNC(atarig1_state::pitfightb_cheap_slapstic_r),this));
/* allocate memory for a copy of bank 0 */ /* allocate memory for a copy of bank 0 */
state->m_bslapstic_bank0 = auto_alloc_array(machine, UINT8, 0x2000); m_bslapstic_bank0 = auto_alloc_array(machine(), UINT8, 0x2000);
memcpy(state->m_bslapstic_bank0, state->m_bslapstic_base, 0x2000); memcpy(m_bslapstic_bank0, m_bslapstic_base, 0x2000);
/* not primed by default */ /* not primed by default */
state->m_bslapstic_primed = FALSE; m_bslapstic_primed = false;
} }
@ -1205,33 +1204,30 @@ ROM_END
* *
*************************************/ *************************************/
static void init_g1_common(running_machine &machine, offs_t slapstic_base, int slapstic, int is_pitfight) void atarig1_state::init_common(offs_t slapstic_base, int slapstic, bool is_pitfight)
{ {
atarig1_state *state = machine.driver_data<atarig1_state>(); m_eeprom_default = NULL;
state->m_eeprom_default = NULL;
if (slapstic == -1) if (slapstic == -1)
{ {
pitfightb_cheap_slapstic_init(machine); pitfightb_cheap_slapstic_init();
state->save_item(NAME(state->m_bslapstic_bank)); save_item(NAME(m_bslapstic_bank));
state->save_item(NAME(state->m_bslapstic_primed)); save_item(NAME(m_bslapstic_primed));
machine.save().register_postload(save_prepost_delegate(FUNC(pitfightb_state_postload), &machine));
} }
else if (slapstic != 0) else if (slapstic != 0)
state->slapstic_configure(*machine.device<cpu_device>("maincpu"), slapstic_base, 0, slapstic); slapstic_configure(*m_maincpu, slapstic_base, 0, slapstic);
atarijsa_init(machine, "IN0", 0x4000); atarijsa_init(machine(), "IN0", 0x4000);
state->m_is_pitfight = is_pitfight; m_is_pitfight = is_pitfight;
} }
DRIVER_INIT_MEMBER(atarig1_state,hydra) { init_g1_common(machine(), 0x078000, 116, 0); } DRIVER_INIT_MEMBER(atarig1_state,hydra) { init_common(0x078000, 116, 0); }
DRIVER_INIT_MEMBER(atarig1_state,hydrap) { init_g1_common(machine(), 0x000000, 0, 0); } DRIVER_INIT_MEMBER(atarig1_state,hydrap) { init_common(0x000000, 0, 0); }
DRIVER_INIT_MEMBER(atarig1_state,pitfight9) { init_g1_common(machine(), 0x038000, 114, 1); } DRIVER_INIT_MEMBER(atarig1_state,pitfight9) { init_common(0x038000, 114, 1); }
DRIVER_INIT_MEMBER(atarig1_state,pitfight7) { init_g1_common(machine(), 0x038000, 112, 1); } DRIVER_INIT_MEMBER(atarig1_state,pitfight7) { init_common(0x038000, 112, 1); }
DRIVER_INIT_MEMBER(atarig1_state,pitfight) { init_g1_common(machine(), 0x038000, 111, 1); } DRIVER_INIT_MEMBER(atarig1_state,pitfight) { init_common(0x038000, 111, 1); }
DRIVER_INIT_MEMBER(atarig1_state,pitfightj) { init_g1_common(machine(), 0x038000, 113, 1); } DRIVER_INIT_MEMBER(atarig1_state,pitfightj) { init_common(0x038000, 113, 1); }
DRIVER_INIT_MEMBER(atarig1_state,pitfightb) { init_g1_common(machine(), 0x038000, -1, 1); } DRIVER_INIT_MEMBER(atarig1_state,pitfightb) { init_common(0x038000, -1, 1); }
/************************************* /*************************************

View File

@ -18,7 +18,6 @@
***************************************************************************/ ***************************************************************************/
#include "emu.h" #include "emu.h"
#include "cpu/m68000/m68000.h"
#include "machine/asic65.h" #include "machine/asic65.h"
#include "audio/atarijsa.h" #include "audio/atarijsa.h"
#include "video/atarirle.h" #include "video/atarirle.h"
@ -33,8 +32,8 @@
void atarig42_state::update_interrupts() void atarig42_state::update_interrupts()
{ {
machine().device("maincpu")->execute().set_input_line(4, m_video_int_state ? ASSERT_LINE : CLEAR_LINE); m_maincpu->set_input_line(4, m_video_int_state ? ASSERT_LINE : CLEAR_LINE);
machine().device("maincpu")->execute().set_input_line(5, m_sound_int_state ? ASSERT_LINE : CLEAR_LINE); m_maincpu->set_input_line(5, m_sound_int_state ? ASSERT_LINE : CLEAR_LINE);
} }
@ -782,7 +781,7 @@ DRIVER_INIT_MEMBER(atarig42_state,roadriot)
m_playfield_base = 0x400; m_playfield_base = 0x400;
address_space &main = machine().device<m68000_device>("maincpu")->space(AS_PROGRAM); address_space &main = m_maincpu->space(AS_PROGRAM);
m_sloop_base = main.install_readwrite_handler(0x000000, 0x07ffff, read16_delegate(FUNC(atarig42_state::roadriot_sloop_data_r),this), write16_delegate(FUNC(atarig42_state::roadriot_sloop_data_w),this)); m_sloop_base = main.install_readwrite_handler(0x000000, 0x07ffff, read16_delegate(FUNC(atarig42_state::roadriot_sloop_data_r),this), write16_delegate(FUNC(atarig42_state::roadriot_sloop_data_w),this));
main.set_direct_update_handler(direct_update_delegate(FUNC(atarig42_state::atarig42_sloop_direct_handler), this)); main.set_direct_update_handler(direct_update_delegate(FUNC(atarig42_state::atarig42_sloop_direct_handler), this));
@ -820,7 +819,7 @@ DRIVER_INIT_MEMBER(atarig42_state,guardian)
/* put an RTS there so we don't die */ /* put an RTS there so we don't die */
*(UINT16 *)&memregion("maincpu")->base()[0x80000] = 0x4E75; *(UINT16 *)&memregion("maincpu")->base()[0x80000] = 0x4E75;
address_space &main = machine().device<m68000_device>("maincpu")->space(AS_PROGRAM); address_space &main = m_maincpu->space(AS_PROGRAM);
m_sloop_base = main.install_readwrite_handler(0x000000, 0x07ffff, read16_delegate(FUNC(atarig42_state::guardians_sloop_data_r),this), write16_delegate(FUNC(atarig42_state::guardians_sloop_data_w),this)); m_sloop_base = main.install_readwrite_handler(0x000000, 0x07ffff, read16_delegate(FUNC(atarig42_state::guardians_sloop_data_r),this), write16_delegate(FUNC(atarig42_state::guardians_sloop_data_w),this));
main.set_direct_update_handler(direct_update_delegate(FUNC(atarig42_state::atarig42_sloop_direct_handler), this)); main.set_direct_update_handler(direct_update_delegate(FUNC(atarig42_state::atarig42_sloop_direct_handler), this));

View File

@ -138,10 +138,10 @@ READ32_MEMBER(atarigt_state::special_port3_r)
} }
#if (HACK_TMEK_CONTROLS) inline void atarigt_state::compute_fake_pots(int *pots)
INLINE void compute_fake_pots(int *pots)
{ {
int fake = machine.root_device().ioport("FAKE")->read(); #if (HACK_TMEK_CONTROLS)
int fake = ioport("FAKE")->read();
pots[0] = pots[1] = pots[2] = pots[3] = 0x80; pots[0] = pots[1] = pots[2] = pots[3] = 0x80;
@ -167,8 +167,8 @@ INLINE void compute_fake_pots(int *pots)
pots[1] = 0xff, pots[3] = 0x00; pots[1] = 0xff, pots[3] = 0x00;
else if (fake & 0x08) /* right only */ else if (fake & 0x08) /* right only */
pots[3] = 0xff, pots[1] = 0x00; pots[3] = 0xff, pots[1] = 0x00;
}
#endif #endif
}
READ32_MEMBER(atarigt_state::analog_port0_r) READ32_MEMBER(atarigt_state::analog_port0_r)
@ -282,21 +282,17 @@ WRITE32_MEMBER(atarigt_state::sound_data_w)
static void tmek_update_mode(atarigt_state *state, offs_t offset) void atarigt_state::tmek_update_mode(offs_t offset)
{ {
int i;
/* pop us into the readseq */ /* pop us into the readseq */
for (i = 0; i < ADDRSEQ_COUNT - 1; i++) for (int i = 0; i < ADDRSEQ_COUNT - 1; i++)
state->m_protaddr[i] = state->m_protaddr[i + 1]; m_protaddr[i] = m_protaddr[i + 1];
state->m_protaddr[ADDRSEQ_COUNT - 1] = offset; m_protaddr[ADDRSEQ_COUNT - 1] = offset;
} }
static void tmek_protection_w(address_space &space, offs_t offset, UINT16 data) void atarigt_state::tmek_protection_w(address_space &space, offs_t offset, UINT16 data)
{ {
atarigt_state *state = space.machine().driver_data<atarigt_state>();
/* /*
T-Mek init: T-Mek init:
($387C0) = $0001 ($387C0) = $0001
@ -308,23 +304,22 @@ static void tmek_protection_w(address_space &space, offs_t offset, UINT16 data)
if (LOG_PROTECTION) logerror("%06X:Protection W@%06X = %04X\n", space.device().safe_pcbase(), offset, data); if (LOG_PROTECTION) logerror("%06X:Protection W@%06X = %04X\n", space.device().safe_pcbase(), offset, data);
/* track accesses */ /* track accesses */
tmek_update_mode(state, offset); tmek_update_mode(offset);
switch (offset) switch (offset)
{ {
case 0xdb0000: case 0xdb0000:
state->m_ignore_writes = (data == 0x18); m_ignore_writes = (data == 0x18);
break; break;
} }
} }
static void tmek_protection_r(address_space &space, offs_t offset, UINT16 *data) void atarigt_state::tmek_protection_r(address_space &space, offs_t offset, UINT16 *data)
{ {
atarigt_state *state = space.machine().driver_data<atarigt_state>();
if (LOG_PROTECTION) logerror("%06X:Protection R@%06X\n", space.device().safe_pcbase(), offset); if (LOG_PROTECTION) logerror("%06X:Protection R@%06X\n", space.device().safe_pcbase(), offset);
/* track accesses */ /* track accesses */
tmek_update_mode(state, offset); tmek_update_mode(offset);
/* handle specific reads */ /* handle specific reads */
switch (offset) switch (offset)
@ -348,46 +343,43 @@ static void tmek_protection_r(address_space &space, offs_t offset, UINT16 *data)
* *
*************************************/ *************************************/
static void primage_update_mode(atarigt_state *state, offs_t offset) void atarigt_state::primrage_update_mode(offs_t offset)
{ {
int i;
/* pop us into the readseq */ /* pop us into the readseq */
for (i = 0; i < ADDRSEQ_COUNT - 1; i++) for (int i = 0; i < ADDRSEQ_COUNT - 1; i++)
state->m_protaddr[i] = state->m_protaddr[i + 1]; m_protaddr[i] = m_protaddr[i + 1];
state->m_protaddr[ADDRSEQ_COUNT - 1] = offset; m_protaddr[ADDRSEQ_COUNT - 1] = offset;
/* check for particular sequences */ /* check for particular sequences */
if (!state->m_protmode) if (!m_protmode)
{ {
/* this is from the code at $20f90 */ /* this is from the code at $20f90 */
if (state->m_protaddr[1] == 0xdcc7c4 && state->m_protaddr[2] == 0xdcc7c4 && state->m_protaddr[3] == 0xdc4010) if (m_protaddr[1] == 0xdcc7c4 && m_protaddr[2] == 0xdcc7c4 && m_protaddr[3] == 0xdc4010)
{ {
if (LOG_PROTECTION) logerror("prot:Entering mode 1\n"); if (LOG_PROTECTION) logerror("prot:Entering mode 1\n");
state->m_protmode = 1; m_protmode = 1;
} }
/* this is from the code at $27592 */ /* this is from the code at $27592 */
if (state->m_protaddr[0] == 0xdcc7ca && state->m_protaddr[1] == 0xdcc7ca && state->m_protaddr[2] == 0xdcc7c6 && state->m_protaddr[3] == 0xdc4022) if (m_protaddr[0] == 0xdcc7ca && m_protaddr[1] == 0xdcc7ca && m_protaddr[2] == 0xdcc7c6 && m_protaddr[3] == 0xdc4022)
{ {
if (LOG_PROTECTION) logerror("prot:Entering mode 2\n"); if (LOG_PROTECTION) logerror("prot:Entering mode 2\n");
state->m_protmode = 2; m_protmode = 2;
} }
/* this is from the code at $3d8dc */ /* this is from the code at $3d8dc */
if (state->m_protaddr[0] == 0xdcc7c0 && state->m_protaddr[1] == 0xdcc7c0 && state->m_protaddr[2] == 0xdc80f2 && state->m_protaddr[3] == 0xdc7af2) if (m_protaddr[0] == 0xdcc7c0 && m_protaddr[1] == 0xdcc7c0 && m_protaddr[2] == 0xdc80f2 && m_protaddr[3] == 0xdc7af2)
{ {
if (LOG_PROTECTION) logerror("prot:Entering mode 3\n"); if (LOG_PROTECTION) logerror("prot:Entering mode 3\n");
state->m_protmode = 3; m_protmode = 3;
} }
} }
} }
static void primrage_protection_w(address_space &space, offs_t offset, UINT16 data) void atarigt_state::primrage_protection_w(address_space &space, offs_t offset, UINT16 data)
{ {
atarigt_state *state = space.machine().driver_data<atarigt_state>();
if (LOG_PROTECTION) if (LOG_PROTECTION)
{ {
UINT32 pc = space.device().safe_pcbase(); UINT32 pc = space.device().safe_pcbase();
@ -431,36 +423,35 @@ static void primrage_protection_w(address_space &space, offs_t offset, UINT16 da
/* mask = 0x78fff */ /* mask = 0x78fff */
/* track accesses */ /* track accesses */
primage_update_mode(state, offset); primrage_update_mode(offset);
/* check for certain read sequences */ /* check for certain read sequences */
if (state->m_protmode == 1 && offset >= 0xdc7800 && offset < 0xdc7800 + sizeof(state->m_protdata) * 2) if (m_protmode == 1 && offset >= 0xdc7800 && offset < 0xdc7800 + sizeof(m_protdata) * 2)
state->m_protdata[(offset - 0xdc7800) / 2] = data; m_protdata[(offset - 0xdc7800) / 2] = data;
if (state->m_protmode == 2) if (m_protmode == 2)
{ {
int temp = (offset - 0xdc7800) / 2; int temp = (offset - 0xdc7800) / 2;
if (LOG_PROTECTION) logerror("prot:mode 2 param = %04X\n", temp); if (LOG_PROTECTION) logerror("prot:mode 2 param = %04X\n", temp);
state->m_protresult = temp * 0x6915 + 0x6915; m_protresult = temp * 0x6915 + 0x6915;
} }
if (state->m_protmode == 3) if (m_protmode == 3)
{ {
if (offset == 0xdc4700) if (offset == 0xdc4700)
{ {
if (LOG_PROTECTION) logerror("prot:Clearing mode 3\n"); if (LOG_PROTECTION) logerror("prot:Clearing mode 3\n");
state->m_protmode = 0; m_protmode = 0;
} }
} }
} }
static void primrage_protection_r(address_space &space, offs_t offset, UINT16 *data) void atarigt_state::primrage_protection_r(address_space &space, offs_t offset, UINT16 *data)
{ {
atarigt_state *state = space.machine().driver_data<atarigt_state>();
/* track accesses */ /* track accesses */
primage_update_mode(state, offset); primrage_update_mode(offset);
if (LOG_PROTECTION) if (LOG_PROTECTION)
{ {
@ -537,7 +528,7 @@ if (LOG_PROTECTION)
{ {
/* status register; the code spins on this waiting for the high bit to be set */ /* status register; the code spins on this waiting for the high bit to be set */
case 0xdc4700: case 0xdc4700:
// if (state->m_protmode != 0) // if (m_protmode != 0)
{ {
*data = 0x8000; *data = 0x8000;
} }
@ -545,18 +536,18 @@ if (LOG_PROTECTION)
/* some kind of result register */ /* some kind of result register */
case 0xdcc7c2: case 0xdcc7c2:
if (state->m_protmode == 2) if (m_protmode == 2)
{ {
*data = state->m_protresult; *data = m_protresult;
state->m_protmode = 0; m_protmode = 0;
if (LOG_PROTECTION) logerror("prot:Clearing mode 2\n"); if (LOG_PROTECTION) logerror("prot:Clearing mode 2\n");
} }
break; break;
case 0xdcc7c4: case 0xdcc7c4:
if (state->m_protmode == 1) if (m_protmode == 1)
{ {
state->m_protmode = 0; m_protmode = 0;
if (LOG_PROTECTION) logerror("prot:Clearing mode 1\n"); if (LOG_PROTECTION) logerror("prot:Clearing mode 1\n");
} }
break; break;
@ -580,13 +571,13 @@ READ32_MEMBER(atarigt_state::colorram_protection_r)
if (ACCESSING_BITS_16_31) if (ACCESSING_BITS_16_31)
{ {
result = atarigt_colorram_r(address); result = atarigt_colorram_r(address);
(*m_protection_r)(space, address, &result); (this->*m_protection_r)(space, address, &result);
result32 |= result << 16; result32 |= result << 16;
} }
if (ACCESSING_BITS_0_15) if (ACCESSING_BITS_0_15)
{ {
result = atarigt_colorram_r(address + 2); result = atarigt_colorram_r(address + 2);
(*m_protection_r)(space, address + 2, &result); (this->*m_protection_r)(space, address + 2, &result);
result32 |= result; result32 |= result;
} }
@ -602,13 +593,13 @@ WRITE32_MEMBER(atarigt_state::colorram_protection_w)
{ {
if (!m_ignore_writes) if (!m_ignore_writes)
atarigt_colorram_w(address, data >> 16, mem_mask >> 16); atarigt_colorram_w(address, data >> 16, mem_mask >> 16);
(*m_protection_w)(space, address, data >> 16); (this->*m_protection_w)(space, address, data >> 16);
} }
if (ACCESSING_BITS_0_15) if (ACCESSING_BITS_0_15)
{ {
if (!m_ignore_writes) if (!m_ignore_writes)
atarigt_colorram_w(address + 2, data, mem_mask); atarigt_colorram_w(address + 2, data, mem_mask);
(*m_protection_w)(space, address + 2, data); (this->*m_protection_w)(space, address + 2, data);
} }
} }
@ -1320,31 +1311,29 @@ DRIVER_INIT_MEMBER(atarigt_state,tmek)
cage_set_irq_handler(cage_irq_callback); cage_set_irq_handler(cage_irq_callback);
/* setup protection */ /* setup protection */
m_protection_r = tmek_protection_r; m_protection_r = &atarigt_state::tmek_protection_r;
m_protection_w = tmek_protection_w; m_protection_w = &atarigt_state::tmek_protection_w;
/* temp hack */ /* temp hack */
machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xd72000, 0xd75fff, write32_delegate(FUNC(atarigt_state::tmek_pf_w),this)); machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xd72000, 0xd75fff, write32_delegate(FUNC(atarigt_state::tmek_pf_w),this));
} }
static void primrage_init_common(running_machine &machine, offs_t cage_speedup) void atarigt_state::primrage_init_common(offs_t cage_speedup)
{ {
atarigt_state *state = machine.driver_data<atarigt_state>(); m_eeprom_default = NULL;
m_is_primrage = 1;
state->m_eeprom_default = NULL; cage_init(machine(), cage_speedup);
state->m_is_primrage = 1;
cage_init(machine, cage_speedup);
cage_set_irq_handler(cage_irq_callback); cage_set_irq_handler(cage_irq_callback);
/* install protection */ /* install protection */
state->m_protection_r = primrage_protection_r; m_protection_r = &atarigt_state::primrage_protection_r;
state->m_protection_w = primrage_protection_w; m_protection_w = &atarigt_state::primrage_protection_w;
} }
DRIVER_INIT_MEMBER(atarigt_state,primrage) { primrage_init_common(machine(), 0x42f2); } DRIVER_INIT_MEMBER(atarigt_state,primrage) { primrage_init_common(0x42f2); }
DRIVER_INIT_MEMBER(atarigt_state,primrage20) { primrage_init_common(machine(), 0x48a4); } DRIVER_INIT_MEMBER(atarigt_state,primrage20) { primrage_init_common(0x48a4); }
/************************************* /*************************************
* *

View File

@ -124,8 +124,6 @@
#include "emu.h" #include "emu.h"
#include "cpu/m6502/m6502.h"
#include "cpu/t11/t11.h"
#include "includes/slapstic.h" #include "includes/slapstic.h"
#include "includes/atarisy2.h" #include "includes/atarisy2.h"
#include "sound/tms5220.h" #include "sound/tms5220.h"
@ -139,16 +137,6 @@
/*************************************
*
* Prototypes
*
*************************************/
static void bankselect_postload(running_machine &machine);
/************************************* /*************************************
* *
* Interrupt updating * Interrupt updating
@ -158,24 +146,24 @@ static void bankselect_postload(running_machine &machine);
void atarisy2_state::update_interrupts() void atarisy2_state::update_interrupts()
{ {
if (m_video_int_state) if (m_video_int_state)
machine().device("maincpu")->execute().set_input_line(3, ASSERT_LINE); m_maincpu->set_input_line(3, ASSERT_LINE);
else else
machine().device("maincpu")->execute().set_input_line(3, CLEAR_LINE); m_maincpu->set_input_line(3, CLEAR_LINE);
if (m_scanline_int_state) if (m_scanline_int_state)
machine().device("maincpu")->execute().set_input_line(2, ASSERT_LINE); m_maincpu->set_input_line(2, ASSERT_LINE);
else else
machine().device("maincpu")->execute().set_input_line(2, CLEAR_LINE); m_maincpu->set_input_line(2, CLEAR_LINE);
if (m_p2portwr_state) if (m_p2portwr_state)
machine().device("maincpu")->execute().set_input_line(1, ASSERT_LINE); m_maincpu->set_input_line(1, ASSERT_LINE);
else else
machine().device("maincpu")->execute().set_input_line(1, CLEAR_LINE); m_maincpu->set_input_line(1, CLEAR_LINE);
if (m_p2portrd_state) if (m_p2portrd_state)
machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE); m_maincpu->set_input_line(0, ASSERT_LINE);
else else
machine().device("maincpu")->execute().set_input_line(0, CLEAR_LINE); m_maincpu->set_input_line(0, CLEAR_LINE);
} }
@ -193,7 +181,7 @@ void atarisy2_state::scanline_update(screen_device &screen, int scanline)
/* generate the 32V interrupt (IRQ 2) */ /* generate the 32V interrupt (IRQ 2) */
if ((scanline % 64) == 0) if ((scanline % 64) == 0)
if (m_interrupt_enable & 4) if (m_interrupt_enable & 4)
scanline_int_gen(*subdevice("maincpu")); scanline_int_gen(*m_maincpu);
} }
} }
@ -225,7 +213,6 @@ MACHINE_START_MEMBER(atarisy2_state,atarisy2)
save_item(NAME(m_which_adc)); save_item(NAME(m_which_adc));
save_item(NAME(m_p2portwr_state)); save_item(NAME(m_p2portwr_state));
save_item(NAME(m_p2portrd_state)); save_item(NAME(m_p2portrd_state));
machine().save().register_postload(save_prepost_delegate(FUNC(bankselect_postload), &machine()));
save_item(NAME(m_sound_reset_state)); save_item(NAME(m_sound_reset_state));
} }
@ -236,8 +223,7 @@ MACHINE_RESET_MEMBER(atarisy2_state,atarisy2)
slapstic_reset(); slapstic_reset();
scanline_timer_reset(*machine().primary_screen, 64); scanline_timer_reset(*machine().primary_screen, 64);
address_space &main = machine().device<t11_device>("maincpu")->space(AS_PROGRAM); m_maincpu->space(AS_PROGRAM).set_direct_update_handler(direct_update_delegate(FUNC(atarisy2_state::atarisy2_direct_handler), this));
main.set_direct_update_handler(direct_update_delegate(FUNC(atarisy2_state::atarisy2_direct_handler), this));
m_p2portwr_state = 0; m_p2portwr_state = 0;
m_p2portrd_state = 0; m_p2portrd_state = 0;
@ -273,7 +259,7 @@ WRITE16_MEMBER(atarisy2_state::int1_ack_w)
{ {
/* reset sound CPU */ /* reset sound CPU */
if (ACCESSING_BITS_0_7) if (ACCESSING_BITS_0_7)
machine().device("audiocpu")->execute().set_input_line(INPUT_LINE_RESET, (data & 1) ? ASSERT_LINE : CLEAR_LINE); m_audiocpu->set_input_line(INPUT_LINE_RESET, (data & 1) ? ASSERT_LINE : CLEAR_LINE);
} }
@ -325,18 +311,18 @@ WRITE16_MEMBER(atarisy2_state::bankselect_w)
COMBINE_DATA(&newword); COMBINE_DATA(&newword);
m_bankselect[offset] = newword; m_bankselect[offset] = newword;
base = &machine().root_device().memregion("maincpu")->base()[bankoffset[(newword >> 10) & 0x3f]]; base = &memregion("maincpu")->base()[bankoffset[(newword >> 10) & 0x3f]];
memcpy(offset ? m_rombank2 : m_rombank1, base, 0x2000); memcpy(offset ? m_rombank2 : m_rombank1, base, 0x2000);
} }
static void bankselect_postload(running_machine &machine) void atarisy2_state::device_post_load()
{ {
address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); atarigen_state::device_post_load();
atarisy2_state *state = machine.driver_data<atarisy2_state>();
state->bankselect_w(space, 0, state->m_bankselect[0], 0xffff); address_space &space = m_maincpu->space(AS_PROGRAM);
state->bankselect_w(space, 1, state->m_bankselect[1], 0xffff); bankselect_w(space, 0, m_bankselect[0], 0xffff);
bankselect_w(space, 1, m_bankselect[1], 0xffff);
} }
@ -785,7 +771,7 @@ WRITE8_MEMBER(atarisy2_state::coincount_w)
/* full memory map derived from schematics */ /* full memory map derived from schematics */
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, atarisy2_state ) static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, atarisy2_state )
AM_RANGE(0x0000, 0x0fff) AM_RAM AM_RANGE(0x0000, 0x0fff) AM_RAM
AM_RANGE(0x1000, 0x11ff) AM_MIRROR(0x0200) AM_RAM_WRITE_LEGACY(atarisy2_paletteram_w) AM_SHARE("paletteram") AM_RANGE(0x1000, 0x11ff) AM_MIRROR(0x0200) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram")
AM_RANGE(0x1400, 0x1403) AM_MIRROR(0x007c) AM_READWRITE(adc_r, bankselect_w) AM_SHARE("bankselect") AM_RANGE(0x1400, 0x1403) AM_MIRROR(0x007c) AM_READWRITE(adc_r, bankselect_w) AM_SHARE("bankselect")
AM_RANGE(0x1480, 0x1487) AM_MIRROR(0x0078) AM_WRITE(adc_strobe_w) AM_RANGE(0x1480, 0x1487) AM_MIRROR(0x0078) AM_WRITE(adc_strobe_w)
AM_RANGE(0x1580, 0x1581) AM_MIRROR(0x001e) AM_WRITE(int0_ack_w) AM_RANGE(0x1580, 0x1581) AM_MIRROR(0x001e) AM_WRITE(int0_ack_w)
@ -794,14 +780,14 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, atarisy2_state )
AM_RANGE(0x15e0, 0x15e1) AM_MIRROR(0x001e) AM_WRITE(video_int_ack_w) AM_RANGE(0x15e0, 0x15e1) AM_MIRROR(0x001e) AM_WRITE(video_int_ack_w)
AM_RANGE(0x1600, 0x1601) AM_MIRROR(0x007e) AM_WRITE(int_enable_w) AM_RANGE(0x1600, 0x1601) AM_MIRROR(0x007e) AM_WRITE(int_enable_w)
AM_RANGE(0x1680, 0x1681) AM_MIRROR(0x007e) AM_WRITE8(sound_w, 0x00ff) AM_RANGE(0x1680, 0x1681) AM_MIRROR(0x007e) AM_WRITE8(sound_w, 0x00ff)
AM_RANGE(0x1700, 0x1701) AM_MIRROR(0x007e) AM_WRITE_LEGACY(atarisy2_xscroll_w) AM_SHARE("xscroll") AM_RANGE(0x1700, 0x1701) AM_MIRROR(0x007e) AM_WRITE(xscroll_w) AM_SHARE("xscroll")
AM_RANGE(0x1780, 0x1781) AM_MIRROR(0x007e) AM_WRITE_LEGACY(atarisy2_yscroll_w) AM_SHARE("yscroll") AM_RANGE(0x1780, 0x1781) AM_MIRROR(0x007e) AM_WRITE(yscroll_w) AM_SHARE("yscroll")
AM_RANGE(0x1800, 0x1801) AM_MIRROR(0x03fe) AM_READ(switch_r) AM_WRITE(watchdog_reset16_w) AM_RANGE(0x1800, 0x1801) AM_MIRROR(0x03fe) AM_READ(switch_r) AM_WRITE(watchdog_reset16_w)
AM_RANGE(0x1c00, 0x1c01) AM_MIRROR(0x03fe) AM_READ(sound_r) AM_RANGE(0x1c00, 0x1c01) AM_MIRROR(0x03fe) AM_READ(sound_r)
AM_RANGE(0x2000, 0x3fff) AM_READWRITE_LEGACY(atarisy2_videoram_r, atarisy2_videoram_w) AM_RANGE(0x2000, 0x3fff) AM_READWRITE(videoram_r, videoram_w)
AM_RANGE(0x4000, 0x5fff) AM_ROM AM_SHARE("rombank1") AM_RANGE(0x4000, 0x5fff) AM_ROM AM_SHARE("rombank1")
AM_RANGE(0x6000, 0x7fff) AM_ROM AM_SHARE("rombank2") AM_RANGE(0x6000, 0x7fff) AM_ROM AM_SHARE("rombank2")
AM_RANGE(0x8000, 0x81ff) AM_READWRITE_LEGACY(atarisy2_slapstic_r, atarisy2_slapstic_w) AM_SHARE("slapstic_base") AM_RANGE(0x8000, 0x81ff) AM_READWRITE(slapstic_r, slapstic_w) AM_SHARE("slapstic_base")
AM_RANGE(0x8000, 0xffff) AM_ROM AM_RANGE(0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END ADDRESS_MAP_END

View File

@ -20,10 +20,7 @@
#include "emu.h" #include "emu.h"
#include "cpu/m68000/m68000.h"
#include "cpu/m6502/m6502.h"
#include "sound/2151intf.h" #include "sound/2151intf.h"
#include "sound/dac.h"
#include "rendlay.h" #include "rendlay.h"
#include "audio/atarijsa.h" #include "audio/atarijsa.h"
#include "video/atarimo.h" #include "video/atarimo.h"
@ -38,15 +35,15 @@
void cyberbal_state::update_interrupts() void cyberbal_state::update_interrupts()
{ {
if (subdevice("extra") != NULL) if (m_extracpu != NULL)
{ {
subdevice("maincpu")->execute().set_input_line(1, m_sound_int_state ? ASSERT_LINE : CLEAR_LINE); m_maincpu->set_input_line(1, m_sound_int_state ? ASSERT_LINE : CLEAR_LINE);
subdevice("extra")->execute().set_input_line(1, m_video_int_state ? ASSERT_LINE : CLEAR_LINE); m_extracpu->set_input_line(1, m_video_int_state ? ASSERT_LINE : CLEAR_LINE);
} }
else else
{ {
subdevice("maincpu")->execute().set_input_line(1, m_video_int_state ? ASSERT_LINE : CLEAR_LINE); m_maincpu->set_input_line(1, m_video_int_state ? ASSERT_LINE : CLEAR_LINE);
subdevice("maincpu")->execute().set_input_line(3, m_sound_int_state ? ASSERT_LINE : CLEAR_LINE); m_maincpu->set_input_line(3, m_sound_int_state ? ASSERT_LINE : CLEAR_LINE);
} }
} }
@ -69,10 +66,10 @@ MACHINE_RESET_MEMBER(cyberbal_state,cyberbal)
atarigen_state::machine_reset(); atarigen_state::machine_reset();
scanline_timer_reset(*machine().primary_screen, 8); scanline_timer_reset(*machine().primary_screen, 8);
cyberbal_sound_reset(machine()); cyberbal_sound_reset();
/* Extra CPU (second M68k) doesn't run until reset */ /* Extra CPU (second M68k) doesn't run until reset */
machine().device("extra")->execute().set_input_line(INPUT_LINE_RESET, ASSERT_LINE); m_extracpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
} }
@ -124,7 +121,7 @@ READ16_MEMBER(cyberbal_state::sound_state_r)
WRITE16_MEMBER(cyberbal_state::p2_reset_w) WRITE16_MEMBER(cyberbal_state::p2_reset_w)
{ {
machine().device("extra")->execute().set_input_line(INPUT_LINE_RESET, CLEAR_LINE); m_extracpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
} }
@ -146,8 +143,8 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, cyberbal_state )
AM_RANGE(0xfd8000, 0xfd9fff) AM_WRITE8(sound_w, 0xff00) AM_RANGE(0xfd8000, 0xfd9fff) AM_WRITE8(sound_w, 0xff00)
AM_RANGE(0xfe0000, 0xfe0fff) AM_READ(special_port0_r) AM_RANGE(0xfe0000, 0xfe0fff) AM_READ(special_port0_r)
AM_RANGE(0xfe1000, 0xfe1fff) AM_READ_PORT("IN1") AM_RANGE(0xfe1000, 0xfe1fff) AM_READ_PORT("IN1")
AM_RANGE(0xfe8000, 0xfe8fff) AM_RAM_WRITE_LEGACY(cyberbal_paletteram_1_w) AM_SHARE("paletteram_1") AM_RANGE(0xfe8000, 0xfe8fff) AM_RAM_WRITE(paletteram_1_w) AM_SHARE("paletteram_1")
AM_RANGE(0xfec000, 0xfecfff) AM_RAM_WRITE_LEGACY(cyberbal_paletteram_0_w) AM_SHARE("paletteram_0") AM_RANGE(0xfec000, 0xfecfff) AM_RAM_WRITE(paletteram_0_w) AM_SHARE("paletteram_0")
AM_RANGE(0xff0000, 0xff1fff) AM_RAM_WRITE(playfield2_w) AM_SHARE("playfield2") AM_RANGE(0xff0000, 0xff1fff) AM_RAM_WRITE(playfield2_w) AM_SHARE("playfield2")
AM_RANGE(0xff2000, 0xff2fff) AM_RAM_WRITE(alpha2_w) AM_SHARE("alpha2") AM_RANGE(0xff2000, 0xff2fff) AM_RAM_WRITE(alpha2_w) AM_SHARE("alpha2")
AM_RANGE(0xff3000, 0xff37ff) AM_READWRITE_LEGACY(atarimo_1_spriteram_r, atarimo_1_spriteram_w) AM_RANGE(0xff3000, 0xff37ff) AM_READWRITE_LEGACY(atarimo_1_spriteram_r, atarimo_1_spriteram_w)
@ -173,8 +170,8 @@ static ADDRESS_MAP_START( extra_map, AS_PROGRAM, 16, cyberbal_state )
AM_RANGE(0xfc0000, 0xfdffff) AM_WRITE(video_int_ack_w) AM_RANGE(0xfc0000, 0xfdffff) AM_WRITE(video_int_ack_w)
AM_RANGE(0xfe0000, 0xfe0fff) AM_READ(special_port0_r) AM_RANGE(0xfe0000, 0xfe0fff) AM_READ(special_port0_r)
AM_RANGE(0xfe1000, 0xfe1fff) AM_READ_PORT("IN1") AM_RANGE(0xfe1000, 0xfe1fff) AM_READ_PORT("IN1")
AM_RANGE(0xfe8000, 0xfe8fff) AM_RAM_WRITE_LEGACY(cyberbal_paletteram_1_w) AM_SHARE("paletteram_1") AM_RANGE(0xfe8000, 0xfe8fff) AM_RAM_WRITE(paletteram_1_w) AM_SHARE("paletteram_1")
AM_RANGE(0xfec000, 0xfecfff) AM_RAM_WRITE_LEGACY(cyberbal_paletteram_0_w) AM_SHARE("paletteram_0") AM_RANGE(0xfec000, 0xfecfff) AM_RAM_WRITE(paletteram_0_w) AM_SHARE("paletteram_0")
AM_RANGE(0xff0000, 0xff1fff) AM_RAM_WRITE(playfield2_w) AM_SHARE("playfield2") AM_RANGE(0xff0000, 0xff1fff) AM_RAM_WRITE(playfield2_w) AM_SHARE("playfield2")
AM_RANGE(0xff2000, 0xff2fff) AM_RAM_WRITE(alpha2_w) AM_SHARE("alpha2") AM_RANGE(0xff2000, 0xff2fff) AM_RAM_WRITE(alpha2_w) AM_SHARE("alpha2")
AM_RANGE(0xff3000, 0xff37ff) AM_READWRITE_LEGACY(atarimo_1_spriteram_r, atarimo_1_spriteram_w) AM_RANGE(0xff3000, 0xff37ff) AM_READWRITE_LEGACY(atarimo_1_spriteram_r, atarimo_1_spriteram_w)
@ -198,14 +195,14 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, cyberbal_state ) static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, cyberbal_state )
AM_RANGE(0x0000, 0x1fff) AM_RAM AM_RANGE(0x0000, 0x1fff) AM_RAM
AM_RANGE(0x2000, 0x2001) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write) AM_RANGE(0x2000, 0x2001) AM_DEVREADWRITE("ymsnd", ym2151_device, read, write)
AM_RANGE(0x2800, 0x2801) AM_WRITE(cyberbal_sound_68k_6502_w) AM_RANGE(0x2800, 0x2801) AM_WRITE(sound_68k_6502_w)
AM_RANGE(0x2802, 0x2803) AM_READWRITE(m6502_irq_ack_r, m6502_irq_ack_w) AM_RANGE(0x2802, 0x2803) AM_READWRITE(m6502_irq_ack_r, m6502_irq_ack_w)
AM_RANGE(0x2804, 0x2805) AM_WRITE(m6502_sound_w) AM_RANGE(0x2804, 0x2805) AM_WRITE(m6502_sound_w)
AM_RANGE(0x2806, 0x2807) AM_WRITE(cyberbal_sound_bank_select_w) AM_RANGE(0x2806, 0x2807) AM_WRITE(sound_bank_select_w)
AM_RANGE(0x2c00, 0x2c01) AM_READ(m6502_sound_r) AM_RANGE(0x2c00, 0x2c01) AM_READ(m6502_sound_r)
AM_RANGE(0x2c02, 0x2c03) AM_READ(cyberbal_special_port3_r) AM_RANGE(0x2c02, 0x2c03) AM_READ(special_port3_r)
AM_RANGE(0x2c04, 0x2c05) AM_READ(cyberbal_sound_68k_6502_r) AM_RANGE(0x2c04, 0x2c05) AM_READ(sound_68k_6502_r)
AM_RANGE(0x2c06, 0x2c07) AM_READ(cyberbal_sound_6502_stat_r) AM_RANGE(0x2c06, 0x2c07) AM_READ(sound_6502_stat_r)
AM_RANGE(0x3000, 0x3fff) AM_ROMBANK("soundbank") AM_RANGE(0x3000, 0x3fff) AM_ROMBANK("soundbank")
AM_RANGE(0x4000, 0xffff) AM_ROM AM_RANGE(0x4000, 0xffff) AM_ROM
ADDRESS_MAP_END ADDRESS_MAP_END
@ -220,10 +217,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( sound_68k_map, AS_PROGRAM, 16, cyberbal_state ) static ADDRESS_MAP_START( sound_68k_map, AS_PROGRAM, 16, cyberbal_state )
AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_RANGE(0x000000, 0x03ffff) AM_ROM
AM_RANGE(0xff8000, 0xff87ff) AM_READ(cyberbal_sound_68k_r) AM_RANGE(0xff8000, 0xff87ff) AM_READ(sound_68k_r)
AM_RANGE(0xff8800, 0xff8fff) AM_WRITE(cyberbal_sound_68k_w) AM_RANGE(0xff8800, 0xff8fff) AM_WRITE(sound_68k_w)
AM_RANGE(0xff9000, 0xff97ff) AM_WRITE(cyberbal_io_68k_irq_ack_w) AM_RANGE(0xff9000, 0xff97ff) AM_WRITE(io_68k_irq_ack_w)
AM_RANGE(0xff9800, 0xff9fff) AM_WRITE(cyberbal_sound_68k_dac_w) AM_RANGE(0xff9800, 0xff9fff) AM_WRITE(sound_68k_dac_w)
AM_RANGE(0xfff000, 0xffffff) AM_RAM AM_RANGE(0xfff000, 0xffffff) AM_RAM
ADDRESS_MAP_END ADDRESS_MAP_END
@ -420,7 +417,7 @@ static MACHINE_CONFIG_START( cyberbal, cyberbal_state )
MCFG_CPU_ADD("dac", M68000, ATARI_CLOCK_14MHz/2) MCFG_CPU_ADD("dac", M68000, ATARI_CLOCK_14MHz/2)
MCFG_CPU_PROGRAM_MAP(sound_68k_map) MCFG_CPU_PROGRAM_MAP(sound_68k_map)
MCFG_CPU_PERIODIC_INT_DRIVER(cyberbal_state, cyberbal_sound_68k_irq_gen, 10000) MCFG_CPU_PERIODIC_INT_DRIVER(cyberbal_state, sound_68k_irq_gen, 10000)
MCFG_QUANTUM_TIME(attotime::from_hz(600)) MCFG_QUANTUM_TIME(attotime::from_hz(600))
@ -981,13 +978,13 @@ ROM_END
DRIVER_INIT_MEMBER(cyberbal_state,cyberbal) DRIVER_INIT_MEMBER(cyberbal_state,cyberbal)
{ {
slapstic_configure(*machine().device<cpu_device>("maincpu"), 0x018000, 0, 0); slapstic_configure(*m_maincpu, 0x018000, 0, 0);
} }
DRIVER_INIT_MEMBER(cyberbal_state,cyberbalt) DRIVER_INIT_MEMBER(cyberbal_state,cyberbalt)
{ {
slapstic_configure(*machine().device<cpu_device>("maincpu"), 0x018000, 0, 116); slapstic_configure(*m_maincpu, 0x018000, 0, 116);
} }

View File

@ -5,15 +5,19 @@
*************************************************************************/ *************************************************************************/
#include "machine/atarigen.h" #include "machine/atarigen.h"
#include "cpu/m68000/m68000.h"
class atarig1_state : public atarigen_state class atarig1_state : public atarigen_state
{ {
public: public:
atarig1_state(const machine_config &mconfig, device_type type, const char *tag) atarig1_state(const machine_config &mconfig, device_type type, const char *tag)
: atarigen_state(mconfig, type, tag), : atarigen_state(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_mo_command(*this, "mo_command") { } m_mo_command(*this, "mo_command") { }
UINT8 m_is_pitfight; required_device<m68000_device> m_maincpu;
bool m_is_pitfight;
UINT8 m_which_input; UINT8 m_which_input;
required_shared_ptr<UINT16> m_mo_command; required_shared_ptr<UINT16> m_mo_command;
@ -21,7 +25,7 @@ public:
UINT16 * m_bslapstic_base; UINT16 * m_bslapstic_base;
void * m_bslapstic_bank0; void * m_bslapstic_bank0;
UINT8 m_bslapstic_bank; UINT8 m_bslapstic_bank;
UINT8 m_bslapstic_primed; bool m_bslapstic_primed;
int m_pfscroll_xoffset; int m_pfscroll_xoffset;
UINT16 m_current_control; UINT16 m_current_control;
@ -30,6 +34,7 @@ public:
UINT16 m_playfield_yscroll; UINT16 m_playfield_yscroll;
device_t * m_rle; device_t * m_rle;
virtual void device_post_load();
virtual void update_interrupts(); virtual void update_interrupts();
virtual void scanline_update(screen_device &screen, int scanline); virtual void scanline_update(screen_device &screen, int scanline);
DECLARE_WRITE16_MEMBER(mo_control_w); DECLARE_WRITE16_MEMBER(mo_control_w);
@ -53,7 +58,7 @@ public:
DECLARE_VIDEO_START(atarig1); DECLARE_VIDEO_START(atarig1);
UINT32 screen_update_atarig1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_atarig1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void screen_eof_atarig1(screen_device &screen, bool state); void screen_eof_atarig1(screen_device &screen, bool state);
private:
void init_common(offs_t slapstic_base, int slapstic, bool is_pitfight);
void pitfightb_cheap_slapstic_init();
}; };
/*----------- defined in video/atarig1.c -----------*/
void atarig1_scanline_update(screen_device &screen, int scanline);

View File

@ -5,14 +5,18 @@
*************************************************************************/ *************************************************************************/
#include "machine/atarigen.h" #include "machine/atarigen.h"
#include "cpu/m68000/m68000.h"
class atarig42_state : public atarigen_state class atarig42_state : public atarigen_state
{ {
public: public:
atarig42_state(const machine_config &mconfig, device_type type, const char *tag) atarig42_state(const machine_config &mconfig, device_type type, const char *tag)
: atarigen_state(mconfig, type, tag), : atarigen_state(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_mo_command(*this, "mo_command") { } m_mo_command(*this, "mo_command") { }
required_device<m68000_device> m_maincpu;
UINT16 m_playfield_base; UINT16 m_playfield_base;
UINT16 m_current_control; UINT16 m_current_control;
@ -57,7 +61,3 @@ public:
UINT32 screen_update_atarig42(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_atarig42(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void screen_eof_atarig42(screen_device &screen, bool state); void screen_eof_atarig42(screen_device &screen, bool state);
}; };
/*----------- defined in video/atarig42.c -----------*/
DECLARE_WRITE16_HANDLER( atarig42_mo_control_w );
void atarig42_scanline_update(screen_device &screen, int scanline);

View File

@ -38,10 +38,10 @@ public:
required_shared_ptr<UINT32> m_mo_command; required_shared_ptr<UINT32> m_mo_command;
void (*m_protection_w)(address_space &space, offs_t offset, UINT16 data); void (atarigt_state::*m_protection_w)(address_space &space, offs_t offset, UINT16 data);
void (*m_protection_r)(address_space &space, offs_t offset, UINT16 *data); void (atarigt_state::*m_protection_r)(address_space &space, offs_t offset, UINT16 *data);
UINT8 m_ignore_writes; bool m_ignore_writes;
offs_t m_protaddr[ADDRSEQ_COUNT]; offs_t m_protaddr[ADDRSEQ_COUNT];
UINT8 m_protmode; UINT8 m_protmode;
UINT16 m_protresult; UINT16 m_protresult;
@ -75,7 +75,13 @@ public:
DECLARE_VIDEO_START(atarigt); DECLARE_VIDEO_START(atarigt);
UINT32 screen_update_atarigt(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); UINT32 screen_update_atarigt(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void screen_eof_atarigt(screen_device &screen, bool state); void screen_eof_atarigt(screen_device &screen, bool state);
private:
void tmek_update_mode(offs_t offset);
void tmek_protection_w(address_space &space, offs_t offset, UINT16 data);
void tmek_protection_r(address_space &space, offs_t offset, UINT16 *data);
void primrage_update_mode(offs_t offset);
void primrage_protection_w(address_space &space, offs_t offset, UINT16 data);
void primrage_protection_r(address_space &space, offs_t offset, UINT16 *data);
void primrage_init_common(offs_t cage_speedup);
void compute_fake_pots(int *pots);
}; };
/*----------- defined in video/atarigt.c -----------*/
void atarigt_scanline_update(screen_device &screen, int scanline);

View File

@ -5,17 +5,23 @@
*************************************************************************/ *************************************************************************/
#include "machine/atarigen.h" #include "machine/atarigen.h"
#include "cpu/m6502/m6502.h"
#include "cpu/t11/t11.h"
class atarisy2_state : public atarigen_state class atarisy2_state : public atarigen_state
{ {
public: public:
atarisy2_state(const machine_config &mconfig, device_type type, const char *tag) atarisy2_state(const machine_config &mconfig, device_type type, const char *tag)
: atarigen_state(mconfig, type, tag), : atarigen_state(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_slapstic_base(*this, "slapstic_base"), m_slapstic_base(*this, "slapstic_base"),
m_bankselect(*this, "bankselect"), m_bankselect(*this, "bankselect"),
m_rombank1(*this, "rombank1"), m_rombank1(*this, "rombank1"),
m_rombank2(*this, "rombank2") { } m_rombank2(*this, "rombank2") { }
required_device<t11_device> m_maincpu;
required_device<m6502_device> m_audiocpu;
required_shared_ptr<UINT16> m_slapstic_base; required_shared_ptr<UINT16> m_slapstic_base;
UINT8 m_interrupt_enable; UINT8 m_interrupt_enable;
@ -49,6 +55,9 @@ public:
UINT32 m_spin_center_count; UINT32 m_spin_center_count;
UINT16 m_vram[0x8000/2]; UINT16 m_vram[0x8000/2];
virtual void device_post_load();
virtual void update_interrupts(); virtual void update_interrupts();
virtual void scanline_update(screen_device &screen, int scanline); virtual void scanline_update(screen_device &screen, int scanline);
DECLARE_WRITE16_MEMBER(int0_ack_w); DECLARE_WRITE16_MEMBER(int0_ack_w);
@ -84,16 +93,11 @@ public:
INTERRUPT_GEN_MEMBER(vblank_int); INTERRUPT_GEN_MEMBER(vblank_int);
TIMER_CALLBACK_MEMBER(delayed_int_enable_w); TIMER_CALLBACK_MEMBER(delayed_int_enable_w);
TIMER_CALLBACK_MEMBER(reset_yscroll_callback); TIMER_CALLBACK_MEMBER(reset_yscroll_callback);
DECLARE_READ16_MEMBER(slapstic_r);
DECLARE_READ16_MEMBER(videoram_r);
DECLARE_WRITE16_MEMBER(slapstic_w);
DECLARE_WRITE16_MEMBER(yscroll_w);
DECLARE_WRITE16_MEMBER(xscroll_w);
DECLARE_WRITE16_MEMBER(videoram_w);
DECLARE_WRITE16_MEMBER(paletteram_w);
}; };
/*----------- defined in video/atarisy2.c -----------*/
DECLARE_READ16_HANDLER( atarisy2_slapstic_r );
DECLARE_READ16_HANDLER( atarisy2_videoram_r );
DECLARE_WRITE16_HANDLER( atarisy2_slapstic_w );
DECLARE_WRITE16_HANDLER( atarisy2_yscroll_w );
DECLARE_WRITE16_HANDLER( atarisy2_xscroll_w );
DECLARE_WRITE16_HANDLER( atarisy2_videoram_w );
DECLARE_WRITE16_HANDLER( atarisy2_paletteram_w );

View File

@ -5,15 +5,30 @@
*************************************************************************/ *************************************************************************/
#include "machine/atarigen.h" #include "machine/atarigen.h"
#include "cpu/m68000/m68000.h"
#include "cpu/m6502/m6502.h"
#include "sound/dac.h"
class cyberbal_state : public atarigen_state class cyberbal_state : public atarigen_state
{ {
public: public:
cyberbal_state(const machine_config &mconfig, device_type type, const char *tag) cyberbal_state(const machine_config &mconfig, device_type type, const char *tag)
: atarigen_state(mconfig, type, tag), : atarigen_state(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_extracpu(*this, "extra"),
m_daccpu(*this, "dac"),
m_dac1(*this, "dac1"),
m_dac2(*this, "dac2"),
m_paletteram_0(*this, "paletteram_0"), m_paletteram_0(*this, "paletteram_0"),
m_paletteram_1(*this, "paletteram_1") { } m_paletteram_1(*this, "paletteram_1") { }
required_device<m68000_device> m_maincpu;
optional_device<m6502_device> m_audiocpu;
optional_device<m68000_device> m_extracpu;
optional_device<m68000_device> m_daccpu;
optional_device<dac_device> m_dac1;
optional_device<dac_device> m_dac2;
optional_shared_ptr<UINT16> m_paletteram_0; optional_shared_ptr<UINT16> m_paletteram_0;
optional_shared_ptr<UINT16> m_paletteram_1; optional_shared_ptr<UINT16> m_paletteram_1;
UINT16 m_current_slip[2]; UINT16 m_current_slip[2];
@ -34,15 +49,15 @@ public:
DECLARE_READ16_MEMBER(special_port2_r); DECLARE_READ16_MEMBER(special_port2_r);
DECLARE_READ16_MEMBER(sound_state_r); DECLARE_READ16_MEMBER(sound_state_r);
DECLARE_WRITE16_MEMBER(p2_reset_w); DECLARE_WRITE16_MEMBER(p2_reset_w);
DECLARE_READ8_MEMBER(cyberbal_special_port3_r); DECLARE_READ8_MEMBER(special_port3_r);
DECLARE_READ8_MEMBER(cyberbal_sound_6502_stat_r); DECLARE_READ8_MEMBER(sound_6502_stat_r);
DECLARE_WRITE8_MEMBER(cyberbal_sound_bank_select_w); DECLARE_WRITE8_MEMBER(sound_bank_select_w);
DECLARE_READ8_MEMBER(cyberbal_sound_68k_6502_r); DECLARE_READ8_MEMBER(sound_68k_6502_r);
DECLARE_WRITE8_MEMBER(cyberbal_sound_68k_6502_w); DECLARE_WRITE8_MEMBER(sound_68k_6502_w);
DECLARE_WRITE16_MEMBER(cyberbal_io_68k_irq_ack_w); DECLARE_WRITE16_MEMBER(io_68k_irq_ack_w);
DECLARE_READ16_MEMBER(cyberbal_sound_68k_r); DECLARE_READ16_MEMBER(sound_68k_r);
DECLARE_WRITE16_MEMBER(cyberbal_sound_68k_w); DECLARE_WRITE16_MEMBER(sound_68k_w);
DECLARE_WRITE16_MEMBER(cyberbal_sound_68k_dac_w); DECLARE_WRITE16_MEMBER(sound_68k_dac_w);
DECLARE_DRIVER_INIT(cyberbalt); DECLARE_DRIVER_INIT(cyberbalt);
DECLARE_DRIVER_INIT(cyberbal2p); DECLARE_DRIVER_INIT(cyberbal2p);
DECLARE_DRIVER_INIT(cyberbal); DECLARE_DRIVER_INIT(cyberbal);
@ -58,18 +73,14 @@ public:
UINT32 screen_update_cyberbal_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_cyberbal_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_cyberbal_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_cyberbal_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_cyberbal2p(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_cyberbal2p(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(cyberbal_sound_68k_irq_gen); INTERRUPT_GEN_MEMBER(sound_68k_irq_gen);
DECLARE_READ16_MEMBER(paletteram_0_r);
DECLARE_READ16_MEMBER(paletteram_1_r);
DECLARE_WRITE16_MEMBER(paletteram_0_w);
DECLARE_WRITE16_MEMBER(paletteram_1_w);
private:
void video_start_common(int screens);
void cyberbal_sound_reset();
UINT32 update_one_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int index);
void update_sound_68k_interrupts();
}; };
/*----------- defined in audio/cyberbal.c -----------*/
void cyberbal_sound_reset(running_machine &machine);
/*----------- defined in video/cyberbal.c -----------*/
DECLARE_READ16_HANDLER( cyberbal_paletteram_0_r );
DECLARE_READ16_HANDLER( cyberbal_paletteram_1_r );
DECLARE_WRITE16_HANDLER( cyberbal_paletteram_0_w );
DECLARE_WRITE16_HANDLER( cyberbal_paletteram_1_w );
void cyberbal_scanline_update(screen_device &screen, int scanline);

View File

@ -75,17 +75,6 @@ VIDEO_START_MEMBER(atarig1_state,atarig1)
* *
*************************************/ *************************************/
WRITE16_HANDLER( atarig1_mo_control_w )
{
atarig1_state *state = space.machine().driver_data<atarig1_state>();
logerror("MOCONT = %d (scan = %d)\n", data, space.machine().primary_screen->vpos());
/* set the control value */
COMBINE_DATA(&state->m_current_control);
}
void atarig1_state::scanline_update(screen_device &screen, int scanline) void atarig1_state::scanline_update(screen_device &screen, int scanline)
{ {
UINT16 *base = &m_alpha[(scanline / 8) * 64 + 48]; UINT16 *base = &m_alpha[(scanline / 8) * 64 + 48];

View File

@ -96,17 +96,6 @@ VIDEO_START_MEMBER(atarig42_state,atarig42)
* *
*************************************/ *************************************/
WRITE16_HANDLER( atarig42_mo_control_w )
{
atarig42_state *state = space.machine().driver_data<atarig42_state>();
logerror("MOCONT = %d (scan = %d)\n", data, space.machine().primary_screen->vpos());
/* set the control value */
COMBINE_DATA(&state->m_current_control);
}
void atarig42_state::scanline_update(screen_device &screen, int scanline) void atarig42_state::scanline_update(screen_device &screen, int scanline)
{ {
UINT16 *base = &m_alpha[(scanline / 8) * 64 + 48]; UINT16 *base = &m_alpha[(scanline / 8) * 64 + 48];

View File

@ -11,16 +11,6 @@
/*************************************
*
* Prototypes
*
*************************************/
/************************************* /*************************************
* *
* Tilemap callbacks * Tilemap callbacks
@ -124,10 +114,9 @@ VIDEO_START_MEMBER(atarisy2_state,atarisy2)
* *
*************************************/ *************************************/
WRITE16_HANDLER( atarisy2_xscroll_w ) WRITE16_HANDLER( atarisy2_state::xscroll_w )
{ {
atarisy2_state *state = space.machine().driver_data<atarisy2_state>(); UINT16 oldscroll = *m_xscroll;
UINT16 oldscroll = *state->m_xscroll;
UINT16 newscroll = oldscroll; UINT16 newscroll = oldscroll;
COMBINE_DATA(&newscroll); COMBINE_DATA(&newscroll);
@ -136,17 +125,17 @@ WRITE16_HANDLER( atarisy2_xscroll_w )
space.machine().primary_screen->update_partial(space.machine().primary_screen->vpos()); space.machine().primary_screen->update_partial(space.machine().primary_screen->vpos());
/* update the playfield scrolling - hscroll is clocked on the following scanline */ /* update the playfield scrolling - hscroll is clocked on the following scanline */
state->m_playfield_tilemap->set_scrollx(0, newscroll >> 6); m_playfield_tilemap->set_scrollx(0, newscroll >> 6);
/* update the playfield banking */ /* update the playfield banking */
if (state->m_playfield_tile_bank[0] != (newscroll & 0x0f) * 0x400) if (m_playfield_tile_bank[0] != (newscroll & 0x0f) * 0x400)
{ {
state->m_playfield_tile_bank[0] = (newscroll & 0x0f) * 0x400; m_playfield_tile_bank[0] = (newscroll & 0x0f) * 0x400;
state->m_playfield_tilemap->mark_all_dirty(); m_playfield_tilemap->mark_all_dirty();
} }
/* update the data */ /* update the data */
*state->m_xscroll = newscroll; *m_xscroll = newscroll;
} }
@ -156,10 +145,9 @@ TIMER_CALLBACK_MEMBER(atarisy2_state::reset_yscroll_callback)
} }
WRITE16_HANDLER( atarisy2_yscroll_w ) WRITE16_HANDLER( atarisy2_state::yscroll_w )
{ {
atarisy2_state *state = space.machine().driver_data<atarisy2_state>(); UINT16 oldscroll = *m_yscroll;
UINT16 oldscroll = *state->m_yscroll;
UINT16 newscroll = oldscroll; UINT16 newscroll = oldscroll;
COMBINE_DATA(&newscroll); COMBINE_DATA(&newscroll);
@ -169,19 +157,19 @@ WRITE16_HANDLER( atarisy2_yscroll_w )
/* if bit 4 is zero, the scroll value is clocked in right away */ /* if bit 4 is zero, the scroll value is clocked in right away */
if (!(newscroll & 0x10)) if (!(newscroll & 0x10))
state->m_playfield_tilemap->set_scrolly(0, (newscroll >> 6) - space.machine().primary_screen->vpos()); m_playfield_tilemap->set_scrolly(0, (newscroll >> 6) - space.machine().primary_screen->vpos());
else else
state->m_yscroll_reset_timer->adjust(space.machine().primary_screen->time_until_pos(0), newscroll >> 6); m_yscroll_reset_timer->adjust(space.machine().primary_screen->time_until_pos(0), newscroll >> 6);
/* update the playfield banking */ /* update the playfield banking */
if (state->m_playfield_tile_bank[1] != (newscroll & 0x0f) * 0x400) if (m_playfield_tile_bank[1] != (newscroll & 0x0f) * 0x400)
{ {
state->m_playfield_tile_bank[1] = (newscroll & 0x0f) * 0x400; m_playfield_tile_bank[1] = (newscroll & 0x0f) * 0x400;
state->m_playfield_tilemap->mark_all_dirty(); m_playfield_tilemap->mark_all_dirty();
} }
/* update the data */ /* update the data */
*state->m_yscroll = newscroll; *m_yscroll = newscroll;
} }
@ -192,7 +180,7 @@ WRITE16_HANDLER( atarisy2_yscroll_w )
* *
*************************************/ *************************************/
WRITE16_HANDLER( atarisy2_paletteram_w ) WRITE16_HANDLER( atarisy2_state::paletteram_w )
{ {
static const int intensity_table[16] = static const int intensity_table[16] =
{ {
@ -209,9 +197,8 @@ WRITE16_HANDLER( atarisy2_paletteram_w )
int newword, inten, red, green, blue; int newword, inten, red, green, blue;
atarisy2_state *state = space.machine().driver_data<atarisy2_state>(); COMBINE_DATA(&m_generic_paletteram_16[offset]);
COMBINE_DATA(&state->m_generic_paletteram_16[offset]); newword = m_generic_paletteram_16[offset];
newword = state->m_generic_paletteram_16[offset];
inten = intensity_table[newword & 15]; inten = intensity_table[newword & 15];
red = (color_table[(newword >> 12) & 15] * inten) >> 4; red = (color_table[(newword >> 12) & 15] * inten) >> 4;
@ -228,26 +215,23 @@ WRITE16_HANDLER( atarisy2_paletteram_w )
* *
*************************************/ *************************************/
READ16_HANDLER( atarisy2_slapstic_r ) READ16_HANDLER( atarisy2_state::slapstic_r )
{ {
atarisy2_state *state = space.machine().driver_data<atarisy2_state>(); int result = m_slapstic_base[offset];
int result = state->m_slapstic_base[offset];
slapstic_tweak(space, offset); slapstic_tweak(space, offset);
/* an extra tweak for the next opcode fetch */ /* an extra tweak for the next opcode fetch */
state->m_videobank = slapstic_tweak(space, 0x1234) * 0x1000; m_videobank = slapstic_tweak(space, 0x1234) * 0x1000;
return result; return result;
} }
WRITE16_HANDLER( atarisy2_slapstic_w ) WRITE16_HANDLER( atarisy2_state::slapstic_w )
{ {
atarisy2_state *state = space.machine().driver_data<atarisy2_state>();
slapstic_tweak(space, offset); slapstic_tweak(space, offset);
/* an extra tweak for the next opcode fetch */ /* an extra tweak for the next opcode fetch */
state->m_videobank = slapstic_tweak(space, 0x1234) * 0x1000; m_videobank = slapstic_tweak(space, 0x1234) * 0x1000;
} }
@ -258,29 +242,27 @@ WRITE16_HANDLER( atarisy2_slapstic_w )
* *
*************************************/ *************************************/
READ16_HANDLER( atarisy2_videoram_r ) READ16_HANDLER( atarisy2_state::videoram_r )
{ {
atarisy2_state *state = space.machine().driver_data<atarisy2_state>(); int offs = offset | m_videobank;
int offs = offset | state->m_videobank;
if (offs >= 0xc00 && offs < 0x1000) if (offs >= 0xc00 && offs < 0x1000)
{ {
return atarimo_0_spriteram_r(space, offs - 0x0c00, mem_mask); return atarimo_0_spriteram_r(space, offs - 0x0c00, mem_mask);
} }
return state->m_vram[offs]; return m_vram[offs];
} }
WRITE16_HANDLER( atarisy2_videoram_w ) WRITE16_HANDLER( atarisy2_state::videoram_w )
{ {
atarisy2_state *state = space.machine().driver_data<atarisy2_state>(); int offs = offset | m_videobank;
int offs = offset | state->m_videobank;
/* alpharam? */ /* alpharam? */
if (offs < 0x0c00) if (offs < 0x0c00)
{ {
COMBINE_DATA(&state->m_alpha[offs]); COMBINE_DATA(&m_alpha[offs]);
state->m_alpha_tilemap->mark_tile_dirty(offs); m_alpha_tilemap->mark_tile_dirty(offs);
} }
/* spriteram? */ /* spriteram? */
@ -288,7 +270,7 @@ WRITE16_HANDLER( atarisy2_videoram_w )
{ {
/* force an update if the link of object 0 is about to change */ /* force an update if the link of object 0 is about to change */
if (offs == 0x0c03) if (offs == 0x0c03)
space.machine().primary_screen->update_partial(space.machine().primary_screen->vpos()); space.machine().primary_screen->update_partial(machine().primary_screen->vpos());
atarimo_0_spriteram_w(space, offs - 0x0c00, data, mem_mask); atarimo_0_spriteram_w(space, offs - 0x0c00, data, mem_mask);
} }
@ -296,14 +278,14 @@ WRITE16_HANDLER( atarisy2_videoram_w )
else if (offs >= 0x2000) else if (offs >= 0x2000)
{ {
offs -= 0x2000; offs -= 0x2000;
COMBINE_DATA(&state->m_playfield[offs]); COMBINE_DATA(&m_playfield[offs]);
state->m_playfield_tilemap->mark_tile_dirty(offs); m_playfield_tilemap->mark_tile_dirty(offs);
} }
/* generic case */ /* generic case */
else else
{ {
COMBINE_DATA(&state->m_vram[offs]); COMBINE_DATA(&m_vram[offs]);
} }
} }

View File

@ -63,7 +63,7 @@ TILE_GET_INFO_MEMBER(cyberbal_state::get_playfield2_tile_info)
* *
*************************************/ *************************************/
static void video_start_cyberbal_common(running_machine &machine, int screens) void cyberbal_state::video_start_common(int screens)
{ {
static const atarimo_desc mo0desc = static const atarimo_desc mo0desc =
{ {
@ -138,47 +138,46 @@ static void video_start_cyberbal_common(running_machine &machine, int screens)
0, /* resulting value to indicate "special" */ 0, /* resulting value to indicate "special" */
0 /* callback routine for special entries */ 0 /* callback routine for special entries */
}; };
cyberbal_state *state = machine.driver_data<cyberbal_state>();
/* initialize the playfield */ /* initialize the playfield */
state->m_playfield_tilemap = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(cyberbal_state::get_playfield_tile_info),state), TILEMAP_SCAN_ROWS, 16,8, 64,64); m_playfield_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(cyberbal_state::get_playfield_tile_info),this), TILEMAP_SCAN_ROWS, 16,8, 64,64);
/* initialize the motion objects */ /* initialize the motion objects */
atarimo_init(machine, 0, &mo0desc); atarimo_init(machine(), 0, &mo0desc);
atarimo_set_slipram(0, &state->m_current_slip[0]); atarimo_set_slipram(0, &m_current_slip[0]);
/* initialize the alphanumerics */ /* initialize the alphanumerics */
state->m_alpha_tilemap = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(cyberbal_state::get_alpha_tile_info),state), TILEMAP_SCAN_ROWS, 16,8, 64,32); m_alpha_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(cyberbal_state::get_alpha_tile_info),this), TILEMAP_SCAN_ROWS, 16,8, 64,32);
state->m_alpha_tilemap->set_transparent_pen(0); m_alpha_tilemap->set_transparent_pen(0);
/* allocate the second screen if necessary */ /* allocate the second screen if necessary */
if (screens == 2) if (screens == 2)
{ {
/* initialize the playfield */ /* initialize the playfield */
state->m_playfield2_tilemap = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(cyberbal_state::get_playfield2_tile_info),state), TILEMAP_SCAN_ROWS, 16,8, 64,64); m_playfield2_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(cyberbal_state::get_playfield2_tile_info),this), TILEMAP_SCAN_ROWS, 16,8, 64,64);
state->m_playfield2_tilemap->set_scrollx(0, 0); m_playfield2_tilemap->set_scrollx(0, 0);
/* initialize the motion objects */ /* initialize the motion objects */
atarimo_init(machine, 1, &mo1desc); atarimo_init(machine(), 1, &mo1desc);
atarimo_set_slipram(1, &state->m_current_slip[1]); atarimo_set_slipram(1, &m_current_slip[1]);
/* initialize the alphanumerics */ /* initialize the alphanumerics */
state->m_alpha2_tilemap = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(cyberbal_state::get_alpha2_tile_info),state), TILEMAP_SCAN_ROWS, 16,8, 64,32); m_alpha2_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(cyberbal_state::get_alpha2_tile_info),this), TILEMAP_SCAN_ROWS, 16,8, 64,32);
state->m_alpha2_tilemap->set_scrollx(0, 0); m_alpha2_tilemap->set_scrollx(0, 0);
state->m_alpha2_tilemap->set_transparent_pen(0); m_alpha2_tilemap->set_transparent_pen(0);
} }
/* save states */ /* save states */
state->save_item(NAME(state->m_current_slip)); save_item(NAME(m_current_slip));
state->save_item(NAME(state->m_playfield_palette_bank)); save_item(NAME(m_playfield_palette_bank));
state->save_item(NAME(state->m_playfield_xscroll)); save_item(NAME(m_playfield_xscroll));
state->save_item(NAME(state->m_playfield_yscroll)); save_item(NAME(m_playfield_yscroll));
} }
VIDEO_START_MEMBER(cyberbal_state,cyberbal) VIDEO_START_MEMBER(cyberbal_state,cyberbal)
{ {
video_start_cyberbal_common(machine(), 2); video_start_common(2);
/* adjust the sprite positions */ /* adjust the sprite positions */
atarimo_set_xscroll(0, 4); atarimo_set_xscroll(0, 4);
@ -188,7 +187,7 @@ VIDEO_START_MEMBER(cyberbal_state,cyberbal)
VIDEO_START_MEMBER(cyberbal_state,cyberbal2p) VIDEO_START_MEMBER(cyberbal_state,cyberbal2p)
{ {
video_start_cyberbal_common(machine(), 1); video_start_common(1);
/* adjust the sprite positions */ /* adjust the sprite positions */
atarimo_set_xscroll(0, 5); atarimo_set_xscroll(0, 5);
@ -221,31 +220,27 @@ INLINE void set_palette_entry(running_machine &machine, int entry, UINT16 value)
* *
*************************************/ *************************************/
WRITE16_HANDLER( cyberbal_paletteram_0_w ) WRITE16_HANDLER(cyberbal_state::paletteram_0_w)
{ {
cyberbal_state *state = space.machine().driver_data<cyberbal_state>(); COMBINE_DATA(&m_paletteram_0[offset]);
COMBINE_DATA(&state->m_paletteram_0[offset]); set_palette_entry(machine(), offset, m_paletteram_0[offset]);
set_palette_entry(space.machine(), offset, state->m_paletteram_0[offset]);
} }
READ16_HANDLER( cyberbal_paletteram_0_r ) READ16_HANDLER(cyberbal_state::paletteram_0_r)
{ {
cyberbal_state *state = space.machine().driver_data<cyberbal_state>(); return m_paletteram_0[offset];
return state->m_paletteram_0[offset];
} }
WRITE16_HANDLER( cyberbal_paletteram_1_w ) WRITE16_HANDLER(cyberbal_state::paletteram_1_w)
{ {
cyberbal_state *state = space.machine().driver_data<cyberbal_state>(); COMBINE_DATA(&m_paletteram_1[offset]);
COMBINE_DATA(&state->m_paletteram_1[offset]); set_palette_entry(machine(), offset + 0x800, m_paletteram_1[offset]);
set_palette_entry(space.machine(), offset + 0x800, state->m_paletteram_1[offset]);
} }
READ16_HANDLER( cyberbal_paletteram_1_r ) READ16_HANDLER(cyberbal_state::paletteram_1_r)
{ {
cyberbal_state *state = space.machine().driver_data<cyberbal_state>(); return m_paletteram_1[offset];
return state->m_paletteram_1[offset];
} }
@ -328,9 +323,8 @@ void cyberbal_state::scanline_update(screen_device &screen, int scanline)
* *
*************************************/ *************************************/
static UINT32 update_one_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int index) UINT32 cyberbal_state::update_one_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int index)
{ {
cyberbal_state *state = screen.machine().driver_data<cyberbal_state>();
atarimo_rect_list rectlist; atarimo_rect_list rectlist;
rectangle tempclip = cliprect; rectangle tempclip = cliprect;
bitmap_ind16 *mobitmap; bitmap_ind16 *mobitmap;
@ -338,7 +332,7 @@ static UINT32 update_one_screen(screen_device &screen, bitmap_ind16 &bitmap, con
rectangle visarea = screen.visible_area(); rectangle visarea = screen.visible_area();
/* draw the playfield */ /* draw the playfield */
((index == 0) ? state->m_playfield_tilemap : state->m_playfield2_tilemap)->draw(bitmap, cliprect, 0, 0); ((index == 0) ? m_playfield_tilemap : m_playfield2_tilemap)->draw(bitmap, cliprect, 0, 0);
/* draw the MOs -- note some kludging to get this to work correctly for 2 screens */ /* draw the MOs -- note some kludging to get this to work correctly for 2 screens */
mooffset = 0; mooffset = 0;
@ -371,7 +365,7 @@ static UINT32 update_one_screen(screen_device &screen, bitmap_ind16 &bitmap, con
} }
/* add the alpha on top */ /* add the alpha on top */
((index == 0) ? state->m_alpha_tilemap : state->m_alpha2_tilemap)->draw(bitmap, cliprect, 0, 0); ((index == 0) ? m_alpha_tilemap : m_alpha2_tilemap)->draw(bitmap, cliprect, 0, 0);
return 0; return 0;
} }