1 /***************************************************************************
2 
3 	Atari Football hardware
4 
5 	driver by Mike Balfour, Patrick Lawrence, Brad Oliver
6 
7 	Games supported:
8 		* Atari Football
9 		* Atari Baseball
10 		* Atari Soccer
11 
12 	Known issues:
13 		* The down marker sprite is multiplexed so that it will be drawn at the
14 		  top and bottom of the screen. We fake this feature. Additionally, we
15 		  draw it at a different location which seems to make more sense.
16 
17 		* The play which is chosen is drawn in text at the top of the screen;
18 		  no backdrop/overlay is supported yet. High quality artwork would be
19 		  appreciated.
20 
21 		* I'm not good at reading the schematics, so I'm unsure about the
22 		  exact vblank duration. I'm pretty sure it is one of two values though.
23 
24 		* The 4-player variation is slightly broken. I'm unsure of the
25 		  LED multiplexing.
26 
27 ****************************************************************************
28 
29 	Memory Map:
30 		0000-01FF	Working RAM
31 		0200-025F	Playfield - Player 1
32 		03A0-03FF	Playfield - Player 2
33 		1000-13BF	Scrollfield
34 		13C0-13FF	Motion Object Parameters:
35 
36 		13C0		Motion Object 1 Picture #
37 		13C1		Motion Object 1 Vertical Position
38 		13C2		Motion Object 2 Picture #
39 		13C3		Motion Object 2 Vertical Position
40 		...
41 		13DE		Motion Object 16 Picture #
42 		13DF		Motion Object 16 Vertical Position
43 
44 		13E0		Motion Object 1 Horizontal Position
45 		13E1		Spare
46 		13E2		Motion Object 2 Horizontal Position
47 		13E3		Spare
48 		...
49 		13FE		Motion Object 16 Horizontal Position
50 		13FF		Spare
51 
52 		2000-2003	Output ports:
53 
54 		2000		(OUT 0) Scrollfield Offset (8 bits)
55 		2001		(OUT 1)
56 					D0 = Whistle
57 					D1 = Hit
58 					D2 = Kicker
59 					D5 = CTRLD
60 		2002		(OUT 2)
61 					D0-D3 = Noise Amplitude
62 					D4 = Coin Counter
63 					D5 = Attract
64 		2003		(OUT 3)
65 					D0-D3 = LED Cathodes
66 					D4-D5 Spare
67 
68 		3000		Interrupt Acknowledge
69 		4000-4003	Input ports:
70 
71 		4000		(IN 0) = 0
72 					D0 = Trackball Direction PL2VD
73 					D1 = Trackball Direction PL2HD
74 					D2 = Trackball Direction PL1VD
75 					D3 = Trackball Direction PL1HD
76 					D4 = Select 1
77 					D5 = Slam
78 					D6 = End Screen
79 					D7 = Coin 1
80 		4000		(CTRLD) = 1
81 					D0-D3 = Track-ball Horiz. 1
82 					D4-D7 = Track-ball Vert. 1
83 		4002		(IN 2) = 0
84 					D0-D3 = Option Switches
85 					D4 = Select 2
86 					D5 = Spare
87 					D6 = Test
88 					D7 = Coin 2
89 		4002		(CTRLD) = 1
90 					D0-D3 = Track-ball Horiz. 2
91 					D4-D7 = Track-ball Vert. 2
92 
93 		5000		Watchdog
94 		6800-7FFF	Program
95 		(F800-FFFF) - only needed for the 6502 vectors
96 
97 	If you have any questions about how this driver works, don't hesitate to
98 	ask.  - Mike Balfour (mab22@po.cwru.edu)
99 
100 	Changes:
101 		LBO - lots of cleanup, now it's playable.
102 
103 ***************************************************************************/
104 
105 #include "driver.h"
106 #include "vidhrdw/generic.h"
107 #include "atarifb.h"
108 
109 
110 int atarifb_game;
111 int atarifb_lamp1, atarifb_lamp2;
112 
113 
114 
115 /*************************************
116  *
117  *	Palette generation
118  *
119  *************************************/
120 
121 static const unsigned short colortable_source[] =
122 {
123 	0x02, 0x00, /* chars */
124 	0x03, 0x02, /* sprites */
125 	0x03, 0x00,
126 	0x03, 0x01, /* sprite masks */
127 	0x03, 0x00,
128 	0x03, 0x02,
129 };
130 
PALETTE_INIT(atarifb)131 static PALETTE_INIT( atarifb )
132 {
133 	palette_set_color(0,0x00,0x00,0x00); /* black  */
134 	palette_set_color(1,0x80,0x80,0x80); /* grey  */
135 	palette_set_color(2,0xff,0xff,0xff); /* white  */
136 	palette_set_color(3,0x40,0x40,0x40); /* dark grey (?) - used in Soccer only */
137 	memcpy(colortable,colortable_source,sizeof(colortable_source));
138 }
139 
140 
141 
142 /*************************************
143  *
144  *	Main CPU memory handlers
145  *
146  *************************************/
147 
MEMORY_READ_START(readmem)148 static MEMORY_READ_START( readmem )
149 	{ 0x0000, 0x03ff, MRA_RAM },
150 	{ 0x1000, 0x13bf, MRA_RAM },
151 	{ 0x13c0, 0x13ff, MRA_RAM },
152 	{ 0x3000, 0x3000, MRA_RAM },
153 	{ 0x4000, 0x4000, atarifb_in0_r },
154 	{ 0x4002, 0x4002, atarifb_in2_r },
155 	{ 0x6000, 0x7fff, MRA_ROM }, /* PROM */
156 	{ 0xfff0, 0xffff, MRA_ROM }, /* PROM for 6502 vectors */
157 MEMORY_END
158 
159 
160 static MEMORY_WRITE_START( writemem )
161 	{ 0x0000, 0x01ff, MWA_RAM },
162 	{ 0x0200, 0x025f, atarifb_alphap1_vram_w, &atarifb_alphap1_vram, &atarifb_alphap1_vram_size },
163 	{ 0x0260, 0x039f, MWA_RAM },
164 	{ 0x03a0, 0x03ff, atarifb_alphap2_vram_w, &atarifb_alphap2_vram, &atarifb_alphap2_vram_size },
165 	{ 0x1000, 0x13bf, videoram_w, &videoram, &videoram_size },
166 	{ 0x13c0, 0x13ff, MWA_RAM, &spriteram, &spriteram_size },
167 	{ 0x2000, 0x2000, atarifb_scroll_w, &atarifb_scroll_register }, /* OUT 0 */
168 	{ 0x2001, 0x2001, atarifb_out1_w }, /* OUT 1 */
169 	{ 0x2002, 0x2002, atarifb_out2_w }, /* OUT 2 */
170 	{ 0x2003, 0x2003, atarifb_out3_w }, /* OUT 3 */
171 	{ 0x3000, 0x3000, MWA_NOP }, /* Interrupt Acknowledge */
172 	{ 0x5000, 0x5000, watchdog_reset_w },
173 	{ 0x6000, 0x7fff, MWA_ROM }, /* PROM */
174 MEMORY_END
175 
176 
177 static MEMORY_READ_START( atarifb4_readmem )
178 	{ 0x0000, 0x03ff, MRA_RAM },
179 	{ 0x1000, 0x13bf, MRA_RAM },
180 	{ 0x13c0, 0x13ff, MRA_RAM },
181 	{ 0x3000, 0x3000, MRA_RAM },
182 	{ 0x4000, 0x4000, atarifb4_in0_r },
183 	{ 0x4001, 0x4001, input_port_1_r },
184 	{ 0x4002, 0x4002, atarifb4_in2_r },
185 	{ 0x6000, 0x7fff, MRA_ROM }, /* PROM */
186 	{ 0xfff0, 0xffff, MRA_ROM }, /* PROM for 6502 vectors */
187 MEMORY_END
188 
189 
190 static MEMORY_WRITE_START( atarifb4_writemem )
191 	{ 0x0000, 0x01ff, MWA_RAM },
192 	{ 0x0200, 0x025f, atarifb_alphap1_vram_w, &atarifb_alphap1_vram, &atarifb_alphap1_vram_size },
193 	{ 0x0260, 0x039f, MWA_RAM },
194 	{ 0x03a0, 0x03ff, atarifb_alphap2_vram_w, &atarifb_alphap2_vram, &atarifb_alphap2_vram_size },
195 	{ 0x1000, 0x13bf, videoram_w, &videoram, &videoram_size },
196 	{ 0x13c0, 0x13ff, MWA_RAM, &spriteram, &spriteram_size },
197 	{ 0x2000, 0x2000, atarifb_scroll_w, &atarifb_scroll_register }, /* OUT 0 */
198 	{ 0x2001, 0x2001, atarifb_out1_w }, /* OUT 1 */
199 	{ 0x2002, 0x2002, atarifb_out2_w }, /* OUT 2 */
200 	{ 0x2003, 0x2003, atarifb_out3_w }, /* OUT 3 */
201 	{ 0x3000, 0x3000, MWA_NOP }, /* Interrupt Acknowledge */
202 	{ 0x5000, 0x5000, watchdog_reset_w },
203 	{ 0x6000, 0x7fff, MWA_ROM }, /* PROM */
204 MEMORY_END
205 
206 
207 static MEMORY_READ_START( soccer_readmem )
208 	{ 0x0000, 0x03ff, MRA_RAM },
209 	{ 0x0800, 0x0bff, MRA_RAM },	/* playfield/object RAM */
210 	{ 0x2000, 0x3fff, MRA_ROM }, /* PROM */
211 	{ 0x1800, 0x1800, atarifb4_in0_r },
212 	{ 0x1801, 0x1801, input_port_1_r },
213 	{ 0x1802, 0x1802, atarifb4_in2_r },
214 	{ 0x1803, 0x1803, input_port_11_r },
215 	{ 0xfff0, 0xffff, MRA_ROM }, /* PROM for 6502 vectors */
216 MEMORY_END
217 
218 
219 static MEMORY_WRITE_START( soccer_writemem )
220 	{ 0x0000, 0x01ff, MWA_RAM },
221 	{ 0x0200, 0x025f, atarifb_alphap1_vram_w, &atarifb_alphap1_vram, &atarifb_alphap1_vram_size },
222 	{ 0x0260, 0x039f, MWA_RAM },
223 	{ 0x03a0, 0x03ff, atarifb_alphap2_vram_w, &atarifb_alphap2_vram, &atarifb_alphap2_vram_size },
224 	{ 0x0800, 0x0bbf, videoram_w, &videoram, &videoram_size },
225 	{ 0x0bc0, 0x0bff, MWA_RAM, &spriteram, &spriteram_size },
226 	{ 0x1000, 0x1000, atarifb_scroll_w, &atarifb_scroll_register }, /* OUT 0 */
227 	{ 0x1001, 0x1001, atarifb_out1_w }, /* OUT 1 */
228 	{ 0x1002, 0x1002, atarifb_out2_w }, /* OUT 2 */
229 	{ 0x1004, 0x1004, MWA_NOP }, /* Interrupt Acknowledge */
230 	{ 0x1005, 0x1005, watchdog_reset_w },
231 	{ 0x2000, 0x3fff, MWA_ROM }, /* PROM */
232 MEMORY_END
233 
234 
235 
236 /*************************************
237  *
238  *	Port definitions
239  *
240  *************************************/
241 
242 INPUT_PORTS_START( atarifb )
243 	PORT_START		/* IN0 */
244 	PORT_BIT ( 0x0F, IP_ACTIVE_HIGH, IPT_UNKNOWN )
245 	PORT_BIT ( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON1 )
246 	PORT_BIT ( 0x20, IP_ACTIVE_LOW,  IPT_TILT )
247 	PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_VBLANK )
248 	PORT_BIT ( 0x80, IP_ACTIVE_LOW,  IPT_COIN1 )
249 
250 	PORT_START		/* IN1 */
251 	PORT_DIPNAME( 0x03, 0x00, "Time per coin" )
252 	PORT_DIPSETTING(	0x00, "1:30" )
253 	PORT_DIPSETTING(	0x01, "2:00" )
254 	PORT_DIPSETTING(	0x02, "2:30" )
255 	PORT_DIPSETTING(	0x03, "3:00" )
256 	PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
257 	PORT_DIPSETTING(	0x00, DEF_STR( Off ) )
258 	PORT_DIPSETTING(	0x04, DEF_STR( On ) )
259 	PORT_DIPNAME( 0x08, 0x00, "Atari logo" )
260 	PORT_DIPSETTING(	0x08, DEF_STR( Off ) )
261 	PORT_DIPSETTING(	0x00, DEF_STR( On ) )
262 	PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
263 	PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
264 	PORT_SERVICE( 0x40, IP_ACTIVE_LOW )
265 	PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
266 
267 	PORT_START	/* IN2 - Player 1 trackball, y */
268 	PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_Y | IPF_REVERSE, 100, 10, 0, 0 )
269 	/* The lower 4 bits are the input */
270 
271 	PORT_START	/* IN3 - Player 1 trackball, x */
272 	PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_X, 100, 10, 0, 0 )
273 	/* The lower 4 bits are the input */
274 
275 	PORT_START	/* IN4 - Player 2 trackball, y */
276 	PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_Y | IPF_REVERSE | IPF_PLAYER2, 100, 10, 0, 0 )
277 	/* The lower 4 bits are the input */
278 
279 	PORT_START	/* IN5 - Player 2 trackball, x */
280 	PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_X | IPF_PLAYER2, 100, 10, 0, 0 )
281 	/* The lower 4 bits are the input */
282 INPUT_PORTS_END
283 
284 
285 INPUT_PORTS_START( atarifb4 )
286 	PORT_START		/* IN0 */
287 	PORT_BIT ( 0xff, IP_ACTIVE_LOW,  IPT_UNKNOWN )
288 
289 	PORT_START		/* IN1 */
290 	PORT_BIT ( 0x01, IP_ACTIVE_LOW,  IPT_COIN1 )
291 	PORT_BIT ( 0x02, IP_ACTIVE_LOW,  IPT_COIN2 )
292 	PORT_BIT ( 0x04, IP_ACTIVE_LOW,  IPT_COIN3 )
293 	PORT_BIT ( 0x38, IP_ACTIVE_LOW, IPT_UNKNOWN )
294 	PORT_SERVICE( 0x40, IP_ACTIVE_LOW )
295 	PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
296 
297 	PORT_START		/* IN2 */
298 	PORT_DIPNAME( 0x03, 0x00, "Time per coin" )
299 	PORT_DIPSETTING(	0x00, "1:30" )
300 	PORT_DIPSETTING(	0x01, "2:00" )
301 	PORT_DIPSETTING(	0x02, "2:30" )
302 	PORT_DIPSETTING(	0x03, "3:00" )
303 	PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
304 	PORT_DIPSETTING(	0x00, DEF_STR( Off ) )
305 	PORT_DIPSETTING(	0x04, DEF_STR( On ) )
306 	PORT_DIPNAME( 0x08, 0x00, "Atari logo" )
307 	PORT_DIPSETTING(	0x08, DEF_STR( Off ) )
308 	PORT_DIPSETTING(	0x00, DEF_STR( On ) )
309 	PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_START1 )
310 	PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_TILT )
311 	PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
312 	PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
313 
314 	PORT_START	/* IN3 - Player 1 trackball, y */
315 	PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_Y | IPF_REVERSE, 100, 10, 0, 0 )
316 	/* The lower 4 bits are the input */
317 
318 	PORT_START	/* IN4 - Player 1 trackball, x */
319 	PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_X, 100, 10, 0, 0 )
320 	/* The lower 4 bits are the input */
321 
322 	PORT_START	/* IN5 - Player 2 trackball, y */
323 	PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_Y | IPF_REVERSE | IPF_PLAYER2, 100, 10, 0, 0 )
324 	/* The lower 4 bits are the input */
325 
326 	PORT_START	/* IN6 - Player 2 trackball, x */
327 	PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_X | IPF_PLAYER2, 100, 10, 0, 0 )
328 	/* The lower 4 bits are the input */
329 
330 	PORT_START	/* IN7 - Player 3 trackball, y */
331 	PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_Y | IPF_REVERSE | IPF_PLAYER3, 100, 10, 0, 0 )
332 	/* The lower 4 bits are the input */
333 
334 	PORT_START	/* IN8 - Player 3 trackball, x */
335 	PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_X | IPF_PLAYER3, 100, 10, 0, 0 )
336 	/* The lower 4 bits are the input */
337 
338 	PORT_START	/* IN9 - Player 4 trackball, y */
339 	PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_Y | IPF_REVERSE | IPF_PLAYER4, 100, 10, 0, 0 )
340 	/* The lower 4 bits are the input */
341 
342 	PORT_START	/* IN10 - Player 4 trackball, x */
343 	PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_X | IPF_PLAYER4, 100, 10, 0, 0 )
344 	/* The lower 4 bits are the input */
345 INPUT_PORTS_END
346 
347 
348 INPUT_PORTS_START( abaseb )
349 	PORT_START		/* IN0 */
350 	PORT_BIT ( 0x0F, IP_ACTIVE_HIGH, IPT_UNKNOWN )
351 	PORT_BIT ( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON1 )
352 	PORT_BIT ( 0x20, IP_ACTIVE_LOW,  IPT_TILT )
353 	PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_VBLANK )
354 	PORT_BIT ( 0x80, IP_ACTIVE_LOW,  IPT_COIN1 )
355 
356 	PORT_START		/* IN1 */
357 	PORT_DIPNAME( 0x03, 0x02, DEF_STR( Difficulty ) )
358 	PORT_DIPSETTING(	0x00, "Hardest" )
359 	PORT_DIPSETTING(	0x01, "Hard" )
360 	PORT_DIPSETTING(	0x02, "Fair" )
361 	PORT_DIPSETTING(	0x03, "Easy" )
362 	PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) )
363 	PORT_DIPSETTING(	0x00, DEF_STR( Off ) )
364 	PORT_DIPSETTING(	0x04, DEF_STR( On ) )
365 	PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
366 	PORT_DIPSETTING(	0x00, DEF_STR( Off ) )
367 	PORT_DIPSETTING(	0x08, DEF_STR( On ) )
368 	PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
369 	PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
370 	PORT_SERVICE( 0x40, IP_ACTIVE_LOW )
371 	PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
372 
373 	PORT_START	/* IN2 - Player 1 trackball, y */
374 	PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_Y | IPF_REVERSE, 100, 10, 0, 0 )
375 	/* The lower 4 bits are the input */
376 
377 	PORT_START	/* IN3 - Player 1 trackball, x */
378 	PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_X, 100, 10, 0, 0 )
379 	/* The lower 4 bits are the input */
380 
381 	PORT_START	/* IN4 - Player 2 trackball, y */
382 	PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_Y | IPF_REVERSE | IPF_PLAYER2, 100, 10, 0, 0 )
383 	/* The lower 4 bits are the input */
384 
385 	PORT_START	/* IN5 - Player 2 trackball, x */
386 	PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_X | IPF_PLAYER2, 100, 10, 0, 0 )
387 	/* The lower 4 bits are the input */
388 INPUT_PORTS_END
389 
390 
391 INPUT_PORTS_START( soccer )
392 	PORT_START		/* IN0 */
393 	PORT_BIT ( 0xff, IP_ACTIVE_LOW,  IPT_UNKNOWN )
394 
395 	PORT_START		/* IN1 */
396 	PORT_BIT ( 0x01, IP_ACTIVE_LOW,  IPT_UNKNOWN ) /* unused on schematics */
397 	PORT_BIT ( 0x02, IP_ACTIVE_LOW,  IPT_COIN1 )
398 	PORT_BIT ( 0x04, IP_ACTIVE_LOW,  IPT_COIN2 )
399 	PORT_BIT ( 0x08, IP_ACTIVE_LOW,  IPT_COIN3 )
400 	PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused on schematics */
401 	PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_TILT )
402 	PORT_SERVICE( 0x40, IP_ACTIVE_LOW )
403 	PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
404 
405 	PORT_START		/* IN2 */
406 	PORT_BIT_NAME ( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2, "2/4 Player Toggle" )
407 	PORT_DIPNAME( 0x02, 0x00, "Rule Switch" )
408 	PORT_DIPSETTING(	0x00, DEF_STR( Off ) )
409 	PORT_DIPSETTING(	0x02, DEF_STR( On ) )
410 	PORT_DIPNAME( 0x0c, 0x00, "Language" )
411 	PORT_DIPSETTING(	0x00, "English" )
412 	PORT_DIPSETTING(	0x04, "German" )
413 	PORT_DIPSETTING(	0x08, "French" )
414 	PORT_DIPSETTING(	0x0c, "Spanish" )
415 	PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 )
416 	PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
417 	PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER4 )
418 	PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
419 
420 	PORT_START	/* IN3 - Player 1 trackball, y */
421 	PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_Y | IPF_REVERSE, 100, 10, 0, 0 )
422 	/* The lower 4 bits are the input */
423 
424 	PORT_START	/* IN4 - Player 1 trackball, x */
425 	PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_X, 100, 10, 0, 0 )
426 	/* The lower 4 bits are the input */
427 
428 	PORT_START	/* IN5 - Player 2 trackball, y */
429 	PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_Y | IPF_REVERSE | IPF_PLAYER2, 100, 10, 0, 0 )
430 	/* The lower 4 bits are the input */
431 
432 	PORT_START	/* IN6 - Player 2 trackball, x */
433 	PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_X | IPF_PLAYER2, 100, 10, 0, 0 )
434 	/* The lower 4 bits are the input */
435 
436 	PORT_START	/* IN7 - Player 3 trackball, y */
437 	PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_Y | IPF_REVERSE | IPF_PLAYER3, 100, 10, 0, 0 )
438 	/* The lower 4 bits are the input */
439 
440 	PORT_START	/* IN8 - Player 3 trackball, x */
441 	PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_X | IPF_PLAYER3, 100, 10, 0, 0 )
442 	/* The lower 4 bits are the input */
443 
444 	PORT_START	/* IN9 - Player 4 trackball, y */
445 	PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_Y | IPF_REVERSE | IPF_PLAYER4, 100, 10, 0, 0 )
446 	/* The lower 4 bits are the input */
447 
448 	PORT_START	/* IN10 - Player 4 trackball, x */
449 	PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_X | IPF_PLAYER4, 100, 10, 0, 0 )
450 	/* The lower 4 bits are the input */
451 
452 	PORT_START		/* IN11 */
453 	PORT_DIPNAME( 0x07, 0x00, "Time per coin" )
454 	PORT_DIPSETTING(	0x00, "1:00" )
455 	PORT_DIPSETTING(	0x01, "1:20" )
456 	PORT_DIPSETTING(	0x02, "1:40" )
457 	PORT_DIPSETTING(	0x03, "2:00" )
458 	PORT_DIPSETTING(	0x04, "2:30" )
459 	PORT_DIPSETTING(	0x05, "3:00" )
460 	PORT_DIPSETTING(	0x06, "3:30" )
461 	PORT_DIPSETTING(	0x07, "4:00" )
462 	PORT_DIPNAME( 0x18, 0x00, DEF_STR( Coin_B ) )
463 	PORT_DIPSETTING(	0x00, DEF_STR( 1C_1C ) )
464 	PORT_DIPSETTING(	0x08, DEF_STR( 1C_4C ) )
465 	PORT_DIPSETTING(	0x10, DEF_STR( 1C_5C ) )
466 	PORT_DIPSETTING(	0x18, DEF_STR( 1C_6C ) )
467 	PORT_DIPNAME( 0x20, 0x00, DEF_STR( Coin_A ) )
468 	PORT_DIPSETTING(	0x00, DEF_STR( 1C_1C ) )
469 	PORT_DIPSETTING(	0x20, DEF_STR( 1C_2C ) )
470 	PORT_DIPNAME( 0x40, 0x00, DEF_STR( Coinage ) )
471 	PORT_DIPSETTING(	0x00, "1 Coin Minimum" )
472 	PORT_DIPSETTING(	0x40, "2 Coin Minimum" )
473 	PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused on schematics */
474 INPUT_PORTS_END
475 
476 
477 
478 /*************************************
479  *
480  *	Graphics definitions
481  *
482  *************************************/
483 
484 static struct GfxLayout charlayout =
485 {
486 	8,8,
487 	64,
488 	1,
489 	{ 0 },
490 	{ 15, 14, 13, 12, 7, 6, 5, 4 },
491 	{ 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
492 	16*8
493 };
494 
495 
496 static struct GfxLayout fieldlayout =
497 {
498 	8,8,
499 	64,
500 	1,
501 	{ 0 },
502 	{ 0, 1, 2, 3, 4, 5, 6, 7 },
503 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
504 	8*8
505 };
506 
507 
508 static struct GfxLayout soccer_fieldlayout =
509 {
510 	8,8,
511 	64,
512 	1,
513 	{ 0 },
514 	{ 0, 1, 2, 3, 4, 5, 6, 7 },
515 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
516 	16*8
517 };
518 
519 
520 static struct GfxLayout spritelayout =
521 {
522 	8,16,
523 	64,
524 	1,
525 	{ 0 },
526 	{ 0, 1, 2, 3, 4, 5, 6, 7 },
527 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
528 			8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
529 	16*8
530 };
531 
532 
533 static struct GfxLayout spritemasklayout =
534 {
535 	8,16,
536 	64,
537 	1,
538 	{ 0 },
539 	{ 0, 1, 2, 3, 4, 5, 6, 7 },
540 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
541 			8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
542 	16*8
543 };
544 
545 
546 static struct GfxDecodeInfo gfxdecodeinfo[] =
547 {
548 	{ REGION_GFX1, 0, &charlayout,  0x00, 0x01 }, /* offset into colors, # of colors */
549 	{ REGION_GFX2, 0, &fieldlayout, 0x02, 0x01 }, /* offset into colors, # of colors */
550 	{ -1 } /* end of array */
551 };
552 
553 
554 static struct GfxDecodeInfo soccer_gfxdecodeinfo[] =
555 {
556 	{ REGION_GFX1, 0x0000, &charlayout,         0x00, 0x01 }, /* offset into colors, # of colors */
557 	{ REGION_GFX3, 0x0400, &soccer_fieldlayout, 0x06, 0x01 }, /* offset into colors, # of colors */
558 	{ REGION_GFX2, 0x0000, &spritelayout,       0x02, 0x02 }, /* offset into colors, # of colors */
559 	{ REGION_GFX3, 0x0000, &spritemasklayout,   0x06, 0x03 }, /* offset into colors, # of colors */
560 	{ -1 } /* end of array */
561 };
562 
563 
564 
565 /*************************************
566  *
567  *	Sound interfaces
568  *
569  *************************************/
570 
571 
572 /************************************************************************/
573 /* atarifb Sound System Analog emulation                                */
574 /************************************************************************/
575 
576 const struct discrete_555_astbl_desc atarifbWhistl555 =
577 {
578 	DISC_555_OUT_CAP | DISC_555_OUT_AC,
579 	5,		// B+ voltage of 555
580 	5.0 - 1.7,	// High output voltage of 555 (Usually v555 - 1.7)
581 	5.0 * 2.0 /3.0,	// normally 2/3 of v555
582 	5.0 / 3.0	// normally 1/3 of v555
583 };
584 
585 const struct discrete_lfsr_desc atarifb_lfsr =
586 {
587 	16,			/* Bit Length */
588 	0,			/* Reset Value */
589 	0,			/* Use Bit 0 as XOR input 0 */
590 	14,			/* Use Bit 14 as XOR input 1 */
591 	DISC_LFSR_XNOR,		/* Feedback stage1 is XNOR */
592 	DISC_LFSR_OR,		/* Feedback stage2 is just stage 1 output OR with external feed */
593 	DISC_LFSR_REPLACE,	/* Feedback stage3 replaces the shifted register contents */
594 	0x000001,		/* Everything is shifted into the first bit only */
595 	0,			/* Output is already inverted by XNOR */
596 	16			/* Output bit is feedback bit */
597 };
598 
599 /* Nodes - Inputs */
600 #define ATARIFB_WHISTLE_EN		NODE_01
601 #define ATARIFB_CROWD_DATA		NODE_02
602 #define ATARIFB_ATTRACT_EN		NODE_03
603 #define ATARIFB_NOISE_EN		NODE_04
604 #define ATARIFB_HIT_EN			NODE_05
605 /* Nodes - Sounds */
606 #define ATARIFB_NOISE			NODE_10
607 #define ATARIFB_HIT_SND			NODE_11
608 #define ATARIFB_WHISTLE_SND		NODE_12
609 #define ATARIFB_CROWD_SND		NODE_13
610 
611 static DISCRETE_SOUND_START(atarifb_sound_interface)
612 	/************************************************/
613 	/* atarifb  Effects Relataive Gain Table        */
614 	/*                                              */
615 	/* Effect       V-ampIn   Gain ratio  Relative  */
616 	/* Hit           3.8      47/47         760.0   */
617 	/* Whistle       5.0      47/47        1000.0   */
618 	/* Crowd         3.8      47/220        162.4   */
619 	/************************************************/
620 
621 	/************************************************/
622 	/* Input register mapping for atarifb           */
623 	/************************************************/
624 	/*              NODE                 ADDR  MASK    GAIN     OFFSET  INIT */
625 	DISCRETE_INPUT (ATARIFB_WHISTLE_EN,  0x00, 0x000f,                  0.0)
626 	DISCRETE_INPUTX(ATARIFB_CROWD_DATA,  0x01, 0x000f, 162.4/15, 0,     0.0)
627 	DISCRETE_INPUTX(ATARIFB_HIT_EN,      0x02, 0x000f, 760.0/2,  0,     0.0)
628 	DISCRETE_INPUT (ATARIFB_ATTRACT_EN,  0x03, 0x000f,                  0.0)
629 	DISCRETE_INPUT (ATARIFB_NOISE_EN,    0x04, 0x000f,                  0.0)
630 
631 	/************************************************/
632 	/* Hit is a trigger fed directly to the amp     */
633 	/************************************************/
634 	DISCRETE_FILTER2(ATARIFB_HIT_SND, 1, ATARIFB_HIT_EN, 10.0, 5, DISC_FILTER_HIGHPASS)	// remove DC
635 
636 	/************************************************/
637 	/* Crowd effect is variable amplitude, filtered */
638 	/* random noise.                                */
639 	/* LFSR clk = 256H = 15750.0Hz                  */
640 	/************************************************/
641 	DISCRETE_LFSR_NOISE(ATARIFB_NOISE, ATARIFB_NOISE_EN, ATARIFB_NOISE_EN, 15750.0, ATARIFB_CROWD_DATA, 0, 0, &atarifb_lfsr)
642 	DISCRETE_FILTER2(ATARIFB_CROWD_SND, 1, ATARIFB_NOISE, 330.0, (1.0 / 7.6), DISC_FILTER_BANDPASS)
643 
644 	/************************************************/
645 	/* Whistle effect is a triggered 555 cap charge */
646 	/************************************************/
647 	DISCRETE_555_ASTABLE(NODE_20, ATARIFB_WHISTLE_EN, 2200, 2200, 1e-7, NODE_NC, &atarifbWhistl555)
648 	DISCRETE_MULTIPLY(ATARIFB_WHISTLE_SND, ATARIFB_WHISTLE_EN, NODE_20, 1000.0/3.3)
649 
DISCRETE_ADDER3(NODE_90,ATARIFB_ATTRACT_EN,ATARIFB_HIT_SND,ATARIFB_WHISTLE_SND,ATARIFB_CROWD_SND)650 	DISCRETE_ADDER3(NODE_90, ATARIFB_ATTRACT_EN, ATARIFB_HIT_SND, ATARIFB_WHISTLE_SND, ATARIFB_CROWD_SND)
651 	DISCRETE_GAIN(NODE_91, NODE_90, 65534.0/(506.7+1000.0+760.0))
652 	DISCRETE_OUTPUT(NODE_91, 100)
653 DISCRETE_SOUND_END
654 
655 
656 /************************************************************************/
657 /* abaseb Sound System Analog emulation                                 */
658 /************************************************************************/
659 /* Sounds indentical to atarifb, but gain values are different          */
660 
661 /* Nodes - Inputs */
662 #define ABASEB_WHISTLE_EN		NODE_01
663 #define ABASEB_CROWD_DATA		NODE_02
664 #define ABASEB_ATTRACT_EN		NODE_03
665 #define ABASEB_NOISE_EN			NODE_04
666 #define ABASEB_HIT_EN			NODE_05
667 /* Nodes - Sounds */
668 #define ABASEB_NOISE			NODE_10
669 #define ABASEB_HIT_SND			NODE_11
670 #define ABASEB_WHISTLE_SND		NODE_12
671 #define ABASEB_CROWD_SND		NODE_13
672 
673 static DISCRETE_SOUND_START(abaseb_sound_interface)
674 	/************************************************/
675 	/* abaseb  Effects Relataive Gain Table         */
676 	/*                                              */
677 	/* Effect       V-ampIn   Gain ratio  Relative  */
678 	/* Hit           3.8      47/330        506.7   */
679 	/* Whistle       5.0      47/220       1000.0   */
680 	/* Crowd         3.8      47/220        760.0   */
681 	/************************************************/
682 
683 	/************************************************/
684 	/* Input register mapping for abaseb            */
685 	/************************************************/
686 	/*              NODE                 ADDR  MASK    GAIN     OFFSET  INIT */
687 	DISCRETE_INPUT (ABASEB_WHISTLE_EN,   0x00, 0x000f,                  0.0)
688 	DISCRETE_INPUTX(ABASEB_CROWD_DATA,   0x01, 0x000f, 760.0/15, 0,     0.0)
689 	DISCRETE_INPUTX(ABASEB_HIT_EN,       0x02, 0x000f, 506.7/2,  0,     0.0)
690 	DISCRETE_INPUT (ABASEB_ATTRACT_EN,   0x03, 0x000f,                  0.0)
691 	DISCRETE_INPUT (ABASEB_NOISE_EN,     0x04, 0x000f,                  0.0)
692 
693 	/************************************************/
694 	/* Hit is a trigger fed directly to the amp     */
695 	/************************************************/
696 	DISCRETE_FILTER2(ABASEB_HIT_SND, 1, ABASEB_HIT_EN, 10.0, 5, DISC_FILTER_HIGHPASS)	// remove DC
697 
698 	/************************************************/
699 	/* Crowd effect is variable amplitude, filtered */
700 	/* random noise.                                */
701 	/* LFSR clk = 256H = 15750.0Hz                  */
702 	/************************************************/
703 	DISCRETE_LFSR_NOISE(ABASEB_NOISE, ABASEB_NOISE_EN, ABASEB_NOISE_EN, 15750.0, ABASEB_CROWD_DATA, 0, 0, &atarifb_lfsr)
704 	DISCRETE_FILTER2(ABASEB_CROWD_SND, 1, ABASEB_NOISE, 330.0, (1.0 / 7.6), DISC_FILTER_BANDPASS)
705 
706 	/************************************************/
707 	/* Whistle effect is a triggered 555 cap charge */
708 	/************************************************/
709 	DISCRETE_555_ASTABLE(NODE_20, ABASEB_WHISTLE_EN, 2200, 2200, 1e-7, NODE_NC, &atarifbWhistl555)
710 	DISCRETE_MULTIPLY(ATARIFB_WHISTLE_SND, ABASEB_WHISTLE_EN, NODE_20, 1000.0/5)
711 
712 	DISCRETE_ADDER3(NODE_90, ABASEB_ATTRACT_EN, ABASEB_HIT_SND, ABASEB_WHISTLE_SND, ABASEB_CROWD_SND)
713 	DISCRETE_GAIN(NODE_91, NODE_90, 65534.0/(506.7+1000.0+760.0))
714 	DISCRETE_OUTPUT(NODE_91, 100)
715 DISCRETE_SOUND_END
716 
717 
718 
719 /*************************************
720  *
721  *	Machine drivers
722  *
723  *************************************/
724 
725 static MACHINE_DRIVER_START( atarifb )
726 
727 	/* basic machine hardware */
728 	MDRV_CPU_ADD_TAG("main", M6502, 750000)
729 	MDRV_CPU_MEMORY(readmem,writemem)
730 	MDRV_CPU_VBLANK_INT(irq0_line_hold,4)
731 
732 	MDRV_FRAMES_PER_SECOND(60)
733 	MDRV_VBLANK_DURATION(2037)	/* 16.3ms * 1/8 = 2037.5. Is it 1/8th or 3/32nds? (1528?) */
734 
735 	/* video hardware */
736 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
737 	MDRV_SCREEN_SIZE(38*8, 32*8)
738 	MDRV_VISIBLE_AREA(0*8, 38*8-1, 0*8, 31*8-1)
739 	MDRV_GFXDECODE(gfxdecodeinfo)
740 	MDRV_PALETTE_LENGTH(4)
741 	MDRV_COLORTABLE_LENGTH(sizeof(colortable_source) / sizeof(colortable_source[0]))
742 
743 	MDRV_PALETTE_INIT(atarifb)
744 	MDRV_VIDEO_START(atarifb)
745 	MDRV_VIDEO_UPDATE(atarifb)
746 
747 	/* sound hardware */
748 	MDRV_SOUND_ADD_TAG("discrete", DISCRETE, atarifb_sound_interface)
749 MACHINE_DRIVER_END
750 
751 
752 static MACHINE_DRIVER_START( atarifb4 )
753 
754 	/* basic machine hardware */
755 	MDRV_IMPORT_FROM(atarifb)
756 	MDRV_CPU_MODIFY("main")
757 	MDRV_CPU_MEMORY(atarifb4_readmem,atarifb4_writemem)
758 
759 	MDRV_VISIBLE_AREA(0*8, 38*8-1, 0*8, 32*8-1)
760 MACHINE_DRIVER_END
761 
762 
763 static MACHINE_DRIVER_START( abaseb )
764 
765 	/* basic machine hardware */
766 	MDRV_IMPORT_FROM(atarifb)
767 
768 	/* sound hardware */
769 	MDRV_SOUND_REPLACE("discrete", DISCRETE, abaseb_sound_interface)
770 MACHINE_DRIVER_END
771 
772 
773 static MACHINE_DRIVER_START( soccer )
774 
775 	/* basic machine hardware */
776 	MDRV_IMPORT_FROM(atarifb)
777 	MDRV_CPU_MODIFY("main")
778 	MDRV_CPU_MEMORY(soccer_readmem,soccer_writemem)
779 
780 	/* video hardware */
781 	MDRV_VISIBLE_AREA(0*8, 38*8-1, 2*8, 32*8-1)
782 	MDRV_GFXDECODE(soccer_gfxdecodeinfo)
783 MACHINE_DRIVER_END
784 
785 
786 
787 /*************************************
788  *
789  *	ROM definitions
790  *
791  *************************************/
792 
793 ROM_START( atarifb )
794 	ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* 64k for code */
795 	ROM_LOAD( "03302602.m1", 0x6800, 0x0800, CRC(352e35db) SHA1(ae3f1bdb274858edf203dbffe4ba2912c065cff2) )
796 	ROM_LOAD( "03302801.p1", 0x7000, 0x0800, CRC(a79c79ca) SHA1(7791b431e9aadb09fd286ae56699c4beda54830a) )
797 	ROM_LOAD( "03302702.n1", 0x7800, 0x0800, CRC(e7e916ae) SHA1(d3a188809e83c311699cb103040c4525b36a56e3) )
798 	ROM_RELOAD( 			    0xf800, 0x0800 )
799 
800 	ROM_REGION( 0x0400, REGION_GFX1, ROMREGION_DISPOSE )
801 	ROM_LOAD_NIB_LOW ( "033029.n7", 0x0000, 0x0400, CRC(12f43dca) SHA1(a463f5068d5522ddf74052429aa6da23e5475844) )
802 
803 	ROM_REGION( 0x0200, REGION_GFX2, ROMREGION_DISPOSE )
804 	ROM_LOAD_NIB_LOW ( "033030.c5", 0x0000, 0x0200, CRC(eac9ef90) SHA1(0e6284392852695ab7323be82105d32f57ad00f1) )
805 	ROM_LOAD_NIB_HIGH( "033031.d5", 0x0000, 0x0200, CRC(89d619b8) SHA1(0af5d1f4e6f9a377dc2d49a8039866b1857af01f) )
806 ROM_END
807 
808 
809 ROM_START( atarifb1 )
810 	ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* 64k for code */
811 	ROM_LOAD( "03302601.m1", 0x6800, 0x0800, CRC(f8ce7ed8) SHA1(54520d7d31c6c8f9028b7253a33aba3b2c35ae7c) )
812 	ROM_LOAD( "03302801.p1", 0x7000, 0x0800, CRC(a79c79ca) SHA1(7791b431e9aadb09fd286ae56699c4beda54830a) )
813 	ROM_LOAD( "03302701.n1", 0x7800, 0x0800, CRC(7740be51) SHA1(3f610061f081eb5589b00a496877bc58f6e0f09f) )
814 	ROM_RELOAD( 			    0xf800, 0x0800 )
815 
816 	ROM_REGION( 0x0400, REGION_GFX1, ROMREGION_DISPOSE )
817 	ROM_LOAD_NIB_LOW ( "033029.n7", 0x0000, 0x0400, CRC(12f43dca) SHA1(a463f5068d5522ddf74052429aa6da23e5475844) )
818 
819 	ROM_REGION( 0x0200, REGION_GFX2, ROMREGION_DISPOSE )
820 	ROM_LOAD_NIB_LOW ( "033030.c5", 0x0000, 0x0200, CRC(eac9ef90) SHA1(0e6284392852695ab7323be82105d32f57ad00f1) )
821 	ROM_LOAD_NIB_HIGH( "033031.d5", 0x0000, 0x0200, CRC(89d619b8) SHA1(0af5d1f4e6f9a377dc2d49a8039866b1857af01f) )
822 ROM_END
823 
824 
825 ROM_START( atarifb4 )
826 	ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* 64k for code, the ROMs are nibble-wide */
827 	ROM_LOAD_NIB_LOW ( "34889.m1", 0x6000, 0x0400, CRC(5c63974a) SHA1(e91f318be80d985a09ff92f4db5792290a06dc0f) )
828 	ROM_LOAD_NIB_HIGH( "34891.m2", 0x6000, 0x0400, CRC(9d03baa1) SHA1(1b57f39fa4d43e3f3d22f2d9a5478b5f5e4d0cb1) )
829 	ROM_LOAD_NIB_LOW ( "34890.n1", 0x6400, 0x0400, CRC(2deb5844) SHA1(abc7cc80d5fcac13f50f6cc550ea7a8f322434c9) )
830 	ROM_LOAD_NIB_HIGH( "34892.n2", 0x6400, 0x0400, CRC(ad212d2d) SHA1(df77ed3d59b497d0f4fe7b275f1cce6c4a5aa0b2) )
831 	ROM_LOAD_NIB_LOW ( "34885.k1", 0x6800, 0x0400, CRC(fdd272a1) SHA1(619c7b1ced1e397a4aa5fcaf0afe84c2b39ba5fd) )
832 	ROM_LOAD_NIB_HIGH( "34887.k2", 0x6800, 0x0400, CRC(fa2b8b52) SHA1(aff26efcf70fe63819a80977853e8f58c17cb32b) )
833 	ROM_LOAD_NIB_LOW ( "34886.l1", 0x6c00, 0x0400, CRC(be912ccb) SHA1(6ed05d011a1fe06831883fdbdf7153b0ec624de9) )
834 	ROM_LOAD_NIB_HIGH( "34888.l2", 0x6c00, 0x0400, CRC(3f8e96c1) SHA1(c188eb39a00943d9eb62b8a70ad3bd108fc768e9) )
835 	ROM_LOAD_NIB_LOW ( "34877.e1", 0x7000, 0x0400, CRC(fd8832fa) SHA1(83f874d5c178846bdfb7609c2738c03e3369743b) )
836 	ROM_LOAD_NIB_HIGH( "34879.e2", 0x7000, 0x0400, CRC(7053ffbc) SHA1(cec5efb005833da448f67b9811719099d6980dcd) )
837 	ROM_LOAD_NIB_LOW ( "34878.f1", 0x7400, 0x0400, CRC(329eb720) SHA1(fa9e8c25c9e20fea72d1314297b77ffe599a5a74) )
838 	ROM_LOAD_NIB_HIGH( "34880.f2", 0x7400, 0x0400, CRC(e0c9b4c2) SHA1(1cc0900bb62c672a870fc465f5691039bb487571) )
839 	ROM_LOAD_NIB_LOW ( "34881.h1", 0x7800, 0x0400, CRC(d9055541) SHA1(ffbf86c5cc325587d89e17da0560518244d3d8e9) )
840 	ROM_LOAD_NIB_HIGH( "34883.h2", 0x7800, 0x0400, CRC(8a912448) SHA1(1756874964eedb75e066a4d6dccecf16a652f6bb) )
841 	ROM_LOAD_NIB_LOW ( "34882.j1", 0x7c00, 0x0400, CRC(060c9cdb) SHA1(3c6d04c535195dfa8f8405ff8e80f4693844d1a1) )
842 	ROM_RELOAD(                    0xfc00, 0x0400 ) /* for 6502 vectors */
843 	ROM_LOAD_NIB_HIGH( "34884.j2", 0x7c00, 0x0400, CRC(aa699a3a) SHA1(2c13eb9cda3fe9cfd348ef5cf309625f77c75056) )
844 	ROM_RELOAD(                    0xfc00, 0x0400 ) /* for 6502 vectors */
845 
846 	ROM_REGION( 0x0400, REGION_GFX1, ROMREGION_DISPOSE )
847 	ROM_LOAD_NIB_LOW ( "033029.n7", 0x0000, 0x0400, CRC(12f43dca) SHA1(a463f5068d5522ddf74052429aa6da23e5475844) )
848 
849 	ROM_REGION( 0x0200, REGION_GFX2, ROMREGION_DISPOSE )
850 	ROM_LOAD_NIB_LOW ( "033030.c5", 0x0000, 0x0200, CRC(eac9ef90) SHA1(0e6284392852695ab7323be82105d32f57ad00f1) )
851 	ROM_LOAD_NIB_HIGH( "033031.d5", 0x0000, 0x0200, CRC(89d619b8) SHA1(0af5d1f4e6f9a377dc2d49a8039866b1857af01f) )
852 ROM_END
853 
854 
855 ROM_START( abaseb )
856 	ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* 64k for code */
857 	ROM_LOAD( "34738-01.n0", 0x6000, 0x0800, CRC(edcfffe8) SHA1(a445668352da5039ed1a090bcdf2ce092215f165) )
858 	ROM_LOAD( "34737-03.m1", 0x6800, 0x0800, CRC(7250863f) SHA1(83ec735a60d74ca9c3e3f5d4b248071f3e3330af) )
859 	ROM_LOAD( "34735-01.p1", 0x7000, 0x0800, CRC(54854d7c) SHA1(536d57b00929bf9d1cd1b209b41004cb78e2cd93) )
860 	ROM_LOAD( "34736-01.n1", 0x7800, 0x0800, CRC(af444eb0) SHA1(783293426cec6938a2cd9c66c491f073cfb2683f) )
861 	ROM_RELOAD( 			 0xf800, 0x0800 )
862 
863 	ROM_REGION( 0x0400, REGION_GFX1, ROMREGION_DISPOSE )
864 	ROM_LOAD_NIB_LOW ( "034710.d5", 0x0000, 0x0400, CRC(31275d86) SHA1(465ff2032e62bcd5a7bb5c947212da4ea4d59353) )
865 
866 	ROM_REGION( 0x0200, REGION_GFX2, ROMREGION_DISPOSE )
867 	ROM_LOAD_NIB_LOW ( "034708.n7", 0x0000, 0x0200, CRC(8a0f971b) SHA1(f7de50eeb15c8291f1560e299e3b1b29bba58422) )
868 	ROM_LOAD_NIB_HIGH( "034709.c5", 0x0000, 0x0200, CRC(021d1067) SHA1(da0fa8e4f6c0240a4feb41312fa057c65d809e62) )
869 ROM_END
870 
871 
872 ROM_START( abaseb2 )
873 	ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* 64k for code, the ROMs are nibble-wide */
874 	ROM_LOAD_NIB_LOW ( "034725.c0", 0x6000, 0x0400, CRC(95912c58) SHA1(cb15b60e31ee212e30a81c170611be1e36d2a6dd) )
875 	ROM_LOAD_NIB_HIGH( "034723.m0", 0x6000, 0x0400, CRC(5eb1597f) SHA1(78f83d4e79de13d3723732d68738660c3f8d4787) )
876 	ROM_LOAD_NIB_LOW ( "034726.b0", 0x6400, 0x0400, CRC(1f8d506c) SHA1(875464ca2ee50b36ceb5989cd40a28c69953c641) )
877 	ROM_LOAD_NIB_HIGH( "034724.l0", 0x6400, 0x0400, CRC(ecd18ed2) SHA1(6ffbc9a4108ebf190455fad3725b72dda4125ac7) )
878 	ROM_LOAD_NIB_LOW ( "034721.d1", 0x6800, 0x0400, CRC(1a0541f2) SHA1(ba74f024deb173678166262c4c6b1c328248aa9a) )
879 	ROM_LOAD_NIB_HIGH( "034715.j1", 0x6800, 0x0400, CRC(accb96f5) SHA1(1cd6603c818dacf4f71fc350ebd3adf3369056b2) ) /* created from 8-bit set */
880 	ROM_LOAD_NIB_LOW ( "034722.d0", 0x6c00, 0x0400, CRC(f9c1174e) SHA1(9d1be9ce4985edd19e0969d8998946d05fbbdf1f) ) /* The code in these 2 differs */
881 	ROM_LOAD_NIB_HIGH( "034716.j0", 0x6c00, 0x0400, CRC(d5622749) SHA1(6a48d428751939857be6869b44a61b8f054d4206) ) /* from the 8-bit set */
882 	ROM_LOAD_NIB_LOW ( "034717.e1", 0x7000, 0x0400, CRC(c941f64b) SHA1(e4d309c8ae71adc42dab0ffeea8f58da310c52f3) )
883 	ROM_LOAD_NIB_HIGH( "034711.k1", 0x7000, 0x0400, CRC(fab61782) SHA1(01b6de2822d09ebe0725307eeeaeb667f53ca8f1) )
884 	ROM_LOAD_NIB_LOW ( "034718.e0", 0x7400, 0x0400, CRC(3fe7dc1c) SHA1(91c3af7d8acdb5c4275f5fa57c19dc589f4a63aa) )
885 	ROM_LOAD_NIB_HIGH( "034712.k0", 0x7400, 0x0400, CRC(0e368e1a) SHA1(29bbe4be07d8d441a4251ed6fbfa9e225487c2d8) )
886 	ROM_LOAD_NIB_LOW ( "034719.h1", 0x7800, 0x0400, CRC(85046ee5) SHA1(2e8559349460a44734c95a1440a84713c5344495) )
887 	ROM_LOAD_NIB_HIGH( "034713.f1", 0x7800, 0x0400, CRC(0c67c48d) SHA1(eec24da32632c1ba00aee22f1b9abb144b38cc8a) )
888 	ROM_LOAD_NIB_LOW ( "034720.h0", 0x7c00, 0x0400, CRC(37c5f149) SHA1(89ad4471b949f8318abbdb38c4f373f711130198) )
889 	ROM_RELOAD(                     0xfc00, 0x0400 ) /* for 6502 vectors */
890 	ROM_LOAD_NIB_HIGH( "034714.f0", 0x7c00, 0x0400, CRC(920979ea) SHA1(aba499376c084b8ceb6f0cc6599bd51cec133cc7) )
891 	ROM_RELOAD(                     0xfc00, 0x0400 ) /* for 6502 vectors */
892 
893 	ROM_REGION( 0x0400, REGION_GFX1, ROMREGION_DISPOSE )
894 	ROM_LOAD_NIB_LOW ( "034710.d5", 0x0000, 0x0400, CRC(31275d86) SHA1(465ff2032e62bcd5a7bb5c947212da4ea4d59353) )
895 
896 	ROM_REGION( 0x0200, REGION_GFX2, ROMREGION_DISPOSE )
897 	ROM_LOAD_NIB_LOW ( "034708.n7", 0x0000, 0x0200, CRC(8a0f971b) SHA1(f7de50eeb15c8291f1560e299e3b1b29bba58422) )
898 	ROM_LOAD_NIB_HIGH( "034709.c5", 0x0000, 0x0200, CRC(021d1067) SHA1(da0fa8e4f6c0240a4feb41312fa057c65d809e62) )
899 ROM_END
900 
901 
902 ROM_START( soccer )
903 	ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* 64k for code, the ROMs are nibble-wide */
904 	ROM_LOAD_NIB_LOW ( "035222.e1", 0x2000, 0x0400, CRC(03ec6bce) SHA1(f81f2ac3bab5f1ae687543427e0187ca51d3be7e) )
905 	ROM_LOAD_NIB_HIGH( "035224.e2", 0x2000, 0x0400, CRC(a1aeaa70) SHA1(2018318a0e652b1dbea7696ef3dc2b7f12ebd632) )
906 	ROM_LOAD_NIB_LOW ( "035223.f1", 0x2400, 0x0400, CRC(9c600726) SHA1(f652b42b93e43124b0363b52f0f13cb9154987e3) )
907 	ROM_LOAD_NIB_HIGH( "035225.f2", 0x2400, 0x0400, CRC(2aa06521) SHA1(c03b02f62346a8e395f8c4b15f6f89fd96b790a4) )
908 	ROM_LOAD_NIB_LOW ( "035226.h1", 0x2800, 0x0400, CRC(d57c0cfb) SHA1(9ce05d9b30e8014137e20e4b0bbe414a3b9fa600) )
909 	ROM_LOAD_NIB_HIGH( "035228.h2", 0x2800, 0x0400, CRC(594574cb) SHA1(c8b42a44520e6a2a3e8831e9f9002c3c532f5fca) )
910 	ROM_LOAD_NIB_LOW ( "035227.j1", 0x2c00, 0x0400, CRC(4112b257) SHA1(997f4681a5cd4ca12977c52133e847afe61c58e1) )
911 	ROM_LOAD_NIB_HIGH( "035229.j2", 0x2c00, 0x0400, CRC(412d129c) SHA1(2680af645aa6935114e59c657e49b131e48661fc) )
912 
913 	ROM_LOAD_NIB_LOW ( "035230.k1", 0x3000, 0x0400, CRC(747f6e4a) SHA1(b0cd8097e064ba6b0e22e97a7907bc287006aa8c) )
914 	ROM_LOAD_NIB_HIGH( "035232.k2", 0x3000, 0x0400, CRC(55f43e7f) SHA1(db44f658a521f859f11f9a638ba19e84bbb75d2d) )
915 	ROM_LOAD_NIB_LOW ( "035231.l1", 0x3400, 0x0400, CRC(d584c199) SHA1(55e86e4f1737bf02d5706f1e757d9c97007549ac) )
916 	ROM_LOAD_NIB_HIGH( "035233.l2", 0x3400, 0x0400, CRC(b343f500) SHA1(d15413759563bec2bc8f3fa28ae84e4ae902910b) )
917 	ROM_LOAD_NIB_LOW ( "035234.m1", 0x3800, 0x0400, CRC(83524bb7) SHA1(d45233b666463f789257c7366c3dfb4d9b55f87e) )
918 	ROM_LOAD_NIB_HIGH( "035236.m2", 0x3800, 0x0400, CRC(c53f4d13) SHA1(ebba48e50c98e7f74d19826cf559cf6633e24f3b) )
919 	ROM_LOAD_NIB_LOW ( "035235.n1", 0x3c00, 0x0400, CRC(d6855b0e) SHA1(379d010ebebde6f1b5fec5519a3c0aa4380be28b) )
920 	ROM_RELOAD(                     0xfc00, 0x0400 ) /* for 6502 vectors */
921 	ROM_LOAD_NIB_HIGH( "035237.n2", 0x3c00, 0x0400, CRC(1d01b054) SHA1(7f3dc1130b2aadb13813e223420672c5baf25ad8) )
922 	ROM_RELOAD(                     0xfc00, 0x0400 ) /* for 6502 vectors */
923 
924 	ROM_REGION( 0x0400, REGION_GFX1, ROMREGION_DISPOSE )
925 	ROM_LOAD_NIB_LOW ( "035250.r2", 0x0000, 0x0400, CRC(12f43dca) SHA1(a463f5068d5522ddf74052429aa6da23e5475844) ) /* characters */
926 
927 	ROM_REGION( 0x0800, REGION_GFX2, ROMREGION_DISPOSE )
928 	ROM_LOAD_NIB_LOW ( "035247.n7", 0x0000, 0x0400, CRC(3adb5f4e) SHA1(859df5dc97b06e0c06e4f71a511313aef1f08d87) ) /* sprites */
929 	ROM_LOAD_NIB_HIGH( "035248.m7", 0x0000, 0x0400, CRC(a890cd48) SHA1(34f52bc4b610491d3b81caae25ec3cafbc429373) )
930 
931 	ROM_REGION( 0x0800, REGION_GFX3, ROMREGION_DISPOSE )
932 	ROM_LOAD( "035246.r6", 0x0000, 0x0800, CRC(4a996136) SHA1(535b6d5f70ab5bc2a47263a1c16877ba4c82b3ff) ) /* spritemask - playfield */
933 ROM_END
934 
935 
936 
937 /*************************************
938  *
939  *	Driver initialization
940  *
941  *************************************/
942 
943 static DRIVER_INIT( atarifb )
944 {
945 	/* Tell the video code to draw the plays for this version */
946 	atarifb_game = 1;
947 }
948 
949 
DRIVER_INIT(atarifb4)950 static DRIVER_INIT( atarifb4 )
951 {
952 	/* Tell the video code to draw the plays for this version */
953 	atarifb_game = 2;
954 }
955 
956 
DRIVER_INIT(abaseb)957 static DRIVER_INIT( abaseb )
958 {
959 	/* Tell the video code to draw the plays for this version */
960 	atarifb_game = 3;
961 }
962 
963 
DRIVER_INIT(soccer)964 static DRIVER_INIT( soccer )
965 {
966 	/* Tell the video code to draw the plays for this version */
967 	atarifb_game = 4;
968 }
969 
970 
971 
972 /*************************************
973  *
974  *	Game drivers
975  *
976  *************************************/
977 
978 /*    YEAR  NAME      PARENT   MACHINE   INPUT     INIT      MONITOR  */
979 GAME( 1978, atarifb,  0,       atarifb,  atarifb,  atarifb,  ROT0, "Atari", "Atari Football (revision 2)" )
980 GAME( 1978, atarifb1, atarifb, atarifb,  atarifb,  atarifb,  ROT0, "Atari", "Atari Football (revision 1)" )
981 GAME( 1979, atarifb4, atarifb, atarifb4, atarifb4, atarifb4, ROT0, "Atari", "Atari Football (4 players)" )
982 GAME( 1979, abaseb,   0,       abaseb,   abaseb,   abaseb,   ROT0, "Atari", "Atari Baseball (set 1)" )
983 GAME( 1979, abaseb2,  abaseb,  abaseb,   abaseb,   abaseb,   ROT0, "Atari", "Atari Baseball (set 2)" )
984 GAME( 1980, soccer,   0,       soccer,   soccer,   soccer,   ROT0, "Atari", "Atari Soccer" )
985