src/mess/video/astrocde.c
| r2008 | r2009 | |
| 1 | | /*************************************************************************** |
| 2 | | |
| 3 | | video/astrocde.c |
| 4 | | |
| 5 | | Functions to emulate the video hardware of the machine. |
| 6 | | |
| 7 | | * History * |
| 8 | | |
| 9 | | MJC - 01.02.98 - Line based dirty colour / dirty rectangle handling |
| 10 | | |
| 11 | | ***************************************************************************/ |
| 12 | | |
| 13 | | #include "driver.h" |
| 14 | | #include "cpu/z80/z80.h" |
| 15 | | #include "includes/astrocde.h" |
| 16 | | |
| 17 | | #include <math.h> /* for sin() and cos() */ |
| 18 | | |
| 19 | | #define VERBOSE 0 |
| 20 | | #define LOG(x) do { if (VERBOSE) logerror x; } while (0) |
| 21 | | |
| 22 | | static int magic_expand_color, magic_control, magic_expand_flipflop, collision; |
| 23 | | |
| 24 | | static int ColourSplit=0; /* Colour System vars */ |
| 25 | | static int Colour[8] = {0,0,0,0,0,0,0,0}; |
| 26 | | |
| 27 | | static unsigned int LeftColourCheck=0x00000000; |
| 28 | | static unsigned int RightColourCheck=0x00000000; |
| 29 | | static unsigned int LeftLineColour[256]; |
| 30 | | static unsigned int RightLineColour[256]; |
| 31 | | |
| 32 | | static int VerticalBlank = 204; |
| 33 | | static int BackgroundData = 0; |
| 34 | | static int LastShifter = 0; |
| 35 | | static int astrocade_mode = 0; |
| 36 | | |
| 37 | | static UINT8 interrupt_vector = 0; |
| 38 | | |
| 39 | | static int screen_interrupt_enabled; |
| 40 | | static int screen_interrupt_mode; |
| 41 | | static int screen_interrupt_line = 0; |
| 42 | | |
| 43 | | static int lightpen_interrupt_enabled; |
| 44 | | static int lightpen_interrupt_mode; |
| 45 | | |
| 46 | | |
| 47 | | /* These are the bits of the Magic Register */ |
| 48 | | static const unsigned char SHIFT_MASK = 0x03; |
| 49 | | static const unsigned char ROTATE_MASK = 0x04; |
| 50 | | static const unsigned char EXPAND_MASK = 0x08; |
| 51 | | static const unsigned char OR_MASK = 0x10; |
| 52 | | static const unsigned char XOR_MASK = 0x20; |
| 53 | | static const unsigned char FLOP_MASK = 0x40; |
| 54 | | |
| 55 | | |
| 56 | | |
| 57 | | /************************************* |
| 58 | | * |
| 59 | | * Palette |
| 60 | | * |
| 61 | | *************************************/ |
| 62 | | |
| 63 | | PALETTE_INIT( astrocade ) |
| 64 | | { |
| 65 | | /* This routine builds a palette using a transformation from */ |
| 66 | | /* the YUV (Y, B-Y, R-Y) to the RGB color space */ |
| 67 | | |
| 68 | | /* It also returns a fake colortable, for the menus */ |
| 69 | | |
| 70 | | int i,j; |
| 71 | | |
| 72 | | float Y, RY, BY; /* Y, R-Y, and B-Y signals as generated by the game */ |
| 73 | | /* Y = Luminance -> (0 to 1) */ |
| 74 | | /* R-Y = Color along R-Y axis -> C*(-1 to +1) */ |
| 75 | | /* B-Y = Color along B-Y axis -> C*(-1 to +1) */ |
| 76 | | float R, G, B; |
| 77 | | |
| 78 | | float brightest = 1.0; /* Approx. Luminance values for the extremes -> (0 to 1) */ |
| 79 | | float dimmest = 0.0; |
| 80 | | float C = 0.75; /* Approx. Chroma intensity */ |
| 81 | | |
| 82 | | /* The astrocade has a 256 color palette */ |
| 83 | | /* 32 colors, with 8 luminance levels for each color */ |
| 84 | | /* The 32 colors circle around the YUV color space, */ |
| 85 | | /* with the exception of the first 8 which are grayscale */ |
| 86 | | |
| 87 | | /* Note: to simulate a B&W monitor, set C=0 and all */ |
| 88 | | /* colors will appear as the first 8 grayscales */ |
| 89 | | |
| 90 | | for(i=0;i<32;i++) |
| 91 | | { |
| 92 | | RY = C*sin(i*2.0*M_PI/32.0); |
| 93 | | if (i == 0) |
| 94 | | BY = 0; |
| 95 | | else |
| 96 | | BY = C*cos(i*2.0*M_PI/32.0); |
| 97 | | |
| 98 | | for(j=0;j<8;j++) |
| 99 | | { |
| 100 | | Y = (j/7.0)*(brightest-dimmest)+dimmest; |
| 101 | | |
| 102 | | /* Transform to RGB */ |
| 103 | | |
| 104 | | R = (RY+Y)*255; |
| 105 | | G = (Y - 0.299*(RY+Y) - 0.114*(BY+Y))/0.587*255; |
| 106 | | B = (BY+Y)*255; |
| 107 | | |
| 108 | | /* Clipping, in case of saturation */ |
| 109 | | |
| 110 | | if (R < 0) |
| 111 | | R = 0; |
| 112 | | if (R > 255) |
| 113 | | R = 255; |
| 114 | | if (G < 0) |
| 115 | | G = 0; |
| 116 | | if (G > 255) |
| 117 | | G = 255; |
| 118 | | if (B < 0) |
| 119 | | B = 0; |
| 120 | | if (B > 255) |
| 121 | | B = 255; |
| 122 | | |
| 123 | | /* Round, and set the value */ |
| 124 | | palette_set_color_rgb(machine, i*8+j, floor(R+.5), floor(G+.5), floor(B+.5)); |
| 125 | | } |
| 126 | | } |
| 127 | | } |
| 128 | | |
| 129 | | |
| 130 | | |
| 131 | | /************************************* |
| 132 | | * |
| 133 | | * Interrupts |
| 134 | | * |
| 135 | | *************************************/ |
| 136 | | |
| 137 | | WRITE8_HANDLER( astrocade_interrupt_enable_w ) |
| 138 | | { |
| 139 | | screen_interrupt_enabled = data & 0x08; |
| 140 | | screen_interrupt_mode = data & 0x04; |
| 141 | | |
| 142 | | lightpen_interrupt_enabled = data & 0x02; |
| 143 | | lightpen_interrupt_mode = data & 0x01; |
| 144 | | |
| 145 | | LOG(("Interrupt Flag set to %02x\n",data & 0x0f)); |
| 146 | | } |
| 147 | | |
| 148 | | |
| 149 | | WRITE8_HANDLER( astrocade_interrupt_w ) |
| 150 | | { |
| 151 | | /* in low res mode, only bits 1-7 are used */ |
| 152 | | screen_interrupt_line = astrocade_mode ? data : data >> 1; |
| 153 | | |
| 154 | | LOG(("Scanline interrupt set to %02x\n", screen_interrupt_line)); |
| 155 | | } |
| 156 | | |
| 157 | | |
| 158 | | WRITE8_HANDLER( astrocade_interrupt_vector_w ) |
| 159 | | { |
| 160 | | interrupt_vector = data; |
| 161 | | } |
| 162 | | |
| 163 | | |
| 164 | | |
| 165 | | /************************************* |
| 166 | | * |
| 167 | | * VBlank |
| 168 | | * |
| 169 | | *************************************/ |
| 170 | | |
| 171 | | WRITE8_HANDLER( astrocade_vertical_blank_w ) |
| 172 | | { |
| 173 | | VerticalBlank = data; |
| 174 | | } |
| 175 | | |
| 176 | | |
| 177 | | READ8_HANDLER( astrocade_video_retrace_r ) |
| 178 | | { |
| 179 | | return video_screen_get_vpos(machine->primary_screen); |
| 180 | | } |
| 181 | | |
| 182 | | |
| 183 | | |
| 184 | | /************************************* |
| 185 | | * |
| 186 | | * Screen mode |
| 187 | | * |
| 188 | | *************************************/ |
| 189 | | |
| 190 | | /*------------------------------------------------- |
| 191 | | astrocade_mode_w - this selects commercial |
| 192 | | (high res, arcade) or consumer |
| 193 | | (low res, astrocade) mode |
| 194 | | -------------------------------------------------*/ |
| 195 | | |
| 196 | | WRITE8_HANDLER( astrocade_mode_w ) |
| 197 | | { |
| 198 | | rectangle visarea; |
| 199 | | astrocade_mode = data & 0x01; |
| 200 | | |
| 201 | | if (astrocade_mode) |
| 202 | | { |
| 203 | | /* high res mode */ |
| 204 | | visarea.min_x = 0; |
| 205 | | visarea.max_x = 319; |
| 206 | | visarea.min_y = 0; |
| 207 | | visarea.max_y = 255; |
| 208 | | |
| 209 | | video_screen_configure(machine->primary_screen, 455, 268, &visarea, HZ_TO_ATTOSECONDS(XTAL_Y1/2) * 268 * 455); |
| 210 | | } |
| 211 | | else |
| 212 | | { |
| 213 | | /* low res mode */ |
| 214 | | visarea.min_x = 0; |
| 215 | | visarea.max_x = 159; |
| 216 | | visarea.min_y = 0; |
| 217 | | visarea.max_y = 127; |
| 218 | | |
| 219 | | video_screen_configure(machine->primary_screen, 455, 134, &visarea, HZ_TO_ATTOSECONDS(XTAL_Y1/4) * 134 * 455); |
| 220 | | } |
| 221 | | } |
| 222 | | |
| 223 | | |
| 224 | | |
| 225 | | /************************************* |
| 226 | | * |
| 227 | | * Collisions |
| 228 | | * |
| 229 | | *************************************/ |
| 230 | | |
| 231 | | READ8_HANDLER( astrocade_intercept_r ) |
| 232 | | { |
| 233 | | int res; |
| 234 | | |
| 235 | | res = collision; |
| 236 | | collision = 0; |
| 237 | | |
| 238 | | return res; |
| 239 | | } |
| 240 | | |
| 241 | | |
| 242 | | |
| 243 | | /************************************* |
| 244 | | * |
| 245 | | * Colors |
| 246 | | * |
| 247 | | *************************************/ |
| 248 | | |
| 249 | | /*------------------------------------------------- |
| 250 | | astrocade_colour_split_w - switches colour |
| 251 | | registers at this zone - 40 zones |
| 252 | | also sets the background colors |
| 253 | | -------------------------------------------------*/ |
| 254 | | |
| 255 | | WRITE8_HANDLER ( astrocade_colour_split_w ) |
| 256 | | { |
| 257 | | ColourSplit = data&0x3f; |
| 258 | | |
| 259 | | if (astrocade_mode == 1) |
| 260 | | ColourSplit <<= 1; |
| 261 | | |
| 262 | | BackgroundData = ((data&0xc0) >> 6) * 0x55; |
| 263 | | |
| 264 | | LOG(("Colour split set to %02d\n", ColourSplit)); |
| 265 | | } |
| 266 | | |
| 267 | | WRITE8_HANDLER( astrocade_colour_register_w ) |
| 268 | | { |
| 269 | | if(Colour[offset] != data) |
| 270 | | { |
| 271 | | Colour[offset] = data; |
| 272 | | |
| 273 | | if(offset>3) |
| 274 | | LeftColourCheck = (Colour[4] << 24) | (Colour[5] << 16) | (Colour[6] < 8) | Colour[7]; |
| 275 | | else |
| 276 | | RightColourCheck = (Colour[0] << 24) | (Colour[1] << 16) | (Colour[2] < 8) | Colour[3]; |
| 277 | | } |
| 278 | | |
| 279 | | LOG(("Colour %01x set to %02x\n",offset,data)); |
| 280 | | } |
| 281 | | |
| 282 | | WRITE8_HANDLER ( astrocade_colour_block_w ) |
| 283 | | { |
| 284 | | static int color_reg_num = 7; |
| 285 | | |
| 286 | | Colour[color_reg_num] = data; |
| 287 | | |
| 288 | | LOG(("Colour block write: color %x set to %x\n", color_reg_num,data)); |
| 289 | | |
| 290 | | if (color_reg_num == 0) |
| 291 | | color_reg_num = 7; |
| 292 | | else |
| 293 | | color_reg_num--; |
| 294 | | |
| 295 | | LeftColourCheck = (Colour[4] << 24) | (Colour[5] << 16) | (Colour[6] < 8) | Colour[7]; |
| 296 | | RightColourCheck = (Colour[0] << 24) | (Colour[1] << 16) | (Colour[2] < 8) | Colour[3]; |
| 297 | | |
| 298 | | } |
| 299 | | |
| 300 | | |
| 301 | | |
| 302 | | /************************************* |
| 303 | | * |
| 304 | | * Magic RAM |
| 305 | | * |
| 306 | | *************************************/ |
| 307 | | |
| 308 | | WRITE8_HANDLER( astrocade_magic_expand_color_w ) |
| 309 | | { |
| 310 | | //LOG(("%04x: magic_expand_color = %02x\n",cpu_getpc(),data)); |
| 311 | | |
| 312 | | magic_expand_color = data; |
| 313 | | } |
| 314 | | |
| 315 | | |
| 316 | | WRITE8_HANDLER( astrocade_magic_control_w ) |
| 317 | | { |
| 318 | | //LOG(("%04x: magic_control = %02x\n",cpu_getpc(),data)); |
| 319 | | |
| 320 | | magic_expand_flipflop = 0; /* initialize the expand nibble */ |
| 321 | | LastShifter = 0; /* clear the shifter */ |
| 322 | | |
| 323 | | magic_control = data; |
| 324 | | } |
| 325 | | |
| 326 | | |
| 327 | | WRITE8_HANDLER( astrocade_magicram_w ) |
| 328 | | { |
| 329 | | unsigned int data1,shift,bits,bibits,stib,k,old_data; |
| 330 | | |
| 331 | | //LOG(("%04x: magicram_w(%04x) = %02x, magic_register = %02x\n",cpu_getpc(),offset,data,magic_control)); |
| 332 | | |
| 333 | | if (magic_control & EXPAND_MASK) /* expand mode */ |
| 334 | | { |
| 335 | | bits = data; |
| 336 | | |
| 337 | | /* if flip-flop set, expand lower half */ |
| 338 | | /* otherwise do upper half */ |
| 339 | | |
| 340 | | if (magic_expand_flipflop) |
| 341 | | bits <<= 4; |
| 342 | | |
| 343 | | /* now what we want to expand is in bits 4-7 */ |
| 344 | | |
| 345 | | bibits = 0; |
| 346 | | for (k = 0;k < 4;k++) |
| 347 | | { |
| 348 | | bibits <<= 2; |
| 349 | | if (bits & 0x80) |
| 350 | | bibits |= (magic_expand_color >> 2) & 0x03; |
| 351 | | else |
| 352 | | bibits |= magic_expand_color & 0x03; |
| 353 | | bits <<= 1; |
| 354 | | } |
| 355 | | |
| 356 | | data = bibits; |
| 357 | | } |
| 358 | | |
| 359 | | /* rotating or shifting */ |
| 360 | | |
| 361 | | data1 = 0; |
| 362 | | |
| 363 | | if (magic_control & ROTATE_MASK) |
| 364 | | { |
| 365 | | /* Rotate not implemented */ |
| 366 | | /* (Only functional in commercial mode) */ |
| 367 | | } |
| 368 | | else |
| 369 | | { |
| 370 | | shift = (magic_control & SHIFT_MASK); |
| 371 | | |
| 372 | | if (shift) |
| 373 | | { |
| 374 | | while (shift > 0) |
| 375 | | { |
| 376 | | data1 >>= 2; |
| 377 | | data1 |= (data & 0x03) << 6; |
| 378 | | |
| 379 | | data >>= 2; |
| 380 | | |
| 381 | | shift--; |
| 382 | | } |
| 383 | | |
| 384 | | data |= LastShifter; |
| 385 | | LastShifter = data1; |
| 386 | | |
| 387 | | } |
| 388 | | } |
| 389 | | |
| 390 | | /* flopping */ |
| 391 | | |
| 392 | | if (magic_control & FLOP_MASK) /* copy backwards */ |
| 393 | | { |
| 394 | | bits = data; |
| 395 | | stib = 0; |
| 396 | | for (k = 0;k < 4;k++) |
| 397 | | { |
| 398 | | stib >>= 2; |
| 399 | | stib |= (bits & 0xc0); |
| 400 | | bits <<= 2; |
| 401 | | } |
| 402 | | |
| 403 | | data = stib; |
| 404 | | |
| 405 | | bits = data1; |
| 406 | | stib = 0; |
| 407 | | for (k = 0;k < 4;k++) |
| 408 | | { |
| 409 | | stib >>= 2; |
| 410 | | stib |= (bits & 0xc0); |
| 411 | | bits <<= 2; |
| 412 | | } |
| 413 | | |
| 414 | | data1 = stib; |
| 415 | | } |
| 416 | | |
| 417 | | /* OR or XOR */ |
| 418 | | |
| 419 | | if (magic_control & 0x30) |
| 420 | | { |
| 421 | | old_data = videoram[offset]; |
| 422 | | collision &= 0x0f; |
| 423 | | |
| 424 | | if (data | old_data) |
| 425 | | { |
| 426 | | if ((data & 0x03) && (old_data & 0x03)) |
| 427 | | collision |= 0x88; |
| 428 | | if ((data & 0x0c) && (old_data & 0x0c)) |
| 429 | | collision |= 0x44; |
| 430 | | if ((data & 0x30) && (old_data & 0x30)) |
| 431 | | collision |= 0x22; |
| 432 | | if ((data & 0xc0) && (old_data & 0xc0)) |
| 433 | | collision |= 0x11; |
| 434 | | } |
| 435 | | } |
| 436 | | |
| 437 | | if (magic_control & XOR_MASK) |
| 438 | | data ^= videoram[offset]; /* draw in XOR mode */ |
| 439 | | else if (magic_control & OR_MASK) |
| 440 | | data |= videoram[offset]; /* draw in OR mode */ |
| 441 | | |
| 442 | | /* else draw in copy mode */ |
| 443 | | videoram[offset] = data; |
| 444 | | |
| 445 | | magic_expand_flipflop ^= 1; |
| 446 | | } |
| 447 | | |
| 448 | | |
| 449 | | |
| 450 | | /************************************* |
| 451 | | * |
| 452 | | * Video update and interrupts |
| 453 | | * |
| 454 | | *************************************/ |
| 455 | | |
| 456 | | VIDEO_UPDATE( astrocde ) |
| 457 | | { |
| 458 | | int line = video_screen_get_vpos(screen); |
| 459 | | int num_bytes = astrocade_mode ? 80 : 40; |
| 460 | | int memloc = line * num_bytes; |
| 461 | | int vblank_start = astrocade_mode ? VerticalBlank : VerticalBlank >> 1; |
| 462 | | |
| 463 | | int i; |
| 464 | | |
| 465 | | /* scanline interrupt? */ |
| 466 | | if (screen_interrupt_enabled && (line == screen_interrupt_line)) |
| 467 | | cpunum_set_input_line_and_vector(screen->machine, 0, 0, |
| 468 | | screen_interrupt_mode ? ASSERT_LINE : HOLD_LINE, interrupt_vector); |
| 469 | | else |
| 470 | | cpunum_set_input_line(screen->machine, 0, 0, CLEAR_LINE); |
| 471 | | |
| 472 | | LeftLineColour[line] = LeftColourCheck; |
| 473 | | RightLineColour[line] = RightColourCheck; |
| 474 | | |
| 475 | | for (i = 0; i < num_bytes; i++, memloc++) |
| 476 | | { |
| 477 | | int data, x; |
| 478 | | |
| 479 | | if (line < vblank_start) |
| 480 | | data = videoram[memloc]; |
| 481 | | else |
| 482 | | data = BackgroundData; |
| 483 | | |
| 484 | | for (x = i*4+3; x >= i*4; x--) |
| 485 | | { |
| 486 | | int color = data & 03; |
| 487 | | |
| 488 | | if (i < ColourSplit) |
| 489 | | color += 4; |
| 490 | | |
| 491 | | *BITMAP_ADDR16(bitmap, line, x) = screen->machine->pens[Colour[color]]; |
| 492 | | |
| 493 | | data >>= 2; |
| 494 | | } |
| 495 | | |
| 496 | | } |
| 497 | | |
| 498 | | return 0; |
| 499 | | } |
src/mess/drivers/astrocde.c
| r2008 | r2009 | |
| 1 | | |
| 2 | 1 | /**************************************************************************** |
| 3 | 2 | |
| 4 | | Bally Astrocade Driver |
| 3 | Bally Astrocade consumer hardware |
| 4 | driver by Nicola Salmoria, Mike Coates, Frank Palazzolo, Aaron Giles, |
| 5 | Dirk Best |
| 5 | 6 | |
| 6 | | 09/23/98 - Added sound, added player 2 pot FMP |
| 7 | | Added SMH_ROM to fix Star Fortress problem |
| 8 | | Added cartridge support |
| 7 | ****************************************************************************/ |
| 9 | 8 | |
| 10 | | 08/02/98 - First release based on original wow.c in MAME FMP |
| 11 | | Added palette generation based on a function |
| 12 | | Fixed collision detection |
| 13 | | Fixed shifter operation |
| 14 | | Fixed clock speed |
| 15 | | Fixed Interrupt Rate and handling |
| 16 | | (No Light pen support yet) |
| 17 | | (No sound yet) |
| 18 | | |
| 19 | | Original header follows, some comments don't apply FMP |
| 20 | | |
| 21 | | ****************************************************************************/ |
| 22 | | |
| 23 | | /**************************************************************************** |
| 24 | | |
| 25 | | Bally Astrocade style games |
| 26 | | |
| 27 | | 02.02.98 - New IO port definitions MJC |
| 28 | | Dirty Rectangle handling |
| 29 | | Sparkle Circuit for Gorf |
| 30 | | errorlog output conditional on MAME_DEBUG |
| 31 | | |
| 32 | | 03/04 98 - Extra Bases driver ATJ |
| 33 | | Wow word driver |
| 34 | | |
| 35 | | ****************************************************************************/ |
| 36 | | |
| 37 | 9 | #include "driver.h" |
| 38 | 10 | #include "includes/astrocde.h" |
| 39 | 11 | #include "sound/astrocde.h" |
| r2008 | r2009 | |
| 41 | 13 | |
| 42 | 14 | |
| 43 | 15 | |
| 44 | | /**************************************************************************** |
| 45 | | * Bally Astrocade |
| 46 | | ****************************************************************************/ |
| 47 | | |
| 48 | | static WRITE8_HANDLER( astrocade_soundblock1_w ) |
| 49 | | { |
| 50 | | astrocade_sound1_w(machine, offset + 0x18, data); |
| 51 | | } |
| 52 | | |
| 53 | | |
| 54 | | |
| 55 | 16 | /************************************* |
| 56 | 17 | * |
| 57 | 18 | * Memory maps |
| r2008 | r2009 | |
| 59 | 20 | *************************************/ |
| 60 | 21 | |
| 61 | 22 | static ADDRESS_MAP_START( astrocade_mem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 62 | | AM_RANGE(0x0000, 0x0fff) AM_READWRITE(SMH_ROM, astrocade_magicram_w) |
| 23 | AM_RANGE(0x0000, 0x0fff) AM_READWRITE(SMH_ROM, astrocade_funcgen_w) |
| 63 | 24 | AM_RANGE(0x1000, 0x3fff) AM_ROM /* Star Fortress writes in here?? */ |
| 64 | 25 | AM_RANGE(0x4000, 0x4fff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size) /* ASG */ |
| 65 | 26 | ADDRESS_MAP_END |
| r2008 | r2009 | |
| 67 | 28 | |
| 68 | 29 | static ADDRESS_MAP_START( astrocade_io, ADDRESS_SPACE_IO, 8 ) |
| 69 | 30 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 70 | | AM_RANGE(0x00, 0x07) AM_WRITE(astrocade_colour_register_w) |
| 71 | | AM_RANGE(0x08, 0x08) AM_READWRITE(astrocade_intercept_r, astrocade_mode_w) |
| 72 | | AM_RANGE(0x09, 0x09) AM_WRITE(astrocade_colour_split_w) |
| 73 | | AM_RANGE(0x0a, 0x0a) AM_WRITE(astrocade_vertical_blank_w) |
| 74 | | AM_RANGE(0x0b, 0x0b) AM_WRITE(astrocade_colour_block_w) |
| 75 | | AM_RANGE(0x0c, 0x0c) AM_WRITE(astrocade_magic_control_w) |
| 76 | | AM_RANGE(0x0d, 0x0d) AM_WRITE(astrocade_interrupt_vector_w) |
| 77 | | AM_RANGE(0x0e, 0x0e) AM_READWRITE(astrocade_video_retrace_r, astrocade_interrupt_enable_w) |
| 78 | | AM_RANGE(0x0f, 0x0f) AM_WRITE(astrocade_interrupt_w) |
| 79 | | /* AM_RANGE(0x0f, 0x0f) AM_READ(astrocade_horiz_r) */ |
| 80 | | AM_RANGE(0x10, 0x10) AM_READ_PORT("P1_HANDLE") |
| 81 | | AM_RANGE(0x11, 0x11) AM_READ_PORT("P2_HANDLE") |
| 82 | | AM_RANGE(0x12, 0x12) AM_READ_PORT("P3_HANDLE") |
| 83 | | AM_RANGE(0x13, 0x13) AM_READ_PORT("P4_HANDLE") |
| 84 | | AM_RANGE(0x14, 0x14) AM_READ_PORT("KEYPAD_COL0") |
| 85 | | AM_RANGE(0x15, 0x15) AM_READ_PORT("KEYPAD_COL1") |
| 86 | | AM_RANGE(0x16, 0x16) AM_READ_PORT("KEYPAD_COL2") |
| 87 | | AM_RANGE(0x17, 0x17) AM_READ_PORT("KEYPAD_COL3") |
| 88 | | AM_RANGE(0x10, 0x17) AM_WRITE(astrocade_sound1_w) /* Sound Stuff */ |
| 89 | | AM_RANGE(0x19, 0x19) AM_WRITE(astrocade_magic_expand_color_w) |
| 90 | | AM_RANGE(0x1c, 0x1c) AM_READ_PORT("P1_KNOB") |
| 91 | | AM_RANGE(0x1d, 0x1d) AM_READ_PORT("P2_KNOB") |
| 92 | | AM_RANGE(0x1e, 0x1e) AM_READ_PORT("P3_KNOB") |
| 93 | | AM_RANGE(0x1f, 0x1f) AM_READ_PORT("P4_KNOB") |
| 94 | | AM_RANGE(0x18, 0xff) AM_WRITE(astrocade_soundblock1_w) |
| 31 | AM_RANGE(0x00, 0x1f) AM_READWRITE(astrocade_data_chip_register_r, astrocade_data_chip_register_w) |
| 95 | 32 | ADDRESS_MAP_END |
| 96 | 33 | |
| 97 | 34 | |
| r2008 | r2009 | |
| 120 | 57 | *************************************/ |
| 121 | 58 | |
| 122 | 59 | static INPUT_PORTS_START( astrocde ) |
| 123 | | PORT_START_TAG("P1_HANDLE") |
| 124 | | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(1) PORT_8WAY |
| 125 | | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) PORT_8WAY |
| 126 | | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) PORT_8WAY |
| 60 | PORT_START_TAG("P1HANDLE") |
| 61 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(1) PORT_8WAY |
| 62 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(1) PORT_8WAY |
| 63 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(1) PORT_8WAY |
| 127 | 64 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(1) PORT_8WAY |
| 128 | | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) |
| 129 | | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 130 | | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 131 | | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 65 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1) |
| 66 | PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 132 | 67 | |
| 133 | | PORT_START_TAG("P2_HANDLE") |
| 134 | | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(2) PORT_8WAY |
| 135 | | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) PORT_8WAY |
| 136 | | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) PORT_8WAY |
| 68 | PORT_START_TAG("P2HANDLE") |
| 69 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(2) PORT_8WAY |
| 70 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(2) PORT_8WAY |
| 71 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(2) PORT_8WAY |
| 137 | 72 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(2) PORT_8WAY |
| 138 | | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) |
| 139 | | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 140 | | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 141 | | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 73 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2) |
| 74 | PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 142 | 75 | |
| 143 | | PORT_START_TAG("P3_HANDLE") |
| 144 | | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(3) PORT_8WAY |
| 145 | | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(3) PORT_8WAY |
| 146 | | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(3) PORT_8WAY |
| 76 | PORT_START_TAG("P3HANDLE") |
| 77 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(3) PORT_8WAY |
| 78 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(3) PORT_8WAY |
| 79 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(3) PORT_8WAY |
| 147 | 80 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(3) PORT_8WAY |
| 148 | | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(3) |
| 149 | | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 150 | | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 151 | | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 81 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(3) |
| 82 | PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 152 | 83 | |
| 153 | | PORT_START_TAG("P4_HANDLE") |
| 154 | | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(4) PORT_8WAY |
| 155 | | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(4) PORT_8WAY |
| 156 | | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(4) PORT_8WAY |
| 84 | PORT_START_TAG("P4HANDLE") |
| 85 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_PLAYER(4) PORT_8WAY |
| 86 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_PLAYER(4) PORT_8WAY |
| 87 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_PLAYER(4) PORT_8WAY |
| 157 | 88 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_PLAYER(4) PORT_8WAY |
| 158 | | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(4) |
| 159 | | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 160 | | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 161 | | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 89 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(4) |
| 90 | PORT_BIT(0xe0, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 162 | 91 | |
| 163 | | PORT_START_TAG("KEYPAD_COL0") |
| 92 | PORT_START_TAG("KEYPAD0") |
| 164 | 93 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("% \xC3\xB7 [ ] LIST") PORT_CODE(KEYCODE_O) |
| 165 | 94 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("/ x J K L NEXT") PORT_CODE(KEYCODE_SLASH_PAD) |
| 166 | 95 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("x - V W X IF") PORT_CODE(KEYCODE_ASTERISK) |
| 167 | 96 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("- + & @ * GOTO") PORT_CODE(KEYCODE_MINUS_PAD) |
| 168 | 97 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("+ = # % : PRINT") PORT_CODE(KEYCODE_PLUS_PAD) |
| 169 | 98 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("= WORDS Shift") PORT_CODE(KEYCODE_ENTER_PAD) |
| 170 | | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 171 | | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 99 | PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 172 | 100 | |
| 173 | | PORT_START_TAG("KEYPAD_COL1") |
| 101 | PORT_START_TAG("KEYPAD1") |
| 174 | 102 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x93 HALT RUN") PORT_CODE(KEYCODE_PGDN) |
| 175 | 103 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CH 9 G H I STEP") PORT_CODE(KEYCODE_H) |
| 176 | 104 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("9 6 S T U RND") PORT_CODE(KEYCODE_9) |
| 177 | 105 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("6 3 \xE2\x86\x91 . \xE2\x86\x93 BOX") PORT_CODE(KEYCODE_6) |
| 178 | 106 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("3 ERASE ( ; )") PORT_CODE(KEYCODE_3) |
| 179 | 107 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME(". BLUE Shift") PORT_CODE(KEYCODE_STOP) |
| 180 | | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 181 | | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 108 | PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 182 | 109 | |
| 183 | | PORT_START_TAG("KEYPAD_COL2") |
| 110 | PORT_START_TAG("KEYPAD2") |
| 184 | 111 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("\xE2\x86\x91 PAUSE / \\") PORT_CODE(KEYCODE_PGUP) |
| 185 | 112 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MS 8 D E F TO") PORT_CODE(KEYCODE_S) |
| 186 | 113 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("8 5 P Q R RETN") PORT_CODE(KEYCODE_8) |
| 187 | 114 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("5 2 \xE2\x86\x90 ' \xE2\x86\x92 LINE") PORT_CODE(KEYCODE_5) |
| 188 | 115 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("2 0 < \" > INPUT") PORT_CODE(KEYCODE_2) |
| 189 | 116 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("0 RED Shift") PORT_CODE(KEYCODE_0) |
| 190 | | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 191 | | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 117 | PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 192 | 118 | |
| 193 | | PORT_START_TAG("KEYPAD_COL3") |
| 119 | PORT_START_TAG("KEYPAD3") |
| 194 | 120 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("C GO +10") PORT_CODE(KEYCODE_C) |
| 195 | 121 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("MR 7 A B C FOR") PORT_CODE(KEYCODE_R) |
| 196 | 122 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("7 4 M N O GOSB") PORT_CODE(KEYCODE_7) |
| 197 | 123 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("4 1 Y Z ! CLEAR") PORT_CODE(KEYCODE_4) |
| 198 | 124 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("1 SPACE $ , ?") PORT_CODE(KEYCODE_1) |
| 199 | 125 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CE GREEN Shift") PORT_CODE(KEYCODE_E) |
| 200 | | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 201 | | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 126 | PORT_BIT(0xc0, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 202 | 127 | |
| 203 | 128 | PORT_START_TAG("P1_KNOB") |
| 204 | 129 | PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X) PORT_PLAYER(1) |
| r2008 | r2009 | |
| 223 | 148 | |
| 224 | 149 | static MACHINE_DRIVER_START( astrocde ) |
| 225 | 150 | /* basic machine hardware */ |
| 226 | | MDRV_CPU_ADD(Z80, XTAL_Y1/8) /* 1.789 Mhz */ |
| 151 | MDRV_CPU_ADD(Z80, ASTROCADE_CLOCK/4) /* 1.789 Mhz */ |
| 227 | 152 | MDRV_CPU_PROGRAM_MAP(astrocade_mem, 0) |
| 228 | 153 | MDRV_CPU_IO_MAP(astrocade_io, 0) |
| 229 | 154 | |
| 230 | 155 | /* video hardware */ |
| 231 | 156 | MDRV_SCREEN_ADD("main", RASTER) |
| 232 | | MDRV_SCREEN_RAW_PARAMS(XTAL_Y1/2, 455, 0, 320, 268, 0, 204) |
| 157 | MDRV_SCREEN_RAW_PARAMS(ASTROCADE_CLOCK, 455, 0, 352, 262, 0, 240) |
| 233 | 158 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 234 | 159 | |
| 235 | | MDRV_PALETTE_LENGTH(8*32) |
| 236 | | MDRV_PALETTE_INIT(astrocade) |
| 160 | MDRV_PALETTE_LENGTH(512) |
| 161 | MDRV_PALETTE_INIT(astrocde) |
| 237 | 162 | |
| 163 | MDRV_VIDEO_START(astrocde) |
| 238 | 164 | MDRV_VIDEO_UPDATE(astrocde) |
| 239 | | MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_SCANLINE) |
| 240 | 165 | |
| 241 | 166 | /* sound hardware */ |
| 242 | 167 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 243 | | MDRV_SOUND_ADD(ASTROCADE, XTAL_Y1/8) |
| 168 | MDRV_SOUND_ADD(ASTROCADE, ASTROCADE_CLOCK/4) |
| 244 | 169 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 245 | 170 | MACHINE_DRIVER_END |
| 246 | 171 | |
| r2008 | r2009 | |
| 255 | 180 | ROM_START( astrocde ) |
| 256 | 181 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 257 | 182 | ROM_LOAD( "astro.bin", 0x0000, 0x2000, CRC(ebc77f3a) SHA1(b902c941997c9d150a560435bf517c6a28137ecc)) |
| 258 | | ROM_CART_LOAD(0, "bin", 0x2000, 0x8000, ROM_OPTIONAL) |
| 183 | ROM_CART_LOAD(0, "bin", 0x2000, 0x2000, ROM_OPTIONAL) |
| 259 | 184 | ROM_END |
| 260 | 185 | |
| 261 | 186 | ROM_START( astrocdw ) |
| 262 | 187 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 263 | 188 | ROM_LOAD( "bioswhit.bin", 0x0000, 0x2000, CRC(6eb53e79) SHA1(d84341feec1a0a0e8aa6151b649bc3cf6ef69fbf)) |
| 264 | | ROM_CART_LOAD(0, "bin", 0x2000, 0x8000, ROM_OPTIONAL) |
| 189 | ROM_CART_LOAD(0, "bin", 0x2000, 0x2000, ROM_OPTIONAL) |
| 265 | 190 | ROM_END |
| 266 | 191 | |
| 267 | 192 | |
| r2008 | r2009 | |
| 280 | 205 | |
| 281 | 206 | /************************************* |
| 282 | 207 | * |
| 208 | * Driver initialization |
| 209 | * |
| 210 | *************************************/ |
| 211 | |
| 212 | DRIVER_INIT( astrocde ) |
| 213 | { |
| 214 | astrocade_video_config = AC_SOUND_PRESENT | AC_LIGHTPEN_INTS; |
| 215 | } |
| 216 | |
| 217 | |
| 218 | |
| 219 | /************************************* |
| 220 | * |
| 283 | 221 | * Driver definitions |
| 284 | 222 | * |
| 285 | 223 | *************************************/ |
| 286 | 224 | |
| 287 | | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 288 | | CONS( 1978, astrocde, 0, 0, astrocde, astrocde, 0, astrocde, "Bally Manufacturing", "Bally Professional Arcade", 0) |
| 289 | | CONS( 1977, astrocdw, astrocde, 0, astrocde, astrocde, 0, astrocde, "Bally Manufacturing", "Bally Computer System", 0) |
| 225 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 226 | CONS( 1978, astrocde, 0, 0, astrocde, astrocde, astrocde, astrocde, "Bally Manufacturing", "Bally Professional Arcade", GAME_SUPPORTS_SAVE ) |
| 227 | CONS( 1977, astrocdw, astrocde, 0, astrocde, astrocde, astrocde, astrocde, "Bally Manufacturing", "Bally Computer System", GAME_SUPPORTS_SAVE ) |