diff options
author | 2019-06-29 23:44:25 +0200 | |
---|---|---|
committer | 2019-06-29 23:44:25 +0200 | |
commit | 1bc2b0472856ce10a189c791bbbce66d0d6f9764 (patch) | |
tree | 02c415bd7dcc0059b9a2861967f44850d31276a2 /src/devices/video/t6963c.cpp | |
parent | 804fc3d1884ec450a47f878e1639ef511cfcd4cc (diff) |
tascr30: add display, inputs and SmartBoard. [Sandro Ronco]
Machines promoted to working
----------------------------
Tasc ChessSystem R30 [Sandro Ronco]
Diffstat (limited to 'src/devices/video/t6963c.cpp')
-rw-r--r-- | src/devices/video/t6963c.cpp | 197 |
1 files changed, 178 insertions, 19 deletions
diff --git a/src/devices/video/t6963c.cpp b/src/devices/video/t6963c.cpp index 0a07a1a7553..7e62d70c0e8 100644 --- a/src/devices/video/t6963c.cpp +++ b/src/devices/video/t6963c.cpp @@ -10,6 +10,9 @@ #include "emu.h" #include "t6963c.h" +//#define VERBOSE 1 +#include "logmacro.h" + //************************************************************************** // GLOBAL VARIABLES //************************************************************************** @@ -38,6 +41,16 @@ t6963c_device::t6963c_device(const machine_config &mconfig, const char *tag, dev , m_data(0) , m_adp(0) , m_auto_mode(auto_mode::NONE) + , m_graphic_home(0) + , m_text_home(0) + , m_graphic_area(0) + , m_text_area(0) + , m_cgram_offset(0) + , m_mode(0) + , m_display_mode(0) + , m_font_size(6) + , m_number_cols(40) + , m_number_lines(8) { } @@ -66,6 +79,16 @@ void t6963c_device::device_start() save_item(NAME(m_data)); save_item(NAME(m_adp)); save_item(NAME(m_auto_mode)); + save_item(NAME(m_graphic_home)); + save_item(NAME(m_text_home)); + save_item(NAME(m_graphic_area)); + save_item(NAME(m_text_area)); + save_item(NAME(m_cgram_offset)); + save_item(NAME(m_mode)); + save_item(NAME(m_display_mode)); + save_item(NAME(m_font_size)); + save_item(NAME(m_number_cols)); + save_item(NAME(m_number_lines)); } @@ -76,6 +99,15 @@ void t6963c_device::device_start() void t6963c_device::device_reset() { m_auto_mode = auto_mode::NONE; + m_data = 0; + m_adp = 0; + m_graphic_home = 0; + m_text_home = 0; + m_graphic_area = 0; + m_text_area = 0; + m_cgram_offset = 0; + m_mode = 0; + m_display_mode = 0; } @@ -105,11 +137,11 @@ void t6963c_device::write(offs_t offset, u8 data) // Data register if (m_auto_mode == auto_mode::WRITE) { - logerror("%s: Auto write %02X to %04X\n", machine().describe_context(), data, m_adp); + LOG("%s: Auto write %02X to %04X\n", machine().describe_context(), data, m_adp); m_display_ram->write_byte(m_adp++, data); } else - m_data = (u16(data) << 8) | (data >> 8); + m_data = (u16(data) << 8) | (m_data >> 8); } } @@ -129,14 +161,16 @@ void t6963c_device::do_command(u8 cmd) break; case 0x02: - logerror("%s: Setting offset register for CG RAM at %04X to %04XH\n", + LOG("%s: Setting offset register for CG RAM at %04X to %04XH\n", machine().describe_context(), (m_data & 0x1f) << 11, (m_data & 0x1f) << 11 | 0x7ff); + + m_cgram_offset = (m_data & 0x1f) << 11; break; case 0x04: - logerror("%s: Setting address pointer = %04X\n", machine().describe_context(), m_data); + LOG("%s: Setting address pointer = %04X\n", machine().describe_context(), m_data); m_adp = m_data; break; @@ -147,37 +181,51 @@ void t6963c_device::do_command(u8 cmd) } else if ((cmd & 0xfd) == 0x40) { - logerror("%s: Setting %s home address = %04X\n", machine().describe_context(), + LOG("%s: Setting %s home address = %04X\n", machine().describe_context(), BIT(cmd, 1) ? "graphic" : "text", m_data); + + if (BIT(cmd, 1)) + m_graphic_home = m_data; + else + m_text_home = m_data; } else if ((cmd & 0xfd) == 0x41) { - logerror("%s: Setting %s area = %d columns\n", machine().describe_context(), + LOG("%s: Setting %s area = %d columns\n", machine().describe_context(), BIT(cmd, 1) ? "graphic" : "text", m_data); + + + if (BIT(cmd, 1)) + m_graphic_area = m_data; + else + m_text_area = m_data; } else if ((cmd & 0xf0) == 0x80) { - logerror("%s: %s mode, %s\n", machine().describe_context(), + LOG("%s: %s mode, %s\n", machine().describe_context(), (cmd & 0x07) == 0x00 ? "OR" : (cmd & 0x07) == 0x01 ? "EXOR" : (cmd & 0x07) == 0x03 ? "AND" : (cmd & 0x07) == 0x04 ? "Text attribute" : "Unknown", BIT(cmd, 3) ? "external CG RAM" : "internal CG ROM"); + + m_mode = cmd & 0x0f; } else if ((cmd & 0xf0) == 0x90) { if (cmd == 0x90) - logerror("%s: Display off\n", machine().describe_context()); + LOG("%s: Display off\n", machine().describe_context()); else - logerror("%s: Text %s, graphic %s, cursor %s, blink %s\n", + LOG("%s: Text %s, graphic %s, cursor %s, blink %s\n", machine().describe_context(), BIT(cmd, 3) ? "on" : "off", BIT(cmd, 2) ? "on" : "off", BIT(cmd, 1) ? "on" : "off", BIT(cmd, 0) ? "on" : "off"); + m_display_mode = cmd & 0x0f; } else if ((cmd & 0xf8) == 0xa0) { @@ -185,20 +233,19 @@ void t6963c_device::do_command(u8 cmd) } else if ((cmd & 0xfe) == 0xb0) { - logerror("%s: Set data auto %s\n", machine().describe_context(), BIT(cmd, 0) ? "read" : "write"); + LOG("%s: Set data auto %s\n", machine().describe_context(), BIT(cmd, 0) ? "read" : "write"); m_auto_mode = BIT(cmd, 0) ? auto_mode::READ : auto_mode::WRITE; } else if (cmd == 0xb2) { - logerror("%s: Auto reset\n", machine().describe_context()); + LOG("%s: Auto reset\n", machine().describe_context()); m_auto_mode = auto_mode::NONE; } else if ((cmd & 0xf0) == 0xc0) { if (BIT(cmd, 0)) { - logerror("%s: Read data from %04X and %s ADP\n", machine().describe_context(), - BIT(cmd, 0) ? "read" : "write", + LOG("%s: Read data from %04X and %s ADP\n", machine().describe_context(), m_adp, (cmd & 0x0e) == 0x00 ? "increment" : (cmd & 0x0e) == 0x02 ? "decrement" @@ -207,7 +254,7 @@ void t6963c_device::do_command(u8 cmd) } else { - logerror("%s: Write %02X to %04X and %s ADP\n", machine().describe_context(), + LOG("%s: Write %02X to %04X and %s ADP\n", machine().describe_context(), m_data >> 8, m_adp, (cmd & 0x0e) == 0x00 ? "increment" @@ -216,11 +263,12 @@ void t6963c_device::do_command(u8 cmd) : "invalid"); m_display_ram->write_byte(m_adp, m_data >> 8); - if ((cmd & 0x0e) == 0x00) - ++m_adp; - else if ((cmd & 0x0e) == 0x02) - --m_adp; } + + if ((cmd & 0x0e) == 0x00) + ++m_adp; + else if ((cmd & 0x0e) == 0x02) + --m_adp; } else if (cmd == 0xe0) { @@ -232,9 +280,17 @@ void t6963c_device::do_command(u8 cmd) } else if ((cmd & 0xf0) == 0xf0) { - logerror("%s: %s bit %d\n", machine().describe_context(), + LOG("%s: %s bit %d\n", machine().describe_context(), BIT(cmd, 3) ? "Set" : "Reset", cmd & 0x07); + + u8 data = m_display_ram->read_byte(m_adp); + if (BIT(cmd, 3)) + data |= 1 << (cmd & 0x07); + else + data &= ~(1 << (cmd & 0x07)); + + m_display_ram->write_byte(m_adp, data); } else { @@ -242,6 +298,88 @@ void t6963c_device::do_command(u8 cmd) } } +void t6963c_device::set_fs(u8 data) +{ + m_font_size = 8 - (data & 3); +} + +void t6963c_device::set_md(u8 data) +{ + // MD0, MD1 + m_number_lines = 8 - (data & 3) * 2; + + if (BIT(data, 4)) // MDS + m_number_lines += 8; + + switch((data >> 2) & 3) // MD2, MD3 + { + case 0: m_number_cols = 32; break; + case 1: m_number_cols = 40; break; + case 2: m_number_cols = 64; break; + case 3: m_number_cols = 80; break; + } +} + + +uint32_t t6963c_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + bitmap.fill(0, cliprect); + + // Text layer + if (BIT(m_display_mode, 3)) + 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); + + for(int cy=0; cy<8; cy++) + { + u8 data; + if (!BIT(m_mode, 3)) + { + if (c < 0x80) + data = m_cgrom[c * 8 + cy]; + else + data = m_display_ram->read_byte(m_cgram_offset + (c & 0x7f) * 8 + cy); + } + else + 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); + } + } + + // Graphic layer + if (BIT(m_display_mode, 2)) + 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); + 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; + break; + case 1: // EXOR + bitmap.pix16(y, x * m_font_size + i) ^= pix; + break; + case 3: // AND + bitmap.pix16(y, x * m_font_size + i) &= pix; + break; + case 4: // Text attribute + logerror("%s: Unimplemented Text attribute\n", machine().describe_context()); + break; + } + } + } + + return 0; +} + //************************************************************************** // T6963C-BASED LCD UNITS @@ -254,6 +392,7 @@ void t6963c_device::do_command(u8 cmd) lm24014h_device::lm24014h_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, LM24014H, tag, owner, clock) , m_lcdc(*this, "lcdc") + , m_fs(1) { } @@ -264,6 +403,10 @@ lm24014h_device::lm24014h_device(const machine_config &mconfig, const char *tag, 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 } @@ -277,6 +420,12 @@ void lm24014h_device::ram_map(address_map &map) map(0x0000, 0x1fff).ram(); // TC5564AFL-15 } +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)); +} + //------------------------------------------------- // device_add_mconfig - add device-specific @@ -287,6 +436,16 @@ void lm24014h_device::device_add_mconfig(machine_config &config) { T6963C(config, m_lcdc, 0); // XTAL is unknown 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_vblank_time(ATTOSECONDS_IN_USEC(2500)); + screen.set_size(240, 64); + screen.set_visarea(0, 240-1, 0, 64-1); + screen.set_screen_update("lcdc", FUNC(t6963c_device::screen_update)); + screen.set_palette("palette"); + + PALETTE(config, "palette", FUNC(lm24014h_device::lcd_palette), 2); } |