summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/modellot.cpp
blob: c87ed0f971961c7c2d4d8c21d10c286a6517e16a (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
// license:BSD-3-Clause
// copyright-holders:Miodrag Milanovic, Robbbert
/**********************************************************************************

General Processor Modello T

2012-12-10 Skeleton driver.
2013-09-27 Added keyboard and cursor.

Made in Italy, a single board with numerous small daughter boards.
The 3 units (keyboard, disk drives, main unit) had wooden cabinets.
It had an inbuilt small green-screen CRT, like a Kaypro, and the RAM could
be 16, 32, or 48k. The FDC is a FD1791.

All the articles and doco (what there is of it) is all in Italian.

Doco found...

Port 77 out (cassette control):
- d0 = recording signal #1
- d1 = relay #1 (0 = open)
- d2 = recording signal #2
- d3 = relay #2 (0 = open)

Port 77 in:
- d0 = free
- d1 = playback signal
- d2 = signal from the anti-glare circuit
- d3 = same as d2

Optional ports:
- 3c to 3f (FDC)
- 5c to 5f (PRT)
- 6c to 6f (US2)
- 78 to 7b (US1)
It's not clear if these are meant to be 3881 PIOs connected to the devices, or for
the devices themselves. An example shows a i8251 used as the US1 device.

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

#include "emu.h"
#include "cpu/z80/z80.h"
#include "machine/keyboard.h"
#include "emupal.h"
#include "screen.h"


class modellot_state : public driver_device
{
public:
	modellot_state(const machine_config &mconfig, device_type type, const char *tag)
		: driver_device(mconfig, type, tag)
		, m_p_videoram(*this, "videoram")
		, m_maincpu(*this, "maincpu")
		, m_p_chargen(*this, "chargen")
	{ }

	void modellot(machine_config &config);

private:
	DECLARE_READ8_MEMBER(port77_r);
	DECLARE_READ8_MEMBER(portff_r);
	void kbd_put(u8 data);
	uint32_t screen_update_modellot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);

	void io_map(address_map &map);
	void mem_map(address_map &map);

	uint8_t m_term_data;
	virtual void machine_reset() override;
	required_shared_ptr<uint8_t> m_p_videoram;
	required_device<cpu_device> m_maincpu;
	required_region_ptr<u8> m_p_chargen;
};

void modellot_state::mem_map(address_map &map)
{
	map.unmap_value_high();
	map(0x0000, 0xbfff).ram(); // 48k ram
	map(0xc000, 0xc3ff).ram().share("videoram");
	map(0xe000, 0xffff).rom();
}

void modellot_state::io_map(address_map &map)
{
	map.unmap_value_high();
	map.global_mask(0xff);
	map(0x77, 0x77).r(FUNC(modellot_state::port77_r));
	map(0xff, 0xff).r(FUNC(modellot_state::portff_r));
}


/* Input ports */
static INPUT_PORTS_START( modellot )
INPUT_PORTS_END

READ8_MEMBER( modellot_state::port77_r)
{
	return 4;
}

READ8_MEMBER( modellot_state::portff_r)
{
	uint8_t data = (m_term_data) ? m_term_data ^ 0x7f : 0xff;
	m_term_data = 0;
	return data;
}

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

void modellot_state::machine_reset()
{
	m_term_data = 1;
	m_maincpu->set_state_int(Z80_PC, 0xe000);
}

const gfx_layout modellot_charlayout =
{
	8, 16,              /* 8x16 characters */
	128,                /* 128 characters */
	1,              /* 1 bits per pixel */
	{0},                /* no bitplanes; 1 bit per pixel */
	{0,1,2,3,4,5,6,7},
	{0, 8, 2 * 8, 3 * 8, 4 * 8, 5 * 8, 6 * 8, 7 * 8,
		0x400*8, 0x401*8, 0x402*8, 0x403*8, 0x404*8, 0x405*8, 0x406*8, 0x407*8},
	8*8             /* space between characters */
};

static GFXDECODE_START( gfx_modellot )
	GFXDECODE_ENTRY( "chargen", 0x0000, modellot_charlayout, 0, 1 )
GFXDECODE_END


uint32_t modellot_state::screen_update_modellot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	uint8_t y,ra,chr,gfx,inv;
	uint16_t sy=0,ma=0,x;

	for (y = 0; y < 16; y++)
	{
		for (ra = 0; ra < 16; ra++)
		{
			uint16_t *p = &bitmap.pix16(sy++);

			for (x = 0; x < 64; x++)
			{
				inv = 0;

				chr = m_p_videoram[x+ma];

				if (BIT(chr, 7)) inv = 0xff;

				chr &= 0x7f; // cursor

				if (ra < 8)
					gfx = m_p_chargen[(chr<<3) | ra ];
				else
					gfx = m_p_chargen[(chr<<3) | (ra-8) | 0x400];

				gfx ^= inv;

				/* Display a scanline of a character */
				*p++ = BIT(gfx, 7);
				*p++ = BIT(gfx, 6);
				*p++ = BIT(gfx, 5);
				*p++ = BIT(gfx, 4);
				*p++ = BIT(gfx, 3);
				*p++ = BIT(gfx, 2);
				*p++ = BIT(gfx, 1);
				*p++ = BIT(gfx, 0);
			}
		}
		ma+=64;
	}
	return 0;
}

MACHINE_CONFIG_START(modellot_state::modellot)
	/* basic machine hardware */
	MCFG_DEVICE_ADD("maincpu",Z80, XTAL(4'000'000))
	MCFG_DEVICE_PROGRAM_MAP(mem_map)
	MCFG_DEVICE_IO_MAP(io_map)

	/* video hardware */
	MCFG_SCREEN_ADD_MONOCHROME("screen", RASTER, rgb_t::green())
	MCFG_SCREEN_REFRESH_RATE(50)
	MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
	MCFG_SCREEN_SIZE(64*8, 16*16)
	MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 16*16-1)
	MCFG_SCREEN_UPDATE_DRIVER(modellot_state, screen_update_modellot)
	MCFG_SCREEN_PALETTE("palette")

	MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_modellot)
	PALETTE(config, "palette", palette_device::MONOCHROME);

	/* Devices */
	generic_keyboard_device &keyboard(GENERIC_KEYBOARD(config, "keyboard", 0));
	keyboard.set_keyboard_callback(FUNC(modellot_state::kbd_put));
MACHINE_CONFIG_END

/* ROM definition */
ROM_START( modellot )
	ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )
	//ROM_LOAD( "fdc8119.u3", 0x0000, 0x0400, CRC(a8aee944) SHA1(f2cc598ed2e7a1a620e2f3f53c1a573965f6af26))
	ROM_LOAD( "dt49-48.u1", 0xe000, 0x0400, CRC(2441c438) SHA1(832994a4214a744b7e19e5f74000c95ae65e3759))
	ROM_LOAD( "ht20.u2",    0xe400, 0x0400, CRC(497c0495) SHA1(d03beebc4c31284729f6eac3bdf1fbf44adf7fff))

	ROM_REGION( 0x0800, "chargen", ROMREGION_INVERT )
	ROM_LOAD( "gcem1.u3", 0x0000, 0x0200, CRC(e7739268) SHA1(091ef69282abe657d5f38c70a572964f5200a1d5))
	ROM_CONTINUE(0x400, 0x200)
	ROM_LOAD( "gcem2.u4", 0x0200, 0x0200, CRC(6614330e) SHA1(880a541fb0ef6f37ac89439f9ea75a313c3e53d6))
	ROM_CONTINUE(0x600, 0x200)
ROM_END

/* Driver */
COMP( 1979, modellot, 0, 0, modellot, modellot, modellot_state, empty_init, "General Processor", "Modello T", MACHINE_IS_SKELETON )