diff options
Diffstat (limited to 'src/devices/video/t6963c.cpp')
-rw-r--r-- | src/devices/video/t6963c.cpp | 53 |
1 files changed, 34 insertions, 19 deletions
diff --git a/src/devices/video/t6963c.cpp b/src/devices/video/t6963c.cpp index 0e63572dddb..4a4b624a48b 100644 --- a/src/devices/video/t6963c.cpp +++ b/src/devices/video/t6963c.cpp @@ -5,6 +5,12 @@ Toshiba T6963C Dot Matrix LCD Controller Sharp LM24014H Dot Matrix LCD Unit + TODO: + - cursor + - screen peek + - screen copy + - auto read mode + **********************************************************************/ #include "emu.h" @@ -36,7 +42,7 @@ t6963c_device::t6963c_device(const machine_config &mconfig, const char *tag, dev : device_t(mconfig, T6963C, tag, owner, clock) , device_memory_interface(mconfig, *this) , m_display_config("display", ENDIANNESS_LITTLE, 8, 16, 0) - , m_cgrom(*this, "cgrom", 0x400) + , m_cgrom(*this, "cgrom") , m_display_ram(nullptr) , m_data(0) , m_adp(0) @@ -51,6 +57,7 @@ t6963c_device::t6963c_device(const machine_config &mconfig, const char *tag, dev , m_font_size(6) , m_number_cols(40) , m_number_lines(8) + , m_read_data(0) { } @@ -89,6 +96,7 @@ void t6963c_device::device_start() save_item(NAME(m_font_size)); save_item(NAME(m_number_cols)); save_item(NAME(m_number_lines)); + save_item(NAME(m_read_data)); } @@ -117,7 +125,7 @@ void t6963c_device::device_reset() u8 t6963c_device::read(offs_t offset) { - return BIT(offset, 0) ? 0x0b : 0x00; + return BIT(offset, 0) ? 0x2b : m_read_data; } @@ -219,7 +227,7 @@ void t6963c_device::do_command(u8 cmd) if (cmd == 0x90) LOG("%s: Display off\n", machine().describe_context()); else - LOG("%s: Text %s, graphic %s, cursor %s, blink %s\n", + LOG("%s: Graphic %s, text %s, cursor %s, blink %s\n", machine().describe_context(), BIT(cmd, 3) ? "on" : "off", BIT(cmd, 2) ? "on" : "off", @@ -251,6 +259,8 @@ void t6963c_device::do_command(u8 cmd) : (cmd & 0x0e) == 0x02 ? "decrement" : (cmd & 0x0e) == 0x04 ? "nonvariable" : "invalid"); + + m_read_data = m_display_ram->read_byte(m_adp); } else { @@ -308,7 +318,7 @@ void t6963c_device::set_md(u8 data) // MD0, MD1 m_number_lines = 8 - (data & 3) * 2; - if (BIT(data, 4)) // MDS + if (BIT(data, 4)) // MDS m_number_lines += 8; switch((data >> 2) & 3) // MD2, MD3 @@ -323,14 +333,17 @@ void t6963c_device::set_md(u8 data) uint32_t t6963c_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { + int offs; bitmap.fill(0, cliprect); // Text layer - if (BIT(m_display_mode, 3)) + if (BIT(m_display_mode, 2)) + { + offs = m_text_home; for(int y=0; y<m_number_lines; y++) for(int x=0; x<m_text_area; x++) { - u8 c = m_display_ram->read_byte(m_text_home + y * m_number_cols + x); + u8 c = m_display_ram->read_byte(offs++); for(int cy=0; cy<8; cy++) { @@ -346,29 +359,31 @@ uint32_t t6963c_device::screen_update(screen_device &screen, bitmap_ind16 &bitma data = m_display_ram->read_byte(m_cgram_offset + c * 8 + cy); for(int cx=0; cx<m_font_size; cx++) - bitmap.pix16(y * 8 + cy, x * m_font_size + cx) = BIT(data, m_font_size - 1 - cx); + bitmap.pix(y * 8 + cy, x * m_font_size + cx) = BIT(data, m_font_size - 1 - cx); } } - + } // Graphic layer - if (BIT(m_display_mode, 2)) + if (BIT(m_display_mode, 3)) + { + offs = m_graphic_home; for(int y=0; y<m_number_lines*8; y++) for(int x=0; x<m_graphic_area; x++) { - u8 data = m_display_ram->read_byte(m_graphic_home + y * m_number_cols + x); + u8 data = m_display_ram->read_byte(offs++); for(int i=0; i<m_font_size; i++) { int pix = BIT(data, m_font_size - 1 - i); switch(m_mode & 7) { case 0: // OR - bitmap.pix16(y, x * m_font_size + i) |= pix; + bitmap.pix(y, x * m_font_size + i) |= pix; break; case 1: // EXOR - bitmap.pix16(y, x * m_font_size + i) ^= pix; + bitmap.pix(y, x * m_font_size + i) ^= pix; break; case 3: // AND - bitmap.pix16(y, x * m_font_size + i) &= pix; + bitmap.pix(y, x * m_font_size + i) &= pix; break; case 4: // Text attribute logerror("%s: Unimplemented Text attribute\n", machine().describe_context()); @@ -376,7 +391,7 @@ uint32_t t6963c_device::screen_update(screen_device &screen, bitmap_ind16 &bitma } } } - + } return 0; } @@ -405,8 +420,8 @@ void lm24014h_device::device_start() { save_item(NAME(m_fs)); - m_lcdc->set_md(4); // 8 lines x 40 columns - m_lcdc->set_fs(m_fs << 1); // font size 6x8 or 8x8 + m_lcdc->set_md(4); // 8 lines x 40 columns + m_lcdc->set_fs(m_fs << 1); // font size 6x8 or 8x8 } @@ -423,7 +438,7 @@ void lm24014h_device::ram_map(address_map &map) void lm24014h_device::lcd_palette(palette_device &palette) const { palette.set_pen_color(0, rgb_t(138, 146, 148)); - palette.set_pen_color(1, rgb_t(92, 83, 88)); + palette.set_pen_color(1, rgb_t(69, 62, 66)); } @@ -438,10 +453,10 @@ void lm24014h_device::device_add_mconfig(machine_config &config) m_lcdc->set_addrmap(0, &lm24014h_device::ram_map); screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD)); - screen.set_refresh_hz(50); + screen.set_refresh_hz(60); screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); screen.set_size(240, 64); - screen.set_visarea(0, 240-1, 0, 64-1); + screen.set_visarea_full(); screen.set_screen_update("lcdc", FUNC(t6963c_device::screen_update)); screen.set_palette("palette"); |