diff --git a/src/mess/drivers/alesis.c b/src/mess/drivers/alesis.c index a815df5b768..e0168c8eb80 100644 --- a/src/mess/drivers/alesis.c +++ b/src/mess/drivers/alesis.c @@ -235,13 +235,15 @@ void alesis_state::machine_reset() static HD44780_INTERFACE( hr16_display ) { 2, // number of lines - 16 // chars for line + 16, // chars for line + NULL // pixel update callback }; static HD44780_INTERFACE( sr16_display ) { 2, // number of lines - 8 // chars for line + 8, // chars for line + NULL // pixel update callback }; static const cassette_interface hr16_cassette_interface = diff --git a/src/mess/drivers/lcmate2.c b/src/mess/drivers/lcmate2.c index a2eaf272a92..987f93a1a50 100644 --- a/src/mess/drivers/lcmate2.c +++ b/src/mess/drivers/lcmate2.c @@ -205,7 +205,8 @@ void lcmate2_state::machine_start() static HD44780_INTERFACE( lcmate2_display ) { 2, // number of lines - 20 // chars for line + 20, // chars for line + NULL // pixel update callback }; static const gfx_layout lcmate2_charlayout = diff --git a/src/mess/drivers/mmodular.c b/src/mess/drivers/mmodular.c index 5c9c29d11d2..fb96c661175 100644 --- a/src/mess/drivers/mmodular.c +++ b/src/mess/drivers/mmodular.c @@ -191,7 +191,8 @@ public: static HD44780_INTERFACE( chess_display ) { 2, // number of lines - 16 // chars for line + 16, // chars for line + NULL // pixel update callback }; static UINT8 convert_imputmask(UINT8 input) diff --git a/src/mess/drivers/pc2000.c b/src/mess/drivers/pc2000.c index 556980acc63..fe96c2d77f3 100644 --- a/src/mess/drivers/pc2000.c +++ b/src/mess/drivers/pc2000.c @@ -319,7 +319,8 @@ GFXDECODE_END static HD44780_INTERFACE( pc2000_display ) { 2, // number of lines - 20 // chars for line + 20, // chars for line + NULL // pixel update callback }; static MACHINE_CONFIG_START( pc2000, pc2000_state ) diff --git a/src/mess/drivers/psion.c b/src/mess/drivers/psion.c index f070e9a2d47..2fdbedb86f2 100644 --- a/src/mess/drivers/psion.c +++ b/src/mess/drivers/psion.c @@ -463,7 +463,8 @@ GFXDECODE_END static HD44780_INTERFACE( psion_2line_display ) { 2, // number of lines - 16 // chars for line + 16, // chars for line + NULL // pixel update callback }; /* basic configuration for 2 lines display */ @@ -506,7 +507,8 @@ MACHINE_CONFIG_END static HD44780_INTERFACE( psion_4line_display ) { 4, // number of lines - 20 // chars for line + 20, // chars for line + NULL // pixel update callback }; /* basic configuration for 4 lines display */ diff --git a/src/mess/video/hd44780.c b/src/mess/video/hd44780.c index 8050c68a007..c89e00855e6 100644 --- a/src/mess/video/hd44780.c +++ b/src/mess/video/hd44780.c @@ -37,6 +37,7 @@ void hd44780_device::device_config_complete() else { height = width = 0; + pixel_update_func = NULL; } } @@ -141,7 +142,14 @@ void hd44780_device::set_busy_flag(UINT16 usec) m_busy_flag = 1; m_busy_timer->adjust( attotime::from_usec( usec ) ); +} +inline void hd44780_device::pixel_update(bitmap_ind16 &bitmap, UINT8 line, UINT8 pos, UINT8 y, UINT8 x, int state) +{ + if (pixel_update_func != NULL) + pixel_update_func(*this, bitmap, line, pos, y, x, state); + else + bitmap.pix16(line*9 + y, pos*6 + x) = state; } //************************************************************************** @@ -177,21 +185,21 @@ UINT32 hd44780_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap if (m_ddram[char_pos] <= 0x10) { //draw CGRAM characters - bitmap.pix16(l*9 + y, i*6 + x) = BIT(m_cgram[(m_ddram[char_pos]&0x07)*8+y], 4-x); + pixel_update(bitmap, l, i, y, x, BIT(m_cgram[(m_ddram[char_pos]&0x07)*8+y], 4-x)); } else { //draw CGROM characters if (region()->bytes() <= 0x800) { - bitmap.pix16(l*9 + y, i*6 + x) = BIT(region()->u8(m_ddram[char_pos]*8+y), 4-x); + pixel_update(bitmap, l, i, y, x, BIT(region()->u8(m_ddram[char_pos]*8+y), 4-x)); } else { if(m_ddram[char_pos] < 0xe0) - bitmap.pix16(l*9 + y, i*6 + x) = BIT(region()->u8(m_ddram[char_pos]*8+y), 4-x); + pixel_update(bitmap, l, i, y, x, BIT(region()->u8(m_ddram[char_pos]*8+y), 4-x)); else - bitmap.pix16(l*9 + y, i*6 + x) = BIT(region()->u8(0x700+((m_ddram[char_pos]-0xe0)*11)+y), 4-x); + pixel_update(bitmap, l, i, y, x, BIT(region()->u8(0x700+((m_ddram[char_pos]-0xe0)*11)+y), 4-x)); } } @@ -201,12 +209,12 @@ UINT32 hd44780_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap //draw the cursor if (m_cursor_on) for (int x=0; x<5; x++) - bitmap.pix16(l*9 + 7, i * 6 + x) = 1; + pixel_update(bitmap, l, i, 7, x, 1); if (!m_blink && m_blink_on) for (int y=0; y<7; y++) for (int x=0; x<5; x++) - bitmap.pix16(l*9 + y, i * 6 + x) = 1; + pixel_update(bitmap, l, i, y, x, 1); } } diff --git a/src/mess/video/hd44780.h b/src/mess/video/hd44780.h index 483f30c2ea0..94584c34323 100644 --- a/src/mess/video/hd44780.h +++ b/src/mess/video/hd44780.h @@ -21,12 +21,16 @@ #define HD44780_INTERFACE(name) \ const hd44780_interface (name) = +typedef void (*hd44780_pixel_update_func)(device_t &device, bitmap_ind16 &bitmap, UINT8 line, UINT8 pos, UINT8 y, UINT8 x, int state); +#define HD44780_PIXEL_UPDATE(name) void name(device_t &device, bitmap_ind16 &bitmap, UINT8 line, UINT8 pos, UINT8 y, UINT8 x, int state) + // ======================> hd44780_interface struct hd44780_interface { UINT8 height; // number of lines UINT8 width; // chars for line + hd44780_pixel_update_func pixel_update_func; // pixel update callback }; // ======================> hd44780_device @@ -59,6 +63,7 @@ protected: // internal helper void set_busy_flag(UINT16 usec); void update_ac(void); + void pixel_update(bitmap_ind16 &bitmap, UINT8 line, UINT8 pos, UINT8 y, UINT8 x, int state); // internal state static const device_timer_id BUSY_TIMER = 0; static const device_timer_id BLINKING_TIMER = 1;