Previous 199869 Revisions Next

r31225 Monday 7th July, 2014 at 22:51:32 UTC by hap
setting address is allowed before function set
[src/emu/video]hd44780.c

trunk/src/emu/video/hd44780.c
r31224r31225
66
77        TODO:
88        - dump internal CGROM
9        - emulate osc pin, determine video timings and busy flag duration from it
910
1011***************************************************************************/
1112
r31224r31225
396397      m_ir = data;
397398   }
398399
399   if (BIT(m_ir, 7))           // set DDRAM address
400   if (BIT(m_ir, 7))
400401   {
402      // set DDRAM address
401403      m_active_ram = DDRAM;
402404      m_ac = m_ir & 0x7f;
403405
r31224r31225
411413      set_busy_flag(37);
412414
413415      if (LOG) logerror("HD44780 '%s': set DDRAM address %x\n", tag(), m_ac);
416      return;
414417   }
415   else if (BIT(m_ir, 6))      // set CGRAM address
418   else if (BIT(m_ir, 6))
416419   {
420      // set CGRAM address
417421      m_active_ram = CGRAM;
418422      m_ac = m_ir & 0x3f;
419423      set_busy_flag(37);
420424
421425      if (LOG) logerror("HD44780 '%s': set CGRAM address %x\n", tag(), m_ac);
426      return;
422427   }
423   else if (BIT(m_ir, 5))      // function set
428   else if (BIT(m_ir, 5))
424429   {
430      // function set
425431      if (!m_first_cmd && m_data_len == (BIT(m_ir, 4) ? 8 : 4) && (m_char_size != (BIT(m_ir, 2) ? 10 : 8) || m_num_line != (BIT(m_ir, 3) + 1)))
426432      {
427433         logerror("HD44780 '%s': function set cannot be executed after other instructions unless the interface data length is changed\n", tag());
r31224r31225
436442      if (LOG) logerror("HD44780 '%s': char size 5x%d, data len %d, lines %d\n", tag(), m_char_size, m_data_len, m_num_line);
437443      return;
438444   }
439   else if (BIT(m_ir, 4))      // cursor or display shift
445   else if (BIT(m_ir, 4))
440446   {
447      // cursor or display shift
441448      int direct = (BIT(m_ir, 2)) ? +1 : -1;
442449
443450      if (LOG) logerror("HD44780 '%s': %s shift %d\n", tag(), BIT(m_ir, 3) ? "display" : "cursor",  direct);
r31224r31225
449456
450457      set_busy_flag(37);
451458   }
452   else if (BIT(m_ir, 3))      // display on/off control
459   else if (BIT(m_ir, 3))
453460   {
461      // display on/off control
454462      m_display_on = BIT(m_ir, 2);
455463      m_cursor_on  = BIT(m_ir, 1);
456464      m_blink_on   = BIT(m_ir, 0);
r31224r31225
458466
459467      if (LOG) logerror("HD44780 '%s': display %d, cursor %d, blink %d\n", tag(), m_display_on, m_cursor_on, m_blink_on);
460468   }
461   else if (BIT(m_ir, 2))      // entry mode set
469   else if (BIT(m_ir, 2))
462470   {
471      // entry mode set
463472      m_direction = (BIT(m_ir, 1)) ? +1 : -1;
464473      m_shift_on  = BIT(m_ir, 0);
465474      set_busy_flag(37);
466475
467476      if (LOG) logerror("HD44780 '%s': entry mode set: direction %d, shift %d\n", tag(), m_direction, m_shift_on);
468477   }
469   else if (BIT(m_ir, 1))      // return home
478   else if (BIT(m_ir, 1))
470479   {
480      // return home
471481      if (LOG) logerror("HD44780 '%s': return home\n", tag());
472482
473483      m_ac         = 0;
r31224r31225
476486      m_disp_shift = 0;
477487      set_busy_flag(1520);
478488   }
479   else if (BIT(m_ir, 0))      // clear display
489   else if (BIT(m_ir, 0))
480490   {
491      // clear display
481492      if (LOG) logerror("HD44780 '%s': clear display\n", tag());
482493
483494      m_ac         = 0;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team