summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/video/upd7227.cpp
blob: 89a12408e05fddc718c703cba18e611e1c29d017 (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
// license:BSD-3-Clause
// copyright-holders:Curt Coder
/**********************************************************************

    uPD7227 Intelligent Dot-Matrix LCD Controller/Driver emulation

**********************************************************************/

#include "emu.h"
#include "upd7227.h"

//#define VERBOSE 1
#include "logmacro.h"



//**************************************************************************
//  DEVICE DEFINITIONS
//**************************************************************************

DEFINE_DEVICE_TYPE(UPD7227, upd7227_device, "upd7227", "NEC uPD7227")


ADDRESS_MAP_START(upd7227_device::upd7227_map)
	AM_RANGE(0x00, 0x27) AM_RAM
	AM_RANGE(0x40, 0x67) AM_RAM
ADDRESS_MAP_END



//**************************************************************************
//  LIVE DEVICE
//**************************************************************************

//-------------------------------------------------
//  upd7227_device - constructor
//-------------------------------------------------

upd7227_device::upd7227_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
	: device_t(mconfig, UPD7227, tag, owner, clock)
	, device_memory_interface(mconfig, *this)
	, m_space_config("videoram", ENDIANNESS_BIG, 8, 7, 0, address_map_constructor(FUNC(upd7227_device::upd7227_map), this))
	, m_cs(1)
	, m_cd(1)
	, m_sck(1)
	, m_si(1)
	, m_so(1)
{
}


//-------------------------------------------------
//  static_set_offsets - configuration helper
//-------------------------------------------------

void upd7227_device::static_set_offsets(device_t &device, int sx, int sy)
{
	upd7227_device &upd7227 = downcast<upd7227_device &>(device);

	upd7227.m_sx = sx;
	upd7227.m_sy = sy;
}


//-------------------------------------------------
//  device_start - device-specific startup
//-------------------------------------------------

void upd7227_device::device_start()
{
	// state saving
	save_item(NAME(m_cs));
	save_item(NAME(m_cd));
	save_item(NAME(m_sck));
	save_item(NAME(m_si));
	save_item(NAME(m_so));
}


//-------------------------------------------------
//  device_reset - device-specific reset
//-------------------------------------------------

void upd7227_device::device_reset()
{
}


//-------------------------------------------------
//  memory_space_config - return a description of
//  any address spaces owned by this device
//-------------------------------------------------

device_memory_interface::space_config_vector upd7227_device::memory_space_config() const
{
	return space_config_vector {
		std::make_pair(0, &m_space_config)
	};
}


//-------------------------------------------------
//  update_screen - update screen
//-------------------------------------------------

uint32_t upd7227_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	return 0;
}


//-------------------------------------------------
//  cs_w - chip select
//-------------------------------------------------

WRITE_LINE_MEMBER( upd7227_device::cs_w )
{
	m_cs = state;
}


//-------------------------------------------------
//  cd_w - command/data select
//-------------------------------------------------

WRITE_LINE_MEMBER( upd7227_device::cd_w )
{
	m_cd = state;
}


//-------------------------------------------------
//  sck_w - serial clock
//-------------------------------------------------

WRITE_LINE_MEMBER( upd7227_device::sck_w )
{
	m_sck = state;
}


//-------------------------------------------------
//  si_w - serial input
//-------------------------------------------------

WRITE_LINE_MEMBER( upd7227_device::si_w )
{
	m_si = state;
}


//-------------------------------------------------
//  so_r - serial output/busy
//-------------------------------------------------

READ_LINE_MEMBER( upd7227_device::so_r )
{
	return m_so;
}