Previous 199869 Revisions Next

r31226 Monday 7th July, 2014 at 22:56:20 UTC by hap
(whitespace)
[src/emu/video]hd44780.c

trunk/src/emu/video/hd44780.c
r31225r31226
156156
157157void hd44780_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
158158{
159   switch(id)
159   switch (id)
160160   {
161161      case TIMER_BUSY:
162162         m_busy_flag = false;
r31225r31226
188188{
189189   if (m_active_ram == DDRAM)
190190   {
191      if(direction == 1)
191      if (direction == 1)
192192      {
193         if(m_num_line == 2 && m_ac == 0x27)
193         if (m_num_line == 2 && m_ac == 0x27)
194194            m_ac = 0x40;
195         else if((m_num_line == 2 && m_ac == 0x67) || (m_num_line == 1 && m_ac == 0x4f))
195         else if ((m_num_line == 2 && m_ac == 0x67) || (m_num_line == 1 && m_ac == 0x4f))
196196            m_ac = 0x00;
197197         else
198198            m_ac = (m_ac + direction) & 0x7f;
199199      }
200200      else
201201      {
202         if(m_num_line == 2 && m_ac == 0x00)
202         if (m_num_line == 2 && m_ac == 0x00)
203203            m_ac = 0x67;
204         else if(m_num_line == 1 && m_ac == 0x00)
204         else if (m_num_line == 1 && m_ac == 0x00)
205205            m_ac = 0x4f;
206         else if(m_num_line == 2 && m_ac == 0x40)
206         else if (m_num_line == 2 && m_ac == 0x40)
207207            m_ac = 0x27;
208208         else
209209            m_ac = (m_ac + direction) & 0x7f;
r31225r31226
219219{
220220   if (direction == 1)
221221   {
222      if(m_disp_shift == 0x4f)
222      if (m_disp_shift == 0x4f)
223223         m_disp_shift = 0x00;
224224      else
225225         m_disp_shift++;
226226   }
227227   else
228228   {
229      if(m_disp_shift == 0x00)
229      if (m_disp_shift == 0x00)
230230         m_disp_shift = 0x4f;
231231      else
232232         m_disp_shift--;
r31225r31226
294294   {
295295      UINT8 line_size = 80 / m_num_line;
296296
297      for (int line=0; line<m_num_line; line++)
297      for (int line = 0; line < m_num_line; line++)
298298      {
299         for (int pos=0; pos<line_size; pos++)
299         for (int pos = 0; pos < line_size; pos++)
300300         {
301301            UINT16 char_pos = line * 0x40 + ((pos + m_disp_shift) % line_size);
302302
r31225r31226
307307               if (m_char_size == 8)
308308                  char_base = (m_ddram[char_pos] & 0x07) * 8;
309309               else
310                  char_base = ((m_ddram[char_pos]>>1) & 0x03) * 16;
310                  char_base = ((m_ddram[char_pos] >> 1) & 0x03) * 16;
311311            }
312312            else
313313            {
r31225r31226
316316            }
317317
318318            const UINT8 * charset = (m_ddram[char_pos] < 0x10) ? m_cgram : m_cgrom;
319            UINT8 *dest = m_render_buf + 16*(line*line_size + pos);
319            UINT8 *dest = m_render_buf + 16 * (line * line_size + pos);
320320            memcpy (dest, charset + char_base, m_char_size);
321321
322322            if (char_pos == m_ac)
323323            {
324324               // draw the cursor
325325               if (m_cursor_on)
326                  dest[m_char_size-1] = 0x1f;
326                  dest[m_char_size - 1] = 0x1f;
327327
328328               if (!m_blink && m_blink_on)
329329                  memset(dest, 0x1f, m_char_size);
r31225r31226
342342
343343   UINT8 line_size = 80 / m_num_line;
344344
345   for (int line=0; line<m_num_line; line++)
345   for (int line = 0; line < m_num_line; line++)
346346   {
347      for (int pos=0; pos<line_size; pos++)
347      for (int pos = 0; pos < line_size; pos++)
348348      {
349         const UINT8 *src = img + 16*(line*line_size + pos);
350         for (int y=0; y<m_char_size; y++)
351            for (int x=0; x<5; x++)
349         const UINT8 *src = img + 16 * (line * line_size + pos);
350         for (int y = 0; y < m_char_size; y++)
351            for (int x = 0; x < 5; x++)
352352               pixel_update(bitmap, line, pos, y, x, BIT(src[y], 4 - x));
353353      }
354354   }
r31225r31226
358358
359359READ8_MEMBER(hd44780_device::read)
360360{
361   switch(offset & 0x01)
361   switch (offset & 0x01)
362362   {
363363      case 0: return control_read(space, 0);
364364      case 1: return data_read(space, 0);
r31225r31226
369369
370370WRITE8_MEMBER(hd44780_device::write)
371371{
372   switch(offset & 0x01)
372   switch (offset & 0x01)
373373   {
374374      case 0: control_write(space, 0, data);  break;
375375      case 1: data_write(space, 0, data);     break;
r31225r31226
389389      }
390390      else
391391      {
392         m_ir |= ((data>>4) & 0x0f);
392         m_ir |= ((data >> 4) & 0x0f);
393393      }
394394   }
395395   else
r31225r31226
512512      if (m_nibble)
513513         return (m_busy_flag ? 0x80 : 0) | (m_ac & 0x70);
514514      else
515         return (m_ac<<4) & 0xf0;
515         return (m_ac << 4) & 0xf0;
516516   }
517517   else
518518   {
r31225r31226
539539      }
540540      else
541541      {
542         m_dr |= ((data>>4) & 0x0f);
542         m_dr |= ((data >> 4) & 0x0f);
543543      }
544544   }
545545   else
r31225r31226
574574      if (m_nibble)
575575         return data & 0xf0;
576576      else
577         data = (data<<4) & 0xf0;
577         data = (data << 4) & 0xf0;
578578   }
579579
580580   if (!space.debugger_access())

Previous 199869 Revisions Next


© 1997-2024 The MAME Team