(MESS) HD44780: added an optional pixel_update callback in order to support custom LCD. (nw)

This commit is contained in:
Sandro Ronco 2012-08-27 17:56:31 +00:00
parent 5bebbc7c53
commit ce54598401
7 changed files with 33 additions and 13 deletions

View File

@ -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 =

View File

@ -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 =

View File

@ -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)

View File

@ -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 )

View File

@ -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 */

View File

@ -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);
}
}

View File

@ -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;