mame/src/devices/video/dl1416.h
Vas Crabb b90b684cd4 dl1416: clean up, support signal-level interface better, support
variants better

sitcom: implement Boot and Reset buttons, implement remapping of low
32kB, hook up PIA, implement I/O space mirrors, hook up RS232 interface
for downloading programs, add a software list with two example programs.

(nw) sitcom software list isn't hooked up right, the file won't be fed
to the -bitb input if you run with the set name; you have to run like
mame sitcom -bitb roms/sitcom/san.zip/san.hex
2017-02-11 16:56:25 +11:00

116 lines
3.1 KiB
C++

// license:GPL-2.0+
// copyright-holders:Dirk Best, Vas Crabb
/*****************************************************************************
*
* DL1416
*
* 4-Digit 16-Segment Alphanumeric Intelligent Display
* with Memory/Decoder/Driver
*
* See video/dl1416.c for more info
*
****************************************************************************/
#ifndef MAME_DEVICES_VIDEO_DL1416_H
#define MAME_DEVICES_VIDEO_DL1416_H
/***************************************************************************
DEVICE TYPES
***************************************************************************/
extern device_type const DL1414T;
extern device_type const DL1416B;
extern device_type const DL1416T;
/***************************************************************************
DEVICE CONFIGURATION MACROS
***************************************************************************/
#define MCFG_DL1414_UPDATE_HANDLER(_devcb) \
devcb = &dl1414_device::set_update_handler(*device, DEVCB_##_devcb);
#define MCFG_DL1416_UPDATE_HANDLER(_devcb) \
devcb = &dl1416_device::set_update_handler(*device, DEVCB_##_devcb);
/***************************************************************************
TYPE DECLARATIONS
***************************************************************************/
class dl1414_device : public device_t
{
public:
template<typename Object> static devcb_base &set_update_handler(device_t &device, Object &&object)
{ return downcast<dl1414_device &>(device).m_update_cb.set_callback(std::forward<Object>(object)); }
// signal-level interface
DECLARE_WRITE_LINE_MEMBER(wr_w); // write strobe (rising edge)
DECLARE_WRITE_LINE_MEMBER(ce_w); // chip enable (active low)
void addr_w(uint8_t state);
void data_w(uint8_t state);
// bus interface - still requires cu_w to set cursor enable state
virtual DECLARE_WRITE8_MEMBER(bus_w);
protected:
dl1414_device(
machine_config const &mconfig,
device_type type,
char const *name,
char const *tag,
device_t *owner,
uint32_t clock,
char const *shortname,
char const *source);
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
void set_cursor_state(offs_t offset, bool state);
virtual uint16_t translate(u8 digit, bool cursor) const = 0;
private:
devcb_write16 m_update_cb;
// internal state
uint8_t m_digit_ram[4]; // holds the digit code for each position
bool m_cursor_state[4]; // holds the cursor state for each position
// input line state
bool m_wr_in;
bool m_ce_in;
uint8_t m_addr_in;
uint8_t m_data_in;
};
class dl1416_device : public dl1414_device
{
public:
DECLARE_WRITE_LINE_MEMBER(cu_w); // cursor enable (active low)
protected:
dl1416_device(
machine_config const &mconfig,
device_type type,
char const *name,
char const *tag,
device_t *owner,
uint32_t clock,
char const *shortname,
char const *source);
// device-level overrides
virtual void device_start() override;
bool cu_in() const { return m_cu_in; }
private:
// input line state
bool m_cu_in;
};
#endif // MAME_DEVICES_VIDEO_DL1416_H