1
/***************************************************************************
3
Intel 8279 Programmable Keyboard/Display Interface emulation
5
Copyright the MESS Team 2012.
6
Visit http://mamedev.org for licensing and usage restrictions.
8
****************************************************************************
29
Vss 20 |_____________| 21 CTRL/DATA
32
***************************************************************************/
43
/***************************************************************************
44
DEVICE CONFIGURATION MACROS
45
***************************************************************************/
47
#define MCFG_I8279_ADD(_tag, _clock, _config) \
48
MCFG_DEVICE_ADD(_tag, I8279, _clock) \
49
MCFG_DEVICE_CONFIG(_config)
51
#define I8279_INTERFACE(_name) \
52
const i8279_interface (_name) =
55
/***************************************************************************
57
***************************************************************************/
60
// ======================> i8279_interface
62
struct i8279_interface
64
devcb_write_line m_out_irq_cb; // IRQ
65
devcb_write8 m_out_sl_cb; // Scanlines SL0-3
66
devcb_write8 m_out_disp_cb; // B0-3,A0-3
67
devcb_write_line m_out_bd_cb; // BD
68
devcb_read8 m_in_rl_cb; // kbd readlines RL0-7
69
devcb_read_line m_in_shift_cb; // Shift key
70
devcb_read_line m_in_ctrl_cb; // Ctrl-Strobe line
75
// ======================> i8279_device
77
class i8279_device : public device_t, public i8279_interface
80
// construction/destruction
81
i8279_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
83
// read & write handlers
84
DECLARE_READ8_MEMBER(status_r);
85
DECLARE_READ8_MEMBER(data_r);
86
DECLARE_WRITE8_MEMBER(cmd_w);
87
DECLARE_WRITE8_MEMBER(data_w);
88
void timer_mainloop();
91
// device-level overrides
92
virtual void device_config_complete();
93
virtual void device_start();
94
virtual void device_reset();
95
virtual void device_post_load() { }
96
virtual void device_clock_changed() { }
98
static TIMER_CALLBACK( timerproc_callback );
103
void clear_display();
104
void new_key(UINT8 data, bool skey, bool ckey);
105
void new_fifo(UINT8 data);
106
UINT8 get_segments();
107
void set_irq(bool state);
108
void set_display_mode(UINT8 data);
110
devcb_resolved_write_line m_out_irq_func;
111
devcb_resolved_write8 m_out_sl_func;
112
devcb_resolved_write8 m_out_disp_func;
113
devcb_resolved_write_line m_out_bd_func;
114
devcb_resolved_read8 m_in_rl_func;
115
devcb_resolved_read_line m_in_shift_func;
116
devcb_resolved_read_line m_in_ctrl_func;
120
UINT8 m_d_ram[16]; // display ram
122
UINT8 m_s_ram[8]; // might be same as fifo ram
124
UINT8 m_fifo[8]; // queued keystrokes
125
UINT8 m_cmd[8]; // Device settings
126
UINT8 m_status; // Returned via status_r
127
UINT32 m_clock; // Internal scan clock
128
UINT8 m_scanner; // next output on SL lines
130
bool m_autoinc; // auto-increment flag
131
bool m_read_flag; // read from where
132
bool m_ctrl_key; // previous state of strobe input
137
// device type definition
138
extern const device_type I8279;