1
/******************************************************************************
2
Motorola Evaluation Kit 6800 D2
7
Juergen Buchmueller <pullmoll@t-online.de>, Jan 2000
11
range short description
12
0000-00ff RAM 256 bytes RAM
13
0100-01ff RAM optional 256 bytes RAM
14
6000-63ff PROM optional PROM
16
6000-67ff ROM optional ROM
17
8004-8007 PIA expansion port
18
8008-8009 ACIA cassette interface
19
8020-8023 PIA keyboard interface
20
a000-a07f RAM 128 bytes RAM (JBUG scratch)
21
c000-c3ff PROM optional PROM
23
c000-c7ff ROM optional ROM
24
e000-e3ff ROM JBUG monitor program
25
e400-ffff -/- mirrors of monitor rom
29
- Cassette (it is extremely complex, with approx 10 chips)
32
******************************************************************************/
33
#define ADDRESS_MAP_MODERN
36
#include "cpu/m6800/m6800.h"
37
#include "machine/6821pia.h"
38
#include "machine/6850acia.h"
39
#include "imagedev/cassette.h"
40
#include "sound/wave.h"
41
#include "imagedev/cartslot.h"
44
#define XTAL_MEKD2 1228800
46
class mekd2_state : public driver_device
49
mekd2_state(const machine_config &mconfig, device_type type, const char *tag)
50
: driver_device(mconfig, type, tag),
51
m_maincpu(*this, "maincpu"),
52
m_pia_s(*this, "pia_s"),
53
m_pia_u(*this, "pia_u"),
57
required_device<cpu_device> m_maincpu;
58
required_device<device_t> m_pia_s;
59
required_device<device_t> m_pia_u;
60
required_device<device_t> m_acia;
61
DECLARE_READ_LINE_MEMBER( mekd2_key40_r );
62
DECLARE_READ8_MEMBER( mekd2_key_r );
63
DECLARE_WRITE_LINE_MEMBER( mekd2_nmi_w );
64
DECLARE_WRITE8_MEMBER( mekd2_digit_w );
65
DECLARE_WRITE8_MEMBER( mekd2_segment_w );
73
/***********************************************************
77
************************************************************/
79
static ADDRESS_MAP_START( mekd2_mem , AS_PROGRAM, 8, mekd2_state)
80
AM_RANGE(0x0000, 0x00ff) AM_RAM // user ram
81
AM_RANGE(0x8004, 0x8007) AM_DEVREADWRITE("pia_u", pia6821_device, read, write)
82
AM_RANGE(0x8008, 0x8008) AM_DEVREADWRITE("acia", acia6850_device, status_read, control_write)
83
AM_RANGE(0x8009, 0x8009) AM_DEVREADWRITE("acia", acia6850_device, data_read, data_write)
84
AM_RANGE(0x8020, 0x8023) AM_DEVREADWRITE("pia_s", pia6821_device, read, write)
85
AM_RANGE(0xa000, 0xa07f) AM_RAM // system ram
86
AM_RANGE(0xe000, 0xe3ff) AM_ROM AM_MIRROR(0x1c00) /* JBUG ROM */
89
/***********************************************************
93
************************************************************/
97
Enter the 4 digit address then the command key:
99
- M : Examine and Change Memory (example: E000M, then G to skip to next, H to exit)
100
- E : Escape (abort) operation (H key in our emulation)
101
- R : Examine Registers
102
- G : Begin execution at specified address
103
- P : Punch data from memory to magnetic tape
104
- L : Load memory from magnetic tape
105
- N : Trace one instruction
106
- V : Set (and remove) breakpoints
108
The keys are laid out as:
118
static INPUT_PORTS_START( mekd2 )
120
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0") PORT_CODE(KEYCODE_0)
121
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("F") PORT_CODE(KEYCODE_F)
122
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E (hex)") PORT_CODE(KEYCODE_E)
123
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("D") PORT_CODE(KEYCODE_D)
126
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1)
127
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2") PORT_CODE(KEYCODE_2)
128
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3)
129
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("C") PORT_CODE(KEYCODE_C)
132
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4") PORT_CODE(KEYCODE_4)
133
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5") PORT_CODE(KEYCODE_5)
134
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("6") PORT_CODE(KEYCODE_6)
135
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("B") PORT_CODE(KEYCODE_B)
138
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("7") PORT_CODE(KEYCODE_7)
139
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8") PORT_CODE(KEYCODE_8)
140
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9") PORT_CODE(KEYCODE_9)
141
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_A)
144
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("P") PORT_CODE(KEYCODE_P)
145
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("L") PORT_CODE(KEYCODE_L)
146
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("N") PORT_CODE(KEYCODE_N)
147
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("V") PORT_CODE(KEYCODE_V)
150
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("M") PORT_CODE(KEYCODE_M)
151
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("E (escape)") PORT_CODE(KEYCODE_H)
152
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("R") PORT_CODE(KEYCODE_R)
153
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("G") PORT_CODE(KEYCODE_G)
157
/***********************************************************
159
Trace hardware (what happens when N is pressed)
161
************************************************************/
163
static TIMER_CALLBACK( mekd2_trace )
165
cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, ASSERT_LINE);
168
WRITE_LINE_MEMBER( mekd2_state::mekd2_nmi_w )
171
cputag_set_input_line(machine(), "maincpu", INPUT_LINE_NMI, CLEAR_LINE);
173
machine().scheduler().timer_set(attotime::from_usec(18), FUNC(mekd2_trace));
178
/***********************************************************
182
************************************************************/
184
READ_LINE_MEMBER( mekd2_state::mekd2_key40_r )
186
return BIT(m_keydata, 6);
189
READ8_MEMBER( mekd2_state::mekd2_key_r )
195
for (i = 0; i < 6; i++)
199
sprintf(kbdrow,"X%d",i);
200
m_keydata &= input_port_read(machine(), kbdrow);
206
i = BIT(m_keydata, 0) ? 0x80 : 0;
209
i = BIT(m_keydata, 1) ? 0x80 : 0;
212
i = BIT(m_keydata, 2) ? 0x80 : 0;
214
i = BIT(m_keydata, 3) ? 0x80 : 0;
216
return i | m_segment;
221
/***********************************************************
225
************************************************************/
227
WRITE8_MEMBER( mekd2_state::mekd2_segment_w )
229
m_segment = data & 0x7f;
232
WRITE8_MEMBER( mekd2_state::mekd2_digit_w )
237
for (i = 0; i < 6; i++)
240
output_set_digit_value(i, ~m_segment & 0x7f);
248
/***********************************************************
252
************************************************************/
254
static const pia6821_interface mekd2_s_mc6821_intf =
256
DEVCB_DRIVER_MEMBER(mekd2_state, mekd2_key_r), /* port A input */
257
DEVCB_NULL, /* port B input */
258
DEVCB_NULL, /* CA1 input */
259
DEVCB_DRIVER_LINE_MEMBER(mekd2_state, mekd2_key40_r), /* CB1 input */
260
DEVCB_NULL, /* CA2 input */
261
DEVCB_NULL, /* CB2 input */
262
DEVCB_DRIVER_MEMBER(mekd2_state, mekd2_segment_w), /* port A output */
263
DEVCB_DRIVER_MEMBER(mekd2_state, mekd2_digit_w), /* port B output */
264
DEVCB_DRIVER_LINE_MEMBER(mekd2_state, mekd2_nmi_w), /* CA2 output */
265
DEVCB_NULL, /* CB2 output */
266
DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_NMI), /* IRQA output */
267
DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_NMI) /* IRQB output */
270
static const pia6821_interface mekd2_u_mc6821_intf =
272
DEVCB_NULL, /* port A input */
273
DEVCB_NULL, /* port B input */
274
DEVCB_NULL, /* CA1 input */
275
DEVCB_NULL, /* CB1 input */
276
DEVCB_NULL, /* CA2 input */
277
DEVCB_NULL, /* CB2 input */
278
DEVCB_NULL, /* port A output */
279
DEVCB_NULL, /* port B output */
280
DEVCB_NULL, /* CA2 output */
281
DEVCB_NULL, /* CB2 output */
282
DEVCB_CPU_INPUT_LINE("maincpu", M6800_IRQ_LINE), /* IRQA output */
283
DEVCB_CPU_INPUT_LINE("maincpu", M6800_IRQ_LINE) /* IRQB output */
286
static ACIA6850_INTERFACE( mekd2_acia_intf )
288
XTAL_MEKD2 / 256, //connected to cassette circuit /* tx clock 4800Hz */
289
XTAL_MEKD2 / 256, //connected to cassette circuit /* rx clock varies, controlled by cassette circuit */
290
DEVCB_NULL,//LINE(cass),//connected to cassette circuit /* in rxd func */
291
DEVCB_NULL,//LINE(cass),//connected to cassette circuit /* out txd func */
292
DEVCB_NULL, /* in cts func */
293
DEVCB_NULL, //connected to cassette circuit /* out rts func */
294
DEVCB_NULL, /* in dcd func */
295
DEVCB_NULL /* out irq func */
298
static DEVICE_IMAGE_LOAD( mekd2_cart )
300
static const char magic[] = "MEK6800D2";
303
UINT8 ident, *RAM = image.device().machine().region("maincpu")->base();
305
image.fread( buff, sizeof (buff));
306
if (memcmp(buff, magic, sizeof (buff)))
308
logerror( "mekd2_rom_load: magic '%s' not found\n", magic);
309
return IMAGE_INIT_FAIL;
311
image.fread( &addr, 2);
312
addr = LITTLE_ENDIANIZE_INT16(addr);
313
image.fread( &size, 2);
314
size = LITTLE_ENDIANIZE_INT16(size);
315
image.fread( &ident, 1);
316
logerror("mekd2_rom_load: $%04X $%04X $%02X\n", addr, size, ident);
318
image.fread( &RAM[addr++], 1);
320
return IMAGE_INIT_PASS;
323
/***********************************************************
327
************************************************************/
329
static MACHINE_CONFIG_START( mekd2, mekd2_state )
330
/* basic machine hardware */
331
MCFG_CPU_ADD("maincpu", M6800, XTAL_MEKD2 / 2) /* 614.4 kHz */
332
MCFG_CPU_PROGRAM_MAP(mekd2_mem)
334
MCFG_DEFAULT_LAYOUT(layout_mekd2)
337
MCFG_SPEAKER_STANDARD_MONO("mono")
338
MCFG_SOUND_WAVE_ADD(WAVE_TAG, CASSETTE_TAG)
339
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
341
MCFG_CASSETTE_ADD( CASSETTE_TAG, default_cassette_interface )
343
/* Cartslot ?? does not come with one.. */
344
MCFG_CARTSLOT_ADD("cart")
345
MCFG_CARTSLOT_EXTENSION_LIST("d2")
346
MCFG_CARTSLOT_NOT_MANDATORY
347
MCFG_CARTSLOT_LOAD(mekd2_cart)
350
MCFG_PIA6821_ADD("pia_s", mekd2_s_mc6821_intf)
351
MCFG_PIA6821_ADD("pia_u", mekd2_u_mc6821_intf)
352
MCFG_ACIA6850_ADD("acia", mekd2_acia_intf)
355
/***********************************************************
359
************************************************************/
362
ROM_REGION(0x10000,"maincpu",0)
363
ROM_LOAD("jbug.rom", 0xe000, 0x0400, CRC(5ed08792) SHA1(b06e74652a4c4e67c4a12ddc191ffb8c07f3332e) )
366
/***************************************************************************
370
***************************************************************************/
372
/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */
373
CONS( 1977, mekd2, 0, 0, mekd2, mekd2, 0, "Motorola", "MEK6800D2" , GAME_NOT_WORKING )