diff --git a/src/mame/drivers/arcadecl.cpp b/src/mame/drivers/arcadecl.cpp index 28153da28e3..1743cce3745 100644 --- a/src/mame/drivers/arcadecl.cpp +++ b/src/mame/drivers/arcadecl.cpp @@ -88,17 +88,17 @@ * *************************************/ -void sparkz_state::update_interrupts() +TIMER_DEVICE_CALLBACK_MEMBER(sparkz_state::scanline_interrupt) { - m_maincpu->set_input_line(4, m_scanline_int_state ? ASSERT_LINE : CLEAR_LINE); + /* generate 32V signals */ + if ((param & 32) == 0) + m_maincpu->set_input_line(M68K_IRQ_4, ASSERT_LINE); } -void sparkz_state::scanline_update(screen_device &screen, int scanline) +void sparkz_state::scanline_int_ack_w(uint16_t data) { - /* generate 32V signals */ - if ((scanline & 32) == 0) - scanline_int_write_line(1); + m_maincpu->set_input_line(M68K_IRQ_4, CLEAR_LINE); } @@ -111,8 +111,6 @@ void sparkz_state::scanline_update(screen_device &screen, int scanline) void sparkz_state::machine_reset() { - atarigen_state::machine_reset(); - scanline_timer_reset(*m_screen, 32); } @@ -123,7 +121,7 @@ void sparkz_state::machine_reset() * *************************************/ -WRITE16_MEMBER(sparkz_state::latch_w) +void sparkz_state::latch_w(uint8_t data) { /* bit layout in this register: @@ -131,12 +129,8 @@ WRITE16_MEMBER(sparkz_state::latch_w) 0x001F == volume */ - /* lower byte being modified? */ - if (ACCESSING_BITS_0_7) - { - m_oki->set_rom_bank((data >> 7) & 1); - m_oki->set_output_gain(ALL_OUTPUTS, (data & 0x001f) / 31.0f); - } + m_oki->set_rom_bank((data >> 7) & 1); + m_oki->set_output_gain(ALL_OUTPUTS, (data & 0x001f) / 31.0f); } @@ -163,11 +157,11 @@ void sparkz_state::main_map(address_map &map) map(0x640022, 0x640023).portr("TRACKY2"); map(0x640024, 0x640025).portr("TRACKX1"); map(0x640026, 0x640027).portr("TRACKY1"); - map(0x640040, 0x64004f).w(FUNC(sparkz_state::latch_w)); + map(0x640041, 0x640041).mirror(0xe).w(FUNC(sparkz_state::latch_w)); map(0x640060, 0x64006f).w("eeprom", FUNC(eeprom_parallel_28xx_device::unlock_write16)); map(0x641000, 0x641fff).rw("eeprom", FUNC(eeprom_parallel_28xx_device::read), FUNC(eeprom_parallel_28xx_device::write)).umask16(0x00ff); map(0x642000, 0x642000).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); - map(0x646000, 0x646fff).w(FUNC(sparkz_state::scanline_int_ack_w)); + map(0x646000, 0x646001).mirror(0xffe).w(FUNC(sparkz_state::scanline_int_ack_w)); map(0x647000, 0x647fff).w("watchdog", FUNC(watchdog_timer_device::reset16_w)); } @@ -326,6 +320,8 @@ void sparkz_state::sparkz(machine_config &config) M68000(config, m_maincpu, MASTER_CLOCK); m_maincpu->set_addrmap(AS_PROGRAM, &sparkz_state::main_map); + TIMER(config, "scantimer").configure_scanline(FUNC(sparkz_state::scanline_interrupt), m_screen, 0, 32); + EEPROM_2804(config, "eeprom").lock_after_write(true); WATCHDOG_TIMER(config, "watchdog"); @@ -343,7 +339,7 @@ void sparkz_state::sparkz(machine_config &config) m_screen->set_raw(MASTER_CLOCK/2, 456, 0+12, 336+12, 262, 0, 240); m_screen->set_screen_update(FUNC(sparkz_state::screen_update)); m_screen->set_palette("palette"); - m_screen->screen_vblank().set(FUNC(sparkz_state::video_int_write_line)); + //m_screen->screen_vblank().set(FUNC(sparkz_state::video_int_write_line)); /* sound hardware */ SPEAKER(config, "mono").front_center(); diff --git a/src/mame/drivers/eprom.cpp b/src/mame/drivers/eprom.cpp index 1d073519eea..6cc775ec517 100644 --- a/src/mame/drivers/eprom.cpp +++ b/src/mame/drivers/eprom.cpp @@ -41,23 +41,22 @@ * *************************************/ -void eprom_state::update_interrupts() +void eprom_state::video_int_ack_w(uint16_t data) { - m_maincpu->set_input_line(4, m_video_int_state ? ASSERT_LINE : CLEAR_LINE); + m_maincpu->set_input_line(M68K_IRQ_4, CLEAR_LINE); +} - if (m_extra.found()) - m_extra->set_input_line(4, m_video_int_state ? ASSERT_LINE : CLEAR_LINE); +void eprom_state::video_int_ack_extra_w(uint16_t data) +{ + m_extra->set_input_line(M68K_IRQ_4, CLEAR_LINE); } void eprom_state::machine_start() { - atarigen_state::machine_start(); } void eprom_state::machine_reset() { - atarigen_state::machine_reset(); - scanline_timer_reset(*m_screen, 8); m_share1[0xcc00/2] = 0; } @@ -69,7 +68,7 @@ void eprom_state::machine_reset() * *************************************/ -READ8_MEMBER(eprom_state::adc_r) +uint8_t eprom_state::adc_r(offs_t offset) { if (!m_adc.found()) return 0xff; @@ -88,9 +87,9 @@ READ8_MEMBER(eprom_state::adc_r) * *************************************/ -WRITE16_MEMBER(eprom_state::eprom_latch_w) +void eprom_state::eprom_latch_w(uint8_t data) { - if (ACCESSING_BITS_0_7 && (m_extra != nullptr)) + if (m_extra.found()) { /* bit 0: reset extra CPU */ if (data & 1) @@ -144,7 +143,7 @@ void eprom_state::main_map(address_map &map) map(0x260031, 0x260031).r(m_jsa, FUNC(atari_jsa_base_device::main_response_r)); map(0x2e0000, 0x2e0001).w("watchdog", FUNC(watchdog_timer_device::reset16_w)); map(0x360000, 0x360001).w(FUNC(eprom_state::video_int_ack_w)); - map(0x360010, 0x360011).w(FUNC(eprom_state::eprom_latch_w)); + map(0x360011, 0x360011).w(FUNC(eprom_state::eprom_latch_w)); map(0x360020, 0x360021).w(m_jsa, FUNC(atari_jsa_base_device::sound_reset_w)); map(0x360031, 0x360031).w(m_jsa, FUNC(atari_jsa_base_device::main_command_w)); map(0x3e0000, 0x3e0fff).ram().share("paletteram"); @@ -170,7 +169,7 @@ void eprom_state::guts_map(address_map &map) map(0x260031, 0x260031).r(m_jsa, FUNC(atari_jsa_ii_device::main_response_r)); map(0x2e0000, 0x2e0001).w("watchdog", FUNC(watchdog_timer_device::reset16_w)); map(0x360000, 0x360001).w(FUNC(eprom_state::video_int_ack_w)); -// map(0x360010, 0x360011).w(FUNC(eprom_state::eprom_latch_w)); +// map(0x360011, 0x360011).w(FUNC(eprom_state::eprom_latch_w)); map(0x360020, 0x360021).w(m_jsa, FUNC(atari_jsa_ii_device::sound_reset_w)); map(0x360031, 0x360031).w(m_jsa, FUNC(atari_jsa_ii_device::main_command_w)); map(0x3e0000, 0x3e0fff).ram().share("paletteram"); @@ -199,8 +198,8 @@ void eprom_state::extra_map(address_map &map) map(0x260010, 0x26001f).portr("260010"); map(0x260020, 0x260027).mirror(0x8).r(FUNC(eprom_state::adc_r)).umask16(0x00ff); map(0x260031, 0x260031).r(m_jsa, FUNC(atari_jsa_base_device::main_response_r)); - map(0x360000, 0x360001).w(FUNC(eprom_state::video_int_ack_w)); - map(0x360010, 0x360011).w(FUNC(eprom_state::eprom_latch_w)); + map(0x360000, 0x360001).w(FUNC(eprom_state::video_int_ack_extra_w)); + map(0x360011, 0x360011).w(FUNC(eprom_state::eprom_latch_w)); map(0x360020, 0x360021).w(m_jsa, FUNC(atari_jsa_base_device::sound_reset_w)); map(0x360031, 0x360031).w(m_jsa, FUNC(atari_jsa_base_device::main_command_w)); } @@ -377,6 +376,8 @@ void eprom_state::eprom(machine_config &config) config.set_maximum_quantum(attotime::from_hz(6000)); + TIMER(config, "scantimer").configure_scanline(FUNC(eprom_state::scanline_update), m_screen, 0, 8); + ADC0809(config, m_adc, ATARI_CLOCK_14MHz/16); m_adc->in_callback<0>().set_ioport("ADC0"); m_adc->in_callback<1>().set_ioport("ADC1"); @@ -404,7 +405,8 @@ void eprom_state::eprom(machine_config &config) m_screen->set_raw(ATARI_CLOCK_14MHz/2, 456, 0, 336, 262, 0, 240); m_screen->set_screen_update(FUNC(eprom_state::screen_update_eprom)); m_screen->set_palette(m_palette); - m_screen->screen_vblank().set(FUNC(eprom_state::video_int_write_line)); + m_screen->screen_vblank().set_inputline(m_maincpu, M68K_IRQ_4, ASSERT_LINE); + m_screen->screen_vblank().append_inputline(m_extra, M68K_IRQ_4, ASSERT_LINE); MCFG_VIDEO_START_OVERRIDE(eprom_state,eprom) @@ -427,6 +429,8 @@ void eprom_state::klaxp(machine_config &config) config.set_maximum_quantum(attotime::from_hz(600)); + TIMER(config, "scantimer").configure_scanline(FUNC(eprom_state::scanline_update), m_screen, 0, 8); + EEPROM_2804(config, "eeprom").lock_after_write(true); WATCHDOG_TIMER(config, "watchdog"); @@ -448,7 +452,7 @@ void eprom_state::klaxp(machine_config &config) m_screen->set_raw(ATARI_CLOCK_14MHz/2, 456, 0, 336, 262, 0, 240); m_screen->set_screen_update(FUNC(eprom_state::screen_update_eprom)); m_screen->set_palette(m_palette); - m_screen->screen_vblank().set(FUNC(eprom_state::video_int_write_line)); + m_screen->screen_vblank().set_inputline(m_maincpu, M68K_IRQ_4, ASSERT_LINE); MCFG_VIDEO_START_OVERRIDE(eprom_state,eprom) @@ -470,6 +474,8 @@ void eprom_state::guts(machine_config &config) config.set_maximum_quantum(attotime::from_hz(600)); + TIMER(config, "scantimer").configure_scanline(FUNC(eprom_state::scanline_update), m_screen, 0, 8); + ADC0809(config, m_adc, ATARI_CLOCK_14MHz/16); m_adc->in_callback<0>().set_ioport("ADC0"); m_adc->in_callback<1>().set_ioport("ADC1"); @@ -497,7 +503,7 @@ void eprom_state::guts(machine_config &config) m_screen->set_raw(ATARI_CLOCK_14MHz/2, 456, 0, 336, 262, 0, 240); m_screen->set_screen_update(FUNC(eprom_state::screen_update_guts)); m_screen->set_palette(m_palette); - m_screen->screen_vblank().set(FUNC(eprom_state::video_int_write_line)); + m_screen->screen_vblank().set_inputline(m_maincpu, M68K_IRQ_4, ASSERT_LINE); MCFG_VIDEO_START_OVERRIDE(eprom_state,guts) diff --git a/src/mame/drivers/klax.cpp b/src/mame/drivers/klax.cpp index 63d7ea87463..abff2d50089 100644 --- a/src/mame/drivers/klax.cpp +++ b/src/mame/drivers/klax.cpp @@ -38,24 +38,19 @@ * *************************************/ -void klax_state::update_interrupts() +TIMER_DEVICE_CALLBACK_MEMBER(klax_state::scanline_update) { - m_maincpu->set_input_line(4, m_video_int_state || m_scanline_int_state ? ASSERT_LINE : CLEAR_LINE); -} + int scanline = param; - -void klax_state::scanline_update(screen_device &screen, int scanline) -{ /* generate 32V signals */ if ((scanline & 32) == 0 && !m_screen->vblank() && !(m_p1->read() & 0x800)) - scanline_int_write_line(1); + m_maincpu->set_input_line(M68K_IRQ_4, ASSERT_LINE); } void klax_state::interrupt_ack_w(u16 data) { - scanline_int_ack_w(); - video_int_ack_w(); + m_maincpu->set_input_line(M68K_IRQ_4, CLEAR_LINE); } @@ -67,8 +62,6 @@ void klax_state::interrupt_ack_w(u16 data) void klax_state::machine_reset() { - atarigen_state::machine_reset(); - scanline_timer_reset(*m_screen, 32); } @@ -194,9 +187,11 @@ GFXDECODE_END void klax_state::klax(machine_config &config) { /* basic machine hardware */ - M68000(config, m_maincpu, ATARI_CLOCK_14MHz/2); + M68000(config, m_maincpu, 14.318181_MHz_XTAL/2); m_maincpu->set_addrmap(AS_PROGRAM, &klax_state::klax_map); + TIMER(config, "scantimer").configure_scanline(FUNC(klax_state::scanline_update), m_screen, 0, 32); + EEPROM_2816(config, "eeprom").lock_after_write(true); WATCHDOG_TIMER(config, "watchdog"); @@ -215,15 +210,15 @@ void klax_state::klax(machine_config &config) m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); /* note: these parameters are from published specs, not derived */ /* the board uses an SOS-2 chip to generate video signals */ - m_screen->set_raw(ATARI_CLOCK_14MHz/2, 456, 0, 336, 262, 0, 240); + m_screen->set_raw(14.318181_MHz_XTAL/2, 456, 0, 336, 262, 0, 240); m_screen->set_screen_update(FUNC(klax_state::screen_update)); m_screen->set_palette("palette"); - m_screen->screen_vblank().set(FUNC(klax_state::video_int_write_line)); + m_screen->screen_vblank().set_inputline(m_maincpu, M68K_IRQ_4, ASSERT_LINE); /* sound hardware */ SPEAKER(config, "mono").front_center(); - OKIM6295(config, "oki", ATARI_CLOCK_14MHz/4/4, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "mono", 1.0); + OKIM6295(config, "oki", 14.318181_MHz_XTAL/4/4, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "mono", 1.0); } void klax_state::bootleg_sound_map(address_map &map) diff --git a/src/mame/drivers/shuuz.cpp b/src/mame/drivers/shuuz.cpp index 947d0b75d68..110e80afee7 100644 --- a/src/mame/drivers/shuuz.cpp +++ b/src/mame/drivers/shuuz.cpp @@ -35,19 +35,6 @@ void shuuz_state::machine_start() save_item(NAME(m_cur)); } -/************************************* - * - * Interrupt handling - * - *************************************/ - -void shuuz_state::update_interrupts() -{ - m_maincpu->set_input_line(4, m_scanline_int_state ? ASSERT_LINE : CLEAR_LINE); -} - - - /************************************* * * Initialization @@ -236,7 +223,7 @@ GFXDECODE_END void shuuz_state::shuuz(machine_config &config) { /* basic machine hardware */ - M68000(config, m_maincpu, ATARI_CLOCK_14MHz/2); + M68000(config, m_maincpu, 14.318181_MHz_XTAL/2); m_maincpu->set_addrmap(AS_PROGRAM, &shuuz_state::main_map); EEPROM_2816(config, "eeprom").lock_after_write(true); @@ -248,7 +235,7 @@ void shuuz_state::shuuz(machine_config &config) PALETTE(config, "palette").set_format(palette_device::IRGB_1555, 1024); ATARI_VAD(config, m_vad, 0, m_screen); - m_vad->scanline_int_cb().set(FUNC(shuuz_state::scanline_int_write_line)); + m_vad->scanline_int_cb().set_inputline(m_maincpu, M68K_IRQ_4); TILEMAP(config, "vad:playfield", m_gfxdecode, 2, 8, 8, TILEMAP_SCAN_COLS, 64, 64).set_info_callback(FUNC(shuuz_state::get_playfield_tile_info)); ATARI_MOTION_OBJECTS(config, "vad:mob", 0, m_screen, shuuz_state::s_mob_config).set_gfxdecode(m_gfxdecode); @@ -256,14 +243,14 @@ void shuuz_state::shuuz(machine_config &config) m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); /* note: these parameters are from published specs, not derived */ /* the board uses a VAD chip to generate video signals */ - m_screen->set_raw(ATARI_CLOCK_14MHz/2, 456, 0, 336, 262, 0, 240); + m_screen->set_raw(14.318181_MHz_XTAL/2, 456, 0, 336, 262, 0, 240); m_screen->set_screen_update(FUNC(shuuz_state::screen_update)); m_screen->set_palette("palette"); /* sound hardware */ SPEAKER(config, "mono").front_center(); - OKIM6295(config, "oki", ATARI_CLOCK_14MHz/16, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "mono", 1.0); + OKIM6295(config, "oki", 14.318181_MHz_XTAL/16, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "mono", 1.0); } diff --git a/src/mame/drivers/toobin.cpp b/src/mame/drivers/toobin.cpp index 9d791ffcaef..1f6110de197 100644 --- a/src/mame/drivers/toobin.cpp +++ b/src/mame/drivers/toobin.cpp @@ -37,23 +37,15 @@ static constexpr XTAL MASTER_CLOCK = 32_MHz_XTAL; * *************************************/ -WRITE_LINE_MEMBER(toobin_state::sound_int_write_line) +TIMER_CALLBACK_MEMBER(toobin_state::scanline_interrupt) { - m_sound_int_state = state; - update_interrupts(); -} - -void toobin_state::update_interrupts() -{ - m_maincpu->set_input_line(1, m_scanline_int_state ? ASSERT_LINE : CLEAR_LINE); - m_maincpu->set_input_line(2, m_sound_int_state ? ASSERT_LINE : CLEAR_LINE); - m_maincpu->set_input_line(3, m_scanline_int_state && m_sound_int_state ? ASSERT_LINE : CLEAR_LINE); + m_maincpu->set_input_line(M68K_IRQ_IPL0, ASSERT_LINE); + m_scanline_interrupt_timer->adjust(m_screen->frame_period()); } void toobin_state::machine_start() { - atarigen_state::machine_start(); - save_item(NAME(m_sound_int_state)); + m_scanline_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(toobin_state::scanline_interrupt), this)); } @@ -74,10 +66,15 @@ WRITE16_MEMBER(toobin_state::interrupt_scan_w) if (oldword != newword) { m_interrupt_scan[offset] = newword; - scanline_int_set(*m_screen, newword & 0x1ff); + m_scanline_interrupt_timer->adjust(m_screen->time_until_pos(newword & 0x1ff)); } } +void toobin_state::scanline_int_ack_w(uint16_t data) +{ + m_maincpu->set_input_line(M68K_IRQ_IPL0, CLEAR_LINE); +} + /************************************* @@ -206,8 +203,9 @@ GFXDECODE_END void toobin_state::toobin(machine_config &config) { /* basic machine hardware */ - M68010(config, m_maincpu, MASTER_CLOCK/4); - m_maincpu->set_addrmap(AS_PROGRAM, &toobin_state::main_map); + m68010_device &maincpu(M68010(config, m_maincpu, MASTER_CLOCK/4)); + maincpu.set_addrmap(AS_PROGRAM, &toobin_state::main_map); + maincpu.disable_interrupt_mixer(); EEPROM_2804(config, "eeprom").lock_after_write(true); @@ -233,7 +231,7 @@ void toobin_state::toobin(machine_config &config) SPEAKER(config, "rspeaker").front_right(); ATARI_JSA_I(config, m_jsa, 0); - m_jsa->main_int_cb().set(FUNC(toobin_state::sound_int_write_line)); + m_jsa->main_int_cb().set_inputline(m_maincpu, M68K_IRQ_IPL1); m_jsa->test_read_cb().set_ioport("FF9000").bit(12); m_jsa->add_route(0, "lspeaker", 1.0); m_jsa->add_route(1, "rspeaker", 1.0); diff --git a/src/mame/drivers/vindictr.cpp b/src/mame/drivers/vindictr.cpp index e533eb1011f..533fa4838de 100644 --- a/src/mame/drivers/vindictr.cpp +++ b/src/mame/drivers/vindictr.cpp @@ -35,16 +35,20 @@ * *************************************/ -void vindictr_state::update_interrupts() +void vindictr_state::scanline_interrupt() { - m_maincpu->set_input_line(4, m_scanline_int_state ? ASSERT_LINE : CLEAR_LINE); + m_maincpu->set_input_line(M68K_IRQ_4, ASSERT_LINE); +} + + +void vindictr_state::scanline_int_ack_w(uint16_t data) +{ + m_maincpu->set_input_line(M68K_IRQ_4, CLEAR_LINE); } void vindictr_state::machine_reset() { - atarigen_state::machine_reset(); - scanline_timer_reset(*m_screen, 8); } @@ -188,6 +192,8 @@ void vindictr_state::vindictr(machine_config &config) M68010(config, m_maincpu, ATARI_CLOCK_14MHz/2); m_maincpu->set_addrmap(AS_PROGRAM, &vindictr_state::main_map); + TIMER(config, "scantimer").configure_scanline(FUNC(vindictr_state::scanline_update), m_screen, 0, 8); + EEPROM_2804(config, "eeprom").lock_after_write(true); WATCHDOG_TIMER(config, "watchdog"); diff --git a/src/mame/includes/arcadecl.h b/src/mame/includes/arcadecl.h index db3a70eb470..bd692281c2d 100644 --- a/src/mame/includes/arcadecl.h +++ b/src/mame/includes/arcadecl.h @@ -10,15 +10,19 @@ #pragma once -#include "machine/atarigen.h" +#include "machine/timer.h" #include "video/atarimo.h" #include "sound/okim6295.h" +#include "screen.h" -class sparkz_state : public atarigen_state +class sparkz_state : public driver_device { public: sparkz_state(const machine_config &mconfig, device_type type, const char *tag) - : atarigen_state(mconfig, type, tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_gfxdecode(*this, "gfxdecode") + , m_screen(*this, "screen") , m_oki(*this, "oki") , m_bitmap(*this, "bitmap") { } @@ -27,13 +31,15 @@ public: protected: virtual void machine_reset() override; - virtual void update_interrupts() override; - virtual void scanline_update(screen_device &screen, int scanline) override; - DECLARE_WRITE16_MEMBER(latch_w); + TIMER_DEVICE_CALLBACK_MEMBER(scanline_interrupt); + void scanline_int_ack_w(uint16_t data); + void latch_w(uint8_t data); virtual uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void main_map(address_map &map); -private: + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_screen; required_device m_oki; required_shared_ptr m_bitmap; }; diff --git a/src/mame/includes/eprom.h b/src/mame/includes/eprom.h index 5d85c395e2d..4ea1c1c087e 100644 --- a/src/mame/includes/eprom.h +++ b/src/mame/includes/eprom.h @@ -11,17 +11,21 @@ #pragma once #include "machine/adc0808.h" -#include "machine/atarigen.h" +#include "machine/timer.h" #include "audio/atarijsa.h" #include "video/atarimo.h" #include "emupal.h" +#include "screen.h" #include "tilemap.h" -class eprom_state : public atarigen_state +class eprom_state : public driver_device { public: eprom_state(const machine_config &mconfig, device_type type, const char *tag) : - atarigen_state(mconfig, type, tag), + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_screen(*this, "screen"), m_playfield_tilemap(*this, "playfield"), m_alpha_tilemap(*this, "alpha"), m_mob(*this, "mob"), @@ -40,10 +44,11 @@ public: protected: virtual void machine_start() override; virtual void machine_reset() override; - virtual void update_interrupts() override; - virtual void scanline_update(screen_device &screen, int scanline) override; - DECLARE_READ8_MEMBER(adc_r); - DECLARE_WRITE16_MEMBER(eprom_latch_w); + void video_int_ack_w(uint16_t data); + void video_int_ack_extra_w(uint16_t data); + TIMER_DEVICE_CALLBACK_MEMBER(scanline_update); + uint8_t adc_r(offs_t offset); + void eprom_latch_w(uint8_t data); template DECLARE_WRITE16_MEMBER(sync_w); TILE_GET_INFO_MEMBER(get_alpha_tile_info); TILE_GET_INFO_MEMBER(get_playfield_tile_info); @@ -58,6 +63,9 @@ protected: void main_map(address_map &map); private: + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_screen; required_device m_playfield_tilemap; required_device m_alpha_tilemap; required_device m_mob; diff --git a/src/mame/includes/klax.h b/src/mame/includes/klax.h index d756d029b31..8a10067d0c5 100644 --- a/src/mame/includes/klax.h +++ b/src/mame/includes/klax.h @@ -10,15 +10,19 @@ #pragma once -#include "machine/atarigen.h" +#include "machine/timer.h" #include "video/atarimo.h" +#include "screen.h" #include "tilemap.h" -class klax_state : public atarigen_state +class klax_state : public driver_device { public: klax_state(const machine_config &mconfig, device_type type, const char *tag) - : atarigen_state(mconfig, type, tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_gfxdecode(*this, "gfxdecode") + , m_screen(*this, "screen") , m_playfield_tilemap(*this, "playfield") , m_mob(*this, "mob") , m_p1(*this, "P1") @@ -30,9 +34,8 @@ public: private: virtual void machine_reset() override; - virtual void scanline_update(screen_device &screen, int scanline) override; + TIMER_DEVICE_CALLBACK_MEMBER(scanline_update); - virtual void update_interrupts() override; void interrupt_ack_w(u16 data = 0); void latch_w(u16 data); @@ -44,6 +47,9 @@ private: void klax5bl_map(address_map &map); void klax_map(address_map &map); + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_screen; required_device m_playfield_tilemap; required_device m_mob; diff --git a/src/mame/includes/shuuz.h b/src/mame/includes/shuuz.h index 64238963601..a598e12479b 100644 --- a/src/mame/includes/shuuz.h +++ b/src/mame/includes/shuuz.h @@ -10,36 +10,42 @@ #pragma once -#include "machine/atarigen.h" #include "video/atarimo.h" #include "video/atarivad.h" +#include "screen.h" #include "tilemap.h" -class shuuz_state : public atarigen_state +class shuuz_state : public driver_device { public: shuuz_state(const machine_config &mconfig, device_type type, const char *tag) - : atarigen_state(mconfig, type, tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_gfxdecode(*this, "gfxdecode") + , m_screen(*this, "screen") , m_vad(*this, "vad") { } void shuuz(machine_config &config); private: - virtual void update_interrupts() override; - DECLARE_WRITE16_MEMBER(latch_w); DECLARE_READ16_MEMBER(leta_r); DECLARE_READ16_MEMBER(special_port0_r); virtual void machine_start() override; + int get_hblank(screen_device &screen) const { return (screen.hpos() > (screen.width() * 9 / 10)); } + TILE_GET_INFO_MEMBER(get_playfield_tile_info); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void main_map(address_map &map); + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_screen; required_device m_vad; int m_cur[2]; diff --git a/src/mame/includes/toobin.h b/src/mame/includes/toobin.h index 8422a2f15dc..d7e46b68c6c 100644 --- a/src/mame/includes/toobin.h +++ b/src/mame/includes/toobin.h @@ -10,17 +10,20 @@ #pragma once -#include "machine/atarigen.h" #include "audio/atarijsa.h" #include "video/atarimo.h" #include "emupal.h" +#include "screen.h" #include "tilemap.h" -class toobin_state : public atarigen_state +class toobin_state : public driver_device { public: toobin_state(const machine_config &mconfig, device_type type, const char *tag) : - atarigen_state(mconfig, type, tag), + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_screen(*this, "screen"), m_jsa(*this, "jsa"), m_playfield_tilemap(*this, "playfield"), m_alpha_tilemap(*this, "alpha"), @@ -28,7 +31,8 @@ public: m_palette(*this, "palette"), m_paletteram(*this, "paletteram"), m_interrupt_scan(*this, "interrupt_scan"), - m_sound_int_state(0) + m_xscroll(*this, "xscroll"), + m_yscroll(*this, "yscroll") { } void toobin(machine_config &config); @@ -36,9 +40,9 @@ public: private: virtual void machine_start() override; virtual void video_start() override; - virtual void update_interrupts() override; - DECLARE_WRITE_LINE_MEMBER(sound_int_write_line); + TIMER_CALLBACK_MEMBER(scanline_interrupt); + void scanline_int_ack_w(uint16_t data); DECLARE_WRITE16_MEMBER(interrupt_scan_w); DECLARE_WRITE16_MEMBER(paletteram_w); @@ -54,6 +58,9 @@ private: void main_map(address_map &map); + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_screen; required_device m_jsa; required_device m_playfield_tilemap; required_device m_alpha_tilemap; @@ -62,11 +69,13 @@ private: required_shared_ptr m_paletteram; required_shared_ptr m_interrupt_scan; + required_shared_ptr m_xscroll; + required_shared_ptr m_yscroll; double m_brightness; bitmap_ind16 m_pfbitmap; - uint8_t m_sound_int_state; + emu_timer *m_scanline_interrupt_timer; static const atari_motion_objects_config s_mob_config; }; diff --git a/src/mame/includes/vindictr.h b/src/mame/includes/vindictr.h index a92a6a6b632..7954befa188 100644 --- a/src/mame/includes/vindictr.h +++ b/src/mame/includes/vindictr.h @@ -10,17 +10,21 @@ #pragma once -#include "machine/atarigen.h" +#include "machine/timer.h" #include "audio/atarijsa.h" #include "video/atarimo.h" #include "emupal.h" +#include "screen.h" #include "tilemap.h" -class vindictr_state : public atarigen_state +class vindictr_state : public driver_device { public: vindictr_state(const machine_config &mconfig, device_type type, const char *tag) : - atarigen_state(mconfig, type, tag), + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_screen(*this, "screen"), m_playfield_tilemap(*this, "playfield"), m_alpha_tilemap(*this, "alpha"), m_mob(*this, "mob"), @@ -36,8 +40,9 @@ public: private: virtual void machine_reset() override; virtual void video_start() override; - virtual void update_interrupts() override; - virtual void scanline_update(screen_device &screen, int scanline) override; + void scanline_interrupt(); + void scanline_int_ack_w(uint16_t data); + TIMER_DEVICE_CALLBACK_MEMBER(scanline_update); DECLARE_READ16_MEMBER(port1_r); TILE_GET_INFO_MEMBER(get_alpha_tile_info); TILE_GET_INFO_MEMBER(get_playfield_tile_info); @@ -47,6 +52,9 @@ private: static const atari_motion_objects_config s_mob_config; void main_map(address_map &map); + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_screen; required_device m_playfield_tilemap; required_device m_alpha_tilemap; required_device m_mob; diff --git a/src/mame/machine/atarigen.cpp b/src/mame/machine/atarigen.cpp index c13e9e6c43d..fc211ed41b3 100644 --- a/src/mame/machine/atarigen.cpp +++ b/src/mame/machine/atarigen.cpp @@ -363,7 +363,6 @@ void atarigen_state::machine_start() { assert(i <= ARRAY_LENGTH(m_screen_timer)); m_screen_timer[i].screen = &screen; - m_screen_timer[i].scanline_interrupt_timer = timer_alloc(TID_SCANLINE_INTERRUPT, (void *)&screen); m_screen_timer[i].scanline_timer = timer_alloc(TID_SCANLINE_TIMER, (void *)&screen); i++; } @@ -401,14 +400,6 @@ void atarigen_state::device_timer(emu_timer &timer, device_timer_id id, int para { switch (id) { - case TID_SCANLINE_INTERRUPT: - { - scanline_int_write_line(1); - screen_device *screen = reinterpret_cast(ptr); - timer.adjust(screen->frame_period()); - break; - } - case TID_SCANLINE_TIMER: scanline_timer(timer, *reinterpret_cast(ptr), param); break; @@ -430,17 +421,6 @@ void atarigen_state::scanline_update(screen_device &screen, int scanline) INTERRUPT HANDLING ***************************************************************************/ -//------------------------------------------------- -// scanline_int_set: Sets the scanline when the next -// scanline interrupt should be generated. -//------------------------------------------------- - -void atarigen_state::scanline_int_set(screen_device &screen, int scanline) -{ - get_screen_timer(screen)->scanline_interrupt_timer->adjust(screen.time_until_pos(scanline)); -} - - //------------------------------------------------- // scanline_int_write_line: Standard write line // callback for the scanline interrupt diff --git a/src/mame/machine/atarigen.h b/src/mame/machine/atarigen.h index 88651dd6c31..76b0e449a6b 100644 --- a/src/mame/machine/atarigen.h +++ b/src/mame/machine/atarigen.h @@ -122,7 +122,6 @@ private: struct atarigen_screen_timer { screen_device *screen; - emu_timer * scanline_interrupt_timer; emu_timer * scanline_timer; }; @@ -145,7 +144,6 @@ protected: virtual void scanline_update(screen_device &screen, int scanline); // interrupt handling - void scanline_int_set(screen_device &screen, int scanline); DECLARE_WRITE_LINE_MEMBER(scanline_int_write_line); void scanline_int_ack_w(u16 data = 0); @@ -163,7 +161,6 @@ protected: void scanline_timer(emu_timer &timer, screen_device &screen, int scanline); // video helpers - int get_hblank(screen_device &screen) const { return (screen.hpos() > (screen.width() * 9 / 10)); } void halt_until_hblank_0(device_t &device, screen_device &screen); // misc helpers @@ -172,7 +169,6 @@ protected: // timer IDs enum { - TID_SCANLINE_INTERRUPT, TID_SCANLINE_TIMER, TID_UNHALT_CPU, TID_ATARIGEN_LAST diff --git a/src/mame/video/eprom.cpp b/src/mame/video/eprom.cpp index be2aacc6a03..fad474f1502 100644 --- a/src/mame/video/eprom.cpp +++ b/src/mame/video/eprom.cpp @@ -179,10 +179,10 @@ VIDEO_START_MEMBER(eprom_state,guts) * *************************************/ -void eprom_state::scanline_update(screen_device &screen, int scanline) +TIMER_DEVICE_CALLBACK_MEMBER(eprom_state::scanline_update) { /* update the playfield */ - if (scanline == 0) + if (param == 0) { int xscroll = (m_alpha_tilemap->basemem_read(0x780) >> 7) & 0x1ff; int yscroll = (m_alpha_tilemap->basemem_read(0x781) >> 7) & 0x1ff; diff --git a/src/mame/video/vindictr.cpp b/src/mame/video/vindictr.cpp index d25988ccfa2..ed507364814 100644 --- a/src/mame/video/vindictr.cpp +++ b/src/mame/video/vindictr.cpp @@ -123,9 +123,9 @@ WRITE16_MEMBER( vindictr_state::vindictr_paletteram_w ) * *************************************/ -void vindictr_state::scanline_update(screen_device &screen, int scanline) +TIMER_DEVICE_CALLBACK_MEMBER(vindictr_state::scanline_update) { - int x; + int scanline = param; /* keep in range */ int offset = ((scanline - 8) / 8) * 64 + 42; @@ -135,7 +135,7 @@ void vindictr_state::scanline_update(screen_device &screen, int scanline) return; /* update the current parameters */ - for (x = 42; x < 64; x++) + for (int x = 42; x < 64; x++) { uint16_t data = m_alpha_tilemap->basemem_read(offset++); @@ -144,7 +144,7 @@ void vindictr_state::scanline_update(screen_device &screen, int scanline) case 2: /* /PFB */ if (m_playfield_tile_bank != (data & 7)) { - screen.update_partial(scanline - 1); + m_screen->update_partial(scanline - 1); m_playfield_tile_bank = data & 7; m_playfield_tilemap->mark_all_dirty(); } @@ -153,7 +153,7 @@ void vindictr_state::scanline_update(screen_device &screen, int scanline) case 3: /* /PFHSLD */ if (m_playfield_xscroll != (data & 0x1ff)) { - screen.update_partial(scanline - 1); + m_screen->update_partial(scanline - 1); m_playfield_tilemap->set_scrollx(0, data); m_playfield_xscroll = data & 0x1ff; } @@ -162,7 +162,7 @@ void vindictr_state::scanline_update(screen_device &screen, int scanline) case 4: /* /MOHS */ if (m_mob->xscroll() != (data & 0x1ff)) { - screen.update_partial(scanline - 1); + m_screen->update_partial(scanline - 1); m_mob->set_xscroll(data & 0x1ff); } break; @@ -171,20 +171,20 @@ void vindictr_state::scanline_update(screen_device &screen, int scanline) break; case 6: /* /VIRQ */ - scanline_int_write_line(1); + scanline_interrupt(); break; case 7: /* /PFVS */ { /* a new vscroll latches the offset into a counter; we must adjust for this */ int offset = scanline; - const rectangle &visible_area = screen.visible_area(); + const rectangle &visible_area = m_screen->visible_area(); if (offset > visible_area.bottom()) offset -= visible_area.bottom() + 1; if (m_playfield_yscroll != ((data - offset) & 0x1ff)) { - screen.update_partial(scanline - 1); + m_screen->update_partial(scanline - 1); m_playfield_tilemap->set_scrolly(0, data - offset); m_mob->set_yscroll((data - offset) & 0x1ff); }