blob: a25f29bdfb66c48cd518ad48abcb41771079e7e2 (
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
70
71
72
73
74
75
76
77
78
79
|
// license:BSD-3-Clause
// copyright-holders:Sergey Svishchev
#pragma once
#ifndef __KM035_H__
#define __KM035_H__
#include "emu.h"
#include "cpu/mcs48/mcs48.h"
#include "sound/beep.h"
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_KM035_TX_HANDLER(_cb) \
devcb = &km035_device::set_tx_handler(*device, DEVCB_##_cb);
#define MCFG_KM035_RTS_HANDLER(_cb) \
devcb = &km035_device::set_rts_handler(*device, DEVCB_##_cb);
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> km035_device
class km035_device : public device_t
{
public:
// construction/destruction
km035_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
template<class _Object> static devcb_base &set_tx_handler(device_t &device, _Object wr) { return downcast<km035_device &>(device).m_tx_handler.set_callback(wr); }
template<class _Object> static devcb_base &set_rts_handler(device_t &device, _Object wr) { return downcast<km035_device &>(device).m_rts_handler.set_callback(wr); }
DECLARE_WRITE8_MEMBER( bus_w );
DECLARE_WRITE8_MEMBER( p1_w );
DECLARE_WRITE8_MEMBER( p2_w );
DECLARE_READ8_MEMBER( p1_r );
DECLARE_READ8_MEMBER( p2_r );
DECLARE_READ8_MEMBER( t0_r );
DECLARE_READ8_MEMBER( t1_r );
DECLARE_WRITE_LINE_MEMBER( write_rxd );
protected:
// device-level overrides
virtual machine_config_constructor device_mconfig_additions() const override;
virtual const tiny_rom_entry *device_rom_region() const override;
virtual ioport_constructor device_input_ports() const override;
virtual void device_start() override;
virtual void device_reset() override;
private:
required_device<cpu_device> m_maincpu;
required_device<beep_device> m_speaker;
required_ioport_array<16> m_kbd;
int m_keylatch; // keyboard row latch
uint8_t m_p1;
uint8_t m_p2;
uint8_t m_rx;
devcb_write_line m_tx_handler;
devcb_write_line m_rts_handler;
};
// device type definition
extern const device_type KM035;
#endif
|