diff options
author | AJR <ajrhacker@users.noreply.github.com> | 2019-09-16 10:11:45 -0400 |
---|---|---|
committer | AJR <ajrhacker@users.noreply.github.com> | 2019-09-16 10:11:45 -0400 |
commit | 85cdb4e1f91911ccb9f63d02e49bc62510604ab3 (patch) | |
tree | cc1783fe961141034950017be264407637fb7fdf | |
parent | 7bc88bb1fb1da10428afcaea100993feb909a99b (diff) |
exidy440.cpp: Eliminate anonymous timers (nw)
-rw-r--r-- | src/mame/includes/exidy440.h | 2 | ||||
-rw-r--r-- | src/mame/video/exidy440.cpp | 15 |
2 files changed, 10 insertions, 7 deletions
diff --git a/src/mame/includes/exidy440.h b/src/mame/includes/exidy440.h index e5221e525a3..af383dedcc5 100644 --- a/src/mame/includes/exidy440.h +++ b/src/mame/includes/exidy440.h @@ -98,7 +98,9 @@ private: uint8_t m_firq_select; uint8_t m_palettebank_io; uint8_t m_palettebank_vis; + emu_timer *m_beam_firq_timer; emu_timer *m_collide_firq_timer; + uint8_t m_beam_firq_count; }; diff --git a/src/mame/video/exidy440.cpp b/src/mame/video/exidy440.cpp index 57ad8a06d80..602b1d3f479 100644 --- a/src/mame/video/exidy440.cpp +++ b/src/mame/video/exidy440.cpp @@ -42,6 +42,7 @@ void exidy440_state::video_start() m_palettebank_vis = 0; m_firq_vblank = 0; m_firq_beam = 0; + m_beam_firq_count = 0; /* allocate a buffer for VRAM */ m_local_videoram = std::make_unique<uint8_t[]>(256 * 256 * 2); @@ -51,6 +52,7 @@ void exidy440_state::video_start() m_local_paletteram = std::make_unique<uint8_t[]>(512 * 2); memset(m_local_paletteram.get(), 0, 512 * 2); + m_beam_firq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(exidy440_state::beam_firq_callback), this)); m_collide_firq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(exidy440_state::collide_firq_callback), this)); } @@ -262,6 +264,9 @@ TIMER_CALLBACK_MEMBER(exidy440_state::beam_firq_callback) /* latch the x value; this convolution comes from the read routine */ m_latched_x = (param + 3) ^ 2; + + if (m_beam_firq_count++ < 12) + m_beam_firq_timer->adjust(m_screen->scan_period(), param); } @@ -420,8 +425,6 @@ uint32_t exidy440_state::screen_update_exidy440(screen_device &screen, bitmap_in /* generate an interrupt once/frame for the beam */ if (cliprect.bottom() == screen.visible_area().bottom()) { - int i; - int beamx = ((ioport("AN0")->read() & 0xff) * (HBSTART - HBEND)) >> 8; int beamy = ((ioport("AN1")->read() & 0xff) * (VBSTART - VBEND)) >> 8; @@ -433,11 +436,9 @@ uint32_t exidy440_state::screen_update_exidy440(screen_device &screen, bitmap_in This is how it is implemented. */ attotime increment = screen.scan_period(); attotime time = screen.time_until_pos(beamy, beamx) - increment * 6; - for (i = 0; i <= 12; i++) - { - machine().scheduler().timer_set(time, timer_expired_delegate(FUNC(exidy440_state::beam_firq_callback),this), beamx); - time += increment; - } + + m_beam_firq_count = 0; + m_beam_firq_timer->adjust(time, beamx); } return 0; |