1 // license:BSD-3-Clause
2 // copyright-holders:Aaron Giles
3 /***************************************************************************
4 
5     Atari G42 hardware
6 
7     driver by Aaron Giles
8 
9     Games supported:
10         * Road Riot 4WD (1991)
11         * Guardians of the 'Hood (1992)
12 
13     Known bugs:
14         * ASIC65 for Road Riot not quite perfect
15         * Missing DSPCOM board for Road Riot 4WD
16             +or shared ram pcb that bridges both pcbs for the twin cab kind of like in F1: Exhaust Note and Air Rescue from segas32.cpp
17 
18 ****************************************************************************
19 
20     Memory map (TBA)
21 
22 ***************************************************************************/
23 
24 #include "emu.h"
25 #include "includes/atarig42.h"
26 #include "machine/eeprompar.h"
27 #include "machine/watchdog.h"
28 #include "emupal.h"
29 #include "speaker.h"
30 
31 
32 /*************************************
33  *
34  *  Initialization & interrupts
35  *
36  *************************************/
37 
video_int_ack_w(uint16_t data)38 void atarig42_state::video_int_ack_w(uint16_t data)
39 {
40 	m_maincpu->set_input_line(M68K_IRQ_4, CLEAR_LINE);
41 }
42 
43 
machine_start()44 void atarig42_state::machine_start()
45 {
46 	atarigen_state::machine_start();
47 
48 	save_item(NAME(m_sloop_bank));
49 	save_item(NAME(m_sloop_next_bank));
50 	save_item(NAME(m_sloop_offset));
51 	save_item(NAME(m_sloop_state));
52 }
53 
54 
55 
56 /*************************************
57  *
58  *  I/O read dispatch.
59  *
60  *************************************/
61 
a2d_select_w(offs_t offset,uint8_t data)62 void atarig42_state::a2d_select_w(offs_t offset, uint8_t data)
63 {
64 	if (m_adc.found())
65 		m_adc->address_offset_start_w(offset, 0);
66 }
67 
68 
a2d_data_r(offs_t offset)69 uint8_t atarig42_state::a2d_data_r(offs_t offset)
70 {
71 	if (!m_adc.found())
72 		return 0xff;
73 
74 	uint8_t result = m_adc->data_r();
75 	if (!machine().side_effects_disabled())
76 		m_adc->address_offset_start_w(offset, 0);
77 	return result;
78 }
79 
80 
io_latch_w(offs_t offset,uint16_t data,uint16_t mem_mask)81 void atarig42_state::io_latch_w(offs_t offset, uint16_t data, uint16_t mem_mask)
82 {
83 	/* upper byte */
84 	if (ACCESSING_BITS_8_15)
85 	{
86 		/* bit 14 controls the ASIC65 reset line */
87 		m_asic65->reset_line((~data >> 14) & 1);
88 
89 		/* bits 13-11 are the MO control bits */
90 		m_rle->control_write((data >> 11) & 7);
91 	}
92 
93 	/* lower byte */
94 	if (ACCESSING_BITS_0_7)
95 	{
96 		/* bit 4 resets the sound CPU */
97 		m_jsa->soundcpu().set_input_line(INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
98 		if (!(data & 0x10))
99 			m_jsa->reset();
100 
101 		/* bit 5 is /XRESET, probably related to the ASIC */
102 
103 		/* bits 3 and 0 are coin counters */
104 	}
105 }
106 
107 
mo_command_w(offs_t offset,uint16_t data,uint16_t mem_mask)108 void atarig42_state::mo_command_w(offs_t offset, uint16_t data, uint16_t mem_mask)
109 {
110 	COMBINE_DATA(m_mo_command);
111 	m_rle->command_write((data == 0) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW);
112 }
113 
114 
115 
116 /*************************************
117  *
118  *  SLOOP banking -- Road Riot
119  *
120  *************************************/
121 
roadriot_sloop_tweak(int offset)122 void atarig42_0x200_state::roadriot_sloop_tweak(int offset)
123 {
124 /*
125     sequence 1:
126 
127         touch $68000
128         touch $68eee and $124/$678/$abc/$1024(bank) in the same instruction
129         touch $69158/$6a690/$6e708/$71166
130 
131     sequence 2:
132 
133         touch $5edb4 to add 2 to the bank
134         touch $5db0a to add 1 to the bank
135         touch $5f042
136         touch $69158/$6a690/$6e708/$71166
137         touch $68000
138         touch $5d532/$5d534
139 */
140 
141 	switch (offset)
142 	{
143 		/* standard 68000 -> 68eee -> (bank) addressing */
144 		case 0x68000/2:
145 			m_sloop_state = 1;
146 			break;
147 		case 0x68eee/2:
148 			if (m_sloop_state == 1)
149 				m_sloop_state = 2;
150 			break;
151 		case 0x00124/2:
152 			if (m_sloop_state == 2)
153 			{
154 				m_sloop_next_bank = 0;
155 				m_sloop_state = 3;
156 			}
157 			break;
158 		case 0x00678/2:
159 			if (m_sloop_state == 2)
160 			{
161 				m_sloop_next_bank = 1;
162 				m_sloop_state = 3;
163 			}
164 			break;
165 		case 0x00abc/2:
166 			if (m_sloop_state == 2)
167 			{
168 				m_sloop_next_bank = 2;
169 				m_sloop_state = 3;
170 			}
171 			break;
172 		case 0x01024/2:
173 			if (m_sloop_state == 2)
174 			{
175 				m_sloop_next_bank = 3;
176 				m_sloop_state = 3;
177 			}
178 			break;
179 
180 		/* lock in the change? */
181 		case 0x69158/2:
182 			/* written if $ff8007 == 0 */
183 		case 0x6a690/2:
184 			/* written if $ff8007 == 1 */
185 		case 0x6e708/2:
186 			/* written if $ff8007 == 2 */
187 		case 0x71166/2:
188 			/* written if $ff8007 == 3 */
189 			if (m_sloop_state == 3)
190 				m_sloop_bank = m_sloop_next_bank;
191 			m_sloop_state = 0;
192 			break;
193 
194 		/* bank offsets */
195 		case 0x5edb4/2:
196 			if (m_sloop_state == 0)
197 			{
198 				m_sloop_state = 10;
199 				m_sloop_offset = 0;
200 			}
201 			m_sloop_offset += 2;
202 			break;
203 		case 0x5db0a/2:
204 			if (m_sloop_state == 0)
205 			{
206 				m_sloop_state = 10;
207 				m_sloop_offset = 0;
208 			}
209 			m_sloop_offset += 1;
210 			break;
211 
212 		/* apply the offset */
213 		case 0x5f042/2:
214 			if (m_sloop_state == 10)
215 			{
216 				m_sloop_bank = (m_sloop_bank + m_sloop_offset) & 3;
217 				m_sloop_offset = 0;
218 				m_sloop_state = 0;
219 			}
220 			break;
221 
222 		/* unknown */
223 		case 0x5d532/2:
224 			break;
225 		case 0x5d534/2:
226 			break;
227 
228 		default:
229 			break;
230 	}
231 }
232 
233 
roadriot_sloop_data_r(offs_t offset)234 uint16_t atarig42_0x200_state::roadriot_sloop_data_r(offs_t offset)
235 {
236 	roadriot_sloop_tweak(offset);
237 	if (offset < 0x78000/2)
238 		return m_sloop_base[offset];
239 	else
240 		return m_sloop_base[0x78000/2 + m_sloop_bank * 0x1000 + (offset & 0xfff)];
241 }
242 
243 
roadriot_sloop_data_w(offs_t offset,uint16_t data)244 void atarig42_0x200_state::roadriot_sloop_data_w(offs_t offset, uint16_t data)
245 {
246 	roadriot_sloop_tweak(offset);
247 }
248 
249 
250 
251 /*************************************
252  *
253  *  SLOOP banking -- Guardians
254  *
255  *************************************/
256 
guardians_sloop_tweak(int offset)257 void atarig42_0x400_state::guardians_sloop_tweak(int offset)
258 {
259 	uint32_t *last_accesses = m_last_accesses;
260 
261 	if (offset >= 0x7f7c0/2)
262 	{
263 		last_accesses[0] = last_accesses[1];
264 		last_accesses[1] = last_accesses[2];
265 		last_accesses[2] = last_accesses[3];
266 		last_accesses[3] = last_accesses[4];
267 		last_accesses[4] = last_accesses[5];
268 		last_accesses[5] = last_accesses[6];
269 		last_accesses[6] = last_accesses[7];
270 		last_accesses[7] = offset;
271 
272 		if (last_accesses[0] == 0x7f7c0/2 && last_accesses[1] == 0x7f7ce/2 && last_accesses[2] == 0x7f7c2/2 && last_accesses[3] == 0x7f7cc/2 &&
273 			last_accesses[4] == 0x7f7c4/2 && last_accesses[5] == 0x7f7ca/2 && last_accesses[6] == 0x7f7c6/2 && last_accesses[7] == 0x7f7c8/2)
274 			m_sloop_bank = 0;
275 
276 		if (last_accesses[0] == 0x7f7d0/2 && last_accesses[1] == 0x7f7de/2 && last_accesses[2] == 0x7f7d2/2 && last_accesses[3] == 0x7f7dc/2 &&
277 			last_accesses[4] == 0x7f7d4/2 && last_accesses[5] == 0x7f7da/2 && last_accesses[6] == 0x7f7d6/2 && last_accesses[7] == 0x7f7d8/2)
278 			m_sloop_bank = 1;
279 
280 		if (last_accesses[0] == 0x7f7e0/2 && last_accesses[1] == 0x7f7ee/2 && last_accesses[2] == 0x7f7e2/2 && last_accesses[3] == 0x7f7ec/2 &&
281 			last_accesses[4] == 0x7f7e4/2 && last_accesses[5] == 0x7f7ea/2 && last_accesses[6] == 0x7f7e6/2 && last_accesses[7] == 0x7f7e8/2)
282 			m_sloop_bank = 2;
283 
284 		if (last_accesses[0] == 0x7f7f0/2 && last_accesses[1] == 0x7f7fe/2 && last_accesses[2] == 0x7f7f2/2 && last_accesses[3] == 0x7f7fc/2 &&
285 			last_accesses[4] == 0x7f7f4/2 && last_accesses[5] == 0x7f7fa/2 && last_accesses[6] == 0x7f7f6/2 && last_accesses[7] == 0x7f7f8/2)
286 			m_sloop_bank = 3;
287 	}
288 }
289 
290 
guardians_sloop_data_r(offs_t offset)291 uint16_t atarig42_0x400_state::guardians_sloop_data_r(offs_t offset)
292 {
293 	guardians_sloop_tweak(offset);
294 	if (offset < 0x78000/2)
295 		return m_sloop_base[offset];
296 	else
297 		return m_sloop_base[0x78000/2 + m_sloop_bank * 0x1000 + (offset & 0xfff)];
298 }
299 
300 
guardians_sloop_data_w(offs_t offset,uint16_t data)301 void atarig42_0x400_state::guardians_sloop_data_w(offs_t offset, uint16_t data)
302 {
303 	guardians_sloop_tweak(offset);
304 }
305 
306 
307 
308 /*************************************
309  *
310  *  Main CPU memory handlers
311  *
312  *************************************/
313 
main_map(address_map & map)314 void atarig42_state::main_map(address_map &map)
315 {
316 	map(0x000000, 0x080001).rom();
317 	map(0xe00000, 0xe00001).portr("IN0");
318 	map(0xe00002, 0xe00003).portr("IN1");
319 	map(0xe00010, 0xe00011).portr("IN2");
320 	map(0xe00012, 0xe00013).portr("jsa:JSAIII");
321 	map(0xe00020, 0xe0002f).rw(FUNC(atarig42_state::a2d_data_r), FUNC(atarig42_state::a2d_select_w)).umask16(0xff00);
322 	map(0xe00031, 0xe00031).r(m_jsa, FUNC(atari_jsa_iii_device::main_response_r));
323 	map(0xe00041, 0xe00041).w(m_jsa, FUNC(atari_jsa_iii_device::main_command_w));
324 	map(0xe00050, 0xe00051).w(FUNC(atarig42_state::io_latch_w));
325 	map(0xe00060, 0xe00061).w("eeprom", FUNC(eeprom_parallel_28xx_device::unlock_write16));
326 	map(0xe03000, 0xe03001).w(FUNC(atarig42_state::video_int_ack_w));
327 	map(0xe03800, 0xe03801).w("watchdog", FUNC(watchdog_timer_device::reset16_w));
328 	map(0xe80000, 0xe80fff).ram();
329 	map(0xf40000, 0xf40001).r(m_asic65, FUNC(asic65_device::io_r));
330 	map(0xf60000, 0xf60001).r(m_asic65, FUNC(asic65_device::read));
331 	map(0xf80000, 0xf80003).w(m_asic65, FUNC(asic65_device::data_w));
332 	map(0xfa0000, 0xfa0fff).rw("eeprom", FUNC(eeprom_parallel_28xx_device::read), FUNC(eeprom_parallel_28xx_device::write)).umask16(0x00ff);
333 	map(0xfc0000, 0xfc0fff).ram().w("palette", FUNC(palette_device::write16)).share("palette");
334 	map(0xff0000, 0xff0fff).ram().share("rle");
335 	map(0xff1000, 0xff1fff).ram();
336 	map(0xff2000, 0xff5fff).ram().w(m_playfield_tilemap, FUNC(tilemap_device::write16)).share("playfield");
337 	map(0xff6000, 0xff6fff).ram().w(m_alpha_tilemap, FUNC(tilemap_device::write16)).share("alpha");
338 	map(0xff7000, 0xff7001).ram().w(FUNC(atarig42_state::mo_command_w)).share("mo_command");
339 	map(0xff7002, 0xffffff).ram();
340 }
341 
342 
343 
344 /*************************************
345  *
346  *  Port definitions
347  *
348  *************************************/
349 
350 static INPUT_PORTS_START( roadriot )
351 	PORT_START("IN0")       /* e00000 */
352 	PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
353 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START1 )
354 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
355 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
356 	PORT_BIT( 0xf800, IP_ACTIVE_LOW, IPT_UNUSED )
357 
358 	PORT_START("IN1")      /* e00002 */
359 	PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNUSED )
360 
361 	PORT_START("IN2")       /* e00010 */
362 	PORT_BIT( 0x0007, IP_ACTIVE_LOW, IPT_UNUSED )
363 	PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("adc", adc0808_device, eoc_r)
364 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_ATARI_JSA_SOUND_TO_MAIN_READY("jsa")
365 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_ATARI_JSA_MAIN_TO_SOUND_READY("jsa")
366 	PORT_SERVICE( 0x0040, IP_ACTIVE_LOW )
367 	PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen")
368 	PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
369 
370 	PORT_START("A2D0")      /* analog 0 */
371 	PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
372 
373 	PORT_START("A2D1")      /* analog 1 */
374 	PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(16)
375 INPUT_PORTS_END
376 
377 
378 static INPUT_PORTS_START( guardian )
379 	PORT_START("IN0")       /* e00000 */
380 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNUSED )
381 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(3)
382 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
383 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(3)
384 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(3)
385 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(3)
386 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(3)
387 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(3)
388 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_UNUSED )
389 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1)
390 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
391 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
392 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
393 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
394 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
395 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
396 
397 	PORT_START("IN1")      /* e00002 */
398 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
399 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
400 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
401 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
402 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)
403 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
404 	PORT_BIT( 0x01c0, IP_ACTIVE_LOW, IPT_UNUSED )
405 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2)
406 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
407 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
408 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
409 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
410 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
411 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
412 
413 	PORT_START("IN2")       /* e00010 */
414 	PORT_BIT( 0x000f, IP_ACTIVE_LOW, IPT_UNUSED )
415 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_ATARI_JSA_SOUND_TO_MAIN_READY("jsa")
416 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_ATARI_JSA_MAIN_TO_SOUND_READY("jsa")
417 	PORT_SERVICE( 0x0040, IP_ACTIVE_LOW )
418 	PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen")
419 	PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
420 INPUT_PORTS_END
421 
422 
423 
424 /*************************************
425  *
426  *  Graphics definitions
427  *
428  *************************************/
429 
430 static const gfx_layout pflayout =
431 {
432 	8,8,
433 	RGN_FRAC(1,3),
434 	5,
435 	{ 0, 0, 1, 2, 3 },
436 	{ RGN_FRAC(1,3)+0, RGN_FRAC(1,3)+4, 0, 4, RGN_FRAC(1,3)+8, RGN_FRAC(1,3)+12, 8, 12 },
437 	{ 0*8, 2*8, 4*8, 6*8, 8*8, 10*8, 12*8, 14*8 },
438 	16*8
439 };
440 
441 static const gfx_layout pftoplayout =
442 {
443 	8,8,
444 	RGN_FRAC(1,3),
445 	6,
446 	{ RGN_FRAC(2,3)+0, RGN_FRAC(2,3)+4, 0, 0, 0, 0 },
447 	{ 3, 2, 1, 0, 11, 10, 9, 8 },
448 	{ 0*8, 2*8, 4*8, 6*8, 8*8, 10*8, 12*8, 14*8 },
449 	16*8
450 };
451 
452 static const gfx_layout anlayout =
453 {
454 	8,8,
455 	RGN_FRAC(1,1),
456 	4,
457 	{ 0, 1, 2, 3 },
458 	{ 0, 4, 8, 12, 16, 20, 24, 28 },
459 	{ 0*8, 4*8, 8*8, 12*8, 16*8, 20*8, 24*8, 28*8 },
460 	32*8
461 };
462 
463 static GFXDECODE_START( gfx_atarig42 )
464 	GFXDECODE_ENTRY( "gfx1", 0, pflayout, 0x000, 64 )
465 	GFXDECODE_ENTRY( "gfx2", 0, anlayout, 0x000, 16 )
466 	GFXDECODE_ENTRY( "gfx1", 0, pftoplayout, 0x000, 64 )
467 GFXDECODE_END
468 
469 
470 static const atari_rle_objects_config modesc_0x200 =
471 {
472 	0,          /* left clip coordinate */
473 	0,          /* right clip coordinate */
474 	0x200,      /* base palette entry */
475 
476 	{{ 0x7fff,0,0,0,0,0,0,0 }}, /* mask for the code index */
477 	{{ 0,0x01f0,0,0,0,0,0,0 }}, /* mask for the color */
478 	{{ 0,0,0xffc0,0,0,0,0,0 }}, /* mask for the X position */
479 	{{ 0,0,0,0xffc0,0,0,0,0 }}, /* mask for the Y position */
480 	{{ 0,0,0,0,0xffff,0,0,0 }}, /* mask for the scale factor */
481 	{{ 0x8000,0,0,0,0,0,0,0 }}, /* mask for the horizontal flip */
482 	{{ 0,0,0,0,0,0,0x00ff,0 }}, /* mask for the order */
483 	{{ 0,0x0e00,0,0,0,0,0,0 }}, /* mask for the priority */
484 	{{ 0 }}                     /* mask for the VRAM target */
485 };
486 
487 
488 static const atari_rle_objects_config modesc_0x400 =
489 {
490 	0,          /* left clip coordinate */
491 	0,          /* right clip coordinate */
492 	0x400,      /* base palette entry */
493 
494 	{{ 0x7fff,0,0,0,0,0,0,0 }}, /* mask for the code index */
495 	{{ 0,0x03f0,0,0,0,0,0,0 }}, /* mask for the color */
496 	{{ 0,0,0xffc0,0,0,0,0,0 }}, /* mask for the X position */
497 	{{ 0,0,0,0xffc0,0,0,0,0 }}, /* mask for the Y position */
498 	{{ 0,0,0,0,0xffff,0,0,0 }}, /* mask for the scale factor */
499 	{{ 0x8000,0,0,0,0,0,0,0 }}, /* mask for the horizontal flip */
500 	{{ 0,0,0,0,0,0,0x00ff,0 }}, /* mask for the order */
501 	{{ 0,0x0e00,0,0,0,0,0,0 }}, /* mask for the priority */
502 	{{ 0 }}                     /* mask for the VRAM target */
503 };
504 
505 
506 
507 /*************************************
508  *
509  *  Machine driver
510  *
511  *************************************/
512 
atarig42(machine_config & config)513 void atarig42_state::atarig42(machine_config &config)
514 {
515 	/* basic machine hardware */
516 	M68000(config, m_maincpu, 14.318181_MHz_XTAL);
517 	m_maincpu->set_addrmap(AS_PROGRAM, &atarig42_state::main_map);
518 
519 	TIMER(config, "scantimer").configure_scanline(FUNC(atarig42_state::scanline_update), m_screen, 0, 8);
520 
521 	EEPROM_2816(config, "eeprom").lock_after_write(true);
522 
523 	WATCHDOG_TIMER(config, "watchdog");
524 
525 	/* video hardware */
526 	GFXDECODE(config, m_gfxdecode, "palette", gfx_atarig42);
527 	PALETTE(config, "palette").set_format(palette_device::IRGB_1555, 2048);
528 
529 	TILEMAP(config, m_playfield_tilemap, m_gfxdecode, 2, 8,8);
530 	m_playfield_tilemap->set_layout(FUNC(atarig42_state::atarig42_playfield_scan), 128,64);
531 	m_playfield_tilemap->set_info_callback(FUNC(atarig42_state::get_playfield_tile_info));
532 	TILEMAP(config, m_alpha_tilemap, m_gfxdecode, 2, 8,8, TILEMAP_SCAN_ROWS, 64,32, 0).set_info_callback(FUNC(atarig42_state::get_alpha_tile_info));
533 
534 	SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
535 	m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK);
536 	/* note: these parameters are from published specs, not derived */
537 	/* the board uses an SOS chip to generate video signals */
538 	m_screen->set_raw(14.318181_MHz_XTAL/2, 456, 0, 336, 262, 0, 240);
539 	m_screen->set_screen_update(FUNC(atarig42_state::screen_update_atarig42));
540 	m_screen->set_palette("palette");
541 	m_screen->screen_vblank().set_inputline(m_maincpu, M68K_IRQ_4, ASSERT_LINE);
542 
543 	MCFG_VIDEO_START_OVERRIDE(atarig42_state,atarig42)
544 
545 	/* sound hardware */
546 	SPEAKER(config, "mono").front_center();
547 
548 	ATARI_JSA_III(config, m_jsa, 0);
549 	m_jsa->main_int_cb().set_inputline(m_maincpu, M68K_IRQ_5);
550 	m_jsa->test_read_cb().set_ioport("IN2").bit(6);
551 	m_jsa->add_route(ALL_OUTPUTS, "mono", 1.0);
552 }
553 
atarig42_0x200(machine_config & config)554 void atarig42_0x200_state::atarig42_0x200(machine_config &config)
555 {
556 	atarig42(config);
557 	ATARI_RLE_OBJECTS(config, m_rle, 0, modesc_0x200);
558 
559 	ADC0809(config, m_adc, 14.318181_MHz_XTAL / 16);
560 	m_adc->in_callback<0>().set_ioport("A2D0");
561 	m_adc->in_callback<1>().set_ioport("A2D1");
562 
563 	/* ASIC65 */
564 	ASIC65(config, m_asic65, 0, ASIC65_ROMBASED);
565 }
566 
atarig42_0x400(machine_config & config)567 void atarig42_0x400_state::atarig42_0x400(machine_config &config)
568 {
569 	atarig42(config);
570 	ATARI_RLE_OBJECTS(config, m_rle, 0, modesc_0x400);
571 
572 	/* ASIC65 */
573 	ASIC65(config, m_asic65, 0, ASIC65_GUARDIANS);
574 }
575 
576 
577 
578 
579 /*************************************
580  *
581  *  ROM definition(s)
582  *
583  *************************************/
584 
585 ROM_START( roadriot )
586 	ROM_REGION( 0x80004, "maincpu", 0 ) /* 68000 code */
587 	ROM_LOAD16_BYTE( "136089-3214.8d", 0x00000, 0x20000, CRC(6b4dc220) SHA1(43517d8adbc8771ac4e4dcde221def12e1859b61) )
588 	ROM_LOAD16_BYTE( "136089-3213.8c", 0x00001, 0x20000, CRC(2f182b74) SHA1(b6b30bc068b5eeb52e0000236b7f58b1e88bb154) )
589 	ROM_LOAD16_BYTE( "136089-2016.9d", 0x40000, 0x20000, CRC(6191653c) SHA1(97d1a84a585149e8f2c49cab7af22dc755dff350) )
590 	ROM_LOAD16_BYTE( "136089-2015.9c", 0x40001, 0x20000, CRC(0d34419a) SHA1(f16e9fb4cd537d727611cb7dd5537c030671fe1e) )
591 
592 	ROM_REGION( 0x2000, "asic65:asic65cpu", 0 )   /* ASIC65 TMS32015 code */
593 	ROM_LOAD( "136089-1012.3f", 0x00000, 0x0a80, CRC(7c5498e7) SHA1(9d8b235baf7b75bef8ef9b168647c5b2b80b2cb3) )
594 
595 	ROM_REGION( 0x10000, "jsa:cpu", 0 ) /* 6502 code */
596 	ROM_LOAD( "136089-1047.12c", 0x00000, 0x10000, CRC(849dd26c) SHA1(05a0b2a5f7ee4437448b5f076d3066d96dec2320) )
597 
598 	ROM_REGION( 0xc0000, "gfx1", 0 )
CRC(b7451f92)599 	ROM_LOAD( "136089-1041.22d",    0x000000, 0x20000, CRC(b7451f92) SHA1(9fd17913630e457e406e596f2d86afff98787750) ) /* playfield, planes 0-1 */
600 	ROM_LOAD( "136089-1038.22c",    0x020000, 0x20000, CRC(90f3c6ee) SHA1(7607509e2d3b2080a918cfaf2879dbed6b79d029) )
601 	ROM_LOAD( "136089-1037.2021d",  0x040000, 0x20000, CRC(d40de62b) SHA1(fa6dfd20bdad7874ae33a1027a9bb0ea200f86ca) ) /* playfield, planes 2-3 */
602 	ROM_LOAD( "136089-1039.2021c",  0x060000, 0x20000, CRC(a7e836b1) SHA1(d41f1e4166ca757176c6976be2a953db5db05e48) )
603 	ROM_LOAD( "136089-1040.20d",    0x080000, 0x20000, CRC(a81ae93f) SHA1(b694ba5fab35f8fa505a02039ae62f7af3c7ae1d) ) /* playfield, planes 4-5 */
604 	ROM_LOAD( "136089-1042.20c",    0x0a0000, 0x20000, CRC(b8a6d15a) SHA1(43d2be9d40a84b2c01d80bbcac737eda04d55999) )
605 
606 	ROM_REGION( 0x020000, "gfx2", 0 )
607 	ROM_LOAD( "136089-1046.22j",    0x000000, 0x20000, CRC(0005bab0) SHA1(257e1b23eea117fe6701a67134b96d9d9fe10caf) ) /* alphanumerics */
608 
609 	ROM_REGION16_BE( 0x200000, "rle", 0 )
610 	ROM_LOAD16_BYTE( "136089-1018.2s", 0x000000, 0x20000, CRC(19590a94) SHA1(e375b7e01a8b1f366bb4e7750e33f0b6d9ae2042) )
611 	ROM_LOAD16_BYTE( "136089-1017.2p", 0x000001, 0x20000, CRC(c2bf3f69) SHA1(f822359070b1907973ee7ee35469f4a59f720830) )
612 	ROM_LOAD16_BYTE( "136089-1020.3s", 0x040000, 0x20000, CRC(bab110e4) SHA1(0c4e3521474249517e7832df1bc63aca6d6a6c91) )
613 	ROM_LOAD16_BYTE( "136089-1019.3p", 0x040001, 0x20000, CRC(791ad2c5) SHA1(4ef218fbf38a9c6b58c86f203843988df1c935f6) )
614 	ROM_LOAD16_BYTE( "136089-1022.4s", 0x080000, 0x20000, CRC(79cba484) SHA1(ce361a432f1fe627086bab3c1131118fd15056f1) )
615 	ROM_LOAD16_BYTE( "136089-1021.4p", 0x080001, 0x20000, CRC(86a2e257) SHA1(98d95d2e67fecc332f6c66358a1f8d58b168c74b) )
616 	ROM_LOAD16_BYTE( "136089-1024.5s", 0x0c0000, 0x20000, CRC(67d28478) SHA1(cfc9da6d20c65d11c2a59a38660a8da4d1cc219d) )
617 	ROM_LOAD16_BYTE( "136089-1023.5p", 0x0c0001, 0x20000, CRC(74638838) SHA1(bea0fb21ccb946e023c88791ce5a8dd92b44baec) )
618 	ROM_LOAD16_BYTE( "136089-1026.6s", 0x100000, 0x20000, CRC(24933c37) SHA1(516393aae51fc9634a5c6d5134be058d6067e114) )
619 	ROM_LOAD16_BYTE( "136089-1025.6p", 0x100001, 0x20000, CRC(054a163b) SHA1(1b0b129c093398bc5c14b3fdd87dfe149f555fac) )
620 	ROM_LOAD16_BYTE( "136089-1028.7s", 0x140000, 0x20000, CRC(31ff090a) SHA1(7b43ed37901c3f94cae90c84b3c8c689d7b64dd6) )
621 	ROM_LOAD16_BYTE( "136089-1027.7p", 0x140001, 0x20000, CRC(bbe5b69b) SHA1(9eaa551fba763824d36fc41bfe0e6d735a9e68c5) )
622 	ROM_LOAD16_BYTE( "136089-1030.8s", 0x180000, 0x20000, CRC(6c89d2c5) SHA1(0bf2990ce1cd5ec5b84f7e3171725540e6238408) )
623 	ROM_LOAD16_BYTE( "136089-1029.8p", 0x180001, 0x20000, CRC(40d9bde5) SHA1(aca6e07ea96e4618412d32fe4d4cd293ae82d940) )
624 	ROM_LOAD16_BYTE( "136089-1032.9s", 0x1c0000, 0x20000, CRC(eca3c595) SHA1(5d067b7c02675b1e6dd3c4046697a16f873f80af) )
625 	ROM_LOAD16_BYTE( "136089-1031.9p", 0x1c0001, 0x20000, CRC(88acdb53) SHA1(5bf2424ee75a25248a8ce38c8605b6780da4e323) )
626 
627 	ROM_REGION( 0x80000, "jsa:oki1", 0 )
628 	ROM_LOAD( "136089-1048.19e",  0x00000, 0x20000, CRC(2db638a7) SHA1(45da8088f7439beacc3056952a4d631d9633efa7) )
629 	ROM_LOAD( "136089-1049.17e",  0x20000, 0x20000, CRC(e1dd7f9e) SHA1(6b9a240aa84d210d3052daab6ea26f9cd0e62dc1) )
630 	ROM_LOAD( "136089-1050.15e",  0x40000, 0x20000, CRC(64d410bb) SHA1(877bccca7ff37a9dd8294bc1453487a2f516ca7d) )
631 	ROM_LOAD( "136089-1051.12e",  0x60000, 0x20000, CRC(bffd01c8) SHA1(f6de000f61ea0c1ddb31ee5301506e5e966638c2) )
632 
633 	ROM_REGION( 0x800, "eeprom", 0 )
634 	ROM_LOAD( "roadriot-eeprom.5c", 0x0000, 0x800, CRC(8d9b957d) SHA1(9d895c5977a3f405130594a10d530a82a6aa265f) )
635 
636 	ROM_REGION( 0x0600, "proms", 0 )    /* microcode for growth renderer */
637 	ROM_LOAD( "136089-1001.20p",  0x0000, 0x0200, CRC(5836cb5a) SHA1(2c797f6a1227d6e1fd7a12f99f0254072c8c266e) )
638 	ROM_LOAD( "136089-1002.22p",  0x0200, 0x0200, CRC(44288753) SHA1(811582015264f85a32643196cdb331a41430318f) )
639 	ROM_LOAD( "136089-1003.21p",  0x0400, 0x0200, CRC(1f571706) SHA1(26d5ea59163b3482ab1f8a26178d0849c5fd9692) )
640 ROM_END
641 
642 ROM_START( roadriota )
643 	ROM_REGION( 0x80004, "maincpu", 0 ) /* 68000 code */
644 	ROM_LOAD16_BYTE( "136089-3114.8d", 0x00000, 0x20000, CRC(a2bd949c) SHA1(f96064d491b4d488cadebd3a63a6d3edf9236046) )
645 	ROM_LOAD16_BYTE( "136089-3113.8c", 0x00001, 0x20000, CRC(68c45cb1) SHA1(e38c7ad3f3d301e59a1d9f53e8f2c28e91d691fe) )
646 	ROM_LOAD16_BYTE( "136089-2016.9d", 0x40000, 0x20000, CRC(6191653c) SHA1(97d1a84a585149e8f2c49cab7af22dc755dff350) )
647 	ROM_LOAD16_BYTE( "136089-2015.9c", 0x40001, 0x20000, CRC(0d34419a) SHA1(f16e9fb4cd537d727611cb7dd5537c030671fe1e) )
648 
649 	ROM_REGION( 0x2000, "asic65:asic65cpu", 0 )   /* ASIC65 TMS32015 code */
650 	ROM_LOAD( "136089-1012.3f", 0x00000, 0x0a80, CRC(7c5498e7) SHA1(9d8b235baf7b75bef8ef9b168647c5b2b80b2cb3) )
651 
652 	ROM_REGION( 0x10000, "jsa:cpu", 0 ) /* 6502 code */
653 	ROM_LOAD( "136089-1047.12c", 0x00000, 0x10000, CRC(849dd26c) SHA1(05a0b2a5f7ee4437448b5f076d3066d96dec2320) )
654 
655 	ROM_REGION( 0xc0000, "gfx1", 0 )
656 	ROM_LOAD( "136089-1041.22d",    0x000000, 0x20000, CRC(b7451f92) SHA1(9fd17913630e457e406e596f2d86afff98787750) ) /* playfield, planes 0-1 */
657 	ROM_LOAD( "136089-1038.22c",    0x020000, 0x20000, CRC(90f3c6ee) SHA1(7607509e2d3b2080a918cfaf2879dbed6b79d029) )
658 	ROM_LOAD( "136089-1037.2021d",  0x040000, 0x20000, CRC(d40de62b) SHA1(fa6dfd20bdad7874ae33a1027a9bb0ea200f86ca) ) /* playfield, planes 2-3 */
659 	ROM_LOAD( "136089-1039.2021c",  0x060000, 0x20000, CRC(a7e836b1) SHA1(d41f1e4166ca757176c6976be2a953db5db05e48) )
660 	ROM_LOAD( "136089-1040.20d",    0x080000, 0x20000, CRC(a81ae93f) SHA1(b694ba5fab35f8fa505a02039ae62f7af3c7ae1d) ) /* playfield, planes 4-5 */
661 	ROM_LOAD( "136089-1042.20c",    0x0a0000, 0x20000, CRC(b8a6d15a) SHA1(43d2be9d40a84b2c01d80bbcac737eda04d55999) )
662 
663 	ROM_REGION( 0x020000, "gfx2", 0 )
664 	ROM_LOAD( "136089-1046.22j",    0x000000, 0x20000, CRC(0005bab0) SHA1(257e1b23eea117fe6701a67134b96d9d9fe10caf) ) /* alphanumerics */
665 
666 	ROM_REGION16_BE( 0x200000, "rle", 0 )
667 	ROM_LOAD16_BYTE( "136089-1018.2s", 0x000000, 0x20000, CRC(19590a94) SHA1(e375b7e01a8b1f366bb4e7750e33f0b6d9ae2042) )
668 	ROM_LOAD16_BYTE( "136089-1017.2p", 0x000001, 0x20000, CRC(c2bf3f69) SHA1(f822359070b1907973ee7ee35469f4a59f720830) )
669 	ROM_LOAD16_BYTE( "136089-1020.3s", 0x040000, 0x20000, CRC(bab110e4) SHA1(0c4e3521474249517e7832df1bc63aca6d6a6c91) )
670 	ROM_LOAD16_BYTE( "136089-1019.3p", 0x040001, 0x20000, CRC(791ad2c5) SHA1(4ef218fbf38a9c6b58c86f203843988df1c935f6) )
671 	ROM_LOAD16_BYTE( "136089-1022.4s", 0x080000, 0x20000, CRC(79cba484) SHA1(ce361a432f1fe627086bab3c1131118fd15056f1) )
672 	ROM_LOAD16_BYTE( "136089-1021.4p", 0x080001, 0x20000, CRC(86a2e257) SHA1(98d95d2e67fecc332f6c66358a1f8d58b168c74b) )
673 	ROM_LOAD16_BYTE( "136089-1024.5s", 0x0c0000, 0x20000, CRC(67d28478) SHA1(cfc9da6d20c65d11c2a59a38660a8da4d1cc219d) )
674 	ROM_LOAD16_BYTE( "136089-1023.5p", 0x0c0001, 0x20000, CRC(74638838) SHA1(bea0fb21ccb946e023c88791ce5a8dd92b44baec) )
675 	ROM_LOAD16_BYTE( "136089-1026.6s", 0x100000, 0x20000, CRC(24933c37) SHA1(516393aae51fc9634a5c6d5134be058d6067e114) )
676 	ROM_LOAD16_BYTE( "136089-1025.6p", 0x100001, 0x20000, CRC(054a163b) SHA1(1b0b129c093398bc5c14b3fdd87dfe149f555fac) )
677 	ROM_LOAD16_BYTE( "136089-1028.7s", 0x140000, 0x20000, CRC(31ff090a) SHA1(7b43ed37901c3f94cae90c84b3c8c689d7b64dd6) )
678 	ROM_LOAD16_BYTE( "136089-1027.7p", 0x140001, 0x20000, CRC(bbe5b69b) SHA1(9eaa551fba763824d36fc41bfe0e6d735a9e68c5) )
679 	ROM_LOAD16_BYTE( "136089-1030.8s", 0x180000, 0x20000, CRC(6c89d2c5) SHA1(0bf2990ce1cd5ec5b84f7e3171725540e6238408) )
680 	ROM_LOAD16_BYTE( "136089-1029.8p", 0x180001, 0x20000, CRC(40d9bde5) SHA1(aca6e07ea96e4618412d32fe4d4cd293ae82d940) )
681 	ROM_LOAD16_BYTE( "136089-1032.9s", 0x1c0000, 0x20000, CRC(eca3c595) SHA1(5d067b7c02675b1e6dd3c4046697a16f873f80af) )
682 	ROM_LOAD16_BYTE( "136089-1031.9p", 0x1c0001, 0x20000, CRC(88acdb53) SHA1(5bf2424ee75a25248a8ce38c8605b6780da4e323) )
683 
684 	ROM_REGION( 0x80000, "jsa:oki1", 0 )
685 	ROM_LOAD( "136089-1048.19e",  0x00000, 0x20000, CRC(2db638a7) SHA1(45da8088f7439beacc3056952a4d631d9633efa7) )
686 	ROM_LOAD( "136089-1049.17e",  0x20000, 0x20000, CRC(e1dd7f9e) SHA1(6b9a240aa84d210d3052daab6ea26f9cd0e62dc1) )
687 	ROM_LOAD( "136089-1050.15e",  0x40000, 0x20000, CRC(64d410bb) SHA1(877bccca7ff37a9dd8294bc1453487a2f516ca7d) )
688 	ROM_LOAD( "136089-1051.12e",  0x60000, 0x20000, CRC(bffd01c8) SHA1(f6de000f61ea0c1ddb31ee5301506e5e966638c2) )
689 
690 	ROM_REGION( 0x800, "eeprom", 0 )
691 	ROM_LOAD( "roadriot-eeprom.5c", 0x0000, 0x800, CRC(8d9b957d) SHA1(9d895c5977a3f405130594a10d530a82a6aa265f) )
692 
693 	ROM_REGION( 0x0600, "proms", 0 )    /* microcode for growth renderer */
694 	ROM_LOAD( "136089-1001.20p",  0x0000, 0x0200, CRC(5836cb5a) SHA1(2c797f6a1227d6e1fd7a12f99f0254072c8c266e) )
695 	ROM_LOAD( "136089-1002.22p",  0x0200, 0x0200, CRC(44288753) SHA1(811582015264f85a32643196cdb331a41430318f) )
696 	ROM_LOAD( "136089-1003.21p",  0x0400, 0x0200, CRC(1f571706) SHA1(26d5ea59163b3482ab1f8a26178d0849c5fd9692) )
697 ROM_END
698 
699 ROM_START( roadriotb )
700 	ROM_REGION( 0x80004, "maincpu", 0 ) /* 68000 code */
701 	ROM_LOAD16_BYTE( "136089-2014.8d", 0x00000, 0x20000, CRC(bf8aaafc) SHA1(1594d91b56609d49921c866d8f5796619e79217b) ) /* Program ROMs in Blue labels,  */
702 	ROM_LOAD16_BYTE( "136089-2013.8c", 0x00001, 0x20000, CRC(5dd2dd70) SHA1(8f6a0e809ec1f6feea8a18197a789086a7b9dd6a) ) /* other ROMs in Yellow labels   */
703 	ROM_LOAD16_BYTE( "136089-2016.9d", 0x40000, 0x20000, CRC(6191653c) SHA1(97d1a84a585149e8f2c49cab7af22dc755dff350) ) /* PALs & BPROMs in White labels */
704 	ROM_LOAD16_BYTE( "136089-2015.9c", 0x40001, 0x20000, CRC(0d34419a) SHA1(f16e9fb4cd537d727611cb7dd5537c030671fe1e) )
705 
706 	ROM_REGION( 0x2000, "asic65:asic65cpu", 0 )   /* ASIC65 TMS32015 code */
707 	ROM_LOAD( "136089-1012.3f", 0x00000, 0x0a80, CRC(7c5498e7) SHA1(9d8b235baf7b75bef8ef9b168647c5b2b80b2cb3) )
708 
709 	ROM_REGION( 0x10000, "jsa:cpu", 0 ) /* 6502 code */
710 	ROM_LOAD( "136089-1047.12c", 0x00000, 0x10000, CRC(849dd26c) SHA1(05a0b2a5f7ee4437448b5f076d3066d96dec2320) )
711 
712 	ROM_REGION( 0xc0000, "gfx1", 0 )
713 	ROM_LOAD( "136089-1041.22d",    0x000000, 0x20000, CRC(b7451f92) SHA1(9fd17913630e457e406e596f2d86afff98787750) ) /* playfield, planes 0-1 */
714 	ROM_LOAD( "136089-1038.22c",    0x020000, 0x20000, CRC(90f3c6ee) SHA1(7607509e2d3b2080a918cfaf2879dbed6b79d029) )
715 	ROM_LOAD( "136089-1037.2021d",  0x040000, 0x20000, CRC(d40de62b) SHA1(fa6dfd20bdad7874ae33a1027a9bb0ea200f86ca) ) /* playfield, planes 2-3 */
716 	ROM_LOAD( "136089-1039.2021c",  0x060000, 0x20000, CRC(a7e836b1) SHA1(d41f1e4166ca757176c6976be2a953db5db05e48) )
717 	ROM_LOAD( "136089-1040.20d",    0x080000, 0x20000, CRC(a81ae93f) SHA1(b694ba5fab35f8fa505a02039ae62f7af3c7ae1d) ) /* playfield, planes 4-5 */
718 	ROM_LOAD( "136089-1042.20c",    0x0a0000, 0x20000, CRC(b8a6d15a) SHA1(43d2be9d40a84b2c01d80bbcac737eda04d55999) )
719 
720 	ROM_REGION( 0x020000, "gfx2", 0 )
721 	ROM_LOAD( "136089-1046.22j",    0x000000, 0x20000, CRC(0005bab0) SHA1(257e1b23eea117fe6701a67134b96d9d9fe10caf) ) /* alphanumerics */
722 
723 	ROM_REGION16_BE( 0x200000, "rle", 0 )
724 	ROM_LOAD16_BYTE( "136089-1018.2s", 0x000000, 0x20000, CRC(19590a94) SHA1(e375b7e01a8b1f366bb4e7750e33f0b6d9ae2042) )
725 	ROM_LOAD16_BYTE( "136089-1017.2p", 0x000001, 0x20000, CRC(c2bf3f69) SHA1(f822359070b1907973ee7ee35469f4a59f720830) )
726 	ROM_LOAD16_BYTE( "136089-1020.3s", 0x040000, 0x20000, CRC(bab110e4) SHA1(0c4e3521474249517e7832df1bc63aca6d6a6c91) )
727 	ROM_LOAD16_BYTE( "136089-1019.3p", 0x040001, 0x20000, CRC(791ad2c5) SHA1(4ef218fbf38a9c6b58c86f203843988df1c935f6) )
728 	ROM_LOAD16_BYTE( "136089-1022.4s", 0x080000, 0x20000, CRC(79cba484) SHA1(ce361a432f1fe627086bab3c1131118fd15056f1) )
729 	ROM_LOAD16_BYTE( "136089-1021.4p", 0x080001, 0x20000, CRC(86a2e257) SHA1(98d95d2e67fecc332f6c66358a1f8d58b168c74b) )
730 	ROM_LOAD16_BYTE( "136089-1024.5s", 0x0c0000, 0x20000, CRC(67d28478) SHA1(cfc9da6d20c65d11c2a59a38660a8da4d1cc219d) )
731 	ROM_LOAD16_BYTE( "136089-1023.5p", 0x0c0001, 0x20000, CRC(74638838) SHA1(bea0fb21ccb946e023c88791ce5a8dd92b44baec) )
732 	ROM_LOAD16_BYTE( "136089-1026.6s", 0x100000, 0x20000, CRC(24933c37) SHA1(516393aae51fc9634a5c6d5134be058d6067e114) )
733 	ROM_LOAD16_BYTE( "136089-1025.6p", 0x100001, 0x20000, CRC(054a163b) SHA1(1b0b129c093398bc5c14b3fdd87dfe149f555fac) )
734 	ROM_LOAD16_BYTE( "136089-1028.7s", 0x140000, 0x20000, CRC(31ff090a) SHA1(7b43ed37901c3f94cae90c84b3c8c689d7b64dd6) )
735 	ROM_LOAD16_BYTE( "136089-1027.7p", 0x140001, 0x20000, CRC(bbe5b69b) SHA1(9eaa551fba763824d36fc41bfe0e6d735a9e68c5) )
736 	ROM_LOAD16_BYTE( "136089-1030.8s", 0x180000, 0x20000, CRC(6c89d2c5) SHA1(0bf2990ce1cd5ec5b84f7e3171725540e6238408) )
737 	ROM_LOAD16_BYTE( "136089-1029.8p", 0x180001, 0x20000, CRC(40d9bde5) SHA1(aca6e07ea96e4618412d32fe4d4cd293ae82d940) )
738 	ROM_LOAD16_BYTE( "136089-1032.9s", 0x1c0000, 0x20000, CRC(eca3c595) SHA1(5d067b7c02675b1e6dd3c4046697a16f873f80af) )
739 	ROM_LOAD16_BYTE( "136089-1031.9p", 0x1c0001, 0x20000, CRC(88acdb53) SHA1(5bf2424ee75a25248a8ce38c8605b6780da4e323) )
740 
741 	ROM_REGION( 0x80000, "jsa:oki1", 0 )
742 	ROM_LOAD( "136089-1048.19e",  0x00000, 0x20000, CRC(2db638a7) SHA1(45da8088f7439beacc3056952a4d631d9633efa7) )
743 	ROM_LOAD( "136089-1049.17e",  0x20000, 0x20000, CRC(e1dd7f9e) SHA1(6b9a240aa84d210d3052daab6ea26f9cd0e62dc1) )
744 	ROM_LOAD( "136089-1050.15e",  0x40000, 0x20000, CRC(64d410bb) SHA1(877bccca7ff37a9dd8294bc1453487a2f516ca7d) )
745 	ROM_LOAD( "136089-1051.12e",  0x60000, 0x20000, CRC(bffd01c8) SHA1(f6de000f61ea0c1ddb31ee5301506e5e966638c2) )
746 
747 	ROM_REGION( 0x800, "eeprom", 0 )
748 	ROM_LOAD( "roadriot-eeprom.5c", 0x0000, 0x800, CRC(8d9b957d) SHA1(9d895c5977a3f405130594a10d530a82a6aa265f) )
749 
750 	ROM_REGION( 0x0600, "proms", 0 )    /* microcode for growth renderer */
751 	ROM_LOAD( "136089-1001.20p",  0x0000, 0x0200, CRC(5836cb5a) SHA1(2c797f6a1227d6e1fd7a12f99f0254072c8c266e) )
752 	ROM_LOAD( "136089-1002.22p",  0x0200, 0x0200, CRC(44288753) SHA1(811582015264f85a32643196cdb331a41430318f) )
753 	ROM_LOAD( "136089-1003.21p",  0x0400, 0x0200, CRC(1f571706) SHA1(26d5ea59163b3482ab1f8a26178d0849c5fd9692) )
754 ROM_END
755 
756 
757 ROM_START( guardian )
758 	ROM_REGION( 0x80004, "maincpu", 0 ) /* 68000 code */
759 	ROM_LOAD16_BYTE( "136092-2021.8e",  0x00000, 0x20000, CRC(efea1e02) SHA1(f0f1ef300f36953aff73b68ffe6d9950ac575f7d) )
760 	ROM_LOAD16_BYTE( "136092-2020.8cd", 0x00001, 0x20000, CRC(a8f655ba) SHA1(2defe4d138613e248718a617d103794e051746f7) )
761 	ROM_LOAD16_BYTE( "136092-2023.9e",  0x40000, 0x20000, CRC(cfa29316) SHA1(4e0e76304e29ee59bc2ce9a704e3f651dc9d473c) )
762 	ROM_LOAD16_BYTE( "136092-2022.9cd", 0x40001, 0x20000, CRC(ed2abc91) SHA1(81531040d5663f6ab82e924210056e3737e17a8d) )
763 
764 	ROM_REGION( 0x2000, "asic65:asic65cpu", 0 )   /* ASIC65 TMS32015 code */
765 	ROM_LOAD( "136089-1012.3f", 0x00000, 0x0a80, NO_DUMP )
766 
767 	ROM_REGION( 0x10000, "jsa:cpu", 0 ) /* 6502 code */
768 	ROM_LOAD( "136092-0080-snd.12c", 0x00000, 0x10000, CRC(0388f805) SHA1(49c11313bc4192dbe294cf68b652cb19047889fd) )
769 
770 	ROM_REGION( 0x180000, "gfx1", 0 )
771 	ROM_LOAD( "136092-0037a.23e",  0x000000, 0x80000, CRC(ca10b63e) SHA1(243a2a440e1bc9135d3dbe6553d39c54b9bdcd13) ) /* playfield, planes 0-1 */
772 	ROM_LOAD( "136092-0038a.22e",  0x080000, 0x80000, CRC(cb1431a1) SHA1(d7b8f49a1e794ca2083e4bf0fa3870ce08caa53a) ) /* playfield, planes 2-3 */
773 	ROM_LOAD( "136092-0039a.20e",  0x100000, 0x80000, CRC(2eee7188) SHA1(d3adbd7b20bc898fee35b6ba781e7775f82acd19) ) /* playfield, planes 4-5 */
774 
775 	ROM_REGION( 0x020000, "gfx2", 0 )
776 	ROM_LOAD( "136092-0030.23k",   0x000000, 0x20000, CRC(0fd7baa1) SHA1(7802d732e5173291628ed498ad0fab71aeef4688) ) /* alphanumerics */
777 
778 	ROM_REGION16_BE( 0x600000, "rle", 0 )
779 	ROM_LOAD16_BYTE( "136092-0041.2s",  0x000000, 0x80000, CRC(a2a5ae08) SHA1(d99f925bbc9a72432e13328ee8422fde615db90f) )
780 	ROM_LOAD16_BYTE( "136092-0040.2p",  0x000001, 0x80000, CRC(ef95132e) SHA1(288de1d15956a612b7d19ceb2cf853490bf42b05) )
781 	ROM_LOAD16_BYTE( "136092-0043.3s",  0x100000, 0x80000, CRC(6438b8e4) SHA1(ee1446209fbcab8b17c88c53b65e754a85f279d1) )
782 	ROM_LOAD16_BYTE( "136092-0042.3p",  0x100001, 0x80000, CRC(46bf7c0d) SHA1(12414de2698178b158ec4ca0fbb176943c944cec) )
783 	ROM_LOAD16_BYTE( "136092-0045.4s",  0x200000, 0x80000, CRC(4f4f2bee) SHA1(8276cdcd252d2d8fa41ab28e76a6bd72613c14ec) )
784 	ROM_LOAD16_BYTE( "136092-0044.4p",  0x200001, 0x80000, CRC(20a4250b) SHA1(6a2e2596a9eef2792f7cdab648dd455b8e420a74) )
785 	ROM_LOAD16_BYTE( "136092-0063a.6s", 0x300000, 0x80000, CRC(93933bcf) SHA1(a67d4839ffdb0eafbc2d68a60fb3bf1507c793cf) )
786 	ROM_LOAD16_BYTE( "136092-0062a.6p", 0x300001, 0x80000, CRC(613e6f1d) SHA1(fd2ea18d245d0895e0bac6c5caa6d35fdd6a199f) )
787 	ROM_LOAD16_BYTE( "136092-0065a.7s", 0x400000, 0x80000, CRC(6bcd1205) SHA1(c883c55f88d274ba8aa48c962406b253e1f8001e) )
788 	ROM_LOAD16_BYTE( "136092-0064a.7p", 0x400001, 0x80000, CRC(7b4dce05) SHA1(36545917388e704f73a9b4d85189ec978d655b63) )
789 	ROM_LOAD16_BYTE( "136092-0067a.9s", 0x500000, 0x80000, CRC(15845fba) SHA1(f7b670a8d48a5e9c261150914a06ef9a938a84e7) )
790 	ROM_LOAD16_BYTE( "136092-0066a.9p", 0x500001, 0x80000, CRC(7130c575) SHA1(b3ea109981a1e5c631705b23dfad4a3a3daf7734) )
791 
792 	ROM_REGION( 0x80000, "jsa:oki1", 0 )
793 	ROM_LOAD( "136092-0010-snd.19e",  0x00000, 0x80000, CRC(bca27f40) SHA1(91a41eac116eb7d9a790abc590eb06328726d1c2) )
794 
795 	ROM_REGION( 0x800, "eeprom", 0 )
796 	ROM_LOAD( "guardian-eeprom.5c", 0x0000, 0x800, CRC(85835fab) SHA1(747e2851c8baa0e7f1c0784b0d6900514230ab07) )
797 
798 	ROM_REGION( 0x0600, "proms", 0 )    /* microcode for growth renderer */
799 	ROM_LOAD( "136092-1001.20p",  0x0000, 0x0200, CRC(b3251eeb) SHA1(5e83baa70aaa28f07f32657bf974fd87719972d3) )
800 	ROM_LOAD( "136092-1002.22p",  0x0200, 0x0200, CRC(0c5314da) SHA1(a9c7ee3ab015c7f3ada4200acd2854eb9a5c74b0) )
801 	ROM_LOAD( "136092-1003.21p",  0x0400, 0x0200, CRC(344b406a) SHA1(f4422f8c0d7004d0277a4fc77718d555f80fcf69) )
802 
803 	ROM_REGION( 0x1500, "plds", 0 )
804 	ROM_LOAD( "gal16v8a.3l",  0x0000, 0x0117, NO_DUMP ) /* PAL is read protected */
805 	ROM_LOAD( "gal16v8a.7c",  0x0200, 0x0117, NO_DUMP ) /* PAL is read protected */
806 	ROM_LOAD( "gal16v8a.13s", 0x0400, 0x0117, NO_DUMP ) /* PAL is read protected */
807 	ROM_LOAD( "gal16v8a.16j", 0x0600, 0x0117, NO_DUMP ) /* PAL is read protected */
808 	ROM_LOAD( "gal16v8a.17c", 0x0800, 0x0117, NO_DUMP ) /* PAL is read protected */
809 	ROM_LOAD( "gal16v8a.18k", 0x0a00, 0x0117, NO_DUMP ) /* PAL is read protected */
810 	ROM_LOAD( "gal16v8a.20c", 0x0c00, 0x0117, NO_DUMP ) /* PAL is read protected */
811 	ROM_LOAD( "gal16v8a.22l", 0x0e00, 0x0117, NO_DUMP ) /* PAL is read protected */
812 	ROM_LOAD( "gal6001b.15h", 0x1000, 0x0410, NO_DUMP ) /* PAL is read protected */
813 ROM_END
814 
815 
816 
817 /*************************************
818  *
819  *  Driver initialization
820  *
821  *************************************/
822 
823 void atarig42_0x200_state::init_roadriot()
824 {
825 	m_playfield_base = 0x400;
826 
827 	address_space &main = m_maincpu->space(AS_PROGRAM);
828 	main.install_readwrite_handler(0x000000, 0x07ffff, read16sm_delegate(*this, FUNC(atarig42_0x200_state::roadriot_sloop_data_r)), write16sm_delegate(*this, FUNC(atarig42_0x200_state::roadriot_sloop_data_w)));
829 	m_sloop_base = (uint16_t *)memregion("maincpu")->base();
830 
831 	/*
832 	Road Riot color MUX
833 
834 	CRA10=!MGEP*!AN.VID7*AN.0               -- if (mopri < pfpri) && (!alpha)
835 	   +!AN.VID7*AN.0*MO.0                  or if (mopix == 0) && (!alpha)
836 
837 	CRA9=MGEP*!AN.VID7*AN.0*!MO.0           -- if (mopri >= pfpri) && (mopix != 0) && (!alpha)
838 	   +!AN.VID7*AN.0*PF.VID9               or if (pfpix & 0x200) && (!alpha)
839 
840 	CRA8=MGEP*!AN.VID7*AN.0*!MO.0*MVID8     -- if (mopri >= pfpri) && (mopix != 0) && (mopix & 0x100) && (!alpha)
841 	   +!MGEP*!AN.VID7*AN.0*PF.VID8         or if (mopri < pfpri) && (pfpix & 0x100) && (!alpha)
842 	   +!AN.VID7*AN.0*MO.0*PF.VID8          or if (pfpix & 0x100) && (!alpha)
843 
844 	CRMUXB=!AN.VID7*AN.0                    -- if (!alpha)
845 
846 	CRMUXA=!MGEP                            -- if (mopri < pfpri)
847 	   +MO.0                                or (mopix == 0)
848 	   +AN.VID7                             or (alpha)
849 	   +!AN.0
850 */
851 }
852 
853 
init_guardian()854 void atarig42_0x400_state::init_guardian()
855 {
856 	m_playfield_base = 0x000;
857 
858 	/* it looks like they jsr to $80000 as some kind of protection */
859 	/* put an RTS there so we don't die */
860 	*(uint16_t *)&memregion("maincpu")->base()[0x80000] = 0x4E75;
861 
862 	address_space &main = m_maincpu->space(AS_PROGRAM);
863 	main.install_readwrite_handler(0x000000, 0x07ffff, read16sm_delegate(*this, FUNC(atarig42_0x400_state::guardians_sloop_data_r)), write16sm_delegate(*this, FUNC(atarig42_0x400_state::guardians_sloop_data_w)));
864 	m_sloop_base = (uint16_t *)memregion("maincpu")->base();
865 
866 	/*
867 	Guardians color MUX
868 
869 	CRA10=MGEP*!AN.VID7*AN.0*!MO.0          -- if (mopri >= pfpri) && (!alpha) && (mopix != 0)
870 
871 	CRA9=MGEP*!AN.VID7*AN.0*!MO.0*MVID9     -- if (mopri >= pfpri) && (!alpha) && (mopix != 0) && (mopix & 0x200)
872 	   +!MGEP*!AN.VID7*AN.0*PF.VID9         or if (mopri < pfpri) && (!alpha) && (pfpix & 0x200)
873 	   +!AN.VID7*AN.0*MO.0*PF.VID9          or if (mopix == 0) && (!alpha) && (pfpix & 0x200)
874 
875 	CRA8=MGEP*!AN.VID7*AN.0*!MO.0*MVID8     -- if (mopri >= pfpri) && (!alpha) && (mopix != 0) && (mopix & 0x100)
876 	   +!MGEP*!AN.VID7*AN.0*PF.VID8         or if (mopri < pfpri) && (!alpha) && (pfpix & 0x100)
877 	   +!AN.VID7*AN.0*MO.0*PF.VID8          or if (mopix == 0) && (!alpha) && (pfpix & 0x100)
878 
879 	CRMUXB=!AN.VID7*AN.0                    -- if (!alpha)
880 
881 	CRMUXA=!MGEP                            -- if (mopri < pfpri)
882 	   +MO.0                                or (mopix == 0)
883 	   +AN.VID7                             or (alpha)
884 	   +!AN.0
885 */
886 }
887 
888 
889 
890 /*************************************
891  *
892  *  Game driver(s)
893  *
894  *************************************/
895 
896 GAME( 1991, roadriot,  0,        atarig42_0x200, roadriot, atarig42_0x200_state, init_roadriot, ROT0, "Atari Games", "Road Riot 4WD (set 1, 04 Dec 1991)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NODEVICE_LAN )
897 GAME( 1991, roadriota, roadriot, atarig42_0x200, roadriot, atarig42_0x200_state, init_roadriot, ROT0, "Atari Games", "Road Riot 4WD (set 2, 13 Nov 1991)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NODEVICE_LAN )
898 GAME( 1991, roadriotb, roadriot, atarig42_0x200, roadriot, atarig42_0x200_state, init_roadriot, ROT0, "Atari Games", "Road Riot 4WD (set 3, 04 Jun 1991)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NODEVICE_LAN )
899 GAME( 1992, guardian,  0,        atarig42_0x400, guardian, atarig42_0x400_state, init_guardian, ROT0, "Atari Games", "Guardians of the 'Hood", 0 )
900