1 #include "../vidhrdw/centiped.c"
2 
3 /***************************************************************************
4 
5 Main clock: XTAL = 12.096 MHz
6 6502 Clock: XTAL/8 = 1.512 MHz (0.756 when accessing playfield RAM)
7 Horizontal video frequency: HSYNC = XTAL/256/3 = 15.75 kHz
8 Video frequency: VSYNC = HSYNC/263 ?? = 59.88593 Hz (not sure, could be /262)
9 VBlank duration: 1/VSYNC * (23/263) = 1460 us
10 
11 
12               Centipede Memory map and Dip Switches
13               -------------------------------------
14 
15 Memory map for Centipede directly from the Atari schematics (1981).
16 
17  Address  R/W  D7 D6 D5 D4 D3 D2 D1 D0   Function
18 --------------------------------------------------------------------------------------
19 0000-03FF       D  D  D  D  D  D  D  D   RAM
20 --------------------------------------------------------------------------------------
21 0400-07BF       D  D  D  D  D  D  D  D   Playfield RAM
22 07C0-07CF       D  D  D  D  D  D  D  D   Motion Object Picture
23 07D0-07DF       D  D  D  D  D  D  D  D   Motion Object Vert.
24 07E0-07EF       D  D  D  D  D  D  D  D   Motion Object Horiz.
25 07F0-07FF             D  D  D  D  D  D   Motion Object Color
26 --------------------------------------------------------------------------------------
27 0800       R    D  D  D  D  D  D  D  D   Option Switch 1 (0 = On)
28 0801       R    D  D  D  D  D  D  D  D   Option Switch 2 (0 = On)
29 --------------------------------------------------------------------------------------
30 0C00       R    D           D  D  D  D   Horizontal Mini-Track Ball tm Inputs
31            R       D                     VBLANK  (1 = VBlank)
32            R          D                  Self-Test  (0 = On)
33            R             D               Cocktail Cabinet  (1 = Cocktail)
34 0C01       R    D  D  D                  R,C,L Coin Switches (0 = On)
35            R             D               SLAM  (0 = On)
36            R                D            Player 2 Fire Switch (0 = On)
37            R                   D         Player 1 Fire Switch (0 = On)
38            R                      D      Player 2 Start Switch (0 = On)
39            R                         D   Player 1 Start Switch (0 = On)
40 
41 0C02       R    D           D  D  D  D   Vertical Mini-Track Ball tm Inputs
42 0C03       R    D  D  D  D               Player 1 Joystick (R,L,Down,Up)
43            R                D  D  D  D   Player 2 Joystick   (0 = On)
44 --------------------------------------------------------------------------------------
45 1000-100F R/W   D  D  D  D  D  D  D  D   Custom Audio Chip
46 1404       W                D  D  D  D   Playfield Color RAM
47 140C       W                D  D  D  D   Motion Object Color RAM
48 --------------------------------------------------------------------------------------
49 1600       W    D  D  D  D  D  D  D  D   EA ROM Address & Data Latch
50 1680       W                D  D  D  D   EA ROM Control Latch
51 1700       R    D  D  D  D  D  D  D  D   EA ROM Read Data
52 --------------------------------------------------------------------------------------
53 1800       W                             IRQ Acknowledge
54 --------------------------------------------------------------------------------------
55 1C00       W    D                        Left Coin Counter (1 = On)
56 1C01       W    D                        Center Coin Counter (1 = On)
57 1C02       W    D                        Right Coin Counter (1 = On)
58 1C03       W    D                        Player 1 Start LED (0 = On)
59 1C04       W    D                        Player 2 Start LED (0 = On)
60 1C07       W    D                        Track Ball Flip Control (0 = Player 1)
61 --------------------------------------------------------------------------------------
62 2000       W                             WATCHDOG
63 2400       W                             Clear Mini-Track Ball Counters
64 --------------------------------------------------------------------------------------
65 2000-3FFF  R                             Program ROM
66 --------------------------------------------------------------------------------------
67 
68 -EA ROM is an Erasable Reprogrammable rom to save the top 3 high scores
69   and other stuff.
70 
71 
72  Dip switches at N9 on the PCB
73 
74  8    7    6    5    4    3    2    1    Option
75 -------------------------------------------------------------------------------------
76                               On   On    English $
77                               On   Off   German
78                               Off  On    French
79                               Off  Off   Spanish
80 -------------------------------------------------------------------------------------
81                     On   On              2 lives per game
82                     On   Off             3 lives per game $
83                     Off  On              4 lives per game
84                     Off  Off             5 lives per game
85 -------------------------------------------------------------------------------------
86                                          Bonus life granted at every:
87           On   On                        10,000 points
88           On   Off                       12.000 points $
89           Off  On                        15,000 points
90           Off  Off                       20,000 points
91 -------------------------------------------------------------------------------------
92      On                                  Hard game difficulty
93      Off                                 Easy game difficulty $
94 -------------------------------------------------------------------------------------
95 On                                       1-credit minimum $
96 Off                                      2-credit minimum
97 -------------------------------------------------------------------------------------
98 
99 $ = Manufacturer's suggested settings
100 
101 
102  Dip switches at N8 on the PCB
103 
104  8    7    6    5    4    3    2    1    Option
105 -------------------------------------------------------------------------------------
106                               On   On    Free play
107                               On   Off   1 coin for 2 credits
108                               Off  On    1 coin for 1 credit $
109                               Off  Off   2 coins for 1 credit
110 -------------------------------------------------------------------------------------
111                     On   On              Right coin mech X 1 $
112                     On   Off             Right coin mech X 4
113                     Off  On              Right coin mech X 5
114                     Off  Off             Right coin mech X 6
115 -------------------------------------------------------------------------------------
116                On                        Left coin mech X 1 $
117                Off                       Left coin mech X 2
118 -------------------------------------------------------------------------------------
119 On   On   On                             No bonus coins $
120 On   On   Off                            For every 2 coins inserted, game logic
121                                           adds 1 more coin
122 On   Off  On                             For every 4 coins inserted, game logic
123                                           adds 1 more coin
124 On   Off  Off                            For every 4 coins inserted, game logic
125                                           adds 2 more coin
126 Off  On   On                             For every 5 coins inserted, game logic
127                                           adds 1 more coin
128 Off  On   Off                            For every 3 coins inserted, game logic
129                                           adds 1 more coin
130 -------------------------------------------------------------------------------------
131 $ = Manufacturer's suggested settings
132 
133 Changes:
134 	30 Apr 98 LBO
135 	* Fixed test mode
136 	* Changed high score to use earom routines
137 	* Added support for alternate rom set
138 
139 Known issues:
140 
141 * Are coins supposed to take over a second to register?
142 * Need to confirm CPU and Pokey clocks
143 
144 ***************************************************************************/
145 
146 #include "driver.h"
147 #include "vidhrdw/generic.h"
148 #include "machine/atari_vg.h"
149 
150 
151 WRITE_HANDLER( centiped_paletteram_w );
152 void centiped_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
153 
154 void centiped_init_machine(void);	/* in vidhrdw */
155 int centiped_interrupt(void);	/* in vidhrdw */
156 
157 
158 /*
159  * This wrapper routine is necessary because Centipede requires a direction bit
160  * to be set or cleared. The direction bit is held until the mouse is moved
161  * again.
162  *
163  * There is a 4-bit counter, and two inputs from the trackball: DIR and CLOCK.
164  * CLOCK makes the counter move in the direction of DIR. Since DIR is latched
165  * only when a CLOCK arrives, the DIR bit in the input port doesn't change
166  * until the trackball actually moves.
167  *
168  * There is also a CLR input to the counter which could be used by the game to
169  * clear the counter, but Centipede doesn't use it (though it would be a good
170  * idea to support it anyway).
171  *
172  * The counter is read 240 times per second. There is no provision whatsoever
173  * to prevent the counter from wrapping around between reads.
174  */
READ_HANDLER(centiped_IN0_r)175 static READ_HANDLER( centiped_IN0_r )
176 {
177 	static int oldpos,sign;
178 	int newpos;
179 
180 	newpos = readinputport(6);
181 	if (newpos != oldpos)
182 	{
183 		sign = (newpos - oldpos) & 0x80;
184 		oldpos = newpos;
185 	}
186 
187 	return ((readinputport(0) & 0x70) | (oldpos & 0x0f) | sign );
188 }
189 
READ_HANDLER(centiped_IN2_r)190 static READ_HANDLER( centiped_IN2_r )
191 {
192 	static int oldpos,sign;
193 	int newpos;
194 
195 	newpos = readinputport(2);
196 	if (newpos != oldpos)
197 	{
198 		sign = (newpos - oldpos) & 0x80;
199 		oldpos = newpos;
200 	}
201 
202 	return ((oldpos & 0x0f) | sign );
203 }
204 
205 
WRITE_HANDLER(centiped_led_w)206 static WRITE_HANDLER( centiped_led_w )
207 {
208 	osd_led_w(offset,~data >> 7);
209 }
210 
READ_HANDLER(centipdb_rand_r)211 static READ_HANDLER( centipdb_rand_r )
212 {
213 	return rand() % 0xff;
214 }
215 
WRITE_HANDLER(centipdb_AY8910_w)216 static WRITE_HANDLER( centipdb_AY8910_w )
217 {
218 	AY8910_control_port_0_w(0, offset);
219 	AY8910_write_port_0_w(0, data);
220 }
221 
READ_HANDLER(centipdb_AY8910_r)222 static READ_HANDLER( centipdb_AY8910_r )
223 {
224 	AY8910_control_port_0_w(0, offset);
225 	return AY8910_read_port_0_r(0);
226 }
227 
228 static struct MemoryReadAddress centiped_readmem[] =
229 {
230 	{ 0x0000, 0x03ff, MRA_RAM },
231 	{ 0x0400, 0x07ff, MRA_RAM },
232 	{ 0x0800, 0x0800, input_port_4_r },	/* DSW1 */
233 	{ 0x0801, 0x0801, input_port_5_r },	/* DSW2 */
234 	{ 0x0c00, 0x0c00, centiped_IN0_r },	/* IN0 */
235 	{ 0x0c01, 0x0c01, input_port_1_r },	/* IN1 */
236 	{ 0x0c02, 0x0c02, centiped_IN2_r },	/* IN2 */	/* JB 971220 */
237 	{ 0x0c03, 0x0c03, input_port_3_r },	/* IN3 */
238 	{ 0x1000, 0x100f, pokey1_r },
239 	{ 0x1700, 0x173f, atari_vg_earom_r },
240 	{ 0x2000, 0x3fff, MRA_ROM },
241 	{ 0xf800, 0xffff, MRA_ROM },	/* for the reset / interrupt vectors */
242 	{ -1 }	/* end of table */
243 };
244 
245 /* Same as the regular one, except it uses an AY8910 and an external RNG */
246 static struct MemoryReadAddress centipdb_readmem[] =
247 {
248 	{ 0x0000, 0x03ff, MRA_RAM },
249 	{ 0x0400, 0x07ff, MRA_RAM },
250 	{ 0x0800, 0x0800, input_port_4_r },	/* DSW1 */
251 	{ 0x0801, 0x0801, input_port_5_r },	/* DSW2 */
252 	{ 0x0c00, 0x0c00, centiped_IN0_r },	/* IN0 */
253 	{ 0x0c01, 0x0c01, input_port_1_r },	/* IN1 */
254 	{ 0x0c02, 0x0c02, centiped_IN2_r },	/* IN2 */	/* JB 971220 */
255 	{ 0x0c03, 0x0c03, input_port_3_r },	/* IN3 */
256 	{ 0x1000, 0x100f, centipdb_AY8910_r },
257 	{ 0x1700, 0x173f, atari_vg_earom_r },
258 	{ 0x1780, 0x1780, centipdb_rand_r },
259 	{ 0x2000, 0x3fff, MRA_ROM },
260 	{ 0xf800, 0xffff, MRA_ROM },	/* for the reset / interrupt vectors */
261 	{ -1 }	/* end of table */
262 };
263 
264 static struct MemoryReadAddress centipb2_readmem[] =
265 {
266 	{ 0x0000, 0x03ff, MRA_RAM },
267 	{ 0x0400, 0x07ff, MRA_RAM },
268 	{ 0x0800, 0x0800, input_port_4_r },	/* DSW1 */
269 	{ 0x0801, 0x0801, input_port_5_r },	/* DSW2 */
270 	{ 0x0c00, 0x0c00, centiped_IN0_r },	/* IN0 */
271 	{ 0x0c01, 0x0c01, input_port_1_r },	/* IN1 */
272 	{ 0x0c02, 0x0c02, centiped_IN2_r },	/* IN2 */	/* JB 971220 */
273 	{ 0x0c03, 0x0c03, input_port_3_r },	/* IN3 */
274 	{ 0x1001, 0x1001, AY8910_read_port_0_r },
275 	{ 0x1700, 0x173f, atari_vg_earom_r },
276 	{ 0x2000, 0x3fff, MRA_ROM },
277 	{ 0x6000, 0x67ff, MRA_ROM },
278 	{ 0xf800, 0xffff, MRA_ROM },	/* for the reset / interrupt vectors */
279 	{ -1 }	/* end of table */
280 };
281 
282 static struct MemoryWriteAddress centiped_writemem[] =
283 {
284 	{ 0x0000, 0x03ff, MWA_RAM },
285 	{ 0x0400, 0x07bf, videoram_w, &videoram, &videoram_size },
286 	{ 0x07c0, 0x07ff, MWA_RAM, &spriteram },
287 	{ 0x1000, 0x100f, pokey1_w },
288 	{ 0x1400, 0x140f, centiped_paletteram_w, &paletteram },
289 	{ 0x1600, 0x163f, atari_vg_earom_w },
290 	{ 0x1680, 0x1680, atari_vg_earom_ctrl_w },
291 	{ 0x1800, 0x1800, MWA_NOP },	/* IRQ acknowldege */
292 	{ 0x1c00, 0x1c02, coin_counter_w },
293 	{ 0x1c03, 0x1c04, centiped_led_w },
294 	{ 0x1c07, 0x1c07, flip_screen_w },
295 	{ 0x2000, 0x2000, watchdog_reset_w },
296 	{ 0x2000, 0x3fff, MWA_ROM },
297 	{ -1 }	/* end of table */
298 };
299 
300 /* Same as the regular one, except it uses an AY8910 */
301 static struct MemoryWriteAddress centipdb_writemem[] =
302 {
303 	{ 0x0000, 0x03ff, MWA_RAM },
304 	{ 0x0400, 0x07bf, videoram_w, &videoram, &videoram_size },
305 	{ 0x07c0, 0x07ff, MWA_RAM, &spriteram },
306 	{ 0x1000, 0x100f, centipdb_AY8910_w },
307 	{ 0x1400, 0x140f, centiped_paletteram_w, &paletteram },
308 	{ 0x1600, 0x163f, atari_vg_earom_w },
309 	{ 0x1680, 0x1680, atari_vg_earom_ctrl_w },
310 	{ 0x1800, 0x1800, MWA_NOP },	/* IRQ acknowldege */
311 	{ 0x1c00, 0x1c02, coin_counter_w },
312 	{ 0x1c03, 0x1c04, centiped_led_w },
313 	{ 0x1c07, 0x1c07, flip_screen_w },
314 	{ 0x2000, 0x2000, watchdog_reset_w },
315 	{ 0x2000, 0x3fff, MWA_ROM },
316 	{ -1 }	/* end of table */
317 };
318 
319 static struct MemoryWriteAddress centipb2_writemem[] =
320 {
321 	{ 0x0000, 0x03ff, MWA_RAM },
322 	{ 0x0400, 0x07bf, videoram_w, &videoram, &videoram_size },
323 	{ 0x07c0, 0x07ff, MWA_RAM, &spriteram },
324 	{ 0x1000, 0x1000, AY8910_write_port_0_w },
325 	{ 0x1001, 0x1001, AY8910_control_port_0_w },
326 	{ 0x1400, 0x140f, centiped_paletteram_w, &paletteram },
327 	{ 0x1600, 0x163f, atari_vg_earom_w },
328 	{ 0x1680, 0x1680, atari_vg_earom_ctrl_w },
329 	{ 0x1800, 0x1800, MWA_NOP },	/* IRQ acknowldege */
330 	{ 0x1c00, 0x1c02, coin_counter_w },
331 	{ 0x1c03, 0x1c04, centiped_led_w },
332 	{ 0x1c07, 0x1c07, flip_screen_w },
333 	{ 0x2000, 0x2000, watchdog_reset_w },
334 	{ 0x2000, 0x3fff, MWA_ROM },
335 	{ 0x6000, 0x67ff, MWA_ROM },
336 	{ -1 }	/* end of table */
337 };
338 
339 
340 /* The input ports are identical for the real one and the bootleg one, except
341    that one of the languages is Italian in the bootleg one instead of Spanish */
342 
343 #define PORTS(GAMENAME, FOURTH_LANGUAGE)										\
344 																				\
345 INPUT_PORTS_START( GAMENAME )										\
346 	PORT_START	/* IN0 */														\
347 	/* The lower 4 bits and bit 7 are for trackball x input. */					\
348 	/* They are handled by fake input port 6 and a custom routine. */			\
349 	PORT_BIT ( 0x0f, IP_ACTIVE_HIGH, IPT_UNKNOWN )								\
350 	PORT_DIPNAME(0x10, 0x00, DEF_STR( Cabinet ) )								\
351 	PORT_DIPSETTING (   0x00, DEF_STR( Upright ) )								\
352 	PORT_DIPSETTING (   0x10, DEF_STR( Cocktail ) )								\
353 	PORT_SERVICE( 0x20, IP_ACTIVE_LOW )											\
354 	PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_VBLANK )								\
355 	PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )								\
356 																				\
357 	PORT_START	/* IN1 */														\
358 	PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_START1 )								\
359 	PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_START2 )								\
360 	PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 )								\
361 	PORT_BIT ( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )					\
362 	PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_TILT )									\
363 	PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )									\
364 	PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )									\
365 	PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_COIN3 )									\
366 																				\
367 	PORT_START	/* IN2 */														\
368 	PORT_ANALOGX( 0xff, 0x00, IPT_TRACKBALL_Y, 50, 10, 0, 0, IP_KEY_NONE, IP_KEY_NONE, IP_JOY_NONE, IP_JOY_NONE )  \
369 	/* The lower 4 bits are the input, and bit 7 is the direction. */			\
370 	/* The state of bit 7 does not change if the trackball is not moved.*/		\
371 																				\
372 	PORT_START	/* IN3 */														\
373 	PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )	\
374 	PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )		\
375 	PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )	\
376 	PORT_BIT ( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )	\
377 	PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )				\
378 	PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )				\
379 	PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )				\
380 	PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )				\
381 																				\
382 	PORT_START	/* IN4 */														\
383 	PORT_DIPNAME(0x03, 0x00, "Language" )										\
384 	PORT_DIPSETTING (   0x00, "English" )										\
385 	PORT_DIPSETTING (   0x01, "German" )										\
386 	PORT_DIPSETTING (   0x02, "French" )										\
387 	PORT_DIPSETTING (   0x03, FOURTH_LANGUAGE )									\
388 	PORT_DIPNAME(0x0c, 0x04, DEF_STR( Lives ) )									\
389 	PORT_DIPSETTING (   0x00, "2" )												\
390 	PORT_DIPSETTING (   0x04, "3" )												\
391 	PORT_DIPSETTING (   0x08, "4" )												\
392 	PORT_DIPSETTING (   0x0c, "5" )												\
393 	PORT_DIPNAME(0x30, 0x10, DEF_STR( Bonus_Life ) )							\
394 	PORT_DIPSETTING (   0x00, "10000" )											\
395 	PORT_DIPSETTING (   0x10, "12000" )											\
396 	PORT_DIPSETTING (   0x20, "15000" )											\
397 	PORT_DIPSETTING (   0x30, "20000" )											\
398 	PORT_DIPNAME(0x40, 0x40, DEF_STR( Difficulty ) )							\
399 	PORT_DIPSETTING (   0x40, "Easy" )											\
400 	PORT_DIPSETTING (   0x00, "Hard" )											\
401 	PORT_DIPNAME(0x80, 0x00, "Credit Minimum" )									\
402 	PORT_DIPSETTING (   0x00, "1" )												\
403 	PORT_DIPSETTING (   0x80, "2" )												\
404 																				\
405 	PORT_START	/* IN5 */														\
406 	PORT_DIPNAME(0x03, 0x02, DEF_STR( Coinage ) )								\
407 	PORT_DIPSETTING (   0x03, DEF_STR( 2C_1C ) )								\
408 	PORT_DIPSETTING (   0x02, DEF_STR( 1C_1C ) )								\
409 	PORT_DIPSETTING (   0x01, DEF_STR( 1C_2C ) )								\
410 	PORT_DIPSETTING (   0x00, DEF_STR( Free_Play ) )							\
411 	PORT_DIPNAME(0x0c, 0x00, "Right Coin" )										\
412 	PORT_DIPSETTING (   0x00, "*1" )											\
413 	PORT_DIPSETTING (   0x04, "*4" )											\
414 	PORT_DIPSETTING (   0x08, "*5" )											\
415 	PORT_DIPSETTING (   0x0c, "*6" )											\
416 	PORT_DIPNAME(0x10, 0x00, "Left Coin" )										\
417 	PORT_DIPSETTING (   0x00, "*1" )											\
418 	PORT_DIPSETTING (   0x10, "*2" )											\
419 	PORT_DIPNAME(0xe0, 0x00, "Bonus Coins" )									\
420 	PORT_DIPSETTING (   0x00, "None" )											\
421 	PORT_DIPSETTING (   0x20, "3 credits/2 coins" )								\
422 	PORT_DIPSETTING (   0x40, "5 credits/4 coins" )								\
423 	PORT_DIPSETTING (   0x60, "6 credits/4 coins" )								\
424 	PORT_DIPSETTING (   0x80, "6 credits/5 coins" )								\
425 	PORT_DIPSETTING (   0xa0, "4 credits/3 coins" )								\
426 																				\
427 	PORT_START	/* IN6, fake trackball input port. */							\
428 	PORT_ANALOGX( 0xff, 0x00, IPT_TRACKBALL_X | IPF_REVERSE, 50, 10, 0, 0, IP_KEY_NONE, IP_KEY_NONE, IP_JOY_NONE, IP_JOY_NONE )	\
429 INPUT_PORTS_END
430 
431 PORTS(centiped, "Spanish")
432 PORTS(centipdb, "Italian")
433 
434 
435 static struct GfxLayout charlayout =
436 {
437 	8,8,	/* 8*8 characters */
438 	256,	/* 256 characters */
439 	2,	/* 2 bits per pixel */
440 	{ 256*8*8, 0 },	/* the two bitplanes are separated */
441 	{ 0, 1, 2, 3, 4, 5, 6, 7 },
442 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
443 	8*8	/* every char takes 8 consecutive bytes */
444 };
445 static struct GfxLayout spritelayout =
446 {
447 	8,16,	/* 16*8 sprites */
448 	128,	/* 64 sprites */
449 	2,	/* 2 bits per pixel */
450 	{ 128*16*8, 0 },	/* the two bitplanes are separated */
451 	{ 0, 1, 2, 3, 4, 5, 6, 7 },
452 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
453 			8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
454 	16*8	/* every sprite takes 16 consecutive bytes */
455 };
456 
457 
458 
459 static struct GfxDecodeInfo gfxdecodeinfo[] =
460 {
461 	{ REGION_GFX1, 0, &charlayout,   4, 4 },	/* 4 color codes to support midframe */
462 												/* palette changes in test mode */
463 	{ REGION_GFX1, 0, &spritelayout, 0, 1 },
464 	{ -1 } /* end of array */
465 };
466 
467 
468 
469 static struct POKEYinterface pokey_interface =
470 {
471 	1,	/* 1 chip */
472 	12096000/8,	/* 1.512 MHz */
473 	{ 100 },
474 	/* The 8 pot handlers */
475 	{ 0 },
476 	{ 0 },
477 	{ 0 },
478 	{ 0 },
479 	{ 0 },
480 	{ 0 },
481 	{ 0 },
482 	{ 0 },
483 	/* The allpot handler */
484 	{ 0 },
485 };
486 
487 static struct AY8910interface centipdb_ay8910_interface =
488 {
489 	1,	/* 1 chips */
490 	12096000/8,	/* 1.512 MHz */
491 	{ 50 },
492 	{ 0 },
493 	{ 0 },
494 	{ 0 },
495 	{ 0 }
496 };
497 
498 static struct AY8910interface centipb2_ay8910_interface =
499 {
500 	1,	/* 1 chips */
501 	12096000/8,	/* 1.512 MHz */
502 	{ 50 },
503 	{ centipdb_rand_r },
504 	{ 0 },
505 	{ 0 },
506 	{ 0 }
507 };
508 
509 
510 #define DRIVER(GAMENAME, SOUND_TYPE, SOUND_INTERFACE)							\
511 																				\
512 static struct MachineDriver machine_driver_##GAMENAME =							\
513 {																				\
514 	/* basic machine hardware */												\
515 	{																			\
516 		{																		\
517 			CPU_M6502,															\
518 			12096000/8,	/* 1.512 Mhz (slows down to 0.75MHz while accessing playfield RAM) */	\
519 			GAMENAME##_readmem,GAMENAME##_writemem,0,0,							\
520 			centiped_interrupt,4												\
521 		}																		\
522 	},																			\
523 	60, 1460,	/* frames per second, vblank duration */						\
524 	1,	/* single CPU, no need for interleaving */								\
525 	centiped_init_machine,														\
526 																				\
527 	/* video hardware */														\
528 	32*8, 32*8, { 0*8, 32*8-1, 0*8, 30*8-1 },									\
529 	gfxdecodeinfo,																\
530 	4+4*4, 4+4*4,																\
531 	0,																			\
532 																				\
533 	VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY|VIDEO_MODIFIES_PALETTE,				\
534 	0,																			\
535 	generic_vh_start,															\
536 	generic_vh_stop,															\
537 	centiped_vh_screenrefresh,													\
538 																				\
539 	/* sound hardware */														\
540 	0,0,0,0,																	\
541 	{																			\
542 		{																		\
543 			SOUND_TYPE,															\
544 			SOUND_INTERFACE,													\
545 		}																		\
546 	},																			\
547 																				\
548 	atari_vg_earom_handler														\
549 };
550 
551 
552 DRIVER(centiped, SOUND_POKEY, &pokey_interface)
553 
554 /* In the bootlegs the Pokey has been replaced by an AY8910 */
555 DRIVER(centipdb, SOUND_AY8910, &centipdb_ay8910_interface)
556 DRIVER(centipb2, SOUND_AY8910, &centipb2_ay8910_interface)
557 
558 
559 /***************************************************************************
560 
561   Game driver(s)
562 
563 ***************************************************************************/
564 
565 ROM_START( centiped )
566 	ROM_REGION( 0x10000, REGION_CPU1 )	/* 64k for code */
567 	ROM_LOAD( "centiped.307", 0x2000, 0x0800, 0x5ab0d9de )
568 	ROM_LOAD( "centiped.308", 0x2800, 0x0800, 0x4c07fd3e )
569 	ROM_LOAD( "centiped.309", 0x3000, 0x0800, 0xff69b424 )
570 	ROM_LOAD( "centiped.310", 0x3800, 0x0800, 0x44e40fa4 )
571 	ROM_RELOAD(               0xf800, 0x0800 )	/* for the reset and interrupt vectors */
572 
573 	ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
574 	ROM_LOAD( "centiped.211", 0x0000, 0x0800, 0x880acfb9 )
575 	ROM_LOAD( "centiped.212", 0x0800, 0x0800, 0xb1397029 )
576 ROM_END
577 
578 ROM_START( centipd2 )
579 	ROM_REGION( 0x10000, REGION_CPU1 )	/* 64k for code */
580 	ROM_LOAD( "centiped.207", 0x2000, 0x0800, 0xb2909e2f )
581 	ROM_LOAD( "centiped.208", 0x2800, 0x0800, 0x110e04ff )
582 	ROM_LOAD( "centiped.209", 0x3000, 0x0800, 0xcc2edb26 )
583 	ROM_LOAD( "centiped.210", 0x3800, 0x0800, 0x93999153 )
584 	ROM_RELOAD(               0xf800, 0x0800 )	/* for the reset and interrupt vectors */
585 
586 	ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
587 	ROM_LOAD( "centiped.211", 0x0000, 0x0800, 0x880acfb9 )
588 	ROM_LOAD( "centiped.212", 0x0800, 0x0800, 0xb1397029 )
589 ROM_END
590 
591 ROM_START( centipdb )
592 	ROM_REGION( 0x10000, REGION_CPU1 )	/* 64k for code */
593 	ROM_LOAD( "olympia.c28",  0x2000, 0x0800, 0x8a744e57 )
594 	ROM_LOAD( "olympia.c29",  0x2800, 0x0800, 0xbb897b10 )
595 	ROM_LOAD( "olympia.c30",  0x3000, 0x0800, 0x2297c2ac )
596 	ROM_LOAD( "olympia.c31",  0x3800, 0x0800, 0xcc529d6b )
597 	ROM_RELOAD(               0xf800, 0x0800 )	/* for the reset and interrupt vectors */
598 
599 	ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
600 	ROM_LOAD( "olympia.c32",  0x0000, 0x0800, 0xd91b9724 )
601 	ROM_LOAD( "olympia.c33",  0x0800, 0x0800, 0x1a6acd02 )
602 ROM_END
603 
604 ROM_START( centipb2 )
605 	ROM_REGION( 0x10000, REGION_CPU1 )	/* 64k for code */
606 	ROM_LOAD( "d1",  		  0x2000, 0x0800, 0xb17b8e0b )
607 	ROM_LOAD( "e1",  		  0x2800, 0x0800, 0x7684398e )
608 	ROM_LOAD( "h1",  		  0x3000, 0x0800, 0x74580fe4 )
609 	ROM_LOAD( "j1",  		  0x3800, 0x0800, 0x84600161 )
610 	ROM_RELOAD(               0xf800, 0x0800 )	/* for the reset and interrupt vectors */
611 	ROM_LOAD( "k1",  		  0x6000, 0x0800, 0xf1aa329b )
612 
613 	ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
614 	ROM_LOAD( "centiped.211", 0x0000, 0x0800, 0x880acfb9 )
615 	ROM_LOAD( "centiped.212", 0x0800, 0x0800, 0xb1397029 )
616 ROM_END
617 
618 
619 GAME( 1980, centiped, 0,        centiped, centiped, 0, ROT270, "Atari", "Centipede (revision 3)" )
620 GAME( 1980, centipd2, centiped, centiped, centiped, 0, ROT270, "Atari", "Centipede (revision 2)" )
621 GAME( 1980, centipdb, centiped, centipdb, centipdb, 0, ROT270, "bootleg", "Centipede (bootleg set 1)" )
622 GAME( 1980, centipb2, centiped, centipb2, centiped, 0, ROT270, "bootleg", "Centipede (bootleg set 2)" )
623