summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/microkit.cpp
blob: 312337dfcb7b7ee63f28d4e970f21ee9edc676b3 (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
// license:BSD-3-Clause
// copyright-holders:Curt Coder
/*

    RCA COSMAC Microkit

    http://www.vintagecomputer.net/browse_thread.cfm?id=511

    Press CR or LF to get the * prompt.
    Commands:
    $Pxxxx - Jump to address xxxx
    ?Mxxxx yyyy - Dump memory starting at xxxx for yyyy bytes
    !Mxxxx yy zz... - Write data (yy etc) to memory xxxx. Data gets entered when you
                      press the space after the data.

    There's no sound or storage facilities, therefore no software.

    ToDo:
    - No technical manual or schematic available, so the entire driver is bodgy guesswork.
    - Address 0 needs to be read/writeable, otherwise the numbers you enter will get
            internally corrupted.
    - Address 8000 is IDL which hangs the system, so program counter is preset to 8001.
    - The keyboard is hooked up serially, which is ok, but the output to the terminal
            is rubbish, so parallel is used so you can at least see something.
    - When you enter commands, you can't see what you're doing.
    - When you enter numbers, they display as rubbish or act as control codes. They
            internally work though.
    - The computer looks like a rack-mount metal box with a rudimentary front panel.
            Buttons are: Reset; Load; Run program; Run Utility
            There is a RUN LED.
            None of these items are emulated.
            It also has a power switch and lamp, and a fuse.

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

#include "emu.h"
#include "cpu/cosmac/cosmac.h"
#include "bus/rs232/rs232.h"
#include "machine/terminal.h"


class microkit_state : public driver_device
{
public:
	microkit_state(const machine_config &mconfig, device_type type, const char *tag)
		: driver_device(mconfig, type, tag)
		, m_maincpu(*this, "maincpu")
		, m_rs232(*this, "rs232")
		, m_terminal(*this, "terminal")
	{ }

	void microkit(machine_config &config);

private:
	DECLARE_READ_LINE_MEMBER(clear_r);
	DECLARE_WRITE8_MEMBER(ram_w);
	DECLARE_READ8_MEMBER(ram_r);

	void microkit_io(address_map &map);
	void microkit_mem(address_map &map);

	virtual void machine_reset() override;
	uint8_t m_resetcnt;
	uint8_t m_ram_data;
	required_device<cosmac_device> m_maincpu;
	required_device<rs232_port_device> m_rs232;
	required_device<generic_terminal_device> m_terminal;
};

void microkit_state::microkit_mem(address_map &map)
{
	map(0x0000, 0x0000).rw(FUNC(microkit_state::ram_r), FUNC(microkit_state::ram_w));
	map(0x8000, 0x81ff).rom().region("maincpu", 0);
	map(0x8200, 0x83ff).ram();
}

void microkit_state::microkit_io(address_map &map)
{
	map(0x07, 0x07).nopw(); // writes a lots of zeros here
}

static INPUT_PORTS_START( microkit )
INPUT_PORTS_END

READ_LINE_MEMBER( microkit_state::clear_r )
{
	if (m_resetcnt < 0x10)
		m_maincpu->set_state_int(cosmac_device::COSMAC_R0, 0x8001); // skip IDL
	if (m_resetcnt < 0x20)
		m_resetcnt++;
	// set reset pin to normal
	return 1;
}

READ8_MEMBER( microkit_state::ram_r )
{
	return m_ram_data;
}

WRITE8_MEMBER( microkit_state::ram_w )
{
	m_ram_data = data;
	if (data > 0 && data < 0x80)
		m_terminal->write(space, 0, data);
}

void microkit_state::machine_reset()
{
	m_resetcnt = 0;
	m_ram_data = 0;
}

static DEVICE_INPUT_DEFAULTS_START( serial_keyb )
	DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_300 )
	DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_300 )
	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_2 )
DEVICE_INPUT_DEFAULTS_END


MACHINE_CONFIG_START(microkit_state::microkit)
	// basic machine hardware
	MCFG_DEVICE_ADD("maincpu", CDP1802, 1750000)
	MCFG_DEVICE_PROGRAM_MAP(microkit_mem)
	MCFG_DEVICE_IO_MAP(microkit_io)
	MCFG_COSMAC_WAIT_CALLBACK(VCC)
	MCFG_COSMAC_CLEAR_CALLBACK(READLINE(*this, microkit_state, clear_r))

	/* video hardware */
	MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, "keyboard")
	MCFG_RS232_RXD_HANDLER(INPUTLINE("maincpu", COSMAC_INPUT_LINE_EF4))
	MCFG_SLOT_OPTION_DEVICE_INPUT_DEFAULTS("keyboard", serial_keyb)
	MCFG_DEVICE_ADD("terminal", GENERIC_TERMINAL, 0)
MACHINE_CONFIG_END

ROM_START( microkit )
	ROM_REGION( 0x200, "maincpu", ROMREGION_INVERT )
	ROM_LOAD( "3.2b", 0x000, 0x100, CRC(6799357e) SHA1(c46e3322b8b1b6534a7da04806be29fa265951b7) )
	ROM_LOAD( "4.2a", 0x100, 0x100, CRC(27267bad) SHA1(838df9be2dc175584a1a6ee1770039118e49482e) )
ROM_END

COMP( 1975, microkit, 0, 0, microkit, microkit, microkit_state, empty_init, "RCA",  "COSMAC Microkit",  MACHINE_IS_SKELETON )