blob: f3c924c7134ed415660c523dcad2f8a4056262ff (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
// license:BSD-3-Clause
// copyright-holders:Miodrag Milanovic, Jonathan Gevaryahu
/***************************************************************************
DEC VT100 keyboard emulation
***************************************************************************/
#ifndef MAME_MACHINE_VT100_KBD_H
#define MAME_MACHINE_VT100_KBD_H
#pragma once
#include "machine/timer.h"
#include "sound/beep.h"
#include "speaker.h"
//**************************************************************************
// CONFIGURATION MACROS
//**************************************************************************
#define MCFG_VT100_KEYBOARD_INT_CALLBACK(_devcb) \
devcb = &vt100_keyboard_device::set_int_callback(*device, DEVCB_##_devcb);
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> vt100_keyboard_device
class vt100_keyboard_device : public device_t
{
public:
// construction/destruction
vt100_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
// static configuration
template <class Object> static devcb_base &set_int_callback(device_t &device, Object &&cb) { return downcast<vt100_keyboard_device &>(device).m_int_cb.set_callback(std::forward<Object>(cb)); }
// accessors (for now)
void control_w(u8 data);
u8 key_code_r();
protected:
virtual void device_resolve_objects() override;
virtual void device_start() override;
virtual void device_add_mconfig(machine_config &config) override;
virtual ioport_constructor device_input_ports() const override;
private:
// internal helpers
static u8 bit_sel(u8 data);
TIMER_DEVICE_CALLBACK_MEMBER(scan_callback);
devcb_write_line m_int_cb;
required_device<beep_device> m_speaker;
required_ioport_array<16> m_key_row;
bool m_key_scan;
u8 m_key_code;
};
// device type definition
DECLARE_DEVICE_TYPE(VT100_KEYBOARD, vt100_keyboard_device)
#endif // MAME_MACHINE_VT100_KBD_H
|