trunk/src/mess/video/hd44780.c
r17509 | r17510 | |
37 | 37 | else |
38 | 38 | { |
39 | 39 | height = width = 0; |
| 40 | pixel_update_func = NULL; |
40 | 41 | } |
41 | 42 | } |
42 | 43 | |
r17509 | r17510 | |
141 | 142 | m_busy_flag = 1; |
142 | 143 | |
143 | 144 | m_busy_timer->adjust( attotime::from_usec( usec ) ); |
| 145 | } |
144 | 146 | |
| 147 | inline void hd44780_device::pixel_update(bitmap_ind16 &bitmap, UINT8 line, UINT8 pos, UINT8 y, UINT8 x, int state) |
| 148 | { |
| 149 | if (pixel_update_func != NULL) |
| 150 | pixel_update_func(*this, bitmap, line, pos, y, x, state); |
| 151 | else |
| 152 | bitmap.pix16(line*9 + y, pos*6 + x) = state; |
145 | 153 | } |
146 | 154 | |
147 | 155 | //************************************************************************** |
r17509 | r17510 | |
177 | 185 | if (m_ddram[char_pos] <= 0x10) |
178 | 186 | { |
179 | 187 | //draw CGRAM characters |
180 | | bitmap.pix16(l*9 + y, i*6 + x) = BIT(m_cgram[(m_ddram[char_pos]&0x07)*8+y], 4-x); |
| 188 | pixel_update(bitmap, l, i, y, x, BIT(m_cgram[(m_ddram[char_pos]&0x07)*8+y], 4-x)); |
181 | 189 | } |
182 | 190 | else |
183 | 191 | { |
184 | 192 | //draw CGROM characters |
185 | 193 | if (region()->bytes() <= 0x800) |
186 | 194 | { |
187 | | bitmap.pix16(l*9 + y, i*6 + x) = BIT(region()->u8(m_ddram[char_pos]*8+y), 4-x); |
| 195 | pixel_update(bitmap, l, i, y, x, BIT(region()->u8(m_ddram[char_pos]*8+y), 4-x)); |
188 | 196 | } |
189 | 197 | else |
190 | 198 | { |
191 | 199 | if(m_ddram[char_pos] < 0xe0) |
192 | | bitmap.pix16(l*9 + y, i*6 + x) = BIT(region()->u8(m_ddram[char_pos]*8+y), 4-x); |
| 200 | pixel_update(bitmap, l, i, y, x, BIT(region()->u8(m_ddram[char_pos]*8+y), 4-x)); |
193 | 201 | else |
194 | | bitmap.pix16(l*9 + y, i*6 + x) = BIT(region()->u8(0x700+((m_ddram[char_pos]-0xe0)*11)+y), 4-x); |
| 202 | pixel_update(bitmap, l, i, y, x, BIT(region()->u8(0x700+((m_ddram[char_pos]-0xe0)*11)+y), 4-x)); |
195 | 203 | } |
196 | 204 | } |
197 | 205 | |
r17509 | r17510 | |
201 | 209 | //draw the cursor |
202 | 210 | if (m_cursor_on) |
203 | 211 | for (int x=0; x<5; x++) |
204 | | bitmap.pix16(l*9 + 7, i * 6 + x) = 1; |
| 212 | pixel_update(bitmap, l, i, 7, x, 1); |
205 | 213 | |
206 | 214 | if (!m_blink && m_blink_on) |
207 | 215 | for (int y=0; y<7; y++) |
208 | 216 | for (int x=0; x<5; x++) |
209 | | bitmap.pix16(l*9 + y, i * 6 + x) = 1; |
| 217 | pixel_update(bitmap, l, i, y, x, 1); |
210 | 218 | } |
211 | 219 | } |
212 | 220 | |
trunk/src/mess/video/hd44780.h
r17509 | r17510 | |
21 | 21 | #define HD44780_INTERFACE(name) \ |
22 | 22 | const hd44780_interface (name) = |
23 | 23 | |
| 24 | typedef void (*hd44780_pixel_update_func)(device_t &device, bitmap_ind16 &bitmap, UINT8 line, UINT8 pos, UINT8 y, UINT8 x, int state); |
| 25 | #define HD44780_PIXEL_UPDATE(name) void name(device_t &device, bitmap_ind16 &bitmap, UINT8 line, UINT8 pos, UINT8 y, UINT8 x, int state) |
| 26 | |
24 | 27 | // ======================> hd44780_interface |
25 | 28 | |
26 | 29 | struct hd44780_interface |
27 | 30 | { |
28 | 31 | UINT8 height; // number of lines |
29 | 32 | UINT8 width; // chars for line |
| 33 | hd44780_pixel_update_func pixel_update_func; // pixel update callback |
30 | 34 | }; |
31 | 35 | |
32 | 36 | // ======================> hd44780_device |
r17509 | r17510 | |
59 | 63 | // internal helper |
60 | 64 | void set_busy_flag(UINT16 usec); |
61 | 65 | void update_ac(void); |
| 66 | void pixel_update(bitmap_ind16 &bitmap, UINT8 line, UINT8 pos, UINT8 y, UINT8 x, int state); |
62 | 67 | // internal state |
63 | 68 | static const device_timer_id BUSY_TIMER = 0; |
64 | 69 | static const device_timer_id BLINKING_TIMER = 1; |