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
|
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
/***************************************************************************
h8_port.h
H8 8 bits digital port
***************************************************************************/
#ifndef MAME_CPU_H8_H8_PORT_H
#define MAME_CPU_H8_H8_PORT_H
#pragma once
#include "h8.h"
class h8_port_device : public device_t {
public:
h8_port_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
template<typename T> h8_port_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&cpu, int address, uint8_t default_ddr, uint8_t mask)
: h8_port_device(mconfig, tag, owner, 0)
{
m_cpu.set_tag(std::forward<T>(cpu));
m_address = address;
m_default_ddr = default_ddr;
m_mask = mask;
}
void ddr_w(uint8_t data);
uint8_t ddr_r();
void dr_w(uint8_t data);
uint8_t dr_r();
uint8_t port_r();
void pcr_w(uint8_t data);
uint8_t pcr_r();
void odr_w(uint8_t data);
uint8_t odr_r();
protected:
required_device<h8_device> m_cpu;
int m_address;
uint8_t m_default_ddr, m_ddr, m_pcr, m_odr;
uint8_t m_mask;
uint8_t m_dr;
int32_t m_last_output;
virtual void device_start() override;
virtual void device_reset() override;
void update_output();
};
DECLARE_DEVICE_TYPE(H8_PORT, h8_port_device)
#endif // MAME_CPU_H8_H8_PORT_H
|