From 3e867504c1f13b0a0e24f9c9428e7ca8539dcd23 Mon Sep 17 00:00:00 2001 From: hap Date: Fri, 10 Mar 2017 16:44:07 +0100 Subject: added hlcd0538 device (nw) --- scripts/src/video.lua | 12 ++++++ scripts/target/mame/arcade.lua | 1 + scripts/target/mame/mess.lua | 1 + src/devices/video/hlcd0515.cpp | 12 +----- src/devices/video/hlcd0515.h | 2 - src/devices/video/hlcd0538.cpp | 96 ++++++++++++++++++++++++++++++++++++++++++ src/devices/video/hlcd0538.h | 85 +++++++++++++++++++++++++++++++++++++ src/mame/drivers/novag6502.cpp | 19 +++++---- 8 files changed, 207 insertions(+), 21 deletions(-) create mode 100644 src/devices/video/hlcd0538.cpp create mode 100644 src/devices/video/hlcd0538.h diff --git a/scripts/src/video.lua b/scripts/src/video.lua index 57067922935..93e8fad6f6d 100644 --- a/scripts/src/video.lua +++ b/scripts/src/video.lua @@ -352,6 +352,18 @@ if (VIDEOS["HLCD0515"]~=null) then } end +-------------------------------------------------- +-- +--@src/devices/video/hlcd0538.h,VIDEOS["HLCD0538"] = true +-------------------------------------------------- + +if (VIDEOS["HLCD0538"]~=null) then + files { + MAME_DIR .. "src/devices/video/hlcd0538.cpp", + MAME_DIR .. "src/devices/video/hlcd0538.h", + } +end + -------------------------------------------------- -- --@src/devices/video/huc6202.h,VIDEOS["HUC6202"] = true diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index 2256c3cef5c..53e60f88060 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -300,6 +300,7 @@ VIDEOS["HD61830"] = true VIDEOS["HD63484"] = true --VIDEOS["HD66421"] = true --VIDEOS["HLCD0515"] = true +--VIDEOS["HLCD0538"] = true VIDEOS["HUC6202"] = true VIDEOS["HUC6260"] = true --VIDEOS["HUC6261"] = true diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index 551df68eabe..8ddf2274646 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -300,6 +300,7 @@ VIDEOS["HD61830"] = true --VIDEOS+= HD63484"] = true VIDEOS["HD66421"] = true VIDEOS["HLCD0515"] = true +VIDEOS["HLCD0538"] = true VIDEOS["HUC6202"] = true VIDEOS["HUC6260"] = true VIDEOS["HUC6261"] = true diff --git a/src/devices/video/hlcd0515.cpp b/src/devices/video/hlcd0515.cpp index 04bf4f72e60..2f691eb839d 100644 --- a/src/devices/video/hlcd0515.cpp +++ b/src/devices/video/hlcd0515.cpp @@ -85,16 +85,6 @@ void hlcd0515_device::device_start() -//------------------------------------------------- -// device_reset - device-specific reset -//------------------------------------------------- - -void hlcd0515_device::device_reset() -{ -} - - - //------------------------------------------------- // device_timer - handler timer events //------------------------------------------------- @@ -105,7 +95,7 @@ void hlcd0515_device::device_timer(emu_timer &timer, device_timer_id id, int par m_rowout = 0; // write to COL/ROW pins - m_write_cols(m_rowout, m_blank ? 0 : m_ram[m_rowout], 0xffffffff); + m_write_cols(m_rowout, m_blank ? 0 : m_ram[m_rowout], ~0); m_rowout++; } diff --git a/src/devices/video/hlcd0515.h b/src/devices/video/hlcd0515.h index e10dbe8b308..899ed199576 100644 --- a/src/devices/video/hlcd0515.h +++ b/src/devices/video/hlcd0515.h @@ -10,7 +10,6 @@ #define _HLCD0515_H_ - // COL/ROW pins (offset for ROW) #define MCFG_HLCD0515_WRITE_COLS_CB(_devcb) \ devcb = &hlcd0515_device::set_write_cols_callback(*device, DEVCB_##_devcb); @@ -68,7 +67,6 @@ public: protected: // device-level overrides virtual void device_start() override; - virtual void device_reset() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; virtual void set_control(); diff --git a/src/devices/video/hlcd0538.cpp b/src/devices/video/hlcd0538.cpp new file mode 100644 index 00000000000..153a6870679 --- /dev/null +++ b/src/devices/video/hlcd0538.cpp @@ -0,0 +1,96 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/* + + Hughes HLCD 0538(A)/0539(A) LCD Driver + + 0538: 8 rows, 26 columns + 0539: 0 rows, 34 columns + + TODO: + - LCD pin + - the only difference between 0538/0539 is row pins voltage levels? + +*/ + +#include "emu.h" +#include "video/hlcd0538.h" + + +const device_type HLCD0538 = device_creator; +const device_type HLCD0539 = device_creator; + +//------------------------------------------------- +// constructor +//------------------------------------------------- + +hlcd0538_device::hlcd0538_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, const char *shortname, const char *source) + : device_t(mconfig, type, name, tag, owner, clock, shortname, source), + m_write_cols(*this) +{ +} + +hlcd0538_device::hlcd0538_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : hlcd0538_device(mconfig, HLCD0538, "HLCD 0538 LCD Driver", tag, owner, clock, "hlcd0538", __FILE__) +{ +} + +hlcd0539_device::hlcd0539_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : hlcd0538_device(mconfig, HLCD0539, "HLCD 0539 LCD Driver", tag, owner, clock, "hlcd0539", __FILE__) +{ +} + + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void hlcd0538_device::device_start() +{ + // resolve callbacks + m_write_cols.resolve_safe(); + + // zerofill + m_int = 0; + m_clk = 0; + m_data = 0; + m_shift = 0; + + // register for savestates + save_item(NAME(m_int)); + save_item(NAME(m_clk)); + save_item(NAME(m_data)); + save_item(NAME(m_shift)); +} + + + +//------------------------------------------------- +// handlers +//------------------------------------------------- + +WRITE_LINE_MEMBER(hlcd0538_device::write_clk) +{ + state = (state) ? 1 : 0; + + // clock in data on falling edge + if (!state && m_clk) + m_shift = (m_shift << 1 | m_data) & u64(0x3ffffffff); + + m_clk = state; +} + +WRITE_LINE_MEMBER(hlcd0538_device::write_int) +{ + state = (state) ? 1 : 0; + + // transfer to latches on rising edge + if (state && !m_int) + { + m_write_cols(0, m_shift, ~0); + m_shift = 0; + } + + m_int = state; +} diff --git a/src/devices/video/hlcd0538.h b/src/devices/video/hlcd0538.h new file mode 100644 index 00000000000..462a1662792 --- /dev/null +++ b/src/devices/video/hlcd0538.h @@ -0,0 +1,85 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/* + + Hughes HLCD 0538(A)/0539(A) LCD Driver + +*/ + +#ifndef _HLCD0538_H_ +#define _HLCD0538_H_ + + +// C/R pins (0538: d0-d7 for rows) +#define MCFG_HLCD0538_WRITE_COLS_CB(_devcb) \ + devcb = &hlcd0538_device::set_write_cols_callback(*device, DEVCB_##_devcb); + + +// pinout reference + +/* + ____ ____ + +V 1 |* \_/ | 40 R 1 + DATA IN 2 | | 39 R 2 + CLK 3 | | 38 R 3 + LCD0 4 | | 37 R 4 + GND 5 | | 36 R 5 + INTERRUPT 6 | | 35 R 6 + C 26 7 | | 34 R 7 + C 25 8 | | 33 R 8 + C 24 9 | | 32 C 1 + C 23 10 | HLCD 0538 | 31 C 2 + C 22 11 | | 30 C 3 + C 21 12 | | 29 C 4 + C 20 13 | | 28 C 5 + C 19 14 | | 27 C 6 + C 18 15 | | 26 C 7 + C 17 16 | | 25 C 8 + C 16 17 | | 24 C 9 + C 15 18 | | 23 C 10 + C 14 19 | | 22 C 11 + C 13 20 |___________| 21 C 12 + + HLCD 0539 has 8 more C pins(1-8) in place of R pins. +*/ + +class hlcd0538_device : public device_t +{ +public: + hlcd0538_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + hlcd0538_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, u32 clock, const char *shortname, const char *source); + + // static configuration helpers + template static devcb_base &set_write_cols_callback(device_t &device, Object &&object) { return downcast(device).m_write_cols.set_callback(std::forward(object)); } + + DECLARE_WRITE_LINE_MEMBER(write_clk); + DECLARE_WRITE_LINE_MEMBER(write_int); + DECLARE_WRITE_LINE_MEMBER(write_data) { m_data = (state) ? 1 : 0; } + +protected: + // device-level overrides + virtual void device_start() override; + + int m_int; // input pin state + int m_clk; // " + int m_data; // " + u64 m_shift; + + // callbacks + devcb_write64 m_write_cols; +}; + + +class hlcd0539_device : public hlcd0538_device +{ +public: + hlcd0539_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); +}; + + + +extern const device_type HLCD0538; +extern const device_type HLCD0539; + + +#endif /* _HLCD0538_H_ */ diff --git a/src/mame/drivers/novag6502.cpp b/src/mame/drivers/novag6502.cpp index dcfccf9c087..f7c505dcc43 100644 --- a/src/mame/drivers/novag6502.cpp +++ b/src/mame/drivers/novag6502.cpp @@ -11,7 +11,7 @@ such as Arena(in editmode). TODO: - - cforte lcd(chip unknown), and ACIA? + - cforte ACIA? - verify supercon/cforte IRQ and beeper frequency - sforte irq active time (21.5us is too long) - sforte/sexpert led handling is correct? @@ -31,7 +31,7 @@ Super Constellation Chess Computer (model 844): Constellation Forte: - 65C02 @ 5MHz - 4KB RAM, 64KB ROM -- 10-digit 7seg LCD display +- HLCD0538P, 10-digit 7seg LCD display - TTL, 18 LEDs, 8*8 chessboard buttons When it was first added to MAME as skeleton driver in mmodular.c, this romset @@ -63,6 +63,7 @@ instead of magnet sensors. #include "cpu/m6502/m65c02.h" #include "machine/mos6551.h" #include "machine/nvram.h" +#include "video/hlcd0538.h" #include "screen.h" #include "speaker.h" @@ -77,9 +78,12 @@ class novag6502_state : public novagbase_state { public: novag6502_state(const machine_config &mconfig, device_type type, const char *tag) - : novagbase_state(mconfig, type, tag) + : novagbase_state(mconfig, type, tag), + m_hlcd0538(*this, "hlcd0538") { } + optional_device m_hlcd0538; + TIMER_DEVICE_CALLBACK_MEMBER(irq_on) { m_maincpu->set_input_line(M6502_IRQ_LINE, ASSERT_LINE); } TIMER_DEVICE_CALLBACK_MEMBER(irq_off) { m_maincpu->set_input_line(M6502_IRQ_LINE, CLEAR_LINE); } @@ -339,10 +343,9 @@ READ8_MEMBER(novag6502_state::supercon_input2_r) WRITE8_MEMBER(novag6502_state::cforte_control_w) { - // TODO: unknown lcd at d0-d3, clocks it 34 times with rowselect in lower bits // d0: lcd data - // d1: lcd clock - // d2: lcd cs + // d1: lcd clk + // d2: lcd interrupt // d3: unused? m_lcd_control = data; @@ -845,7 +848,7 @@ static MACHINE_CONFIG_START( cforte, novag6502_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M65C02, 5000000) // 5MHz - MCFG_CPU_PERIODIC_INT_DRIVER(novag6502_state, irq0_line_hold, 256) // guessed + MCFG_CPU_PERIODIC_INT_DRIVER(novag6502_state, irq0_line_hold, 256) // approximation MCFG_CPU_PROGRAM_MAP(cforte_map) MCFG_NVRAM_ADD_1FILL("nvram") @@ -855,7 +858,7 @@ static MACHINE_CONFIG_START( cforte, novag6502_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_SOUND_ADD("beeper", BEEP, 1024) // guessed + MCFG_SOUND_ADD("beeper", BEEP, 1024) // 1024Hz (measured from video reference) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END -- cgit v1.2.3