summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/mekd5.cpp
blob: 284b2d30edaf0b74d0b22c9383e95748499ffa80 (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
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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
// license:BSD-3-Clause
// copyright-holders: 68bit
/******************************************************************************

Motorola Evaluation Kit 6802 D5 - MEK6802D5

Memory map

Range    Short  Description

0000-dfff RAM   Either 128 bytes on board, or external

e000-e3ff RAM   Static RAM, 1K.
e400-e47f RAM   System RAM
e480-e483 PIA   User PIA
e484-e487 PIA   System PIA

e700-e701 ACIA  System ACIA.

e800-efff ROM   Optional user ROM
f000-f7ff ROM   D5BUG monitor ROM
f800-ffff ROM   D5BUG (mirror), or optional user ROM.


A 1K or 2K optional user ROM or EPROM can be installed and mapped to either
0xe800-0xefff, or to 0xf800-0xffff, set via jumper 3.
TODO implement this user ROM.

The board has provision for an ACIA, and the documentation mentions that it is
not used when there is a keypad, and the keypad is removable. However the
D5BUG monitor has no support for this ACIA. Was there an alternative official
monitor that used this ACIA?


Keypad commands:

RS (Reset)  Reset, wired to the CPU reset line
EX (Escape) Typically aborts user program.
M (Memory display/change)
  Digits 5 and 6 show the actual data at the address.
  G  - increase the address.
  M  - decreases the address.
  FS - Offset calculation. Enter address, then press 'GO'.
    GO - stores the offset and returns to memory display and increased the address.
    FC - return to memory display, without storing the offset.
    M  - return to memory display, after a BAD offset.
  EX - exits memory display.
RD (Register display/alter)
  G   - advance to next register.
  M   - previous register.
  T/B - trace a single instruction
  EX  - exits register display.
GO to user program.
  If no address if entered then it uses the pseudo PC, it continues.
  Enter the address and press 'Go' to use that entered address.
  It firstly checks that there is RAM at the stack pointer.
FS T/B - Breakpoint editor
  GO - advance to next breakpoing, up to 8, then loops.
  FS - insert a breakpoint
  FC - deactivate breakpoint
  EX - exits breakpoing editor.
P/L (Punch tape)
  At the 'bb' prompt enter the beginning address of the data, then 'GO'.
  At the 'EE' prompt enter the last address of the data.
  Start the tape and press GO. There is a 30 second leader of $ff.
FS P/L (Load from tape)
FS RD (Verify from tape)
FS 0 to F
  One of 16 user defined functions. Press FS then one number key 0 to F.
  A pointer to a table of 16 function addresses should be set at 0xe43f.

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

#include "emu.h"
#include "cpu/m6800/m6800.h"
#include "machine/input_merger.h"
#include "machine/6821pia.h"
#include "machine/6850acia.h"
#include "machine/mc14411.h"
#include "machine/clock.h"
#include "machine/timer.h"
#include "video/pwm.h"
#include "sound/wave.h"
#include "speaker.h"
#include "bus/rs232/rs232.h"
#include "machine/terminal.h"
#include "imagedev/cassette.h"
#include "imagedev/snapquik.h"
#include "render.h"
#include "mekd5.lh"

#define XTAL_MEKD5 3.579545_MHz_XTAL

class mekd5_state : public driver_device
{
public:
	enum
	{
		TIMER_TRACE
	};

	mekd5_state(const machine_config &mconfig, device_type type, const char *tag)
		: driver_device(mconfig, type, tag)
		, m_maincpu(*this, "maincpu")
		, m_kpd_pia(*this, "kpd_pia")
		, m_user_pia(*this, "user_pia")
		, m_display(*this, "display")
		, m_brg(*this, "brg")
		, m_baud_rate(*this, "BAUD_RATE")
		, m_acia(*this, "acia")
		, m_cass(*this, "cassette")
		, m_keypad_columns(*this, "COL%u", 0)
	{ }

	void mekd5(machine_config &config);
	void init_mekd5();

	DECLARE_WRITE_LINE_MEMBER(reset_key_w);
	DECLARE_INPUT_CHANGED_MEMBER(keypad_changed);

private:
	DECLARE_WRITE_LINE_MEMBER(trace_timer_clear_w);

	DECLARE_READ_LINE_MEMBER(keypad_cb1_r);
	uint8_t keypad_key_r();
	void led_digit_w(uint8_t data);
	void led_segment_w(uint8_t data);
	DECLARE_READ_LINE_MEMBER(kansas_r);

	// Clocks
	DECLARE_WRITE_LINE_MEMBER(write_f1_clock);
	DECLARE_WRITE_LINE_MEMBER(write_f3_clock);
	DECLARE_WRITE_LINE_MEMBER(write_f5_clock);
	DECLARE_WRITE_LINE_MEMBER(write_f7_clock);
	DECLARE_WRITE_LINE_MEMBER(write_f9_clock);
	DECLARE_WRITE_LINE_MEMBER(write_f13_clock);

	void mekd5_mem(address_map &map);

	bool keypad_key_pressed();

	virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
	uint8_t m_segment;
	uint8_t m_digit;
	virtual void machine_start() override;
	virtual void machine_reset() override;
	required_device<m6802_cpu_device> m_maincpu;
	required_device<pia6821_device> m_kpd_pia;
	required_device<pia6821_device> m_user_pia;
	required_device<pwm_display_device> m_display;
	required_device<mc14411_device> m_brg;
	required_ioport m_baud_rate;
	required_device<acia6850_device> m_acia;
	required_device<cassette_image_device> m_cass;
	required_ioport_array<4> m_keypad_columns;
};



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

    Address Map

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

void mekd5_state::mekd5_mem(address_map &map)
{
	map(0x0000, 0xdfff).ram();
	map(0xe000, 0xe3ff).ram();
	map(0xe400, 0xe47f).ram();

	map(0xe480, 0xe483).mirror(0x0378).rw(m_user_pia, FUNC(pia6821_device::read), FUNC(pia6821_device::write));
	map(0xe484, 0xe487).mirror(0x0378).rw(m_kpd_pia, FUNC(pia6821_device::read), FUNC(pia6821_device::write));

	map(0xe700, 0xe701).mirror(0x003e).rw(m_acia, FUNC(acia6850_device::read), FUNC(acia6850_device::write));

	/* D5BUG ROM */
	map(0xf000, 0xf7ff).rom().mirror(0x0800);
}

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

    Keys

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

static INPUT_PORTS_START(mekd5)

	// RESET is not wired to the key matrix.
	PORT_START("RESET")
	PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("RS") PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, mekd5_state, reset_key_w)

	PORT_START("COL0")
	PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, mekd5_state, keypad_changed, 0) PORT_NAME("M") PORT_CODE(KEYCODE_M)
	PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, mekd5_state, keypad_changed, 0) PORT_NAME("FS") PORT_CODE(KEYCODE_S)
	PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, mekd5_state, keypad_changed, 0) PORT_NAME("7") PORT_CODE(KEYCODE_7)
	PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, mekd5_state, keypad_changed, 0) PORT_NAME("4") PORT_CODE(KEYCODE_4)
	PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, mekd5_state, keypad_changed, 0) PORT_NAME("1") PORT_CODE(KEYCODE_1)
	PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, mekd5_state, keypad_changed, 0) PORT_NAME("0") PORT_CODE(KEYCODE_0)

	PORT_START("COL1")
	PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, mekd5_state, keypad_changed, 0) PORT_NAME("EX") PORT_CODE(KEYCODE_X)
	PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, mekd5_state, keypad_changed, 0) PORT_NAME("FC") PORT_CODE(KEYCODE_W)
	PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, mekd5_state, keypad_changed, 0) PORT_NAME("8") PORT_CODE(KEYCODE_8)
	PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, mekd5_state, keypad_changed, 0) PORT_NAME("5") PORT_CODE(KEYCODE_5)
	PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, mekd5_state, keypad_changed, 0) PORT_NAME("2") PORT_CODE(KEYCODE_2)
	PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, mekd5_state, keypad_changed, 0) PORT_NAME("F") PORT_CODE(KEYCODE_F)

	PORT_START("COL2")
	PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, mekd5_state, keypad_changed, 0) PORT_NAME("RD") PORT_CODE(KEYCODE_R)
	PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, mekd5_state, keypad_changed, 0) PORT_NAME("P/L") PORT_CODE(KEYCODE_P)
	PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, mekd5_state, keypad_changed, 0) PORT_NAME("9") PORT_CODE(KEYCODE_9)
	PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, mekd5_state, keypad_changed, 0) PORT_NAME("6") PORT_CODE(KEYCODE_6)
	PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, mekd5_state, keypad_changed, 0) PORT_NAME("3") PORT_CODE(KEYCODE_3)
	PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, mekd5_state, keypad_changed, 0) PORT_NAME("E") PORT_CODE(KEYCODE_E)

	PORT_START("COL3")
	PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, mekd5_state, keypad_changed, 0) PORT_NAME("GO") PORT_CODE(KEYCODE_G)
	PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, mekd5_state, keypad_changed, 0) PORT_NAME("T/B") PORT_CODE(KEYCODE_T)
	PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, mekd5_state, keypad_changed, 0) PORT_NAME("A") PORT_CODE(KEYCODE_A)
	PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, mekd5_state, keypad_changed, 0) PORT_NAME("B") PORT_CODE(KEYCODE_B)
	PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, mekd5_state, keypad_changed, 0) PORT_NAME("C") PORT_CODE(KEYCODE_C)
	PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHANGED_MEMBER(DEVICE_SELF, mekd5_state, keypad_changed, 0) PORT_NAME("D") PORT_CODE(KEYCODE_D)

	/* RS232 baud rates available via J5. */
	PORT_START("BAUD_RATE")
	PORT_CONFNAME(0x3f, 1, "RS232 Baud Rate")
	PORT_CONFSETTING(0x20, "110")
	PORT_CONFSETTING(0x10, "300")
	PORT_CONFSETTING(0x08, "1200")
	PORT_CONFSETTING(0x04, "2400")
	PORT_CONFSETTING(0x02, "4800")
	PORT_CONFSETTING(0x01, "9600")

INPUT_PORTS_END

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

    Trace timer

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

void mekd5_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	switch (id)
	{
	case TIMER_TRACE:
		// CB2 is programmed to trigger on the falling edge, so after
		// a count of 16. CB2 input comes from a counter, so the duty
		// cycle should be 50/50, but it makes no difference to rise
		// and fall here.
		m_kpd_pia->cb2_w(1);
		m_kpd_pia->cb2_w(0);
		break;
	default:
		throw emu_fatalerror("Unknown id in mekd5_state::device_timer");
	}
}


// Expect a delay of 16 cycles.  However the 6800 cycle model appears to
// account for the store that writes here as occuring at the start of that
// instruction adding 5 cycles to give an effective 21 cycles. TODO adjust
// this back to 16 cycles when the 6800 cycle timing becomes more accurate.
WRITE_LINE_MEMBER(mekd5_state::trace_timer_clear_w)
{
	if (state)
		m_kpd_pia->cb2_w(0);
	else
		timer_set(attotime::from_ticks(21, XTAL_MEKD5 / 4), TIMER_TRACE);
}

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

    Keypad

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

// Keypad input is disable on views with the RS232 input.

WRITE_LINE_MEMBER(mekd5_state::reset_key_w)
{
	uint8_t view = machine().render().first_target()->view();
	if (view > 1) return;

	m_maincpu->set_input_line(INPUT_LINE_RESET, state ? CLEAR_LINE : ASSERT_LINE);

	// TODO reset other devices.
}


bool mekd5_state::keypad_key_pressed()
{
	uint8_t view = machine().render().first_target()->view();
	if (view > 1) return 0;

	return (m_keypad_columns[0]->read() & m_digit) ||
		(m_keypad_columns[1]->read() & m_digit) ||
		(m_keypad_columns[2]->read() & m_digit) ||
		(m_keypad_columns[3]->read() & m_digit);
}

INPUT_CHANGED_MEMBER(mekd5_state::keypad_changed)
{
	m_kpd_pia->cb1_w(mekd5_state::keypad_key_pressed());
}

READ_LINE_MEMBER(mekd5_state::keypad_cb1_r)
{
	return mekd5_state::keypad_key_pressed();
}

uint8_t mekd5_state::keypad_key_r()
{
	uint8_t view = machine().render().first_target()->view();
	if (view > 1) return m_segment;

	uint8_t mux = (m_digit & 0xc0) >> 6;
	uint8_t i = (m_keypad_columns[mux]->read() & m_digit) ? 0 : 0x80;

	return i | m_segment;
}

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

    Seven segment LED display, and cassette

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

// PA
void mekd5_state::led_segment_w(uint8_t data)
{
	m_segment = data & 0x7f;
	m_display->matrix(m_digit & 0x3f, ~m_segment);
}

// PB
void mekd5_state::led_digit_w(uint8_t data)
{
	m_digit = data;
	m_display->matrix(m_digit & 0x3f, ~m_segment);
	// PB7 also drives the cassette output.
	m_cass->output(BIT(data, 7) ? -1.0 : +1.0);
	// Update the keypad pressed output which depends on m_digit.
	m_kpd_pia->cb1_w(mekd5_state::keypad_key_pressed());
}

READ_LINE_MEMBER(mekd5_state::kansas_r)
{
	uint8_t data = m_cass->input() > +0.0;
	return data;
}


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

  ACIA clocks

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

WRITE_LINE_MEMBER(mekd5_state::write_f1_clock)
{
	if (BIT(m_baud_rate->read(), 0))
	{
		m_acia->write_txc(state);
		m_acia->write_rxc(state);
	}
}

WRITE_LINE_MEMBER(mekd5_state::write_f3_clock)
{
	if (BIT(m_baud_rate->read(), 1))
	{
		m_acia->write_txc(state);
		m_acia->write_rxc(state);
	}
}

WRITE_LINE_MEMBER(mekd5_state::write_f5_clock)
{
	if (BIT(m_baud_rate->read(), 2))
	{
		m_acia->write_txc(state);
		m_acia->write_rxc(state);
	}
}

WRITE_LINE_MEMBER(mekd5_state::write_f7_clock)
{
	if (BIT(m_baud_rate->read(), 3))
	{
		m_acia->write_txc(state);
		m_acia->write_rxc(state);
	}
}

WRITE_LINE_MEMBER(mekd5_state::write_f9_clock)
{
	if (BIT(m_baud_rate->read(), 4))
	{
		m_acia->write_txc(state);
		m_acia->write_rxc(state);
	}
}

WRITE_LINE_MEMBER(mekd5_state::write_f13_clock)
{
	if (BIT(m_baud_rate->read(), 5))
	{
		m_acia->write_txc(state);
		m_acia->write_rxc(state);
	}
}


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

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

void mekd5_state::init_mekd5()
{
}

void mekd5_state::machine_start()
{
	save_item(NAME(m_segment));
	save_item(NAME(m_digit));
}

void mekd5_state::machine_reset()
{
	// Trace timer out low.
	m_kpd_pia->cb2_w(0);

	m_brg->rsa_w(CLEAR_LINE);
	m_brg->rsb_w(ASSERT_LINE);

	// /DCD and /CTS are wired low.
	m_acia->write_dcd(CLEAR_LINE);
	m_acia->write_cts(CLEAR_LINE);
}

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

    Machine

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

static DEVICE_INPUT_DEFAULTS_START(terminal)
	DEVICE_INPUT_DEFAULTS("RS232_RXBAUD", 0xff, RS232_BAUD_9600)
	DEVICE_INPUT_DEFAULTS("RS232_TXBAUD", 0xff, RS232_BAUD_9600)
	DEVICE_INPUT_DEFAULTS("RS232_STARTBITS", 0xff, RS232_STARTBITS_1)
	DEVICE_INPUT_DEFAULTS("RS232_DATABITS", 0xff, RS232_DATABITS_8)
	DEVICE_INPUT_DEFAULTS("RS232_PARITY", 0xff, RS232_PARITY_NONE)
	DEVICE_INPUT_DEFAULTS("RS232_STOPBITS", 0xff, RS232_STOPBITS_1)
DEVICE_INPUT_DEFAULTS_END

void mekd5_state::mekd5(machine_config &config)
{
	M6802(config, m_maincpu, XTAL_MEKD5);        /* 894.8 kHz clock */
	m_maincpu->set_ram_enable(false);
	m_maincpu->set_addrmap(AS_PROGRAM, &mekd5_state::mekd5_mem);

	INPUT_MERGER_ANY_HIGH(config, "mainirq").output_handler().set_inputline(m_maincpu, M6802_IRQ_LINE);
	INPUT_MERGER_ANY_HIGH(config, "mainnmi").output_handler().set_inputline(m_maincpu, INPUT_LINE_NMI);

	// LED display
	PWM_DISPLAY(config, m_display).set_size(6, 7);
	m_display->set_segmask(0x3f, 0x7f);

	config.set_default_layout(layout_mekd5);

	SPEAKER(config, "mono").front_center();

	CASSETTE(config, m_cass);
	m_cass->set_default_state(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED);
	m_cass->add_route(ALL_OUTPUTS, "mono", 0.05);

	// Keypad and display PIA (U23). IRQA is NC. CB2 is trace timer input.
	PIA6821(config, m_kpd_pia, 0);
	m_kpd_pia->readpa_handler().set(FUNC(mekd5_state::keypad_key_r));
	m_kpd_pia->writepa_handler().set(FUNC(mekd5_state::led_segment_w));
	m_kpd_pia->writepb_handler().set(FUNC(mekd5_state::led_digit_w));
	m_kpd_pia->readca1_handler().set(FUNC(mekd5_state::kansas_r));
	m_kpd_pia->ca2_handler().set(FUNC(mekd5_state::trace_timer_clear_w));
	m_kpd_pia->readcb1_handler().set(FUNC(mekd5_state::keypad_cb1_r));
	m_kpd_pia->irqb_handler().set("mainnmi", FUNC(input_merger_device::in_w<1>));

	// User PIA (U9).
	// IRQA and IRQB can be independently jumpered to IRQ or NMI via J1.
	// All the I/O lines are available at the User I/O connector.
	PIA6821(config, m_user_pia, 0);

	// IRQ is NC. RX and TX clk are wired together. RTS is available.
	// /DCD and /CTS and wired low.
	ACIA6850(config, m_acia, 0);
	m_acia->txd_handler().set("rs232", FUNC(rs232_port_device::write_txd));

	MC14411(config, m_brg, XTAL(1'843'200));
	m_brg->out_f<1>().set(FUNC(mekd5_state::write_f1_clock));
	m_brg->out_f<3>().set(FUNC(mekd5_state::write_f3_clock));
	m_brg->out_f<5>().set(FUNC(mekd5_state::write_f5_clock));
	m_brg->out_f<7>().set(FUNC(mekd5_state::write_f7_clock));
	m_brg->out_f<9>().set(FUNC(mekd5_state::write_f9_clock));
	m_brg->out_f<13>().set(FUNC(mekd5_state::write_f13_clock));

	rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, "terminal"));
	rs232.rxd_handler().set(m_acia, FUNC(acia6850_device::write_rxd));
	rs232.set_option_device_input_defaults("terminal", DEVICE_INPUT_DEFAULTS_NAME(terminal));
}

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

    ROMS

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

ROM_START(mekd5)
	ROM_REGION(0x10000,"maincpu",0)
	ROM_LOAD("d5bug.rom", 0xf000, 0x0800, CRC(67c00a2c) SHA1(ae321dbca0baf4b67d62bfec77266d9132b973bf))
ROM_END

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

  Game driver(s)

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

//    YEAR  NAME    PARENT  COMPAT  MACHINE   INPUT  CLASS        INIT        COMPANY     FULLNAME      FLAGS
COMP( 1980, mekd5,  0,      0,      mekd5,    mekd5, mekd5_state, init_mekd5, "Motorola", "MEK6802D5" , MACHINE_NO_SOUND )