summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/consola_emt.cpp
blob: b91c1c1f51708f5c4fb7e0bf23895bf5d52b14b4 (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
// license: BSD-3-Clause
// copyright-holders: Dirk Best
/***************************************************************************

    Indra / Amper "Consola EMT"

    On-board ticketing console used on public transport buses on Madrid
    from 1997 to 2007.

    CPU Intel N80C188XL25 with a 50.0 HMz xtal near it.
    1 Oki MSM62X42B real time clock with built-in xtal
    4 x HY62810DA 128kx8bit CMOS SRAM
    MCU (for ticket pinter?) Intel N87C51FA (unprotected) with 11.0592 MHz xtal near it
    2 x Zilog Z85230 with a 4.9152 MHZ xtal near them
    5 x 8 dips banks:
    -FUNCIONES = Functions
    -L-NUMBUS  = Low / Bus number
    -H-NUMBUS  = High / Bus number
    -L-NUMFAB  = Low / Manufacturer number
    -H-NUMFAB  = High / Manufacturer number
    LCD display = PC2002LRU-LSO-H

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

#include "emu.h"
#include "cpu/i86/i186.h"
#include "cpu/mcs51/mcs51.h"
#include "machine/msm6242.h"
#include "machine/z80scc.h"
#include "video/hd44780.h"
#include "emupal.h"
#include "screen.h"


//**************************************************************************
//  TYPE DEFINITIONS
//**************************************************************************

class consoemt_state : public driver_device
{
public:
	consoemt_state(const machine_config &mconfig, device_type type, const char *tag)
		: driver_device(mconfig, type, tag),
		m_maincpu(*this, "maincpu"),
		m_mcu(*this, "mcu"),
		m_lcdc(*this, "lcdc")
	{ }

	void consoemt(machine_config &config);

protected:
	virtual void machine_start() override;

private:
	required_device<cpu_device> m_maincpu;
	required_device<mcs51_cpu_device> m_mcu;
	required_device<hd44780_device> m_lcdc;

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

	void consoemt_palette(palette_device &palette) const;
	HD44780_PIXEL_UPDATE(lcd_pixel_update);
};


//**************************************************************************
//  ADDRESS MAPS
//**************************************************************************

void consoemt_state::mem_map(address_map &map)
{
	map(0x00000, 0x7ffff).ram();
	map(0xc0000, 0xfffff).rom().region("maincpu", 0);
}

void consoemt_state::io_map(address_map &map)
{
	map(0x180, 0x18f).rw("rtc", FUNC(msm6242_device::read), FUNC(msm6242_device::write));
	map(0x200, 0x200).portr("FUNCIONES"); // maybe
	map(0x210, 0x210).portr("NUMBUS-L");
	map(0x220, 0x220).portr("NUMBUS-H");
	map(0x230, 0x230).portr("NUMFAB-L");
	map(0x240, 0x240).portr("NUMFAB-H");
	map(0x280, 0x281).rw(m_lcdc, FUNC(hd44780_device::read), FUNC(hd44780_device::write));
}


//**************************************************************************
//  INPUT PORT DEFINITIONS
//**************************************************************************

static INPUT_PORTS_START( consoemt )
	PORT_START("FUNCIONES")
	PORT_DIPUNKNOWN_DIPLOC(0x01, 0x00, "FUNCIONES:1")
	PORT_DIPUNKNOWN_DIPLOC(0x02, 0x00, "FUNCIONES:2")
	PORT_DIPUNKNOWN_DIPLOC(0x04, 0x00, "FUNCIONES:3")
	PORT_DIPUNKNOWN_DIPLOC(0x08, 0x00, "FUNCIONES:4")
	PORT_DIPUNKNOWN_DIPLOC(0x10, 0x00, "FUNCIONES:5")
	PORT_DIPUNKNOWN_DIPLOC(0x20, 0x00, "FUNCIONES:6")
	PORT_DIPUNKNOWN_DIPLOC(0x40, 0x00, "FUNCIONES:7")
	PORT_DIPUNKNOWN_DIPLOC(0x80, 0x00, "FUNCIONES:8")

	PORT_START("NUMBUS-L")
	PORT_DIPNAME(0x01, 0x00, "Bus 1") PORT_DIPLOCATION("NUMBUS-L:1")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x01, DEF_STR( On ))
	PORT_DIPNAME(0x02, 0x00, "Bus 2") PORT_DIPLOCATION("NUMBUS-L:2")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x02, DEF_STR( On ))
	PORT_DIPNAME(0x04, 0x00, "Bus 4") PORT_DIPLOCATION("NUMBUS-L:3")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x04, DEF_STR( On ))
	PORT_DIPNAME(0x08, 0x00, "Bus 8") PORT_DIPLOCATION("NUMBUS-L:4")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x08, DEF_STR( On ))
	PORT_DIPNAME(0x10, 0x00, "Bus 16") PORT_DIPLOCATION("NUMBUS-L:5")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x10, DEF_STR( On ))
	PORT_DIPNAME(0x20, 0x00, "Bus 32") PORT_DIPLOCATION("NUMBUS-L:6")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x20, DEF_STR( On ))
	PORT_DIPNAME(0x40, 0x00, "Bus 64") PORT_DIPLOCATION("NUMBUS-L:7")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x40, DEF_STR( On ))
	PORT_DIPNAME(0x80, 0x00, "Bus 128") PORT_DIPLOCATION("NUMBUS-L:8")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x80, DEF_STR( On ))

	PORT_START("NUMBUS-H")
	PORT_DIPNAME(0x01, 0x00, "Bus 256") PORT_DIPLOCATION("NUMBUS-H:1")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x01, DEF_STR( On ))
	PORT_DIPNAME(0x02, 0x00, "Bus 512") PORT_DIPLOCATION("NUMBUS-H:2")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x02, DEF_STR( On ))
	PORT_DIPNAME(0x04, 0x00, "Bus 1024") PORT_DIPLOCATION("NUMBUS-H:3")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x04, DEF_STR( On ))
	PORT_DIPNAME(0x08, 0x00, "Bus 2048") PORT_DIPLOCATION("NUMBUS-H:4")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x08, DEF_STR( On ))
	PORT_DIPNAME(0x10, 0x00, "Bus 4096") PORT_DIPLOCATION("NUMBUS-H:5")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x10, DEF_STR( On ))
	PORT_DIPNAME(0x20, 0x00, "Bus 8192") PORT_DIPLOCATION("NUMBUS-H:6")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x20, DEF_STR( On ))
	PORT_DIPNAME(0x40, 0x00, "Bus 16384") PORT_DIPLOCATION("NUMBUS-H:7")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x40, DEF_STR( On ))
	PORT_DIPUNKNOWN_DIPLOC(0x80, 0x00, "NUMBUS-H:8")

	PORT_START("NUMFAB-L")
	PORT_DIPNAME(0x01, 0x00, "Fab 1") PORT_DIPLOCATION("NUMFAB-L:1")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x01, DEF_STR( On ))
	PORT_DIPNAME(0x02, 0x00, "Fab 2") PORT_DIPLOCATION("NUMFAB-L:2")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x02, DEF_STR( On ))
	PORT_DIPNAME(0x04, 0x00, "Fab 4") PORT_DIPLOCATION("NUMFAB-L:3")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x04, DEF_STR( On ))
	PORT_DIPNAME(0x08, 0x00, "Fab 8") PORT_DIPLOCATION("NUMFAB-L:4")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x08, DEF_STR( On ))
	PORT_DIPNAME(0x10, 0x00, "Fab 16") PORT_DIPLOCATION("NUMFAB-L:5")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x10, DEF_STR( On ))
	PORT_DIPNAME(0x20, 0x00, "Fab 32") PORT_DIPLOCATION("NUMFAB-L:6")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x20, DEF_STR( On ))
	PORT_DIPNAME(0x40, 0x00, "Fab 64") PORT_DIPLOCATION("NUMFAB-L:7")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x40, DEF_STR( On ))
	PORT_DIPNAME(0x80, 0x00, "Fab 128") PORT_DIPLOCATION("NUMFAB-L:8")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x80, DEF_STR( On ))

	PORT_START("NUMFAB-H")
	PORT_DIPNAME(0x01, 0x00, "Fab 256") PORT_DIPLOCATION("NUMFAB-H:1")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x01, DEF_STR( On ))
	PORT_DIPNAME(0x02, 0x00, "Fab 512") PORT_DIPLOCATION("NUMFAB-H:2")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x02, DEF_STR( On ))
	PORT_DIPNAME(0x04, 0x00, "Fab 1024") PORT_DIPLOCATION("NUMFAB-H:3")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x04, DEF_STR( On ))
	PORT_DIPNAME(0x08, 0x00, "Fab 2048") PORT_DIPLOCATION("NUMFAB-H:4")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x08, DEF_STR( On ))
	PORT_DIPNAME(0x10, 0x00, "Fab 4096") PORT_DIPLOCATION("NUMFAB-H:5")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x10, DEF_STR( On ))
	PORT_DIPNAME(0x20, 0x00, "Fab 8192") PORT_DIPLOCATION("NUMFAB-H:6")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x20, DEF_STR( On ))
	PORT_DIPNAME(0x40, 0x00, "Fab 16384") PORT_DIPLOCATION("NUMFAB-H:7")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x40, DEF_STR( On ))
	PORT_DIPNAME(0x80, 0x00, "Fab 32768") PORT_DIPLOCATION("NUMFAB-H:8")
	PORT_DIPSETTING(   0x00, DEF_STR( Off ))
	PORT_DIPSETTING(   0x80, DEF_STR( On ))
INPUT_PORTS_END


//**************************************************************************
//  VIDEO EMULATION
//**************************************************************************

void consoemt_state::consoemt_palette(palette_device &palette) const
{
	palette.set_pen_color(0, rgb_t(138, 146, 148)); // background
	palette.set_pen_color(1, rgb_t( 92,  83,  88)); // lcd pixel on
	palette.set_pen_color(2, rgb_t(131, 136, 139)); // lcd pixel off
}

HD44780_PIXEL_UPDATE( consoemt_state::lcd_pixel_update )
{
	// char size is 5x8
	if (x > 4 || y > 7)
		return;

	if (line < 2 && pos < 20)
		bitmap.pix16(1 + y + line*8 + line, 1 + pos*6 + x) = state ? 1 : 2;
}


//**************************************************************************
//  MACHINE EMULATION
//**************************************************************************

void consoemt_state::machine_start()
{
}


//**************************************************************************
//  MACHINE DEFINTIONS
//**************************************************************************

void consoemt_state::consoemt(machine_config &config)
{
	I80188(config, m_maincpu, 50_MHz_XTAL / 2); // N80C188XL25
	m_maincpu->set_addrmap(AS_PROGRAM, &consoemt_state::mem_map);
	m_maincpu->set_addrmap(AS_IO, &consoemt_state::io_map);

	I80C51(config, m_mcu, 11.0592_MHz_XTAL);

	MSM6242(config, "rtc", XTAL(32'768));

	SCC85230(config, "uart1", 4.9152_MHz_XTAL);

	SCC85230(config, "uart2", 4.9152_MHz_XTAL);

	// video hardware
	screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD));
	screen.set_refresh_hz(50);
	screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */
	screen.set_size(6*20+1, 19);
	screen.set_visarea_full();
	screen.set_screen_update(m_lcdc, FUNC(hd44780_device::screen_update));
	screen.set_palette("palette");

	PALETTE(config, "palette", FUNC(consoemt_state::consoemt_palette), 3);

	KS0066_F05(config, m_lcdc, 0);
	m_lcdc->set_lcd_size(2, 20);
	m_lcdc->set_pixel_update_cb(FUNC(consoemt_state::lcd_pixel_update));
}


//**************************************************************************
//  ROM DEFINITIONS
//**************************************************************************

ROM_START( consoemt )
	ROM_REGION(0x40000, "maincpu", 0)
	ROM_LOAD("pupitre_emt_24_04_03_6adc.ic1", 0x00000, 0x40000, CRC(fbafc173) SHA1(c0366a553125d42f18c24faa71467144eae42972))

	ROM_REGION(0x2000, "mcu", 0)
	ROM_LOAD("v26_7caa_n87c51fa.ic20", 0x0000, 0x2000, CRC(37e6c202) SHA1(7b240ed6474240090c26de11048a40c5870886dd))
ROM_END


//**************************************************************************
//  SYSTEM DRIVERS
//**************************************************************************

//    YEAR  NAME      PARENT  COMPAT  MACHINE   INPUT     CLASS           INIT        COMPANY          FULLNAME       FLAGS
COMP( 2003, consoemt, 0,      0,      consoemt, consoemt, consoemt_state, empty_init, "Indra / Amper", "Consola EMT", MACHINE_IS_SKELETON )