lc7582: correct com/seg positions on 1/2 duty,

scprof: add lcd outputs
This commit is contained in:
hap 2024-02-19 13:44:27 +01:00
parent e256ef03f5
commit f6d4240626
7 changed files with 122 additions and 50 deletions

View File

@ -2,11 +2,12 @@
// copyright-holders:hap
/*
Sanyo LC7582 LCD Driver
Sanyo LC7580 LCD Driver
53 outputs (static), or 106 outputs (1/2 duty)
53 outputs (static), or 104 outputs (1/2 duty)
TODO:
- any difference between LC7580 and LC7582?
- OSC pin (input is R/C)
- AD/DSP function
@ -16,23 +17,32 @@ TODO:
#include "video/lc7582.h"
DEFINE_DEVICE_TYPE(LC7580, lc7580_device, "lc7580", "Sanyo LC7580 LCD Driver")
DEFINE_DEVICE_TYPE(LC7582, lc7582_device, "lc7582", "Sanyo LC7582 LCD Driver")
//-------------------------------------------------
// constructor
//-------------------------------------------------
lc7582_device::lc7582_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
device_t(mconfig, LC7582, tag, owner, clock),
lc7580_device::lc7580_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) :
device_t(mconfig, type, tag, owner, clock),
m_write_segs(*this)
{ }
lc7580_device::lc7580_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
lc7580_device(mconfig, LC7580, tag, owner, clock)
{ }
lc7582_device::lc7582_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
lc7580_device(mconfig, LC7582, tag, owner, clock)
{ }
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void lc7582_device::device_start()
void lc7580_device::device_start()
{
// zerofill
m_data = 0;
@ -60,13 +70,27 @@ void lc7582_device::device_start()
// handlers
//-------------------------------------------------
void lc7582_device::refresh_output()
void lc7580_device::refresh_output()
{
m_write_segs(0, m_blank ? 0 : m_latch[0]);
m_write_segs(1, (m_blank || !m_duty) ? 0 : m_latch[1]);
if (m_duty)
{
u64 segs[2] = { 0, 0 };
// COM1 on even bits, COM2 on uneven bits
for (int i = 0; i < 104; i++)
segs[i & 1] |= BIT(m_latch[i / 52], i % 52) << (i >> 1);
for (int i = 0; i < 2; i++)
m_write_segs(i, m_blank ? 0 : segs[i]);
}
else
{
m_write_segs(0, m_blank ? 0 : m_latch[0]);
m_write_segs(1, 0);
}
}
void lc7582_device::clk_w(int state)
void lc7580_device::clk_w(int state)
{
state = (state) ? 1 : 0;
@ -77,7 +101,7 @@ void lc7582_device::clk_w(int state)
m_clk = state;
}
void lc7582_device::ce_w(int state)
void lc7580_device::ce_w(int state)
{
state = (state) ? 1 : 0;
@ -86,7 +110,7 @@ void lc7582_device::ce_w(int state)
{
// d53: DP (drive mode select, aka duty)
// d54: DQ (AD/DSP function)
// d55: commons
// d55: latch select
if (!BIT(m_shift, 55))
{
m_duty = BIT(m_shift, 53);

View File

@ -2,7 +2,7 @@
// copyright-holders:hap
/*
Sanyo LC7582 LCD Driver
Sanyo LC7580 LCD Driver
*/
@ -31,10 +31,10 @@ pin desc
*/
class lc7582_device : public device_t
class lc7580_device : public device_t
{
public:
lc7582_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
lc7580_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
// configuration helpers
auto write_segs() { return m_write_segs.bind(); } // S pins, COM1/COM2 in offset
@ -45,7 +45,9 @@ public:
void inh_w(int state) { m_blank = bool(state); refresh_output(); }
protected:
// device-level overrides
lc7580_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
// device_t implementation
virtual void device_start() override;
private:
@ -65,7 +67,14 @@ private:
devcb_write64 m_write_segs;
};
class lc7582_device : public lc7580_device
{
public:
lc7582_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
};
DECLARE_DEVICE_TYPE(LC7580, lc7580_device)
DECLARE_DEVICE_TYPE(LC7582, lc7582_device)
#endif // MAME_VIDEO_LC7582_H

View File

@ -12,7 +12,7 @@ This engine was also used in the newer Mephisto Modena.
Hardware notes:
- R65C02P4 @ 4MHz
- 32KB ROM, 8KB RAM battery-backed
- Sanyo LC7582, 2 LCD panels (each 4-digit)
- Sanyo LC7582, 2 LCD panels (each 4-digit, some unused segments)
- TTL, piezo, 8*8+8 LEDs, button sensors
Sphinx Commander also uses the Dominator program, and is on similar hardware,
@ -27,8 +27,8 @@ Sphinx Galaxy is on similar hardware too, with less leds.
#include "machine/nvram.h"
#include "machine/sensorboard.h"
#include "sound/dac.h"
#include "video/pwm.h"
#include "video/lc7582.h"
#include "video/pwm.h"
#include "speaker.h"
@ -46,13 +46,13 @@ public:
dominator_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_board(*this, "board"),
m_lcd(*this, "lcd"),
m_display(*this, "display"),
m_board(*this, "board"),
m_dac(*this, "dac"),
m_inputs(*this, "IN.%u", 0),
m_out_digit(*this, "digit%u", 0U),
m_out_lcd(*this, "lcd%u.%u", 0U, 0U)
m_out_lcd(*this, "s%u.%u", 0U, 0U)
{ }
// machine configs
@ -66,13 +66,13 @@ protected:
private:
// devices/pointers
required_device<cpu_device> m_maincpu;
required_device<sensorboard_device> m_board;
required_device<lc7582_device> m_lcd;
required_device<pwm_display_device> m_display;
required_device<sensorboard_device> m_board;
required_device<dac_bit_interface> m_dac;
required_ioport_array<2> m_inputs;
output_finder<8> m_out_digit;
output_finder<2, 53> m_out_lcd;
output_finder<2, 52> m_out_lcd;
// address maps
void dominator_map(address_map &map);
@ -101,23 +101,29 @@ void dominator_state::machine_start()
void dominator_state::lcd_s_w(offs_t offset, u64 data)
{
u8 d[4];
// 1st digit: S1-S9, unused middle vertical segments
// 2nd digit: S10-S18, unused bottom-right diagonal segment, colon at S17
// 3rd digit: S21-S27
// 4th digit: S28-S34
d[0] = bitswap<9>(data >> 0 & 0x1ff, 2,7,5,4,3,1,0,8,6) & 0x7f;
d[1] = bitswap<9>(data >> 9 & 0x1ff, 7,6,4,2,0,8,5,3,1) & 0x7f;
d[2] = bitswap<7>(data >> 20 & 0x7f, 3,5,1,0,2,6,4);
d[3] = bitswap<7>(data >> 27 & 0x7f, 4,2,0,6,5,3,1);
for (int i = 0; i < 4; i++)
m_out_digit[offset * 4 + i] = d[i];
// output individual segments
for (int i = 0; i < 53; i++)
for (int i = 0; i < 52; i++)
m_out_lcd[offset][i] = BIT(data, i);
// unscramble digit 7segs
static u8 seg2digit[4*7] =
{
0x03, 0x04, 0x00, 0x40, 0x41, 0x02, 0x42,
0x05, 0x06, 0x07, 0x48, 0x44, 0x45, 0x46,
0x0c, 0x0d, 0x0b, 0x0a, 0x4a, 0x4c, 0x4b,
0x0e, 0x0f, 0x10, 0x50, 0x4d, 0x4e, 0x4f
};
for (int i = 0; i < 8; i++)
{
u8 digit = 0;
for (int seg = 0; seg < 7; seg++)
{
u8 bit = seg2digit[7 * (i & 3) + seg] + 26 * (i >> 2);
digit |= m_out_lcd[BIT(bit, 6)][bit & 0x3f] << seg;
}
m_out_digit[i] = digit;
}
}

View File

@ -18,7 +18,6 @@ Hardware notes:
- 8*8 chessboard buttons, 16 LEDs, piezo
TODO:
- add lcd
- internal artwork
*******************************************************************************/
@ -28,8 +27,10 @@ TODO:
#include "cpu/m6800/m6801.h"
#include "machine/sensorboard.h"
#include "sound/dac.h"
#include "video/lc7582.h"
#include "video/pwm.h"
#include "screen.h"
#include "speaker.h"
// internal artwork
@ -45,9 +46,11 @@ public:
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_board(*this, "board"),
m_lcd(*this, "lcd"),
m_display(*this, "display"),
m_dac(*this, "dac"),
m_inputs(*this, "IN.%u", 0)
m_inputs(*this, "IN.%u", 0),
m_out_lcd(*this, "s%u.%u", 0U, 0U)
{ }
void professor(machine_config &config);
@ -61,13 +64,16 @@ private:
// devices/pointers
required_device<hd6301y0_cpu_device> m_maincpu;
required_device<sensorboard_device> m_board;
required_device<lc7580_device> m_lcd;
required_device<pwm_display_device> m_display;
required_device<dac_bit_interface> m_dac;
required_ioport_array<3> m_inputs;
output_finder<2, 52> m_out_lcd;
u16 m_inp_mux = 0;
// I/O handlers
void lcd_s_w(offs_t offset, u64 data);
template <int N> void leds_w(u8 data);
void control_w(u8 data);
u8 input_r();
@ -76,6 +82,9 @@ private:
void professor_state::machine_start()
{
m_out_lcd.resolve();
// register for savestates
save_item(NAME(m_inp_mux));
}
@ -92,6 +101,12 @@ INPUT_CHANGED_MEMBER(professor_state::on_button)
m_maincpu->pulse_input_line(INPUT_LINE_RESET, attotime::zero);
}
void professor_state::lcd_s_w(offs_t offset, u64 data)
{
for (int i = 0; i < 52; i++)
m_out_lcd[offset][i] = BIT(data, i);
}
template <int N>
void professor_state::leds_w(u8 data)
{
@ -106,6 +121,13 @@ void professor_state::control_w(u8 data)
// P23: speaker out
m_dac->write(BIT(data, 3));
// P24: LC7580 DATA
// P25: LC7580 CLK
// P26: LC7580 CE
m_lcd->data_w(BIT(data, 4));
m_lcd->clk_w(BIT(data, 5));
m_lcd->ce_w(BIT(data, 6));
}
u8 professor_state::input_r()
@ -192,6 +214,14 @@ void professor_state::professor(machine_config &config)
//m_board->set_nvram_enable(true);
// video hardware
LC7580(config, m_lcd, 0);
m_lcd->write_segs().set(FUNC(professor_state::lcd_s_w));
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_SVG));
screen.set_refresh_hz(60);
screen.set_size(1920/4, 977/4);
screen.set_visarea_full();
PWM_DISPLAY(config, m_display).set_size(2, 8);
//config.set_default_layout(layout_cxg_professor);
@ -209,6 +239,9 @@ void professor_state::professor(machine_config &config)
ROM_START( scprof )
ROM_REGION( 0x4000, "maincpu", 0 )
ROM_LOAD("1988_107_newcrest_hd6301y0j76p", 0x0000, 0x4000, CRC(681456c7) SHA1(99f8ab7369dbc2c93335affc38838295a8a2c5f3) )
ROM_REGION( 100000, "screen", 0 )
ROM_LOAD("scprof.svg", 0, 100000, NO_DUMP )
ROM_END
} // anonymous namespace

View File

@ -325,8 +325,8 @@ authors:hap
<element name="digit2" ref="digit"><bounds x="43.0" y="91" width="4" height="6" /></element>
<element name="digit3" ref="digit"><bounds x="47.5" y="91" width="4" height="6" /></element>
<element name="lcd0.16" ref="ldot"><bounds xc="42.45" yc="92.25" width="0.6" height="0.6" /></element>
<element name="lcd0.16" ref="ldot"><bounds xc="42.15" yc="95.65" width="0.6" height="0.6" /></element>
<element name="s0.8" ref="ldot"><bounds xc="42.45" yc="92.25" width="0.6" height="0.6" /></element>
<element name="s0.8" ref="ldot"><bounds xc="42.15" yc="95.65" width="0.6" height="0.6" /></element>
</group>
<group name="lcd2">
@ -337,8 +337,8 @@ authors:hap
<element name="digit6" ref="digit"><bounds x="43.0" y="91" width="4" height="6" /></element>
<element name="digit7" ref="digit"><bounds x="47.5" y="91" width="4" height="6" /></element>
<element name="lcd1.16" ref="ldot"><bounds xc="42.45" yc="92.25" width="0.6" height="0.6" /></element>
<element name="lcd1.16" ref="ldot"><bounds xc="42.15" yc="95.65" width="0.6" height="0.6" /></element>
<element name="s0.34" ref="ldot"><bounds xc="42.45" yc="92.25" width="0.6" height="0.6" /></element>
<element name="s0.34" ref="ldot"><bounds xc="42.15" yc="95.65" width="0.6" height="0.6" /></element>
</group>

View File

@ -377,8 +377,8 @@ authors:hap
<element name="digit2" ref="digit"><bounds x="43.0" y="91" width="4" height="6" /></element>
<element name="digit3" ref="digit"><bounds x="47.5" y="91" width="4" height="6" /></element>
<element name="lcd0.16" ref="ldot"><bounds xc="42.45" yc="92.25" width="0.6" height="0.6" /></element>
<element name="lcd0.16" ref="ldot"><bounds xc="42.15" yc="95.65" width="0.6" height="0.6" /></element>
<element name="s0.8" ref="ldot"><bounds xc="42.45" yc="92.25" width="0.6" height="0.6" /></element>
<element name="s0.8" ref="ldot"><bounds xc="42.15" yc="95.65" width="0.6" height="0.6" /></element>
</group>
<group name="lcd2">
@ -389,8 +389,8 @@ authors:hap
<element name="digit6" ref="digit"><bounds x="43.0" y="91" width="4" height="6" /></element>
<element name="digit7" ref="digit"><bounds x="47.5" y="91" width="4" height="6" /></element>
<element name="lcd1.16" ref="ldot"><bounds xc="42.45" yc="92.25" width="0.6" height="0.6" /></element>
<element name="lcd1.16" ref="ldot"><bounds xc="42.15" yc="95.65" width="0.6" height="0.6" /></element>
<element name="s0.34" ref="ldot"><bounds xc="42.45" yc="92.25" width="0.6" height="0.6" /></element>
<element name="s0.34" ref="ldot"><bounds xc="42.15" yc="95.65" width="0.6" height="0.6" /></element>
</group>

View File

@ -365,8 +365,8 @@ authors:hap
<element name="digit2" ref="digit"><bounds x="43.0" y="91" width="4" height="6" /></element>
<element name="digit3" ref="digit"><bounds x="47.5" y="91" width="4" height="6" /></element>
<element name="lcd0.16" ref="ldot"><bounds xc="42.45" yc="92.25" width="0.6" height="0.6" /></element>
<element name="lcd0.16" ref="ldot"><bounds xc="42.15" yc="95.65" width="0.6" height="0.6" /></element>
<element name="s0.8" ref="ldot"><bounds xc="42.45" yc="92.25" width="0.6" height="0.6" /></element>
<element name="s0.8" ref="ldot"><bounds xc="42.15" yc="95.65" width="0.6" height="0.6" /></element>
</group>
<group name="lcd2">
@ -377,8 +377,8 @@ authors:hap
<element name="digit6" ref="digit"><bounds x="43.0" y="91" width="4" height="6" /></element>
<element name="digit7" ref="digit"><bounds x="47.5" y="91" width="4" height="6" /></element>
<element name="lcd1.16" ref="ldot"><bounds xc="42.45" yc="92.25" width="0.6" height="0.6" /></element>
<element name="lcd1.16" ref="ldot"><bounds xc="42.15" yc="95.65" width="0.6" height="0.6" /></element>
<element name="s0.34" ref="ldot"><bounds xc="42.45" yc="92.25" width="0.6" height="0.6" /></element>
<element name="s0.34" ref="ldot"><bounds xc="42.15" yc="95.65" width="0.6" height="0.6" /></element>
</group>