From feee20045248af9e8b531f79fec51c57c18bcf04 Mon Sep 17 00:00:00 2001 From: cracyc Date: Mon, 26 Oct 2015 14:37:48 -0500 Subject: [PATCH] mc6845: screen reconfig callback (nw) --- src/devices/video/mc6845.c | 6 ++++++ src/devices/video/mc6845.h | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/src/devices/video/mc6845.c b/src/devices/video/mc6845.c index 4c1d811369c..372a99a8a30 100644 --- a/src/devices/video/mc6845.c +++ b/src/devices/video/mc6845.c @@ -536,6 +536,9 @@ void mc6845_device::recompute_parameters(bool postload) if ( m_screen != NULL ) m_screen->configure(horiz_pix_total, vert_pix_total, visarea, refresh); + if(!m_reconfigure_cb.isnull()) + m_reconfigure_cb(horiz_pix_total, vert_pix_total, visarea, refresh); + m_has_valid_parameters = true; } else @@ -549,6 +552,7 @@ void mc6845_device::recompute_parameters(bool postload) m_hsync_off_pos = hsync_off_pos; m_vsync_on_pos = vsync_on_pos; m_vsync_off_pos = vsync_off_pos; + m_line_counter = 0; } } @@ -667,6 +671,7 @@ void mc6845_device::handle_line_timer() if ( m_line_counter == m_vert_disp ) { m_line_enable_ff = false; + m_current_disp_addr = m_disp_start_addr; } /* Check if VSYNC should be enabled */ @@ -1005,6 +1010,7 @@ void mc6845_device::device_start() m_out_vsync_cb.resolve_safe(); /* bind delegates */ + m_reconfigure_cb.bind_relative_to(*owner()); m_begin_update_cb.bind_relative_to(*owner()); m_update_row_cb.bind_relative_to(*owner()); m_end_update_cb.bind_relative_to(*owner()); diff --git a/src/devices/video/mc6845.h b/src/devices/video/mc6845.h index 053c2b9491e..c445fac2c33 100644 --- a/src/devices/video/mc6845.h +++ b/src/devices/video/mc6845.h @@ -39,6 +39,9 @@ #define MCFG_MC6845_CHAR_WIDTH(_pixels) \ mc6845_device::set_char_width(*device, _pixels); +#define MCFG_MC6845_RECONFIGURE_CB(_class, _method) \ + mc6845_device::set_reconfigure_callback(*device, mc6845_reconfigure_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); + #define MCFG_MC6845_BEGIN_UPDATE_CB(_class, _method) \ mc6845_device::set_begin_update_callback(*device, mc6845_begin_update_delegate(&_class::_method, #_class "::" #_method, downcast<_class *>(owner))); @@ -65,6 +68,9 @@ /* callback definitions */ +typedef device_delegate mc6845_reconfigure_delegate; +#define MC6845_RECONFIGURE(name) void name(int width, int height, const rectangle &visarea, attoseconds_t frame_period) + typedef device_delegate mc6845_begin_update_delegate; #define MC6845_BEGIN_UPDATE(name) void name(bitmap_rgb32 &bitmap, const rectangle &cliprect) @@ -110,6 +116,7 @@ public: } static void set_char_width(device_t &device, int pixels) { downcast(device).m_hpixels_per_column = pixels; } + static void set_reconfigure_callback(device_t &device, mc6845_reconfigure_delegate callback) { downcast(device).m_reconfigure_cb = callback; } static void set_begin_update_callback(device_t &device, mc6845_begin_update_delegate callback) { downcast(device).m_begin_update_cb = callback; } static void set_update_row_callback(device_t &device, mc6845_update_row_delegate callback) { downcast(device).m_update_row_cb = callback; } static void set_end_update_callback(device_t &device, mc6845_end_update_delegate callback) { downcast(device).m_end_update_cb = callback; } @@ -286,6 +293,8 @@ protected: int m_hpixels_per_column; /* number of pixels per video memory address */ + mc6845_reconfigure_delegate m_reconfigure_cb; + /* if specified, this gets called before any pixel update, optionally return a pointer that will be passed to the update and tear down callbacks */