trunk/src/emu/video/hd44780.c
| r31224 | r31225 | |
| 6 | 6 | |
| 7 | 7 | TODO: |
| 8 | 8 | - dump internal CGROM |
| 9 | - emulate osc pin, determine video timings and busy flag duration from it |
| 9 | 10 | |
| 10 | 11 | ***************************************************************************/ |
| 11 | 12 | |
| r31224 | r31225 | |
| 396 | 397 | m_ir = data; |
| 397 | 398 | } |
| 398 | 399 | |
| 399 | | if (BIT(m_ir, 7)) // set DDRAM address |
| 400 | if (BIT(m_ir, 7)) |
| 400 | 401 | { |
| 402 | // set DDRAM address |
| 401 | 403 | m_active_ram = DDRAM; |
| 402 | 404 | m_ac = m_ir & 0x7f; |
| 403 | 405 | |
| r31224 | r31225 | |
| 411 | 413 | set_busy_flag(37); |
| 412 | 414 | |
| 413 | 415 | if (LOG) logerror("HD44780 '%s': set DDRAM address %x\n", tag(), m_ac); |
| 416 | return; |
| 414 | 417 | } |
| 415 | | else if (BIT(m_ir, 6)) // set CGRAM address |
| 418 | else if (BIT(m_ir, 6)) |
| 416 | 419 | { |
| 420 | // set CGRAM address |
| 417 | 421 | m_active_ram = CGRAM; |
| 418 | 422 | m_ac = m_ir & 0x3f; |
| 419 | 423 | set_busy_flag(37); |
| 420 | 424 | |
| 421 | 425 | if (LOG) logerror("HD44780 '%s': set CGRAM address %x\n", tag(), m_ac); |
| 426 | return; |
| 422 | 427 | } |
| 423 | | else if (BIT(m_ir, 5)) // function set |
| 428 | else if (BIT(m_ir, 5)) |
| 424 | 429 | { |
| 430 | // function set |
| 425 | 431 | 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))) |
| 426 | 432 | { |
| 427 | 433 | logerror("HD44780 '%s': function set cannot be executed after other instructions unless the interface data length is changed\n", tag()); |
| r31224 | r31225 | |
| 436 | 442 | 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); |
| 437 | 443 | return; |
| 438 | 444 | } |
| 439 | | else if (BIT(m_ir, 4)) // cursor or display shift |
| 445 | else if (BIT(m_ir, 4)) |
| 440 | 446 | { |
| 447 | // cursor or display shift |
| 441 | 448 | int direct = (BIT(m_ir, 2)) ? +1 : -1; |
| 442 | 449 | |
| 443 | 450 | if (LOG) logerror("HD44780 '%s': %s shift %d\n", tag(), BIT(m_ir, 3) ? "display" : "cursor", direct); |
| r31224 | r31225 | |
| 449 | 456 | |
| 450 | 457 | set_busy_flag(37); |
| 451 | 458 | } |
| 452 | | else if (BIT(m_ir, 3)) // display on/off control |
| 459 | else if (BIT(m_ir, 3)) |
| 453 | 460 | { |
| 461 | // display on/off control |
| 454 | 462 | m_display_on = BIT(m_ir, 2); |
| 455 | 463 | m_cursor_on = BIT(m_ir, 1); |
| 456 | 464 | m_blink_on = BIT(m_ir, 0); |
| r31224 | r31225 | |
| 458 | 466 | |
| 459 | 467 | if (LOG) logerror("HD44780 '%s': display %d, cursor %d, blink %d\n", tag(), m_display_on, m_cursor_on, m_blink_on); |
| 460 | 468 | } |
| 461 | | else if (BIT(m_ir, 2)) // entry mode set |
| 469 | else if (BIT(m_ir, 2)) |
| 462 | 470 | { |
| 471 | // entry mode set |
| 463 | 472 | m_direction = (BIT(m_ir, 1)) ? +1 : -1; |
| 464 | 473 | m_shift_on = BIT(m_ir, 0); |
| 465 | 474 | set_busy_flag(37); |
| 466 | 475 | |
| 467 | 476 | if (LOG) logerror("HD44780 '%s': entry mode set: direction %d, shift %d\n", tag(), m_direction, m_shift_on); |
| 468 | 477 | } |
| 469 | | else if (BIT(m_ir, 1)) // return home |
| 478 | else if (BIT(m_ir, 1)) |
| 470 | 479 | { |
| 480 | // return home |
| 471 | 481 | if (LOG) logerror("HD44780 '%s': return home\n", tag()); |
| 472 | 482 | |
| 473 | 483 | m_ac = 0; |
| r31224 | r31225 | |
| 476 | 486 | m_disp_shift = 0; |
| 477 | 487 | set_busy_flag(1520); |
| 478 | 488 | } |
| 479 | | else if (BIT(m_ir, 0)) // clear display |
| 489 | else if (BIT(m_ir, 0)) |
| 480 | 490 | { |
| 491 | // clear display |
| 481 | 492 | if (LOG) logerror("HD44780 '%s': clear display\n", tag()); |
| 482 | 493 | |
| 483 | 494 | m_ac = 0; |