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

Commodore C900
UNIX prototype

http://www.zimmers.net/cbmpics/c900.html
http://www.zimmers.net/cbmpics/cbm/900/c900-chips.txt

Chips: Z8001 CPU, Z8010 MMU, Z8030 SCC, Z8036 CIO. Crystal: 12MHz

The Z8030 runs 2 serial ports. The Z8036 runs the IEEE interface and the speaker.

The FDC is an intelligent device that communicates with the main board via the MMU.
It has a 6508 CPU.

Disk drive is a Matsushita JA-560-012

Our implementation of z80scc is currently incomplete and therefore unusable.

Increasing the amount of RAM stops the error message, however it still keeps running
into the weeds (jumps to 00000).

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


#include "emu.h"
#include "cpu/z8000/z8000.h"
//#include "machine/z80scc.h"
//#include "bus/rs232/rs232.h"
#include "machine/terminal.h"
#include "machine/z8536.h"


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

	DECLARE_READ16_MEMBER(key_r);
	DECLARE_READ16_MEMBER(stat_r);
	void kbd_put(u8 data);

	void c900(machine_config &config);
	void data_map(address_map &map);
	void io_map(address_map &map);
	void mem_map(address_map &map);
private:
	uint8_t m_term_data;
	required_device<cpu_device> m_maincpu;
	required_device<generic_terminal_device> m_terminal;
};

void c900_state::mem_map(address_map &map)
{
	map(0x00000, 0x07fff).rom().region("roms", 0);
}

void c900_state::data_map(address_map &map)
{
	map(0x00000, 0x07fff).rom().region("roms", 0);
	map(0x08000, 0x6ffff).ram();
}

void c900_state::io_map(address_map &map)
{
	map(0x0000, 0x007f).rw("cio", FUNC(z8036_device::read), FUNC(z8036_device::write)).umask16(0x00ff);
	//AM_RANGE(0x0100, 0x011f) AM_DEVREADWRITE8("scc", scc8030_device, zbus_r, zbus_w, 0x00ff)  // range for one channel
	map(0x0100, 0x0101).r(this, FUNC(c900_state::stat_r));
	map(0x0110, 0x0111).r(this, FUNC(c900_state::key_r));
	map(0x0111, 0x0111).w(m_terminal, FUNC(generic_terminal_device::write));
}

static INPUT_PORTS_START( c900 )
INPUT_PORTS_END

READ16_MEMBER( c900_state::key_r )
{
	uint8_t ret = m_term_data;
	m_term_data = 0;
	return ret;
}

READ16_MEMBER( c900_state::stat_r )
{
	return (m_term_data) ? 5 : 4;
}

void c900_state::kbd_put(u8 data)
{
	m_term_data = data;
}

/* F4 Character Displayer */
static const gfx_layout c900_charlayout =
{
	8, 16,                   /* 8 x 16 characters */
	256,                    /* 256 characters */
	1,                  /* 1 bits per pixel */
	{ 0 },                  /* no bitplanes */
	/* x offsets */
	{ 0, 1, 2, 3, 4, 5, 6, 7 },
	/* y offsets */
	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
	8*16                    /* every char takes 16 bytes */
};

static GFXDECODE_START( gfx_c900 )
	GFXDECODE_ENTRY( "chargen", 0x0000, c900_charlayout, 0, 1 )
GFXDECODE_END

MACHINE_CONFIG_START(c900_state::c900)
	/* basic machine hardware */
	MCFG_DEVICE_ADD("maincpu", Z8001, XTAL(12'000'000) / 2)
	MCFG_DEVICE_PROGRAM_MAP(mem_map)
	MCFG_DEVICE_DATA_MAP(data_map)
	MCFG_DEVICE_IO_MAP(io_map)

	MCFG_DEVICE_ADD("terminal", GENERIC_TERMINAL, 0)
	MCFG_GENERIC_TERMINAL_KEYBOARD_CB(PUT(c900_state, kbd_put))
	MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_c900)
	MCFG_PALETTE_ADD_MONOCHROME("palette")

	MCFG_DEVICE_ADD("cio", Z8036, 6'000'000)

	//MCFG_SCC8030_ADD("scc", 6'000'000, 326400, 0, 326400, 0)
	/* Port A */
	//MCFG_Z80SCC_OUT_TXDA_CB(WRITELINE("rs232a", rs232_port_device, write_txd))
	//MCFG_Z80SCC_OUT_DTRA_CB(WRITELINE("rs232a", rs232_port_device, write_dtr))
	//MCFG_Z80SCC_OUT_RTSA_CB(WRITELINE("rs232a", rs232_port_device, write_rts))
	//MCFG_Z80SCC_OUT_INT_CB(WRITELINE(*this, lwriter_state, scc_int))

	//MCFG_RS232_PORT_ADD ("rs232a", default_rs232_devices, "terminal")
	//MCFG_RS232_RXD_HANDLER (WRITELINE ("scc", scc8030_device, rxa_w))
	//MCFG_RS232_CTS_HANDLER (WRITELINE ("scc", scc8030_device, ctsa_w))
MACHINE_CONFIG_END

ROM_START( c900 )
	ROM_REGION16_LE( 0x8000, "roms", 0 )
	ROM_LOAD16_BYTE( "c 900 boot-h v 1.0.bin.u17", 0x0001, 0x4000, CRC(c3aa7fc1) SHA1(ff12dd100fa7b1e7e931e9a8ef4c4f5cc056e099) )
	ROM_LOAD16_BYTE( "c 900 boot-l v 1.0.bin.u18", 0x0000, 0x4000, CRC(0aa39272) SHA1(b2c5da4586d38fc66bb33aafeae4dbda36080f1e) )

	ROM_REGION( 0x2000, "fdc", 0 )
	ROM_LOAD( "s41_6-20-85.bin", 0x0000, 0x2000, CRC(ec245721) SHA1(4cc19014b4887833a56b1236dc5fe39cc5d7b5c3) )

	ROM_REGION( 0x1000, "chargen", 0 ) // this must be for the c900 terminal as the mainframe has no video output
	ROM_LOAD( "380217-01.u2", 0x0000, 0x1000, CRC(64cb4171) SHA1(e60d796170addfd27e2c33090f9c512c7e3f99f5) )
ROM_END

/*    YEAR  NAME  PARENT  COMPAT  MACHINE  INPUT  CLASS       INIT        COMPANY      FULLNAME         FLAGS */
COMP( 1985, c900, 0,      0,      c900,    c900,  c900_state, empty_init, "Commodore", "Commodore 900", MACHINE_IS_SKELETON )