From c9921f5bdcdad4ffc925511b9a80716cbba22d22 Mon Sep 17 00:00:00 2001 From: cam900 Date: Sun, 28 Apr 2019 19:28:05 +0900 Subject: atarigen.cpp : Updates Simplify handlers, Reduce unnecessary lines, Fix debugger issues, Fix notes, Use shorter type values, Fix spacings badlands.cpp, gauntlet.cpp : Fix irq acknowlodge behavior --- src/mame/audio/atarijsa.cpp | 6 +- src/mame/drivers/atarisy2.cpp | 6 +- src/mame/drivers/badlands.cpp | 8 +-- src/mame/drivers/gauntlet.cpp | 4 +- src/mame/drivers/klax.cpp | 4 +- src/mame/machine/atarigen.cpp | 128 +++++++++++++++++++++++------------------- src/mame/machine/atarigen.h | 112 ++++++++++++++++++------------------ src/mame/video/atarisy1.cpp | 4 +- src/mame/video/blstroid.cpp | 4 +- 9 files changed, 140 insertions(+), 136 deletions(-) diff --git a/src/mame/audio/atarijsa.cpp b/src/mame/audio/atarijsa.cpp index 51869806fe1..3547592763b 100644 --- a/src/mame/audio/atarijsa.cpp +++ b/src/mame/audio/atarijsa.cpp @@ -271,7 +271,7 @@ void atari_jsa_base_device::device_reset() WRITE8_MEMBER( atari_jsa_base_device::main_command_w ) { - m_soundcomm->main_command_w(space, offset, data); + m_soundcomm->main_command_w(data); } @@ -281,7 +281,7 @@ WRITE8_MEMBER( atari_jsa_base_device::main_command_w ) READ8_MEMBER( atari_jsa_base_device::main_response_r ) { - return m_soundcomm->main_response_r(space, offset); + return m_soundcomm->main_response_r(); } @@ -291,7 +291,7 @@ READ8_MEMBER( atari_jsa_base_device::main_response_r ) WRITE16_MEMBER( atari_jsa_base_device::sound_reset_w ) { - m_soundcomm->sound_reset_w(space, offset, data); + m_soundcomm->sound_reset_w(); } diff --git a/src/mame/drivers/atarisy2.cpp b/src/mame/drivers/atarisy2.cpp index 94af07033f9..5eea006c356 100644 --- a/src/mame/drivers/atarisy2.cpp +++ b/src/mame/drivers/atarisy2.cpp @@ -663,7 +663,7 @@ READ16_MEMBER(atarisy2_state::sound_r) update_interrupts(); /* handle it normally otherwise */ - return m_soundcomm->main_response_r(space,offset) | 0xff00; + return m_soundcomm->main_response_r() | 0xff00; } @@ -674,7 +674,7 @@ WRITE8_MEMBER(atarisy2_state::sound_6502_w) update_interrupts(); /* handle it normally otherwise */ - m_soundcomm->sound_response_w(space, offset, data); + m_soundcomm->sound_response_w(data); } @@ -685,7 +685,7 @@ READ8_MEMBER(atarisy2_state::sound_6502_r) update_interrupts(); /* handle it normally otherwise */ - return m_soundcomm->sound_command_r(space, offset); + return m_soundcomm->sound_command_r(); } diff --git a/src/mame/drivers/badlands.cpp b/src/mame/drivers/badlands.cpp index d2d51288124..2b5c19329d8 100644 --- a/src/mame/drivers/badlands.cpp +++ b/src/mame/drivers/badlands.cpp @@ -275,7 +275,7 @@ READ8_MEMBER(badlands_state::audio_io_r) break; case 0x002: /* /RDP */ - result = m_soundcomm->sound_command_r(space, offset); + result = m_soundcomm->sound_command_r(); break; case 0x004: /* /RDIO */ @@ -295,7 +295,7 @@ READ8_MEMBER(badlands_state::audio_io_r) break; case 0x006: /* /IRQACK */ - m_soundcomm->sound_irq_ack_r(space, 0); + m_soundcomm->sound_irq_ack_r(); break; case 0x200: /* /VOICE */ @@ -321,7 +321,7 @@ WRITE8_MEMBER(badlands_state::audio_io_w) break; case 0x006: /* /IRQACK */ - m_soundcomm->sound_irq_ack_r(space, 0); + m_soundcomm->sound_irq_ack_w(); break; case 0x200: /* n/c */ @@ -329,7 +329,7 @@ WRITE8_MEMBER(badlands_state::audio_io_w) break; case 0x202: /* /WRP */ - m_soundcomm->sound_response_w(space, offset, data); + m_soundcomm->sound_response_w(data); break; case 0x204: /* WRIO */ diff --git a/src/mame/drivers/gauntlet.cpp b/src/mame/drivers/gauntlet.cpp index 7f3f1b05ac5..c32e3920c50 100644 --- a/src/mame/drivers/gauntlet.cpp +++ b/src/mame/drivers/gauntlet.cpp @@ -148,13 +148,11 @@ void gauntlet_state::update_interrupts() void gauntlet_state::scanline_update(screen_device &screen, int scanline) { - address_space &space = m_audiocpu->space(AS_PROGRAM); - /* sound IRQ is on 32V */ if (scanline & 32) m_soundcomm->sound_irq_gen(*m_audiocpu); else - m_soundcomm->sound_irq_ack_r(space, 0); + m_soundcomm->sound_irq_ack_w(); } diff --git a/src/mame/drivers/klax.cpp b/src/mame/drivers/klax.cpp index bec9aec2143..c0052a969f6 100644 --- a/src/mame/drivers/klax.cpp +++ b/src/mame/drivers/klax.cpp @@ -54,8 +54,8 @@ void klax_state::scanline_update(screen_device &screen, int scanline) WRITE16_MEMBER(klax_state::interrupt_ack_w) { - scanline_int_ack_w(space, offset, data, mem_mask); - video_int_ack_w(space, offset, data, mem_mask); + scanline_int_ack_w(); + video_int_ack_w(); } diff --git a/src/mame/machine/atarigen.cpp b/src/mame/machine/atarigen.cpp index a39ea07db6e..dd1f5329d87 100644 --- a/src/mame/machine/atarigen.cpp +++ b/src/mame/machine/atarigen.cpp @@ -2,7 +2,7 @@ // copyright-holders:Aaron Giles /*************************************************************************** - atarigen.c + atarigen.cpp General functions for Atari games. @@ -54,16 +54,16 @@ DEFINE_DEVICE_TYPE(ATARI_SOUND_COMM, atari_sound_comm_device, "atarscom", "Atari // atari_sound_comm_device - constructor //------------------------------------------------- -atari_sound_comm_device::atari_sound_comm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, ATARI_SOUND_COMM, tag, owner, clock), - m_main_int_cb(*this), - m_sound_cpu(*this, finder_base::DUMMY_TAG), - m_main_to_sound_ready(false), - m_sound_to_main_ready(false), - m_main_to_sound_data(0), - m_sound_to_main_data(0), - m_timed_int(0), - m_ym2151_int(0) +atari_sound_comm_device::atari_sound_comm_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : device_t(mconfig, ATARI_SOUND_COMM, tag, owner, clock) + , m_main_int_cb(*this) + , m_sound_cpu(*this, finder_base::DUMMY_TAG) + , m_main_to_sound_ready(false) + , m_sound_to_main_ready(false) + , m_main_to_sound_data(0) + , m_sound_to_main_data(0) + , m_timed_int(0) + , m_ym2151_int(0) { } @@ -149,14 +149,17 @@ void atari_sound_comm_device::sound_irq() // can be used. //------------------------------------------------- -READ8_MEMBER(atari_sound_comm_device::sound_irq_ack_r) +u8 atari_sound_comm_device::sound_irq_ack_r() { - m_timed_int = 0; - update_sound_irq(); + if (!machine().side_effects_disabled()) + { + m_timed_int = 0; + update_sound_irq(); + } return 0; } -WRITE8_MEMBER(atari_sound_comm_device::sound_irq_ack_w) +void atari_sound_comm_device::sound_irq_ack_w(u8 data) { m_timed_int = 0; update_sound_irq(); @@ -180,7 +183,7 @@ WRITE_LINE_MEMBER(atari_sound_comm_device::ym2151_irq_gen) // sound CPU in response. //------------------------------------------------- -WRITE16_MEMBER(atari_sound_comm_device::sound_reset_w) +void atari_sound_comm_device::sound_reset_w(u16 data) { synchronize(TID_SOUND_RESET); } @@ -193,7 +196,7 @@ WRITE16_MEMBER(atari_sound_comm_device::sound_reset_w) // the upper 8 bits. //------------------------------------------------- -WRITE8_MEMBER(atari_sound_comm_device::main_command_w) +void atari_sound_comm_device::main_command_w(u8 data) { synchronize(TID_SOUND_WRITE, data); } @@ -206,10 +209,13 @@ WRITE8_MEMBER(atari_sound_comm_device::main_command_w) // byte in the upper 8 bits. //------------------------------------------------- -READ8_MEMBER(atari_sound_comm_device::main_response_r) +u8 atari_sound_comm_device::main_response_r() { - m_sound_to_main_ready = false; - m_main_int_cb(CLEAR_LINE); + if (!machine().side_effects_disabled()) + { + m_sound_to_main_ready = false; + m_main_int_cb(CLEAR_LINE); + } return m_sound_to_main_data; } @@ -219,7 +225,7 @@ READ8_MEMBER(atari_sound_comm_device::main_response_r) // sound CPU to the main CPU. //------------------------------------------------- -WRITE8_MEMBER(atari_sound_comm_device::sound_response_w) +void atari_sound_comm_device::sound_response_w(u8 data) { synchronize(TID_6502_WRITE, data); } @@ -231,10 +237,13 @@ WRITE8_MEMBER(atari_sound_comm_device::sound_response_w) // CPU. //------------------------------------------------- -READ8_MEMBER(atari_sound_comm_device::sound_command_r) +u8 atari_sound_comm_device::sound_command_r() { - m_main_to_sound_ready = false; - m_sound_cpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + if (!machine().side_effects_disabled()) + { + m_main_to_sound_ready = false; + m_sound_cpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + } return m_main_to_sound_data; } @@ -289,7 +298,7 @@ void atari_sound_comm_device::delayed_sound_write(int data) { // warn if we missed something if (m_main_to_sound_ready) - logerror("Missed command from 68010\n"); + logerror("Missed command from 680x0\n"); // set up the states and signal an NMI to the sound CPU m_main_to_sound_data = data; @@ -326,23 +335,23 @@ void atari_sound_comm_device::delayed_6502_write(int data) ***************************************************************************/ atarigen_state::atarigen_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_scanline_int_state(0), - m_video_int_state(0), - m_xscroll(*this, "xscroll"), - m_yscroll(*this, "yscroll"), - m_slapstic_num(0), - m_slapstic(nullptr), - m_slapstic_bank(0), - m_slapstic_last_pc(0), - m_slapstic_last_address(0), - m_slapstic_base(0), - m_slapstic_mirror(0), - m_scanlines_per_callback(0), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_slapstic_device(*this, ":slapstic") + : driver_device(mconfig, type, tag) + , m_scanline_int_state(0) + , m_video_int_state(0) + , m_xscroll(*this, "xscroll") + , m_yscroll(*this, "yscroll") + , m_slapstic_num(0) + , m_slapstic(nullptr) + , m_slapstic_bank(0) + , m_slapstic_last_pc(0) + , m_slapstic_last_address(0) + , m_slapstic_base(0) + , m_slapstic_mirror(0) + , m_scanlines_per_callback(0) + , m_maincpu(*this, "maincpu") + , m_gfxdecode(*this, "gfxdecode") + , m_screen(*this, "screen") + , m_slapstic_device(*this, ":slapstic") { } @@ -449,7 +458,7 @@ WRITE_LINE_MEMBER(atarigen_state::scanline_int_write_line) // scanline interrupt. //------------------------------------------------- -WRITE16_MEMBER(atarigen_state::scanline_int_ack_w) +void atarigen_state::scanline_int_ack_w(u16 data) { m_scanline_int_state = 0; update_interrupts(); @@ -476,7 +485,7 @@ WRITE_LINE_MEMBER(atarigen_state::video_int_write_line) // interrupt. //------------------------------------------------- -WRITE16_MEMBER(atarigen_state::video_int_ack_w) +void atarigen_state::video_int_ack_w(u16 data) { m_video_int_state = 0; update_interrupts(); @@ -522,7 +531,7 @@ void atarigen_state::device_post_load() // slapstic and sets the chip number. //------------------------------------------------- -void atarigen_state::slapstic_configure(cpu_device &device, offs_t base, offs_t mirror, uint8_t *mem) +void atarigen_state::slapstic_configure(cpu_device &device, offs_t base, offs_t mirror, u8 *mem) { if (!m_slapstic_device.found()) fatalerror("Slapstic device is missing\n"); @@ -534,7 +543,7 @@ void atarigen_state::slapstic_configure(cpu_device &device, offs_t base, offs_t // install the memory handlers address_space &program = device.space(AS_PROGRAM); program.install_readwrite_handler(base, base + 0x7fff, 0, mirror, 0, read16_delegate(FUNC(atarigen_state::slapstic_r), this), write16_delegate(FUNC(atarigen_state::slapstic_w), this)); - m_slapstic = (uint16_t *)mem; + m_slapstic = (u16 *)mem; // allocate memory for a copy of bank 0 m_slapstic_bank0.resize(0x2000); @@ -577,8 +586,11 @@ READ16_MEMBER(atarigen_state::slapstic_r) // fetch the result from the current bank first int result = m_slapstic[offset & 0xfff]; - // then determine the new one - slapstic_update_bank(m_slapstic_device->slapstic_tweak(space, offset)); + if (!machine().side_effects_disabled()) + { + // then determine the new one + slapstic_update_bank(m_slapstic_device->slapstic_tweak(space, offset)); + } return result; } @@ -663,26 +675,24 @@ void atarigen_state::blend_gfx(int gfx0, int gfx1, int mask0, int mask1) { gfx_element *gx0 = m_gfxdecode->gfx(gfx0); gfx_element *gx1 = m_gfxdecode->gfx(gfx1); - uint8_t *srcdata, *dest; - int c, x, y; // allocate memory for the assembled data - srcdata = auto_alloc_array(machine(), uint8_t, gx0->elements() * gx0->width() * gx0->height()); + u8 *srcdata = auto_alloc_array(machine(), u8, gx0->elements() * gx0->width() * gx0->height()); // loop over elements - dest = srcdata; - for (c = 0; c < gx0->elements(); c++) + u8 *dest = srcdata; + for (int c = 0; c < gx0->elements(); c++) { - const uint8_t *c0base = gx0->get_data(c); - const uint8_t *c1base = gx1->get_data(c); + const u8 *c0base = gx0->get_data(c); + const u8 *c1base = gx1->get_data(c); // loop over height - for (y = 0; y < gx0->height(); y++) + for (int y = 0; y < gx0->height(); y++) { - const uint8_t *c0 = c0base; - const uint8_t *c1 = c1base; + const u8 *c0 = c0base; + const u8 *c1 = c1base; - for (x = 0; x < gx0->width(); x++) + for (int x = 0; x < gx0->width(); x++) *dest++ = (*c0++ & mask0) | (*c1++ & mask1); c0base += gx0->rowbytes(); c1base += gx1->rowbytes(); diff --git a/src/mame/machine/atarigen.h b/src/mame/machine/atarigen.h index ba1f2bda30a..88651dd6c31 100644 --- a/src/mame/machine/atarigen.h +++ b/src/mame/machine/atarigen.h @@ -49,12 +49,12 @@ public: // construction/destruction template atari_sound_comm_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&cputag) - : atari_sound_comm_device(mconfig, tag, owner, (uint32_t)0) + : atari_sound_comm_device(mconfig, tag, owner, (u32)0) { m_sound_cpu.set_tag(std::forward(cputag)); } - atari_sound_comm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + atari_sound_comm_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); // configuration helpers auto int_callback() { return m_main_int_cb.bind(); } @@ -64,16 +64,16 @@ public: DECLARE_READ_LINE_MEMBER(sound_to_main_ready) { return m_sound_to_main_ready ? ASSERT_LINE : CLEAR_LINE; } // main cpu accessors (forward internally to the atari_sound_comm_device) - DECLARE_WRITE8_MEMBER(main_command_w); - DECLARE_READ8_MEMBER(main_response_r); - DECLARE_WRITE16_MEMBER(sound_reset_w); + void main_command_w(u8 data); + u8 main_response_r(); + void sound_reset_w(u16 data = 0); // sound cpu accessors void sound_cpu_reset() { synchronize(TID_SOUND_RESET, 1); } - DECLARE_WRITE8_MEMBER(sound_response_w); - DECLARE_READ8_MEMBER(sound_command_r); - DECLARE_WRITE8_MEMBER(sound_irq_ack_w); - DECLARE_READ8_MEMBER(sound_irq_ack_r); + void sound_response_w(u8 data); + u8 sound_command_r(); + void sound_irq_ack_w(u8 data = 0); + u8 sound_irq_ack_r(); INTERRUPT_GEN_MEMBER(sound_irq_gen); void sound_irq(); @@ -106,12 +106,12 @@ private: // internal state required_device m_sound_cpu; - bool m_main_to_sound_ready; - bool m_sound_to_main_ready; - uint8_t m_main_to_sound_data; - uint8_t m_sound_to_main_data; - uint8_t m_timed_int; - uint8_t m_ym2151_int; + bool m_main_to_sound_ready; + bool m_sound_to_main_ready; + u8 m_main_to_sound_data; + u8 m_sound_to_main_data; + u8 m_timed_int; + u8 m_ym2151_int; }; @@ -147,13 +147,13 @@ protected: // interrupt handling void scanline_int_set(screen_device &screen, int scanline); DECLARE_WRITE_LINE_MEMBER(scanline_int_write_line); - DECLARE_WRITE16_MEMBER(scanline_int_ack_w); + void scanline_int_ack_w(u16 data = 0); DECLARE_WRITE_LINE_MEMBER(video_int_write_line); - DECLARE_WRITE16_MEMBER(video_int_ack_w); + void video_int_ack_w(u16 data = 0); // slapstic helpers - void slapstic_configure(cpu_device &device, offs_t base, offs_t mirror, uint8_t *mem); + void slapstic_configure(cpu_device &device, offs_t base, offs_t mirror, u8 *mem); void slapstic_update_bank(int bank); DECLARE_WRITE16_MEMBER(slapstic_w); DECLARE_READ16_MEMBER(slapstic_r); @@ -178,23 +178,23 @@ protected: TID_ATARIGEN_LAST }; - uint8_t m_scanline_int_state; - uint8_t m_video_int_state; + u8 m_scanline_int_state; + u8 m_video_int_state; - optional_shared_ptr m_xscroll; - optional_shared_ptr m_yscroll; + optional_shared_ptr m_xscroll; + optional_shared_ptr m_yscroll; /* internal state */ - uint8_t m_slapstic_num; - uint16_t * m_slapstic; - uint8_t m_slapstic_bank; - std::vector m_slapstic_bank0; - offs_t m_slapstic_last_pc; - offs_t m_slapstic_last_address; - offs_t m_slapstic_base; - offs_t m_slapstic_mirror; + u8 m_slapstic_num; + u16 * m_slapstic; + u8 m_slapstic_bank; + std::vector m_slapstic_bank0; + offs_t m_slapstic_last_pc; + offs_t m_slapstic_last_address; + offs_t m_slapstic_base; + offs_t m_slapstic_mirror; - uint32_t m_scanlines_per_callback; + u32 m_scanlines_per_callback; atarigen_screen_timer m_screen_timer[2]; @@ -216,31 +216,31 @@ private: Atari 68000 list: - Driver Pr? Up? VC? PF? P2? MO? AL? BM? PH? - ---------- --- --- --- --- --- --- --- --- --- - arcadecl.c * * * - atarig1.c * * rle * - atarig42.c * * rle * - atarigt.c * rle * - atarigx2.c * rle * - atarisy1.c * * * * * 270->260 - atarisy2.c * * * * * 150->120 - badlands.c * * * 250->260 - batman.c * * * * * * * * 200->160 ? - blstroid.c * * * 240->230 - cyberbal.c * * * * 125->105 ? - eprom.c * * * * 170->170 - gauntlet.c * * * * * * 220->250 - klax.c * * * * 480->440 ? - offtwall.c * * * * 260->260 - rampart.c * * * 280->280 - relief.c * * * * * * 240->240 - shuuz.c * * * * 410->290 fix! - skullxbo.c * * * * 150->145 - thunderj.c * * * * * * * 180->180 - toobin.c * * * * 140->115 fix! - vindictr.c * * * * * * 200->210 - xybots.c * * * * * 235->238 + Driver Pr? Up? VC? PF? P2? MO? AL? BM? PH? + ---------- --- --- --- --- --- --- --- --- --- + arcadecl.cpp * * * + atarig1.cpp * * rle * + atarig42.cpp * * rle * + atarigt.cpp * rle * + atarigx2.cpp * rle * + atarisy1.cpp * * * * * 270->260 + atarisy2.cpp * * * * * 150->120 + badlands.cpp * * * 250->260 + batman.cpp * * * * * * * * 200->160 ? + blstroid.cpp * * * 240->230 + cyberbal.cpp * * * * 125->105 ? + eprom.cpp * * * * 170->170 + gauntlet.cpp * * * * * * 220->250 + klax.cpp * * * * 480->440 ? + offtwall.cpp * * * * 260->260 + rampart.cpp * * * 280->280 + relief.cpp * * * * * * 240->240 + shuuz.cpp * * * * 410->290 fix! + skullxbo.cpp * * * * 150->145 + thunderj.cpp * * * * * * * 180->180 + toobin.cpp * * * * 140->115 fix! + vindictr.cpp * * * * * * 200->210 + xybots.cpp * * * * * 235->238 ---------- --- --- --- --- --- --- --- --- --- Pr? - do we have verifiable proof on priorities? diff --git a/src/mame/video/atarisy1.cpp b/src/mame/video/atarisy1.cpp index 13e28d18065..a625f752c43 100644 --- a/src/mame/video/atarisy1.cpp +++ b/src/mame/video/atarisy1.cpp @@ -353,10 +353,8 @@ WRITE16_MEMBER( atarisy1_state::atarisy1_spriteram_w ) TIMER_DEVICE_CALLBACK_MEMBER(atarisy1_state::atarisy1_int3off_callback) { - address_space &space = m_maincpu->space(AS_PROGRAM); - /* clear the state */ - scanline_int_ack_w(space, 0, 0); + scanline_int_ack_w(); } diff --git a/src/mame/video/blstroid.cpp b/src/mame/video/blstroid.cpp index 31c9f4302c0..3eb2ef5bde1 100644 --- a/src/mame/video/blstroid.cpp +++ b/src/mame/video/blstroid.cpp @@ -85,13 +85,11 @@ VIDEO_START_MEMBER(blstroid_state,blstroid) void blstroid_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - address_space &space = m_maincpu->space(AS_PROGRAM); - switch (id) { case TIMER_IRQ_OFF: /* clear the interrupt */ - scanline_int_ack_w(space, 0, 0); + scanline_int_ack_w(); break; case TIMER_IRQ_ON: /* generate the interrupt */ -- cgit v1.2.3