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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
|
/***************************************************************************
SED1200
A LCD controller.
The D/F variants have a packaging difference (QFP80 vs. bare chip).
The A/B variants have an internal CGROM difference (jis
vs. european characters)
****************************************************************************
Copyright Olivier Galibert
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name 'MAME' nor the names of its contributors may be
used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY OLIVIER GALIBERT ''AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL OLIVIER GALIBERT BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
***************************************************************************/
#include "emu.h"
#include "sed1200.h"
const device_type SED1200D0A = &device_creator<sed1200d0a_device>;
const device_type SED1200F0A = &device_creator<sed1200f0a_device>;
const device_type SED1200D0B = &device_creator<sed1200d0b_device>;
const device_type SED1200F0B = &device_creator<sed1200f0b_device>;
ROM_START( sed1200x0a )
ROM_REGION( 0x800, "cgrom", 0 )
ROM_LOAD( "sed1200-a.bin", 0x000, 0x800, CRC(e8c28054) SHA1(086406eb74e9ed97b309d2a4bdedc567626e9a98))
ROM_END
ROM_START( sed1200x0b )
ROM_REGION( 0x800, "cgrom", 0 )
ROM_LOAD( "sed1200-b.bin", 0x000, 0x800, CRC(d0741f51) SHA1(c8c856f1357286a2c8c806af81724a828345357e))
ROM_END
sed1200_device::sed1200_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, type, name, tag, owner, clock)
{
m_shortname = "sed1200";
}
sed1200d0a_device::sed1200d0a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
sed1200_device(mconfig, SED1200D0A, "sed1200d-0a", tag, owner, clock)
{
}
sed1200f0a_device::sed1200f0a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
sed1200_device(mconfig, SED1200F0A, "sed1200f-0a", tag, owner, clock)
{
}
sed1200d0b_device::sed1200d0b_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
sed1200_device(mconfig, SED1200D0B, "sed1200d-0b", tag, owner, clock)
{
}
sed1200f0b_device::sed1200f0b_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
sed1200_device(mconfig, SED1200F0B, "sed1200f-0b", tag, owner, clock)
{
}
const rom_entry *sed1200d0a_device::device_rom_region() const
{
return ROM_NAME(sed1200x0a);
}
const rom_entry *sed1200f0a_device::device_rom_region() const
{
return ROM_NAME(sed1200x0a);
}
const rom_entry *sed1200d0b_device::device_rom_region() const
{
return ROM_NAME(sed1200x0b);
}
const rom_entry *sed1200f0b_device::device_rom_region() const
{
return ROM_NAME(sed1200x0b);
}
void sed1200_device::device_start()
{
memset(cgram, 0, sizeof(cgram));
memset(ddram, 0, sizeof(ddram));
if(memregion("cgrom"))
cgrom = memregion("cgrom")->base();
else
cgrom = NULL;
soft_reset();
}
void sed1200_device::soft_reset()
{
cursor_direction = false;
cursor_blinking = false;
cursor_full = false;
cursor_on = false;
display_on = false;
cursor_address = 0x00;
cgram_address = 0x00;
}
void sed1200_device::control_w(UINT8 data)
{
switch(data) {
case 0x04: case 0x05:
cursor_direction = data & 0x01;
break;
case 0x06: case 0x07:
cursor_step();
break;
case 0x08: case 0x09:
cursor_full = data & 0x01;
break;
case 0x0a: case 0x0b:
cursor_blinking = data & 0x01;
break;
case 0x0c: case 0x0d:
display_on = data & 0x01;
break;
case 0x0e: case 0x0f:
cursor_on = data & 0x01;
break;
case 0x10:
soft_reset();
break;
case 0x12: case 0x13:
break; // Number of lines selection
default:
if((data & 0xf0) == 0x20)
cgram_address = (data & 3)*8;
else if((data & 0xe0) == 0x40) {
cgram[cgram_address++] = data;
if(cgram_address == 4*8)
cgram_address = 0;
} else if(data & 0x80) {
cursor_address = data & 0x40 ? 10 : 0;
cursor_address += (data & 0x3f) >= 10 ? 9 : data & 0x3f;
}
break;
}
}
UINT8 sed1200_device::control_r()
{
return 0x00;
}
void sed1200_device::data_w(UINT8 data)
{
ddram[cursor_address] = data;
cursor_step();
}
void sed1200_device::cursor_step()
{
if(cursor_direction) {
if(cursor_address == 0 || cursor_address == 10)
cursor_address += 9;
else
cursor_address --;
} else {
if(cursor_address == 9 || cursor_address == 19)
cursor_address -= 9;
else
cursor_address ++;
}
}
const UINT8 *sed1200_device::render()
{
memset(render_buf, 0, 20*8);
if(!display_on)
return render_buf;
for(int i=0; i<20; i++) {
UINT8 c = ddram[i];
if(c < 4)
memcpy(render_buf + 8*i, cgram + 8*c, 8);
else if(cgrom)
memcpy(render_buf + 8*i, cgrom + 8*c, 8);
}
if(cursor_on && (!cursor_blinking || (machine().time().as_ticks(2) & 1))) {
if(cursor_full)
for(int i=0; i<8; i++)
render_buf[cursor_address*8+i] ^= 0x1f;
else
render_buf[cursor_address*8+7] ^= 0x1f;
}
return render_buf;
}
|