summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/video/tms9927.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/video/tms9927.cpp')
-rw-r--r--src/devices/video/tms9927.cpp84
1 files changed, 39 insertions, 45 deletions
diff --git a/src/devices/video/tms9927.cpp b/src/devices/video/tms9927.cpp
index 7fef40f635e..12b17acac99 100644
--- a/src/devices/video/tms9927.cpp
+++ b/src/devices/video/tms9927.cpp
@@ -7,7 +7,7 @@
**********************************************************************/
#include "emu.h"
-#include "video/tms9927.h"
+#include "tms9927.h"
#include "screen.h"
@@ -84,13 +84,9 @@ void tms9927_device::device_start()
assert(clock() > 0);
if (!(m_hpixels_per_column > 0)) fatalerror("TMS9927: number of pixels per column must be explicitly set using set_char_width()!\n");
- // resolve callbacks
- m_write_vsyn.resolve_safe();
- m_write_hsyn.resolve();
-
// allocate timers
- m_vsync_timer = timer_alloc(TIMER_VSYNC);
- m_hsync_timer = timer_alloc(TIMER_HSYNC);
+ m_vsync_timer = timer_alloc(FUNC(tms9927_device::toggle_vsync), this);
+ m_hsync_timer = timer_alloc(FUNC(tms9927_device::toggle_hsync), this);
// register for state saving
save_item(NAME(m_reg));
@@ -137,46 +133,42 @@ void tms9927_device::device_stop()
//-------------------------------------------------
-// device_timer - handle timer events
+// timer events
//-------------------------------------------------
-void tms9927_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+TIMER_CALLBACK_MEMBER(tms9927_device::toggle_vsync)
{
- switch (id)
+ m_vsyn = !m_vsyn;
+ m_write_vsyn(m_vsyn ? 1 : 0);
+
+ if (m_vsyn)
{
- case TIMER_VSYNC:
- m_vsyn = !m_vsyn;
- m_write_vsyn(m_vsyn ? 1 : 0);
-
- if (m_vsyn)
- {
- m_vsync_timer->adjust(screen().time_until_pos(m_vsyn_end, m_hsyn_start));
- }
- else
- {
- m_vsync_timer->adjust(screen().time_until_pos(m_vsyn_start, m_hsyn_start));
- }
- break;
-
- case TIMER_HSYNC:
- m_hsyn = !m_hsyn;
- m_write_hsyn(m_hsyn ? 1 : 0);
-
- uint16_t vpos = screen().vpos();
- if (m_hsyn)
- {
- screen().update_now();
- if (screen().hpos() > m_hsyn_end)
- vpos = (vpos + 1) % m_total_vpix;
- m_hsync_timer->adjust(screen().time_until_pos(vpos, m_hsyn_end));
- }
- else
- {
- if (screen().hpos() > m_hsyn_start)
- vpos = (vpos + 1) % m_total_vpix;
- m_hsync_timer->adjust(screen().time_until_pos(vpos, m_hsyn_start));
- }
- break;
+ m_vsync_timer->adjust(screen().time_until_pos(m_vsyn_end, m_hsyn_start));
+ }
+ else
+ {
+ m_vsync_timer->adjust(screen().time_until_pos(m_vsyn_start, m_hsyn_start));
+ }
+}
+
+TIMER_CALLBACK_MEMBER(tms9927_device::toggle_hsync)
+{
+ m_hsyn = !m_hsyn;
+ m_write_hsyn(m_hsyn ? 1 : 0);
+
+ uint16_t vpos = screen().vpos();
+ if (m_hsyn)
+ {
+ screen().update_now();
+ if (screen().hpos() > m_hsyn_end)
+ vpos = (vpos + 1) % m_total_vpix;
+ m_hsync_timer->adjust(screen().time_until_pos(vpos, m_hsyn_end));
+ }
+ else
+ {
+ if (screen().hpos() > m_hsyn_start)
+ vpos = (vpos + 1) % m_total_vpix;
+ m_hsync_timer->adjust(screen().time_until_pos(vpos, m_hsyn_start));
}
}
@@ -355,12 +347,14 @@ void tms9927_device::recompute_parameters(bool postload)
attotime refresh = clocks_to_attotime(HCOUNT * m_total_vpix);
- osd_printf_debug("TMS9927: Total = %dx%d, Visible = %dx%d, HSync = %d-%d, VSync = %d-%d, Skew=%d, Upscroll=%d, Period=%f Hz\n", m_total_hpix, m_total_vpix, m_visible_hpix, m_visible_vpix, m_hsyn_start, m_hsyn_end, m_vsyn_start, m_vsyn_end, SKEW_BITS, m_start_datarow, refresh.as_hz());
+ osd_printf_debug(
+ "TMS9927(%s): Total = %dx%d, Visible = %dx%d, HSync = %d-%d, VSync = %d-%d, Skew=%d, Upscroll=%d, Period=%f Hz\n",
+ tag(), m_total_hpix, m_total_vpix, m_visible_hpix, m_visible_vpix, m_hsyn_start, m_hsyn_end, m_vsyn_start, m_vsyn_end, SKEW_BITS, m_start_datarow, refresh.as_hz());
screen().configure(m_total_hpix, m_total_vpix, visarea, refresh.as_attoseconds());
m_hsyn = false;
- if (!m_write_hsyn.isnull())
+ if (!m_write_hsyn.isunset())
{
m_write_hsyn(0);
m_hsync_timer->adjust(screen().time_until_pos(m_vsyn_start, m_hsyn_start));