1 // license:BSD-3-Clause
2 // copyright-holders:AJR
3 /*******************************************************************************
4
5 Skeleton driver for Textel Compact portable digital teletype machine.
6
7 *******************************************************************************/
8
9 #include "emu.h"
10 #include "cpu/m6502/m65sc02.h"
11 #include "machine/input_merger.h"
12 #include "machine/6522via.h"
13 #include "machine/mos6551.h"
14 #include "machine/msm58321.h"
15 #include "video/sed1330.h"
16 #include "emupal.h"
17 #include "screen.h"
18
19
20 class textelcomp_state : public driver_device
21 {
22 public:
textelcomp_state(const machine_config & mconfig,device_type type,const char * tag)23 textelcomp_state(const machine_config &mconfig, device_type type, const char *tag)
24 : driver_device(mconfig, type, tag)
25 , m_maincpu(*this, "maincpu")
26 , m_rtc(*this, "rtc")
27 , m_chargen(*this, "chargen")
28 , m_keys(*this, "KEY%X", 0U)
29 , m_leds(*this, "led%u", 0U)
30 , m_keyscan(0)
31 , m_shift_register(0)
32 , m_shift_data(true)
33 , m_shift_clock(true)
34 { }
35
36 void textelcomp(machine_config &config);
37
38 private:
39 virtual void machine_start() override;
40 void keyscan_w(u8 data);
41 u8 keyboard_r();
42 DECLARE_WRITE_LINE_MEMBER(shift_data_w);
43 DECLARE_WRITE_LINE_MEMBER(shift_clock_w);
44 void update_shift_output();
45 void rtc_w(u8 data);
46
47 void mem_map(address_map &map);
48 void lcdc_map(address_map &map);
49
50 required_device<cpu_device> m_maincpu;
51 required_device<msm58321_device> m_rtc;
52 required_region_ptr<u8> m_chargen;
53 required_ioport_array<16> m_keys;
54 output_finder<16> m_leds;
55
56 u8 m_keyscan;
57 u16 m_shift_register;
58 bool m_shift_data;
59 bool m_shift_clock;
60 };
61
62
machine_start()63 void textelcomp_state::machine_start()
64 {
65 m_rtc->cs1_w(1);
66 subdevice<mos6551_device>("acia")->write_cts(0);
67
68 m_leds.resolve();
69
70 save_item(NAME(m_keyscan));
71 save_item(NAME(m_shift_register));
72 save_item(NAME(m_shift_data));
73 save_item(NAME(m_shift_clock));
74 }
75
keyscan_w(u8 data)76 void textelcomp_state::keyscan_w(u8 data)
77 {
78 // 2x TC4094BP driving keyboard lights
79 if (BIT(data, 4) && !BIT(m_keyscan, 4))
80 update_shift_output();
81
82 m_keyscan = data;
83 }
84
keyboard_r()85 u8 textelcomp_state::keyboard_r()
86 {
87 return m_keys[m_keyscan & 0x0f]->read();
88 }
89
WRITE_LINE_MEMBER(textelcomp_state::shift_data_w)90 WRITE_LINE_MEMBER(textelcomp_state::shift_data_w)
91 {
92 m_shift_data = state;
93 }
94
WRITE_LINE_MEMBER(textelcomp_state::shift_clock_w)95 WRITE_LINE_MEMBER(textelcomp_state::shift_clock_w)
96 {
97 if (state && !m_shift_clock)
98 {
99 m_shift_clock = true;
100 m_shift_register = (m_shift_register << 1) | m_shift_data;
101 if (BIT(m_keyscan, 4))
102 update_shift_output();
103 }
104 else if (!state && m_shift_clock)
105 m_shift_clock = false;
106 }
107
update_shift_output()108 void textelcomp_state::update_shift_output()
109 {
110 for (int i = 0; i < 16; i++)
111 m_leds[i] = BIT(m_shift_register, i);
112 }
113
rtc_w(u8 data)114 void textelcomp_state::rtc_w(u8 data)
115 {
116 // Minimum address/data setup time is given as 0 µs in Oki and Epson datasheets
117 // Address and data are written to the VIA at the same time as the control strobes
118 if (!BIT(data, 5))
119 m_rtc->write_w(0);
120 if (!BIT(data, 6))
121 m_rtc->read_w(0);
122 if (!BIT(data, 7))
123 m_rtc->address_write_w(0);
124
125 m_rtc->d0_w(BIT(data, 0));
126 m_rtc->d1_w(BIT(data, 1));
127 m_rtc->d2_w(BIT(data, 2));
128 m_rtc->d3_w(BIT(data, 3));
129
130 if (BIT(data, 5))
131 m_rtc->write_w(1);
132 if (BIT(data, 6))
133 m_rtc->read_w(1);
134 if (BIT(data, 7))
135 m_rtc->address_write_w(1);
136 }
137
138
mem_map(address_map & map)139 void textelcomp_state::mem_map(address_map &map)
140 {
141 map(0x0000, 0x1eff).ram(); // MB8464A-10L (battery backed?)
142 map(0x1f00, 0x1f0f).m("via0", FUNC(via6522_device::map));
143 map(0x1f10, 0x1f1f).m("via1", FUNC(via6522_device::map));
144 map(0x1f20, 0x1f2f).m("via2", FUNC(via6522_device::map));
145 map(0x1f30, 0x1f3f).m("via3", FUNC(via6522_device::map));
146 map(0x1f40, 0x1f43).rw("acia", FUNC(mos6551_device::read), FUNC(mos6551_device::write));
147 map(0x1f70, 0x1f70).rw("lcdc", FUNC(sed1330_device::status_r), FUNC(sed1330_device::data_w));
148 map(0x1f71, 0x1f71).rw("lcdc", FUNC(sed1330_device::data_r), FUNC(sed1330_device::command_w));
149 map(0x4000, 0x7fff).ram(); // HY62256ALP-10 (battery backed?)
150 map(0x8000, 0x9fff).ram(); // MB8464A-10L (battery backed?)
151 map(0xa000, 0xffff).rom().region("maincpu", 0x2000);
152 }
153
lcdc_map(address_map & map)154 void textelcomp_state::lcdc_map(address_map &map)
155 {
156 map(0x0000, 0x1fff).ram();
157 map(0xf000, 0xffff).rom().region("chargen", 0x1000);
158 }
159
160
161 static INPUT_PORTS_START(textelcomp)
162 PORT_START("KEY0")
PORT_CHAR(UCHAR_SHIFT_1)163 PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_SHIFT_1) PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT)
164 PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0x10
165 PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0x13
166 PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0x80/0x81
167 PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0x90/0x91
168 PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0xa0
169 PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0xa1
170 PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0xa4
171
172 PORT_START("KEY1")
173 PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift Lock") PORT_CODE(KEYCODE_CAPSLOCK)
174 PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0x11
175 PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0x14
176 PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('1') PORT_CHAR('!') PORT_CODE(KEYCODE_1)
177 PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L\xc3\xb6sch") PORT_CHAR(0x08) PORT_CODE(KEYCODE_TAB) // left of Q
178 PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('a') PORT_CHAR('A') PORT_CHAR(0x01) PORT_CODE(KEYCODE_A)
179 PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('y') PORT_CHAR('Y') PORT_CHAR(0x19) PORT_CODE(KEYCODE_Z)
180 PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0xa5
181
182 PORT_START("KEY2")
183 PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNKNOWN) // modifier
184 PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0x12
185 PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0x15
186 PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('2') PORT_CHAR('"') PORT_CODE(KEYCODE_2)
187 PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('q') PORT_CHAR('Q') PORT_CHAR(0x11) PORT_CODE(KEYCODE_Q)
188 PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('s') PORT_CHAR('S') PORT_CHAR(0x13) PORT_CODE(KEYCODE_S)
189 PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('x') PORT_CHAR('X') PORT_CHAR(0x18) PORT_CODE(KEYCODE_X)
190 PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0xa8
191
192 PORT_START("KEY3")
193 PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(UCHAR_SHIFT_2) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL)
194 PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
195 PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED)
196 PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('3') PORT_CHAR('#') PORT_CODE(KEYCODE_3)
197 PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('w') PORT_CHAR('W') PORT_CHAR(0x17) PORT_CODE(KEYCODE_W)
198 PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('d') PORT_CHAR('D') PORT_CHAR(0x04) PORT_CODE(KEYCODE_D)
199 PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('c') PORT_CHAR('C') PORT_CHAR(0x03) PORT_CODE(KEYCODE_C)
200 PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0xa9
201
202 PORT_START("KEY4")
203 PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0x1b
204 PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0x20
205 PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0x21
206 PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('4') PORT_CHAR('+') PORT_CODE(KEYCODE_4)
207 PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('e') PORT_CHAR('E') PORT_CHAR(0x05) PORT_CODE(KEYCODE_E)
208 PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('f') PORT_CHAR('F') PORT_CHAR(0x06) PORT_CODE(KEYCODE_F)
209 PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('v') PORT_CHAR('V') PORT_CHAR(0x16) PORT_CODE(KEYCODE_V)
210 PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
211
212 PORT_START("KEY5")
213 PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(0x0d) PORT_CODE(KEYCODE_ENTER)
214 PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
215 PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0x22
216 PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('5') PORT_CHAR('%') PORT_CODE(KEYCODE_5)
217 PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('r') PORT_CHAR('R') PORT_CHAR(0x12) PORT_CODE(KEYCODE_R)
218 PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('g') PORT_CHAR('G') PORT_CHAR(0x07) PORT_CODE(KEYCODE_G)
219 PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('b') PORT_CHAR('B') PORT_CODE(KEYCODE_B)
220 PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
221
222 PORT_START("KEY6")
223 PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(' ') PORT_CODE(KEYCODE_SPACE)
224 PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
225 PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED)
226 PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('6') PORT_CHAR('&') PORT_CODE(KEYCODE_6)
227 PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('t') PORT_CHAR('T') PORT_CHAR(0x14) PORT_CODE(KEYCODE_T)
228 PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('h') PORT_CHAR('H') PORT_CODE(KEYCODE_H)
229 PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('n') PORT_CHAR('N') PORT_CHAR(0x0e) PORT_CODE(KEYCODE_N)
230 PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
231
232 PORT_START("KEY7")
233 PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
234 PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0x40
235 PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0x44
236 PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('7') PORT_CHAR('/') PORT_CODE(KEYCODE_7)
237 PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('z') PORT_CHAR('Z') PORT_CHAR(0x1a) PORT_CODE(KEYCODE_Y)
238 PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('j') PORT_CHAR('J') PORT_CHAR(0x0a) PORT_CODE(KEYCODE_J)
239 PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('m') PORT_CHAR('M') PORT_CODE(KEYCODE_M)
240 PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
241
242 PORT_START("KEY8")
243 PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
244 PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0x41
245 PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0x45
246 PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('8') PORT_CHAR('(') PORT_CODE(KEYCODE_8)
247 PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('u') PORT_CHAR('U') PORT_CHAR(0x15) PORT_CODE(KEYCODE_U)
248 PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('k') PORT_CHAR('K') PORT_CHAR(0x0b) PORT_CODE(KEYCODE_K)
249 PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(',') PORT_CHAR(';') PORT_CODE(KEYCODE_COMMA)
250 PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
251
252 PORT_START("KEY9")
253 PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
254 PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0x50
255 PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0x46
256 PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('9') PORT_CHAR(')') PORT_CODE(KEYCODE_9)
257 PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('i') PORT_CHAR('I') PORT_CHAR(0x09) PORT_CODE(KEYCODE_I)
258 PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('l') PORT_CHAR('L') PORT_CHAR(0x0c) PORT_CODE(KEYCODE_L)
259 PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('.') PORT_CHAR(':') PORT_CODE(KEYCODE_STOP)
260 PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
261
262 PORT_START("KEYA")
263 PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
264 PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0x43
265 PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED)
266 PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('0') PORT_CODE(KEYCODE_0)
267 PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('o') PORT_CHAR('O') PORT_CHAR(0x0f) PORT_CODE(KEYCODE_O)
268 PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\x96") PORT_CHAR(0xf6, 0x7c) PORT_CHAR(0xd6, 0x5c) PORT_CHAR(0x1c) PORT_CODE(KEYCODE_COLON) // Ö
269 PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('-') PORT_CHAR('=') PORT_CODE(KEYCODE_SLASH)
270 PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
271
272 PORT_START("KEYB")
273 PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
274 PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
275 PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0x60
276 PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR(0xdf, 0x7e) PORT_CHAR('?') PORT_CODE(KEYCODE_MINUS) // ß
277 PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('p') PORT_CHAR('P') PORT_CHAR(0x10) PORT_CODE(KEYCODE_P)
278 PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\x84") PORT_CHAR(0xe4, 0x7b) PORT_CHAR(0xc4, 0x5b) PORT_CHAR(0x1b) PORT_CODE(KEYCODE_QUOTE) // Ä
279 PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
280 PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
281
282 PORT_START("KEYC")
283 PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
284 PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0x30/0x31
285 PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED)
286 PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CHAR('*') PORT_CODE(KEYCODE_EQUALS)
287 PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("\xc3\x9c") PORT_CHAR(0xfc, 0x7d) PORT_CHAR(0xdc, 0x5d) PORT_CHAR(0x1d) PORT_CODE(KEYCODE_OPENBRACE) // Ü
288 PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED)
289 PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
290 PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
291
292 PORT_START("KEYD")
293 PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
294 PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
295 PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0x71
296 PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
297 PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
298 PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED)
299 PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
300 PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
301
302 PORT_START("KEYE")
303 PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
304 PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNKNOWN) // code 0x70
305 PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED)
306 PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
307 PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
308 PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED)
309 PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
310 PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
311
312 PORT_START("KEYF")
313 PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
314 PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
315 PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED)
316 PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
317 PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
318 PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED)
319 PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNUSED)
320 PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
321 INPUT_PORTS_END
322
323
324 void textelcomp_state::textelcomp(machine_config &config)
325 {
326 M65SC02(config, m_maincpu, 3.6864_MHz_XTAL / 2); // GS65SC02P-2 (clock not verified)
327 m_maincpu->set_addrmap(AS_PROGRAM, &textelcomp_state::mem_map);
328
329 INPUT_MERGER_ANY_HIGH(config, "mainirq").output_handler().set_inputline(m_maincpu, m65sc02_device::IRQ_LINE);
330
331 via6522_device &via0(VIA6522(config, "via0", 3.6864_MHz_XTAL / 2)); // GS65SC22P-2
332 via0.irq_handler().set("mainirq", FUNC(input_merger_device::in_w<0>));
333
334 VIA6522(config, "via1", 3.6864_MHz_XTAL / 2); // GS65SC22P-2
335 // IRQ might be connected on hardware, but is never enabled
336
337 via6522_device &via2(VIA6522(config, "via2", 3.6864_MHz_XTAL / 2)); // GS65SC22P-2
338 via2.readpa_handler().set(FUNC(textelcomp_state::keyboard_r));
339 via2.writepb_handler().set(FUNC(textelcomp_state::keyscan_w));
340 via2.cb1_handler().set(FUNC(textelcomp_state::shift_clock_w));
341 via2.cb2_handler().set(FUNC(textelcomp_state::shift_data_w));
342
343 via6522_device &via3(VIA6522(config, "via3", 3.6864_MHz_XTAL / 2)); // GS65SC22P-2
344 via3.writepa_handler().set(FUNC(textelcomp_state::rtc_w));
345 via3.ca2_handler().set(m_rtc, FUNC(msm58321_device::cs2_w)).invert();
346 via3.ca2_handler().append(m_rtc, FUNC(msm58321_device::stop_w)).invert();
347 // TODO: PB7 toggling generates beeps?
348
349 mos6551_device &acia(MOS6551(config, "acia", 3.6864_MHz_XTAL / 2)); // GS65SC51P-2
350 acia.set_xtal(3.6864_MHz_XTAL / 2);
351 acia.irq_handler().set("mainirq", FUNC(input_merger_device::in_w<1>));
352
353 screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD));
354 screen.set_color(rgb_t(0x00, 0xff, 0x80));
355 screen.set_refresh_hz(50);
356 screen.set_size(640, 201);
357 screen.set_visarea(0, 640-1, 0, 201-1);
358 screen.set_palette("palette");
359 screen.set_screen_update("lcdc", FUNC(sed1330_device::screen_update));
360
361 PALETTE(config, "palette", palette_device::MONOCHROME_INVERTED);
362
363 sed1330_device &lcdc(SED1330(config, "lcdc", 6.4_MHz_XTAL)); // SED1330F + B&W LCD
364 lcdc.set_addrmap(0, &textelcomp_state::lcdc_map);
365 lcdc.set_screen("screen");
366
367 MSM58321(config, m_rtc, 32.768_kHz_XTAL); // RTC58321A
368 m_rtc->set_default_24h(true);
369 m_rtc->d0_handler().set("via3", FUNC(via6522_device::write_pa0));
370 m_rtc->d1_handler().set("via3", FUNC(via6522_device::write_pa1));
371 m_rtc->d2_handler().set("via3", FUNC(via6522_device::write_pa2));
372 m_rtc->d3_handler().set("via3", FUNC(via6522_device::write_pa3));
373 m_rtc->busy_handler().set("via0", FUNC(via6522_device::write_ca1)); // source of periodic falling edge interrupt?
374 }
375
376
377 ROM_START(a1010)
378 ROM_REGION(0x8000, "maincpu", 0)
379 ROM_LOAD("d15_31.bin", 0x0000, 0x8000, CRC(5ee1175d) SHA1(87ff6a3d5c64a53b0ab23d54aa343365c44d0407))
380
381 ROM_REGION(0x8000, "chargen", 0)
382 ROM_LOAD("chargen.bin", 0x0000, 0x8000, CRC(07daa70e) SHA1(8066a0ac238b06fbeeb99c3a2a8a9e70a27db7a9))
383 ROM_END
384
385
386 COMP(1993, a1010, 0, 0, textelcomp, textelcomp, textelcomp_state, empty_init, "Humantechnik", "Textel Compact A1010-0", MACHINE_IS_SKELETON)
387