1 #include "../vidhrdw/blstroid.c"
2
3 /***************************************************************************
4
5 Blasteroids Memory Map
6 ----------------------
7
8 BLASTEROIDS 68010 MEMORY MAP
9
10 Function Address R/W DATA
11 -------------------------------------------------------------
12 Program ROM 000000-03FFFF R D0-D15
13 Slapstic Program ROM 038000-03FFFF R D0-D15
14
15 Watchdog reset FF8000 W xx
16 IRQ Acknowledge FF8200 W xx
17 VBLANK Acknowledge FF8400 W xx
18 Unlock EEPROM FF8600 W xx
19
20 Priority RAM (1=MO, 0=PF) FF8800-FF89FE W D0
21
22 Audio Send Port FF8A01 W D0-D7
23 Sound Processor Reset FF8C00 W xx
24 Halt CPU until HBLANK FF8E00 W xx
25
26 Audio Receive Port FF9401 R D0-D7
27 Whirly-Gig (Player 1) FF9801 R D0-D7
28 Whirly-Gig (Player 2) FF9805 R D0-D7
29
30 Self-Test FF9C01 R D7
31 Audio Busy Flag R D6
32 Vertical Blank R D5
33 Horizontal Blank R D4
34 Player 1 Button 4 R D3
35 Player 1 Transform R D2
36 Player 1 Thrust R D1
37 Player 1 Fire R D0
38
39 Player 2 Button 4 FF9C03 R D3
40 Player 2 Transform R D2
41 Player 2 Thrust R D1
42 Player 2 Fire R D0
43
44 Color RAM Motion Object FFA000-FFA1FE R/W D0-D14
45 Color RAM Playfield FFA200-FFA2FE R/W D0-D14
46
47 EEPROM FFB001-FFB3FF R/W D0-D7
48
49 Playfield RAM (40x30) FFC000-FFCFFF R/W D0-D15
50 Row Programmable Interrupt FFC050-FFCED0 R/W D15
51
52 Motion Object V Position FFD000-FFDFF8 R/W D7-D15
53 Motion Object V Size R/W D0-D3
54 Motion Object H Flip FFD002-FFDFFA R/W D15
55 Motion Object V Flip R/W D14
56 Motion Object Stamp R/W D0-D13
57 Motion Object Link FFD004-FFDFFC R/W D3-D11
58 Motion Object H Position FFD006-FFDFFE R/W D6-D15
59 Motion Object Palette R/W D0-D3
60
61 RAM FFE000-FFFFFF R/W
62
63 ****************************************************************************/
64
65
66
67 #include "driver.h"
68 #include "machine/atarigen.h"
69 #include "sndhrdw/atarijsa.h"
70 #include "vidhrdw/generic.h"
71
72
73 WRITE_HANDLER( blstroid_priorityram_w );
74 WRITE_HANDLER( blstroid_playfieldram_w );
75
76 int blstroid_vh_start(void);
77 void blstroid_vh_stop(void);
78 void blstroid_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
79
80 void blstroid_scanline_update(int scanline);
81
82
83
84 /*************************************
85 *
86 * Initialization
87 *
88 *************************************/
89
update_interrupts(void)90 static void update_interrupts(void)
91 {
92 int newstate = 0;
93
94 if (atarigen_scanline_int_state)
95 newstate = 1;
96 if (atarigen_video_int_state)
97 newstate = 2;
98 if (atarigen_sound_int_state)
99 newstate = 4;
100
101 if (newstate)
102 cpu_set_irq_line(0, newstate, ASSERT_LINE);
103 else
104 cpu_set_irq_line(0, 7, CLEAR_LINE);
105 }
106
107
init_machine(void)108 static void init_machine(void)
109 {
110 atarigen_eeprom_reset();
111 atarigen_interrupt_reset(update_interrupts);
112 atarigen_scanline_timer_reset(blstroid_scanline_update, 8);
113 atarijsa_reset();
114 }
115
116
117
118 /*************************************
119 *
120 * I/O read dispatch
121 *
122 *************************************/
123
READ_HANDLER(special_port2_r)124 static READ_HANDLER( special_port2_r )
125 {
126 int temp = input_port_2_r(offset);
127 if (atarigen_cpu_to_sound_ready) temp ^= 0x0040;
128 if (atarigen_get_hblank()) temp ^= 0x0010;
129 return temp;
130 }
131
132
133
134 /*************************************
135 *
136 * Main CPU memory handlers
137 *
138 *************************************/
139
140 static struct MemoryReadAddress main_readmem[] =
141 {
142 { 0x000000, 0x03ffff, MRA_ROM },
143 { 0xff9400, 0xff9401, atarigen_sound_r },
144 { 0xff9800, 0xff9801, input_port_0_r },
145 { 0xff9804, 0xff9805, input_port_1_r },
146 { 0xff9c00, 0xff9c01, special_port2_r },
147 { 0xff9c02, 0xff9c03, input_port_3_r },
148 { 0xffa000, 0xffa3ff, paletteram_word_r },
149 { 0xffb000, 0xffb3ff, atarigen_eeprom_r },
150 { 0xffc000, 0xffcfff, MRA_BANK1 },
151 { 0xffd000, 0xffdfff, MRA_BANK2 },
152 { 0xffe000, 0xffffff, MRA_BANK3 },
153 { -1 } /* end of table */
154 };
155
156
157 static struct MemoryWriteAddress main_writemem[] =
158 {
159 { 0x000000, 0x03ffff, MWA_ROM },
160 { 0xff8000, 0xff8001, watchdog_reset_w },
161 { 0xff8200, 0xff8201, atarigen_scanline_int_ack_w },
162 { 0xff8400, 0xff8401, atarigen_video_int_ack_w },
163 { 0xff8600, 0xff8601, atarigen_eeprom_enable_w },
164 { 0xff8800, 0xff89ff, blstroid_priorityram_w },
165 { 0xff8a00, 0xff8a01, atarigen_sound_w },
166 { 0xff8c00, 0xff8c01, atarigen_sound_reset_w },
167 { 0xff8e00, 0xff8e01, atarigen_halt_until_hblank_0_w },
168 { 0xffa000, 0xffa3ff, paletteram_xRRRRRGGGGGBBBBB_word_w, &paletteram },
169 { 0xffb000, 0xffb3ff, atarigen_eeprom_w, &atarigen_eeprom, &atarigen_eeprom_size },
170 { 0xffc000, 0xffcfff, blstroid_playfieldram_w, &atarigen_playfieldram, &atarigen_playfieldram_size },
171 { 0xffd000, 0xffdfff, MWA_BANK2, &atarigen_spriteram, &atarigen_spriteram_size },
172 { 0xffe000, 0xffffff, MWA_BANK3 },
173 { -1 } /* end of table */
174 };
175
176
177
178 /*************************************
179 *
180 * Port definitions
181 *
182 *************************************/
183
184 INPUT_PORTS_START( blstroid )
185 PORT_START /* ff9800 */
186 PORT_ANALOG( 0x00ff, 0, IPT_DIAL | IPF_PLAYER1, 60, 10, 0, 0 )
187 PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
188
189 PORT_START /* ff9804 */
190 PORT_ANALOG( 0x00ff, 0, IPT_DIAL | IPF_PLAYER2, 60, 10, 0, 0 )
191 PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
192
193 PORT_START /* ff9c00 */
194 PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
195 PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
196 PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER1 )
197 PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER1 )
198 PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_UNUSED )
199 PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_VBLANK )
200 PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED )
201 PORT_SERVICE( 0x0080, IP_ACTIVE_LOW )
202 PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
203
204 PORT_START /* ff9c02 */
205 PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
206 PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
207 PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_PLAYER2 )
208 PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON4 | IPF_PLAYER2 )
209 PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNUSED )
210
211 JSA_I_PORT /* audio board port */
212 INPUT_PORTS_END
213
214
215
216 /*************************************
217 *
218 * Graphics definitions
219 *
220 *************************************/
221
222 static struct GfxLayout pflayout =
223 {
224 16,8,
225 RGN_FRAC(1,1),
226 4,
227 { 0, 1, 2, 3 },
228 { 0,0, 4,4, 8,8, 12,12, 16,16, 20,20, 24,24, 28,28 },
229 { 0*8, 4*8, 8*8, 12*8, 16*8, 20*8, 24*8, 28*8 },
230 32*8
231 };
232
233
234 static struct GfxLayout molayout =
235 {
236 16,8,
237 RGN_FRAC(1,2),
238 4,
239 { 0, 1, 2, 3 },
240 { RGN_FRAC(1,2)+0, RGN_FRAC(1,2)+4, 0, 4, RGN_FRAC(1,2)+8, RGN_FRAC(1,2)+12, 8, 12,
241 RGN_FRAC(1,2)+16, RGN_FRAC(1,2)+20, 16, 20, RGN_FRAC(1,2)+24, RGN_FRAC(1,2)+28, 24, 28 },
242 { 0*8, 4*8, 8*8, 12*8, 16*8, 20*8, 24*8, 28*8 },
243 32*8
244 };
245
246
247 static struct GfxDecodeInfo gfxdecodeinfo[] =
248 {
249 { REGION_GFX1, 0, &pflayout, 256, 16 },
250 { REGION_GFX2, 0, &molayout, 0, 16 },
251 { -1 } /* end of array */
252 };
253
254
255
256 /*************************************
257 *
258 * Machine driver
259 *
260 *************************************/
261
262 static struct MachineDriver machine_driver_blstroid =
263 {
264 /* basic machine hardware */
265 {
266 {
267 CPU_M68000, /* verified */
268 ATARI_CLOCK_14MHz/2,
269 main_readmem,main_writemem,0,0,
270 atarigen_video_int_gen,1
271 },
272 JSA_I_CPU
273 },
274 60, DEFAULT_REAL_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */
275 1,
276 init_machine,
277
278 /* video hardware */
279 40*16, 30*8, { 0*8, 40*16-1, 0*8, 30*8-1 },
280 gfxdecodeinfo,
281 512,512,
282 0,
283
284 VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_UPDATE_BEFORE_VBLANK |
285 VIDEO_SUPPORTS_DIRTY | VIDEO_PIXEL_ASPECT_RATIO_1_2,
286 0,
287 blstroid_vh_start,
288 blstroid_vh_stop,
289 blstroid_vh_screenrefresh,
290
291 /* sound hardware */
292 JSA_I_STEREO,
293
294 atarigen_nvram_handler
295 };
296
297
298
299 /*************************************
300 *
301 * ROM definition(s)
302 *
303 *************************************/
304
305 ROM_START( blstroid )
306 ROM_REGION( 0x40000, REGION_CPU1 ) /* 4*64k for 68000 code */
307 ROM_LOAD_EVEN( "057-4123", 0x00000, 0x10000, 0xd14badc4 )
308 ROM_LOAD_ODD ( "057-4121", 0x00000, 0x10000, 0xae3e93e8 )
309 ROM_LOAD_EVEN( "057-4124", 0x20000, 0x10000, 0xfd2365df )
310 ROM_LOAD_ODD ( "057-4122", 0x20000, 0x10000, 0xc364706e )
311
312 ROM_REGION( 0x14000, REGION_CPU2 ) /* 64k for 6502 code */
313 ROM_LOAD( "blstroid.snd", 0x10000, 0x4000, 0xbaa8b5fe )
314 ROM_CONTINUE( 0x04000, 0xc000 )
315
316 ROM_REGION( 0x040000, REGION_GFX1 | REGIONFLAG_DISPOSE )
317 ROM_LOAD( "blstroid.1l", 0x000000, 0x10000, 0x3c2daa5b ) /* playfield */
318 ROM_LOAD( "blstroid.1m", 0x010000, 0x10000, 0xf84f0b97 ) /* playfield */
319 ROM_LOAD( "blstroid.3l", 0x020000, 0x10000, 0xae5274f0 ) /* playfield */
320 ROM_LOAD( "blstroid.3m", 0x030000, 0x10000, 0x4bb72060 ) /* playfield */
321
322 ROM_REGION( 0x100000, REGION_GFX2 | REGIONFLAG_DISPOSE )
323 ROM_LOAD( "blstroid.5m", 0x000000, 0x10000, 0x50e0823f ) /* mo */
324 ROM_LOAD( "blstroid.6m", 0x010000, 0x10000, 0x729de7a9 ) /* mo */
325 ROM_LOAD( "blstroid.8m", 0x020000, 0x10000, 0x090e42ab ) /* mo */
326 ROM_LOAD( "blstroid.10m", 0x030000, 0x10000, 0x1ff79e67 ) /* mo */
327 ROM_LOAD( "blstroid.11m", 0x040000, 0x10000, 0x4be1d504 ) /* mo */
328 ROM_LOAD( "blstroid.13m", 0x050000, 0x10000, 0xe4409310 ) /* mo */
329 ROM_LOAD( "blstroid.14m", 0x060000, 0x10000, 0x7aaca15e ) /* mo */
330 ROM_LOAD( "blstroid.16m", 0x070000, 0x10000, 0x33690379 ) /* mo */
331 ROM_LOAD( "blstroid.5n", 0x080000, 0x10000, 0x2720ee71 ) /* mo */
332 ROM_LOAD( "blstroid.6n", 0x090000, 0x10000, 0x2faecd15 ) /* mo */
333 ROM_LOAD( "blstroid.8n", 0x0a0000, 0x10000, 0xf10e59ed ) /* mo */
334 ROM_LOAD( "blstroid.10n", 0x0b0000, 0x10000, 0x4d5fc284 ) /* mo */
335 ROM_LOAD( "blstroid.11n", 0x0c0000, 0x10000, 0xa70fc6e6 ) /* mo */
336 ROM_LOAD( "blstroid.13n", 0x0d0000, 0x10000, 0xf423b4f8 ) /* mo */
337 ROM_LOAD( "blstroid.14n", 0x0e0000, 0x10000, 0x56fa3d16 ) /* mo */
338 ROM_LOAD( "blstroid.16n", 0x0f0000, 0x10000, 0xf257f738 ) /* mo */
339 ROM_END
340
341
ROM_START(blstroi2)342 ROM_START( blstroi2 )
343 ROM_REGION( 0x40000, REGION_CPU1 ) /* 4*64k for 68000 code */
344 ROM_LOAD_EVEN( "blstroid.6c", 0x00000, 0x10000, 0x5a092513 )
345 ROM_LOAD_ODD ( "blstroid.6b", 0x00000, 0x10000, 0x486aac51 )
346 ROM_LOAD_EVEN( "blstroid.4c", 0x20000, 0x10000, 0xd0fa38fe )
347 ROM_LOAD_ODD ( "blstroid.4b", 0x20000, 0x10000, 0x744bf921 )
348
349 ROM_REGION( 0x14000, REGION_CPU2 ) /* 64k for 6502 code */
350 ROM_LOAD( "blstroid.snd", 0x10000, 0x4000, 0xbaa8b5fe )
351 ROM_CONTINUE( 0x04000, 0xc000 )
352
353 ROM_REGION( 0x040000, REGION_GFX1 | REGIONFLAG_DISPOSE )
354 ROM_LOAD( "blstroid.1l", 0x000000, 0x10000, 0x3c2daa5b ) /* playfield */
355 ROM_LOAD( "blstroid.1m", 0x010000, 0x10000, 0xf84f0b97 ) /* playfield */
356 ROM_LOAD( "blstroid.3l", 0x020000, 0x10000, 0xae5274f0 ) /* playfield */
357 ROM_LOAD( "blstroid.3m", 0x030000, 0x10000, 0x4bb72060 ) /* playfield */
358
359 ROM_REGION( 0x100000, REGION_GFX2 | REGIONFLAG_DISPOSE )
360 ROM_LOAD( "blstroid.5m", 0x000000, 0x10000, 0x50e0823f ) /* mo */
361 ROM_LOAD( "blstroid.6m", 0x010000, 0x10000, 0x729de7a9 ) /* mo */
362 ROM_LOAD( "blstroid.8m", 0x020000, 0x10000, 0x090e42ab ) /* mo */
363 ROM_LOAD( "blstroid.10m", 0x030000, 0x10000, 0x1ff79e67 ) /* mo */
364 ROM_LOAD( "blstroid.11m", 0x040000, 0x10000, 0x4be1d504 ) /* mo */
365 ROM_LOAD( "blstroid.13m", 0x050000, 0x10000, 0xe4409310 ) /* mo */
366 ROM_LOAD( "blstroid.14m", 0x060000, 0x10000, 0x7aaca15e ) /* mo */
367 ROM_LOAD( "blstroid.16m", 0x070000, 0x10000, 0x33690379 ) /* mo */
368 ROM_LOAD( "blstroid.5n", 0x080000, 0x10000, 0x2720ee71 ) /* mo */
369 ROM_LOAD( "blstroid.6n", 0x090000, 0x10000, 0x2faecd15 ) /* mo */
370 ROM_LOAD( "blstroid.8n", 0x0a0000, 0x10000, 0xf10e59ed ) /* mo */
371 ROM_LOAD( "blstroid.10n", 0x0b0000, 0x10000, 0x4d5fc284 ) /* mo */
372 ROM_LOAD( "blstroid.11n", 0x0c0000, 0x10000, 0xa70fc6e6 ) /* mo */
373 ROM_LOAD( "blstroid.13n", 0x0d0000, 0x10000, 0xf423b4f8 ) /* mo */
374 ROM_LOAD( "blstroid.14n", 0x0e0000, 0x10000, 0x56fa3d16 ) /* mo */
375 ROM_LOAD( "blstroid.16n", 0x0f0000, 0x10000, 0xf257f738 ) /* mo */
376 ROM_END
377
378
379 ROM_START( blsthead )
380 ROM_REGION( 0x40000, REGION_CPU1 ) /* 4*64k for 68000 code */
381 ROM_LOAD_EVEN( "eheadh0.c6", 0x00000, 0x10000, 0x061f0898 )
382 ROM_LOAD_ODD ( "eheadl0.b6", 0x00000, 0x10000, 0xae8df7cb )
383 ROM_LOAD_EVEN( "eheadh1.c5", 0x20000, 0x10000, 0x0b7a3cb6 )
384 ROM_LOAD_ODD ( "eheadl1.b5", 0x20000, 0x10000, 0x43971694 )
385
386 ROM_REGION( 0x14000, REGION_CPU2 ) /* 64k for 6502 code */
387 ROM_LOAD( "blstroid.snd", 0x10000, 0x4000, 0xbaa8b5fe )
388 ROM_CONTINUE( 0x04000, 0xc000 )
389
390 ROM_REGION( 0x040000, REGION_GFX1 | REGIONFLAG_DISPOSE )
391 ROM_LOAD( "blstroid.1l", 0x000000, 0x10000, 0x3c2daa5b ) /* playfield */
392 ROM_LOAD( "blstroid.1m", 0x010000, 0x10000, 0xf84f0b97 ) /* playfield */
393 ROM_LOAD( "blstroid.3l", 0x020000, 0x10000, 0xae5274f0 ) /* playfield */
394 ROM_LOAD( "blstroid.3m", 0x030000, 0x10000, 0x4bb72060 ) /* playfield */
395
396 ROM_REGION( 0x100000, REGION_GFX2 | REGIONFLAG_DISPOSE )
397 ROM_LOAD( "blstroid.5m", 0x000000, 0x10000, 0x50e0823f ) /* mo */
398 ROM_LOAD( "blstroid.6m", 0x010000, 0x10000, 0x729de7a9 ) /* mo */
399 ROM_LOAD( "blstroid.8m", 0x020000, 0x10000, 0x090e42ab ) /* mo */
400 ROM_LOAD( "blstroid.10m", 0x030000, 0x10000, 0x1ff79e67 ) /* mo */
401 ROM_LOAD( "mol4.m12", 0x040000, 0x10000, 0x571139ea ) /* mo */
402 ROM_LOAD( "blstroid.13m", 0x050000, 0x10000, 0xe4409310 ) /* mo */
403 ROM_LOAD( "blstroid.14m", 0x060000, 0x10000, 0x7aaca15e ) /* mo */
404 ROM_LOAD( "mol7.m16", 0x070000, 0x10000, 0xd27b2d91 ) /* mo */
405 ROM_LOAD( "blstroid.5n", 0x080000, 0x10000, 0x2720ee71 ) /* mo */
406 ROM_LOAD( "blstroid.6n", 0x090000, 0x10000, 0x2faecd15 ) /* mo */
407 ROM_LOAD( "moh2.n8", 0x0a0000, 0x10000, 0xa15e79e1 ) /* mo */
408 ROM_LOAD( "blstroid.10n", 0x0b0000, 0x10000, 0x4d5fc284 ) /* mo */
409 ROM_LOAD( "moh4.n12", 0x0c0000, 0x10000, 0x1a74e960 ) /* mo */
410 ROM_LOAD( "blstroid.13n", 0x0d0000, 0x10000, 0xf423b4f8 ) /* mo */
411 ROM_LOAD( "blstroid.14n", 0x0e0000, 0x10000, 0x56fa3d16 ) /* mo */
412 ROM_LOAD( "moh7.n16", 0x0f0000, 0x10000, 0xa93cbbe7 ) /* mo */
413 ROM_END
414
415
416
417 /*************************************
418 *
419 * Driver initialization
420 *
421 *************************************/
422
423 static void init_blstroid(void)
424 {
425 atarigen_eeprom_default = NULL;
426 atarijsa_init(1, 4, 2, 0x80);
427
428 /* speed up the 6502 */
429 atarigen_init_6502_speedup(1, 0x4157, 0x416f);
430
431 /* display messages */
432 atarigen_show_sound_message();
433 }
434
435
436
437 /*************************************
438 *
439 * Game driver(s)
440 *
441 *************************************/
442
443 GAME( 1987, blstroid, 0, blstroid, blstroid, blstroid, ROT0, "Atari Games", "Blasteroids (version 4)" )
444 GAME( 1987, blstroi2, blstroid, blstroid, blstroid, blstroid, ROT0, "Atari Games", "Blasteroids (version 2)" )
445 GAME( 1987, blsthead, blstroid, blstroid, blstroid, blstroid, ROT0, "Atari Games", "Blasteroids (with heads)" )
446