1 // license:BSD-3-Clause
2 // copyright-holders:Sergey Svishchev
3 /***************************************************************************
4 
5     drivers/gridcomp.cpp
6 
7     Driver file for GRiD Compass series
8 
9     US patent 4,571,456 describes model 1101:
10 
11     - 15 MHz XTAL, produces
12         - 5 MHz system clock for CPU, FPU, OSP
13         - 7.5 MHz pixel clock
14     - Intel 8086 - CPU
15     - Intel 8087 - FPU
16     - Intel 80130 - Operating System Processor, equivalent of:
17         - 8259 PIC
18         - 8254 PIT
19     - Texas Instruments TMS9914 GPIB controller
20     - Intel 7220 Bubble Memory Controller
21         - 7110 Magnetic Bubble Memory modules and support chips
22     - X2210D - EAROM for machine ID
23     - MM58174AN - Real-Time Clock
24     - (custom DMA logic)
25     - Intel 8741 - keyboard MCU
26     - Intel 8274 - UART
27     - Intel 8255 - modem interface
28         - 2x DAC0832LCN - DAC
29         - MK5089N - DTMF generator
30         - ...
31 
32     high-resolution motherboard photo (enough to read chip numbers): http://deltacxx.insomnia247.nl/gridcompass/motherboard.jpg
33 
34     differences between models:
35     - Compass 110x do not have GRiDROM slots.
36     - Compass II (112x, 113x) have 4 of them.
37     - Compass II 113x have 512x256 screen size
38     - Compass 11x9 have 512K ram
39     - Compass II have DMA addresses different from Compass 110x
40 
41     to do:
42 
43     - keyboard: decode and add the rest of keycodes
44         keycode table can be found here on page A-2:
45         http://deltacxx.insomnia247.nl/gridcompass/large_files/Yahoo%20group%20backup/RuGRiD-Laptop/files/6_GRiD-OS-Programming/3_GRiD-OS-Reference.pdf
46     - EAROM, RTC
47     - serial port (incomplete), modem (incl. DTMF generator)
48     - proper custom DMA logic timing
49     - implement units other than 1101
50 
51     missing dumps:
52 
53     - BIOS from models other than 1139 and late 1101 revision (the latter one is detected as 1108 in VERIFYPROM utility)
54     - GRiDROM's
55     - keyboard MCU
56     - external floppy and hard disk (2101, 2102)
57 
58     to boot CCOS 3.0.1:
59     - convert GRIDOS.IMD to IMG format
60     - create zero-filled 384K bubble memory image and attach it as -memcard
61     - attach floppy with `-ieee_grid grid2102 -flop GRIDOS.IMG`
62     - use grid1101 with 'ccos' ROM
63 
64 ***************************************************************************/
65 
66 #include "emu.h"
67 
68 #include "bus/ieee488/ieee488.h"
69 #include "bus/rs232/rs232.h"
70 #include "cpu/i86/i86.h"
71 #include "machine/gridkeyb.h"
72 #include "machine/i7220.h"
73 #include "machine/i80130.h"
74 #include "machine/i8255.h"
75 #include "machine/mm58174.h"
76 #include "machine/ram.h"
77 #include "machine/tms9914.h"
78 #include "machine/z80sio.h"
79 #include "sound/spkrdev.h"
80 
81 #include "emupal.h"
82 #include "screen.h"
83 #include "softlist.h"
84 #include "speaker.h"
85 
86 
87 //#define LOG_GENERAL (1U <<  0) //defined in logmacro.h already
88 #define LOG_KEYBOARD  (1U <<  1)
89 #define LOG_DEBUG     (1U <<  2)
90 
91 #define VERBOSE (LOG_GENERAL)
92 //#define LOG_OUTPUT_FUNC printf
93 #include "logmacro.h"
94 
95 #define LOGKBD(...) LOGMASKED(LOG_KEYBOARD, __VA_ARGS__)
96 #define LOGDBG(...) LOGMASKED(LOG_DEBUG, __VA_ARGS__)
97 
98 
99 #define I80130_TAG      "osp"
100 
101 class gridcomp_state : public driver_device
102 {
103 public:
gridcomp_state(const machine_config & mconfig,device_type type,const char * tag)104 	gridcomp_state(const machine_config &mconfig, device_type type, const char *tag)
105 		: driver_device(mconfig, type, tag)
106 		, m_maincpu(*this, "maincpu")
107 		, m_osp(*this, I80130_TAG)
108 		, m_rtc(*this, "rtc")
109 		, m_modem(*this, "modem")
110 		, m_uart8274(*this, "uart8274")
111 		, m_speaker(*this, "speaker")
112 		, m_ram(*this, RAM_TAG)
113 		, m_tms9914(*this, "hpib")
114 	{ }
115 
unemulated_features()116 	static constexpr feature_type unemulated_features() { return feature::WAN; }
117 
118 	void grid1129(machine_config &config);
119 	void grid1131(machine_config &config);
120 	void grid1121(machine_config &config);
121 	void grid1139(machine_config &config);
122 	void grid1109(machine_config &config);
123 	void grid1101(machine_config &config);
124 
125 	void init_gridcomp();
126 
127 private:
128 	required_device<cpu_device> m_maincpu;
129 	required_device<i80130_device> m_osp;
130 	required_device<mm58174_device> m_rtc;
131 	required_device<i8255_device> m_modem;
132 	optional_device<i8274_device> m_uart8274;
133 	required_device<speaker_sound_device> m_speaker;
134 	required_device<ram_device> m_ram;
135 	required_device<tms9914_device> m_tms9914;
136 
137 	DECLARE_MACHINE_START(gridcomp);
138 	DECLARE_MACHINE_RESET(gridcomp);
139 
140 	IRQ_CALLBACK_MEMBER(irq_callback);
141 
142 	uint16_t grid_9ff0_r(offs_t offset);
143 	uint16_t grid_keyb_r(offs_t offset);
144 	uint8_t grid_modem_r(offs_t offset);
145 	void grid_keyb_w(offs_t offset, uint16_t data);
146 	void grid_modem_w(offs_t offset, uint8_t data);
147 
148 	void grid_dma_w(offs_t offset, uint8_t data);
149 	uint8_t grid_dma_r(offs_t offset);
150 
151 	uint32_t screen_update_110x(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
152 	uint32_t screen_update_113x(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
153 	uint32_t screen_update_generic(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int px);
154 
155 	void kbd_put(u16 data);
156 
157 	void grid1101_io(address_map &map);
158 	void grid1101_map(address_map &map);
159 	void grid1121_map(address_map &map);
160 
161 	bool m_kbd_ready;
162 	uint16_t m_kbd_data;
163 
164 	uint16_t *m_videoram;
165 };
166 
167 
grid_9ff0_r(offs_t offset)168 uint16_t gridcomp_state::grid_9ff0_r(offs_t offset)
169 {
170 	uint16_t data = 0;
171 
172 	switch (offset)
173 	{
174 	case 0:
175 		data = 0xbb66;
176 		break;
177 	}
178 
179 	LOGDBG("9FF0: %02x == %02x\n", 0x9ff00 + (offset << 1), data);
180 
181 	return data;
182 }
183 
grid_keyb_r(offs_t offset)184 uint16_t gridcomp_state::grid_keyb_r(offs_t offset)
185 {
186 	uint16_t data = 0;
187 
188 	switch (offset)
189 	{
190 	case 0:
191 		data = m_kbd_data;
192 		m_kbd_data = 0xff;
193 		m_kbd_ready = false;
194 		m_osp->ir4_w(CLEAR_LINE);
195 		break;
196 
197 	case 1:
198 		data = m_kbd_ready ? 2 : 0;
199 		break;
200 	}
201 
202 	LOGKBD("%02x == %02x\n", 0xdffc0 + (offset << 1), data);
203 
204 	return data;
205 }
206 
grid_keyb_w(offs_t offset,uint16_t data)207 void gridcomp_state::grid_keyb_w(offs_t offset, uint16_t data)
208 {
209 	LOGKBD("%02x <- %02x\n", 0xdffc0 + (offset << 1), data);
210 }
211 
kbd_put(u16 data)212 void gridcomp_state::kbd_put(u16 data)
213 {
214 	m_kbd_data = data;
215 	m_kbd_ready = true;
216 	m_osp->ir4_w(ASSERT_LINE);
217 }
218 
219 
220 // reject all commands
grid_modem_r(offs_t offset)221 uint8_t gridcomp_state::grid_modem_r(offs_t offset)
222 {
223 	uint8_t data = 0;
224 	LOG("MDM %02x == %02x\n", 0xdfec0 + (offset << 1), data);
225 
226 	return data;
227 }
228 
grid_modem_w(offs_t offset,uint8_t data)229 void gridcomp_state::grid_modem_w(offs_t offset, uint8_t data)
230 {
231 	LOG("MDM %02x <- %02x\n", 0xdfec0 + (offset << 1), data);
232 }
233 
grid_dma_w(offs_t offset,uint8_t data)234 void gridcomp_state::grid_dma_w(offs_t offset, uint8_t data)
235 {
236 	m_tms9914->write(7, data);
237 	// LOG("DMA %02x <- %02x\n", offset, data);
238 }
239 
grid_dma_r(offs_t offset)240 uint8_t gridcomp_state::grid_dma_r(offs_t offset)
241 {
242 	int ret = m_tms9914->read(7);
243 	// LOG("DMA %02x == %02x\n", offset, ret);
244 	return ret;
245 }
246 
screen_update_generic(screen_device & screen,bitmap_ind16 & bitmap,const rectangle & cliprect,int px)247 uint32_t gridcomp_state::screen_update_generic(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int px)
248 {
249 	for (int y = 0; y < 240; y++)
250 	{
251 		uint16_t *p = &bitmap.pix(y);
252 
253 		int const offset = y * (px / 16);
254 
255 		for (int x = offset; x < offset + px / 16; x++)
256 		{
257 			uint16_t const gfx = m_videoram[x];
258 
259 			for (int i = 15; i >= 0; i--)
260 			{
261 				*p++ = BIT(gfx, i);
262 			}
263 		}
264 	}
265 
266 	return 0;
267 }
268 
screen_update_110x(screen_device & screen,bitmap_ind16 & bitmap,const rectangle & cliprect)269 uint32_t gridcomp_state::screen_update_110x(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
270 {
271 	return screen_update_generic(screen, bitmap, cliprect, 320);
272 }
273 
screen_update_113x(screen_device & screen,bitmap_ind16 & bitmap,const rectangle & cliprect)274 uint32_t gridcomp_state::screen_update_113x(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
275 {
276 	return screen_update_generic(screen, bitmap, cliprect, 512);
277 }
278 
279 
init_gridcomp()280 void gridcomp_state::init_gridcomp()
281 {
282 }
283 
MACHINE_START_MEMBER(gridcomp_state,gridcomp)284 MACHINE_START_MEMBER(gridcomp_state, gridcomp)
285 {
286 	address_space &program = m_maincpu->space(AS_PROGRAM);
287 
288 	program.install_readwrite_bank(0, m_ram->size() - 1, "bank10");
289 	membank("bank10")->set_base(m_ram->pointer());
290 
291 	m_videoram = (uint16_t *)m_maincpu->space(AS_PROGRAM).get_write_ptr(0x400);
292 }
293 
MACHINE_RESET_MEMBER(gridcomp_state,gridcomp)294 MACHINE_RESET_MEMBER(gridcomp_state, gridcomp)
295 {
296 	m_kbd_ready = false;
297 }
298 
IRQ_CALLBACK_MEMBER(gridcomp_state::irq_callback)299 IRQ_CALLBACK_MEMBER(gridcomp_state::irq_callback)
300 {
301 	return m_osp->inta_r();
302 }
303 
304 
grid1101_map(address_map & map)305 void gridcomp_state::grid1101_map(address_map &map)
306 {
307 	map.unmap_value_high();
308 	map(0xdfe80, 0xdfe83).rw("i7220", FUNC(i7220_device::read), FUNC(i7220_device::write)).umask16(0x00ff);
309 	map(0xdfea0, 0xdfeaf).unmaprw(); // ??
310 	map(0xdfec0, 0xdfecf).rw(FUNC(gridcomp_state::grid_modem_r), FUNC(gridcomp_state::grid_modem_w)).umask16(0x00ff); // incl. DTMF generator
311 	map(0xdff00, 0xdff1f).rw("uart8274", FUNC(i8274_device::ba_cd_r), FUNC(i8274_device::ba_cd_w)).umask16(0x00ff);
312 	map(0xdff40, 0xdff5f).rw(m_rtc, FUNC(mm58174_device::read), FUNC(mm58174_device::write)).umask16(0xff00);
313 	map(0xdff80, 0xdff8f).rw("hpib", FUNC(tms9914_device::read), FUNC(tms9914_device::write)).umask16(0x00ff);
314 	map(0xdffc0, 0xdffcf).rw(FUNC(gridcomp_state::grid_keyb_r), FUNC(gridcomp_state::grid_keyb_w)); // Intel 8741 MCU
315 	map(0xe0000, 0xeffff).rw(FUNC(gridcomp_state::grid_dma_r), FUNC(gridcomp_state::grid_dma_w)); // DMA
316 	map(0xfc000, 0xfffff).rom().region("user1", 0);
317 }
318 
grid1121_map(address_map & map)319 void gridcomp_state::grid1121_map(address_map &map)
320 {
321 	map.unmap_value_high();
322 	map(0x90000, 0x97fff).unmaprw(); // ?? ROM slot
323 	map(0x9ff00, 0x9ff0f).unmaprw(); // .r(FUNC(gridcomp_state::grid_9ff0_r)); // ?? ROM?
324 	map(0xc0000, 0xcffff).unmaprw(); // ?? ROM slot -- signature expected: 0x4554, 0x5048
325 	map(0xdfa00, 0xdfdff).rw(FUNC(gridcomp_state::grid_dma_r), FUNC(gridcomp_state::grid_dma_w)); // DMA
326 	map(0xdfe00, 0xdfe1f).unmaprw(); // .rw("uart8274", FUNC(i8274_device::ba_cd_r), FUNC(i8274_device::ba_cd_w)).umask16(0x00ff);
327 	map(0xdfe40, 0xdfe4f).unmaprw(); // ?? diagnostic 8274
328 	map(0xdfe80, 0xdfe83).rw("i7220", FUNC(i7220_device::read), FUNC(i7220_device::write)).umask16(0x00ff);
329 	map(0xdfea0, 0xdfeaf).unmaprw(); // ??
330 	map(0xdfec0, 0xdfecf).rw(FUNC(gridcomp_state::grid_modem_r), FUNC(gridcomp_state::grid_modem_w)).umask16(0x00ff); // incl. DTMF generator
331 	map(0xdff40, 0xdff5f).rw(m_rtc, FUNC(mm58174_device::read), FUNC(mm58174_device::write)).umask16(0xff00);
332 	map(0xdff80, 0xdff8f).rw("hpib", FUNC(tms9914_device::read), FUNC(tms9914_device::write)).umask16(0x00ff);
333 	map(0xdffc0, 0xdffcf).rw(FUNC(gridcomp_state::grid_keyb_r), FUNC(gridcomp_state::grid_keyb_w)); // Intel 8741 MCU
334 	map(0xfc000, 0xfffff).rom().region("user1", 0);
335 }
336 
grid1101_io(address_map & map)337 void gridcomp_state::grid1101_io(address_map &map)
338 {
339 	map(0x0000, 0x000f).m(m_osp, FUNC(i80130_device::io_map));
340 }
341 
INPUT_PORTS_START(gridcomp)342 static INPUT_PORTS_START( gridcomp )
343 INPUT_PORTS_END
344 
345 /*
346  * IRQ0 serial
347  * IRQ1 bubble
348  * IRQ2 modem
349  * IRQ3 system tick || vert sync
350  * IRQ4 keyboard
351  * IRQ5 gpib
352  * IRQ6 8087
353  * IRQ7 ring
354  */
355 void gridcomp_state::grid1101(machine_config &config)
356 {
357 	I8086(config, m_maincpu, XTAL(15'000'000) / 3);
358 	m_maincpu->set_addrmap(AS_PROGRAM, &gridcomp_state::grid1101_map);
359 	m_maincpu->set_addrmap(AS_IO, &gridcomp_state::grid1101_io);
360 	m_maincpu->set_irq_acknowledge_callback(FUNC(gridcomp_state::irq_callback));
361 
362 	MCFG_MACHINE_START_OVERRIDE(gridcomp_state, gridcomp)
363 	MCFG_MACHINE_RESET_OVERRIDE(gridcomp_state, gridcomp)
364 
365 	I80130(config, m_osp, XTAL(15'000'000)/3);
366 	m_osp->irq().set_inputline("maincpu", 0);
367 
368 	MM58174(config, m_rtc, 32.768_kHz_XTAL);
369 
370 	SPEAKER(config, "mono").front_center();
371 	SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 1.00);
372 
373 	screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD)); // actually a kind of EL display
374 	screen.set_color(rgb_t::amber());
375 	screen.set_screen_update(FUNC(gridcomp_state::screen_update_110x));
376 	screen.set_raw(XTAL(15'000'000)/2, 424, 0, 320, 262, 0, 240); // XXX 66 Hz refresh
377 	screen.screen_vblank().set(m_osp, FUNC(i80130_device::ir3_w));
378 	screen.set_palette("palette");
379 
380 	PALETTE(config, "palette", palette_device::MONOCHROME);
381 
382 	grid_keyboard_device &keyboard(GRID_KEYBOARD(config, "keyboard", 0));
383 	keyboard.set_keyboard_callback(FUNC(gridcomp_state::kbd_put));
384 
385 	i7220_device &i7220(I7220(config, "i7220", XTAL(4'000'000)));
386 	i7220.set_data_size(3); // 3 1-Mbit MBM's
387 	i7220.irq_callback().set(I80130_TAG, FUNC(i80130_device::ir1_w));
388 	i7220.drq_callback().set(I80130_TAG, FUNC(i80130_device::ir1_w));
389 
390 	tms9914_device &hpib(TMS9914(config, m_tms9914, XTAL(4'000'000)));
391 	hpib.int_write_cb().set(I80130_TAG, FUNC(i80130_device::ir5_w));
392 	hpib.dio_read_cb().set(IEEE488_TAG, FUNC(ieee488_device::dio_r));
393 	hpib.dio_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_dio_w));
394 	hpib.eoi_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_eoi_w));
395 	hpib.dav_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_dav_w));
396 	hpib.nrfd_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_nrfd_w));
397 	hpib.ndac_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_ndac_w));
398 	hpib.ifc_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_ifc_w));
399 	hpib.srq_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_srq_w));
400 	hpib.atn_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_atn_w));
401 	hpib.ren_write_cb().set(IEEE488_TAG, FUNC(ieee488_device::host_ren_w));
402 
403 	ieee488_device &ieee(IEEE488(config, IEEE488_TAG));
404 	ieee.eoi_callback().set("hpib", FUNC(tms9914_device::eoi_w));
405 	ieee.dav_callback().set("hpib", FUNC(tms9914_device::dav_w));
406 	ieee.nrfd_callback().set("hpib", FUNC(tms9914_device::nrfd_w));
407 	ieee.ndac_callback().set("hpib", FUNC(tms9914_device::ndac_w));
408 	ieee.ifc_callback().set("hpib", FUNC(tms9914_device::ifc_w));
409 	ieee.srq_callback().set("hpib", FUNC(tms9914_device::srq_w));
410 	ieee.atn_callback().set("hpib", FUNC(tms9914_device::atn_w));
411 	ieee.ren_callback().set("hpib", FUNC(tms9914_device::ren_w));
412 	IEEE488_SLOT(config, "ieee_grid", 0, grid_ieee488_devices, nullptr);
413 	IEEE488_SLOT(config, "ieee_grid2", 0, grid_ieee488_devices, nullptr);
414 	IEEE488_SLOT(config, "ieee_grid3", 0, grid_ieee488_devices, nullptr);
415 	IEEE488_SLOT(config, "ieee_grid4", 0, grid_ieee488_devices, nullptr);
416 	IEEE488_SLOT(config, "ieee_rem", 0, remote488_devices, nullptr);
417 
418 	I8274(config, m_uart8274, XTAL(4'032'000));
419 	m_uart8274->out_txda_callback().set("rs232_port", FUNC(rs232_port_device::write_txd));
420 	m_uart8274->out_dtra_callback().set("rs232_port", FUNC(rs232_port_device::write_dtr));
421 	m_uart8274->out_rtsa_callback().set("rs232_port", FUNC(rs232_port_device::write_rts));
422 
423 	rs232_port_device &rs232_port(RS232_PORT(config, "rs232_port", default_rs232_devices, nullptr));
424 	rs232_port.rxd_handler().set("uart8274", FUNC(i8274_device::rxa_w));
425 	rs232_port.dcd_handler().set("uart8274", FUNC(i8274_device::dcda_w));
426 	rs232_port.cts_handler().set("uart8274", FUNC(i8274_device::ctsa_w));
427 
428 	I8255(config, "modem", 0);
429 
430 	RAM(config, m_ram).set_default_size("256K").set_default_value(0);
431 }
432 
grid1109(machine_config & config)433 void gridcomp_state::grid1109(machine_config &config)
434 {
435 	grid1101(config);
436 	m_ram->set_default_size("512K");
437 }
438 
grid1121(machine_config & config)439 void gridcomp_state::grid1121(machine_config &config)
440 {
441 	grid1101(config);
442 	// m_maincpu->set_clock(XTAL(24'000'000) / 3); // XXX
443 	m_maincpu->set_addrmap(AS_PROGRAM, &gridcomp_state::grid1121_map);
444 }
445 
grid1129(machine_config & config)446 void gridcomp_state::grid1129(machine_config &config)
447 {
448 	grid1121(config);
449 	m_ram->set_default_size("512K");
450 }
451 
grid1131(machine_config & config)452 void gridcomp_state::grid1131(machine_config &config)
453 {
454 	grid1121(config);
455 	subdevice<screen_device>("screen")->set_screen_update(FUNC(gridcomp_state::screen_update_113x));
456 	subdevice<screen_device>("screen")->set_raw(XTAL(15'000'000)/2, 720, 0, 512, 262, 0, 240); // XXX
457 }
458 
grid1139(machine_config & config)459 void gridcomp_state::grid1139(machine_config &config)
460 {
461 	grid1131(config);
462 	m_ram->set_default_size("512K");
463 }
464 
465 
466 ROM_START( grid1101 )
467 	ROM_REGION16_LE(0x10000, "user1", 0)
468 
469 	ROM_SYSTEM_BIOS(0, "ccos", "ccos bios")
470 	ROMX_LOAD("bios1101_0_25.bin", 0x0000, 0x4000, CRC(625388cb) SHA1(4c52c62fa9bc2f9a9a0a1e7f3beddef6809b9eed), ROM_BIOS(0))
471 ROM_END
472 
473 ROM_START( grid1109 )
474 	ROM_REGION16_LE(0x10000, "user1", 0)
475 
476 	ROM_SYSTEM_BIOS(0, "ccos", "ccos bios")
477 	ROMX_LOAD("1109even.bin", 0x0000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(0))
478 	ROMX_LOAD("1109odd.bin",  0x0001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(0))
479 ROM_END
480 
481 ROM_START( grid1121 )
482 	ROM_REGION16_LE(0x10000, "user1", 0)
483 
484 	ROM_SYSTEM_BIOS(0, "ccos", "ccos bios")
485 	ROMX_LOAD("1121even.bin", 0x0000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(0))
486 	ROMX_LOAD("1121odd.bin",  0x0001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(0))
487 ROM_END
488 
489 ROM_START( grid1129 )
490 	ROM_REGION16_LE(0x10000, "user1", 0)
491 	ROM_DEFAULT_BIOS("ccos")
492 
493 	ROM_SYSTEM_BIOS(0, "ccos", "ccos bios")
494 	ROMX_LOAD("1129even.bin", 0x0000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(0))
495 	ROMX_LOAD("1129odd.bin",  0x0001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(0))
496 
497 	ROM_SYSTEM_BIOS(1, "patched", "patched 1139 bios")
498 	ROMX_LOAD("1139even.bin", 0x0000, 0x2000, CRC(67071849) SHA1(782239c155fa5821f8dbd2607cee9152d175e90e), ROM_SKIP(1) | ROM_BIOS(1))
499 	ROMX_LOAD("1139odd.bin",  0x0001, 0x2000, CRC(13ed4bf0) SHA1(f7087f86dbbc911bee985125bccd2417e0374e8e), ROM_SKIP(1) | ROM_BIOS(1))
500 
501 	// change bubble driver setup to read floppy images with 512-byte sectors
502 	ROM_FILL(0x3114,1,0x00)
503 	ROM_FILL(0x3115,1,0x02)
504 	ROM_FILL(0x3116,1,0xf8)
505 	ROM_FILL(0x3117,1,0x01)
506 
507 	// move work area from 0440h:XXXX to 0298h:XXXX
508 	ROM_FILL(0x23,1,0x98)
509 	ROM_FILL(0x24,1,0x2)
510 	ROM_FILL(0xbc,1,0x98)
511 	ROM_FILL(0xbd,1,0x2)
512 	ROM_FILL(0x14e,1,0xc1)  //
513 	ROM_FILL(0x14f,1,0x2)   //
514 	ROM_FILL(0x15a,1,0xc2)  //
515 	ROM_FILL(0x15b,1,0x2)   //
516 	ROM_FILL(0x17b,1,0x45)  //
517 	ROM_FILL(0x17c,1,0x3)   //
518 	ROM_FILL(0x28c,1,0x98)
519 	ROM_FILL(0x28d,1,0x2)
520 	ROM_FILL(0x28f,1,0x98)
521 	ROM_FILL(0x290,1,0x2)
522 	ROM_FILL(0x2b9,1,0x98)
523 	ROM_FILL(0x2ba,1,0x2)
524 	ROM_FILL(0x2d0,1,0x98)
525 	ROM_FILL(0x2d1,1,0x2)
526 	ROM_FILL(0x31a,1,0x98)
527 	ROM_FILL(0x31b,1,0x2)
528 	ROM_FILL(0x3a0,1,0x98)
529 	ROM_FILL(0x3a1,1,0x2)
530 	ROM_FILL(0x3a3,1,0x98)
531 	ROM_FILL(0x3a4,1,0x2)
532 	ROM_FILL(0x3e2,1,0x98)
533 	ROM_FILL(0x3e3,1,0x2)
534 	ROM_FILL(0x43e,1,0x98)
535 	ROM_FILL(0x43f,1,0x2)
536 	ROM_FILL(0x46d,1,0x98)
537 	ROM_FILL(0x46e,1,0x2)
538 	ROM_FILL(0x4fe,1,0x98)
539 	ROM_FILL(0x4ff,1,0x2)
540 	ROM_FILL(0x512,1,0x98)
541 	ROM_FILL(0x513,1,0x2)
542 	ROM_FILL(0x768,1,0x98)
543 	ROM_FILL(0x769,1,0x2)
544 	ROM_FILL(0x79e,1,0x98)
545 	ROM_FILL(0x79f,1,0x2)
546 	ROM_FILL(0x7f5,1,0x98)
547 	ROM_FILL(0x7f6,1,0x2)
548 	ROM_FILL(0x92a,1,0x98)
549 	ROM_FILL(0x92b,1,0x2)
550 	ROM_FILL(0xe50,1,0x98)
551 	ROM_FILL(0xe51,1,0x2)
552 	ROM_FILL(0xfa6,1,0x98)
553 	ROM_FILL(0xfa7,1,0x2)
554 	ROM_FILL(0x15fe,1,0xce) //
555 	ROM_FILL(0x15ff,1,0x2)  //
556 	ROM_FILL(0x1628,1,0xd0) //
557 	ROM_FILL(0x1629,1,0x2)  //
558 	ROM_FILL(0x1700,1,0x98)
559 	ROM_FILL(0x1701,1,0x2)
560 	ROM_FILL(0x1833,1,0xd6) //
561 	ROM_FILL(0x1834,1,0x2)  //
562 	ROM_FILL(0x184a,1,0xd6) //
563 	ROM_FILL(0x184b,1,0x2)  //
564 	ROM_FILL(0x1a2e,1,0xd6) //
565 	ROM_FILL(0x1a2f,1,0x2)  //
566 	ROM_FILL(0x19c2,1,0x98)
567 	ROM_FILL(0x19c3,1,0x2)
568 	ROM_FILL(0x1ee0,1,0x98)
569 	ROM_FILL(0x1ee1,1,0x2)
570 	ROM_FILL(0x1f1d,1,0x98)
571 	ROM_FILL(0x1f1e,1,0x2)
572 	ROM_FILL(0x1f40,1,0x98)
573 	ROM_FILL(0x1f41,1,0x2)
574 	ROM_FILL(0x2253,1,0x98)
575 	ROM_FILL(0x2254,1,0x2)
576 	ROM_FILL(0x2437,1,0x98)
577 	ROM_FILL(0x2438,1,0x2)
578 	ROM_FILL(0x283a,1,0x98)
579 	ROM_FILL(0x283b,1,0x2)
580 	ROM_FILL(0x2868,1,0x98)
581 	ROM_FILL(0x2869,1,0x2)
582 	ROM_FILL(0x288f,1,0x98)
583 	ROM_FILL(0x2890,1,0x2)
584 	ROM_FILL(0x2942,1,0x98)
585 	ROM_FILL(0x2943,1,0x2)
586 	ROM_FILL(0x295c,1,0x98)
587 	ROM_FILL(0x295d,1,0x2)
588 	ROM_FILL(0x2a5e,1,0x98)
589 	ROM_FILL(0x2a5f,1,0x2)
590 	ROM_FILL(0x315c,1,0xc9) //
591 	ROM_FILL(0x315d,1,0x2)  //
592 	ROM_FILL(0x3160,1,0xce) //
593 	ROM_FILL(0x3161,1,0x2)  //
594 	ROM_FILL(0x3164,1,0xcf) //
595 	ROM_FILL(0x3165,1,0x2)  //
596 ROM_END
597 
598 ROM_START( grid1131 )
599 	ROM_REGION16_LE(0x10000, "user1", 0)
600 
601 	ROM_SYSTEM_BIOS(0, "ccos", "ccos bios")
602 	ROMX_LOAD("1131even.bin", 0x0000, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(0))
603 	ROMX_LOAD("1131odd.bin",  0x0001, 0x2000, NO_DUMP, ROM_SKIP(1) | ROM_BIOS(0))
604 ROM_END
605 
606 ROM_START( grid1139 )
607 	ROM_REGION16_LE(0x10000, "user1", 0)
608 
609 	ROM_SYSTEM_BIOS(0, "normal", "normal bios")
610 	ROMX_LOAD("1139even.bin", 0x0000, 0x2000, CRC(67071849) SHA1(782239c155fa5821f8dbd2607cee9152d175e90e), ROM_SKIP(1) | ROM_BIOS(0))
611 	ROMX_LOAD("1139odd.bin",  0x0001, 0x2000, CRC(13ed4bf0) SHA1(f7087f86dbbc911bee985125bccd2417e0374e8e), ROM_SKIP(1) | ROM_BIOS(0))
612 ROM_END
613 
614 
615 /***************************************************************************
616 
617   Game driver(s)
618 
619 ***************************************************************************/
620 
621 //    YEAR  NAME      PARENT    COMPAT  MACHINE   INPUT     CLASS           INIT        COMPANY           FULLNAME           FLAGS
622 COMP( 1982, grid1101, 0,        0,      grid1101, gridcomp, gridcomp_state, empty_init, "GRiD Computers", "Compass 1101",    MACHINE_NO_SOUND_HW | MACHINE_IMPERFECT_CONTROLS )
623 COMP( 1982, grid1109, grid1101, 0,      grid1109, gridcomp, gridcomp_state, empty_init, "GRiD Computers", "Compass 1109",    MACHINE_IS_SKELETON )
624 COMP( 1984, grid1121, 0,        0,      grid1121, gridcomp, gridcomp_state, empty_init, "GRiD Computers", "Compass II 1121", MACHINE_IS_SKELETON )
625 COMP( 1984, grid1129, grid1121, 0,      grid1129, gridcomp, gridcomp_state, empty_init, "GRiD Computers", "Compass II 1129", MACHINE_IS_SKELETON )
626 COMP( 1984, grid1131, grid1121, 0,      grid1131, gridcomp, gridcomp_state, empty_init, "GRiD Computers", "Compass II 1131", MACHINE_IS_SKELETON )
627 COMP( 1984, grid1139, grid1121, 0,      grid1139, gridcomp, gridcomp_state, empty_init, "GRiD Computers", "Compass II 1139", MACHINE_IS_SKELETON )
628