src/mame/video/midzeus.c
| r0 | r1216 | |
| 1 | /************************************************************************* |
| 2 | |
| 3 | Driver for Midway Zeus games |
| 4 | |
| 5 | **************************************************************************/ |
| 6 | |
| 7 | #include "driver.h" |
| 8 | #include "eminline.h" |
| 9 | #include "includes/midzeus.h" |
| 10 | #include "video/polynew.h" |
| 11 | |
| 12 | |
| 13 | |
| 14 | /************************************* |
| 15 | * |
| 16 | * Constants |
| 17 | * |
| 18 | *************************************/ |
| 19 | |
| 20 | #define WAVERAM_WIDTH 512 |
| 21 | #define WAVERAM_HEIGHT 4096 |
| 22 | |
| 23 | |
| 24 | |
| 25 | /************************************* |
| 26 | * |
| 27 | * Type definitions |
| 28 | * |
| 29 | *************************************/ |
| 30 | |
| 31 | typedef struct _poly_extra_data poly_extra_data; |
| 32 | struct _poly_extra_data |
| 33 | { |
| 34 | const UINT32 * palbase; |
| 35 | const UINT32 * texbase; |
| 36 | UINT16 transcolor; |
| 37 | UINT16 texwidth; |
| 38 | UINT16 color; |
| 39 | UINT32 alpha; |
| 40 | }; |
| 41 | |
| 42 | |
| 43 | |
| 44 | /************************************* |
| 45 | * |
| 46 | * Global variables |
| 47 | * |
| 48 | *************************************/ |
| 49 | |
| 50 | UINT32 *zeusbase; |
| 51 | |
| 52 | static poly_manager *poly; |
| 53 | |
| 54 | static UINT32 zeuscmd_buffer[8]; |
| 55 | static UINT8 zeuscmd_buffer_words; |
| 56 | static UINT8 zeuscmd_buffer_expected_words; |
| 57 | static INT16 zeus_matrix[3][3]; |
| 58 | static INT32 zeus_point[3]; |
| 59 | static UINT32 *zeus_palbase; |
| 60 | static int zeus_enable_logging; |
| 61 | static UINT32 zeus_blend; |
| 62 | static UINT32 zeus_texdata; |
| 63 | static UINT32 zeus_objdata; |
| 64 | |
| 65 | static UINT32 last_tex[1000][2]; |
| 66 | static int last_tex_index; |
| 67 | |
| 68 | static UINT32 *waveram; |
| 69 | |
| 70 | |
| 71 | |
| 72 | /************************************* |
| 73 | * |
| 74 | * Function prototypes |
| 75 | * |
| 76 | *************************************/ |
| 77 | |
| 78 | static void exit_handler(running_machine *machine); |
| 79 | |
| 80 | |
| 81 | |
| 82 | /************************************* |
| 83 | * |
| 84 | * Inlines |
| 85 | * |
| 86 | *************************************/ |
| 87 | |
| 88 | INLINE UINT32 *waveram_ptr_from_addr(UINT32 addr) |
| 89 | { |
| 90 | return &waveram[((addr & 0x1ff) | ((addr & 0xfff000) >> 3)) * 2]; |
| 91 | } |
| 92 | |
| 93 | |
| 94 | INLINE UINT32 *waveram_pixel_ptr(int bank, int y, int x) |
| 95 | { |
| 96 | return &waveram[bank * (WAVERAM_HEIGHT * WAVERAM_WIDTH) + y * WAVERAM_WIDTH + (x & ~1)]; |
| 97 | } |
| 98 | |
| 99 | |
| 100 | INLINE void waveram_plot(int y, int x, UINT16 color) |
| 101 | { |
| 102 | if (x >= 0 && x < 400 && y >= 0 && y < 256) |
| 103 | { |
| 104 | UINT32 *ptr = waveram_pixel_ptr(1, y, x); |
| 105 | if (x & 1) |
| 106 | *ptr = (*ptr & 0x0000ffff) | (color << 16); |
| 107 | else |
| 108 | *ptr = (*ptr & 0xffff0000) | color; |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | |
| 113 | INLINE void waveram_plot_depth(int y, int x, UINT16 color, UINT16 depth) |
| 114 | { |
| 115 | if (x >= 0 && x < 400 && y >= 0 && y < 256) |
| 116 | { |
| 117 | UINT32 *ptr = waveram_pixel_ptr(1, y, x); |
| 118 | if (x & 1) |
| 119 | { |
| 120 | ptr[0] = (ptr[0] & 0x0000ffff) | (color << 16); |
| 121 | ptr[1] = (ptr[1] & 0x0000ffff) | (depth << 16); |
| 122 | } |
| 123 | else |
| 124 | { |
| 125 | ptr[0] = (ptr[0] & 0xffff0000) | color; |
| 126 | ptr[1] = (ptr[1] & 0xffff0000) | depth; |
| 127 | } |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | |
| 132 | INLINE void waveram_plot_check_depth(int y, int x, UINT16 color, UINT16 depth) |
| 133 | { |
| 134 | if (x >= 0 && x < 400 && y >= 0 && y < 256) |
| 135 | { |
| 136 | UINT32 *ptr = waveram_pixel_ptr(1, y, x); |
| 137 | if (x & 1) |
| 138 | { |
| 139 | if (depth <= (ptr[1] >> 16)) |
| 140 | { |
| 141 | ptr[0] = (ptr[0] & 0x0000ffff) | (color << 16); |
| 142 | ptr[1] = (ptr[1] & 0x0000ffff) | (depth << 16); |
| 143 | } |
| 144 | } |
| 145 | else |
| 146 | { |
| 147 | if (depth <= (ptr[1] & 0xffff)) |
| 148 | { |
| 149 | ptr[0] = (ptr[0] & 0xffff0000) | color; |
| 150 | ptr[1] = (ptr[1] & 0xffff0000) | depth; |
| 151 | } |
| 152 | } |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | |
| 157 | INLINE UINT32 *zeus_pixaddr(void) |
| 158 | { |
| 159 | int bank = (zeusbase[0xb6] >> 31) & 1; |
| 160 | int x = (zeusbase[0xb4] & 0xff) << 1; |
| 161 | int y = ((zeusbase[0xb4] >> 15) & 0xffe) | ((zeusbase[0xb4] >> 8) & 0x01); |
| 162 | return waveram_pixel_ptr(bank, y, x); |
| 163 | } |
| 164 | |
| 165 | |
| 166 | INLINE UINT8 get_texel_8bit(const UINT32 *base, int y, int x, int width) |
| 167 | { |
| 168 | if (x >= width) |
| 169 | return 0; |
| 170 | base += (y / 2) * (width / 2) + (x / 4) * 2 + (y & 1); |
| 171 | return *base >> (8 * (x & 3)); |
| 172 | } |
| 173 | |
| 174 | |
| 175 | INLINE UINT8 get_texel_4bit(const UINT32 *base, int y, int x, int width) |
| 176 | { |
| 177 | if (x >= width * 2) |
| 178 | return 0; |
| 179 | base += (y / 2) * (width / 2) + (x / 8) * 2 + (y & 1); |
| 180 | return (*base >> (4 * (x & 7))) & 0x0f; |
| 181 | } |
| 182 | |
| 183 | |
| 184 | |
| 185 | /************************************* |
| 186 | * |
| 187 | * Video startup |
| 188 | * |
| 189 | *************************************/ |
| 190 | |
| 191 | VIDEO_START( midzeus ) |
| 192 | { |
| 193 | int i; |
| 194 | |
| 195 | /* allocate memory for "wave" RAM */ |
| 196 | waveram = auto_malloc(2 * WAVERAM_WIDTH * WAVERAM_HEIGHT * sizeof(*waveram)); |
| 197 | state_save_register_global_pointer(waveram, 2 * WAVERAM_WIDTH * WAVERAM_HEIGHT); |
| 198 | |
| 199 | /* initialize a 5-5-5 palette */ |
| 200 | for (i = 0; i < 32768; i++) |
| 201 | palette_set_color_rgb(machine, i, pal5bit(i >> 10), pal5bit(i >> 5), pal5bit(i >> 0)); |
| 202 | |
| 203 | /* initialize polygon engine */ |
| 204 | poly = poly_alloc(1000, sizeof(poly_extra_data), 0); |
| 205 | |
| 206 | /* we need to cleanup on exit */ |
| 207 | add_exit_callback(machine, exit_handler); |
| 208 | } |
| 209 | |
| 210 | |
| 211 | static void exit_handler(running_machine *machine) |
| 212 | { |
| 213 | FILE *f = fopen("waveram.dmp", "w"); |
| 214 | int i; |
| 215 | |
| 216 | for (i = 0; i < 2 * WAVERAM_WIDTH * WAVERAM_HEIGHT; i += 2) |
| 217 | { |
| 218 | if (i % 8 == 0) fprintf(f, "%03X%03X: ", (i / 1024), (i / 2) & 0x1ff); |
| 219 | fprintf(f, " %08X %08X ", waveram[i+0], waveram[i+1]); |
| 220 | if (i % 8 == 6) fprintf(f, "\n"); |
| 221 | } |
| 222 | fclose(f); |
| 223 | } |
| 224 | |
| 225 | |
| 226 | |
| 227 | /************************************* |
| 228 | * |
| 229 | * Video update |
| 230 | * |
| 231 | *************************************/ |
| 232 | |
| 233 | VIDEO_UPDATE( midzeus ) |
| 234 | { |
| 235 | int x, y; |
| 236 | |
| 237 | /* normal update case */ |
| 238 | if (!input_code_pressed(KEYCODE_W)) |
| 239 | { |
| 240 | for (y = cliprect->min_y; y <= cliprect->max_y; y++) |
| 241 | { |
| 242 | UINT32 *src = waveram_pixel_ptr(1, y, 0); |
| 243 | UINT16 *dest = (UINT16 *)bitmap->base + y * bitmap->rowpixels; |
| 244 | for (x = cliprect->min_x; x <= cliprect->max_x; x += 2) |
| 245 | { |
| 246 | UINT32 pixels = *src; |
| 247 | dest[x+0] = pixels & 0x7fff; |
| 248 | dest[x+1] = (pixels >> 16) & 0x7fff; |
| 249 | src += 2; |
| 250 | } |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | /* waveram drawing case */ |
| 255 | else |
| 256 | { |
| 257 | static int yoffs = 0; |
| 258 | static int width = 256; |
| 259 | UINT32 *base; |
| 260 | |
| 261 | if (input_code_pressed(KEYCODE_DOWN)) yoffs += input_code_pressed(KEYCODE_LSHIFT) ? 0x40 : 1; |
| 262 | if (input_code_pressed(KEYCODE_UP)) yoffs -= input_code_pressed(KEYCODE_LSHIFT) ? 0x40 : 1; |
| 263 | if (input_code_pressed(KEYCODE_LEFT) && width > 4) { width >>= 1; while (input_code_pressed(KEYCODE_LEFT)) ; } |
| 264 | if (input_code_pressed(KEYCODE_RIGHT) && width < 512) { width <<= 1; while (input_code_pressed(KEYCODE_RIGHT)) ; } |
| 265 | |
| 266 | if (yoffs < 0) yoffs = 0; |
| 267 | base = waveram_ptr_from_addr(yoffs << 12); |
| 268 | |
| 269 | for (y = cliprect->min_y; y <= cliprect->max_y; y++) |
| 270 | { |
| 271 | UINT16 *dest = (UINT16 *)bitmap->base + y * bitmap->rowpixels; |
| 272 | for (x = cliprect->min_x; x <= cliprect->max_x; x++) |
| 273 | { |
| 274 | UINT8 tex = get_texel_8bit(base, y, x, width); |
| 275 | dest[x] = (tex << 8) | tex; |
| 276 | } |
| 277 | } |
| 278 | popmessage("offs = %06X", yoffs << 12); |
| 279 | } |
| 280 | |
| 281 | if (input_code_pressed(KEYCODE_T) && last_tex_index != 0) |
| 282 | { |
| 283 | int i; |
| 284 | printf("----\n"); |
| 285 | for (i = 0; i < last_tex_index; i++) |
| 286 | printf("%06X %03X (w=%d)\n", last_tex[i][0], last_tex[i][1], 512 >> ((last_tex[i][1] >> 6) & 7)); |
| 287 | last_tex_index = 0; |
| 288 | } |
| 289 | |
| 290 | return 0; |
| 291 | } |
| 292 | |
| 293 | |
| 294 | |
| 295 | /* |
| 296 | |
| 297 | New analysis: |
| 298 | |
| 299 | Offset |
| 300 | ------ |
| 301 | |
| 302 | $58 W Usually written after $5A; after writing, waits for $F6 bit 4 to be cleared |
| 303 | |
| 304 | $5A W Usually written first, followed by $58 |
| 305 | |
| 306 | $68 W Written at startup: |
| 307 | $00030000 = toggled on then off at startup |
| 308 | |
| 309 | $76 W |
| 310 | |
| 311 | $7C W |
| 312 | |
| 313 | $80 W Master control |
| 314 | |
| 315 | $40000000 = set along with $02000000 when enabling FIFO empty interrupt |
| 316 | $02000000 = enable internal data FIFO empty interrupt |
| 317 | $01000000 = cleared along with $02000000 when disabling FIFO empty interrupt |
| 318 | $00020000 = 16-bit (0) or 32-bit (1) mode |
| 319 | $00000008 = cleared just before writing to offsets $200-$3FF |
| 320 | |
| 321 | $82 W |
| 322 | $84 W |
| 323 | $86 W |
| 324 | $88 W |
| 325 | $8A W |
| 326 | $8C W |
| 327 | $8E W |
| 328 | |
| 329 | $B0 R/W Data port for direct RAM access |
| 330 | $B2 R/W Data port for direct RAM access |
| 331 | |
| 332 | $B4 W Address for direct RAM access |
| 333 | |
| 334 | $07FF0100 = mask for Y coordinate |
| 335 | $000000FF = mask for X coordinate |
| 336 | |
| 337 | $B6 W Direct RAM access control |
| 338 | |
| 339 | $80000000 = enable writes to wave RAM 0 |
| 340 | $40000000 = enable writes to wave RAM 1 |
| 341 | $02000000 = perform access on write to B0(0) or B2(1) ????? |
| 342 | $00800000 = enable writes from [$B2] to depth buffer |
| 343 | $00400000 = enable writes from [$B0] to depth buffer |
| 344 | $00200000 = enable writes from [$B2] to RAM buffer |
| 345 | $00100000 = enable writes from [$B0] to RAM buffer |
| 346 | $00020000 = auto increment the address |
| 347 | $00010000 = perform a read when the address is written |
| 348 | $00000001 = enable direct RAM access |
| 349 | |
| 350 | Examples: |
| 351 | $80A00000 when writing a single pixel (address written each time) |
| 352 | $80A20001 when writing the right pixel of a pair (autoinc assumed) |
| 353 | $80F60001 when writing the middle pairs of pixels (autoinc assumed) |
| 354 | $80520001 when writing the left pixel of a pair (autoinc assumed) |
| 355 | $82F00001 when testing wave RAM page 1 (address written each pair) |
| 356 | $42F00001 when testing wave RAM page 0 (address written each pair) |
| 357 | $82F60001 when uploading to wave RAM page 1 (autoinc assumed) |
| 358 | $42F60001 when uploading to wave RAM page 0 (autoinc assumed) |
| 359 | |
| 360 | $C0 W Written at startup = $801F2500 |
| 361 | $C2 W Written at startup = $0015E591 |
| 362 | $C4 W Written at startup = $000C0042 (HSYNC start/HSYNC end?) |
| 363 | $C6 W Written at startup = $0211007F (HTOTAL/HBLANK end?) |
| 364 | $C8 W Written at startup = $010300FF (VSYNC start/VBLANK start?) |
| 365 | $CA W Written at startup = $01160107 (VTOTAL/VSYNC end?) |
| 366 | $CC W Written at startup = $00000000 |
| 367 | $CE W Written at startup = $00C87620 |
| 368 | |
| 369 | $E0 W Internal data FIFO |
| 370 | |
| 371 | $F2 R Looped on until it returns a stable value; must change frequently; PRNG? |
| 372 | |
| 373 | $F4 R Status register |
| 374 | |
| 375 | $00000800 = VBLANK? code waits for it to clear to 0 and then reset to 1 |
| 376 | $00000140 = tested together in tight loop until both are 0 |
| 377 | $00000008 = internal data FIFO full |
| 378 | $00000004 = tested in tight loop along with $00000002 until at least one is set |
| 379 | $00000002 = tested in tight loop after handling FIFO interrupt until set |
| 380 | |
| 381 | $F6 R Status register 2 |
| 382 | |
| 383 | $00000010 = tested in tight loop after writing 5A/59/58 until set to 0 |
| 384 | |
| 385 | $200- W Unknown, but written in a loop with master control bit $00000008 cleared |
| 386 | $3FF Possible fast buffer clear? One set of writes stores $7F7F to all entries. |
| 387 | A second set writes $E00,$25,$E01,$25,...,$E7F,$25. A third set writes |
| 388 | $52,$A0000000,... |
| 389 | |
| 390 | Notes: |
| 391 | |
| 392 | In 16-bit mode, writes to $E0 are done via $E1 first then $E0 |
| 393 | |
| 394 | ------------------------------------------------------- |
| 395 | |
| 396 | Old info: |
| 397 | |
| 398 | offset B7 = control.... |
| 399 | |
| 400 | 8000 = page 1 enable |
| 401 | 4000 = page 0 enable |
| 402 | |
| 403 | 0080 = 2nd pixel enable (maybe Z buff?) |
| 404 | 0040 = 1st pixel enable (maybe Z buff?) |
| 405 | 0020 = 2nd pixel enable |
| 406 | 0010 = 1st pixel enable |
| 407 | |
| 408 | |
| 409 | writes 80a2 to write an odd pixel at startup |
| 410 | writes 80f6 to write the middle pixels |
| 411 | writes 8052 to write an odd pixel at the end |
| 412 | |
| 413 | writes 8050 before writing an odd pixel |
| 414 | writes 80a0 before writing an even pixel |
| 415 | |
| 416 | writes 44f1 before reading from page 0 of wave ram |
| 417 | writes 84f1 before reading from page 1 of wave ram |
| 418 | |
| 419 | writes 42f0 before writing to page 0 of wave ram |
| 420 | writes 82f0 before writing to page 1 of wave ram |
| 421 | |
| 422 | */ |
| 423 | |
| 424 | /* |
| 425 | zeus data notes: |
| 426 | |
| 427 | Data from $1000-1A20 |
| 428 | Palettes at $2000,$2200,$2400 |
| 429 | Data from $2600-27C7 |
| 430 | Palettes at $27C8,$29C8,$2BC8,$2DC8 |
| 431 | Palettes up through $5A000 |
| 432 | |
| 433 | Interesting data at $5A000-5BFFF |
| 434 | |
| 435 | Common sequence: |
| 436 | $8000 xxxx $0C01 $3805 |
| 437 | x = matches address of next data * 8 |
| 438 | */ |
| 439 | |
| 440 | |
| 441 | |
| 442 | /* |
| 443 | Control = $80F6 when doing initial screen clear. |
| 444 | Writes 256 consecutive values to $B0, must mean autoincrement |
| 445 | Uses latched value in $B2 (maybe also in $B0) |
| 446 | |
| 447 | Control = $82F0 when doing video RAM test write phase. |
| 448 | Writes 512 values across, but updates address before each one. |
| 449 | |
| 450 | Control = $84F1 when doing video RAM test read phase. |
| 451 | Reads 512 values across, but updates address before each one. |
| 452 | |
| 453 | Control = $80F2 when doing screen clear. |
| 454 | Writes 256 consecutive values to $B0, must mean autoincrement. |
| 455 | Uses latched value in $B2 (maybe also in $B0) |
| 456 | |
| 457 | Control = $80A0/$8050 when plotting pixels. |
| 458 | |
| 459 | Control = $42F0 when doing wave RAM test write phase. |
| 460 | Writes 512 values across, but updates address before each one. |
| 461 | |
| 462 | Control = $44F1 when doing wave RAM test read phase. |
| 463 | Reads 512 values across, but updates address before each one. |
| 464 | */ |
| 465 | |
| 466 | |
| 467 | /* |
| 468 | |
| 469 | Known commands: |
| 470 | |
| 471 | $00rrxxxx = another type of register set? |
| 472 | yyyyyyyy |
| 473 | |
| 474 | $0000C040 = set palette to 'yyyyyyyy' |
| 475 | |
| 476 | $17rrxxxx = 16-bit write 'xxxx' to register 'rr' |
| 477 | |
| 478 | $1752xxxx = write 'xxxx' to something that reflects back through $B2 |
| 479 | $1770xxxx = write 'xxxx' to upper 16 bits of X coordinate |
| 480 | $1772xxxx = write 'xxxx' to upper 16 bits of Y coordinate |
| 481 | $1774xxxx = write 'xxxx' to upper 16 bits of Z coordinate |
| 482 | |
| 483 | $18rr0000 = 32-bit write 'xxxxxxxx' to register 'rr' |
| 484 | xxxxxxxx |
| 485 | |
| 486 | $1A000000 = pipeline synchronize (guess) |
| 487 | |
| 488 | $1C00cccc = load matrix (abc)(def)(ghi) and point (xyz) |
| 489 | ffffiiii |
| 490 | bbbbaaaa |
| 491 | eeeedddd |
| 492 | hhhhgggg |
| 493 | xxxxxxxx |
| 494 | yyyyyyyy |
| 495 | zzzzzzzz |
| 496 | |
| 497 | $6700xxxx = render object described at 'bbbbbb' in waveram |
| 498 | aabbbbbb |
| 499 | ccddcccc |
| 500 | */ |
| 501 | |
| 502 | /* |
| 503 | Zeus cmd 18 : 18D60000 500A00FF |
| 504 | Zeus cmd 00 : 0005C0A5 21001125 |
| 505 | Zeus cmd 25 : 25000000 007F0018 01000400 B0F60008 |
| 506 | Zeus cmd 18 : 18D60000 500A00FF |
| 507 | Zeus cmd 18 : 18CE0000 00FFFFFF |
| 508 | Zeus cmd 1A : 1A000000 |
| 509 | Zeus cmd 18 : 187E0000 0000FFFF |
| 510 | Zeus cmd 1A : 1A000000 |
| 511 | Zeus cmd 18 : 18CE0000 00FFFFFF |
| 512 | Zeus cmd 1A : 1A000000 |
| 513 | Zeus cmd 18 : 187E0000 FF980000 |
| 514 | Zeus cmd 00 : 0080C0A5 3F00102F |
| 515 | Zeus cmd 17 : 17681370 |
| 516 | Zeus cmd 17 : 176940C4 |
| 517 | Zeus cmd 1C : ( 4000 0000 0000 ) ( 0000 4000 0000 ) ( 0000 0000 4000 ) -152.00 -50.00 1.25000 |
| 518 | Zeus cmd 00 : 0000C040 0318E132 -> palette @ (18E,132) |
| 519 | Zeus cmd 67 : 67008000 0919F1C4 151 01FA4C -> render @ (19F,1C4) |
| 520 | Zeus cmd 1C : ( 4000 0000 0000 ) ( 0000 4000 0000 ) ( 0000 0000 4000 ) -135.00 -50.00 1.25000 |
| 521 | Zeus cmd 67 : 67008000 0919F1C4 151 01FA4C |
| 522 | Zeus cmd 1C : ( 4000 0000 0000 ) ( 0000 4000 0000 ) ( 0000 0000 4000 ) -118.00 -50.00 1.25000 |
| 523 | Zeus cmd 67 : 67008000 0919F1C4 151 01F988 |
| 524 | Zeus cmd 1C : ( 4000 0000 0000 ) ( 0000 4000 0000 ) ( 0000 0000 4000 ) -101.00 -50.00 1.25000 |
| 525 | |
| 526 | 19F1BA: 19DC0000 00000000 19840000 00F01605 25810000 21010000 FFD00000 00000000 FFD00038 000E0000 00080038 0E0E0000 00080000 0E000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 527 | 19F1C4: 19DC0000 00000000 19840000 00F01605 25800000 21010000 FFD0FFFC 00000000 FFD0003C 00100000 0008003C 0E100000 0008FFFC 0E000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 528 | 19F1CE: 19DC0000 00000000 19840000 00F01605 25800000 21010000 FFD0FFFC 00000000 FFD00028 000B0000 00080028 0E0B0000 0008FFFC 0E000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 529 | 19F1D8: 19DC0000 00000000 19840000 00F01605 25800000 21010000 FFD00000 00000000 FFD00034 000D0000 00080034 0E0D0000 00080000 0E000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 530 | 19F1E2: 19DC0000 00000000 19840000 00F01605 25800000 21010000 FFD00000 00000000 FFD00028 000A0000 000C0028 0F0A0000 000C0000 0F000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 531 | 19F1EC: 19DC0000 00000000 19840000 00F01605 25800000 21010000 FFD00000 00000000 FFD00014 00050000 00080014 0E050000 00080000 0E000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 532 | 19F1F6: 19DC0000 00000000 19840000 00F01605 25810000 21010000 FFD0FFFC 00000000 FFD00034 000E0000 00080034 0E0E0000 0008FFFC 0E000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 533 | 1A0000: 19DC0000 00000000 19840000 00F01605 25800000 21010000 FFCC0000 00000000 FFCC0038 000E0000 000C0038 100E0000 000C0000 10000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 534 | 1A000A: 19DC0000 00000000 19840000 00F01605 25800000 21010000 FFCC0000 00000000 FFCC0034 000D0000 000C0034 100D0000 000C0000 10000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 535 | 1A0014: 19DC0000 00000000 19840000 00F01605 25800000 21010000 FFCC0000 00000000 FFCC002C 000B0000 0008002C 0F0B0000 00080000 0F000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 536 | 1A001E: 19DC0000 00000000 19840000 00F01605 25800000 21010000 FFCC0000 00000000 FFCC002C 000B0000 000C002C 100B0000 000C0000 10000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 537 | 1A0028: 19DC0000 00000000 19840000 00F01605 25800000 21010000 FFD00000 00000000 FFD0002C 000B0000 000C002C 0F0B0000 000C0000 0F000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 538 | 1A0032: 19DC0000 00000000 19840000 00F01605 25800000 21010000 FFD00000 00000000 FFD00018 00060000 00080018 0E060000 00080000 0E000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 539 | 1A003C: 19DC0000 40B68800 19840000 00001604 25800000 21010000 FF9CFF64 00000000 FF9C0084 00480000 005C0084 30480000 005CFF64 30000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 540 | 1A0046: 19DC0000 40B68800 19840000 00001604 25800000 21010000 FF80FF48 00000000 FF80009C 00550000 0070009C 3C550000 0070FF48 3C000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 541 | 1A0050: 19DC0000 40B68800 19840000 00001604 25800000 21010000 FF68FF30 00000000 FF6800B0 00600000 008800B0 48600000 0088FF30 48000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 542 | 1A005A: 19DC0000 40B68800 19840000 00001604 25800000 21010000 FF54FF20 00000000 FF5400C4 00690000 00A000C4 53690000 00A0FF20 53000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 543 | 1A0064: 19DC0000 40B68800 19840000 00001604 25800000 21010000 FF44FF10 00000000 FF4400D4 00710000 00B000D4 5B710000 00B0FF10 5B000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 544 | 1A006E: 19DC0000 40B68800 19840000 00001604 25800000 21010000 FF3CFF08 00000000 FF3C00E4 00770000 00B400E4 5E770000 00B4FF08 5E000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 545 | 1A0078: 19DC0000 40B68800 19840000 00001604 25800000 21010000 FF38FEFC 00000000 FF3800E4 007A0000 00C000E4 627A0000 00C0FEFC 62000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 546 | 1A0082: 19DC0000 40B68800 19840000 00001604 25800000 21010000 FF28FEFC 00000000 FF2800EC 007C0000 00C000EC 667C0000 00C0FEFC 66000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 547 | 1A008C: 19DC0000 40B68800 19840000 00001604 25800000 21010000 FF60FF28 00000000 FF6000C0 00660000 009C00C0 4F660000 009CFF28 4F000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 548 | 1A0096: 19DC0000 40B68800 19840000 00001604 25800000 21010000 FF80FF48 00000000 FF80009C 00550000 0078009C 3E550000 0078FF48 3E000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 549 | 1A00A0: 19DC0000 40B68800 19840000 00001604 25800000 21010000 FF94FF5C 00000000 FF940088 004B0000 00640088 344B0000 0064FF5C 34000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 550 | 1A00AA: 19DC0000 40B68800 19840000 00001604 25810000 21010000 FFA4FF6C 00000000 FFA4007C 00440000 0054007C 2C440000 0054FF6C 2C000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 551 | 1A00B4: 19DC0000 40B68800 19840000 00001604 25800000 21010000 FFACFF78 00000000 FFAC0070 003E0000 00480070 273E0000 0048FF78 27000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 552 | 1A00BE: 19DC0000 40B68800 19840000 00001604 25800000 21010000 FFB4FF7C 00000000 FFB4006C 003C0000 0044006C 243C0000 0044FF7C 24000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 553 | 1A00C8: 19DC0000 00000000 19840000 00001605 25800000 21000000 FF42FF02 00000000 FF4200FE 007F0000 00BE00FE 5F7F0000 00BEFF02 5F000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 554 | 1A00D2: 19DC0000 00000000 19840000 00001605 25800000 21010000 FFB0FF70 00000000 FFB0007C 00430000 0054007C 29430000 0054FF70 29000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 555 | 1A00DC: 19DC0000 40B68800 19840000 00001604 25800000 21010000 FA10F810 00000000 FA1007F0 007F0000 05F007F0 5F7F0000 05F0F810 5F000000 30000000 30000000 30000000 30000000 08000000 00000000 |
| 556 | 1A00E6: 0C02C0F0 0F18E1BE |
| 557 | 19DC0000 4B23CB00 19840000 00001605 252978EF 200C0000 04480000 00000000 043D0000 0000001E 043DFFEB 00000015 043DFFEB 00000015 00040000 0A331400 0743178C 0743178C |
| 558 | 1A00F0: 251178D7 200C0000 04480000 00000000 043DFFEB 00000015 043DFFE2 00000000 043DFFE2 00000000 00040000 0743178C 0003175D 0003175D |
| 559 | 25EF78D7 200C0000 04480000 00000000 043DFFE2 00000000 043DFFEB 0000FFEB 043DFFEB 0000FFEB 00040000 0003175D 38C3178C 38C3178C |
| 560 | 25D778EF 200C0000 04480000 00000000 043DFFEB 0000FFEB 043D0000 0000FFE2 043D0000 0000FFE2 00040000 38C3178C 35D31400 35D31400 |
| 561 | 25D77811 200C0000 04480000 00000000 043D0000 0000FFE2 043D0015 0000FFEB 043D0015 0000FFEB 00040000 35D31400 38C31474 38C31474 |
| 562 | 1A010C: 25EF7829 200C0000 04480000 00000000 043D0015 0000FFEB 043D001E 00000000 043D001E 00000000 00040000 38C31474 000314A3 000314A3 |
| 563 | 25117829 200C0000 04480000 00000000 043D001E 00000000 043D0015 00000015 043D0015 00000015 00040000 000314A3 07431474 07431474 |
| 564 | 25297811 200C0000 04480000 00000000 043D0015 00000015 043D0000 0000001E 043D0000 0000001E 00040000 07431474 0A331400 0A331400 |
| 565 | 0C018000 381A0122 |
| 566 | 252186F3 200C0000 F64A0000 00000000 F652FFEB 00000015 F6520000 0000001E F6520000 0000001E 000C0000 06ECD393 09ACD3FF 09ACD3FF |
| 567 | 250D86DF 200C0000 F64A0000 00000000 F652FFE2 00000000 F652FFEB 00000015 F652FFEB 00000015 000C0000 001CD366 06DCD392 06DCD392 |
| 568 | 1A0130: 25F386DF 200C0000 F64A0000 00000000 F652FFEB 0000FFEB F652FFE2 00000000 F652FFE2 00000000 000C0000 393CD392 3FFCD366 3FFCD366 |
| 569 | 25DF86F3 200C0000 F64A0000 00000000 F6520000 0000FFE2 F652FFEB 0000FFEB F652FFEB 0000FFEB 000C0000 366CD3FF 392CD393 392CD393 |
| 570 | 25DF860D 200C0000 F64A0000 00000000 F6520015 0000FFEB F6520000 0000FFE2 F6520000 0000FFE2 000C0000 392CD06D 366CD001 366CD001 |
| 571 | 25F38621 200C0000 F64A0000 00000000 F652001E 00000000 F6520015 0000FFEB F6520015 0000FFEB 000C0000 3FFCD09A 393CD06E 393CD06E |
| 572 | 1A014C: 250D8621 200C0000 F64A0000 00000000 F6520015 00000015 F652001E 00000000 F652001E 00000000 000C0000 06DCD06E 001CD09A 001CD09A |
| 573 | 2521860D 200C0000 F6520000 0000001E F6520015 00000015 F64A0000 00000000 F64A0000 00000000 09ACD001 06ECD06D 000C0000 000C0000 |
| 574 | 0C018000 381A015B |
| 575 | 25D53969 200C0000 0429001D 0000FFE3 04290029 00000000 043D001E 00000000 043D0015 0000FFEB 356110B3 3FA110F7 3EB2D8B3 3902D88D |
| 576 | 252B3969 200C0000 04290029 00000000 0429001D 0000001D 043D0015 00000015 043D001E 00000000 006110F7 0AA110B3 0702D88D 0152D8B3 |
| 577 | 2569392B 200C0000 0429001D 0000001D 04290000 00000029 043D0000 0000001E 043D0015 00000015 0B3110AA 0F711006 0B32D815 08D2D870 |
| 578 | 1A0170: 256939D5 200C0000 04290000 00000029 0429FFE3 0000001D 043DFFEB 00000015 043D0000 0000001E 0F7113FA 0B311356 08D2DB90 0B32DBEB |
| 579 | 252B3997 200C0000 0429FFE3 0000001D 0429FFD7 00000000 043DFFE2 00000000 043DFFEB 00000015 0AA1134D 00611309 0152DB4D 0702DB73 |
| 580 | 25D53997 200C0000 0429FFD7 00000000 0429FFE3 0000FFE3 043DFFEB 0000FFEB 043DFFE2 00000000 3FA11309 3561134D 3902DB73 3EB2DB4D |
| 581 | 259739D5 200C0000 0429FFE3 0000FFE3 04290000 0000FFD7 043D0000 0000FFE2 043DFFEB 0000FFEB 34D11356 309113FA 34D2DBEB 3732DB90 |
| 582 | 1A018C: 2597392B 200C0000 04290000 0000FFD7 0429001D 0000FFE3 043D0015 0000FFEB 043D0000 0000FFE2 30911006 34D110AA 3732D870 34D2D815 |
| 583 | 0C018000 381A0194 |
| 584 | 1A0194: 252BC769 200C0000 F666001D 0000001D F6660029 00000000 F652001E 00000000 F6520015 00000015 0AAEF0B3 006EF0F7 018D20B0 06CD208D |
| 585 | 25D5C769 200C0000 F6660029 00000000 F666001D 0000FFE3 F6520015 0000FFEB F652001E 00000000 3FAEF0F7 356EF0B3 394D208D 3E8D20B0 |
| 586 | 2597C72B 200C0000 F666001D 0000FFE3 F6660000 0000FFD7 F6520000 0000FFE2 F6520015 0000FFEB 34DEF0AA 309EF006 350D2018 373D206C |
| 587 | 2597C7D5 200C0000 F6660000 0000FFD7 F666FFE3 0000FFE3 F652FFEB 0000FFEB F6520000 0000FFE2 309EF3FA 34DEF356 373D2394 350D23E8 |
| 588 | 1A01B0: 25D5C797 200C0000 F666FFE3 0000FFE3 F666FFD7 00000000 F652FFE2 00000000 F652FFEB 0000FFEB 356EF34D 3FAEF309 3E8D2350 394D2373 |
| 589 | 252BC797 200C0000 F666FFD7 00000000 F666FFE3 0000001D F652FFEB 00000015 F652FFE2 00000000 006EF309 0AAEF34D 06CD2373 018D2350 |
| 590 | 2569C7D5 200C0000 F666FFE3 0000001D F6660000 00000029 F6520000 0000001E F652FFEB 00000015 0B3EF356 0F7EF3FA 0B0D23E8 08DD2394 |
| 591 | 2569C72B 200C0000 F6660000 00000029 F666001D 0000001D F6520015 00000015 F6520000 0000001E 0F7EF006 0B3EF0AA 08DD206C 0B0D2018 |
| 592 | 1A01CC: 0C018000 311A01CD |
| 593 | 25300076 200C0000 F6660029 00000000 F666001D 0000001D 0429001D 0000001D 04290029 00000000 00FF24FA 0A6F24BB 0A60DCBB 00F0DCFA |
| 594 | 1A01D4: 25760030 200C0000 F666001D 0000001D F6660000 00000029 04290000 00000029 0429001D 0000001D 0BBF24A6 0FAF240F 0FA0DC0F 0BB0DCA6 |
| 595 | 257600D0 200C0000 F6660000 00000029 F666FFE3 0000001D 0429FFE3 0000001D 04290000 00000029 0FAF27F1 0BBF275A 0BB0DF5A 0FA0DFF1 |
| 596 | 2530008A 200C0000 F666FFE3 0000001D F666FFD7 00000000 0429FFD7 00000000 0429FFE3 0000001D 0A6F2745 00FF2706 00F0DF06 0A60DF45 |
| 597 | 25D0008A 200C0000 F666FFD7 00000000 F666FFE3 0000FFE3 0429FFE3 0000FFE3 0429FFD7 00000000 3F1F2706 35AF2745 35A0DF45 3F10DF06 |
| 598 | 1A01F0: 258A00D0 200C0000 F666FFE3 0000FFE3 F6660000 0000FFD7 04290000 0000FFD7 0429FFE3 0000FFE3 345F275A 306F27F1 3060DFF1 3450DF5A |
| 599 | 258A0030 200C0000 F6660000 0000FFD7 F666001D 0000FFE3 0429001D 0000FFE3 04290000 0000FFD7 306F240F 345F24A6 3450DCA6 3060DC0F |
| 600 | 0C018000 071A1000 00000000 00000000 |
| 601 | 1A1000: 25D00076 200C0000 F666001D 0000FFE3 F6660029 00000000 04290029 00000000 0429001D 0000FFE3 35AF24BB 3F1F24FA 3F10DCFA 35A0DCBB |
| 602 | 08000000 00000000 |
| 603 | */ |
| 604 | |
| 605 | |
| 606 | static void render_poly_4bit(void *dest, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid) |
| 607 | { |
| 608 | poly_extra_data *extra = poly->extra; |
| 609 | float ooz = poly_param_value(startx, scanline, 0, poly); |
| 610 | float uoz = poly_param_value(startx, scanline, 1, poly); |
| 611 | float voz = poly_param_value(startx, scanline, 2, poly); |
| 612 | float doozdx = poly->param[0].dpdx; |
| 613 | float duozdx = poly->param[1].dpdx; |
| 614 | float dvozdx = poly->param[2].dpdx; |
| 615 | const UINT32 *texbase = extra->texbase; |
| 616 | const UINT32 *palbase = extra->palbase; |
| 617 | UINT16 transcolor = extra->transcolor; |
| 618 | int texwidth = extra->texwidth; |
| 619 | int x; |
| 620 | |
| 621 | for (x = startx; x < stopx; x++) |
| 622 | { |
| 623 | float z = recip_approx(ooz); |
| 624 | int u = (int)(uoz * z) & ((texwidth * 2) - 1); |
| 625 | int v = (int)(voz * z) & 255; |
| 626 | UINT8 texel = get_texel_4bit(texbase, v, u, texwidth); |
| 627 | if (texel != transcolor) |
| 628 | { |
| 629 | UINT16 color = palbase[texel >> 1] >> (16 * (texel & 1)); |
| 630 | INT32 depth = z * 256.0f; |
| 631 | if (depth > 0x7fff) depth = 0x7fff; |
| 632 | if (depth >= 0) |
| 633 | waveram_plot_check_depth(scanline, x, color, depth); |
| 634 | } |
| 635 | |
| 636 | ooz += doozdx; |
| 637 | uoz += duozdx; |
| 638 | voz += dvozdx; |
| 639 | } |
| 640 | } |
| 641 | |
| 642 | |
| 643 | static void render_poly_8bit(void *dest, INT32 scanline, INT32 startx, INT32 stopx, const poly_params *poly, int threadid) |
| 644 | { |
| 645 | poly_extra_data *extra = poly->extra; |
| 646 | float ooz = poly_param_value(startx, scanline, 0, poly); |
| 647 | float uoz = poly_param_value(startx, scanline, 1, poly); |
| 648 | float voz = poly_param_value(startx, scanline, 2, poly); |
| 649 | float doozdx = poly->param[0].dpdx; |
| 650 | float duozdx = poly->param[1].dpdx; |
| 651 | float dvozdx = poly->param[2].dpdx; |
| 652 | const UINT32 *texbase = extra->texbase; |
| 653 | const UINT32 *palbase = extra->palbase; |
| 654 | UINT16 transcolor = extra->transcolor; |
| 655 | int texwidth = extra->texwidth; |
| 656 | int x; |
| 657 | |
| 658 | for (x = startx; x < stopx; x++) |
| 659 | { |
| 660 | float z = recip_approx(ooz); |
| 661 | int u = (int)(uoz * z) & (texwidth - 1); |
| 662 | int v = (int)(voz * z) & 255; |
| 663 | UINT8 texel = get_texel_8bit(texbase, v, u, texwidth); |
| 664 | if (texel != transcolor) |
| 665 | { |
| 666 | UINT16 color = palbase[texel >> 1] >> (16 * (texel & 1)); |
| 667 | INT32 depth = z * 256.0f; |
| 668 | if (depth > 0x7fff) depth = 0x7fff; |
| 669 | if (depth >= 0) |
| 670 | waveram_plot_check_depth(scanline, x, color, depth); |
| 671 | } |
| 672 | |
| 673 | ooz += doozdx; |
| 674 | uoz += duozdx; |
| 675 | voz += dvozdx; |
| 676 | } |
| 677 | } |
| 678 | |
| 679 | |
| 680 | static void zeus_draw_polys(UINT32 addr_and_count, UINT32 texdata, int logcmd) |
| 681 | { |
| 682 | static UINT32 *loglist[1000]; |
| 683 | static int loglist_last = 0; |
| 684 | UINT32 *data = waveram_ptr_from_addr(addr_and_count); |
| 685 | UINT32 val1, val2; |
| 686 | int i, logit = FALSE; |
| 687 | int texwshift; |
| 688 | int testbit = 0; |
| 689 | |
| 690 | val1 = ((texdata >> 10) & 0x3f0000) | (texdata & 0xffff); |
| 691 | val2 = (texdata >> 16) & 0x3ff; |
| 692 | texwshift = (val2 >> 6) & 7; |
| 693 | |
| 694 | if (logcmd) |
| 695 | { |
| 696 | int texwshift = (val2 >> 6) & 7; |
| 697 | logerror("Zeus cmd 67 : %08X %08X %03X %06X (w=%d adj=%03X%03X)\n", |
| 698 | zeuscmd_buffer[0], addr_and_count, val2, val1, |
| 699 | 512 >> texwshift, |
| 700 | ((val1 << (7 - texwshift)) >> 10) & 0xfff, |
| 701 | ((val1 << (7 - texwshift)) >> 1) & 0x1ff |
| 702 | ); |
| 703 | } |
| 704 | |
| 705 | for (i = 0; i < last_tex_index; i++) |
| 706 | if (last_tex[i][0] == val1 && last_tex[i][1] == val2) |
| 707 | break; |
| 708 | if (i == last_tex_index) |
| 709 | { |
| 710 | last_tex[i][0] = val1; |
| 711 | last_tex[i][1] = val2; |
| 712 | last_tex_index++; |
| 713 | } |
| 714 | |
| 715 | if (logcmd) |
| 716 | { |
| 717 | for (i = 0; i < loglist_last; i++) |
| 718 | if (loglist[i] == data) |
| 719 | break; |
| 720 | logit = (i == loglist_last); |
| 721 | if (i == loglist_last) |
| 722 | loglist[loglist_last++] = data; |
| 723 | } |
| 724 | |
| 725 | if (input_code_pressed(KEYCODE_Z)) testbit = 1; |
| 726 | if (input_code_pressed(KEYCODE_X)) testbit = 2; |
| 727 | if (input_code_pressed(KEYCODE_C)) testbit = 3; |
| 728 | if (input_code_pressed(KEYCODE_V)) testbit = 4; |
| 729 | if (input_code_pressed(KEYCODE_B)) testbit = 5; |
| 730 | if (input_code_pressed(KEYCODE_N)) testbit = 6; |
| 731 | if (input_code_pressed(KEYCODE_M)) testbit = 7; |
| 732 | |
| 733 | if (testbit != 0) |
| 734 | texwshift = testbit; |
| 735 | |
| 736 | while (1) |
| 737 | { |
| 738 | const UINT32 *data = waveram_ptr_from_addr(addr_and_count); |
| 739 | int count = ((addr_and_count >> 24) + 1) * 2; |
| 740 | UINT32 next_addr_and_count = 0; |
| 741 | int datanum; |
| 742 | int length; |
| 743 | |
| 744 | for (datanum = 0; datanum < count; datanum += length * 2) |
| 745 | { |
| 746 | int offs; |
| 747 | |
| 748 | length = ((data[datanum] >> 24) == 0x25 || (data[datanum] >> 24) == 0x30) ? 7 : 1; |
| 749 | |
| 750 | if (logit) |
| 751 | { |
| 752 | logerror("\t%08X", data[datanum]); |
| 753 | for (offs = 1; offs < length * 2; offs++) |
| 754 | logerror(" %08X", data[datanum + offs]); |
| 755 | logerror("\n"); |
| 756 | } |
| 757 | |
| 758 | if ((data[datanum] >> 24) == 0x25 || (data[datanum] >> 24) == 0x30 /* invasn */) |
| 759 | { |
| 760 | poly_draw_scanline callback; |
| 761 | poly_extra_data *extra; |
| 762 | poly_vertex vert[4]; |
| 763 | int i; |
| 764 | |
| 765 | callback = (val2 & 0x20) ? render_poly_8bit : render_poly_4bit; |
| 766 | |
| 767 | for (i = 0; i < 4; i++) |
| 768 | { |
| 769 | UINT32 ixy = data[datanum + 2 + 2*i]; |
| 770 | UINT32 iuvz = data[datanum + 3 + 2*i]; |
| 771 | INT32 xo = (INT16)ixy; |
| 772 | INT32 yo = (INT16)(ixy >> 16); |
| 773 | INT32 zo = (INT16)iuvz; |
| 774 | UINT8 u = iuvz >> 16; |
| 775 | UINT8 v = iuvz >> 24; |
| 776 | float z, ooz; |
| 777 | |
| 778 | vert[i].x = (xo * zeus_matrix[0][0] + yo * zeus_matrix[0][1] + zo * zeus_matrix[0][2] + zeus_point[0]) * (1.0f / 65536.0f); |
| 779 | vert[i].y = (xo * zeus_matrix[1][0] + yo * zeus_matrix[1][1] + zo * zeus_matrix[1][2] + zeus_point[1]) * (1.0f / 65536.0f); |
| 780 | z = (xo * zeus_matrix[2][0] + yo * zeus_matrix[2][1] + zo * zeus_matrix[2][2] + zeus_point[2]) * (1.0f / (512.0f * 65536.0f)); |
| 781 | |
| 782 | ooz = 1.0f / z; |
| 783 | vert[i].x *= ooz; |
| 784 | vert[i].y *= ooz; |
| 785 | vert[i].p[0] = ooz; |
| 786 | vert[i].p[1] = u * ooz; |
| 787 | vert[i].p[2] = v * ooz; |
| 788 | |
| 789 | vert[i].x += 200.0f; |
| 790 | vert[i].y += 128.0f; |
| 791 | } |
| 792 | |
| 793 | val1 <<= 7 - texwshift; |
| 794 | |
| 795 | extra = poly_get_extra_data(poly); |
| 796 | extra->transcolor = 0x100; |
| 797 | extra->texbase = &waveram[val1 & 0x3fffff]; |
| 798 | extra->texwidth = 512 >> texwshift; |
| 799 | extra->palbase = zeus_palbase; |
| 800 | extra->alpha = zeus_blend; |
| 801 | poly_render_triangle(poly, NULL, &Machine->screen[0].visarea, callback, 3, &vert[0], &vert[1], &vert[2]); |
| 802 | |
| 803 | /* skip empty if not a full quad */ |
| 804 | if (vert[2].x != vert[3].x || vert[2].y != vert[3].y) |
| 805 | { |
| 806 | extra = poly_get_extra_data(poly); |
| 807 | extra->transcolor = 0x100; |
| 808 | extra->texbase = &waveram[val1 & 0x3fffff]; |
| 809 | extra->texwidth = 512 >> texwshift; |
| 810 | extra->palbase = zeus_palbase; |
| 811 | extra->alpha = zeus_blend; |
| 812 | poly_render_triangle(poly, NULL, &Machine->screen[0].visarea, callback, 3, &vert[0], &vert[2], &vert[3]); |
| 813 | } |
| 814 | |
| 815 | poly_wait(poly, "Normal"); |
| 816 | } |
| 817 | else if (data[datanum] == 0x0c018000) |
| 818 | next_addr_and_count = data[datanum + 1]; |
| 819 | } |
| 820 | if (datanum != count) |
| 821 | logerror("Overran data\n"); |
| 822 | |
| 823 | if (next_addr_and_count == 0) |
| 824 | break; |
| 825 | else |
| 826 | addr_and_count = next_addr_and_count; |
| 827 | } |
| 828 | } |
| 829 | |
| 830 | |
| 831 | static void zeuscmd_execute(void) |
| 832 | { |
| 833 | static int colorcount; |
| 834 | int logcmd = input_code_pressed(KEYCODE_L); |
| 835 | int wordnum; |
| 836 | |
| 837 | switch (zeuscmd_buffer[0] >> 24) |
| 838 | { |
| 839 | case 0x1c: |
| 840 | if (logcmd) |
| 841 | logerror("Zeus cmd 1C : ( %04X %04X %04X ) ( %04X %04X %04X ) ( %04X %04X %04X ) %8.2f %8.2f %8.5f\n", |
| 842 | zeuscmd_buffer[2] & 0xffff, |
| 843 | zeuscmd_buffer[2] >> 16, |
| 844 | zeuscmd_buffer[0] & 0xffff, |
| 845 | zeuscmd_buffer[3] & 0xffff, |
| 846 | zeuscmd_buffer[3] >> 16, |
| 847 | zeuscmd_buffer[1] >> 16, |
| 848 | zeuscmd_buffer[4] & 0xffff, |
| 849 | zeuscmd_buffer[4] >> 16, |
| 850 | zeuscmd_buffer[1] & 0xffff, |
| 851 | (float)(INT32)zeuscmd_buffer[5] * (1.0f / 65536.0f), |
| 852 | (float)(INT32)zeuscmd_buffer[6] * (1.0f / 65536.0f), |
| 853 | (float)(INT32)zeuscmd_buffer[7] * (1.0f / (65536.0f * 512.0f))); |
| 854 | |
| 855 | zeus_matrix[0][0] = zeuscmd_buffer[2]; |
| 856 | zeus_matrix[0][1] = zeuscmd_buffer[2] >> 16; |
| 857 | zeus_matrix[0][2] = zeuscmd_buffer[0]; |
| 858 | zeus_matrix[1][0] = zeuscmd_buffer[3]; |
| 859 | zeus_matrix[1][1] = zeuscmd_buffer[3] >> 16; |
| 860 | zeus_matrix[1][2] = zeuscmd_buffer[1] >> 16; |
| 861 | zeus_matrix[2][0] = zeuscmd_buffer[4]; |
| 862 | zeus_matrix[2][1] = zeuscmd_buffer[4] >> 16; |
| 863 | zeus_matrix[2][2] = zeuscmd_buffer[1]; |
| 864 | zeus_point[0] = zeuscmd_buffer[5]; |
| 865 | zeus_point[1] = zeuscmd_buffer[6]; |
| 866 | zeus_point[2] = zeuscmd_buffer[7]; |
| 867 | break; |
| 868 | |
| 869 | case 0x13: /* invasn */ |
| 870 | zeus_draw_polys(zeus_objdata, zeus_texdata, logcmd); |
| 871 | break; |
| 872 | |
| 873 | case 0x67: |
| 874 | zeus_draw_polys(zeuscmd_buffer[1], zeuscmd_buffer[2], logcmd); |
| 875 | break; |
| 876 | |
| 877 | case 0x01: /* invasn */ |
| 878 | if (logcmd) |
| 879 | logerror("Zeus cmd %02X : %08X %08X\n", zeuscmd_buffer[0] >> 24, zeuscmd_buffer[0], zeuscmd_buffer[1]); |
| 880 | if (zeuscmd_buffer[0] == 0x01008000) |
| 881 | zeus_objdata = zeuscmd_buffer[1]; |
| 882 | else if (zeuscmd_buffer[0] == 0x0100c0b0) |
| 883 | zeus_texdata = zeuscmd_buffer[1]; |
| 884 | else if (zeuscmd_buffer[0] == 0x0100C040) |
| 885 | zeus_palbase = waveram_ptr_from_addr(zeuscmd_buffer[1]); |
| 886 | break; |
| 887 | |
| 888 | default: |
| 889 | if ((zeuscmd_buffer[0] >> 16) == 0x1752) |
| 890 | { |
| 891 | zeusbase[0xb2] = zeuscmd_buffer[0]; |
| 892 | // zeus_enable_logging = 1; |
| 893 | } |
| 894 | if ((zeuscmd_buffer[0] >> 16) == 0x1770) |
| 895 | zeus_point[0] = zeuscmd_buffer[0] << 16; |
| 896 | if ((zeuscmd_buffer[0] >> 16) == 0x1772) |
| 897 | zeus_point[1] = zeuscmd_buffer[0] << 16; |
| 898 | if ((zeuscmd_buffer[0] >> 16) == 0x1774) |
| 899 | zeus_point[2] = zeuscmd_buffer[0] << 16; |
| 900 | if ((zeuscmd_buffer[0] >> 16) == 0x18ce) |
| 901 | zeus_blend = zeuscmd_buffer[1]; |
| 902 | |
| 903 | if (zeuscmd_buffer[0] == 0x0000c040) |
| 904 | zeus_palbase = waveram_ptr_from_addr(zeuscmd_buffer[1]); |
| 905 | |
| 906 | if (zeuscmd_buffer[0] == 0x0080C0A5) |
| 907 | { |
| 908 | /* not right -- just a hack */ |
| 909 | int x, y; |
| 910 | for (y = 0; y <= 255; y++) |
| 911 | for (x = 0; x <= 399; x++) |
| 912 | waveram_plot_depth(y, x, 0, 0x7fff); |
| 913 | colorcount = 0; |
| 914 | last_tex_index = 0; |
| 915 | } |
| 916 | |
| 917 | if (logcmd) |
| 918 | { |
| 919 | logerror("Zeus cmd %02X : %08X", zeuscmd_buffer[0] >> 24, zeuscmd_buffer[0]); |
| 920 | for (wordnum = 1; wordnum < zeuscmd_buffer_expected_words; wordnum++) |
| 921 | logerror(" %08X", zeuscmd_buffer[wordnum]); |
| 922 | logerror("\n"); |
| 923 | } |
| 924 | break; |
| 925 | } |
| 926 | } |
| 927 | |
| 928 | |
| 929 | static UINT8 zeuscmd_length(UINT32 word) |
| 930 | { |
| 931 | switch (word >> 24) |
| 932 | { |
| 933 | case 0x00: |
| 934 | case 0x01: |
| 935 | return (word == 0) ? 1 : 2; |
| 936 | |
| 937 | case 0x13: |
| 938 | case 0x17: |
| 939 | case 0x1a: |
| 940 | case 0x2d: /* invasn */ |
| 941 | case 0x70: |
| 942 | return 1; |
| 943 | |
| 944 | case 0x18: |
| 945 | case 0x23: |
| 946 | case 0x2e: /* invasn */ |
| 947 | return 2; |
| 948 | |
| 949 | case 0x67: |
| 950 | return 3; |
| 951 | |
| 952 | case 0x25: |
| 953 | case 0x30: /* invasn */ |
| 954 | return 4; /* ??? */ |
| 955 | |
| 956 | case 0x1c: |
| 957 | return 8; |
| 958 | |
| 959 | default: |
| 960 | printf("Unknown command %02X\n", zeusbase[0xe0] >> 24); |
| 961 | break; |
| 962 | } |
| 963 | return 1; |
| 964 | } |
| 965 | |
| 966 | |
| 967 | READ32_HANDLER( zeus_r ) |
| 968 | { |
| 969 | int logit = (offset < 0xb0 || offset > 0xb7); |
| 970 | UINT32 result = zeusbase[offset & ~1]; |
| 971 | |
| 972 | switch (offset & ~1) |
| 973 | { |
| 974 | case 0x00: |
| 975 | // crusnexo wants bit 0x20 to be non-zero |
| 976 | result = 0x20; |
| 977 | break; |
| 978 | |
| 979 | case 0x51: |
| 980 | // crusnexo expects a reflection of the data at 0x08 here (b425) |
| 981 | result = zeusbase[0x08]; |
| 982 | break; |
| 983 | |
| 984 | case 0xf2: |
| 985 | // polled frequently during gametime; expected to change often |
| 986 | // as it is polled multiple times and a consistent value is looked for |
| 987 | result = video_screen_get_vpos(0); |
| 988 | logit = 0; |
| 989 | break; |
| 990 | |
| 991 | case 0xf4: |
| 992 | result = 6; |
| 993 | if (video_screen_get_vblank(0)) |
| 994 | result |= 0x800; |
| 995 | logit = 0; |
| 996 | break; |
| 997 | |
| 998 | case 0xf6: // status -- they wait for this & 9 == 0 |
| 999 | if (zeusbase[0xb6] == 0x80040000) |
| 1000 | result = 1; |
| 1001 | else |
| 1002 | result = 0; |
| 1003 | logit = 0; |
| 1004 | break; |
| 1005 | } |
| 1006 | |
| 1007 | /* 32-bit mode */ |
| 1008 | if (zeusbase[0x80] & 0x00020000) |
| 1009 | { |
| 1010 | if (offset & 1) |
| 1011 | result >>= 16; |
| 1012 | if (logit) |
| 1013 | { |
| 1014 | if (offset & 1) |
| 1015 | logerror("%06X:zeus32_r(%02X) = %08X -- unexpected in 32-bit mode\n", activecpu_get_pc(), offset, result); |
| 1016 | else if (offset != 0xe0) |
| 1017 | logerror("%06X:zeus32_r(%02X) = %08X\n", activecpu_get_pc(), offset, result); |
| 1018 | else |
| 1019 | logerror("%06X:zeus32_r(%02X) = %08X\n", activecpu_get_pc(), offset, result); |
| 1020 | } |
| 1021 | } |
| 1022 | |
| 1023 | /* 16-bit mode */ |
| 1024 | else |
| 1025 | { |
| 1026 | if (offset & 1) |
| 1027 | result >>= 16; |
| 1028 | else |
| 1029 | result &= 0xffff; |
| 1030 | if (logit) |
| 1031 | logerror("%06X:zeus16_r(%02X) = %04X\n", activecpu_get_pc(), offset, result); |
| 1032 | } |
| 1033 | return result; |
| 1034 | } |
| 1035 | |
| 1036 | |
| 1037 | WRITE32_HANDLER( zeus_w ) |
| 1038 | { |
| 1039 | int logit = zeus_enable_logging || ((offset < 0xb0 || offset > 0xb7) && (offset < 0xe0 || offset > 0xe1)); |
| 1040 | |
| 1041 | /* 32-bit mode */ |
| 1042 | if (zeusbase[0x80] & 0x00020000) |
| 1043 | { |
| 1044 | zeusbase[offset & ~1] = data; |
| 1045 | |
| 1046 | if (logit) |
| 1047 | { |
| 1048 | if (offset & 1) |
| 1049 | logerror("%06X:zeus32_w(%02X) = %08X -- unexpected in 32-bit mode\n", activecpu_get_pc(), offset, data); |
| 1050 | else if (offset != 0xe0) |
| 1051 | logerror("%06X:zeus32_w(%02X) = %08X\n", activecpu_get_pc(), offset, data); |
| 1052 | else |
| 1053 | logerror("%06X:zeus32_w(%02X) = %08X\n", activecpu_get_pc(), offset, data); |
| 1054 | } |
| 1055 | } |
| 1056 | |
| 1057 | /* 16-bit mode */ |
| 1058 | else |
| 1059 | { |
| 1060 | if (offset & 1) |
| 1061 | zeusbase[offset & ~1] = (zeusbase[offset & ~1] & 0x0000ffff) | (data << 16); |
| 1062 | else |
| 1063 | zeusbase[offset & ~1] = (zeusbase[offset & ~1] & 0xffff0000) | (data & 0xffff); |
| 1064 | |
| 1065 | if (logit) |
| 1066 | logerror("%06X:zeus16_w(%02X) = %04X [%08X]\n", activecpu_get_pc(), offset, data & 0xffff, zeusbase[offset & ~1]); |
| 1067 | } |
| 1068 | |
| 1069 | /* handle the writes; only trigger on low accesses */ |
| 1070 | switch (offset) |
| 1071 | { |
| 1072 | case 0x60: |
| 1073 | /* invasn writes here to execute a command (?) */ |
| 1074 | if (zeusbase[0x60] & 1) |
| 1075 | { |
| 1076 | if (zeusbase[0x80] == 0x0022FCFF) |
| 1077 | { |
| 1078 | int startx, stopx, starty, stopy; |
| 1079 | int x, y; |
| 1080 | // zeusbase[0x00] = color |
| 1081 | // zeusbase[0x02] = ??? = 0x000C0000 |
| 1082 | // zeusbase[0x04] = ??? = 0x00000E01 |
| 1083 | // zeusbase[0x06] = ??? = 0xFFFF0030 |
| 1084 | // zeusbase[0x08] = vert[0] = (y0 << 16) | x0 |
| 1085 | // zeusbase[0x0a] = vert[1] = (y1 << 16) | x1 |
| 1086 | // zeusbase[0x0c] = vert[2] = (y2 << 16) | x2 |
| 1087 | // zeusbase[0x0e] = vert[3] = (y3 << 16) | x3 |
| 1088 | // zeusbase[0x18] = ??? = 0xFFFFFFFF |
| 1089 | // zeusbase[0x1a] = ??? = 0xFFFFFFFF |
| 1090 | // zeusbase[0x1c] = ??? = 0xFFFFFFFF |
| 1091 | // zeusbase[0x1e] = ??? = 0xFFFFFFFF |
| 1092 | // zeusbase[0x20] = ??? = 0x00000000 |
| 1093 | // zeusbase[0x22] = ??? = 0x00000000 |
| 1094 | // zeusbase[0x24] = ??? = 0x00000000 |
| 1095 | // zeusbase[0x26] = ??? = 0x00000000 |
| 1096 | // zeusbase[0x40] = ??? = 0x00000000 |
| 1097 | // zeusbase[0x42] = ??? = 0x00000000 |
| 1098 | // zeusbase[0x44] = ??? = 0x00000000 |
| 1099 | // zeusbase[0x46] = ??? = 0x00000000 |
| 1100 | // zeusbase[0x4c] = ??? = 0x00808080 (brightness?) |
| 1101 | // zeusbase[0x4e] = ??? = 0x00808080 (brightness?) |
| 1102 | startx = (zeusbase[0x08] & 0xffff); |
| 1103 | starty = zeusbase[0x08] >> 16; |
| 1104 | stopx = (zeusbase[0x0c] & 0xffff); |
| 1105 | stopy = zeusbase[0x0c] >> 16; |
| 1106 | for (y = starty; y <= stopy; y++) |
| 1107 | for (x = startx; x <= stopx; x++) |
| 1108 | waveram[(1 * WAVERAM_HEIGHT + (y % WAVERAM_HEIGHT)) * WAVERAM_WIDTH + x] = zeusbase[0x00]; |
| 1109 | } |
| 1110 | else |
| 1111 | logerror("Execute unknown command\n"); |
| 1112 | } |
| 1113 | break; |
| 1114 | |
| 1115 | case 0xb0: |
| 1116 | case 0xb2: |
| 1117 | if ((zeusbase[0xb6] >> 16) != 0) |
| 1118 | { |
| 1119 | UINT32 *dest = zeus_pixaddr(); |
| 1120 | if ((offset == 0xb0 && (zeusbase[0xb6] & 0x02000000) == 0) || |
| 1121 | (offset == 0xb2 && (zeusbase[0xb6] & 0x02000000) != 0)) |
| 1122 | { |
| 1123 | if (zeusbase[0xb6] & 0x00100000) |
| 1124 | dest[0] = (dest[0] & 0xffff0000) | (zeusbase[0xb0] & 0x0000ffff); |
| 1125 | if (zeusbase[0xb6] & 0x00200000) |
| 1126 | dest[0] = (dest[0] & 0x0000ffff) | (zeusbase[0xb0] & 0xffff0000); |
| 1127 | if (zeusbase[0xb6] & 0x00400000) |
| 1128 | dest[1] = (dest[1] & 0xffff0000) | (zeusbase[0xb2] & 0x0000ffff); |
| 1129 | if (zeusbase[0xb6] & 0x00800000) |
| 1130 | dest[1] = (dest[1] & 0x0000ffff) | (zeusbase[0xb2] & 0xffff0000); |
| 1131 | if (zeusbase[0xb6] & 0x00020000) |
| 1132 | zeusbase[0xb4]++; |
| 1133 | } |
| 1134 | } |
| 1135 | break; |
| 1136 | |
| 1137 | case 0xb4: |
| 1138 | if (zeusbase[0xb6] & 0x00010000) |
| 1139 | { |
| 1140 | UINT32 *src = zeus_pixaddr(); |
| 1141 | zeusbase[0xb0] = src[0]; |
| 1142 | zeusbase[0xb2] = src[1]; |
| 1143 | } |
| 1144 | break; |
| 1145 | |
| 1146 | case 0xe0: |
| 1147 | zeuscmd_buffer[zeuscmd_buffer_words++] = zeusbase[0xe0]; |
| 1148 | if (zeuscmd_buffer_words == 1) |
| 1149 | zeuscmd_buffer_expected_words = zeuscmd_length(zeusbase[0xe0]); |
| 1150 | if (zeuscmd_buffer_words == zeuscmd_buffer_expected_words) |
| 1151 | { |
| 1152 | zeuscmd_execute(); |
| 1153 | zeuscmd_buffer_words = 0; |
| 1154 | } |
| 1155 | break; |
| 1156 | } |
| 1157 | } |
| 1158 | |
| 1159 | |
| 1160 | READ32_HANDLER( zeus2_r ) |
| 1161 | { |
| 1162 | return zeus_r(offset * 2, 0); |
| 1163 | } |
| 1164 | |
| 1165 | |
| 1166 | WRITE32_HANDLER( zeus2_w ) |
| 1167 | { |
| 1168 | zeus_w(offset * 2, data, mem_mask); |
| 1169 | } |
src/mame/drivers/midzeus.c
| r1215 | r1216 | |
| 18 | 18 | #include "driver.h" |
| 19 | 19 | #include "cpu/tms34010/tms34010.h" |
| 20 | 20 | #include "cpu/adsp2100/adsp2100.h" |
| 21 | #include "includes/midzeus.h" |
| 21 | 22 | #include "machine/midwayic.h" |
| 22 | 23 | #include "audio/dcs.h" |
| 23 | 24 | |
| r1215 | r1216 | |
| 28 | 29 | static mame_timer *timer[2]; |
| 29 | 30 | |
| 30 | 31 | static UINT32 *tms32031_control; |
| 31 | | static UINT32 *graphics_ram; |
| 32 | 32 | |
| 33 | 33 | |
| 34 | | //------------------------------ |
| 35 | 34 | |
| 36 | | #define WAVERAM_WIDTH 512 |
| 37 | | #define WAVERAM_HEIGHT 4096 |
| 38 | | |
| 39 | | static UINT32 *waveram; |
| 40 | | |
| 41 | | |
| 42 | | VIDEO_START( midzeus ) |
| 43 | | { |
| 44 | | int i; |
| 45 | | |
| 46 | | waveram = auto_malloc(2 * WAVERAM_WIDTH * WAVERAM_HEIGHT * sizeof(*waveram)); |
| 47 | | |
| 48 | | for (i = 0; i < 32768; i++) |
| 49 | | palette_set_color_rgb(machine, i, pal5bit(i >> 10), pal5bit(i >> 5), pal5bit(i >> 0)); |
| 50 | | } |
| 51 | | |
| 52 | | VIDEO_UPDATE( midzeus ) |
| 53 | | { |
| 54 | | static int yoffs = 0; |
| 55 | | int p = input_code_pressed(KEYCODE_0) ? 0 : 1; |
| 56 | | int x, y; |
| 57 | | if (input_code_pressed(KEYCODE_DOWN) && input_code_pressed(KEYCODE_LCONTROL)) yoffs += 8; |
| 58 | | if (input_code_pressed(KEYCODE_UP) && input_code_pressed(KEYCODE_LCONTROL)) yoffs -= 8; |
| 59 | | for (y = cliprect->min_y; y <= cliprect->max_y; y++) |
| 60 | | { |
| 61 | | UINT32 *src = &waveram[(p * WAVERAM_HEIGHT + ((y + yoffs) % WAVERAM_HEIGHT)) * WAVERAM_WIDTH + 0]; |
| 62 | | UINT16 *dest = (UINT16 *)bitmap->base + y * bitmap->rowpixels; |
| 63 | | for (x = cliprect->min_x; x <= cliprect->max_x; x++) |
| 64 | | dest[x] = src[x] & 0x7fff; |
| 65 | | } |
| 66 | | return 0; |
| 67 | | } |
| 68 | | |
| 69 | | /* |
| 70 | | offset B7 = control.... |
| 71 | | |
| 72 | | 8000 = page 1 enable |
| 73 | | 4000 = page 0 enable |
| 74 | | |
| 75 | | 0080 = 2nd pixel enable (maybe Z buff?) |
| 76 | | 0040 = 1st pixel enable (maybe Z buff?) |
| 77 | | 0020 = 2nd pixel enable |
| 78 | | 0010 = 1st pixel enable |
| 79 | | |
| 80 | | |
| 81 | | writes 80a2 to write an odd pixel at startup |
| 82 | | writes 80f6 to write the middle pixels |
| 83 | | writes 8052 to write an odd pixel at the end |
| 84 | | |
| 85 | | writes 8050 before writing an odd pixel |
| 86 | | writes 80a0 before writing an even pixel |
| 87 | | |
| 88 | | writes 44f1 before reading from page 0 of wave ram |
| 89 | | writes 84f1 before reading from page 1 of wave ram |
| 90 | | |
| 91 | | writes 42f0 before writing to page 0 of wave ram |
| 92 | | writes 82f0 before writing to page 1 of wave ram |
| 93 | | |
| 94 | | |
| 95 | | Initialization: |
| 96 | | 01BFF4:graphics_w(080) = 0020F023 |
| 97 | | 01BFF1:graphics_w(081) = 00000020 |
| 98 | | 01C03E:graphics_w(080) = 00000000 |
| 99 | | 01C03E:graphics_w(081) = 00008200 |
| 100 | | 01C03E:graphics_w(08F) = 00000206 |
| 101 | | 01C03E:graphics_w(08E) = 00000000 |
| 102 | | 01C03E:graphics_w(08B) = 00000000 |
| 103 | | 01C03E:graphics_w(08A) = 0000FAFA |
| 104 | | 01C03E:graphics_w(08D) = 00000206 |
| 105 | | 01C03E:graphics_w(08C) = 00000000 |
| 106 | | 01C03E:graphics_w(089) = 00000000 |
| 107 | | 01C03E:graphics_w(088) = 0000FAFA |
| 108 | | 01C03E:graphics_w(080) = 00000001 |
| 109 | | 01C03E:graphics_w(0CF) = 000000C8 |
| 110 | | 01C03E:graphics_w(0CE) = 00007620 |
| 111 | | 01C03E:graphics_w(0CD) = 00000000 |
| 112 | | 01C03E:graphics_w(0CC) = 00000000 |
| 113 | | 01C03E:graphics_w(0CB) = 00000116 = VTOTAL(?) |
| 114 | | 01C03E:graphics_w(0CA) = 00000107 = VSYNC END |
| 115 | | 01C03E:graphics_w(0C9) = 00000103 = VSYNC START |
| 116 | | 01C03E:graphics_w(0C8) = 000000FF = VBSTART |
| 117 | | 01C03E:graphics_w(0C7) = 00000211 |
| 118 | | 01C03E:graphics_w(0C6) = 0000007F |
| 119 | | 01C03E:graphics_w(0C5) = 0000000C |
| 120 | | 01C03E:graphics_w(0C4) = 00000042 |
| 121 | | 01C03E:graphics_w(0C3) = 00000015 |
| 122 | | 01C03E:graphics_w(0C2) = 0000E591 |
| 123 | | 01C03E:graphics_w(0C1) = 0000801F |
| 124 | | 01C03E:graphics_w(0C0) = 00002500 |
| 125 | | 01C03E:graphics_w(086) = 00008003 |
| 126 | | 01C03E:graphics_w(080) = 00000C05 |
| 127 | | 01C03E:graphics_w(085) = 00000000 |
| 128 | | 01C03E:graphics_w(084) = 00000000 |
| 129 | | 01C03E:graphics_w(083) = 00001F1F |
| 130 | | 01C03E:graphics_w(082) = 00002011 |
| 131 | | 01C03E:graphics_w(069) = 00000003 |
| 132 | | 01C03E:graphics_w(069) = 00000000 |
| 133 | | 01C03E:graphics_w(08D) = 00000227 |
| 134 | | 01C03E:graphics_w(08C) = 0000BFFF |
| 135 | | 01C03E:graphics_w(08D) = 00000226 |
| 136 | | 01C03E:graphics_w(08C) = 00000000 |
| 137 | | 01C03E:graphics_w(08D) = 00000227 |
| 138 | | 01C03E:graphics_w(08C) = 0000BFFF |
| 139 | | 01C03E:graphics_w(08D) = 00000226 |
| 140 | | 01C03E:graphics_w(08C) = 00000000 |
| 141 | | 01C03E:graphics_w(08D) = 00000227 |
| 142 | | 01C03E:graphics_w(08C) = 0000F020 |
| 143 | | 01C03E:graphics_w(08D) = 00000226 |
| 144 | | 01C03E:graphics_w(08C) = 00000000 |
| 145 | | 01C03E:graphics_w(08D) = 00000227 |
| 146 | | 01C03E:graphics_w(08C) = 0000DFFF |
| 147 | | 01C03E:graphics_w(08D) = 00000226 |
| 148 | | 01C03E:graphics_w(08C) = 00000000 |
| 149 | | 01C03E:graphics_w(08D) = 00000227 |
| 150 | | 01C03E:graphics_w(08C) = 0000DFFF |
| 151 | | 01C03E:graphics_w(08D) = 00000226 |
| 152 | | 01C03E:graphics_w(08C) = 00000000 |
| 153 | | 01C03E:graphics_w(08F) = 00000207 |
| 154 | | 01C03E:graphics_w(08E) = 0000BFFF |
| 155 | | 01C03E:graphics_w(08F) = 00000206 |
| 156 | | 01C03E:graphics_w(08E) = 00000000 |
| 157 | | 01C03E:graphics_w(08F) = 00000207 |
| 158 | | 01C03E:graphics_w(08E) = 0000F020 |
| 159 | | 01C03E:graphics_w(08F) = 00000206 |
| 160 | | 01C03E:graphics_w(08E) = 00000000 |
| 161 | | 01C03E:graphics_w(08F) = 00000207 |
| 162 | | 01C03E:graphics_w(08E) = 0000DFFF |
| 163 | | 01C03E:graphics_w(08F) = 00000206 |
| 164 | | 01C03E:graphics_w(08E) = 00000000 |
| 165 | | 01C03E:graphics_w(08F) = 00000207 |
| 166 | | 01C03E:graphics_w(08E) = 0000DFFF |
| 167 | | 01C03E:graphics_w(08F) = 00000206 |
| 168 | | 01C03E:graphics_w(08E) = 00000000 |
| 169 | | 01C03E:graphics_w(08F) = 00000206 |
| 170 | | 01C03E:graphics_w(08E) = 00000000 |
| 171 | | 01C03E:graphics_w(08D) = 00000226 |
| 172 | | 01C03E:graphics_w(08C) = 00000000 |
| 173 | | 01C03E:graphics_w(08B) = 00000000 |
| 174 | | 01C03E:graphics_w(08A) = 0000D254 |
| 175 | | 01C03E:graphics_w(089) = 00000000 |
| 176 | | 01C03E:graphics_w(088) = 0000D794 |
| 177 | | |
| 178 | | then: |
| 179 | | 01C2CE:graphics_w(0B7) = 00000000 |
| 180 | | 01C2D0:graphics_w(0B6) = 00000001 |
| 181 | | 01C2D1:graphics_w(0B0) = 00000000 |
| 182 | | 01C2D2:graphics_w(0B1) = 00000000 |
| 183 | | 01C2D3:graphics_w(0B2) = 00007FFF |
| 184 | | 01C2D4:graphics_w(0B3) = 00007FFF |
| 185 | | 01C2D8:graphics_w(0B5) = 000000FF y |
| 186 | | 01C2DD:graphics_w(0B4) = 00000100 x/yhi |
| 187 | | 01C2EA:graphics_w(0B7) = FFFF80F6 page 1 |
| 188 | | 01C2EB:graphics_w(0B0) = 00000000 |
| 189 | | 01C2EC:graphics_r(0F6) |
| 190 | | 01C2F4:graphics_w(0B0) = 00000000 x 256 |
| 191 | | |
| 192 | | 01C2F6:graphics_w(0B7) = FFFF8052 |
| 193 | | 01C2CE:graphics_w(0B7) = 00000000 |
| 194 | | 01C2D0:graphics_w(0B6) = 00000001 |
| 195 | | 01C2D1:graphics_w(0B0) = 00000000 |
| 196 | | 01C2D2:graphics_w(0B1) = 00000000 |
| 197 | | 01C2D3:graphics_w(0B2) = 00007FFF |
| 198 | | 01C2D4:graphics_w(0B3) = 00007FFF |
| 199 | | 01C2D8:graphics_w(0B5) = 000000FF y |
| 200 | | 01C2DD:graphics_w(0B4) = 00000000 x/yhi |
| 201 | | 01C2EA:graphics_w(0B7) = FFFF80F6 |
| 202 | | 01C2EB:graphics_w(0B0) = 00000000 |
| 203 | | 01C2EC:graphics_r(0F6) |
| 204 | | 01C2F4:graphics_w(0B0) = 00000000 x 256 |
| 205 | | |
| 206 | | etc. to clear all scanlines on page 1 |
| 207 | | |
| 208 | | then: |
| 209 | | 01C2F6:graphics_w(0B7) = FFFF8052 |
| 210 | | 01BFF4:graphics_w(080) = 00200001 |
| 211 | | 01C1B6:graphics_w(0CF) = 000000C9 |
| 212 | | 01BFF4:graphics_w(080) = 00200C27 |
| 213 | | 01C1BC:graphics_w(0CF) = 000000C8 |
| 214 | | 01BFF4:graphics_w(080) = 0020F023 |
| 215 | | 01BFF1:graphics_w(081) = 00000020 |
| 216 | | 01BFF1:graphics_w(081) = 00000022 |
| 217 | | 01BFF4:graphics_w(080) = 0022F023 |
| 218 | | |
| 219 | | 01C0DB:graphics_w(200) = 00000E00 |
| 220 | | 01C0DB:graphics_w(202) = 00000025 |
| 221 | | 01C0DB:graphics_w(204) = 00000E01 |
| 222 | | 01C0DB:graphics_w(206) = 00000025 |
| 223 | | 01C0DB:graphics_w(208) = 00000E02 |
| 224 | | 01C0DB:graphics_w(20A) = 00000025 |
| 225 | | 01C0DB:graphics_w(20C) = 00000E03 |
| 226 | | 01C0DB:graphics_w(20E) = 00000025 |
| 227 | | 01C0DB:graphics_w(210) = 00000E04 |
| 228 | | 01C0DB:graphics_w(212) = 00000025 |
| 229 | | 01C0DB:graphics_w(214) = 00000E05 |
| 230 | | 01C0DB:graphics_w(216) = 00000025 |
| 231 | | 01C0DB:graphics_w(218) = 00000E06 |
| 232 | | 01C0DB:graphics_w(21A) = 00000025 |
| 233 | | 01C0DB:graphics_w(21C) = 00000E07 |
| 234 | | 01C0DB:graphics_w(21E) = 00000025 |
| 235 | | 01C0DB:graphics_w(220) = 00000E08 |
| 236 | | 01C0DB:graphics_w(222) = 00000025 |
| 237 | | 01C0DB:graphics_w(224) = 00000E09 |
| 238 | | 01C0DB:graphics_w(226) = 00000025 |
| 239 | | 01C0DB:graphics_w(228) = 00000E0A |
| 240 | | 01C0DB:graphics_w(22A) = 00000025 |
| 241 | | 01C0DB:graphics_w(22C) = 00000E0B |
| 242 | | 01C0DB:graphics_w(22E) = 00000025 |
| 243 | | 01C0DB:graphics_w(230) = 00000E0C |
| 244 | | 01C0DB:graphics_w(232) = 00000025 |
| 245 | | 01C0DB:graphics_w(234) = 00000E0D |
| 246 | | 01C0DB:graphics_w(236) = 00000025 |
| 247 | | 01C0DB:graphics_w(238) = 00000E0E |
| 248 | | 01C0DB:graphics_w(23A) = 00000025 |
| 249 | | 01C0DB:graphics_w(23C) = 00000E0F |
| 250 | | 01C0DB:graphics_w(23E) = 00000025 |
| 251 | | 01C0DB:graphics_w(240) = 00000E10 |
| 252 | | 01C0DB:graphics_w(242) = 00000025 |
| 253 | | 01C0DB:graphics_w(244) = 00000E11 |
| 254 | | 01C0DB:graphics_w(246) = 00000025 |
| 255 | | 01C0DB:graphics_w(248) = 00000E12 |
| 256 | | 01C0DB:graphics_w(24A) = 00000025 |
| 257 | | 01C0DB:graphics_w(24C) = 00000E13 |
| 258 | | 01C0DB:graphics_w(24E) = 00000025 |
| 259 | | 01C0DB:graphics_w(250) = 00000E14 |
| 260 | | 01C0DB:graphics_w(252) = 00000025 |
| 261 | | 01C0DB:graphics_w(254) = 00000E15 |
| 262 | | 01C0DB:graphics_w(256) = 00000025 |
| 263 | | 01C0DB:graphics_w(258) = 00000E16 |
| 264 | | 01C0DB:graphics_w(25A) = 00000025 |
| 265 | | 01C0DB:graphics_w(25C) = 00000E17 |
| 266 | | 01C0DB:graphics_w(25E) = 00000025 |
| 267 | | 01C0DB:graphics_w(260) = 00000E18 |
| 268 | | 01C0DB:graphics_w(262) = 00000025 |
| 269 | | 01C0DB:graphics_w(264) = 00000E19 |
| 270 | | 01C0DB:graphics_w(266) = 00000025 |
| 271 | | 01C0DB:graphics_w(268) = 00000E1A |
| 272 | | 01C0DB:graphics_w(26A) = 00000025 |
| 273 | | 01C0DB:graphics_w(26C) = 00000E1B |
| 274 | | 01C0DB:graphics_w(26E) = 00000025 |
| 275 | | 01C0DB:graphics_w(270) = 00000E1C |
| 276 | | 01C0DB:graphics_w(272) = 00000025 |
| 277 | | 01C0DB:graphics_w(274) = 00000E1D |
| 278 | | 01C0DB:graphics_w(276) = 00000025 |
| 279 | | 01C0DB:graphics_w(278) = 00000E1E |
| 280 | | 01C0DB:graphics_w(27A) = 00000025 |
| 281 | | 01C0DB:graphics_w(27C) = 00000E1F |
| 282 | | 01C0DB:graphics_w(27E) = 00000025 |
| 283 | | 01C0DB:graphics_w(280) = 00000E20 |
| 284 | | 01C0DB:graphics_w(282) = 00000025 |
| 285 | | 01C0DB:graphics_w(284) = 00000E21 |
| 286 | | 01C0DB:graphics_w(286) = 00000025 |
| 287 | | 01C0DB:graphics_w(288) = 00000E22 |
| 288 | | 01C0DB:graphics_w(28A) = 00000025 |
| 289 | | 01C0DB:graphics_w(28C) = 00000E23 |
| 290 | | 01C0DB:graphics_w(28E) = 00000025 |
| 291 | | 01C0DB:graphics_w(290) = 00000E24 |
| 292 | | 01C0DB:graphics_w(292) = 00000025 |
| 293 | | 01C0DB:graphics_w(294) = 00000E25 |
| 294 | | 01C0DB:graphics_w(296) = 00000025 |
| 295 | | 01C0DB:graphics_w(298) = 00000E26 |
| 296 | | 01C0DB:graphics_w(29A) = 00000025 |
| 297 | | 01C0DB:graphics_w(29C) = 00000E27 |
| 298 | | 01C0DB:graphics_w(29E) = 00000025 |
| 299 | | 01C0DB:graphics_w(2A0) = 00000E28 |
| 300 | | 01C0DB:graphics_w(2A2) = 00000025 |
| 301 | | 01C0DB:graphics_w(2A4) = 00000E29 |
| 302 | | 01C0DB:graphics_w(2A6) = 00000025 |
| 303 | | 01C0DB:graphics_w(2A8) = 00000E2A |
| 304 | | 01C0DB:graphics_w(2AA) = 00000025 |
| 305 | | 01C0DB:graphics_w(2AC) = 00000E2B |
| 306 | | 01C0DB:graphics_w(2AE) = 00000025 |
| 307 | | 01C0DB:graphics_w(2B0) = 00000E2C |
| 308 | | 01C0DB:graphics_w(2B2) = 00000025 |
| 309 | | 01C0DB:graphics_w(2B4) = 00000E2D |
| 310 | | 01C0DB:graphics_w(2B6) = 00000025 |
| 311 | | 01C0DB:graphics_w(2B8) = 00000E2E |
| 312 | | 01C0DB:graphics_w(2BA) = 00000025 |
| 313 | | 01C0DB:graphics_w(2BC) = 00000E2F |
| 314 | | 01C0DB:graphics_w(2BE) = 00000025 |
| 315 | | 01C0DB:graphics_w(2C0) = 00000E30 |
| 316 | | 01C0DB:graphics_w(2C2) = 00000025 |
| 317 | | 01C0DB:graphics_w(2C4) = 00000E31 |
| 318 | | 01C0DB:graphics_w(2C6) = 00000025 |
| 319 | | 01C0DB:graphics_w(2C8) = 00000E32 |
| 320 | | 01C0DB:graphics_w(2CA) = 00000025 |
| 321 | | 01C0DB:graphics_w(2CC) = 00000E33 |
| 322 | | 01C0DB:graphics_w(2CE) = 00000025 |
| 323 | | 01C0DB:graphics_w(2D0) = 00000E34 |
| 324 | | 01C0DB:graphics_w(2D2) = 00000025 |
| 325 | | 01C0DB:graphics_w(2D4) = 00000E35 |
| 326 | | 01C0DB:graphics_w(2D6) = 00000025 |
| 327 | | 01C0DB:graphics_w(2D8) = 00000E36 |
| 328 | | 01C0DB:graphics_w(2DA) = 00000025 |
| 329 | | 01C0DB:graphics_w(2DC) = 00000E37 |
| 330 | | 01C0DB:graphics_w(2DE) = 00000025 |
| 331 | | 01C0DB:graphics_w(2E0) = 00000E38 |
| 332 | | 01C0DB:graphics_w(2E2) = 00000025 |
| 333 | | 01C0DB:graphics_w(2E4) = 00000E39 |
| 334 | | 01C0DB:graphics_w(2E6) = 00000025 |
| 335 | | 01C0DB:graphics_w(2E8) = 00000E3A |
| 336 | | 01C0DB:graphics_w(2EA) = 00000025 |
| 337 | | 01C0DB:graphics_w(2EC) = 00000E3B |
| 338 | | 01C0DB:graphics_w(2EE) = 00000025 |
| 339 | | 01C0DB:graphics_w(2F0) = 00000E3C |
| 340 | | 01C0DB:graphics_w(2F2) = 00000025 |
| 341 | | 01C0DB:graphics_w(2F4) = 00000E3D |
| 342 | | 01C0DB:graphics_w(2F6) = 00000025 |
| 343 | | 01C0DB:graphics_w(2F8) = 00000E3E |
| 344 | | 01C0DB:graphics_w(2FA) = 00000025 |
| 345 | | 01C0DB:graphics_w(2FC) = 00000E3F |
| 346 | | 01C0DB:graphics_w(2FE) = 00000025 |
| 347 | | 01C0DB:graphics_w(300) = 00000E40 |
| 348 | | 01C0DB:graphics_w(302) = 00000025 |
| 349 | | 01C0DB:graphics_w(304) = 00000E41 |
| 350 | | 01C0DB:graphics_w(306) = 00000025 |
| 351 | | 01C0DB:graphics_w(308) = 00000E42 |
| 352 | | 01C0DB:graphics_w(30A) = 00000025 |
| 353 | | 01C0DB:graphics_w(30C) = 00000E43 |
| 354 | | 01C0DB:graphics_w(30E) = 00000025 |
| 355 | | 01C0DB:graphics_w(310) = 00000E44 |
| 356 | | 01C0DB:graphics_w(312) = 00000025 |
| 357 | | 01C0DB:graphics_w(314) = 00000E45 |
| 358 | | 01C0DB:graphics_w(316) = 00000025 |
| 359 | | 01C0DB:graphics_w(318) = 00000E46 |
| 360 | | 01C0DB:graphics_w(31A) = 00000025 |
| 361 | | 01C0DB:graphics_w(31C) = 00000E47 |
| 362 | | 01C0DB:graphics_w(31E) = 00000025 |
| 363 | | 01C0DB:graphics_w(320) = 00000E48 |
| 364 | | 01C0DB:graphics_w(322) = 00000025 |
| 365 | | 01C0DB:graphics_w(324) = 00000E49 |
| 366 | | 01C0DB:graphics_w(326) = 00000025 |
| 367 | | 01C0DB:graphics_w(328) = 00000E4A |
| 368 | | 01C0DB:graphics_w(32A) = 00000025 |
| 369 | | 01C0DB:graphics_w(32C) = 00000E4B |
| 370 | | 01C0DB:graphics_w(32E) = 00000025 |
| 371 | | 01C0DB:graphics_w(330) = 00000E4C |
| 372 | | 01C0DB:graphics_w(332) = 00000025 |
| 373 | | 01C0DB:graphics_w(334) = 00000E4D |
| 374 | | 01C0DB:graphics_w(336) = 00000025 |
| 375 | | 01C0DB:graphics_w(338) = 00000E4E |
| 376 | | 01C0DB:graphics_w(33A) = 00000025 |
| 377 | | 01C0DB:graphics_w(33C) = 00000E4F |
| 378 | | 01C0DB:graphics_w(33E) = 00000025 |
| 379 | | 01C0DB:graphics_w(340) = 00000E50 |
| 380 | | 01C0DB:graphics_w(342) = 00000025 |
| 381 | | 01C0DB:graphics_w(344) = 00000E51 |
| 382 | | 01C0DB:graphics_w(346) = 00000025 |
| 383 | | 01C0DB:graphics_w(348) = 00000E52 |
| 384 | | 01C0DB:graphics_w(34A) = 00000025 |
| 385 | | 01C0DB:graphics_w(34C) = 00000E53 |
| 386 | | 01C0DB:graphics_w(34E) = 00000025 |
| 387 | | 01C0DB:graphics_w(350) = 00000E54 |
| 388 | | 01C0DB:graphics_w(352) = 00000025 |
| 389 | | 01C0DB:graphics_w(354) = 00000E55 |
| 390 | | 01C0DB:graphics_w(356) = 00000025 |
| 391 | | 01C0DB:graphics_w(358) = 00000E56 |
| 392 | | 01C0DB:graphics_w(35A) = 00000025 |
| 393 | | 01C0DB:graphics_w(35C) = 00000E57 |
| 394 | | 01C0DB:graphics_w(35E) = 00000025 |
| 395 | | 01C0DB:graphics_w(360) = 00000E58 |
| 396 | | 01C0DB:graphics_w(362) = 00000025 |
| 397 | | 01C0DB:graphics_w(364) = 00000E59 |
| 398 | | 01C0DB:graphics_w(366) = 00000025 |
| 399 | | 01C0DB:graphics_w(368) = 00000E5A |
| 400 | | 01C0DB:graphics_w(36A) = 00000025 |
| 401 | | 01C0DB:graphics_w(36C) = 00000E5B |
| 402 | | 01C0DB:graphics_w(36E) = 00000025 |
| 403 | | 01C0DB:graphics_w(370) = 00000E5C |
| 404 | | 01C0DB:graphics_w(372) = 00000025 |
| 405 | | 01C0DB:graphics_w(374) = 00000E5D |
| 406 | | 01C0DB:graphics_w(376) = 00000025 |
| 407 | | 01C0DB:graphics_w(378) = 00000E5E |
| 408 | | 01C0DB:graphics_w(37A) = 00000025 |
| 409 | | 01C0DB:graphics_w(37C) = 00000E5F |
| 410 | | 01C0DB:graphics_w(37E) = 00000025 |
| 411 | | 01C0DB:graphics_w(380) = 00000E60 |
| 412 | | 01C0DB:graphics_w(382) = 00000025 |
| 413 | | 01C0DB:graphics_w(384) = 00000E61 |
| 414 | | 01C0DB:graphics_w(386) = 00000025 |
| 415 | | 01C0DB:graphics_w(388) = 00000E62 |
| 416 | | 01C0DB:graphics_w(38A) = 00000025 |
| 417 | | 01C0DB:graphics_w(38C) = 00000E63 |
| 418 | | 01C0DB:graphics_w(38E) = 00000025 |
| 419 | | 01C0DB:graphics_w(390) = 00000E64 |
| 420 | | 01C0DB:graphics_w(392) = 00000025 |
| 421 | | 01C0DB:graphics_w(394) = 00000E65 |
| 422 | | 01C0DB:graphics_w(396) = 00000025 |
| 423 | | 01C0DB:graphics_w(398) = 00000E66 |
| 424 | | 01C0DB:graphics_w(39A) = 00000025 |
| 425 | | 01C0DB:graphics_w(39C) = 00000E67 |
| 426 | | 01C0DB:graphics_w(39E) = 00000025 |
| 427 | | 01C0DB:graphics_w(3A0) = 00000E68 |
| 428 | | 01C0DB:graphics_w(3A2) = 00000025 |
| 429 | | 01C0DB:graphics_w(3A4) = 00000E69 |
| 430 | | 01C0DB:graphics_w(3A6) = 00000025 |
| 431 | | 01C0DB:graphics_w(3A8) = 00000E6A |
| 432 | | 01C0DB:graphics_w(3AA) = 00000025 |
| 433 | | 01C0DB:graphics_w(3AC) = 00000E6B |
| 434 | | 01C0DB:graphics_w(3AE) = 00000025 |
| 435 | | 01C0DB:graphics_w(3B0) = 00000E6C |
| 436 | | 01C0DB:graphics_w(3B2) = 00000025 |
| 437 | | 01C0DB:graphics_w(3B4) = 00000E6D |
| 438 | | 01C0DB:graphics_w(3B6) = 00000025 |
| 439 | | 01C0DB:graphics_w(3B8) = 00000E6E |
| 440 | | 01C0DB:graphics_w(3BA) = 00000025 |
| 441 | | 01C0DB:graphics_w(3BC) = 00000E6F |
| 442 | | 01C0DB:graphics_w(3BE) = 00000025 |
| 443 | | 01C0DB:graphics_w(3C0) = 00000E70 |
| 444 | | 01C0DB:graphics_w(3C2) = 00000025 |
| 445 | | 01C0DB:graphics_w(3C4) = 00000E71 |
| 446 | | 01C0DB:graphics_w(3C6) = 00000025 |
| 447 | | 01C0DB:graphics_w(3C8) = 00000E72 |
| 448 | | 01C0DB:graphics_w(3CA) = 00000025 |
| 449 | | 01C0DB:graphics_w(3CC) = 00000E73 |
| 450 | | 01C0DB:graphics_w(3CE) = 00000025 |
| 451 | | 01C0DB:graphics_w(3D0) = 00000E74 |
| 452 | | 01C0DB:graphics_w(3D2) = 00000025 |
| 453 | | 01C0DB:graphics_w(3D4) = 00000E75 |
| 454 | | 01C0DB:graphics_w(3D6) = 00000025 |
| 455 | | 01C0DB:graphics_w(3D8) = 00000E76 |
| 456 | | 01C0DB:graphics_w(3DA) = 00000025 |
| 457 | | 01C0DB:graphics_w(3DC) = 00000E77 |
| 458 | | 01C0DB:graphics_w(3DE) = 00000025 |
| 459 | | 01C0DB:graphics_w(3E0) = 00000E78 |
| 460 | | 01C0DB:graphics_w(3E2) = 00000025 |
| 461 | | 01C0DB:graphics_w(3E4) = 00000E79 |
| 462 | | 01C0DB:graphics_w(3E6) = 00000025 |
| 463 | | 01C0DB:graphics_w(3E8) = 00000E7A |
| 464 | | 01C0DB:graphics_w(3EA) = 00000025 |
| 465 | | 01C0DB:graphics_w(3EC) = 00000E7B |
| 466 | | 01C0DB:graphics_w(3EE) = 00000025 |
| 467 | | 01C0DB:graphics_w(3F0) = 00000E7C |
| 468 | | 01C0DB:graphics_w(3F2) = 00000025 |
| 469 | | 01C0DB:graphics_w(3F4) = 00000E7D |
| 470 | | 01C0DB:graphics_w(3F6) = 00000025 |
| 471 | | 01C0DB:graphics_w(3F8) = 00000E7E |
| 472 | | 01C0DB:graphics_w(3FA) = 00000025 |
| 473 | | 01C0DB:graphics_w(3FC) = 00000E7F |
| 474 | | 01C0DB:graphics_w(3FE) = 00000025 |
| 475 | | |
| 476 | | 01BFB6:graphics_w(05A) = 00000000 |
| 477 | | 01BFB8:graphics_w(058) = 3F000000 |
| 478 | | 01BFB9:graphics_r(0F6) |
| 479 | | 01BFBE:graphics_w(0E0) = 00000000 |
| 480 | | 01BFF4:graphics_w(080) = 0022F02B |
| 481 | | 01BFC2:graphics_w(068) = 00030000 |
| 482 | | 01BFC4:graphics_w(068) = 00000000 |
| 483 | | 01C052:graphics_w(08A) = 8FFFD254 |
| 484 | | 01C054:graphics_w(088) = 87FFD794 |
| 485 | | 01BFF4:graphics_w(080) = 0022FC2B |
| 486 | | |
| 487 | | (other stuff) |
| 488 | | |
| 489 | | loop over each scanline: |
| 490 | | A2DD19:graphics_w(0B7) = 00000000 |
| 491 | | A2DD24:graphics_w(0B6) = 82F00001 |
| 492 | | A2DD30:graphics_r(0F6) |
| 493 | | A2DD34:graphics_w(0B4) = 01FF0000 |
| 494 | | A2DD37:graphics_w(0B0) = AAAAAAAA |
| 495 | | A2DD39:graphics_w(0B2) = AAAAAAAA |
| 496 | | A2DD30:graphics_r(0F6) |
| 497 | | A2DD34:graphics_w(0B4) = 01FF0001 |
| 498 | | A2DD37:graphics_w(0B0) = AAAAAAAA |
| 499 | | A2DD39:graphics_w(0B2) = AAAAAAAA |
| 500 | | A2DD30:graphics_r(0F6) |
| 501 | | ... |
| 502 | | A2DD34:graphics_w(0B4) = 01FF01FE |
| 503 | | A2DD37:graphics_w(0B0) = AAAAAAAA |
| 504 | | A2DD39:graphics_w(0B2) = AAAAAAAA |
| 505 | | A2DD30:graphics_r(0F6) |
| 506 | | A2DD34:graphics_w(0B4) = 01FF01FF |
| 507 | | A2DD37:graphics_w(0B0) = AAAAAAAA |
| 508 | | A2DD39:graphics_w(0B2) = AAAAAAAA |
| 509 | | A2DD45:graphics_w(0B6) = 00000000 |
| 510 | | A2DD58:graphics_w(0B6) = 00000000 |
| 511 | | A2DD6E:graphics_w(0B6) = 84F10001 |
| 512 | | A2DD6F:graphics_w(0B4) = 01FF0000 |
| 513 | | A2DD71:graphics_r(0F6) |
| 514 | | A2DD76:graphics_w(0B6) = 00000000 |
| 515 | | A2DD77:graphics_r(0B0) |
| 516 | | A2DD79:graphics_r(0B2) |
| 517 | | A2DD6E:graphics_w(0B6) = 84F10001 |
| 518 | | A2DD6F:graphics_w(0B4) = 01FF0001 |
| 519 | | A2DD71:graphics_r(0F6) |
| 520 | | A2DD76:graphics_w(0B6) = 00000000 |
| 521 | | A2DD77:graphics_r(0B0) |
| 522 | | A2DD79:graphics_r(0B2) |
| 523 | | ... |
| 524 | | A2DD6E:graphics_w(0B6) = 84F10001 |
| 525 | | A2DD6F:graphics_w(0B4) = 01FF01FE |
| 526 | | A2DD71:graphics_r(0F6) |
| 527 | | A2DD76:graphics_w(0B6) = 00000000 |
| 528 | | A2DD77:graphics_r(0B0) |
| 529 | | A2DD79:graphics_r(0B2) |
| 530 | | A2DD6E:graphics_w(0B6) = 84F10001 |
| 531 | | A2DD6F:graphics_w(0B4) = 01FF01FF |
| 532 | | A2DD71:graphics_r(0F6) |
| 533 | | A2DD76:graphics_w(0B6) = 00000000 |
| 534 | | A2DD77:graphics_r(0B0) |
| 535 | | A2DD79:graphics_r(0B2) |
| 536 | | A2DD82:graphics_w(0B6) = 00000000 |
| 537 | | A2DD19:graphics_w(0B7) = 00000000 |
| 538 | | A2DD24:graphics_w(0B6) = 82F00001 |
| 539 | | A2DD30:graphics_r(0F6) |
| 540 | | |
| 541 | | repeat with 55555555.... |
| 542 | | |
| 543 | | repeat with ffffffff.... |
| 544 | | |
| 545 | | repeat with 00000000.... |
| 546 | | |
| 547 | | A2DD82:graphics_w(0B6) = 00000000 |
| 548 | | A2DCAF:graphics_w(0B6) = 00000000 |
| 549 | | A2DCB3:graphics_w(0B2) = 7FFF7FFF |
| 550 | | A2DCB7:graphics_w(0B0) = 00000000 |
| 551 | | A2DCC2:graphics_w(0B4) = 007F0100 |
| 552 | | A2DCCD:graphics_w(0B6) = 80F20001 |
| 553 | | A2DD89:graphics_w(0B0) = 00000000 |
| 554 | | A2DD8A:graphics_r(0F6) \ ... x256 |
| 555 | | A2DD89:graphics_w(0B0) = 00000000 / |
| 556 | | |
| 557 | | A2DCAF:graphics_w(0B6) = 00000000 |
| 558 | | A2DCB3:graphics_w(0B2) = 7FFF7FFF |
| 559 | | A2DCB7:graphics_w(0B0) = 00000000 |
| 560 | | A2DCC2:graphics_w(0B4) = 007F0000 |
| 561 | | A2DCCD:graphics_w(0B6) = 80F20001 |
| 562 | | A2DD89:graphics_w(0B0) = 00000000 |
| 563 | | A2DD8A:graphics_r(0F6) \ ... x256 |
| 564 | | A2DD89:graphics_w(0B0) = 00000000 / |
| 565 | | |
| 566 | | drawing: |
| 567 | | A2DCEB:graphics_w(0B6) = 00000000 |
| 568 | | A2DCEF:graphics_w(0B2) = 7FFF7FFF |
| 569 | | A2DCF3:graphics_w(0B0) = 001F001F |
| 570 | | A2DCFE:graphics_w(0B4) = 00040104 |
| 571 | | A2DD02:graphics_w(0B7) = 80A00000 |
| 572 | | A2DD89:graphics_w(0B0) = 001F001F |
| 573 | | A2DD8A:graphics_r(0F6) |
| 574 | | A2DCEB:graphics_w(0B6) = 00000000 |
| 575 | | A2DCEF:graphics_w(0B2) = 7FFF7FFF |
| 576 | | A2DCF3:graphics_w(0B0) = 001F001F |
| 577 | | A2DCFE:graphics_w(0B4) = 00040105 |
| 578 | | A2DD07:graphics_w(0B7) = 80500000 |
| 579 | | A2DD89:graphics_w(0B0) = 001F001F |
| 580 | | A2DD8A:graphics_r(0F6) |
| 581 | | A2DCEB:graphics_w(0B6) = 00000000 |
| 582 | | A2DCEF:graphics_w(0B2) = 7FFF7FFF |
| 583 | | A2DCF3:graphics_w(0B0) = 001F001F |
| 584 | | A2DCFE:graphics_w(0B4) = 00040105 |
| 585 | | A2DD02:graphics_w(0B7) = 80A00000 |
| 586 | | A2DD89:graphics_w(0B0) = 001F001F |
| 587 | | A2DD8A:graphics_r(0F6) |
| 588 | | A2DCEB:graphics_w(0B6) = 00000000 |
| 589 | | A2DCEF:graphics_w(0B2) = 7FFF7FFF |
| 590 | | A2DCF3:graphics_w(0B0) = 001F001F |
| 591 | | A2DCFE:graphics_w(0B4) = 00040106 |
| 592 | | A2DD07:graphics_w(0B7) = 80500000 |
| 593 | | A2DD89:graphics_w(0B0) = 001F001F |
| 594 | | A2DD8A:graphics_r(0F6) |
| 595 | | |
| 596 | | |
| 597 | | Invasion: |
| 598 | | |
| 599 | | 011729:graphics_w(0E0) = 1A000000 |
| 600 | | 011729:graphics_w(0E0) = 187E0000 |
| 601 | | 011729:graphics_w(0E0) = 0000FFFF |
| 602 | | 011729:graphics_w(0E0) = 187C0000 |
| 603 | | 011729:graphics_w(0E0) = FFFFFFE0 |
| 604 | | 011729:graphics_w(0E0) = 187A0000 |
| 605 | | 011729:graphics_w(0E0) = 00800000 |
| 606 | | 011729:graphics_w(0E0) = 18780000 |
| 607 | | 011729:graphics_w(0E0) = 000000C7 |
| 608 | | 011729:graphics_w(0E0) = 18760000 |
| 609 | | 011729:graphics_w(0E0) = F8800000 |
| 610 | | 011729:graphics_w(0E0) = 176F0032 |
| 611 | | 011729:graphics_w(0E0) = 176E0031 |
| 612 | | 011729:graphics_w(0E0) = 176D003B |
| 613 | | 011729:graphics_w(0E0) = 176C002B |
| 614 | | 011729:graphics_w(0E0) = 184E0000 |
| 615 | | 011729:graphics_w(0E0) = 00808080 |
| 616 | | 011729:graphics_w(0E0) = 184C0000 |
| 617 | | 011729:graphics_w(0E0) = 00808080 |
| 618 | | 011729:graphics_w(0E0) = 184A0000 |
| 619 | | 011729:graphics_w(0E0) = 00FF018E |
| 620 | | 011729:graphics_w(0E0) = 18480000 |
| 621 | | 011729:graphics_w(0E0) = 00FF018E |
| 622 | | 011729:graphics_w(0E0) = 176940C4 |
| 623 | | 011729:graphics_w(0E0) = 17681370 |
| 624 | | 011729:graphics_w(0E0) = 1707FFFF |
| 625 | | 011729:graphics_w(0E0) = 17060030 |
| 626 | | 011729:graphics_w(0E0) = 17010000 |
| 627 | | 011729:graphics_w(0E0) = 2D007FFF |
| 628 | | 011729:graphics_w(0E0) = 2E000800 |
| 629 | | 011729:graphics_w(0E0) = 00000000 |
| 630 | | 011729:graphics_w(0E0) = 1757500A |
| 631 | | 011729:graphics_w(0E0) = 175600FF |
| 632 | | 011729:graphics_w(0E0) = 17524321 |
| 633 | | 011729:graphics_w(0E0) = 0100C0B0 |
| 634 | | 011729:graphics_w(0E0) = 3F001059 |
| 635 | | |
| 636 | | 011729:graphics_w(0E0) = 0100C0B0 |
| 637 | | 011729:graphics_w(0E0) = 3F001059 |
| 638 | | |
| 639 | | 011841:graphics_w(0E0) = 1A000000 |
| 640 | | 011841:graphics_w(0E0) = 1A000000 |
| 641 | | |
| 642 | | 00D09A:graphics_w(080) = FB22FC3F |
| 643 | | 00D01E:graphics_w(076) = F8800000 |
| 644 | | 00D020:graphics_w(0CC) = 00800000 |
| 645 | | 00D034:graphics_w(084) = 00000000 |
| 646 | | 00D0A7:graphics_r(0F2) = 00000000 |
| 647 | | 00D0C9:graphics_w(068) = 00000100 |
| 648 | | 00D0CA:graphics_w(000) = 00000000 |
| 649 | | 00D0CC:graphics_w(05C) = 00000000 |
| 650 | | 00D0CE:graphics_w(006) = FFFF0030 |
| 651 | | 00D0D0:graphics_w(002) = 000C0000 |
| 652 | | 00D0D2:graphics_w(004) = 00000E01 |
| 653 | | 00D0D4:graphics_w(04C) = 00808080 |
| 654 | | 00D0D5:graphics_w(04E) = 00808080 |
| 655 | | 00D0D6:graphics_w(008) = 00000000 |
| 656 | | 00D0D7:graphics_w(00C) = 00FF018F |
| 657 | | 00D0DD:graphics_w(00A) = 0000018F |
| 658 | | 00D0E3:graphics_w(00E) = 00FF0000 |
| 659 | | 00D0E5:graphics_w(01E) = FFFFFFFF |
| 660 | | 00D0E6:graphics_w(01C) = FFFFFFFF |
| 661 | | 00D0E7:graphics_w(01A) = FFFFFFFF |
| 662 | | 00D0E8:graphics_w(018) = FFFFFFFF |
| 663 | | 00D0EA:graphics_w(046) = 00000000 |
| 664 | | 00D0EB:graphics_w(044) = 00000000 |
| 665 | | 00D0EC:graphics_w(042) = 00000000 |
| 666 | | 00D0ED:graphics_w(040) = 00000000 |
| 667 | | 00D0EE:graphics_w(026) = 00000000 |
| 668 | | 00D0EF:graphics_w(024) = 00000000 |
| 669 | | 00D0F0:graphics_w(022) = 00000000 |
| 670 | | 00D0F1:graphics_w(020) = 00000000 |
| 671 | | 00D09A:graphics_w(080) = FB22FCFF |
| 672 | | 00D0F6:graphics_w(060) = 00000001 |
| 673 | | 00D09A:graphics_w(080) = FB22FC3F |
| 674 | | 011729:graphics_w(0E0) = 1757500A |
| 675 | | 011729:graphics_w(0E0) = 175600FF |
| 676 | | 00D09A:graphics_w(080) = 0222FC3F |
| 677 | | |
| 678 | | */ |
| 679 | | |
| 680 | | INLINE UINT32 *graphics_pixaddr(void) |
| 681 | | { |
| 682 | | int p = (graphics_ram[0xb7] >> 15) & 1; |
| 683 | | int x = (graphics_ram[0xb4] & 0xff) << 1; |
| 684 | | int y = ((graphics_ram[0xb4] >> 8) & 0x01) | ((graphics_ram[0xb5] << 1) & 0xffe); |
| 685 | | return &waveram[(p * WAVERAM_HEIGHT + (y % WAVERAM_HEIGHT)) * WAVERAM_WIDTH + x]; |
| 686 | | } |
| 687 | | |
| 688 | | |
| 689 | | static READ32_HANDLER( graphics_r ) |
| 690 | | { |
| 691 | | UINT32 result; |
| 692 | | int logit = 1; |
| 693 | | |
| 694 | | if (offset >= 0xb0 && offset <= 0xb7) |
| 695 | | logit = graphics_ram[0xb4] < 8; |
| 696 | | |
| 697 | | result = graphics_ram[offset & ~1] | (graphics_ram[offset | 1] << 16); |
| 698 | | |
| 699 | | switch (offset) |
| 700 | | { |
| 701 | | case 0x00: |
| 702 | | // crusnexo wants bit 0x20 to be non-zero |
| 703 | | result = 0x20; |
| 704 | | break; |
| 705 | | case 0x51: |
| 706 | | // crusnexo expects a reflection of the data at 0x08 here (b425) |
| 707 | | result = graphics_ram[0x08]; |
| 708 | | break; |
| 709 | | case 0xf4: |
| 710 | | result = 6; |
| 711 | | logit = 0; |
| 712 | | break; |
| 713 | | case 0xf6: // status -- they wait for this & 9 == 0 |
| 714 | | result = 0; |
| 715 | | logit = 0; |
| 716 | | break; |
| 717 | | } |
| 718 | | |
| 719 | | if (logit || input_code_pressed(KEYCODE_F11)) |
| 720 | | logerror("%06X:graphics_r(%03X) = %08X\n", activecpu_get_pc(), offset, result); |
| 721 | | return result; |
| 722 | | } |
| 723 | | |
| 724 | | |
| 725 | | /* |
| 726 | | Writes to even addresses: reg[offs] = data & 0xffff; reg[offs+1] = data >> 16; |
| 727 | | Writes to odd addresses: reg[offs] = data & 0xffff; |
| 728 | | |
| 729 | | Control in $B7. |
| 730 | | Enable in $B6. |
| 731 | | Y/2 in $B5. |
| 732 | | X | ((Y & 1) << 8) in $B4. |
| 733 | | Depth data in $B2/$B3. |
| 734 | | Pixel data in $B0/$B1. |
| 735 | | |
| 736 | | Control = $80F6 when doing initial screen clear. |
| 737 | | Writes 256 consecutive values to $B0, must mean autoincrement |
| 738 | | Uses latched value in $B2 (maybe also in $B0) |
| 739 | | |
| 740 | | Control = $82F0 when doing video RAM test write phase. |
| 741 | | Writes 512 values across, but updates address before each one. |
| 742 | | |
| 743 | | Control = $84F1 when doing video RAM test read phase. |
| 744 | | Reads 512 values across, but updates address before each one. |
| 745 | | |
| 746 | | Control = $80F2 when doing screen clear. |
| 747 | | Writes 256 consecutive values to $B0, must mean autoincrement. |
| 748 | | Uses latched value in $B2 (maybe also in $B0) |
| 749 | | |
| 750 | | Control = $80A0/$8050 when plotting pixels. |
| 751 | | |
| 752 | | Control = $42F0 when doing wave RAM test write phase. |
| 753 | | Writes 512 values across, but updates address before each one. |
| 754 | | |
| 755 | | Control = $44F1 when doing wave RAM test read phase. |
| 756 | | Reads 512 values across, but updates address before each one. |
| 757 | | |
| 758 | | |
| 759 | | Low bits = operation? |
| 760 | | $0 = write single |
| 761 | | $1 = read single |
| 762 | | $2 = write autoinc |
| 763 | | */ |
| 764 | | |
| 765 | | static WRITE32_HANDLER( graphics_w ) |
| 766 | | { |
| 767 | | int logit = 1; |
| 768 | | |
| 769 | | if (offset >= 0xb0 && offset <= 0xb7) |
| 770 | | logit = graphics_ram[0xb4] < 8; |
| 771 | | |
| 772 | | if (!(offset & 1)) |
| 773 | | graphics_ram[offset | 0] = data & 0xffff; |
| 774 | | graphics_ram[offset | 1] = data >> 16; |
| 775 | | |
| 776 | | switch (offset) |
| 777 | | { |
| 778 | | case 0xb0: |
| 779 | | case 0xb2: |
| 780 | | { |
| 781 | | UINT32 *dest = graphics_pixaddr(); |
| 782 | | if (input_code_pressed(KEYCODE_F11)) logerror("B7=%04X x=%3d y=%3d B0=%04X%04X B2=%04X%04X\n", |
| 783 | | graphics_ram[0xb7], |
| 784 | | (graphics_ram[0xb4] & 0xff) << 1, |
| 785 | | ((graphics_ram[0xb4] >> 8) & 0x01) | ((graphics_ram[0xb5] << 1) & 0xffe), |
| 786 | | graphics_ram[0xb0],graphics_ram[0xb1], |
| 787 | | graphics_ram[0xb2],graphics_ram[0xb3]); |
| 788 | | |
| 789 | | if (graphics_ram[0xb7] != 0) |
| 790 | | { |
| 791 | | if (graphics_ram[0xb7] & 0x0050) |
| 792 | | dest[0] = (graphics_ram[0xb2] << 16) | graphics_ram[0xb0]; |
| 793 | | if (graphics_ram[0xb7] & 0x00a0) |
| 794 | | dest[1] = (graphics_ram[0xb3] << 16) | graphics_ram[0xb1]; |
| 795 | | switch (graphics_ram[0xb7] & 3) |
| 796 | | { |
| 797 | | case 0: |
| 798 | | case 1: |
| 799 | | break; |
| 800 | | case 2: |
| 801 | | case 3: |
| 802 | | graphics_ram[0xb4]++; |
| 803 | | break; |
| 804 | | } |
| 805 | | { |
| 806 | | static int count = 0; |
| 807 | | popmessage("WaveRAM writes = %X", ++count); |
| 808 | | } |
| 809 | | } |
| 810 | | break; |
| 811 | | } |
| 812 | | |
| 813 | | case 0xb4: |
| 814 | | { |
| 815 | | if (graphics_ram[0xb7] & 1) |
| 816 | | { |
| 817 | | UINT32 *src = graphics_pixaddr(); |
| 818 | | graphics_ram[0xb0] = src[0] & 0xffff; |
| 819 | | graphics_ram[0xb1] = src[1] & 0xffff; |
| 820 | | graphics_ram[0xb2] = src[0] >> 16; |
| 821 | | graphics_ram[0xb3] = src[1] >> 16; |
| 822 | | } |
| 823 | | break; |
| 824 | | } |
| 825 | | } |
| 826 | | |
| 827 | | if (logit || input_code_pressed(KEYCODE_F11)) |
| 828 | | logerror("%06X:graphics_w(%03X) = %08X\n", activecpu_get_pc(), offset, data); |
| 829 | | } |
| 830 | | |
| 831 | | |
| 832 | | static READ32_HANDLER( graphics2_r ) |
| 833 | | { |
| 834 | | return graphics_r(offset * 2, 0); |
| 835 | | } |
| 836 | | |
| 837 | | |
| 838 | | static WRITE32_HANDLER( graphics2_w ) |
| 839 | | { |
| 840 | | graphics_w(offset * 2, data, mem_mask); |
| 841 | | } |
| 842 | | |
| 843 | | |
| 844 | | |
| 845 | 35 | /************************************* |
| 846 | 36 | * |
| 847 | 37 | * Machine init |
| r1215 | r1216 | |
| 960 | 150 | AM_RANGE(0x400000, 0x41ffff) AM_RAM |
| 961 | 151 | AM_RANGE(0x808000, 0x80807f) AM_READWRITE(tms32031_control_r, tms32031_control_w) AM_BASE(&tms32031_control) |
| 962 | 152 | AM_RANGE(0x87fe00, 0x87ffff) AM_RAM |
| 963 | | AM_RANGE(0x880000, 0x8803ff) AM_READWRITE(graphics_r, graphics_w) AM_BASE(&graphics_ram) |
| 153 | AM_RANGE(0x880000, 0x8803ff) AM_READWRITE(zeus_r, zeus_w) AM_BASE(&zeusbase) |
| 964 | 154 | AM_RANGE(0x8d0000, 0x8d0003) AM_READWRITE(unknown_8d0000_r, unknown_8d0000_w) AM_BASE(&unknown_8d0000) |
| 965 | 155 | AM_RANGE(0x990000, 0x99000f) AM_READWRITE(midway_ioasic_r, midway_ioasic_w) |
| 966 | 156 | //9d0000 -- page select? |
| r1215 | r1216 | |
| 977 | 167 | AM_RANGE(0x400000, 0x43ffff) AM_RAM |
| 978 | 168 | AM_RANGE(0x808000, 0x80807f) AM_READWRITE(tms32031_control_r, tms32031_control_w) AM_BASE(&tms32031_control) |
| 979 | 169 | AM_RANGE(0x87fe00, 0x87ffff) AM_RAM |
| 980 | | AM_RANGE(0x880000, 0x8801ff) AM_READWRITE(graphics2_r, graphics2_w) AM_BASE(&graphics_ram) |
| 170 | AM_RANGE(0x880000, 0x8801ff) AM_READWRITE(zeus2_r, zeus2_w) AM_BASE(&zeusbase) |
| 981 | 171 | AM_RANGE(0x8d0000, 0x8d0003) AM_READWRITE(unknown_8d0000_r, unknown_8d0000_w) AM_BASE(&unknown_8d0000) |
| 982 | 172 | AM_RANGE(0x990000, 0x99000f) AM_READWRITE(midway_ioasic_r, midway_ioasic_w) |
| 983 | 173 | //9d0000 -- page select? |
| r1215 | r1216 | |
| 997 | 187 | |
| 998 | 188 | INPUT_PORTS_START( mk4 ) |
| 999 | 189 | PORT_START /* DS1 */ |
| 1000 | | PORT_DIPNAME( 0x0001, 0x0001, "Fatalities" ) |
| 1001 | | PORT_DIPSETTING( 0x0001, DEF_STR( Off )) |
| 190 | PORT_DIPNAME( 0x0001, 0x0001, "Coinage Source" ) |
| 191 | PORT_DIPSETTING( 0x0001, "Dipswitch" ) |
| 192 | PORT_DIPSETTING( 0x0000, "CMOS" ) |
| 193 | PORT_DIPNAME( 0x003e, 0x003e, DEF_STR( Coinage )) |
| 194 | PORT_DIPSETTING( 0x003e, "USA-1" ) |
| 195 | PORT_DIPSETTING( 0x003c, "USA-2" ) |
| 196 | PORT_DIPSETTING( 0x003a, "USA-3" ) |
| 197 | PORT_DIPSETTING( 0x0038, "USA-4" ) |
| 198 | PORT_DIPSETTING( 0x0034, "USA-9" ) |
| 199 | PORT_DIPSETTING( 0x0032, "USA-11" ) |
| 200 | PORT_DIPSETTING( 0x0036, "USA-ECA" ) |
| 201 | PORT_DIPSETTING( 0x002e, "German-1" ) |
| 202 | PORT_DIPSETTING( 0x002c, "German-2" ) |
| 203 | PORT_DIPSETTING( 0x002a, "German-3" ) |
| 204 | PORT_DIPSETTING( 0x0028, "German-4" ) |
| 205 | PORT_DIPSETTING( 0x0026, "German-ECA" ) |
| 206 | PORT_DIPSETTING( 0x001e, "French-1" ) |
| 207 | PORT_DIPSETTING( 0x001c, "French-2" ) |
| 208 | PORT_DIPSETTING( 0x001a, "French-3" ) |
| 209 | PORT_DIPSETTING( 0x0018, "French-4" ) |
| 210 | PORT_DIPSETTING( 0x0016, "French-ECA" ) |
| 211 | PORT_DIPSETTING( 0x0030, DEF_STR( Free_Play )) |
| 212 | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown )) /* Manual lists this dip as Unused */ |
| 213 | PORT_DIPSETTING( 0x0040, DEF_STR( Off )) |
| 1002 | 214 | PORT_DIPSETTING( 0x0000, DEF_STR( On )) |
| 1003 | | PORT_DIPNAME( 0x0002, 0x0002, "Blood" ) |
| 1004 | | PORT_DIPSETTING( 0x0002, DEF_STR( Off )) |
| 215 | PORT_DIPNAME( 0x0080, 0x0080, "Test Switch" ) |
| 216 | PORT_DIPSETTING( 0x0080, DEF_STR( Off )) |
| 1005 | 217 | PORT_DIPSETTING( 0x0000, DEF_STR( On )) |
| 1006 | | PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown )) /* Manual states that switches 3-7 are Unused */ |
| 1007 | | PORT_DIPSETTING( 0x0004, DEF_STR( Off )) |
| 1008 | | PORT_DIPSETTING( 0x0000, DEF_STR( On )) |
| 1009 | | PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown )) |
| 218 | PORT_DIPNAME( 0x0100, 0x0100, "Fatalities" ) |
| 1010 | 219 | PORT_DIPSETTING( 0x0000, DEF_STR( Off )) |
| 1011 | | PORT_DIPSETTING( 0x0008, DEF_STR( On )) |
| 1012 | | PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown )) |
| 1013 | | PORT_DIPSETTING( 0x0010, DEF_STR( Off )) |
| 1014 | | PORT_DIPSETTING( 0x0000, DEF_STR( On )) |
| 1015 | | PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown )) |
| 1016 | | PORT_DIPSETTING( 0x0020, DEF_STR( Off )) |
| 220 | PORT_DIPSETTING( 0x0100, DEF_STR( On )) |
| 221 | PORT_DIPNAME( 0x0200, 0x0200, "Blood" ) |
| 222 | PORT_DIPSETTING( 0x0000, DEF_STR( Off )) |
| 223 | PORT_DIPSETTING( 0x0200, DEF_STR( On )) |
| 224 | PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown )) /* Manual states that switches 3-7 are Unused */ |
| 225 | PORT_DIPSETTING( 0x0400, DEF_STR( Off )) |
| 1017 | 226 | PORT_DIPSETTING( 0x0000, DEF_STR( On )) |
| 1018 | | PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown )) |
| 1019 | | PORT_DIPSETTING( 0x0040, DEF_STR( Off )) |
| 227 | PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown )) |
| 228 | PORT_DIPSETTING( 0x0800, DEF_STR( Off )) |
| 1020 | 229 | PORT_DIPSETTING( 0x0000, DEF_STR( On )) |
| 1021 | | PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown )) |
| 1022 | | PORT_DIPSETTING( 0x0080, DEF_STR( Off )) |
| 230 | PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown )) |
| 231 | PORT_DIPSETTING( 0x1000, DEF_STR( Off )) |
| 232 | PORT_DIPSETTING( 0x0000, DEF_STR( On )) |
| 233 | PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown )) |
| 234 | PORT_DIPSETTING( 0x2000, DEF_STR( Off )) |
| 1023 | 235 | PORT_DIPSETTING( 0x0000, DEF_STR( On )) |
| 1024 | | PORT_DIPNAME( 0x0100, 0x0100, "Coinage Source" ) |
| 1025 | | PORT_DIPSETTING( 0x0100, "Dipswitch" ) |
| 1026 | | PORT_DIPSETTING( 0x0000, "CMOS" ) |
| 1027 | | PORT_DIPNAME( 0x3e00, 0x3e00, DEF_STR( Coinage )) |
| 1028 | | PORT_DIPSETTING( 0x3e00, "USA-1" ) |
| 1029 | | PORT_DIPSETTING( 0x3c00, "USA-2" ) |
| 1030 | | PORT_DIPSETTING( 0x3a00, "USA-3" ) |
| 1031 | | PORT_DIPSETTING( 0x3800, "USA-4" ) |
| 1032 | | PORT_DIPSETTING( 0x3400, "USA-9" ) |
| 1033 | | PORT_DIPSETTING( 0x3200, "USA-11" ) |
| 1034 | | PORT_DIPSETTING( 0x3600, "USA-ECA" ) |
| 1035 | | PORT_DIPSETTING( 0x2e00, "German-1" ) |
| 1036 | | PORT_DIPSETTING( 0x2c00, "German-2" ) |
| 1037 | | PORT_DIPSETTING( 0x2a00, "German-3" ) |
| 1038 | | PORT_DIPSETTING( 0x2800, "German-4" ) |
| 1039 | | PORT_DIPSETTING( 0x2600, "German-ECA" ) |
| 1040 | | PORT_DIPSETTING( 0x1e00, "French-1" ) |
| 1041 | | PORT_DIPSETTING( 0x1c00, "French-2" ) |
| 1042 | | PORT_DIPSETTING( 0x1a00, "French-3" ) |
| 1043 | | PORT_DIPSETTING( 0x1800, "French-4" ) |
| 1044 | | PORT_DIPSETTING( 0x1600, "French-ECA" ) |
| 1045 | | PORT_DIPSETTING( 0x3000, DEF_STR( Free_Play )) |
| 1046 | | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown )) /* Manual lists this dip as Unused */ |
| 236 | PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown )) |
| 1047 | 237 | PORT_DIPSETTING( 0x4000, DEF_STR( Off )) |
| 1048 | 238 | PORT_DIPSETTING( 0x0000, DEF_STR( On )) |
| 1049 | | PORT_DIPNAME( 0x8000, 0x8000, "Test Switch" ) |
| 239 | PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown )) |
| 1050 | 240 | PORT_DIPSETTING( 0x8000, DEF_STR( Off )) |
| 1051 | 241 | PORT_DIPSETTING( 0x0000, DEF_STR( On )) |
| 1052 | 242 | |
| r1215 | r1216 | |
| 1443 | 633 | /* video hardware */ |
| 1444 | 634 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| 1445 | 635 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 1446 | | MDRV_SCREEN_SIZE(512, 432) |
| 1447 | | MDRV_SCREEN_VISIBLE_AREA(0, 511, 0, 399) |
| 636 | MDRV_SCREEN_SIZE(512, 278) |
| 637 | MDRV_SCREEN_VISIBLE_AREA(0, 399, 0, 255) |
| 1448 | 638 | MDRV_PALETTE_LENGTH(32768) |
| 1449 | 639 | |
| 1450 | 640 | MDRV_VIDEO_START(midzeus) |
| r1215 | r1216 | |
| 1625 | 815 | * |
| 1626 | 816 | *************************************/ |
| 1627 | 817 | |
| 1628 | | GAME( 1997, mk4, 0, midzeus, mk4, mk4, ROT0, "Midway", "Mortal Kombat 4 (rev L3)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 1629 | | GAME( 1997, mk4a, mk4, midzeus, mk4, mk4, ROT0, "Midway", "Mortal Kombat 4 (? rev)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 818 | GAME( 1997, mk4, 0, midzeus, mk4, mk4, ROT0, "Midway", "Mortal Kombat 4 (3.0)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 819 | GAME( 1997, mk4a, mk4, midzeus, mk4, mk4, ROT0, "Midway", "Mortal Kombat 4 (2.1)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 1630 | 820 | GAME( 1999, invasn, 0, midzeus, invasn, invasn, ROT0, "Midway", "Invasion (Midway)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 1631 | 821 | GAME( 1999, crusnexo, 0, midzeus2, crusnexo, crusnexo, ROT0, "Midway", "Cruis'n Exotica", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 1632 | 822 | GAME( 2001, thegrid, 0, midzeus2, thegrid, thegrid, ROT0, "Midway", "The Grid (version 1.1)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
src/mame/drivers/mpu4.c
| r1215 | r1216 | |
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | MPU4 highly preliminary driver by J.Wallace, and Anonymous. |
| 3 | 3 | |
| 4 | 09-2007: Haze: Added Deal 'Em video support. |
| 4 | 5 | 03-08-2007: J Wallace: Removed audio filter for now, since sound is more accurate without them. |
| 5 | 6 | Connect 4 now has the right sound. |
| 6 | 7 | 03-07-2007: J Wallace: Several major changes, including input relabelling, and system timer improvements. |
| r1215 | r1216 | |
| 10 | 11 | Revisionism, if you will. |
| 11 | 12 | 17-02-2007: J Wallace: Added Deal 'Em - still needs some work. |
| 12 | 13 | 10-02-2007: J Wallace: Improved input timing. |
| 13 | | It appears Connect 4 uses a different sound mapping to regular Barcrest games. |
| 14 | 14 | 30-01-2007: J Wallace: Characteriser rewritten to run the 'extra' data needed by some games. |
| 15 | 15 | 24-01-2007: J Wallace: With thanks to Canonman and HIGHWAYMAN/System 80, I was able to confirm a seemingly |
| 16 | 16 | ghastly misuse of a PIA is actually on the real hardware. This fixes the meters. |
| r1215 | r1216 | |
| 262 | 262 | - Confirm that MC6850 emulation is sufficient. |
| 263 | 263 | - MPU4 Master clock value taken from schematic, but 68k value is not. |
| 264 | 264 | - On IRQ, inhibit line goes low. |
| 265 | |
| 266 | - Test mode appears to malfunction in Refill mode in Deal 'Em |
| 267 | - Distinguish door switches using manual |
| 265 | 268 | *****************************************************************************************/ |
| 266 | 269 | |
| 267 | 270 | #include "driver.h" |
| r1215 | r1216 | |
| 274 | 277 | #include "cpu/m6809/m6809.h" |
| 275 | 278 | #include "sound/ay8910.h" |
| 276 | 279 | #include "sound/flt_rc.h" |
| 277 | | #include "sound/2413intf.h" |
| 278 | 280 | #include "machine/steppers.h" // stepper motor |
| 279 | 281 | #include "machine/roc10937.h" // vfd |
| 280 | 282 | #include "machine/mmtr.h" |
| r1215 | r1216 | |
| 288 | 290 | #include "video/crtc6845.h" |
| 289 | 291 | |
| 290 | 292 | #ifdef MAME_DEBUG |
| 291 | | #define LOG(x) |
| 292 | | #define LOG_CHR(x) |
| 293 | | #define LOG_IC3(x) |
| 294 | | #define LOG_IC8(x) |
| 295 | | #define LOGSTUFF(x) |
| 293 | #define LOG(x)logerror x |
| 294 | #define LOG_CHR(x)logerror x |
| 295 | #define LOG_CHR_FULL(x)logerror x |
| 296 | #define LOG_IC3(x)logerror x |
| 297 | #define LOG_IC8(x)logerror x |
| 298 | #define LOGSTUFF(x)logerror x |
| 296 | 299 | #else |
| 297 | 300 | #define LOG(x) |
| 298 | 301 | #define LOG_CHR(x) |
| 302 | #define LOG_CHR_FULL(x) |
| 299 | 303 | #define LOG_IC3(x) |
| 300 | 304 | #define LOG_IC8(x) |
| 301 | 305 | #define LOGSTUFF(x) |
| r1215 | r1216 | |
| 323 | 327 | static int IC23GA; |
| 324 | 328 | static int prot_col; |
| 325 | 329 | static int lamp_col; |
| 326 | | static int ic24_active; |
| 330 | static int ic23_active; |
| 327 | 331 | static int led_extend; |
| 328 | 332 | static mame_timer *ic24_timer; |
| 329 | 333 | static mame_timer *freq_timer; |
| r1215 | r1216 | |
| 339 | 343 | UINT8 MPU4_chr_data[72]; |
| 340 | 344 | static UINT8 led_segs[8]; |
| 341 | 345 | static UINT8 Lamps[128]; // 128 multiplexed lamps |
| 342 | | //static UINT8 Lampscopy[128]; |
| 343 | 346 | // 32 multiplexed inputs - but a further 8 possible per AUX. |
| 344 | 347 | // Two connectors 'orange' (sampled every 8ms) and 'black' (sampled every 16ms) |
| 345 | 348 | // Each connector carries two banks of eight inputs and two enable signals |
| r1215 | r1216 | |
| 395 | 398 | output_set_digit_value(id,value); |
| 396 | 399 | } |
| 397 | 400 | |
| 401 | static void draw_lamps(void) |
| 402 | { |
| 403 | int i; |
| 404 | |
| 405 | for (i=0; i<8; i++) |
| 406 | { |
| 407 | output_set_lamp_value((8*input_strobe)+i, (Lamps[(8*input_strobe)+i])); |
| 408 | output_set_lamp_value((8*input_strobe)+i+64, (Lamps[(8*input_strobe)+i+64])); |
| 409 | } |
| 410 | |
| 411 | } |
| 412 | |
| 398 | 413 | static void update_lamps(void) |
| 399 | 414 | { |
| 400 | 415 | int i; |
| r1215 | r1216 | |
| 422 | 437 | mpu4_draw_led(8, pled_segs[0]); |
| 423 | 438 | mpu4_draw_led(9, pled_segs[1]); |
| 424 | 439 | } |
| 425 | | } |
| 426 | 440 | |
| 427 | | static void draw_lamps(void) |
| 428 | | { |
| 429 | | int i; |
| 430 | | |
| 431 | | for (i=0; i<8; i++) |
| 432 | | { |
| 433 | | output_set_lamp_value((8*input_strobe)+i, (Lamps[(8*input_strobe)+i])); |
| 434 | | output_set_lamp_value((8*input_strobe)+i+64, (Lamps[(8*input_strobe)+i+64])); |
| 435 | | } |
| 436 | 441 | } |
| 437 | 442 | |
| 438 | 443 | // palette initialisation ///////////////////////////////////////////////// |
| r1215 | r1216 | |
| 585 | 590 | 6821 PIA handlers |
| 586 | 591 | ***************************************************************************/ |
| 587 | 592 | |
| 593 | // IC3 |
| 588 | 594 | static WRITE8_HANDLER( pia_ic3_porta_w ) |
| 589 | 595 | { |
| 590 | 596 | LOG_IC3(("%04x IC3 PIA Port A Set to %2x (lamp strobes 1 - 9)\n", activecpu_get_previouspc(),data)); |
| 591 | 597 | |
| 592 | | lamp_strobe = data; |
| 593 | | update_lamps(); |
| 598 | if(ic23_active) |
| 599 | { |
| 600 | lamp_strobe = data; |
| 601 | update_lamps(); |
| 602 | } |
| 594 | 603 | } |
| 595 | 604 | |
| 596 | 605 | static WRITE8_HANDLER( pia_ic3_portb_w ) |
| 597 | 606 | { |
| 598 | 607 | LOG_IC3(("%04x IC3 PIA Port B Set to %2x (lamp strobes 10 - 17)\n", activecpu_get_previouspc(),data)); |
| 599 | 608 | |
| 600 | | lamp_strobe2 = data; |
| 601 | | update_lamps(); |
| 609 | if(ic23_active) |
| 610 | { |
| 611 | lamp_strobe2 = data; |
| 612 | update_lamps(); |
| 613 | } |
| 602 | 614 | } |
| 603 | 615 | |
| 604 | 616 | static WRITE8_HANDLER( pia_ic3_ca2_w ) |
| 605 | 617 | { |
| 606 | | LOG_IC3(("%04x IC3 PIA Write CA2 (alpha data), %02X\n", activecpu_get_previouspc(),data&0xFF)); |
| 618 | LOG_IC3(("%04x IC3 PIA Write CA2 (alpha data), %02X\n", activecpu_get_previouspc(),data&0xff)); |
| 607 | 619 | |
| 608 | 620 | alpha_data_line = data; |
| 609 | 621 | ROC10937_draw_16seg(0); |
| r1215 | r1216 | |
| 659 | 671 | { |
| 660 | 672 | input_strobe = 0x00; |
| 661 | 673 | } |
| 674 | draw_lamps(); |
| 662 | 675 | } |
| 663 | 676 | /*--------------------------------------- |
| 664 | 677 | IC24 emulation |
| r1215 | r1216 | |
| 679 | 692 | if (IC23GA) |
| 680 | 693 | { |
| 681 | 694 | double duration = TIME_OF_74LS123((220*1000),(0.1*0.000001)); |
| 682 | | if (!ic24_active) |
| 683 | 695 | { |
| 696 | ic23_active=1; |
| 684 | 697 | ic24_output(0); |
| 685 | 698 | mame_timer_adjust(ic24_timer, double_to_mame_time(duration), 0, time_zero); |
| 686 | | ic24_active = 1; |
| 687 | 699 | } |
| 688 | | draw_lamps(); |
| 689 | 700 | } |
| 690 | 701 | } |
| 691 | 702 | |
| 692 | 703 | static TIMER_CALLBACK( ic24_timeout ) |
| 693 | 704 | { |
| 694 | | ic24_active = 0; |
| 705 | ic23_active=0; |
| 695 | 706 | ic24_output(1); |
| 696 | 707 | } |
| 697 | 708 | |
| 709 | // IC4 |
| 710 | |
| 698 | 711 | static WRITE8_HANDLER( pia_ic4_porta_w ) |
| 699 | 712 | { |
| 700 | | led_segs[input_strobe] = data; |
| 701 | | mpu4_draw_led(input_strobe, led_segs[input_strobe]); |
| 713 | if(ic23_active) |
| 714 | { |
| 715 | led_segs[input_strobe] = data; |
| 716 | mpu4_draw_led(input_strobe, led_segs[input_strobe]); |
| 717 | } |
| 702 | 718 | } |
| 703 | 719 | |
| 704 | 720 | static READ8_HANDLER( pia_ic4_portb_r ) |
| r1215 | r1216 | |
| 753 | 769 | /*irqs : A/B */ cpu0_irq, cpu0_irq |
| 754 | 770 | }; |
| 755 | 771 | |
| 772 | //IC5 |
| 756 | 773 | static READ8_HANDLER( pia_ic5_porta_r ) |
| 757 | 774 | { |
| 758 | 775 | LOG(("%04x IC5 PIA Read of Port A (AUX1)\n",activecpu_get_previouspc())); |
| r1215 | r1216 | |
| 847 | 864 | /*irqs : A/B */ cpu0_irq, cpu0_irq |
| 848 | 865 | }; |
| 849 | 866 | |
| 867 | //IC6 |
| 850 | 868 | static WRITE8_HANDLER( pia_ic6_portb_w ) |
| 851 | 869 | { |
| 852 | 870 | LOG(("%04x IC6 PIA Port B Set to %2x (Reel A and B)\n", activecpu_get_previouspc(),data)); |
| 871 | Stepper_update(0, data & 0x0F ); |
| 872 | Stepper_update(1, (data>>4) & 0x0F ); |
| 853 | 873 | |
| 854 | | Stepper_update(0, (data >> 4) & 0x0F ); |
| 855 | | Stepper_update(1, data & 0x0F ); |
| 856 | | |
| 857 | | if ( pia_get_output_cb2(1)) |
| 874 | // if ( pia_get_output_cb2(1)) |
| 858 | 875 | { |
| 859 | 876 | if ( Stepper_optic_state(0) ) optic_pattern |= 0x01; |
| 860 | 877 | else optic_pattern &= ~0x01; |
| 878 | |
| 861 | 879 | if ( Stepper_optic_state(1) ) optic_pattern |= 0x02; |
| 862 | 880 | else optic_pattern &= ~0x02; |
| 863 | 881 | } |
| 882 | // awp_draw_reel(0); |
| 883 | // awp_draw_reel(1); |
| 864 | 884 | } |
| 865 | 885 | |
| 866 | 886 | static WRITE8_HANDLER( pia_ic6_porta_w ) |
| r1215 | r1216 | |
| 902 | 922 | /*irqs : A/B */ cpu0_irq, cpu0_irq |
| 903 | 923 | }; |
| 904 | 924 | |
| 925 | //IC7 |
| 905 | 926 | static WRITE8_HANDLER( pia_ic7_porta_w ) |
| 906 | 927 | { |
| 907 | 928 | LOG(("%04x IC7 PIA Port A Set to %2x (Reel C and D)\n", activecpu_get_previouspc(),data)); |
| 929 | Stepper_update(2, data & 0x0F ); |
| 930 | Stepper_update(3, (data >> 4)& 0x0F ); |
| 908 | 931 | |
| 909 | | Stepper_update(2, (data >> 4) & 0x0F ); |
| 910 | | Stepper_update(3, data & 0x0F ); |
| 911 | | |
| 912 | | if ( pia_get_output_cb2(1)) |
| 932 | // if ( pia_get_output_cb2(1)) |
| 913 | 933 | { |
| 914 | 934 | if ( Stepper_optic_state(2) ) optic_pattern |= 0x04; |
| 915 | 935 | else optic_pattern &= ~0x04; |
| 916 | 936 | if ( Stepper_optic_state(3) ) optic_pattern |= 0x08; |
| 917 | 937 | else optic_pattern &= ~0x08; |
| 918 | 938 | } |
| 939 | // awp_draw_reel(2); |
| 940 | // awp_draw_reel(3); |
| 919 | 941 | } |
| 920 | 942 | |
| 921 | 943 | static WRITE8_HANDLER( pia_ic7_portb_w ) |
| r1215 | r1216 | |
| 1078 | 1100 | // Communications //////////////////////////////////////////////////////// |
| 1079 | 1101 | /* Clock values are currently unknown, and are derived from the 68k board. |
| 1080 | 1102 | For now, it's fixed to the frequency set by the PTM on initialisation.*/ |
| 1081 | | |
| 1103 | static void cpu1a_acia_irq(int state) |
| 1104 | { |
| 1105 | cpunum_set_input_line(0, M6809_IRQ_LINE, state ? CLEAR_LINE : ASSERT_LINE); |
| 1106 | // m6850_irq_state = state; |
| 1107 | // update_mpu68_interrupts(); |
| 1108 | logerror("6809 acia irq \n"); |
| 1109 | } |
| 1082 | 1110 | static void cpu1_acia_irq(int state) |
| 1083 | 1111 | { |
| 1084 | | cpunum_set_input_line(0, M6809_IRQ_LINE, state?ASSERT_LINE:CLEAR_LINE); |
| 1085 | | m6850_irq_state = state; |
| 1086 | | update_mpu68_interrupts(); |
| 1087 | | LOG(("acia irq \n")); |
| 1112 | // cpunum_set_input_line(0, M6809_IRQ_LINE, state?ASSERT_LINE:CLEAR_LINE); |
| 1113 | m6850_irq_state = state; |
| 1114 | update_mpu68_interrupts(); |
| 1115 | logerror("68k acia irq \n"); |
| 1088 | 1116 | } |
| 1089 | 1117 | |
| 1090 | 1118 | static struct acia6850_interface m6809_acia_if = |
| r1215 | r1216 | |
| 1093 | 1121 | MPU4_MASTER_CLOCK/44,//the ACIA code's hard coding |
| 1094 | 1122 | &m68k_m6809_line, |
| 1095 | 1123 | &m6809_m68k_line, |
| 1096 | | cpu1_acia_irq |
| 1124 | NULL, |
| 1125 | NULL, |
| 1126 | NULL, |
| 1127 | cpu1a_acia_irq |
| 1097 | 1128 | }; |
| 1098 | 1129 | |
| 1099 | 1130 | static struct acia6850_interface m68k_acia_if = |
| r1215 | r1216 | |
| 1102 | 1133 | MPU4_MASTER_CLOCK/44, |
| 1103 | 1134 | &m6809_m68k_line, |
| 1104 | 1135 | &m68k_m6809_line, |
| 1105 | | 0 |
| 1136 | NULL, |
| 1137 | NULL, |
| 1138 | NULL, |
| 1139 | cpu1_acia_irq |
| 1106 | 1140 | }; |
| 1107 | 1141 | |
| 1108 | 1142 | static void cpu1_irq(int state) |
| r1215 | r1216 | |
| 2142 | 2176 | |
| 2143 | 2177 | INPUT_PORTS_START( dealem ) |
| 2144 | 2178 | PORT_START_TAG("ORANGE1") |
| 2145 | | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("00") |
| 2146 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("01") |
| 2147 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("02") |
| 2148 | | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("03") |
| 2149 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("04") |
| 2150 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("05") |
| 2151 | | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("06") |
| 2152 | | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("07") |
| 2179 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Gamble") |
| 2180 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_START2) PORT_NAME("Pontoon") |
| 2181 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 2182 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 2183 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 2184 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 2185 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 2186 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_INTERLOCK) PORT_NAME("Rear Door") PORT_TOGGLE |
| 2153 | 2187 | |
| 2154 | 2188 | PORT_START_TAG("ORANGE2") |
| 2155 | | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("08") |
| 2156 | | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("09") |
| 2157 | | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("10") |
| 2158 | | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("11") |
| 2159 | | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("12") |
| 2160 | | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("13") |
| 2161 | | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("14") |
| 2162 | | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("15") |
| 2189 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_COIN5) PORT_NAME("20p Token")PORT_IMPULSE(3) |
| 2190 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 2191 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 2192 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 2193 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 2194 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 2195 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 2196 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 2163 | 2197 | |
| 2164 | 2198 | PORT_START_TAG("BLACK1") |
| 2165 | | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("16") |
| 2166 | | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("17") |
| 2167 | | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("18") |
| 2168 | | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("19") |
| 2169 | | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("20") |
| 2170 | | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Test Switch") |
| 2199 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON5) PORT_NAME("Collect") |
| 2200 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN) //Duplicate for Pontoon button |
| 2201 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 2202 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 2203 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 2204 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_SERVICE) PORT_NAME("Test Button") PORT_CODE(KEYCODE_W) |
| 2171 | 2205 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_SERVICE) PORT_NAME("Refill Key") PORT_CODE(KEYCODE_R) PORT_TOGGLE |
| 2172 | | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Door Switch?") PORT_TOGGLE |
| 2206 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_INTERLOCK) PORT_NAME("Cashbox Door") PORT_CODE(KEYCODE_Q) PORT_TOGGLE |
| 2173 | 2207 | |
| 2174 | 2208 | PORT_START_TAG("BLACK2") |
| 2175 | | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("24") |
| 2176 | | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("25") |
| 2177 | | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("26") |
| 2178 | | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("27") |
| 2179 | | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("28") |
| 2180 | | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("29") |
| 2181 | | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("30") |
| 2182 | | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("31") |
| 2209 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START1) PORT_NAME("Hi-Lo") |
| 2210 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 2211 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON6) PORT_NAME("Twist") |
| 2212 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Lo") |
| 2213 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Hi") |
| 2214 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_BUTTON7) PORT_NAME("Stick") |
| 2215 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 2216 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_BUTTON4) PORT_NAME("Deal") |
| 2183 | 2217 | |
| 2184 | 2218 | PORT_START_TAG("DIL1") |
| 2185 | 2219 | PORT_DIPNAME( 0x0f, 0x00, "Cabinet Set Up Mode" ) PORT_DIPLOCATION("DIL1:01,02,03,04") |
| r1215 | r1216 | |
| 2208 | 2242 | |
| 2209 | 2243 | PORT_START_TAG("DIL2") |
| 2210 | 2244 | PORT_DIPNAME( 0x01, 0x00, "Payout Limit" ) PORT_DIPLOCATION("DIL2:01") |
| 2211 | | PORT_DIPSETTING( 0x00, "GBP 2.00 (All Cash)") |
| 2212 | | PORT_DIPSETTING( 0x01, "GBP 4.00 (Token)") |
| 2245 | PORT_DIPSETTING( 0x00, "200p (All Cash)") |
| 2246 | PORT_DIPSETTING( 0x01, "200p (Cash)+400p (Token)") |
| 2213 | 2247 | PORT_DIPNAME( 0x02, 0x00, "10p Payout Priority" ) PORT_DIPLOCATION("DIL2:02") |
| 2214 | 2248 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 2215 | 2249 | PORT_DIPSETTING( 0x02, DEF_STR( On ) ) |
| r1215 | r1216 | |
| 2219 | 2253 | PORT_DIPNAME( 0x08, 0x00, "50p Payout Solenoid fitted?" ) PORT_DIPLOCATION("DIL2:04") |
| 2220 | 2254 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 2221 | 2255 | PORT_DIPSETTING( 0x08, DEF_STR( Yes ) ) |
| 2222 | | PORT_DIPNAME( 0x10, 0x00, "GBP 1.00 Payout Solenoid fitted?" ) PORT_DIPLOCATION("DIL2:05") |
| 2256 | PORT_DIPNAME( 0x10, 0x00, "100p Payout Solenoid fitted?" ) PORT_DIPLOCATION("DIL2:05") |
| 2223 | 2257 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 2224 | 2258 | PORT_DIPSETTING( 0x10, DEF_STR( Yes ) ) |
| 2225 | | PORT_DIPNAME( 0x20, 0x00, "Coin alarm active?" ) PORT_DIPLOCATION("DIL2:06") |
| 2226 | | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 2227 | | PORT_DIPSETTING( 0x20, DEF_STR( Yes ) ) |
| 2228 | | PORT_DIPNAME( 0x40, 0x00, "Stake" ) PORT_DIPLOCATION("DIL2:07") |
| 2259 | PORT_DIPNAME( 0x20, 0x00, "Coin alarms active?" ) PORT_DIPLOCATION("DIL2:06") |
| 2260 | PORT_DIPSETTING( 0x20, DEF_STR( No ) ) |
| 2261 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) |
| 2262 | PORT_DIPNAME( 0x40, 0x00, "Price of Play" ) PORT_DIPLOCATION("DIL2:07") |
| 2229 | 2263 | PORT_DIPSETTING( 0x00, "10p 1 Game" ) |
| 2230 | 2264 | PORT_DIPSETTING( 0x40, "10p 2 Games" ) |
| 2231 | | PORT_DIPNAME( 0x80, 0x00, "DIL208" ) PORT_DIPLOCATION("DIL2:08") |
| 2232 | | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 2233 | | PORT_DIPSETTING( 0x80, DEF_STR( On ) ) |
| 2265 | PORT_DIPNAME( 0x80, 0x00, "Coin Entry" ) PORT_DIPLOCATION("DIL2:08") |
| 2266 | PORT_DIPSETTING( 0x00, "Multi" ) |
| 2267 | PORT_DIPSETTING( 0x80, DEF_STR(Single)) |
| 2234 | 2268 | |
| 2235 | 2269 | PORT_START_TAG("AUX1") |
| 2236 | | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("0") |
| 2237 | | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("1") |
| 2238 | | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("2") |
| 2239 | | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("3") |
| 2240 | | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("4") |
| 2241 | | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("5") |
| 2242 | | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("6") |
| 2243 | | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("7") |
| 2270 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 2271 | PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 2272 | PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 2273 | PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 2274 | PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 2275 | PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 2276 | PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 2277 | PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) |
| 2244 | 2278 | |
| 2245 | 2279 | PORT_START_TAG("AUX2") |
| 2246 | 2280 | PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_SPECIAL) |
| r1215 | r1216 | |
| 2268 | 2302 | // if (cpu_getiloops()&1) |
| 2269 | 2303 | // cpunum_set_input_line(1, 1, ASSERT_LINE); |
| 2270 | 2304 | // else |
| 2271 | | // LOGSTUFF(("scn2674_irq_mask %02x",scn2674_irq_mask)); |
| 2305 | LOGSTUFF(("scn2674_irq_mask %02x",scn2674_irq_mask)); |
| 2272 | 2306 | |
| 2273 | 2307 | if (cpu_getiloops()==0) // vbl |
| 2274 | 2308 | { |
| r1215 | r1216 | |
| 2328 | 2362 | Stepper_init(2, BARCREST_48STEP_REEL); |
| 2329 | 2363 | Stepper_init(3, BARCREST_48STEP_REEL); |
| 2330 | 2364 | |
| 2365 | /* Stepper_set_index(0,92,8,0); |
| 2366 | Stepper_set_index(1,92,8,0); |
| 2367 | Stepper_set_index(2,92,8,0); |
| 2368 | Stepper_set_index(3,92,8,0);*/ |
| 2369 | |
| 2331 | 2370 | // setup the standard oki MSC1937 display /////////////////////////////// |
| 2332 | 2371 | |
| 2333 | 2372 | ROC10937_init(0, MSC1937,0); // ? |
| r1215 | r1216 | |
| 2350 | 2389 | Stepper_init(2, BARCREST_48STEP_REEL); |
| 2351 | 2390 | Stepper_init(3, BARCREST_48STEP_REEL); |
| 2352 | 2391 | |
| 2392 | /* Stepper_set_index(0,92,8,0); |
| 2393 | Stepper_set_index(1,5,6,0); |
| 2394 | Stepper_set_index(2,92,8,0); |
| 2395 | Stepper_set_index(3,1,6,0);*/ |
| 2396 | |
| 2353 | 2397 | // setup the standard oki MSC1937 display /////////////////////////////// |
| 2354 | 2398 | ROC10937_init(0, MSC1937,0); |
| 2355 | 2399 | } |
| r1215 | r1216 | |
| 2358 | 2402 | Characteriser (CHR) |
| 2359 | 2403 | |
| 2360 | 2404 | I haven't been able to work out all the ways of finding the CHR data, but there must be a flag in the ROMs |
| 2361 | | somewhere to pick it out. As built, the CHR is a PAL which holds an internal data table that is inaccessible to |
| 2362 | | anything other than the CPU. However, the programmers decided to best use this protection device in read/write/compare |
| 2405 | somewhere to pick it out. As built, the CHR is a PAL which can perform basic bit manipulation according to an as yet unknown unique key. However, the programmers decided to best use this protection device in read/write/compare |
| 2363 | 2406 | cycles, storing almost the entire 'hidden' data table in the ROMs in plain sight. Only later rebuilds by BwB |
| 2364 | 2407 | avoided this 'feature' of the development kit, and as such, only low level access can defeat their protection. |
| 2365 | 2408 | |
| 2366 | | This information has been used to generate the CHR tables loaded by the programs. |
| 2409 | This information has been used to generate the CHR tables loaded by the programs, until a key can be determined. |
| 2367 | 2410 | |
| 2368 | 2411 | For most Barcrest games, the following method was used: |
| 2369 | 2412 | |
| r1215 | r1216 | |
| 2400 | 2443 | { |
| 2401 | 2444 | UINT8 x; |
| 2402 | 2445 | int call=data; |
| 2403 | | for ( x = 0; x < 64; x++ ) |
| 2404 | | { |
| 2405 | | LOG_CHR(("Characteriser %02X:",MPU4_chr_data[x])); |
| 2406 | | } |
| 2407 | | |
| 2446 | LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X", activecpu_get_previouspc(),offset,data)); |
| 2408 | 2447 | if (offset == 0) |
| 2409 | 2448 | { |
| 2410 | | for ( x = prot_col; x < 64; x++ ) |
| 2449 | if (call == 0) |
| 2411 | 2450 | { |
| 2412 | | if (MPU4_chr_lut[(x)] == call) |
| 2451 | prot_col = 0; |
| 2452 | } |
| 2453 | else |
| 2454 | { |
| 2455 | for ( x = prot_col; x < 64; x++ ) |
| 2413 | 2456 | { |
| 2414 | | prot_col = x; |
| 2415 | | LOG_CHR(("Characteriser find column %02X\n",prot_col)); |
| 2416 | | LOG_CHR(("Characteriser find data %02X\n",MPU4_chr_data[prot_col])); |
| 2417 | | break; |
| 2457 | if (MPU4_chr_lut[(x)] == call) |
| 2458 | { |
| 2459 | prot_col = x; |
| 2460 | LOG_CHR(("Characteriser find column %02X\n",prot_col)); |
| 2461 | LOG_CHR(("Characteriser find data %02X\n",MPU4_chr_data[prot_col])); |
| 2462 | break; |
| 2463 | } |
| 2418 | 2464 | } |
| 2419 | 2465 | } |
| 2420 | | if (prot_col > 63) |
| 2421 | | { |
| 2422 | | prot_col = 0; |
| 2423 | | } |
| 2424 | | |
| 2425 | 2466 | } |
| 2426 | 2467 | else if (offset == 2) |
| 2427 | 2468 | { |
| r1215 | r1216 | |
| 2445 | 2486 | static READ8_HANDLER( characteriser_r ) |
| 2446 | 2487 | { |
| 2447 | 2488 | LOG_CHR(("Characteriser read offset %02X \n",offset)); |
| 2489 | LOG_CHR_FULL(("%04x Characteriser read offset %02X", activecpu_get_previouspc(),offset)); |
| 2448 | 2490 | if (offset == 0) |
| 2449 | 2491 | { |
| 2450 | 2492 | LOG_CHR(("Characteriser read data %02X \n",MPU4_chr_data[prot_col])); |
| r1215 | r1216 | |
| 2462 | 2504 | { |
| 2463 | 2505 | int x; |
| 2464 | 2506 | int call=data; |
| 2465 | | LOG_CHR(("Characteriser write offset %02X data %02X\n",offset,data)); |
| 2507 | LOG_CHR_FULL(("%04x Characteriser write offset %02X data %02X", activecpu_get_previouspc(),offset,data)); |
| 2466 | 2508 | for ( x = prot_col; x < 64; x++ ) |
| 2467 | 2509 | { |
| 2468 | | if (MPU4_chr_lut[(x)] == call) |
| 2510 | if (call == 0) |
| 2469 | 2511 | { |
| 2470 | | prot_col = x; |
| 2471 | | LOG_CHR(("Characteriser find column %02X\n",prot_col)); |
| 2472 | | break; |
| 2512 | prot_col = 0; |
| 2473 | 2513 | } |
| 2474 | | if (prot_col > 63) |
| 2475 | | prot_col = 0; |
| 2514 | else |
| 2515 | { |
| 2516 | if (MPU4_chr_lut[(x)] == call) |
| 2517 | { |
| 2518 | prot_col = x; |
| 2519 | LOG_CHR(("Characteriser find column %02X\n",prot_col)); |
| 2520 | break; |
| 2521 | } |
| 2522 | } |
| 2476 | 2523 | } |
| 2477 | 2524 | } |
| 2478 | 2525 | |
| 2479 | 2526 | static READ16_HANDLER( characteriser16_r ) |
| 2480 | 2527 | { |
| 2528 | LOG_CHR_FULL(("%04x Characteriser read offset %02X,data %02X", activecpu_get_previouspc(),offset,MPU4_chr_data[prot_col])); |
| 2481 | 2529 | LOG_CHR(("Characteriser read offset %02X \n",offset)); |
| 2482 | 2530 | LOG_CHR(("Characteriser read data %02X \n",MPU4_chr_data[prot_col])); |
| 2483 | 2531 | return MPU4_chr_data[prot_col]; |
| r1215 | r1216 | |
| 2676 | 2724 | |
| 2677 | 2725 | VIDEO_START(dealem) |
| 2678 | 2726 | { |
| 2679 | | |
| 2680 | 2727 | } |
| 2681 | 2728 | |
| 2682 | | |
| 2683 | 2729 | VIDEO_UPDATE(dealem) |
| 2684 | 2730 | { |
| 2685 | 2731 | int x,y; |
| r1215 | r1216 | |
| 2698 | 2744 | return 0; |
| 2699 | 2745 | } |
| 2700 | 2746 | |
| 2701 | | #ifdef UNUSED_FUNCTION |
| 2702 | | static WRITE8_HANDLER( dealem_pal_w ) |
| 2703 | | { |
| 2704 | | switch (data) |
| 2705 | | { |
| 2706 | | default: |
| 2707 | | { |
| 2708 | | logerror("Deal 'em PAL write %d",data); |
| 2709 | | break; |
| 2710 | | } |
| 2711 | | } |
| 2712 | | } |
| 2713 | | #endif |
| 2714 | | |
| 2715 | 2747 | static ADDRESS_MAP_START( dealem_memmap, ADDRESS_SPACE_PROGRAM, 8 ) |
| 2716 | 2748 | |
| 2717 | 2749 | AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size) |
| r1215 | r1216 | |
| 3015 | 3047 | ROM_LOAD16_BYTE( "st.qa", 0x0c0001, 0x010000, CRC(3fc62a0e) SHA1(0628de4b962d3fcca3757cd4e89b3005c9bfd218) ) |
| 3016 | 3048 | ROM_END |
| 3017 | 3049 | |
| 3050 | ROM_START( timemchn ) |
| 3051 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 3052 | VID_BIOS |
| 3053 | |
| 3054 | ROM_REGION( 0x800000, REGION_CPU2, 0 ) |
| 3055 | ROM_LOAD16_BYTE( "tm20.p1", 0x000000, 0x010000, CRC(6919697c) SHA1(786d7b9ab218dbf54ff839d1f83580c409c725b3) ) |
| 3056 | ROM_LOAD16_BYTE( "tm20.p2", 0x000001, 0x010000, CRC(d13b56e4) SHA1(623e73995da93c07b51ce0a5843dba1f853529dd) ) |
| 3057 | ROM_LOAD16_BYTE( "tm20.p3", 0x020000, 0x010000, CRC(efd3ae64) SHA1(9d2a3b65048e04842205751c6921d2550f38bd52) ) |
| 3058 | ROM_LOAD16_BYTE( "tm20.p4", 0x020001, 0x010000, CRC(602ba3fb) SHA1(7243f58df9a26adfd1a149a1e60630b187787dd0) ) |
| 3059 | ROM_LOAD16_BYTE( "q12.p5" , 0x040000, 0x010000, CRC(adddd8a7) SHA1(73a8dd191eda2f4b41b79d4b55723731953b8970) ) |
| 3060 | ROM_LOAD16_BYTE( "q11.p6" , 0x040001, 0x010000, CRC(e8ed736f) SHA1(e7068c550aa39a6e8f1692a16794147e996D36b4) ) |
| 3061 | ROM_LOAD16_BYTE( "q14.p7" , 0x060000, 0x010000, CRC(02abb026) SHA1(42224678e5913090c91c21672661beb8e27127a8) ) |
| 3062 | ROM_LOAD16_BYTE( "q13.p8" , 0x060001, 0x010000, CRC(3de147dd) SHA1(d2111d54d1604fe2da0133102bbfee706f8f542e) ) |
| 3063 | ROM_LOAD16_BYTE( "q16.p9" , 0x080000, 0x010000, CRC(ce2bf15e) SHA1(29c7f2e718bce415b0b8dc6d902bf74dad6b1ef4) ) |
| 3064 | ROM_LOAD16_BYTE( "q15.p10", 0x080001, 0x010000, CRC(7894ac8b) SHA1(dc46bd108ac4f67a9062bb7ace91aa51f069cbc8) ) |
| 3065 | ROM_LOAD16_BYTE( "q18.p11", 0x0a0000, 0x010000, CRC(27de90b3) SHA1(625c98e555f7b627ea96653926b8917996a2fdb7) ) |
| 3066 | ROM_LOAD16_BYTE( "q17.p12", 0x0a0001, 0x010000, CRC(5cab773e) SHA1(59a235c51a975b341bdbb88e909729507408f75b) ) |
| 3067 | ROM_LOAD16_BYTE( "q20.p13", 0x0c0000, 0x010000, CRC(083f6c65) SHA1(291ad39ee5f8eba9da293d9206b1f6a6d852f9bd) ) |
| 3068 | ROM_LOAD16_BYTE( "q19.p14", 0x0c0001, 0x010000, CRC(73747644) SHA1(ae252fc95c069a3c82e155220fbfcb74dd43bf89) ) |
| 3069 | ROM_END |
| 3070 | |
| 3018 | 3071 | ROM_START( mating ) |
| 3019 | 3072 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) |
| 3020 | 3073 | VID_BIOS |
| r1215 | r1216 | |
| 3065 | 3118 | |
| 3066 | 3119 | ROM_START( connect4 ) |
| 3067 | 3120 | ROM_REGION( 0x10000, REGION_CPU1, ROMREGION_ERASE00 ) |
| 3068 | | ROM_LOAD( "connect4.p2", 0x8000, 0x4000, CRC(6090633c) ) |
| 3069 | | ROM_LOAD( "connect4.p1", 0xC000, 0x4000, CRC(b1af50c0) ) |
| 3121 | ROM_LOAD( "connect4.p2", 0x8000, 0x4000, CRC(6090633c) SHA1(0cd2725a235bf93cfe94f2ca648d5fccb87b8e5c) ) |
| 3122 | ROM_LOAD( "connect4.p1", 0xC000, 0x4000, CRC(b1af50c0) SHA1(7c9645ea378f0857b849ca24a239d9114f62da7f) ) |
| 3070 | 3123 | ROM_END |
| 3071 | 3124 | |
| 3072 | 3125 | ROM_START( dealem ) |
| r1215 | r1216 | |
| 3077 | 3130 | ROM_LOAD( "zenndlem.u24", 0x0000, 0x10000, CRC(3a1950c4) SHA1(7138346d4e8b3cffbd9751b4d7ebd367b9ad8da9) ) /* text layer */ |
| 3078 | 3131 | |
| 3079 | 3132 | ROM_REGION( 0x020, REGION_PROMS, 0 ) |
| 3080 | | ROM_LOAD( "zenndlem.u22", 0x000, 0x020, CRC(29988304) SHA1(42f61b8f9e1ee96b65db3b70833eb2f6e7a6ae0a) ) |
| 3133 | ROM_LOAD( "zenndlem.u22", 0x000, 0x020, CRC(29988304) SHA1(42f61b8f9e1ee96b65db3b70833eb2f6e7a6ae0a) ) |
| 3081 | 3134 | |
| 3082 | 3135 | ROM_REGION( 0x200, REGION_PLDS, 0 ) |
| 3083 | | ROM_LOAD( "zenndlem.u10", 0x000, 0x104, CRC(e3103c05) SHA1(91b7be75c5fb37025039ab54b484e46a033969b5) ) |
| 3136 | ROM_LOAD( "zenndlem.u10", 0x000, 0x104, CRC(e3103c05) SHA1(91b7be75c5fb37025039ab54b484e46a033969b5) ) |
| 3084 | 3137 | ROM_END |
| 3085 | 3138 | |
| 3086 | 3139 | GAMEL(1989?,connect4,0, mpu4mod2, connect4, connect4, 0, "Dolbeck Systems", "Connect 4", GAME_IMPERFECT_GRAPHICS,layout_connect4 ) |
| r1215 | r1216 | |
| 3090 | 3143 | //and reel assembly with this kit and a supplied monitor. |
| 3091 | 3144 | //The real Deal 'Em ran on Summit Coin hardware, and was made by someone else. |
| 3092 | 3145 | //A further different release was made in 2000, running on the Barcrest MPU4 Video, rather than this one. |
| 3093 | | GAME( 1987, dealem, 0, dealem, dealem, 0, ROT0, "Zenitone", "Deal 'Em (MPU4 Conversion Kit)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS|GAME_WRONG_COLORS ) |
| 3146 | GAME( 1987, dealem, 0, dealem, dealem, 0, ROT0, "Zenitone", "Deal 'Em (MPU4 Conversion Kit, v7.0)", GAME_IMPERFECT_GRAPHICS ) |
| 3094 | 3147 | |
| 3095 | 3148 | GAME( 1994?,crmaze, bctvidbs,mpu4_vid, crmaze, crmaze,ROT0, "Barcrest", "The Crystal Maze: Team Challenge (SWP)", GAME_NOT_WORKING|GAME_NO_SOUND ) |
| 3096 | 3149 | GAME( 1992?,crmazea, crmaze, mpu4_vid, crmaze, crmaze,ROT0, "Barcrest", "The Crystal Maze (AMLD version SWP)", GAME_NOT_WORKING|GAME_NO_SOUND ) |
| 3097 | 3150 | GAME( 1993?,crmazeb, crmaze, mpu4_vid, crmaze, 0, ROT0, "Barcrest", "The Crystal Maze - Now Featuring Ocean Zone (AMLD Version SWP)", GAME_NOT_WORKING|GAME_NO_SOUND ) // unprotected? |
| 3098 | 3151 | GAME( 1990, turnover,bctvidbs,mpu4_vid, mpu4, 0, ROT0, "Barcrest", "Turnover", GAME_NOT_WORKING|GAME_NO_SOUND ) // unprotected? |
| 3099 | | GAME( 1992, skiltrek,bctvidbs,mpu4_vid, mpu4, 0, ROT0, "Barcrest", "Skill Trek", GAME_NOT_WORKING|GAME_NO_SOUND ) |
| 3152 | GAME( 1992, skiltrek,bctvidbs,mpu4_vid, mpu4, 0, ROT0, "Barcrest", "Skill Trek", GAME_NOT_WORKING|GAME_NO_SOUND ) // unprotected? |
| 3153 | GAME( 1990, timemchn,bctvidbs,mpu4_vid, mpu4, 0, ROT0, "Barcrest", "Time Machine v2.0", GAME_NOT_WORKING|GAME_NO_SOUND ) // unprotected? |
| 3100 | 3154 | GAME( 199?, mating, bctvidbs,mpu4_vid, mpu4, mating,ROT0, "Barcrest", "The Mating Game (Datapak)", GAME_NOT_WORKING|GAME_NO_SOUND ) |
| 3101 | 3155 | GAME( 199?, matinga, mating, mpu4_vid, mpu4, mating,ROT0, "Barcrest", "The Mating Game (Standard)", GAME_NOT_WORKING|GAME_NO_SOUND ) |
src/mame/drivers/bnstars.c
| r1215 | r1216 | |
| 534 | 534 | |
| 535 | 535 | INPUT_PORTS_START( bnstars ) |
| 536 | 536 | PORT_START |
| 537 | | PORT_DIPNAME( 0x00000001, 0x00000001, "MAH0" ) |
| 538 | | PORT_DIPSETTING( 0x00000001, DEF_STR( Off ) ) |
| 539 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 540 | | PORT_DIPNAME( 0x00000002, 0x00000002, DEF_STR( Unknown ) ) |
| 541 | | PORT_DIPSETTING( 0x00000002, DEF_STR( Off ) ) |
| 542 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 543 | | PORT_DIPNAME( 0x00000004, 0x00000004, DEF_STR( Unknown ) ) |
| 544 | | PORT_DIPSETTING( 0x00000004, DEF_STR( Off ) ) |
| 545 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 546 | | PORT_DIPNAME( 0x00000008, 0x00000008, DEF_STR( Unknown ) ) |
| 547 | | PORT_DIPSETTING( 0x00000008, DEF_STR( Off ) ) |
| 548 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 549 | | PORT_DIPNAME( 0x00000010, 0x00000010, DEF_STR( Unknown ) ) |
| 550 | | PORT_DIPSETTING( 0x00000010, DEF_STR( Off ) ) |
| 551 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 552 | | PORT_DIPNAME( 0x00000020, 0x00000020, DEF_STR( Unknown ) ) |
| 553 | | PORT_DIPSETTING( 0x00000020, DEF_STR( Off ) ) |
| 554 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 537 | PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_START1 ) |
| 538 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_A ) |
| 539 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_E ) |
| 540 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M ) |
| 541 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_I ) |
| 542 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) |
| 555 | 543 | PORT_DIPNAME( 0x00000040, 0x00000040, DEF_STR( Unknown ) ) |
| 556 | 544 | PORT_DIPSETTING( 0x00000040, DEF_STR( Off ) ) |
| 557 | 545 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| r1215 | r1216 | |
| 586 | 574 | PORT_DIPNAME( 0x00020000, 0x00020000, "MAH1" ) |
| 587 | 575 | PORT_DIPSETTING( 0x00020000, DEF_STR( Off ) ) |
| 588 | 576 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 589 | | PORT_DIPNAME( 0x00040000, 0x00040000, DEF_STR( Unknown ) ) |
| 590 | | PORT_DIPSETTING( 0x00040000, DEF_STR( Off ) ) |
| 591 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 592 | | PORT_DIPNAME( 0x00080000, 0x00080000, DEF_STR( Unknown ) ) |
| 577 | PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_SERVICE1 ) |
| 578 | PORT_DIPNAME( 0x00080000, 0x00080000, "Service Mode ? 1" ) |
| 593 | 579 | PORT_DIPSETTING( 0x00080000, DEF_STR( Off ) ) |
| 594 | 580 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 595 | 581 | PORT_DIPNAME( 0x00100000, 0x00100000, DEF_STR( Unknown ) ) |
| r1215 | r1216 | |
| 633 | 619 | PORT_DIPNAME( 0x00000001, 0x00000001, "MAH2" ) |
| 634 | 620 | PORT_DIPSETTING( 0x00000001, DEF_STR( Off ) ) |
| 635 | 621 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 636 | | PORT_DIPNAME( 0x00000002, 0x00000002, DEF_STR( Unknown ) ) |
| 637 | | PORT_DIPSETTING( 0x00000002, DEF_STR( Off ) ) |
| 638 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 639 | | PORT_DIPNAME( 0x00000004, 0x00000004, DEF_STR( Unknown ) ) |
| 640 | | PORT_DIPSETTING( 0x00000004, DEF_STR( Off ) ) |
| 641 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 642 | | PORT_DIPNAME( 0x00000008, 0x00000008, DEF_STR( Unknown ) ) |
| 643 | | PORT_DIPSETTING( 0x00000008, DEF_STR( Off ) ) |
| 644 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 645 | | PORT_DIPNAME( 0x00000010, 0x00000010, DEF_STR( Unknown ) ) |
| 646 | | PORT_DIPSETTING( 0x00000010, DEF_STR( Off ) ) |
| 647 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 648 | | PORT_DIPNAME( 0x00000020, 0x00000020, DEF_STR( Unknown ) ) |
| 649 | | PORT_DIPSETTING( 0x00000020, DEF_STR( Off ) ) |
| 650 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 622 | PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_MAHJONG_B ) |
| 623 | PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_MAHJONG_F ) |
| 624 | PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_MAHJONG_N ) |
| 625 | PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_MAHJONG_J ) |
| 626 | PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) |
| 651 | 627 | PORT_DIPNAME( 0x00000040, 0x00000040, DEF_STR( Unknown ) ) |
| 652 | 628 | PORT_DIPSETTING( 0x00000040, DEF_STR( Off ) ) |
| 653 | 629 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| r1215 | r1216 | |
| 731 | 707 | PORT_DIPNAME( 0x00000001, 0x00000001, "MAH4" ) |
| 732 | 708 | PORT_DIPSETTING( 0x00000001, DEF_STR( Off ) ) |
| 733 | 709 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 734 | | PORT_DIPNAME( 0x00000002, 0x00000002, DEF_STR( Unknown ) ) |
| 735 | | PORT_DIPSETTING( 0x00000002, DEF_STR( Off ) ) |
| 736 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 737 | | PORT_DIPNAME( 0x00000004, 0x00000004, DEF_STR( Unknown ) ) |
| 738 | | PORT_DIPSETTING( 0x00000004, DEF_STR( Off ) ) |
| 739 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 740 | | PORT_DIPNAME( 0x00000008, 0x00000008, DEF_STR( Unknown ) ) |
| 741 | | PORT_DIPSETTING( 0x00000008, DEF_STR( Off ) ) |
| 742 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 743 | | PORT_DIPNAME( 0x00000010, 0x00000010, DEF_STR( Unknown ) ) |
| 744 | | PORT_DIPSETTING( 0x00000010, DEF_STR( Off ) ) |
| 745 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 746 | | PORT_DIPNAME( 0x00000020, 0x00000020, DEF_STR( Unknown ) ) |
| 747 | | PORT_DIPSETTING( 0x00000020, DEF_STR( Off ) ) |
| 748 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 710 | PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_MAHJONG_C ) |
| 711 | PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_MAHJONG_G ) |
| 712 | PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) |
| 713 | PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_MAHJONG_K ) |
| 714 | PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) |
| 749 | 715 | PORT_DIPNAME( 0x00000040, 0x00000040, DEF_STR( Unknown ) ) |
| 750 | 716 | PORT_DIPSETTING( 0x00000040, DEF_STR( Off ) ) |
| 751 | 717 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| r1215 | r1216 | |
| 829 | 795 | PORT_DIPNAME( 0x00000001, 0x00000001, "MAH6" ) |
| 830 | 796 | PORT_DIPSETTING( 0x00000001, DEF_STR( Off ) ) |
| 831 | 797 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 832 | | PORT_DIPNAME( 0x00000002, 0x00000002, DEF_STR( Unknown ) ) |
| 833 | | PORT_DIPSETTING( 0x00000002, DEF_STR( Off ) ) |
| 834 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 835 | | PORT_DIPNAME( 0x00000004, 0x00000004, DEF_STR( Unknown ) ) |
| 836 | | PORT_DIPSETTING( 0x00000004, DEF_STR( Off ) ) |
| 837 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 838 | | PORT_DIPNAME( 0x00000008, 0x00000008, DEF_STR( Unknown ) ) |
| 839 | | PORT_DIPSETTING( 0x00000008, DEF_STR( Off ) ) |
| 840 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 841 | | PORT_DIPNAME( 0x00000010, 0x00000010, DEF_STR( Unknown ) ) |
| 842 | | PORT_DIPSETTING( 0x00000010, DEF_STR( Off ) ) |
| 843 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 798 | PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_MAHJONG_D ) |
| 799 | PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_MAHJONG_H ) |
| 800 | PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) |
| 801 | PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_MAHJONG_L ) |
| 844 | 802 | PORT_DIPNAME( 0x00000020, 0x00000020, DEF_STR( Unknown ) ) |
| 845 | 803 | PORT_DIPSETTING( 0x00000020, DEF_STR( Off ) ) |
| 846 | 804 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| r1215 | r1216 | |
| 924 | 882 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 925 | 883 | |
| 926 | 884 | PORT_START |
| 927 | | PORT_DIPNAME( 0x00000001, 0x00000001, "0" ) |
| 928 | | PORT_DIPSETTING( 0x00000001, DEF_STR( Off ) ) |
| 929 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 930 | | PORT_DIPNAME( 0x00000002, 0x00000002, DEF_STR( Unknown ) ) |
| 885 | PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_START2 ) |
| 886 | /* The follow 4 bits active 4 button each one for the second player */ |
| 887 | PORT_DIPNAME( 0x00000002, 0x00000002, "P2: A,B,C,D" ) |
| 931 | 888 | PORT_DIPSETTING( 0x00000002, DEF_STR( Off ) ) |
| 932 | 889 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 933 | | PORT_DIPNAME( 0x00000004, 0x00000004, DEF_STR( Unknown ) ) |
| 890 | PORT_DIPNAME( 0x00000004, 0x00000004, "P2: E,F,G,H" ) |
| 934 | 891 | PORT_DIPSETTING( 0x00000004, DEF_STR( Off ) ) |
| 935 | 892 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 936 | | PORT_DIPNAME( 0x00000008, 0x00000008, DEF_STR( Unknown ) ) |
| 893 | PORT_DIPNAME( 0x00000008, 0x00000008, "P2: M,N,Pon,Chie" ) |
| 937 | 894 | PORT_DIPSETTING( 0x00000008, DEF_STR( Off ) ) |
| 938 | 895 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 939 | | PORT_DIPNAME( 0x00000010, 0x00000010, DEF_STR( Unknown ) ) |
| 896 | PORT_DIPNAME( 0x00000010, 0x00000010, "P2: I,J,K,L" ) |
| 940 | 897 | PORT_DIPSETTING( 0x00000010, DEF_STR( Off ) ) |
| 941 | 898 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 942 | | PORT_DIPNAME( 0x00000020, 0x00000020, DEF_STR( Unknown ) ) |
| 899 | PORT_DIPNAME( 0x00000020, 0x00000020, "P2: Kan,Reach,Ron" ) |
| 943 | 900 | PORT_DIPSETTING( 0x00000020, DEF_STR( Off ) ) |
| 944 | 901 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 945 | 902 | PORT_DIPNAME( 0x00000040, 0x00000040, DEF_STR( Unknown ) ) |
| r1215 | r1216 | |
| 972 | 929 | PORT_DIPNAME( 0x00008000, 0x00008000, DEF_STR( Unknown ) ) |
| 973 | 930 | PORT_DIPSETTING( 0x00008000, DEF_STR( Off ) ) |
| 974 | 931 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 975 | | PORT_DIPNAME( 0x00010000, 0x00010000, "1" ) |
| 976 | | PORT_DIPSETTING( 0x00010000, DEF_STR( Off ) ) |
| 977 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 978 | | PORT_DIPNAME( 0x00020000, 0x00020000, DEF_STR( Unknown ) ) |
| 932 | PORT_BIT( 0x00010000, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 933 | PORT_DIPNAME( 0x00020000, 0x00020000, "MAH9" ) |
| 979 | 934 | PORT_DIPSETTING( 0x00020000, DEF_STR( Off ) ) |
| 980 | 935 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 981 | | PORT_DIPNAME( 0x00040000, 0x00040000, DEF_STR( Unknown ) ) |
| 982 | | PORT_DIPSETTING( 0x00040000, DEF_STR( Off ) ) |
| 983 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 984 | | PORT_DIPNAME( 0x00080000, 0x00080000, DEF_STR( Unknown ) ) |
| 936 | PORT_BIT( 0x00040000, IP_ACTIVE_LOW, IPT_SERVICE2 ) |
| 937 | PORT_DIPNAME( 0x00080000, 0x00080000, "Service Mode ? 2" ) |
| 985 | 938 | PORT_DIPSETTING( 0x00080000, DEF_STR( Off ) ) |
| 986 | 939 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 987 | 940 | PORT_DIPNAME( 0x00100000, 0x00100000, DEF_STR( Unknown ) ) |
| r1215 | r1216 | |
| 1020 | 973 | PORT_DIPNAME( 0x80000000, 0x80000000, DEF_STR( Unknown ) ) |
| 1021 | 974 | PORT_DIPSETTING( 0x80000000, DEF_STR( Off ) ) |
| 1022 | 975 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 976 | |
| 1023 | 977 | PORT_START |
| 1024 | | PORT_DIPNAME( 0x00000001, 0x00000001, "2" ) |
| 978 | PORT_DIPNAME( 0x00000001, 0x00000001, "Test Mode" ) PORT_DIPLOCATION("SW1:8") |
| 1025 | 979 | PORT_DIPSETTING( 0x00000001, DEF_STR( Off ) ) |
| 1026 | 980 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 1027 | | PORT_DIPNAME( 0x00000002, 0x00000002, DEF_STR( Unknown ) ) |
| 981 | PORT_DIPNAME( 0x00000002, 0x00000002, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW1:7") |
| 1028 | 982 | PORT_DIPSETTING( 0x00000002, DEF_STR( Off ) ) |
| 1029 | 983 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 1030 | | PORT_DIPNAME( 0x00000004, 0x00000004, DEF_STR( Unknown ) ) |
| 1031 | | PORT_DIPSETTING( 0x00000004, DEF_STR( Off ) ) |
| 1032 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 1033 | | PORT_DIPNAME( 0x00000008, 0x00000008, DEF_STR( Unknown ) ) |
| 1034 | | PORT_DIPSETTING( 0x00000008, DEF_STR( Off ) ) |
| 1035 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 1036 | | PORT_DIPNAME( 0x00000010, 0x00000010, DEF_STR( Unknown ) ) |
| 1037 | | PORT_DIPSETTING( 0x00000010, DEF_STR( Off ) ) |
| 1038 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 1039 | | PORT_DIPNAME( 0x00000020, 0x00000020, DEF_STR( Unknown ) ) |
| 1040 | | PORT_DIPSETTING( 0x00000020, DEF_STR( Off ) ) |
| 1041 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 1042 | | PORT_DIPNAME( 0x00000040, 0x00000040, DEF_STR( Unknown ) ) |
| 1043 | | PORT_DIPSETTING( 0x00000040, DEF_STR( Off ) ) |
| 1044 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 1045 | | PORT_DIPNAME( 0x00000080, 0x00000080, DEF_STR( Unknown ) ) |
| 1046 | | PORT_DIPSETTING( 0x00000080, DEF_STR( Off ) ) |
| 1047 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 1048 | | PORT_DIPNAME( 0x00000100, 0x00000100, DEF_STR( Unknown ) ) |
| 984 | PORT_DIPNAME( 0x0000001c, 0x0000001c, "First Point" ) PORT_DIPLOCATION("SW1:6,5,4") |
| 985 | PORT_DIPSETTING( 0x0000000c, "5000" ) |
| 986 | PORT_DIPSETTING( 0x00000014, "10000" ) |
| 987 | PORT_DIPSETTING( 0x00000004, "15000" ) |
| 988 | PORT_DIPSETTING( 0x0000001c, "20000" ) |
| 989 | PORT_DIPSETTING( 0x00000018, "23000" ) |
| 990 | PORT_DIPSETTING( 0x00000008, "25000" ) |
| 991 | PORT_DIPSETTING( 0x00000010, "26000" ) |
| 992 | PORT_DIPSETTING( 0x00000000, "30000" ) |
| 993 | PORT_DIPNAME( 0x000000e0, 0x000000e0, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:3,2,1") |
| 994 | PORT_DIPSETTING( 0x00000000, DEF_STR( 5C_1C ) ) |
| 995 | PORT_DIPSETTING( 0x00000080, DEF_STR( 4C_1C ) ) |
| 996 | PORT_DIPSETTING( 0x00000040, DEF_STR( 3C_1C ) ) |
| 997 | PORT_DIPSETTING( 0x000000c0, DEF_STR( 2C_1C ) ) |
| 998 | PORT_DIPSETTING( 0x000000e0, DEF_STR( 1C_1C ) ) |
| 999 | PORT_DIPSETTING( 0x00000060, DEF_STR( 1C_2C ) ) |
| 1000 | PORT_DIPSETTING( 0x000000a0, DEF_STR( 1C_3C ) ) |
| 1001 | PORT_DIPSETTING( 0x00000020, DEF_STR( 1C_4C ) ) |
| 1002 | PORT_DIPNAME( 0x00000100, 0x00000100, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:8") |
| 1049 | 1003 | PORT_DIPSETTING( 0x00000100, DEF_STR( Off ) ) |
| 1050 | 1004 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 1051 | | PORT_DIPNAME( 0x00000200, 0x00000200, DEF_STR( Unknown ) ) |
| 1005 | PORT_DIPNAME( 0x00000200, 0x00000200, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:7") |
| 1052 | 1006 | PORT_DIPSETTING( 0x00000200, DEF_STR( Off ) ) |
| 1053 | 1007 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 1054 | | PORT_DIPNAME( 0x00000400, 0x00000400, DEF_STR( Unknown ) ) |
| 1008 | PORT_DIPNAME( 0x00000400, 0x00000400, "Taisen Only" ) PORT_DIPLOCATION("SW2:6") |
| 1055 | 1009 | PORT_DIPSETTING( 0x00000400, DEF_STR( Off ) ) |
| 1056 | 1010 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 1057 | | PORT_DIPNAME( 0x00000800, 0x00000800, DEF_STR( Unknown ) ) |
| 1058 | | PORT_DIPSETTING( 0x00000800, DEF_STR( Off ) ) |
| 1059 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 1060 | | PORT_DIPNAME( 0x00001000, 0x00001000, DEF_STR( Unknown ) ) |
| 1061 | | PORT_DIPSETTING( 0x00001000, DEF_STR( Off ) ) |
| 1062 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 1063 | | PORT_DIPNAME( 0x00002000, 0x00002000, DEF_STR( Unknown ) ) |
| 1064 | | PORT_DIPSETTING( 0x00002000, DEF_STR( Off ) ) |
| 1065 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 1066 | | PORT_DIPNAME( 0x00004000, 0x00004000, DEF_STR( Unknown ) ) |
| 1067 | | PORT_DIPSETTING( 0x00004000, DEF_STR( Off ) ) |
| 1068 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 1069 | | PORT_DIPNAME( 0x00008000, 0x00008000, DEF_STR( Unknown ) ) |
| 1070 | | PORT_DIPSETTING( 0x00008000, DEF_STR( Off ) ) |
| 1071 | | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 1072 | | PORT_DIPNAME( 0x00010000, 0x00010000, "3" ) |
| 1011 | PORT_DIPNAME( 0x00000800, 0x00000800, "Tumo Pinfu" ) PORT_DIPLOCATION("SW2:5") |
| 1012 | PORT_DIPSETTING( 0x00000000, DEF_STR( Off ) ) |
| 1013 | PORT_DIPSETTING( 0x00000800, DEF_STR( On ) ) |
| 1014 | PORT_DIPNAME( 0x00001000, 0x00001000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:4") |
| 1015 | PORT_DIPSETTING( 0x00000000, DEF_STR( Off ) ) |
| 1016 | PORT_DIPSETTING( 0x00001000, DEF_STR( On ) ) |
| 1017 | PORT_DIPNAME( 0x0000e000, 0x0000e000, DEF_STR ( Difficulty ) ) PORT_DIPLOCATION("SW2:3,2,1") |
| 1018 | PORT_DIPSETTING( 0x00000000, DEF_STR( Easiest ) ) |
| 1019 | PORT_DIPSETTING( 0x00008000, DEF_STR( Very_Easy) ) |
| 1020 | PORT_DIPSETTING( 0x00004000, DEF_STR( Easier ) ) |
| 1021 | PORT_DIPSETTING( 0x0000c000, DEF_STR( Easy ) ) |
| 1022 | PORT_DIPSETTING( 0x0000e000, DEF_STR( Normal ) ) |
| 1023 | PORT_DIPSETTING( 0x00006000, DEF_STR( Hard ) ) |
| 1024 | PORT_DIPSETTING( 0x0000a000, DEF_STR( Harder ) ) |
| 1025 | PORT_DIPSETTING( 0x00002000, DEF_STR( Hardest ) ) |
| 1026 | |
| 1027 | PORT_DIPNAME( 0x00010000, 0x00010000, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW3:8") |
| 1073 | 1028 | PORT_DIPSETTING( 0x00010000, DEF_STR( Off ) ) |
| 1074 | 1029 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 1075 | | PORT_DIPNAME( 0x00020000, 0x00020000, DEF_STR( Unknown ) ) |
| 1030 | PORT_DIPNAME( 0x00020000, 0x00020000, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW3:7") |
| 1076 | 1031 | PORT_DIPSETTING( 0x00020000, DEF_STR( Off ) ) |
| 1077 | 1032 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 1078 | | PORT_DIPNAME( 0x00040000, 0x00040000, DEF_STR( Unknown ) ) |
| 1033 | PORT_DIPNAME( 0x00040000, 0x00040000, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW3:6") |
| 1079 | 1034 | PORT_DIPSETTING( 0x00040000, DEF_STR( Off ) ) |
| 1080 | 1035 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 1081 | | PORT_DIPNAME( 0x00080000, 0x00080000, DEF_STR( Unknown ) ) |
| 1036 | PORT_DIPNAME( 0x00080000, 0x00080000, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW3:5") |
| 1082 | 1037 | PORT_DIPSETTING( 0x00080000, DEF_STR( Off ) ) |
| 1083 | 1038 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 1084 | | PORT_DIPNAME( 0x00100000, 0x00100000, DEF_STR( Unknown ) ) |
| 1039 | PORT_DIPNAME( 0x00100000, 0x00100000, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW3:4") |
| 1085 | 1040 | PORT_DIPSETTING( 0x00100000, DEF_STR( Off ) ) |
| 1086 | 1041 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 1087 | | PORT_DIPNAME( 0x00200000, 0x00200000, DEF_STR( Unknown ) ) |
| 1042 | PORT_DIPNAME( 0x00200000, 0x00200000, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW3:3") |
| 1088 | 1043 | PORT_DIPSETTING( 0x00200000, DEF_STR( Off ) ) |
| 1089 | 1044 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 1090 | | PORT_DIPNAME( 0x00400000, 0x00400000, DEF_STR( Unknown ) ) |
| 1045 | PORT_DIPNAME( 0x00400000, 0x00400000, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW3:2") |
| 1091 | 1046 | PORT_DIPSETTING( 0x00400000, DEF_STR( Off ) ) |
| 1092 | 1047 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 1093 | | PORT_DIPNAME( 0x00800000, 0x00800000, DEF_STR( Unknown ) ) |
| 1048 | PORT_DIPNAME( 0x00800000, 0x00800000, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW3:1") |
| 1094 | 1049 | PORT_DIPSETTING( 0x00800000, DEF_STR( Off ) ) |
| 1095 | 1050 | PORT_DIPSETTING( 0x00000000, DEF_STR( On ) ) |
| 1096 | 1051 | PORT_DIPNAME( 0x01000000, 0x01000000, DEF_STR( Unknown ) ) |
| r1215 | r1216 | |
| 1531 | 1486 | memory_set_bankptr(1, memory_region(REGION_CPU1)); |
| 1532 | 1487 | } |
| 1533 | 1488 | |
| 1534 | | GAME( 1997, bnstars1, 0, bnstars, bnstars, bnstars, ROT0, "Jaleco", "Vs. Janshi Brandnew Stars", GAME_NOT_WORKING|GAME_NO_SOUND ) |
| 1489 | GAME( 1997, bnstars1, 0, bnstars, bnstars, bnstars, ROT0, "Jaleco", "Vs. Janshi Brandnew Stars", GAME_NO_SOUND ) |
src/mame/drivers/madalien.c
| r1215 | r1216 | |
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | | Mad Alien |
| 4 | | (c) 1980 Data East Corporation |
| 3 | Mad Alien (c) 1980 Data East Corporation |
| 5 | 4 | |
| 6 | | Driver by Norbert Kehrer (February 2004). |
| 5 | Original driver by Norbert Kehrer (February 2004) |
| 7 | 6 | |
| 8 | | **************************************************************************** |
| 7 | ***************************************************************************/ |
| 9 | 8 | |
| 10 | | Hardware: |
| 11 | | --------- |
| 9 | #include "driver.h" |
| 10 | #include "video/crtc6845.h" |
| 11 | #include "sound/ay8910.h" |
| 12 | 12 | |
| 13 | | Main CPU 6502 |
| 14 | | Sound CPU 6502 |
| 15 | | Sound chip AY-3-8910 |
| 13 | #define MAIN_CLOCK 10595000 |
| 16 | 14 | |
| 15 | #define SOUND_CLOCK 4000000 |
| 17 | 16 | |
| 18 | | Memory map of main board: |
| 19 | | ------------------------- |
| 17 | #define PIXEL_CLOCK (MAIN_CLOCK / 2) |
| 20 | 18 | |
| 21 | | $0000 - $03ff Program RAM |
| 22 | | $6000 - $63ff Video RAM |
| 23 | | $6800 - $7fff Character generator RAM |
| 24 | | $8004 Flip screen in cocktail mode (?) |
| 25 | | $8006 Write: send command to sound board, read: input from sound board |
| 26 | | $8008 Write: set counter for shifter circuitry, read: low byte of shift reg. after shift operation |
| 27 | | $8009 Write: set data to be shifted, read: high byte of shift reg. after shift operation |
| 28 | | $8008 Video register (control of headlight, color, and landscape) |
| 29 | | $800d Background horiz. scroll register left part |
| 30 | | $800e Background horiz. scroll register right part |
| 31 | | $800f Background vertical scroll register |
| 32 | | $9000 Input port 1: player 1 controls |
| 33 | | $9001 DIP switch port |
| 34 | | $9002 Input port 2: player 2 controls |
| 35 | | $c000 - $ffff Program ROM |
| 36 | 19 | |
| 37 | | Main board interrupts: NMI triggered, when coin is inserted |
| 20 | static UINT8* madalien_videoram; |
| 21 | static UINT8* madalien_charram; |
| 38 | 22 | |
| 23 | static UINT8 madalien_video_flags; |
| 24 | static UINT8 madalien_screen_control; |
| 25 | static UINT8 madalien_scroll; |
| 26 | static UINT8 madalien_edge1_pos; |
| 27 | static UINT8 madalien_edge2_pos; |
| 28 | static UINT8 madalien_headlight_pos; |
| 29 | static UINT8 madalien_shift_count; |
| 30 | static UINT8 madalien_shift_data; |
| 39 | 31 | |
| 40 | | Memory map of sound board: |
| 41 | | -------------------------- |
| 32 | static tilemap* tilemap_fg; |
| 42 | 33 | |
| 43 | | $0000 - $03ff Sound board program RAM |
| 44 | | $6500 Sound board register, just to write in someting (?) |
| 45 | | $6800 Sound board register, just to write in and read out (?) |
| 46 | | $8000 Write: AY-3-8910 control port, read: input from master CPU |
| 47 | | $8001 AY-3-8910 data port |
| 48 | | $8006 Output to master CPU |
| 49 | | $f800 - $ffff Sound board program ROM |
| 34 | static tilemap* tilemap_edge1[4]; |
| 35 | static tilemap* tilemap_edge2[4]; |
| 50 | 36 | |
| 51 | | Sound board interrupts: NMI triggered by VBlank signal |
| 37 | static mame_bitmap* tmp_bitmap; |
| 38 | static mame_bitmap* headlight_bitmap; |
| 52 | 39 | |
| 53 | 40 | |
| 54 | | Input ports: |
| 55 | | ------------ |
| 41 | static PALETTE_INIT( madalien ) |
| 42 | { |
| 43 | int i; |
| 56 | 44 | |
| 57 | | Input port 1, mapped to memory address $9000: |
| 58 | | 7654 3210 |
| 59 | | 1 Unused |
| 60 | | 1 Start 2 players game |
| 61 | | 1 Start 1 player game |
| 62 | | 1 Player 1 fire button |
| 63 | | 1 Player 1 down (not used in Mad Alien) |
| 64 | | 1 Player 1 up (not used in Mad Alien) |
| 65 | | 1 Player 1 left |
| 66 | | 1 Player 1 right |
| 45 | for (i = 0; i < 32; i++) |
| 46 | { |
| 47 | int r = 0; |
| 48 | int g = 0; |
| 49 | int b = 0; |
| 67 | 50 | |
| 68 | | DIP switch port, mapped to memory address $9001: |
| 69 | | 7654 3210 |
| 70 | | 1 VBlank (0 = off, 1 = on) |
| 71 | | 1 Game screen (0 = prevent turning, 1 = to turn) (?) |
| 72 | | 00 Bonus points (0 = 3000, 1 = 7000, 2 = 5000, 3 = nil) |
| 73 | | 00 Game charge (0 = 1 coin/1 play, 1 = 1 coin/2 plays, 2 and 3 = 2 coins 1 play) |
| 74 | | 00 Number of cars (0 = 3 cars, 1 = 4 cars, 2 = 5 cars, 3 = 6cars) |
| 51 | if (BIT(color_prom[i], 0)) |
| 52 | r += 0x3f; |
| 53 | if (BIT(color_prom[i], 1)) |
| 54 | r += 0xc0; |
| 55 | if (BIT(color_prom[i], 2)) |
| 56 | g += 0x3f; |
| 57 | if (BIT(color_prom[i], 3)) |
| 58 | g += 0xc0; |
| 59 | if (BIT(color_prom[i], 4)) |
| 60 | b += 0x3f; |
| 61 | if (BIT(color_prom[i], 5)) |
| 62 | b += 0xc0; |
| 75 | 63 | |
| 76 | | Input port 2, mapped to memory address $9002: |
| 77 | | 7654 3210 |
| 78 | | 111 Unused |
| 79 | | 1 Player 2 fire button |
| 80 | | 1 Player 2 down (not used in Mad Alien) |
| 81 | | 1 Player 2 up (not used in Mad Alien) |
| 82 | | 1 Player 2 left |
| 83 | | 1 Player 2 right |
| 64 | palette_set_color(machine, i, MAKE_RGB(r, g, b)); |
| 65 | } |
| 84 | 66 | |
| 85 | | ***************************************************************************/ |
| 67 | for (i = 0; i < 16; i++) |
| 68 | { |
| 69 | colortable[0x00 + i] = i; |
| 70 | colortable[0x10 + i] = i; |
| 71 | colortable[0x20 + i] = i + 0x10; |
| 86 | 72 | |
| 87 | | #include "driver.h" |
| 88 | | #include "sound/ay8910.h" |
| 73 | /* PCB can swap address lines 1 and 2 when accessing color PROM */ |
| 89 | 74 | |
| 90 | | static tilemap *fg_tilemap, *bg_tilemap_l, *bg_tilemap_r; |
| 75 | if (BIT(i, 1)) |
| 76 | { |
| 77 | colortable[0x10 + i] ^= 6; |
| 78 | } |
| 79 | if (BIT(i, 2)) |
| 80 | { |
| 81 | colortable[0x10 + i] ^= 6; |
| 82 | } |
| 83 | } |
| 84 | } |
| 91 | 85 | |
| 92 | | static rectangle bg_tilemap_l_clip; |
| 93 | | static rectangle bg_tilemap_r_clip; |
| 94 | 86 | |
| 95 | | static mame_bitmap *headlight_bitmap, *flip_bitmap; |
| 87 | static void update_edges(int area) |
| 88 | { |
| 89 | UINT8* map = memory_region(REGION_GFX2) + 0x200 * area; |
| 96 | 90 | |
| 97 | | static UINT8 *madalien_videoram; |
| 98 | | static UINT8 *madalien_charram; |
| 99 | | static UINT8 *madalien_bgram; |
| 100 | | static UINT8 *madalien_shift_data; |
| 91 | // MADALIEN: |
| 92 | // |
| 93 | // area 0 section A - casino |
| 94 | // section B - tunnel |
| 95 | // area 1 section A - city |
| 96 | // section B - tunnel |
| 97 | // |
| 98 | // MADALINA: |
| 99 | // |
| 100 | // area 0 section A - desert |
| 101 | // section B - tunnel |
| 102 | // area 1 section A - lake |
| 103 | // section B - tunnel |
| 101 | 104 | |
| 102 | | static UINT8 madalien_scroll_v; |
| 103 | | static UINT8 madalien_scroll_l; |
| 104 | | static UINT8 madalien_scroll_r; |
| 105 | | static UINT8 madalien_scroll_light; |
| 105 | tilemap_set_user_data(tilemap_edge1[0], map); /* left edge */ |
| 106 | tilemap_set_user_data(tilemap_edge1[1], map); |
| 107 | tilemap_set_user_data(tilemap_edge1[2], map); |
| 108 | tilemap_set_user_data(tilemap_edge1[3], map); |
| 106 | 109 | |
| 107 | | static UINT8 madalien_shift_counter; |
| 108 | | static UINT8 madalien_shift_reg_lo; |
| 109 | | static UINT8 madalien_shift_reg_hi; |
| 110 | map += 0x80; |
| 110 | 111 | |
| 111 | | static UINT8 madalien_video_register; |
| 112 | tilemap_set_user_data(tilemap_edge2[0], map); /* right edge */ |
| 113 | tilemap_set_user_data(tilemap_edge2[1], map); |
| 114 | tilemap_set_user_data(tilemap_edge2[2], map); |
| 115 | tilemap_set_user_data(tilemap_edge2[3], map); |
| 112 | 116 | |
| 113 | | static UINT8 madalien_bg_map_selector; |
| 117 | tilemap_mark_all_tiles_dirty(ALL_TILEMAPS); |
| 118 | } |
| 114 | 119 | |
| 115 | | static int madalien_select_color_1; |
| 116 | | static int madalien_select_color_2; |
| 117 | | static int madalien_swap_colors; |
| 118 | 120 | |
| 119 | | static int madalien_headlight_on; |
| 121 | static int scan_helper(int col, int row, int section) |
| 122 | { |
| 123 | return section * 0x100 + (~col & 15) * 8 + row; |
| 124 | } |
| 120 | 125 | |
| 121 | | static int madalien_flip_screen; |
| 122 | 126 | |
| 123 | | static int madalien_headlight_source[128][128]; |
| 127 | static TILEMAP_MAPPER( scan_mode0 ) |
| 128 | { |
| 129 | return scan_helper(col, row, 0); |
| 130 | } |
| 131 | static TILEMAP_MAPPER( scan_mode1 ) |
| 132 | { |
| 133 | return scan_helper(col, row, 1); |
| 134 | } |
| 135 | static TILEMAP_MAPPER( scan_mode2 ) |
| 136 | { |
| 137 | return scan_helper(col, row, BIT(col, 4) ? 1 : 0); |
| 138 | } |
| 139 | static TILEMAP_MAPPER( scan_mode3 ) |
| 140 | { |
| 141 | return scan_helper(col, row, BIT(col, 4) ? 0 : 1); |
| 142 | } |
| 124 | 143 | |
| 125 | | static UINT8 madalien_sound_reg; |
| 126 | 144 | |
| 127 | | |
| 128 | | PALETTE_INIT( madalien ) |
| 145 | static TILE_GET_INFO( get_tile_info_BG ) |
| 129 | 146 | { |
| 130 | | int i, j, n, bit0, bit1, r, g, b; |
| 147 | const UINT8* p = param; |
| 131 | 148 | |
| 132 | | n = machine->drv->total_colors / 2; |
| 149 | SET_TILE_INFO(1, p[tile_index], BIT(madalien_video_flags, 2) ? 2 : 0, 0); |
| 150 | } |
| 133 | 151 | |
| 134 | | for (i = 0; i < n; i++) |
| 135 | | { |
| 136 | | /* red component */ |
| 137 | | bit0 = (color_prom[i] >> 0) & 0x01; |
| 138 | | bit1 = (color_prom[i] >> 1) & 0x01; |
| 139 | | r = 0x40 * bit0 + 0x80 * bit1; |
| 140 | | /* green component */ |
| 141 | | bit0 = (color_prom[i] >> 2) & 0x01; |
| 142 | | bit1 = (color_prom[i] >> 3) & 0x01; |
| 143 | | g = 0x40 * bit0 + 0x80 * bit1; |
| 144 | | /* blue component */ |
| 145 | | bit0 = (color_prom[i] >> 4) & 0x01; |
| 146 | | bit1 = (color_prom[i] >> 5) & 0x01; |
| 147 | | b = 0x40 * bit0 + 0x80 * bit1; |
| 148 | 152 | |
| 149 | | palette_set_color(machine, i, MAKE_RGB(r, g, b)); |
| 150 | | |
| 151 | | /* Colors for bits 1 and 2 swapped */ |
| 152 | | j = i; |
| 153 | | switch (j & 6) { |
| 154 | | case 2: |
| 155 | | j &= 0xf9; |
| 156 | | j |= 0x04; |
| 157 | | break; |
| 158 | | case 4: |
| 159 | | j &= 0xf9; |
| 160 | | j |= 0x02; |
| 161 | | break; |
| 162 | | }; |
| 163 | | palette_set_color(machine, j+n, MAKE_RGB(r, g, b)); |
| 164 | | } |
| 153 | static TILE_GET_INFO( get_tile_info_FG ) |
| 154 | { |
| 155 | SET_TILE_INFO(0, madalien_videoram[tile_index], 0, 0); |
| 165 | 156 | } |
| 166 | 157 | |
| 167 | | static TILE_GET_INFO( get_fg_tile_info ) |
| 168 | | { |
| 169 | | int code, color; |
| 170 | 158 | |
| 171 | | code = madalien_videoram[tile_index]; |
| 172 | | color = 2 * madalien_select_color_1; |
| 173 | | |
| 174 | | SET_TILE_INFO(0, code, color, 0); |
| 175 | | } |
| 176 | | |
| 177 | | static TILE_GET_INFO( get_bg_tile_info_l ) |
| 159 | static VIDEO_START( madalien ) |
| 178 | 160 | { |
| 179 | | int x, y, code, color, bg_base; |
| 161 | rectangle rect = { 0, 127, 0, 127 }; |
| 180 | 162 | |
| 181 | | UINT8 *bgrom = memory_region(REGION_GFX2); |
| 163 | static crtc6845_interface crtc6845_intf = |
| 164 | { |
| 165 | 0, /* screen we are acting on */ |
| 166 | PIXEL_CLOCK / 8, /* the clock of the chip */ |
| 167 | 8, /* number of pixels per video memory address */ |
| 168 | NULL, /* before pixel update callback */ |
| 169 | NULL, /* row update callback */ |
| 170 | NULL, /* after pixel update callback */ |
| 171 | NULL /* call back for display state changes */ |
| 172 | }; |
| 182 | 173 | |
| 183 | | x = tile_index & 0x0f; |
| 184 | | y = (tile_index / 16) & 0x0f; |
| 174 | crtc6845_config(0, &crtc6845_intf); |
| 185 | 175 | |
| 186 | | bg_base = madalien_bg_map_selector * 0x0100; |
| 176 | tilemap_fg = tilemap_create(get_tile_info_FG, |
| 177 | tilemap_scan_cols_flip_x, TILEMAP_TYPE_PEN, 8, 8, 32, 32); |
| 187 | 178 | |
| 188 | | if (x < 8) |
| 189 | | code = bgrom[bg_base + 8*y + x]; |
| 190 | | else |
| 191 | | code = 16; |
| 179 | tilemap_set_transparent_pen(tilemap_fg, 0); |
| 192 | 180 | |
| 193 | | color = madalien_swap_colors * 4; |
| 181 | tilemap_edge1[0] = tilemap_create(get_tile_info_BG, |
| 182 | scan_mode0, TILEMAP_TYPE_PEN, 16, 16, 16, 8); |
| 183 | tilemap_edge1[1] = tilemap_create(get_tile_info_BG, |
| 184 | scan_mode1, TILEMAP_TYPE_PEN, 16, 16, 16, 8); |
| 185 | tilemap_edge1[2] = tilemap_create(get_tile_info_BG, |
| 186 | scan_mode2, TILEMAP_TYPE_PEN, 16, 16, 32, 8); |
| 187 | tilemap_edge1[3] = tilemap_create(get_tile_info_BG, |
| 188 | scan_mode3, TILEMAP_TYPE_PEN, 16, 16, 32, 8); |
| 194 | 189 | |
| 195 | | SET_TILE_INFO(1, code, color, 0); |
| 196 | | } |
| 190 | tilemap_edge2[0] = tilemap_create(get_tile_info_BG, |
| 191 | scan_mode0, TILEMAP_TYPE_PEN, 16, 16, 16, 8); |
| 192 | tilemap_edge2[1] = tilemap_create(get_tile_info_BG, |
| 193 | scan_mode1, TILEMAP_TYPE_PEN, 16, 16, 16, 8); |
| 194 | tilemap_edge2[2] = tilemap_create(get_tile_info_BG, |
| 195 | scan_mode2, TILEMAP_TYPE_PEN, 16, 16, 32, 8); |
| 196 | tilemap_edge2[3] = tilemap_create(get_tile_info_BG, |
| 197 | scan_mode3, TILEMAP_TYPE_PEN, 16, 16, 32, 8); |
| 197 | 198 | |
| 198 | | static TILE_GET_INFO( get_bg_tile_info_r ) |
| 199 | | { |
| 200 | | int x, y, code, color, bg_base; |
| 199 | update_edges(0); |
| 201 | 200 | |
| 202 | | UINT8 *bgrom = memory_region(REGION_GFX2); |
| 201 | tilemap_set_scrolldy(tilemap_edge2[0], 0, machine->screen[0].height - 256); |
| 202 | tilemap_set_scrolldy(tilemap_edge2[1], 0, machine->screen[0].height - 256); |
| 203 | tilemap_set_scrolldy(tilemap_edge2[2], 0, machine->screen[0].height - 256); |
| 204 | tilemap_set_scrolldy(tilemap_edge2[3], 0, machine->screen[0].height - 256); |
| 203 | 205 | |
| 204 | | x = tile_index & 0x0f; |
| 205 | | y = (tile_index / 16) & 0x0f; |
| 206 | tilemap_set_flip(tilemap_edge2[0], TILEMAP_FLIPY); |
| 207 | tilemap_set_flip(tilemap_edge2[1], TILEMAP_FLIPY); |
| 208 | tilemap_set_flip(tilemap_edge2[2], TILEMAP_FLIPY); |
| 209 | tilemap_set_flip(tilemap_edge2[3], TILEMAP_FLIPY); |
| 206 | 210 | |
| 207 | | bg_base = madalien_bg_map_selector * 0x0100; |
| 211 | headlight_bitmap = auto_bitmap_alloc(128, 128, BITMAP_FORMAT_INDEXED16); |
| 208 | 212 | |
| 209 | | if (x < 8) |
| 210 | | code = bgrom[bg_base + 0x80 + 8*y + x]; |
| 211 | | else |
| 212 | | code = 16; |
| 213 | drawgfx(headlight_bitmap, machine->gfx[2], |
| 214 | 0, 0, 0, 0, 0x00, 0x00, &rect, TRANSPARENCY_NONE, 0); |
| 215 | drawgfx(headlight_bitmap, machine->gfx[2], |
| 216 | 0, 0, 0, 1, 0x00, 0x40, &rect, TRANSPARENCY_NONE, 0); |
| 213 | 217 | |
| 214 | | color = madalien_swap_colors * 4; |
| 215 | | |
| 216 | | SET_TILE_INFO(1, code, color, 0); |
| 218 | tmp_bitmap = auto_bitmap_alloc(256, 256, BITMAP_FORMAT_INDEXED16); |
| 217 | 219 | } |
| 218 | 220 | |
| 219 | 221 | |
| 222 | static VIDEO_UPDATE( madalien ) |
| 223 | { |
| 224 | int i; |
| 220 | 225 | |
| 226 | int flip_screen; |
| 221 | 227 | |
| 222 | | VIDEO_START( madalien ) |
| 223 | | { |
| 224 | | int x, y, data1, data2, bit; |
| 225 | | const UINT8 *headlight_rom; |
| 228 | /* draw background */ |
| 226 | 229 | |
| 227 | | fg_tilemap = tilemap_create(get_fg_tile_info, tilemap_scan_cols_flip_x, |
| 228 | | TILEMAP_TYPE_PEN, 8, 8, 32, 32); |
| 230 | rectangle rect = { 0, 255, 0, 255 }; |
| 229 | 231 | |
| 230 | | bg_tilemap_l = tilemap_create(get_bg_tile_info_l, tilemap_scan_cols_flip_x, |
| 231 | | TILEMAP_TYPE_PEN, 16, 16, 16, 16); |
| 232 | rectangle clip_edge1 = rect; |
| 233 | rectangle clip_edge2 = rect; |
| 232 | 234 | |
| 233 | | bg_tilemap_r = tilemap_create(get_bg_tile_info_r, tilemap_scan_cols_flip_x, |
| 234 | | TILEMAP_TYPE_PEN, 16, 16, 16, 16); |
| 235 | int mode = madalien_scroll & 3; |
| 235 | 236 | |
| 236 | | tilemap_set_transparent_pen( fg_tilemap, 0 ); |
| 237 | clip_edge1.max_y = madalien_edge1_pos ^ 0x7f; |
| 238 | clip_edge2.min_y = madalien_edge2_pos | 0x80; |
| 237 | 239 | |
| 238 | | bg_tilemap_l_clip = machine->screen[0].visarea; |
| 239 | | bg_tilemap_l_clip.max_y = machine->screen[0].height / 2; |
| 240 | fillbitmap(tmp_bitmap, machine->pens[0], &rect); |
| 240 | 241 | |
| 241 | | bg_tilemap_r_clip = machine->screen[0].visarea; |
| 242 | | bg_tilemap_r_clip.min_y = machine->screen[0].height / 2; |
| 242 | tilemap_draw( |
| 243 | tmp_bitmap, &clip_edge1, tilemap_edge1[mode], 0, 0); |
| 244 | tilemap_draw( |
| 245 | tmp_bitmap, &clip_edge2, tilemap_edge2[mode], 0, 0); |
| 243 | 246 | |
| 244 | | tilemap_set_flip(bg_tilemap_r, TILEMAP_FLIPY); |
| 247 | /* draw foreground */ |
| 245 | 248 | |
| 246 | | headlight_bitmap = auto_bitmap_alloc(128, 128, machine->screen[0].format); |
| 249 | for (i = 0; i < 256; i++) |
| 250 | { |
| 251 | decodechar(machine->gfx[0], i, madalien_charram, |
| 252 | machine->drv->gfxdecodeinfo[0].gfxlayout); |
| 253 | } |
| 247 | 254 | |
| 248 | | flip_bitmap = auto_bitmap_alloc(machine->screen[0].width,machine->screen[0].height,machine->screen[0].format); |
| 255 | tilemap_mark_all_tiles_dirty(tilemap_fg); |
| 249 | 256 | |
| 250 | | madalien_bgram = auto_malloc(0x1000); /* ficticiuos background RAM for empty tile */ |
| 257 | tilemap_draw(tmp_bitmap, &rect, tilemap_fg, 0, 0); |
| 251 | 258 | |
| 252 | | memset(madalien_bgram, 0, 0x1000); |
| 259 | /* highlight section A (outside of tunnels) */ |
| 253 | 260 | |
| 254 | | madalien_scroll_v = madalien_scroll_l = madalien_scroll_r = 0; |
| 261 | if (mode != 1) |
| 262 | { |
| 263 | int x; |
| 264 | int y; |
| 255 | 265 | |
| 256 | | madalien_shift_data = memory_region( REGION_GFX4 ); |
| 266 | int _L = 0; |
| 267 | int _T = 0; |
| 268 | int _R = 256; |
| 269 | int _B = 256; |
| 257 | 270 | |
| 258 | | /* Generate headlight shape data: */ |
| 259 | | headlight_rom = memory_region( REGION_GFX3 ); |
| 260 | | for( x=0; x<64; x++ ) |
| 261 | | for( y=0; y<64; y+=8 ) |
| 271 | if (mode == 2) |
| 262 | 272 | { |
| 263 | | data1 = headlight_rom[x*16 + (y/8)]; |
| 264 | | data2 = headlight_rom[x*16 + (y/8) + 8]; |
| 265 | | for( bit=0; bit<8; bit++ ) |
| 273 | if (_L < (madalien_scroll & 0xfc)) |
| 274 | _L = (madalien_scroll & 0xfc); |
| 275 | } |
| 276 | if (mode == 3) |
| 277 | { |
| 278 | if (_R > (madalien_scroll & 0xfc)) |
| 279 | _R = (madalien_scroll & 0xfc); |
| 280 | } |
| 281 | |
| 282 | for (y = _T; y < _B; y++) |
| 283 | { |
| 284 | for (x = _L; x < _R; x++) |
| 266 | 285 | { |
| 267 | | madalien_headlight_source[127-(y+bit)][x] = (data1 & 0x01); |
| 268 | | madalien_headlight_source[63-(y+bit)][x] = (data2 & 0x01); |
| 269 | | data1 >>= 1; |
| 270 | | data2 >>= 1; |
| 286 | *BITMAP_ADDR16(tmp_bitmap, y, x) |= 8; |
| 271 | 287 | } |
| 272 | 288 | } |
| 273 | | for( x=0; x<64; x++ ) |
| 274 | | for( y=0; y<128; y++ ) |
| 275 | | madalien_headlight_source[y][64+x] = madalien_headlight_source[y][63-x]; |
| 276 | | } |
| 289 | } |
| 277 | 290 | |
| 291 | /* draw car headlight */ |
| 278 | 292 | |
| 279 | | |
| 280 | | VIDEO_UPDATE( madalien ) |
| 281 | | { |
| 282 | | rectangle clip; |
| 283 | | int i, yh, x, y, xp, yp; |
| 284 | | |
| 285 | | for (i=0; i<256; i++) |
| 286 | | decodechar(machine->gfx[0], i, madalien_charram, machine->drv->gfxdecodeinfo[0].gfxlayout); |
| 287 | | |
| 288 | | decodechar(machine->gfx[1], 16, madalien_bgram, machine->drv->gfxdecodeinfo[1].gfxlayout); /* empty tile */ |
| 289 | | |
| 290 | | tilemap_set_scrolly( bg_tilemap_l, 0, madalien_scroll_l ); |
| 291 | | tilemap_set_scrollx( bg_tilemap_l, 0, madalien_scroll_v ); |
| 292 | | |
| 293 | | tilemap_set_scrolly( bg_tilemap_r, 0, madalien_scroll_r ); |
| 294 | | tilemap_set_scrollx( bg_tilemap_r, 0, madalien_scroll_v ); |
| 295 | | |
| 296 | | clip = bg_tilemap_l_clip; |
| 297 | | sect_rect(&clip, cliprect); |
| 298 | | tilemap_draw(bitmap, &clip, bg_tilemap_l, 0, 0); |
| 299 | | |
| 300 | | clip = bg_tilemap_r_clip; |
| 301 | | sect_rect(&clip, cliprect); |
| 302 | | tilemap_draw(bitmap, &clip, bg_tilemap_r, 0, 0); |
| 303 | | |
| 304 | | tilemap_draw(bitmap, &machine->screen[0].visarea, fg_tilemap, 0, 0); |
| 305 | | |
| 306 | | /* Draw headlight area using lighter colors: */ |
| 307 | | if (madalien_headlight_on && (madalien_bg_map_selector & 1)) |
| 293 | if (BIT(madalien_video_flags, 0)) |
| 308 | 294 | { |
| 309 | | yh = (256 - madalien_scroll_light) & 0xff; |
| 310 | | if (yh >= 192) |
| 311 | | yh = -(255-yh); |
| 295 | int x; |
| 296 | int y; |
| 312 | 297 | |
| 313 | | copybitmap( |
| 314 | | headlight_bitmap, /* dest */ |
| 315 | | bitmap, /* source */ |
| 316 | | 0, 0, /* flipx, flipy */ |
| 317 | | 0, -yh, /* scroll x, scroll y */ |
| 318 | | cliprect, /* clip */ |
| 319 | | TRANSPARENCY_NONE, 0 ); |
| 298 | for (y = 0; y < 128; y++) |
| 299 | { |
| 300 | int ypos = (y - madalien_headlight_pos) & 0xff; |
| 320 | 301 | |
| 321 | | for( x=0; x<128; x++ ) |
| 322 | | for( y=0; y<128; y++ ) |
| 323 | | if (madalien_headlight_source[x][y]) |
| 302 | for (x = 0; x < 128; x++) |
| 303 | { |
| 304 | if (*BITMAP_ADDR16(headlight_bitmap, y, x) != 0) |
| 324 | 305 | { |
| 325 | | xp = x; |
| 326 | | yp = yh + y; |
| 327 | | if( xp >= machine->screen[0].visarea.min_x && |
| 328 | | yp >= machine->screen[0].visarea.min_y && |
| 329 | | xp <= machine->screen[0].visarea.max_x && |
| 330 | | yp <= machine->screen[0].visarea.max_y ) |
| 331 | | { |
| 332 | | int color = *BITMAP_ADDR16(headlight_bitmap, y, x); |
| 333 | | *BITMAP_ADDR16(bitmap, yp, xp) = machine->pens[color+8]; |
| 334 | | } |
| 306 | *BITMAP_ADDR16(tmp_bitmap, ypos, x) |= 8; |
| 335 | 307 | } |
| 308 | } |
| 309 | } |
| 336 | 310 | }; |
| 337 | 311 | |
| 338 | | /* Flip screen (cocktail mode): */ |
| 339 | | if (madalien_flip_screen) { |
| 340 | | copybitmap(flip_bitmap, bitmap, 1, 1, 0, 0, &machine->screen[0].visarea, TRANSPARENCY_NONE, 0); |
| 341 | | copybitmap(bitmap, flip_bitmap, 0, 0, 0, 0, &machine->screen[0].visarea, TRANSPARENCY_NONE, 0); |
| 342 | | }; |
| 343 | | return 0; |
| 344 | | } |
| 312 | /* flip screen if necessary */ |
| 345 | 313 | |
| 314 | flip_screen = 0; |
| 346 | 315 | |
| 347 | | |
| 348 | | INTERRUPT_GEN( madalien_interrupt ) |
| 349 | | { |
| 350 | | static int coin; |
| 351 | | |
| 352 | | int port = readinputport(3) & 0x01; |
| 353 | | |
| 354 | | if (port != 0x00) /* Coin insertion triggers an NMI */ |
| 316 | if (BIT(readinputportbytag("DIP"), 6)) /* cocktail DIP */ |
| 355 | 317 | { |
| 356 | | if (coin == 0) |
| 318 | if (BIT(madalien_screen_control, 0)) |
| 357 | 319 | { |
| 358 | | coin = 1; |
| 359 | | cpunum_set_input_line(0, INPUT_LINE_NMI, PULSE_LINE); |
| 320 | flip_screen = 1; |
| 360 | 321 | } |
| 361 | 322 | } |
| 362 | | else |
| 363 | | coin = 0; |
| 364 | | } |
| 365 | 323 | |
| 324 | copybitmap(bitmap, tmp_bitmap, flip_screen, flip_screen, |
| 325 | 0, 0, cliprect, TRANSPARENCY_NONE, 0); |
| 366 | 326 | |
| 367 | | READ8_HANDLER( madalien_shift_reg_lo_r ) |
| 368 | | { |
| 369 | | return madalien_shift_reg_lo; |
| 327 | return 0; |
| 370 | 328 | } |
| 371 | 329 | |
| 372 | | READ8_HANDLER( madalien_shift_reg_hi_r ) |
| 330 | |
| 331 | static INTERRUPT_GEN( madalien_interrupt ) |
| 373 | 332 | { |
| 374 | | return madalien_shift_reg_hi; |
| 333 | cpunum_set_input_line(0, INPUT_LINE_NMI, |
| 334 | (readinputportbytag("PLAYER2") & 0x80) ? CLEAR_LINE : ASSERT_LINE); |
| 375 | 335 | } |
| 376 | 336 | |
| 377 | | READ8_HANDLER( madalien_videoram_r ) |
| 337 | |
| 338 | static READ8_HANDLER( madalien_shift_lo_r ) |
| 378 | 339 | { |
| 379 | | return madalien_videoram[offset]; |
| 380 | | } |
| 340 | const UINT8* table = memory_region(REGION_USER1); |
| 381 | 341 | |
| 382 | | READ8_HANDLER( madalien_charram_r ) |
| 383 | | { |
| 384 | | return madalien_charram[offset]; |
| 342 | return table[256 * madalien_shift_count + madalien_shift_data]; |
| 385 | 343 | } |
| 386 | 344 | |
| 387 | | WRITE8_HANDLER(madalien_video_register_w) |
| 345 | |
| 346 | static READ8_HANDLER( madalien_shift_hi_r ) |
| 388 | 347 | { |
| 389 | | int bit0, bit2, bit3; |
| 348 | UINT8 result = 0; |
| 390 | 349 | |
| 391 | | if ( madalien_video_register != data ) |
| 392 | | { |
| 393 | | madalien_video_register = data; |
| 350 | UINT8 flip = 0; |
| 394 | 351 | |
| 395 | | bit0 = data & 0x01; |
| 396 | | bit2 = ((data & 0x04) >> 2); |
| 397 | | bit3 = ((data & 0x08) >> 3); |
| 352 | if (BIT(madalien_shift_data, 0)) flip |= 1 << 7; |
| 353 | if (BIT(madalien_shift_data, 1)) flip |= 1 << 6; |
| 354 | if (BIT(madalien_shift_data, 2)) flip |= 1 << 5; |
| 355 | if (BIT(madalien_shift_data, 3)) flip |= 1 << 4; |
| 356 | if (BIT(madalien_shift_data, 4)) flip |= 1 << 3; |
| 357 | if (BIT(madalien_shift_data, 5)) flip |= 1 << 2; |
| 358 | if (BIT(madalien_shift_data, 6)) flip |= 1 << 1; |
| 359 | if (BIT(madalien_shift_data, 7)) flip |= 1 << 0; |
| 398 | 360 | |
| 399 | | /* Headlight on, if bit 0 is on */ |
| 400 | | madalien_headlight_on = bit0; |
| 361 | { |
| 362 | const UINT8* table = memory_region(REGION_USER1); |
| 401 | 363 | |
| 402 | | /* Swap color bits 1 and 2 of background */ |
| 403 | | if (bit2 != madalien_swap_colors) |
| 404 | | { |
| 405 | | madalien_swap_colors = bit2; |
| 406 | | tilemap_mark_all_tiles_dirty( fg_tilemap ); |
| 407 | | }; |
| 364 | UINT8 lookup = table[256 * (madalien_shift_count ^ 7) + flip]; |
| 408 | 365 | |
| 409 | | /* Select map (0=landscape A, 1=tunnel, 2=landscape B, 3=tunnel) */ |
| 410 | | madalien_bg_map_selector &= 0x01; |
| 411 | | madalien_bg_map_selector |= (bit3 << 1); |
| 366 | if (BIT(lookup, 0)) result |= 1 << 6; |
| 367 | if (BIT(lookup, 1)) result |= 1 << 5; |
| 368 | if (BIT(lookup, 2)) result |= 1 << 4; |
| 369 | if (BIT(lookup, 3)) result |= 1 << 3; |
| 370 | if (BIT(lookup, 4)) result |= 1 << 2; |
| 371 | if (BIT(lookup, 5)) result |= 1 << 1; |
| 372 | if (BIT(lookup, 6)) result |= 1 << 0; |
| 373 | } |
| 412 | 374 | |
| 413 | | tilemap_mark_all_tiles_dirty( bg_tilemap_l ); |
| 414 | | tilemap_mark_all_tiles_dirty( bg_tilemap_r ); |
| 415 | | }; |
| 375 | return result; |
| 416 | 376 | } |
| 417 | 377 | |
| 418 | | WRITE8_HANDLER( madalien_charram_w ) |
| 378 | |
| 379 | static WRITE8_HANDLER(madalien_video_flags_w) |
| 419 | 380 | { |
| 420 | | if (madalien_charram[offset] != data) |
| 381 | data &= 15; |
| 382 | |
| 383 | if (madalien_video_flags != data) |
| 421 | 384 | { |
| 422 | | madalien_charram[offset] = data; |
| 423 | | tilemap_mark_all_tiles_dirty(fg_tilemap); |
| 385 | update_edges(data >> 3); |
| 424 | 386 | } |
| 387 | |
| 388 | madalien_video_flags = data; |
| 425 | 389 | } |
| 426 | 390 | |
| 427 | | WRITE8_HANDLER( madalien_scroll_light_w ) |
| 391 | |
| 392 | static WRITE8_HANDLER( madalien_headlight_pos_w ) |
| 428 | 393 | { |
| 429 | | madalien_scroll_light = data; |
| 394 | madalien_headlight_pos = data; |
| 430 | 395 | } |
| 431 | 396 | |
| 432 | | WRITE8_HANDLER( madalien_scroll_v_w ) |
| 397 | |
| 398 | static WRITE8_HANDLER( madalien_scroll_w ) |
| 433 | 399 | { |
| 434 | | madalien_scroll_v = (255 - (data & 0xfc)); |
| 400 | int i; |
| 435 | 401 | |
| 436 | | madalien_bg_map_selector &= 0x02; |
| 437 | | madalien_bg_map_selector |= (data & 0x01); |
| 402 | // bits #0 and #1 define scrolling mode |
| 403 | // |
| 404 | // mode 0 - cycle over map section A |
| 405 | // mode 1 - cycle over map section B |
| 406 | // |
| 407 | // mode 2 - transition from B to A |
| 408 | // mode 3 - transition from A to B |
| 438 | 409 | |
| 439 | | madalien_select_color_1 = (data & 0x01); |
| 410 | for (i = 0; i < 4; i++) |
| 411 | { |
| 412 | tilemap_set_scrollx( |
| 413 | tilemap_edge1[i], 0, -(data & 0xfc)); |
| 414 | tilemap_set_scrollx( |
| 415 | tilemap_edge2[i], 0, -(data & 0xfc)); |
| 416 | } |
| 440 | 417 | |
| 441 | | tilemap_mark_all_tiles_dirty( bg_tilemap_l ); |
| 442 | | tilemap_mark_all_tiles_dirty( bg_tilemap_r ); |
| 443 | | tilemap_mark_all_tiles_dirty( fg_tilemap ); |
| 418 | madalien_scroll = data; |
| 444 | 419 | } |
| 445 | 420 | |
| 446 | | WRITE8_HANDLER( madalien_scroll_l_w ) |
| 421 | |
| 422 | static WRITE8_HANDLER( madalien_edge1_pos_w ) |
| 447 | 423 | { |
| 448 | | madalien_scroll_l = data; |
| 424 | madalien_edge1_pos = data & 0x7f; |
| 425 | |
| 426 | tilemap_set_scrolly(tilemap_edge1[0], 0, madalien_edge1_pos); |
| 427 | tilemap_set_scrolly(tilemap_edge1[1], 0, madalien_edge1_pos); |
| 428 | tilemap_set_scrolly(tilemap_edge1[2], 0, madalien_edge1_pos); |
| 429 | tilemap_set_scrolly(tilemap_edge1[3], 0, madalien_edge1_pos); |
| 449 | 430 | } |
| 450 | 431 | |
| 451 | | WRITE8_HANDLER( madalien_scroll_r_w ) |
| 432 | |
| 433 | static WRITE8_HANDLER( madalien_edge2_pos_w ) |
| 452 | 434 | { |
| 453 | | madalien_scroll_r = data; |
| 435 | madalien_edge2_pos = data & 0x7f; |
| 436 | |
| 437 | tilemap_set_scrolly(tilemap_edge2[0], 0, madalien_edge2_pos); |
| 438 | tilemap_set_scrolly(tilemap_edge2[1], 0, madalien_edge2_pos); |
| 439 | tilemap_set_scrolly(tilemap_edge2[2], 0, madalien_edge2_pos); |
| 440 | tilemap_set_scrolly(tilemap_edge2[3], 0, madalien_edge2_pos); |
| 454 | 441 | } |
| 455 | 442 | |
| 456 | | WRITE8_HANDLER( madalien_shift_counter_w ) |
| 443 | |
| 444 | static WRITE8_HANDLER( madalien_shift_data_w ) |
| 457 | 445 | { |
| 458 | | madalien_shift_counter = data & 0x07; |
| 446 | madalien_shift_data = data; |
| 459 | 447 | } |
| 460 | | |
| 461 | | static UINT8 reverse_bits( int x ) /* bit reversal by wiring in Mad Alien hardware */ |
| 448 | static WRITE8_HANDLER( madalien_shift_count_w ) |
| 462 | 449 | { |
| 463 | | int bit, n; |
| 464 | | n = 0; |
| 465 | | for (bit=0; bit<8; bit++) |
| 466 | | if (x & (1 << bit)) |
| 467 | | n |= (1 << (7-bit)); |
| 468 | | return n; |
| 450 | madalien_shift_count = data & 7; |
| 469 | 451 | } |
| 470 | 452 | |
| 471 | | static UINT8 swap_bits( int x ) /* special bit swap by wiring in Mad Alien hardware */ |
| 453 | |
| 454 | static WRITE8_HANDLER( madalien_screen_control_w ) |
| 472 | 455 | { |
| 473 | | int n = 0; |
| 474 | | if (x & 0x40) n |= 0x01; |
| 475 | | if (x & 0x20) n |= 0x02; |
| 476 | | if (x & 0x10) n |= 0x04; |
| 477 | | if (x & 0x08) n |= 0x08; |
| 478 | | if (x & 0x04) n |= 0x10; |
| 479 | | if (x & 0x02) n |= 0x20; |
| 480 | | if (x & 0x01) n |= 0x40; |
| 481 | | return n; |
| 482 | | } |
| 456 | /* bit #0 is set during player 2's turn, bit #3 is set during CRTC initialization */ |
| 483 | 457 | |
| 484 | | WRITE8_HANDLER( madalien_shift_reg_w ) |
| 485 | | { |
| 486 | | int rom_addr_0, rom_addr_1; |
| 487 | | rom_addr_0 = madalien_shift_counter * 256 + data; |
| 488 | | rom_addr_1 = ((madalien_shift_counter^0x07) & 0x07) * 256 + reverse_bits(data); |
| 489 | | madalien_shift_reg_lo = madalien_shift_data[rom_addr_0]; |
| 490 | | madalien_shift_reg_hi = swap_bits( madalien_shift_data[rom_addr_1] ); |
| 458 | madalien_screen_control = data & 15; |
| 491 | 459 | } |
| 492 | 460 | |
| 493 | | WRITE8_HANDLER( madalien_videoram_w ) |
| 461 | |
| 462 | static WRITE8_HANDLER( madalien_output_w ) |
| 494 | 463 | { |
| 495 | | madalien_videoram[offset] = data; |
| 496 | | tilemap_mark_tile_dirty(fg_tilemap, offset); |
| 464 | /* output latch, eight output bits, none connected */ |
| 497 | 465 | } |
| 498 | 466 | |
| 499 | | WRITE8_HANDLER( madalien_flip_screen_w ) |
| 467 | |
| 468 | static WRITE8_HANDLER( madalien_sound_command_w ) |
| 500 | 469 | { |
| 501 | | if (readinputport(1) & 0x40) /* hack for screen flipping in cocktail mode - main board schematics needed */ |
| 502 | | madalien_flip_screen = (data & 1); |
| 503 | | else |
| 504 | | madalien_flip_screen = 0; |
| 505 | | } |
| 470 | cpunum_set_input_line(1, 0, ASSERT_LINE); |
| 506 | 471 | |
| 507 | | WRITE8_HANDLER( madalien_sound_command_w ) |
| 508 | | { |
| 509 | 472 | soundlatch_w(offset, data); |
| 510 | | cpunum_set_input_line(1, 0, HOLD_LINE); |
| 511 | 473 | } |
| 512 | 474 | |
| 513 | | WRITE8_HANDLER( madalien_soundreg_w ) |
| 475 | |
| 476 | static READ8_HANDLER(madalien_sound_command_r ) |
| 514 | 477 | { |
| 515 | | madalien_sound_reg = data; |
| 516 | | } |
| 478 | cpunum_set_input_line(1, 0, CLEAR_LINE); |
| 517 | 479 | |
| 518 | | READ8_HANDLER( madalien_soundreg_r ) |
| 519 | | { |
| 520 | | return madalien_sound_reg; |
| 480 | return soundlatch_r(offset); |
| 521 | 481 | } |
| 522 | 482 | |
| 523 | 483 | |
| 524 | | static const gfx_layout charlayout_memory = |
| 484 | static WRITE8_HANDLER( madalien_portA_w ) |
| 525 | 485 | { |
| 526 | | 8,8, /* 8*8 characters */ |
| 527 | | 256, /* 256 characters */ |
| 528 | | 3, /* 3 bits per pixel */ |
| 529 | | { 2*256*8*8, 256*8*8, 0 }, /* the 3 bitplanes are separated */ |
| 530 | | { 0, 1, 2, 3, 4, 5, 6, 7 }, |
| 531 | | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, |
| 532 | | 8*8 /* every char takes 8 consecutive bytes */ |
| 533 | | }; |
| 534 | | |
| 535 | | static const gfx_layout tilelayout = |
| 486 | /* not emulated - amplification? */ |
| 487 | } |
| 488 | static WRITE8_HANDLER( madalien_portB_w ) |
| 536 | 489 | { |
| 537 | | 16,16, /* 16*16 tiles */ |
| 538 | | 16+1, /* 16 tiles + 1 empty tile */ |
| 539 | | 3, /* 3 bits per pixel */ |
| 540 | | { 4*16*16*16+4, 2*16*16*16+4, 4 }, |
| 541 | | { 3*16*8+0, 3*16*8+1, 3*16*8+2, 3*16*8+3, 2*16*8+0, 2*16*8+1, 2*16*8+2, 2*16*8+3, |
| 542 | | 16*8+0, 16*8+1, 16*8+2, 16*8+3, 0, 1, 2, 3 }, |
| 543 | | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, |
| 544 | | 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, |
| 545 | | 64*8 /* every tile takes 64 consecutive bytes */ |
| 546 | | }; |
| 490 | /* not emulated - motor sound? */ |
| 491 | } |
| 547 | 492 | |
| 548 | 493 | |
| 549 | | static GFXDECODE_START( madalien ) |
| 550 | | GFXDECODE_ENTRY( 0, 0, charlayout_memory, 0, 8 ) /* characters (the game dynamically modifies them) */ |
| 551 | | GFXDECODE_ENTRY( REGION_GFX1, 0, tilelayout, 0, 8 ) /* background tiles */ |
| 552 | | GFXDECODE_END |
| 494 | static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 495 | AM_RANGE(0x0000, 0x03ff) AM_RAM |
| 553 | 496 | |
| 497 | AM_RANGE(0x6000, 0x63ff) AM_RAM AM_BASE(&madalien_videoram) |
| 498 | AM_RANGE(0x6400, 0x67ff) AM_RAM |
| 499 | AM_RANGE(0x6800, 0x7fff) AM_RAM AM_BASE(&madalien_charram) |
| 554 | 500 | |
| 555 | | static ADDRESS_MAP_START( madalien_readmem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 556 | | AM_RANGE(0x0000, 0x03ff) AM_READ(MRA8_RAM) /* Program RAM */ |
| 557 | | AM_RANGE(0x6000, 0x63ff) AM_READ(madalien_videoram_r) /* Video RAM */ |
| 558 | | AM_RANGE(0x6800, 0x7fff) AM_READ(madalien_charram_r) /* Character generator RAM */ |
| 559 | | AM_RANGE(0x8006, 0x8006) AM_READ(soundlatch2_r) /* Input from sound board */ |
| 560 | | AM_RANGE(0x8008, 0x8008) AM_READ(madalien_shift_reg_lo_r) /* Low byte of shift reg. after shift operation */ |
| 561 | | AM_RANGE(0x8009, 0x8009) AM_READ(madalien_shift_reg_hi_r) /* Low byte of shift reg. after shift operation */ |
| 562 | | AM_RANGE(0x9000, 0x9000) AM_READ(input_port_0_r) /* Input ports */ |
| 563 | | AM_RANGE(0x9001, 0x9001) AM_READ(input_port_1_r) |
| 564 | | AM_RANGE(0x9002, 0x9002) AM_READ(input_port_2_r) |
| 565 | | AM_RANGE(0xb000, 0xffff) AM_READ(MRA8_ROM) /* Program ROM */ |
| 566 | | ADDRESS_MAP_END |
| 501 | AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x0ff0) AM_WRITE(crtc6845_address_w) |
| 502 | AM_RANGE(0x8001, 0x8001) AM_MIRROR(0x0ff0) AM_READWRITE(crtc6845_register_r, crtc6845_register_w) |
| 503 | AM_RANGE(0x8004, 0x8004) AM_MIRROR(0x0ff0) AM_WRITE(madalien_screen_control_w) |
| 504 | AM_RANGE(0x8005, 0x8005) AM_MIRROR(0x0ff0) AM_WRITE(madalien_output_w) |
| 505 | AM_RANGE(0x8006, 0x8006) AM_MIRROR(0x0ff0) AM_READWRITE(soundlatch2_r, madalien_sound_command_w) |
| 506 | AM_RANGE(0x8008, 0x8008) AM_MIRROR(0x07f0) AM_READWRITE(madalien_shift_lo_r, madalien_shift_count_w) |
| 507 | AM_RANGE(0x8009, 0x8009) AM_MIRROR(0x07f0) AM_READWRITE(madalien_shift_hi_r, madalien_shift_data_w) |
| 508 | AM_RANGE(0x800b, 0x800b) AM_MIRROR(0x07f0) AM_WRITE(madalien_video_flags_w) |
| 509 | AM_RANGE(0x800c, 0x800c) AM_MIRROR(0x07f0) AM_WRITE(madalien_headlight_pos_w) |
| 510 | AM_RANGE(0x800d, 0x800d) AM_MIRROR(0x07f0) AM_WRITE(madalien_edge1_pos_w) |
| 511 | AM_RANGE(0x800e, 0x800e) AM_MIRROR(0x07f0) AM_WRITE(madalien_edge2_pos_w) |
| 512 | AM_RANGE(0x800f, 0x800f) AM_MIRROR(0x07f0) AM_WRITE(madalien_scroll_w) |
| 567 | 513 | |
| 514 | AM_RANGE(0x9000, 0x9000) AM_MIRROR(0x0ff0) AM_READ(input_port_0_r) |
| 515 | AM_RANGE(0x9001, 0x9001) AM_MIRROR(0x0ff0) AM_READ(input_port_1_r) |
| 516 | AM_RANGE(0x9002, 0x9002) AM_MIRROR(0x0ff0) AM_READ(input_port_2_r) |
| 568 | 517 | |
| 569 | | |
| 570 | | static ADDRESS_MAP_START( madalien_writemem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 571 | | AM_RANGE(0x0000, 0x03ff) AM_WRITE(MWA8_RAM) /* Normal RAM */ |
| 572 | | AM_RANGE(0x6000, 0x63ff) AM_WRITE(madalien_videoram_w) AM_BASE(&madalien_videoram) /* Video RAM */ |
| 573 | | AM_RANGE(0x6800, 0x7fff) AM_WRITE(madalien_charram_w) AM_BASE(&madalien_charram) /* Character generator RAM */ |
| 574 | | AM_RANGE(0x8004, 0x8004) AM_WRITE(madalien_flip_screen_w) /* Flip screen in cocktail mode */ |
| 575 | | AM_RANGE(0x8006, 0x8006) AM_WRITE(madalien_sound_command_w) /* Command to sound board */ |
| 576 | | AM_RANGE(0x8008, 0x8008) AM_WRITE(madalien_shift_counter_w) /* Set counter for shifter circuitry */ |
| 577 | | AM_RANGE(0x8009, 0x8009) AM_WRITE(madalien_shift_reg_w) /* Put data to be shifted */ |
| 578 | | AM_RANGE(0x800b, 0x800b) AM_WRITE(madalien_video_register_w) /* Video register (light/color/landscape) */ |
| 579 | | AM_RANGE(0x800c, 0x800c) AM_WRITE(madalien_scroll_light_w) /* Car headlight horiz. scroll register */ |
| 580 | | AM_RANGE(0x800d, 0x800d) AM_WRITE(madalien_scroll_l_w) /* Background horiz. scroll register left part */ |
| 581 | | AM_RANGE(0x800e, 0x800e) AM_WRITE(madalien_scroll_r_w) /* Background horiz. scroll register right part */ |
| 582 | | AM_RANGE(0x800f, 0x800f) AM_WRITE(madalien_scroll_v_w) /* Background vertical scroll register */ |
| 583 | | AM_RANGE(0xb000, 0xffff) AM_WRITE(MWA8_ROM) /* Program ROM */ |
| 518 | AM_RANGE(0xa000, 0xffff) AM_ROM |
| 584 | 519 | ADDRESS_MAP_END |
| 585 | 520 | |
| 586 | 521 | |
| 587 | | static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 588 | | AM_RANGE(0x0000, 0x03ff) AM_READ(MRA8_RAM) /* Sound board RAM */ |
| 589 | | AM_RANGE(0x6800, 0x6800) AM_READ(madalien_soundreg_r) /* Sound board register, just to write in and read out */ |
| 590 | | AM_RANGE(0x8000, 0x8000) AM_READ(soundlatch_r) /* Sound board input from master CPU */ |
| 591 | | AM_RANGE(0xf800, 0xffff) AM_READ(MRA8_ROM) /* Sound board program ROM */ |
| 522 | static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 523 | AM_RANGE(0x0000, 0x03ff) AM_MIRROR(0x1c00) AM_RAM |
| 524 | AM_RANGE(0x6000, 0x6003) AM_MIRROR(0x1ffc) AM_RAM /* unknown device in an epoxy block, might be tilt detection */ |
| 525 | AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x1ffc) AM_READ(madalien_sound_command_r) |
| 526 | AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x1ffc) AM_WRITE(AY8910_control_port_0_w) |
| 527 | AM_RANGE(0x8001, 0x8001) AM_MIRROR(0x1ffc) AM_WRITE(AY8910_write_port_0_w) |
| 528 | AM_RANGE(0x8002, 0x8002) AM_MIRROR(0x1ffc) AM_WRITE(soundlatch2_w) |
| 529 | AM_RANGE(0xf800, 0xffff) AM_ROM |
| 592 | 530 | ADDRESS_MAP_END |
| 593 | 531 | |
| 594 | | static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) |
| 595 | | AM_RANGE(0x0000, 0x03ff) AM_WRITE(MWA8_RAM) /* Sound board RAM */ |
| 596 | | AM_RANGE(0x6500, 0x6500) AM_WRITE(madalien_soundreg_w) /* Sound board register */ |
| 597 | | AM_RANGE(0x8000, 0x8000) AM_WRITE(AY8910_control_port_0_w) /* AY-3-8910 control port */ |
| 598 | | AM_RANGE(0x8001, 0x8001) AM_WRITE(AY8910_write_port_0_w) /* AY-3-8910 data port */ |
| 599 | | AM_RANGE(0x8006, 0x8006) AM_WRITE(soundlatch2_w) /* Sound board output to master CPU */ |
| 600 | | AM_RANGE(0xf800, 0xffff) AM_WRITE(MWA8_ROM) /* Sound board program ROM */ |
| 601 | | ADDRESS_MAP_END |
| 602 | 532 | |
| 603 | | |
| 604 | | |
| 605 | 533 | INPUT_PORTS_START( madalien ) |
| 606 | | PORT_START |
| 534 | PORT_START_TAG("PLAYER1") |
| 607 | 535 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) |
| 608 | 536 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) |
| 609 | 537 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) |
| r1215 | r1216 | |
| 611 | 539 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) |
| 612 | 540 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) |
| 613 | 541 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 ) |
| 614 | | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 542 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 615 | 543 | |
| 616 | | PORT_START |
| 617 | | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) ) |
| 544 | PORT_START_TAG("DIP") |
| 545 | PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives )) PORT_DIPLOCATION("SW:1,2") |
| 618 | 546 | PORT_DIPSETTING( 0x00, "3" ) |
| 619 | 547 | PORT_DIPSETTING( 0x01, "4" ) |
| 620 | 548 | PORT_DIPSETTING( 0x02, "5" ) |
| 621 | 549 | PORT_DIPSETTING( 0x03, "6" ) |
| 622 | | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coinage ) ) |
| 550 | PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Coinage )) PORT_DIPLOCATION("SW:3,4") |
| 623 | 551 | PORT_DIPSETTING( 0x0c, DEF_STR( 2C_1C ) ) |
| 624 | 552 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) |
| 625 | 553 | PORT_DIPSETTING( 0x04, DEF_STR( 1C_2C ) ) |
| 626 | | PORT_DIPNAME( 0x30, 0x30, "Bonus_points" ) |
| 554 | PORT_DIPNAME( 0x30, 0x00, DEF_STR( Bonus_Life )) PORT_DIPLOCATION("SW:5,6") |
| 627 | 555 | PORT_DIPSETTING( 0x00, "3000" ) |
| 628 | | PORT_DIPSETTING( 0x20, "5000" ) |
| 629 | | PORT_DIPSETTING( 0x10, "7000" ) |
| 630 | | PORT_DIPSETTING( 0x30, "nil" ) |
| 631 | | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) ) |
| 632 | | PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) |
| 633 | | PORT_DIPSETTING( 0x40, DEF_STR( Cocktail ) ) |
| 634 | | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 556 | PORT_DIPSETTING( 0x10, "5000" ) |
| 557 | PORT_DIPSETTING( 0x20, "7000" ) |
| 558 | PORT_DIPSETTING( 0x30, "never" ) |
| 559 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet )) PORT_DIPLOCATION("SW:8") |
| 560 | PORT_DIPSETTING( 0x00, DEF_STR( Upright )) |
| 561 | PORT_DIPSETTING( 0x40, DEF_STR( Cocktail )) |
| 562 | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK ) |
| 635 | 563 | |
| 636 | | PORT_START |
| 564 | PORT_START_TAG("PLAYER2") |
| 637 | 565 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) |
| 638 | 566 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) |
| 639 | 567 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) |
| 640 | 568 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) |
| 641 | 569 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 642 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 643 | | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 644 | | PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 645 | | |
| 646 | | PORT_START /* Fake port or coin: coin insertion triggers an NMI */ |
| 647 | | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) |
| 648 | | PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 570 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 571 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 572 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) /* or service coin */ |
| 649 | 573 | INPUT_PORTS_END |
| 650 | 574 | |
| 651 | 575 | |
| 652 | 576 | |
| 577 | static const UINT32 headlight_xoffset[] = |
| 578 | { |
| 579 | STEP8(0x78, 1), |
| 580 | STEP8(0x70, 1), |
| 581 | STEP8(0x68, 1), |
| 582 | STEP8(0x60, 1), |
| 583 | STEP8(0x58, 1), |
| 584 | STEP8(0x50, 1), |
| 585 | STEP8(0x48, 1), |
| 586 | STEP8(0x40, 1), |
| 587 | STEP8(0x38, 1), |
| 588 | STEP8(0x30, 1), |
| 589 | STEP8(0x28, 1), |
| 590 | STEP8(0x20, 1), |
| 591 | STEP8(0x18, 1), |
| 592 | STEP8(0x10, 1), |
| 593 | STEP8(0x08, 1), |
| 594 | STEP8(0x00, 1), |
| 595 | }; |
| 596 | |
| 597 | static const UINT32 headlight_yoffset[] = |
| 598 | { |
| 599 | STEP32(0x0000, 0x80), STEP32(0x1000, 0x80) |
| 600 | }; |
| 601 | |
| 602 | static const gfx_layout headlightlayout = |
| 603 | { |
| 604 | 128, 64, |
| 605 | 1, |
| 606 | 1, |
| 607 | { 0 }, |
| 608 | EXTENDED_XOFFS, |
| 609 | EXTENDED_YOFFS, |
| 610 | 0x2000, |
| 611 | headlight_xoffset, |
| 612 | headlight_yoffset |
| 613 | }; |
| 614 | |
| 615 | static const gfx_layout charlayout = |
| 616 | { |
| 617 | 8, 8, |
| 618 | 256, |
| 619 | 3, |
| 620 | { 2*0x4000, 1*0x4000, 0*0x4000 }, |
| 621 | { STEP8(0, 1) }, |
| 622 | { STEP8(0, 8) }, |
| 623 | 64 |
| 624 | }; |
| 625 | |
| 626 | static const gfx_layout tilelayout = |
| 627 | { |
| 628 | 16, 16, |
| 629 | RGN_FRAC(1,3), |
| 630 | 3, |
| 631 | { RGN_FRAC(2,3), RGN_FRAC(1,3), RGN_FRAC(0,3) }, |
| 632 | { |
| 633 | 0x30*8+4, 0x30*8+5, 0x30*8+6, 0x30*8+7, |
| 634 | 0x20*8+4, 0x20*8+5, 0x20*8+6, 0x20*8+7, |
| 635 | 0x10*8+4, 0x10*8+5, 0x10*8+6, 0x10*8+7, |
| 636 | 0x00*8+4, 0x00*8+5, 0x00*8+6, 0x00*8+7 |
| 637 | }, |
| 638 | { STEP16(0, 8) }, |
| 639 | 0x200 |
| 640 | }; |
| 641 | |
| 642 | |
| 643 | static GFXDECODE_START( madalien ) |
| 644 | GFXDECODE_ENTRY( 0, 0, charlayout, 32, 2 ) /* foreground characters, stored in RAM */ |
| 645 | GFXDECODE_ENTRY( REGION_GFX1, 0, tilelayout, 0, 4 ) |
| 646 | GFXDECODE_ENTRY( REGION_GFX3, 0, headlightlayout, 0, 1 ) |
| 647 | GFXDECODE_END |
| 648 | |
| 649 | |
| 650 | static struct AY8910interface ay8910_interface = |
| 651 | { |
| 652 | NULL, |
| 653 | NULL, |
| 654 | madalien_portA_w, |
| 655 | madalien_portB_w |
| 656 | }; |
| 657 | |
| 658 | |
| 653 | 659 | static MACHINE_DRIVER_START( madalien ) |
| 654 | 660 | |
| 655 | | /* basic machine hardware */ |
| 656 | | MDRV_CPU_ADD_TAG("main", M6502, 750000) /* 750 kHz ? */ |
| 657 | | MDRV_CPU_PROGRAM_MAP(madalien_readmem, madalien_writemem) |
| 661 | /* main CPU */ |
| 662 | MDRV_CPU_ADD_TAG("main", M6502, MAIN_CLOCK / 8) /* 1324kHz */ |
| 663 | MDRV_CPU_PROGRAM_MAP(main_map, 0) |
| 658 | 664 | MDRV_CPU_VBLANK_INT(madalien_interrupt, 1) |
| 659 | 665 | |
| 660 | | MDRV_CPU_ADD_TAG("sound", M6502, 500000) /* 500 kHz ? */ |
| 661 | 666 | /* audio CPU */ |
| 662 | | MDRV_CPU_PROGRAM_MAP(sound_readmem, sound_writemem) |
| 663 | | MDRV_CPU_VBLANK_INT(nmi_line_pulse, 16) |
| 667 | MDRV_CPU_ADD_TAG("sound", M6502, SOUND_CLOCK / 8) /* 512kHz */ |
| 668 | MDRV_CPU_PROGRAM_MAP(sound_map, 0) |
| 669 | MDRV_CPU_PERIODIC_INT(nmi_line_pulse, 800) /* unknown due to incomplete schematics */ |
| 664 | 670 | |
| 665 | | MDRV_SCREEN_REFRESH_RATE(60) |
| 666 | | MDRV_SCREEN_VBLANK_TIME(USEC_TO_SUBSECONDS(3072)) |
| 667 | | |
| 668 | 671 | /* video hardware */ |
| 669 | 672 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| 673 | MDRV_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 336, 0, 256, 288, 0, 256) |
| 670 | 674 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 671 | | MDRV_SCREEN_SIZE(32*8, 32*8) |
| 672 | | MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) |
| 673 | 675 | MDRV_GFXDECODE(madalien) |
| 674 | | MDRV_PALETTE_LENGTH(2*32) |
| 676 | MDRV_PALETTE_LENGTH(32) |
| 677 | MDRV_COLORTABLE_LENGTH(48) |
| 675 | 678 | MDRV_PALETTE_INIT(madalien) |
| 676 | 679 | MDRV_VIDEO_START(madalien) |
| 677 | 680 | MDRV_VIDEO_UPDATE(madalien) |
| r1215 | r1216 | |
| 679 | 682 | /* sound hardware */ |
| 680 | 683 | MDRV_SPEAKER_STANDARD_MONO("mono") |
| 681 | 684 | |
| 682 | | MDRV_SOUND_ADD(AY8910, 500000) |
| 685 | MDRV_SOUND_ADD(AY8910, SOUND_CLOCK / 4) |
| 686 | MDRV_SOUND_CONFIG(ay8910_interface) |
| 683 | 687 | MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.23) |
| 684 | 688 | MACHINE_DRIVER_END |
| 685 | 689 | |
| 686 | 690 | |
| 687 | 691 | ROM_START( madalien ) |
| 688 | | ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* 64k for 6502 code of main CPU */ |
| 689 | | ROM_LOAD( "m7", 0xc000, 0x0800, CRC(4d12f89d) SHA1(e155f9135bc2bea56e211052f2b74d25e76308c8) ) |
| 690 | | ROM_LOAD( "m6", 0xc800, 0x0800, CRC(1bc4a57b) SHA1(02252b868d0c07c0a18240e9d831c303cdcfa9a6) ) |
| 691 | | ROM_LOAD( "m5", 0xd000, 0x0800, CRC(8db99572) SHA1(f8cf22f8c134b47756b7f02c5ca0217100466744) ) |
| 692 | | ROM_LOAD( "m4", 0xd800, 0x0800, CRC(fba671af) SHA1(dd74bd357c82d525948d836a7f860bbb3182c825) ) |
| 693 | | ROM_LOAD( "m3", 0xe000, 0x0800, CRC(1aad640d) SHA1(9ace7d2c5ef9e789c2b8cc65420b19ce72cd95fa) ) |
| 694 | | ROM_LOAD( "m2", 0xe800, 0x0800, CRC(cbd533a0) SHA1(d3be81fb9ba40e30e5ff0171efd656b11dd20f2b) ) |
| 695 | | ROM_LOAD( "m1", 0xf000, 0x0800, CRC(ad654b1d) SHA1(f8b365dae3801e97e04a10018a790d3bdb5d9439) ) |
| 696 | | ROM_LOAD( "m0", 0xf800, 0x0800, CRC(cf7aa787) SHA1(f852cc806ecc582661582326747974a14f50174a) ) |
| 692 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* main CPU */ |
| 693 | ROM_LOAD( "m7.3f", 0xc000, 0x0800, CRC(4d12f89d) SHA1(e155f9135bc2bea56e211052f2b74d25e76308c8) ) |
| 694 | ROM_LOAD( "m6.3h", 0xc800, 0x0800, CRC(1bc4a57b) SHA1(02252b868d0c07c0a18240e9d831c303cdcfa9a6) ) |
| 695 | ROM_LOAD( "m5.3k", 0xd000, 0x0800, CRC(8db99572) SHA1(f8cf22f8c134b47756b7f02c5ca0217100466744) ) |
| 696 | ROM_LOAD( "m4.3l", 0xd800, 0x0800, CRC(fba671af) SHA1(dd74bd357c82d525948d836a7f860bbb3182c825) ) |
| 697 | ROM_LOAD( "m3.4f", 0xe000, 0x0800, CRC(1aad640d) SHA1(9ace7d2c5ef9e789c2b8cc65420b19ce72cd95fa) ) |
| 698 | ROM_LOAD( "m2.4h", 0xe800, 0x0800, CRC(cbd533a0) SHA1(d3be81fb9ba40e30e5ff0171efd656b11dd20f2b) ) |
| 699 | ROM_LOAD( "m1.4k", 0xf000, 0x0800, CRC(ad654b1d) SHA1(f8b365dae3801e97e04a10018a790d3bdb5d9439) ) |
| 700 | ROM_LOAD( "m0.4l", 0xf800, 0x0800, CRC(cf7aa787) SHA1(f852cc806ecc582661582326747974a14f50174a) ) |
| 697 | 701 | |
| 698 | | ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* 64k for 6502 code of audio CPU */ |
| 702 | ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* audio CPU */ |
| 699 | 703 | ROM_LOAD( "m8", 0xf800, 0x0400, CRC(cfd19dab) SHA1(566dc84ffe9bcaeb112250a9e1882bf62f47b579) ) |
| 700 | 704 | ROM_LOAD( "m9", 0xfc00, 0x0400, CRC(48f30f24) SHA1(9c0bf6e43b143d6af1ebb9dad2bdc2b53eb2e48e) ) |
| 701 | 705 | |
| 702 | | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) /* Background tiles */ |
| 703 | | ROM_LOAD( "mc", 0x0000, 0x0400, CRC(2daadfb7) SHA1(8be084a39b256e538fd57111e92d47115cb142cd) ) |
| 704 | | ROM_LOAD( "md", 0x0400, 0x0400, CRC(3ee1287a) SHA1(33bc59a8d09d22f3db80f881c2f37aa788718138) ) |
| 705 | | ROM_LOAD( "me", 0x0800, 0x0400, CRC(45a5c201) SHA1(ac600afeabf494634c3189d8e96644bd0deb45f3) ) |
| 706 | ROM_REGION( 0x0c00, REGION_GFX1, ROMREGION_DISPOSE ) /* background tiles */ |
| 707 | ROM_LOAD( "mc.3k", 0x0000, 0x0400, CRC(2daadfb7) SHA1(8be084a39b256e538fd57111e92d47115cb142cd) ) |
| 708 | ROM_LOAD( "md.3l", 0x0400, 0x0400, CRC(3ee1287a) SHA1(33bc59a8d09d22f3db80f881c2f37aa788718138) ) |
| 709 | ROM_LOAD( "me.3m", 0x0800, 0x0400, CRC(45a5c201) SHA1(ac600afeabf494634c3189d8e96644bd0deb45f3) ) |
| 706 | 710 | |
| 707 | | ROM_REGION( 0x0400, REGION_GFX2, 0 ) /* Background tile maps */ |
| 708 | | ROM_LOAD( "mf", 0x0000, 0x0400, CRC(e9cba773) SHA1(356c7edb1b412a9e04f0747e780c945af8791c55) ) |
| 711 | ROM_REGION( 0x0400, REGION_GFX2, 0 ) /* background tile map */ |
| 712 | ROM_LOAD( "mf.4h", 0x0000, 0x0400, CRC(e9cba773) SHA1(356c7edb1b412a9e04f0747e780c945af8791c55) ) |
| 709 | 713 | |
| 710 | | ROM_REGION( 0x0400, REGION_GFX3, 0 ) /* Car headlight */ |
| 711 | | ROM_LOAD( "ma", 0x0000, 0x0400, CRC(aab16446) SHA1(d2342627cc2766004343f27515d8a7989d5fe932) ) |
| 714 | ROM_REGION( 0x0400, REGION_GFX3, ROMREGION_DISPOSE ) /* headlight */ |
| 715 | ROM_LOAD( "ma.2b", 0x0000, 0x0400, CRC(aab16446) SHA1(d2342627cc2766004343f27515d8a7989d5fe932) ) |
| 712 | 716 | |
| 713 | | ROM_REGION( 0x0800, REGION_GFX4, 0 ) /* Shifting data */ |
| 714 | | ROM_LOAD( "mb", 0x0000, 0x0800, CRC(cb801e49) SHA1(7444c4af7cf07e5fdc54044d62ea4fcb201b2b8b) ) |
| 717 | ROM_REGION( 0x0800, REGION_USER1, 0 ) /* shifting table */ |
| 718 | ROM_LOAD( "mb.5c", 0x0000, 0x0800, CRC(cb801e49) SHA1(7444c4af7cf07e5fdc54044d62ea4fcb201b2b8b) ) |
| 715 | 719 | |
| 716 | | ROM_REGION( 0x0020, REGION_PROMS, 0 ) /* Color PROM */ |
| 717 | | ROM_LOAD( "mg", 0x0000, 0x0020, CRC(3395b31f) SHA1(26235fb448a4180c58f0887e53a29c17857b3b34) ) |
| 720 | ROM_REGION( 0x0020, REGION_PROMS, 0 ) /* color PROM */ |
| 721 | ROM_LOAD( "mg.7f", 0x0000, 0x0020, CRC(3395b31f) SHA1(26235fb448a4180c58f0887e53a29c17857b3b34) ) |
| 718 | 722 | ROM_END |
| 719 | 723 | |
| 720 | 724 | |
| 721 | 725 | ROM_START( madalina ) |
| 722 | | ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* 64k for 6502 code of main CPU */ |
| 723 | | ROM_LOAD( "2716.4c", 0xb000, 0x0800, CRC(90be68af) SHA1(472ccfd2e04d6d49be47d919cba0c55d850b2887) ) |
| 724 | | ROM_LOAD( "2716.4e", 0xb800, 0x0800, CRC(aba10cbb) SHA1(6ca213ded8ed7f4f310ab5ae25220cf867dd1d00) ) |
| 725 | | ROM_LOAD( "2716.3f", 0xc000, 0x0800, CRC(c3af484c) SHA1(c3667526d3b5aeee68823f92826053e657512851) ) |
| 726 | | ROM_LOAD( "2716.3j", 0xc800, 0x0800, CRC(78ca5a87) SHA1(729d69ee63c710241a098471e9769063dfe8ef1e) ) |
| 727 | | ROM_LOAD( "2716.3k", 0xd000, 0x0800, CRC(070e81ea) SHA1(006831f4bf289812e4e87a3ece7885e8b901f2f5) ) |
| 728 | | ROM_LOAD( "2716.3l", 0xd800, 0x0800, CRC(98225cb0) SHA1(ca74f5e33fa9116215b03abadd5d09840c04fb0b) ) |
| 729 | | ROM_LOAD( "2716.4f", 0xe000, 0x0800, CRC(52fea0fc) SHA1(443fd859daf4279d5976256a4b1c970b520661a2) ) |
| 730 | | ROM_LOAD( "2716.4j", 0xe800, 0x0800, CRC(dba6c4f6) SHA1(51f815fc7eb99a05eee6204de2d4cad1734adc52) ) |
| 731 | | ROM_LOAD( "2716.4k", 0xf000, 0x0800, CRC(06991af6) SHA1(19112306529721222b6e1c07920348c263d8b8aa) ) |
| 732 | | ROM_LOAD( "2716.4l", 0xf800, 0x0800, CRC(57752b47) SHA1(a34d3150ea9082889154042dbea3386f71322a78) ) |
| 726 | ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* main CPU */ |
| 727 | ROM_LOAD( "2716.4c", 0xb000, 0x0800, CRC(90be68af) SHA1(472ccfd2e04d6d49be47d919cba0c55d850b2887) ) |
| 728 | ROM_LOAD( "2716.4e", 0xb800, 0x0800, CRC(aba10cbb) SHA1(6ca213ded8ed7f4f310ab5ae25220cf867dd1d00) ) |
| 729 | ROM_LOAD( "2716.3f", 0xc000, 0x0800, CRC(c3af484c) SHA1(c3667526d3b5aeee68823f92826053e657512851) ) |
| 730 | ROM_LOAD( "2716.3h", 0xc800, 0x0800, CRC(78ca5a87) SHA1(729d69ee63c710241a098471e9769063dfe8ef1e) ) |
| 731 | ROM_LOAD( "2716.3k", 0xd000, 0x0800, CRC(070e81ea) SHA1(006831f4bf289812e4e87a3ece7885e8b901f2f5) ) |
| 732 | ROM_LOAD( "2716.3l", 0xd800, 0x0800, CRC(98225cb0) SHA1(ca74f5e33fa9116215b03abadd5d09840c04fb0b) ) |
| 733 | ROM_LOAD( "2716.4f", 0xe000, 0x0800, CRC(52fea0fc) SHA1(443fd859daf4279d5976256a4b1c970b520661a2) ) |
| 734 | ROM_LOAD( "2716.4h", 0xe800, 0x0800, CRC(dba6c4f6) SHA1(51f815fc7eb99a05eee6204de2d4cad1734adc52) ) |
| 735 | ROM_LOAD( "2716.4k", 0xf000, 0x0800, CRC(06991af6) SHA1(19112306529721222b6e1c07920348c263d8b8aa) ) |
| 736 | ROM_LOAD( "2716.4l", 0xf800, 0x0800, CRC(57752b47) SHA1(a34d3150ea9082889154042dbea3386f71322a78) ) |
| 733 | 737 | |
| 734 | | ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* 64k for 6502 code of audio CPU */ |
| 735 | | ROM_LOAD( "8_2708.4d", 0xf800, 0x0400, CRC(46162e7e) SHA1(7ed85f4a9ac58d6d9bafba0c843a16c269656563) ) |
| 736 | | ROM_LOAD( "9_2708.3d", 0xfc00, 0x0400, CRC(4175f5c4) SHA1(45cae8a1fcfd34b91c63cc7e544a32922da14f16) ) |
| 738 | ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* audio CPU */ |
| 739 | ROM_LOAD( "8_2708.4d", 0xf800, 0x0400, CRC(46162e7e) SHA1(7ed85f4a9ac58d6d9bafba0c843a16c269656563) ) |
| 740 | ROM_LOAD( "9_2708.3d", 0xfc00, 0x0400, CRC(4175f5c4) SHA1(45cae8a1fcfd34b91c63cc7e544a32922da14f16) ) |
| 737 | 741 | |
| 738 | | ROM_REGION( 0x1000, REGION_GFX1, ROMREGION_DISPOSE ) /* Background tiles */ |
| 739 | | ROM_LOAD( "mc-1_82s137.3k", 0x0000, 0x0400, NO_DUMP ) |
| 740 | | ROM_LOAD( "me-1_82s137.3l", 0x0400, 0x0400, CRC(7328a425) SHA1(327adc8b0e25d93f1ae98a44c26d0aaaac1b1a9c) ) |
| 741 | | ROM_LOAD( "md-1_82s137.3m", 0x0800, 0x0400, CRC(b5329929) SHA1(86890e1b7cc8cb31fc0dcbc2d3cff02e4cf95619) ) |
| 742 | ROM_REGION( 0x0c00, REGION_GFX1, ROMREGION_DISPOSE ) /* background tiles */ |
| 743 | ROM_LOAD( "mc-1.3k", 0x0000, 0x0400, NO_DUMP ) |
| 744 | ROM_LOAD( "me-1.3l", 0x0400, 0x0400, CRC(7328a425) SHA1(327adc8b0e25d93f1ae98a44c26d0aaaac1b1a9c) ) |
| 745 | ROM_LOAD( "md-1.3m", 0x0800, 0x0400, CRC(b5329929) SHA1(86890e1b7cc8cb31fc0dcbc2d3cff02e4cf95619) ) |
| 742 | 746 | |
| 743 | | ROM_REGION( 0x0400, REGION_GFX2, 0 ) /* Background tile maps */ |
| 744 | | ROM_LOAD( "mf-1_82s137.4h", 0x0000, 0x0400, CRC(9b04c446) SHA1(918013f3c0244ab6a670b9d1b6b642298e2c5ab8) ) |
| 747 | ROM_REGION( 0x0400, REGION_GFX2, 0 ) /* background tile map */ |
| 748 | ROM_LOAD( "mf-1.4h", 0x0000, 0x0400, CRC(9b04c446) SHA1(918013f3c0244ab6a670b9d1b6b642298e2c5ab8) ) |
| 745 | 749 | |
| 746 | | ROM_REGION( 0x0400, REGION_GFX3, 0 ) /* Car headlight */ |
| 747 | | ROM_LOAD( "ma-_2708.2b", 0x0000, 0x0400, CRC(aab16446) SHA1(d2342627cc2766004343f27515d8a7989d5fe932) ) |
| 750 | ROM_REGION( 0x0400, REGION_GFX3, ROMREGION_DISPOSE ) /* headlight */ |
| 751 | ROM_LOAD( "ma.2b", 0x0000, 0x0400, CRC(aab16446) SHA1(d2342627cc2766004343f27515d8a7989d5fe932) ) |
| 748 | 752 | |
| 749 | | ROM_REGION( 0x0800, REGION_GFX4, 0 ) /* Shifting data */ |
| 750 | | ROM_LOAD( "mb-_2716.5c", 0x0000, 0x0800, CRC(cb801e49) SHA1(7444c4af7cf07e5fdc54044d62ea4fcb201b2b8b) ) |
| 753 | ROM_REGION( 0x0800, REGION_USER1, 0 ) /* shifting table */ |
| 754 | ROM_LOAD( "mb.5c", 0x0000, 0x0800, CRC(cb801e49) SHA1(7444c4af7cf07e5fdc54044d62ea4fcb201b2b8b) ) |
| 751 | 755 | |
| 752 | | ROM_REGION( 0x0020, REGION_PROMS, 0 ) /* Color PROM */ |
| 753 | | ROM_LOAD( "mg-1_82s123.7e", 0x0000, 0x0020, CRC(e622396a) SHA1(8972704bd25fed462e25c453771cc5ca4fc74034) ) |
| 756 | ROM_REGION( 0x0020, REGION_PROMS, 0 ) /* color PROM */ |
| 757 | ROM_LOAD( "mg-1.7f", 0x0000, 0x0020, CRC(e622396a) SHA1(8972704bd25fed462e25c453771cc5ca4fc74034) ) |
| 754 | 758 | ROM_END |
| 755 | 759 | |
| 756 | 760 | |
| 757 | | DRIVER_INIT( madalien ) |
| 761 | static DRIVER_INIT( madalien ) |
| 758 | 762 | { |
| 759 | | madalien_shift_counter = 0; |
| 760 | | madalien_shift_reg_lo = 0; |
| 761 | | madalien_shift_reg_hi = 0; |
| 762 | | madalien_bg_map_selector = 0; |
| 763 | | madalien_scroll_light = 0; |
| 764 | | madalien_select_color_1 = 0; |
| 765 | | madalien_select_color_2 = 0; |
| 766 | | madalien_headlight_on = 0; |
| 767 | | madalien_swap_colors = 0; |
| 768 | | madalien_video_register = 0; |
| 769 | | madalien_flip_screen = 0; |
| 763 | state_save_register_global(madalien_video_flags); |
| 764 | state_save_register_global(madalien_screen_control); |
| 765 | state_save_register_global(madalien_scroll); |
| 766 | state_save_register_global(madalien_edge1_pos); |
| 767 | state_save_register_global(madalien_edge2_pos); |
| 768 | state_save_register_global(madalien_headlight_pos); |
| 769 | state_save_register_global(madalien_shift_count); |
| 770 | state_save_register_global(madalien_shift_data); |
| 770 | 771 | } |
| 771 | 772 | |
| 772 | 773 | |
| 773 | 774 | /* rom parent machine inp init */ |
| 774 | | GAME( 1980, madalien, 0, madalien, madalien, madalien, ROT270, "Data East Corporation", "Mad Alien", 0 ) |
| 775 | | GAME( 1980, madalina, madalien, madalien, madalien, madalien, ROT270, "Data East Corporation", "Mad Alien (Highway Chase)", 0 ) |
| 775 | GAME( 1980, madalien, 0, madalien, madalien, madalien, ROT270, "Data East Corporation", "Mad Alien", GAME_IMPERFECT_SOUND ) |
| 776 | GAME( 1980, madalina, madalien, madalien, madalien, madalien, ROT270, "Data East Corporation", "Mad Alien (Highway Chase)", GAME_IMPERFECT_SOUND ) |
src/mame/drivers/zr107.c
| r1215 | r1216 | |
| 1 | 1 | /* Konami ZR107 System |
| 2 | 2 | |
| 3 | 3 | Driver by Ville Linde |
| 4 | |
| 5 | |
| 6 | |
| 7 | Hardware overview: |
| 8 | |
| 9 | ZR107 CPU board: |
| 10 | ---------------- |
| 11 | IBM PowerPC 403GA at 32MHz (main CPU) |
| 12 | Motorola MC68EC000 at 16MHz (sound CPU) |
| 13 | Konami K056800 (MIRAC), sound system interface |
| 14 | Konami K056230 (LANC), LAN interface |
| 15 | Konami K058141 sound chip (same as 2x K054539) |
| 16 | |
| 17 | ZR107 GFX board: |
| 18 | ---------------- |
| 19 | Analog Devices ADSP-21062 SHARC DSP at 36MHz |
| 20 | Konami K056832 tilemap chip |
| 21 | KS10071 (custom 3D pixel unit) |
| 22 | KS10081 (custom 3D texel unit) |
| 23 | |
| 24 | GN678 GFX board (same as in gticlub.c): |
| 25 | ---------------- |
| 26 | Analog Devices ADSP-21062 SHARC DSP at 36MHz |
| 27 | Konami K001604 (2D tilemaps + 2x ROZ) |
| 28 | 2x KS10071 (custom 3D pixel unit) |
| 29 | 2x KS10081 (custom 3D texel unit) |
| 30 | |
| 31 | |
| 32 | Hardware configurations: |
| 33 | |
| 34 | Game | ID | CPU PCB | CG Board(s) |
| 35 | -------------------------------------------------------------------------- |
| 36 | Midnight Run | GX??? | ZR107 | ZR107 |
| 37 | Winding Heat | GX677 | ZR107 | ZR107 |
| 38 | Jetwave / Waveshark | GX678 | ZR107 | GN678 |
| 39 | |
| 4 | 40 | */ |
| 5 | 41 | |
| 6 | 42 | #include "driver.h" |
| r1215 | r1216 | |
| 15 | 51 | #include "video/gticlub.h" |
| 16 | 52 | |
| 17 | 53 | |
| 54 | static UINT8 led_reg0 = 0x7f, led_reg1 = 0x7f; |
| 18 | 55 | |
| 56 | |
| 19 | 57 | // defined in drivers/gticlub.c |
| 20 | 58 | extern READ32_HANDLER(lanc_r); |
| 21 | 59 | extern WRITE32_HANDLER(lanc_w); |
| r1215 | r1216 | |
| 23 | 61 | extern WRITE32_HANDLER(lanc_ram_w); |
| 24 | 62 | |
| 25 | 63 | |
| 64 | // defined in video/gticlub.c |
| 65 | VIDEO_START( gticlub ); |
| 66 | VIDEO_UPDATE( gticlub ); |
| 26 | 67 | |
| 27 | | static UINT8 led_reg0 = 0x7f, led_reg1 = 0x7f; |
| 28 | 68 | |
| 69 | // defined in drivers/nwk-tr.c |
| 70 | int K001604_vh_start(running_machine *machine, int chip); |
| 71 | void K001604_tile_update(running_machine *machine, int chip); |
| 72 | void K001604_draw_front_layer(int chip, mame_bitmap *bitmap, const rectangle *cliprect); |
| 73 | void K001604_draw_back_layer(int chip, mame_bitmap *bitmap, const rectangle *cliprect); |
| 74 | READ32_HANDLER(K001604_tile_r); |
| 75 | READ32_HANDLER(K001604_char_r); |
| 76 | WRITE32_HANDLER(K001604_tile_w); |
| 77 | WRITE32_HANDLER(K001604_char_w); |
| 78 | WRITE32_HANDLER(K001604_reg_w); |
| 79 | READ32_HANDLER(K001604_reg_r); |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | VIDEO_START( jetwave ) |
| 85 | { |
| 86 | K001005_init(); |
| 87 | K001604_vh_start(machine, 0); |
| 88 | } |
| 89 | |
| 90 | |
| 91 | VIDEO_UPDATE( jetwave ) |
| 92 | { |
| 93 | fillbitmap(bitmap, machine->remapped_colortable[0], cliprect); |
| 94 | |
| 95 | K001604_tile_update(machine, 0); |
| 96 | K001005_draw(bitmap, cliprect); |
| 97 | |
| 98 | K001604_draw_front_layer(0, bitmap, cliprect); |
| 99 | |
| 100 | draw_7segment_led(bitmap, 3, 3, led_reg0); |
| 101 | draw_7segment_led(bitmap, 9, 3, led_reg1); |
| 102 | |
| 103 | cpuintrf_push_context(2); |
| 104 | sharc_set_flag_input(1, ASSERT_LINE); |
| 105 | cpuintrf_pop_context(); |
| 106 | return 0; |
| 107 | } |
| 108 | |
| 109 | |
| 110 | /*****************************************************************************/ |
| 111 | |
| 29 | 112 | static WRITE32_HANDLER( paletteram32_w ) |
| 30 | 113 | { |
| 31 | 114 | COMBINE_DATA(&paletteram32[offset]); |
| r1215 | r1216 | |
| 244 | 327 | ADDRESS_MAP_END |
| 245 | 328 | |
| 246 | 329 | |
| 330 | static WRITE32_HANDLER( jetwave_palette_w ) |
| 331 | { |
| 332 | COMBINE_DATA(&paletteram32[offset]); |
| 333 | data = paletteram32[offset]; |
| 334 | palette_set_color_rgb(Machine, offset, pal5bit(data >> 10), pal5bit(data >> 5), pal5bit(data >> 0)); |
| 335 | } |
| 247 | 336 | |
| 337 | static ADDRESS_MAP_START( jetwave_map, ADDRESS_SPACE_PROGRAM, 32 ) |
| 338 | AM_RANGE(0x00000000, 0x000fffff) AM_MIRROR(0x80000000) AM_RAM /* Work RAM */ |
| 339 | AM_RANGE(0x74000000, 0x740000ff) AM_MIRROR(0x80000000) AM_READWRITE(K001604_reg_r, K001604_reg_w) |
| 340 | AM_RANGE(0x74010000, 0x7401ffff) AM_MIRROR(0x80000000) AM_READWRITE(paletteram32_r, jetwave_palette_w) AM_BASE(&paletteram32) |
| 341 | AM_RANGE(0x74020000, 0x7403ffff) AM_MIRROR(0x80000000) AM_READWRITE(K001604_tile_r, K001604_tile_w) |
| 342 | AM_RANGE(0x74040000, 0x7407ffff) AM_MIRROR(0x80000000) AM_READWRITE(K001604_char_r, K001604_char_w) |
| 343 | AM_RANGE(0x78000000, 0x7800ffff) AM_MIRROR(0x80000000) AM_READWRITE(cgboard_dsp_shared_r_ppc, cgboard_dsp_shared_w_ppc) /* 21N 21K 23N 23K */ |
| 344 | AM_RANGE(0x78010000, 0x7801ffff) AM_MIRROR(0x80000000) AM_WRITE(cgboard_dsp_shared_w_ppc) |
| 345 | AM_RANGE(0x78040000, 0x7804000f) AM_MIRROR(0x80000000) AM_READWRITE(K001006_0_r, K001006_0_w) |
| 346 | AM_RANGE(0x78080000, 0x7808000f) AM_MIRROR(0x80000000) AM_READWRITE(K001006_1_r, K001006_1_w) |
| 347 | AM_RANGE(0x780c0000, 0x780c0007) AM_MIRROR(0x80000000) AM_READWRITE(cgboard_dsp_comm_r_ppc, cgboard_dsp_comm_w_ppc) |
| 348 | AM_RANGE(0x7e000000, 0x7e003fff) AM_MIRROR(0x80000000) AM_READWRITE(sysreg_r, sysreg_w) |
| 349 | AM_RANGE(0x7e008000, 0x7e009fff) AM_MIRROR(0x80000000) AM_READWRITE(lanc_r, lanc_w) /* LANC registers */ |
| 350 | AM_RANGE(0x7e00a000, 0x7e00bfff) AM_MIRROR(0x80000000) AM_READWRITE(lanc_ram_r, lanc_ram_w) /* LANC Buffer RAM (27E) */ |
| 351 | AM_RANGE(0x7e00c000, 0x7e00c007) AM_MIRROR(0x80000000) AM_WRITE(K056800_host_w) |
| 352 | AM_RANGE(0x7e00c008, 0x7e00c00f) AM_MIRROR(0x80000000) AM_READ(K056800_host_r) |
| 353 | AM_RANGE(0x7f000000, 0x7f3fffff) AM_MIRROR(0x80000000) AM_ROM AM_REGION(REGION_USER2, 0) |
| 354 | AM_RANGE(0x7f800000, 0x7f9fffff) AM_MIRROR(0x80000000) AM_ROM AM_SHARE(2) |
| 355 | AM_RANGE(0x7fe00000, 0x7fffffff) AM_MIRROR(0x80000000) AM_ROM AM_REGION(REGION_USER1, 0) AM_SHARE(2) /* Program ROM */ |
| 356 | ADDRESS_MAP_END |
| 357 | |
| 358 | |
| 359 | |
| 248 | 360 | /**********************************************************************/ |
| 249 | 361 | |
| 250 | 362 | static READ16_HANDLER( dual539_r ) |
| r1215 | r1216 | |
| 391 | 503 | |
| 392 | 504 | INPUT_PORTS_END |
| 393 | 505 | |
| 506 | INPUT_PORTS_START( jetwave ) |
| 507 | PORT_START |
| 508 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 509 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) |
| 510 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) |
| 511 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) |
| 512 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Service Button") PORT_CODE(KEYCODE_8) |
| 513 | PORT_BIT( 0x0b, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 514 | |
| 515 | PORT_START |
| 516 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 517 | |
| 518 | PORT_START |
| 519 | PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNKNOWN ) |
| 520 | |
| 521 | PORT_START |
| 522 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME( DEF_STR( Service_Mode )) PORT_CODE(KEYCODE_F2) |
| 523 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Service Button") PORT_CODE(KEYCODE_8) |
| 524 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 525 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 ) |
| 526 | PORT_DIPNAME( 0x08, 0x00, "DIP 1" ) |
| 527 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 528 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 529 | PORT_DIPNAME( 0x04, 0x04, "DIP 2" ) |
| 530 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 531 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 532 | PORT_DIPNAME( 0x02, 0x02, "DIP 3" ) |
| 533 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 534 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 535 | PORT_DIPNAME( 0x01, 0x00, "DIP 4" ) |
| 536 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 537 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 538 | |
| 539 | PORT_START_TAG("ANALOG1") // Steering wheel |
| 540 | PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(35) PORT_KEYDELTA(5) PORT_REVERSE |
| 541 | |
| 542 | PORT_START_TAG("ANALOG2") // Acceleration pedal |
| 543 | PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(35) PORT_KEYDELTA(5) |
| 544 | |
| 545 | PORT_START_TAG("ANALOG3") // Brake pedal |
| 546 | PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(35) PORT_KEYDELTA(5) |
| 547 | |
| 548 | INPUT_PORTS_END |
| 549 | |
| 394 | 550 | static ppc_config zr107_ppc_cfg = |
| 395 | 551 | { |
| 396 | 552 | PPC_MODEL_403GA |
| r1215 | r1216 | |
| 461 | 617 | MDRV_SOUND_ROUTE(1, "right", 0.75) |
| 462 | 618 | MACHINE_DRIVER_END |
| 463 | 619 | |
| 620 | static MACHINE_DRIVER_START( jetwave ) |
| 621 | |
| 622 | /* basic machine hardware */ |
| 623 | MDRV_CPU_ADD(PPC403, 64000000/2) /* PowerPC 403GA 32MHz */ |
| 624 | MDRV_CPU_CONFIG(zr107_ppc_cfg) |
| 625 | MDRV_CPU_PROGRAM_MAP(jetwave_map, 0) |
| 626 | MDRV_CPU_VBLANK_INT(zr107_vblank, 1) |
| 627 | |
| 628 | MDRV_CPU_ADD(M68000, 64000000/8) /* 8MHz */ |
| 629 | MDRV_CPU_PROGRAM_MAP(sound_memmap, 0) |
| 630 | |
| 631 | MDRV_CPU_ADD(ADSP21062, 36000000) |
| 632 | MDRV_CPU_CONFIG(sharc_cfg) |
| 633 | MDRV_CPU_DATA_MAP(sharc_map, 0) |
| 634 | |
| 635 | MDRV_SCREEN_REFRESH_RATE(60) |
| 636 | MDRV_INTERLEAVE(500) |
| 637 | |
| 638 | MDRV_NVRAM_HANDLER(93C46) |
| 639 | MDRV_MACHINE_RESET(zr107) |
| 640 | |
| 641 | /* video hardware */ |
| 642 | MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) |
| 643 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) |
| 644 | MDRV_SCREEN_SIZE(64*8, 48*8) |
| 645 | MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0*8, 48*8-1) |
| 646 | MDRV_PALETTE_LENGTH(65536) |
| 647 | |
| 648 | MDRV_VIDEO_START(jetwave) |
| 649 | MDRV_VIDEO_UPDATE(jetwave) |
| 650 | |
| 651 | MDRV_SPEAKER_STANDARD_STEREO("left", "right") |
| 652 | |
| 653 | MDRV_SOUND_ADD(K054539, 48000) |
| 654 | MDRV_SOUND_CONFIG(k054539_interface) |
| 655 | MDRV_SOUND_ROUTE(0, "left", 0.75) |
| 656 | MDRV_SOUND_ROUTE(1, "right", 0.75) |
| 657 | |
| 658 | MDRV_SOUND_ADD(K054539, 48000) |
| 659 | MDRV_SOUND_CONFIG(k054539_interface) |
| 660 | MDRV_SOUND_ROUTE(0, "left", 0.75) |
| 661 | MDRV_SOUND_ROUTE(1, "right", 0.75) |
| 662 | MACHINE_DRIVER_END |
| 663 | |
| 464 | 664 | /*****************************************************************************/ |
| 465 | 665 | |
| 466 | 666 | static void sound_irq_callback(int irq) |
| r1215 | r1216 | |
| 487 | 687 | adc083x_init(0, ADC0838, adc0838_callback); |
| 488 | 688 | } |
| 489 | 689 | |
| 690 | static DRIVER_INIT(jetwave) |
| 691 | { |
| 692 | init_konami_cgboard(1, CGBOARD_TYPE_GTICLUB); |
| 693 | sharc_dataram = auto_malloc(0x100000); |
| 694 | |
| 695 | K001005_preprocess_texture_data(memory_region(REGION_GFX1), memory_region_length(REGION_GFX1), 0); |
| 696 | |
| 697 | K056800_init(sound_irq_callback); |
| 698 | |
| 699 | adc083x_init(0, ADC0838, adc0838_callback); |
| 700 | } |
| 701 | |
| 490 | 702 | /*****************************************************************************/ |
| 491 | 703 | |
| 704 | #define ROM_LOAD64_WORD(name,offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_SKIP(6)) |
| 705 | |
| 492 | 706 | ROM_START(midnrun) |
| 493 | 707 | ROM_REGION(0x200000, REGION_USER1, 0) /* PowerPC program roms */ |
| 494 | 708 | ROM_LOAD32_BYTE("midnight.20u", 0x000003, 0x80000, CRC(ea70edf2) SHA1(51c882383a150ba118ccd39eb869525fcf5eee3c)) |
| r1215 | r1216 | |
| 541 | 755 | ROM_LOAD( "677a08.5r", 0x400000, 0x200000, CRC(bde38850) SHA1(aaf1bdfc25ecdffc1f6076c9c1b2edbe263171d2) ) |
| 542 | 756 | ROM_END |
| 543 | 757 | |
| 758 | ROM_START(jetwave) |
| 759 | ROM_REGION(0x200000, REGION_USER1, 0) /* PowerPC program roms */ |
| 760 | ROM_LOAD32_BYTE( "678uab01.20u", 0x000003, 0x080000, CRC(a9b9ceed) SHA1(36f0d18481d7c3e7358e02473e54bc6b52d5c26b) ) |
| 761 | ROM_LOAD32_BYTE( "678uab02.17u", 0x000002, 0x080000, CRC(5ed24ac8) SHA1(d659c751558d4f8d89314466a37c04ac2df46879) ) |
| 762 | ROM_LOAD32_BYTE( "678uab03.15u", 0x000001, 0x080000, CRC(f4a595e7) SHA1(e05e7ea6613ecf70d8470af5fe0c6a7274c6e45b) ) |
| 763 | ROM_LOAD32_BYTE( "678uab04.13u", 0x000000, 0x080000, CRC(fd3320a7) SHA1(03a50a7bba9eb7cdb9f84953d6fb5c09f2d4b2db) ) |
| 764 | |
| 765 | ROM_REGION(0x20000, REGION_CPU2, 0) /* M68K program */ |
| 766 | ROM_LOAD16_WORD_SWAP( "678a07.19l", 0x000000, 0x020000, CRC(bb3f5875) SHA1(97f80d9b55d4177217b7cd1ba14e8ed2d64376bb) ) |
| 767 | |
| 768 | ROM_REGION32_BE(0x400000, REGION_USER2, 0) /* data roms */ |
| 769 | ROM_LOAD32_WORD_SWAP( "685a05.10u", 0x000000, 0x200000, CRC(00e59741) SHA1(d799910d4e85482b0e92a3cc9043f81d97b2fb02) ) |
| 770 | ROM_LOAD32_WORD_SWAP( "685a06.8u", 0x000002, 0x200000, CRC(fc98c6a5) SHA1(a84583bb7296fa9e0c284b2ac59e2dc7b2689eee) ) |
| 771 | |
| 772 | ROM_REGION(0x800000, REGION_GFX1, 0) /* Texture data */ |
| 773 | ROM_LOAD64_WORD( "678a13.18d", 0x000000, 0x200000, CRC(ccf75722) SHA1(f48d21dfc4f82adbb4c9c841a809267cfd028a3d) ) |
| 774 | ROM_LOAD64_WORD( "678a14.13d", 0x000002, 0x200000, CRC(333a1ab4) SHA1(79df4a98b7871eba4157307a7709da8f8b5da39b) ) |
| 775 | ROM_LOAD64_WORD( "678a15.9d", 0x000004, 0x200000, CRC(58b670f8) SHA1(5d4facb00e34de3ad11ed60c19835918a9cf6cb9) ) |
| 776 | ROM_LOAD64_WORD( "678a16.4d", 0x000006, 0x200000, CRC(137b9bff) SHA1(5052c1fa30cc1d6affd78f48d483415dca89d10b) ) |
| 777 | |
| 778 | ROM_REGION(0x600000, REGION_SOUND1, 0) /* Sound data */ |
| 779 | ROM_LOAD( "678a09.3r", 0x000000, 0x200000, CRC(39baef23) SHA1(9f7bda0f9c06eee94703f9ceb06975c8e28338cc) ) |
| 780 | ROM_LOAD( "678a10.5n", 0x200000, 0x200000, CRC(0508280e) SHA1(a36c5dc377b0ba597f131bd9dfc6019e7fc2d243) ) |
| 781 | ROM_LOAD( "678a08.5r", 0x400000, 0x200000, CRC(4aeb61ad) SHA1(ec6872cb2e4776849963f48c1c245ca7697849e0) ) |
| 782 | ROM_END |
| 783 | |
| 544 | 784 | /*****************************************************************************/ |
| 545 | 785 | |
| 546 | 786 | GAME( 1995, midnrun, 0, zr107, midnrun, zr107, ROT0, "Konami", "Midnight Run", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND ) |
| 547 | 787 | GAME( 1996, windheat, 0, zr107, windheat, zr107, ROT0, "Konami", "Winding Heat", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND ) |
| 788 | GAME( 1996, jetwave, 0, jetwave, jetwave, jetwave, ROT0, "Konami", "Jet Wave", GAME_IMPERFECT_GRAPHICS|GAME_IMPERFECT_SOUND|GAME_NOT_WORKING ) |
src/mame/drivers/ksys573.c
| r1215 | r1216 | |
| 209 | 209 | #include "cpu/mips/psx.h" |
| 210 | 210 | #include "includes/psx.h" |
| 211 | 211 | #include "machine/intelfsh.h" |
| 212 | | #include "machine/scsidev.h" |
| 212 | #include "machine/cr589.h" |
| 213 | 213 | #include "machine/timekpr.h" |
| 214 | 214 | #include "machine/adc083x.h" |
| 215 | 215 | #include "machine/ds2401.h" |
| r1215 | r1216 | |
| 451 | 451 | |
| 452 | 452 | static UINT8 *atapi_regs; |
| 453 | 453 | static mame_timer *atapi_timer; |
| 454 | | static pSCSIDispatch cdrom_drive; |
| 455 | | static void *inserted_cdrom; |
| 456 | | static void *available_cdroms[ 2 ]; |
| 457 | | static UINT16 *atapi_data; |
| 454 | static SCSIInstance *inserted_cdrom; |
| 455 | static SCSIInstance *available_cdroms[ 2 ]; |
| 456 | static UINT8 *atapi_data; |
| 458 | 457 | static int atapi_data_ptr, atapi_data_len, atapi_xferlen, atapi_xferbase, atapi_cdata_wait, atapi_xfermod; |
| 459 | 458 | |
| 460 | 459 | #define MAX_TRANSFER_SIZE ( 63488 ) |
| r1215 | r1216 | |
| 473 | 472 | while (atapi_xferlen > 0 ) |
| 474 | 473 | { |
| 475 | 474 | // get a sector from the SCSI device |
| 476 | | cdrom_drive(SCSIOP_READ_DATA, inserted_cdrom, 2048, sector_buffer); |
| 475 | SCSIReadData( inserted_cdrom, sector_buffer, 2048 ); |
| 477 | 476 | |
| 478 | 477 | atapi_xferlen -= 2048; |
| 479 | 478 | |
| r1215 | r1216 | |
| 526 | 525 | static READ32_HANDLER( atapi_r ) |
| 527 | 526 | { |
| 528 | 527 | int reg, data; |
| 529 | | int i; |
| 530 | | UINT8 sector_buffer[ 4096 ]; |
| 531 | 528 | |
| 532 | 529 | if (mem_mask == 0xffff0000) // word-wide command read |
| 533 | 530 | { |
| r1215 | r1216 | |
| 536 | 533 | // assert IRQ and drop DRQ |
| 537 | 534 | if (atapi_data_ptr == 0 && atapi_data_len == 0) |
| 538 | 535 | { |
| 539 | | while( atapi_xferlen > 0 ) |
| 536 | // get the data from the device |
| 537 | if( atapi_xferlen > 0 ) |
| 540 | 538 | { |
| 541 | | int transfer = atapi_xferlen; |
| 542 | | if( transfer > 2048 ) |
| 543 | | { |
| 544 | | transfer = 2048; |
| 545 | | } |
| 546 | | |
| 547 | | // get the data from the device |
| 548 | | cdrom_drive(SCSIOP_READ_DATA, inserted_cdrom, transfer, sector_buffer); |
| 549 | | |
| 550 | | // fix it up in an endian-safe way |
| 551 | | for (i = 0; i < transfer; i += 2) |
| 552 | | { |
| 553 | | atapi_data[ atapi_data_len++ ] = sector_buffer[i] | sector_buffer[i+1]<<8; |
| 554 | | } |
| 555 | | |
| 556 | | atapi_xferlen -= transfer; |
| 539 | SCSIReadData( inserted_cdrom, atapi_data, atapi_xferlen ); |
| 540 | atapi_data_len = atapi_xferlen; |
| 557 | 541 | } |
| 558 | 542 | |
| 559 | 543 | if (atapi_xfermod > MAX_TRANSFER_SIZE) |
| r1215 | r1216 | |
| 589 | 573 | if( atapi_data_ptr < atapi_data_len ) |
| 590 | 574 | { |
| 591 | 575 | data = atapi_data[atapi_data_ptr++]; |
| 576 | data |= ( atapi_data[atapi_data_ptr++] << 8 ); |
| 592 | 577 | if( atapi_data_ptr >= atapi_data_len ) |
| 593 | 578 | { |
| 594 | 579 | // verboselog( 2, "atapi_r: read all bytes\n" ); |
| r1215 | r1216 | |
| 661 | 646 | static WRITE32_HANDLER( atapi_w ) |
| 662 | 647 | { |
| 663 | 648 | int reg; |
| 664 | | int i; |
| 665 | | UINT8 atapi_scsi_packet[ 32*1024 ]; |
| 666 | 649 | |
| 667 | 650 | verboselog( 2, "atapi_w( %08x, %08x, %08x )\n", offset, mem_mask, data ); |
| 668 | 651 | |
| r1215 | r1216 | |
| 671 | 654 | verboselog( 2, "atapi_w: data=%04x\n", data ); |
| 672 | 655 | |
| 673 | 656 | // mame_printf_debug("ATAPI: packet write %04x\n", data); |
| 674 | | atapi_data[atapi_data_ptr++] = data; |
| 657 | atapi_data[atapi_data_ptr++] = data & 0xff; |
| 658 | atapi_data[atapi_data_ptr++] = data >> 8; |
| 675 | 659 | |
| 676 | 660 | if (atapi_cdata_wait) |
| 677 | 661 | { |
| 678 | 662 | // mame_printf_debug("ATAPI: waiting, ptr %d wait %d\n", atapi_data_ptr, atapi_cdata_wait); |
| 679 | 663 | if (atapi_data_ptr == atapi_cdata_wait) |
| 680 | 664 | { |
| 681 | | // decompose SCSI packet into proper byte order |
| 682 | | for (i = 0; i < atapi_cdata_wait; i += 2) |
| 683 | | { |
| 684 | | atapi_scsi_packet[i] = atapi_data[i/2]&0xff; |
| 685 | | atapi_scsi_packet[i+1] = atapi_data[i/2]>>8; |
| 686 | | } |
| 687 | | |
| 688 | 665 | // send it to the device |
| 689 | | cdrom_drive(SCSIOP_WRITE_DATA, inserted_cdrom, atapi_cdata_wait, atapi_scsi_packet); |
| 666 | SCSIWriteData( inserted_cdrom, atapi_data, atapi_cdata_wait ); |
| 690 | 667 | |
| 691 | 668 | // assert IRQ |
| 692 | 669 | psx_irq_set(0x400); |
| r1215 | r1216 | |
| 696 | 673 | } |
| 697 | 674 | } |
| 698 | 675 | |
| 699 | | if ((!atapi_cdata_wait) && (atapi_data_ptr == 6)) |
| 676 | else if ( atapi_data_ptr == 12 ) |
| 700 | 677 | { |
| 678 | int phase; |
| 679 | |
| 701 | 680 | verboselog( 2, "atapi_w: command %02x\n", atapi_data[0]&0xff ); |
| 702 | 681 | |
| 703 | 682 | // reset data pointer for reading SCSI results |
| 704 | 683 | atapi_data_ptr = 0; |
| 705 | 684 | atapi_data_len = 0; |
| 706 | 685 | |
| 707 | | // decompose SCSI packet into proper byte order |
| 708 | | for (i = 0; i < 16; i += 2) |
| 709 | | { |
| 710 | | atapi_scsi_packet[i] = atapi_data[i/2]&0xff; |
| 711 | | atapi_scsi_packet[i+1] = atapi_data[i/2]>>8; |
| 712 | | } |
| 713 | | |
| 714 | 686 | // send it to the SCSI device |
| 715 | | atapi_xferlen = cdrom_drive(SCSIOP_EXEC_COMMAND, inserted_cdrom, 0, atapi_scsi_packet); |
| 687 | SCSISetCommand( inserted_cdrom, atapi_data, 12 ); |
| 688 | SCSIExecCommand( inserted_cdrom, &atapi_xferlen ); |
| 689 | SCSIGetPhase( inserted_cdrom, &phase ); |
| 716 | 690 | |
| 717 | 691 | if (atapi_xferlen != -1) |
| 718 | 692 | { |
| r1215 | r1216 | |
| 743 | 717 | atapi_regs[ATAPI_REG_INTREASON] = ATAPI_INTREASON_IO; |
| 744 | 718 | } |
| 745 | 719 | |
| 720 | switch( phase ) |
| 721 | { |
| 722 | case SCSI_PHASE_DATAOUT: |
| 723 | atapi_cdata_wait = atapi_xferlen; |
| 724 | break; |
| 725 | } |
| 726 | |
| 746 | 727 | // perform special ATAPI processing of certain commands |
| 747 | 728 | switch (atapi_data[0]&0xff) |
| 748 | 729 | { |
| 749 | | case 0x55: // MODE SELECT |
| 750 | | atapi_cdata_wait = atapi_data[4]/2; |
| 751 | | break; |
| 752 | | |
| 753 | | case 0x00: // BUS RESET / TEST UNIT READY |
| 730 | case 0x00: // BUS RESET / TEST UNIT READY |
| 731 | case 0xbb: // SET CDROM SPEED |
| 754 | 732 | atapi_regs[ATAPI_REG_CMDSTATUS] = 0; |
| 755 | 733 | break; |
| 756 | 734 | |
| r1215 | r1216 | |
| 758 | 736 | atapi_regs[ATAPI_REG_CMDSTATUS] = ATAPI_STAT_BSY; |
| 759 | 737 | mame_timer_adjust( atapi_timer, MAME_TIME_IN_CYCLES( ATAPI_CYCLES_PER_SECTOR, 0 ), 0, time_zero ); |
| 760 | 738 | break; |
| 761 | | |
| 762 | | case 0xbb: // SET CDROM SPEED |
| 763 | | atapi_regs[ATAPI_REG_CMDSTATUS] = 0; |
| 764 | | break; |
| 765 | 739 | } |
| 766 | 740 | |
| 767 | 741 | // assert IRQ |
| r1215 | r1216 | |
| 850 | 824 | |
| 851 | 825 | memset( atapi_data, 0, atapi_data_len ); |
| 852 | 826 | |
| 853 | | atapi_data[0] = 0x8500; // ATAPI device, cmd set 5 compliant, DRQ within 3 ms of PACKET command |
| 854 | | atapi_data[49] = 0x0400; // IORDY may be disabled |
| 827 | atapi_data[ 0 ^ 1 ] = 0x85; // ATAPI device, cmd set 5 compliant, DRQ within 3 ms of PACKET command |
| 828 | atapi_data[ 1 ^ 1 ] = 0x00; |
| 855 | 829 | |
| 830 | memset( &atapi_data[ 46 ], ' ', 8 ); |
| 831 | atapi_data[ 46 ^ 1 ] = '1'; |
| 832 | atapi_data[ 47 ^ 1 ] = '.'; |
| 833 | atapi_data[ 48 ^ 1 ] = '0'; |
| 834 | |
| 835 | memset( &atapi_data[ 54 ], ' ', 40 ); |
| 836 | atapi_data[ 54 ^ 1 ] = 'M'; |
| 837 | atapi_data[ 55 ^ 1 ] = 'A'; |
| 838 | atapi_data[ 56 ^ 1 ] = 'T'; |
| 839 | atapi_data[ 57 ^ 1 ] = 'S'; |
| 840 | atapi_data[ 58 ^ 1 ] = 'H'; |
| 841 | atapi_data[ 59 ^ 1 ] = 'I'; |
| 842 | atapi_data[ 60 ^ 1 ] = 'T'; |
| 843 | atapi_data[ 61 ^ 1 ] = 'A'; |
| 844 | atapi_data[ 62 ^ 1 ] = ' '; |
| 845 | atapi_data[ 63 ^ 1 ] = 'C'; |
| 846 | atapi_data[ 64 ^ 1 ] = 'R'; |
| 847 | atapi_data[ 65 ^ 1 ] = '-'; |
| 848 | atapi_data[ 66 ^ 1 ] = '5'; |
| 849 | atapi_data[ 67 ^ 1 ] = '8'; |
| 850 | atapi_data[ 68 ^ 1 ] = '9'; |
| 851 | atapi_data[ 69 ^ 1 ] = ' '; |
| 852 | |
| 853 | atapi_data[ 98 ^ 1 ] = 0x04; // IORDY may be disabled |
| 854 | atapi_data[ 99 ^ 1 ] = 0x00; |
| 855 | |
| 856 | 856 | atapi_regs[ATAPI_REG_COUNTLOW] = 0; |
| 857 | 857 | atapi_regs[ATAPI_REG_COUNTHIGH] = 2; |
| 858 | 858 | |
| r1215 | r1216 | |
| 895 | 895 | atapi_timer = mame_timer_alloc( atapi_xfer_end ); |
| 896 | 896 | mame_timer_adjust(atapi_timer, time_never, 0, time_never); |
| 897 | 897 | |
| 898 | | // allocate a SCSI CD-ROM device |
| 899 | | cdrom_drive = SCSI_DEVICE_CDROM; |
| 900 | | |
| 901 | 898 | for( i = 0; i < 2; i++ ) |
| 902 | 899 | { |
| 903 | 900 | if( get_disk_handle( i ) != NULL ) |
| 904 | 901 | { |
| 905 | | cdrom_drive(SCSIOP_ALLOC_INSTANCE, &available_cdroms[ i ], i, (UINT8 *)NULL); |
| 902 | SCSIAllocInstance( &SCSIClassCr589, &available_cdroms[ i ], i ); |
| 906 | 903 | } |
| 907 | 904 | else |
| 908 | 905 | { |
| r1215 | r1216 | |
| 1392 | 1389 | static void *atapi_get_device(void) |
| 1393 | 1390 | { |
| 1394 | 1391 | void *ret; |
| 1395 | | cdrom_drive(SCSIOP_GET_DEVICE, inserted_cdrom, 0, (UINT8 *)&ret); |
| 1392 | SCSIGetDevice( inserted_cdrom, &ret ); |
| 1396 | 1393 | return ret; |
| 1397 | 1394 | } |
| 1398 | 1395 | |
| r1215 | r1216 | |
| 1529 | 1526 | static void update_mode( void ) |
| 1530 | 1527 | { |
| 1531 | 1528 | int mode = readinputportbytag( "MODE" ); |
| 1532 | | static void *new_cdrom; |
| 1529 | static SCSIInstance *new_cdrom; |
| 1533 | 1530 | |
| 1534 | 1531 | if( chiptype[ 1 ] != 0 ) |
| 1535 | 1532 | { |
| r1215 | r1216 | |
| 3018 | 3015 | DISK_IMAGE_READONLY( "765jaa02", 0, MD5(11693b1234458c238ed613ef37f71245) SHA1(d820f8166b7d5ffcf41e7a70c8c4c4d1c207c1bd) ) |
| 3019 | 3016 | ROM_END |
| 3020 | 3017 | |
| 3018 | ROM_START( cr589fw ) |
| 3019 | ROM_REGION32_LE( 0x080000, REGION_USER1, 0 ) |
| 3020 | SYS573_BIOS_A |
| 3021 | |
| 3022 | ROM_REGION( 0x1000000, REGION_USER3, 0 ) /* onboard flash */ |
| 3023 | ROM_FILL( 0x0000000, 0x1000000, 0xff ) |
| 3024 | |
| 3025 | DISK_REGION( REGION_DISKS ) |
| 3026 | DISK_IMAGE_READONLY( "700b04", 0, MD5(4847e008189b7c700f2129ecb362b924) SHA1(13ac92eb242de48317924b9c725f9f693a263cf5) ) |
| 3027 | ROM_END |
| 3028 | |
| 3029 | ROM_START( cr589fwa ) |
| 3030 | ROM_REGION32_LE( 0x080000, REGION_USER1, 0 ) |
| 3031 | SYS573_BIOS_A |
| 3032 | |
| 3033 | ROM_REGION( 0x1000000, REGION_USER3, 0 ) /* onboard flash */ |
| 3034 | ROM_FILL( 0x0000000, 0x1000000, 0xff ) |
| 3035 | |
| 3036 | DISK_REGION( REGION_DISKS ) |
| 3037 | DISK_IMAGE_READONLY( "700a04", 0, MD5(211850ed73d05ccbf5951f1fe19a6767) SHA1(bf7865629775a34a8f8b628053e97f25b51ade2e) ) |
| 3038 | ROM_END |
| 3039 | |
| 3021 | 3040 | ROM_START( darkhleg ) |
| 3022 | 3041 | ROM_REGION32_LE( 0x080000, REGION_USER1, 0 ) |
| 3023 | 3042 | SYS573_BIOS_A |
| r1215 | r1216 | |
| 4162 | 4181 | DISK_IMAGE_READONLY( "b06jaa02", 0, MD5(8191da2660bb645fcfee9fb60baef242) SHA1(e8be8bdc0cbfb95a0a56ab89f39de3089d31f305) ) |
| 4163 | 4182 | ROM_END |
| 4164 | 4183 | |
| 4184 | ROM_START( gtrfrk7m ) |
| 4185 | ROM_REGION32_LE( 0x080000, REGION_USER1, 0 ) |
| 4186 | SYS573_BIOS_A |
| 4187 | |
| 4188 | ROM_REGION( 0x0001014, REGION_USER2, 0 ) /* install security cart eeprom */ |
| 4189 | ROM_LOAD( "gcb17jaa.u1", 0x000000, 0x001014, BAD_DUMP CRC(5a338c31) SHA1(0fd9ee306335858dd6bef680a62557a8bf055cc3) ) |
| 4190 | |
| 4191 | ROM_REGION( 0x1000000, REGION_USER3, 0 ) /* onboard flash */ |
| 4192 | ROM_LOAD( "gcb17jaa.31m", 0x000000, 0x200000, CRC(1e1cbfe3) SHA1(6c942820f915ea0e01f0e736d70780ad8408aa69) ) |
| 4193 | ROM_LOAD( "gcb17jaa.27m", 0x200000, 0x200000, CRC(7e7da9a9) SHA1(1882418779a48b5aefd113895756116379a6a4f7) ) |
| 4194 | ROM_FILL( 0x400000, 0x0c00000, 0xff ) |
| 4195 | |
| 4196 | ROM_REGION( 0x2000000, REGION_USER4, 0 ) /* PCCARD1 */ |
| 4197 | ROM_FILL( 0x0000000, 0x2000000, 0xff ) |
| 4198 | |
| 4199 | ROM_REGION( 0x000008, REGION_USER9, 0 ) /* install security cart id */ |
| 4200 | ROM_LOAD( "gcb17jaa.u6", 0x000000, 0x000008, BAD_DUMP CRC(ce84419e) SHA1(839e8ee080ecfc79021a06417d930e8b32dfc6a1) ) |
| 4201 | |
| 4202 | DISK_REGION( REGION_DISKS ) |
| 4203 | DISK_IMAGE_READONLY( "b17jaa02", 0, MD5(65b47fbf7d682e8dc8b2a3137aaab9b7) SHA1(bf8eb8f857c08595bb1c19f470ac689400ee0cab) ) |
| 4204 | ROM_END |
| 4205 | |
| 4165 | 4206 | ROM_START( gtfrk11m ) |
| 4166 | 4207 | ROM_REGION32_LE( 0x080000, REGION_USER1, 0 ) |
| 4167 | 4208 | SYS573_BIOS_A |
| r1215 | r1216 | |
| 4341 | 4382 | GAME( 1999, ddr2mc2, ddr2m, konami573, ddr, ddr, ROT0, "Konami", "Dance Dance Revolution 2nd Mix with beatmaniaIIDX substream CLUB VERSiON 2 (GE984 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 4342 | 4383 | GAME( 1999, gtrfrk2m, sys573, konami573, gtrfrks, gtrfrks, ROT0, "Konami", "Guitar Freaks 2nd Mix Ver 1.01 (GQ883 VER. JAD)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 4343 | 4384 | GAME( 1999, dsftkd, sys573, konami573, ddr, ddr, ROT0, "Konami", "Dancing Stage featuring TRUE KiSS DESTiNATiON (G*884 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 4385 | GAME( 1999, cr589fw, sys573, konami573, konami573, konami573, ROT0, "Konami", "CD-ROM Drive Updater 2.0 (700B04)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 4386 | GAME( 1999, cr589fwa, sys573, konami573, konami573, konami573, ROT0, "Konami", "CD-ROM Drive Updater (700A04)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) |
| 4344 | 4387 | GAME( 2000, ddr3mk, sys573, konami573, ddr, ddrdigital, ROT0, "Konami", "Dance Dance Revolution 3rd Mix - Ver.Korea2 (GN887 VER. KBA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.3 */ |
| 4345 | 4388 | GAME( 2000, ddr3mka, ddr3mk, konami573, ddr, ddrdigital, ROT0, "Konami", "Dance Dance Revolution 3rd Mix - Ver.Korea (GN887 VER. KAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.3 */ |
| 4346 | 4389 | GAME( 1999, ddr3ma, ddr3mk, konami573, ddr, ddrdigital, ROT0, "Konami", "Dance Dance Revolution 3rd Mix (GN887 VER. AAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.1 */ |
| r1215 | r1216 | |
| 4372 | 4415 | GAME( 2001, ddr5m, sys573, konami573, ddr, ddrdigital, ROT0, "Konami", "Dance Dance Revolution 5th Mix (G*A27 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */ |
| 4373 | 4416 | GAME( 2001, dmx2majp, sys573, konami573, dmx, dmx, ROT0, "Konami", "Dance Maniax 2nd Mix Append J-Paradise (G*A38 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */ |
| 4374 | 4417 | GAME( 2001, gtrfrk6m, sys573, konami573, gtrfrks, gtrfrkdigital,ROT0, "Konami", "Guitar Freaks 6th Mix (G*B06 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */ |
| 4418 | GAME( 2001, gtrfrk7m, sys573, konami573, gtrfrks, gtrfrkdigital,ROT0, "Konami", "Guitar Freaks 7th Mix (G*B17 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.95 */ |
| 4375 | 4419 | GAME( 2001, ddrmax, sys573, konami573, ddr, ddrdigital, ROT0, "Konami", "DDR Max - Dance Dance Revolution 6th Mix (G*B19 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */ |
| 4376 | 4420 | GAME( 2002, ddrmax2, sys573, konami573, ddr, ddrdigital, ROT0, "Konami", "DDR Max 2 - Dance Dance Revolution 7th Mix (G*B20 VER. JAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.9 */ |
| 4377 | 4421 | GAME( 2002, dsem2, sys573, konami573, ddr, ddrdigital, ROT0, "Konami", "Dancing Stage Euro Mix 2 (G*C23 VER. EAA)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_NOT_WORKING ) /* BOOT VER 1.95 */ |
src/emu/video/rgbsse.h
| r0 | r1216 | |
| 1 | /*************************************************************************** |
| 2 | |
| 3 | rgbgen.h |
| 4 | |
| 5 | SSE optimized RGB utilities. |
| 6 | |
| 7 | WARNING: This code assumes SSE2 or greater capability. |
| 8 | |
| 9 | Copyright (c) 1996-2007, Nicola Salmoria and the MAME Team. |
| 10 | Visit http://mamedev.org for licensing and usage restrictions. |
| 11 | |
| 12 | ***************************************************************************/ |
| 13 | |
| 14 | #ifndef __RGBSSE__ |
| 15 | #define __RGBSSE__ |
| 16 | |
| 17 | #include <xmmintrin.h> |
| 18 | |
| 19 | |
| 20 | /*************************************************************************** |
| 21 | TYPE DEFINITIONS |
| 22 | ***************************************************************************/ |
| 23 | |
| 24 | /* intermediate RGB values are stored in an __m128i */ |
| 25 | typedef __m128i rgbint; |
| 26 | |
| 27 | /* intermediate RGB values are stored in an __m128i */ |
| 28 | typedef __m128i rgbaint; |
| 29 | |
| 30 | |
| 31 | |
| 32 | /*************************************************************************** |
| 33 | BASIC CONVERSIONS |
| 34 | ***************************************************************************/ |
| 35 | |
| 36 | /*------------------------------------------------- |
| 37 | rgb_comp_to_rgbint - converts a trio of RGB |
| 38 | components to an rgbint type |
| 39 | -------------------------------------------------*/ |
| 40 | |
| 41 | INLINE void rgb_comp_to_rgbint(rgbint *rgb, INT16 r, INT16 g, INT16 b) |
| 42 | { |
| 43 | *rgb = _mm_set_epi16(0, 0, 0, 0, 0, r, g, b); |
| 44 | } |
| 45 | |
| 46 | |
| 47 | /*------------------------------------------------- |
| 48 | rgba_comp_to_rgbint - converts a quad of RGB |
| 49 | components to an rgbint type |
| 50 | -------------------------------------------------*/ |
| 51 | |
| 52 | INLINE void rgba_comp_to_rgbaint(rgbaint *rgb, INT16 a, INT16 r, INT16 g, INT16 b) |
| 53 | { |
| 54 | *rgb = _mm_set_epi16(0, 0, 0, 0, a, r, g, b); |
| 55 | } |
| 56 | |
| 57 | |
| 58 | /*------------------------------------------------- |
| 59 | rgb_to_rgbint - converts a packed trio of RGB |
| 60 | components to an rgbint type |
| 61 | -------------------------------------------------*/ |
| 62 | |
| 63 | INLINE void rgb_to_rgbint(rgbint *rgb, rgb_t color) |
| 64 | { |
| 65 | *rgb = _mm_unpacklo_epi8(_mm_cvtsi32_si128(color), _mm_setzero_si128()); |
| 66 | } |
| 67 | |
| 68 | |
| 69 | /*------------------------------------------------- |
| 70 | rgba_to_rgbaint - converts a packed quad of RGB |
| 71 | components to an rgbint type |
| 72 | -------------------------------------------------*/ |
| 73 | |
| 74 | INLINE void rgba_to_rgbaint(rgbaint *rgb, rgb_t color) |
| 75 | { |
| 76 | *rgb = _mm_unpacklo_epi8(_mm_cvtsi32_si128(color), _mm_setzero_si128()); |
| 77 | } |
| 78 | |
| 79 | |
| 80 | /*------------------------------------------------- |
| 81 | rgbint_to_rgb - converts an rgbint back to |
| 82 | a packed trio of RGB values |
| 83 | -------------------------------------------------*/ |
| 84 | |
| 85 | INLINE rgb_t rgbint_to_rgb(const rgbint *color) |
| 86 | { |
| 87 | return _mm_cvtsi128_si32(_mm_packus_epi16(*color, *color)); |
| 88 | } |
| 89 | |
| 90 | |
| 91 | /*------------------------------------------------- |
| 92 | rgbaint_to_rgba - converts an rgbint back to |
| 93 | a packed quad of RGB values |
| 94 | -------------------------------------------------*/ |
| 95 | |
| 96 | INLINE rgb_t rgbaint_to_rgba(const rgbaint *color) |
| 97 | { |
| 98 | return _mm_cvtsi128_si32(_mm_packus_epi16(*color, *color)); |
| 99 | } |
| 100 | |
| 101 | |
| 102 | /*------------------------------------------------- |
| 103 | rgbint_to_rgb_clamp - converts an rgbint back |
| 104 | to a packed trio of RGB values, clamping them |
| 105 | to bytes first |
| 106 | -------------------------------------------------*/ |
| 107 | |
| 108 | INLINE rgb_t rgbint_to_rgb_clamp(const rgbint *color) |
| 109 | { |
| 110 | return _mm_cvtsi128_si32(_mm_packus_epi16(*color, *color)); |
| 111 | } |
| 112 | |
| 113 | |
| 114 | /*------------------------------------------------- |
| 115 | rgbaint_to_rgba_clamp - converts an rgbint back |
| 116 | to a packed quad of RGB values, clamping them |
| 117 | to bytes first |
| 118 | -------------------------------------------------*/ |
| 119 | |
| 120 | INLINE rgb_t rgbaint_to_rgba_clamp(const rgbaint *color) |
| 121 | { |
| 122 | return _mm_cvtsi128_si32(_mm_packus_epi16(*color, *color)); |
| 123 | } |
| 124 | |
| 125 | |
| 126 | |
| 127 | /*************************************************************************** |
| 128 | CORE MATH |
| 129 | ***************************************************************************/ |
| 130 | |
| 131 | /*------------------------------------------------- |
| 132 | rgbint_add - add two rgbint values |
| 133 | -------------------------------------------------*/ |
| 134 | |
| 135 | INLINE void rgbint_add(rgbint *color1, const rgbint *color2) |
| 136 | { |
| 137 | *color1 = _mm_add_epi16(*color1, *color2); |
| 138 | } |
| 139 | |
| 140 | |
| 141 | /*------------------------------------------------- |
| 142 | rgbaint_add - add two rgbaint values |
| 143 | -------------------------------------------------*/ |
| 144 | |
| 145 | INLINE void rgbaint_add(rgbaint *color1, const rgbaint *color2) |
| 146 | { |
| 147 | *color1 = _mm_add_epi16(*color1, *color2); |
| 148 | } |
| 149 | |
| 150 | |
| 151 | /*------------------------------------------------- |
| 152 | rgbint_sub - subtract two rgbint values |
| 153 | -------------------------------------------------*/ |
| 154 | |
| 155 | INLINE void rgbint_sub(rgbint *color1, const rgbint *color2) |
| 156 | { |
| 157 | *color1 = _mm_sub_epi16(*color1, *color2); |
| 158 | } |
| 159 | |
| 160 | |
| 161 | /*------------------------------------------------- |
| 162 | rgbaint_sub - subtract two rgbaint values |
| 163 | -------------------------------------------------*/ |
| 164 | |
| 165 | INLINE void rgbaint_sub(rgbaint *color1, const rgbaint *color2) |
| 166 | { |
| 167 | *color1 = _mm_sub_epi16(*color1, *color2); |
| 168 | } |
| 169 | |
| 170 | |
| 171 | /*------------------------------------------------- |
| 172 | rgbint_subr - reverse subtract two rgbint |
| 173 | values |
| 174 | -------------------------------------------------*/ |
| 175 | |
| 176 | INLINE void rgbint_subr(rgbint *color1, const rgbint *color2) |
| 177 | { |
| 178 | __m128i temp = *color1; |
| 179 | *color1 = *color2; |
| 180 | *color1 = _mm_sub_epi16(*color1, temp); |
| 181 | } |
| 182 | |
| 183 | |
| 184 | /*------------------------------------------------- |
| 185 | rgbaint_subr - reverse subtract two rgbaint |
| 186 | values |
| 187 | -------------------------------------------------*/ |
| 188 | |
| 189 | INLINE void rgbaint_subr(rgbaint *color1, const rgbaint *color2) |
| 190 | { |
| 191 | __m128i temp = *color1; |
| 192 | *color1 = *color2; |
| 193 | *color1 = _mm_sub_epi16(*color1, temp); |
| 194 | } |
| 195 | |
| 196 | |
| 197 | |
| 198 | /*************************************************************************** |
| 199 | TABLES |
| 200 | ***************************************************************************/ |
| 201 | |
| 202 | static struct |
| 203 | { |
| 204 | __m128 dummy_for_alignment; |
| 205 | INT16 zero[8]; |
| 206 | INT16 maxbyte[8]; |
| 207 | INT16 scale_table[256][8]; |
| 208 | } rgbsse_statics = |
| 209 | { |
| 210 | { 0 }, |
| 211 | { 0, 0, 0, 0, 0, 0, 0, 0 }, |
| 212 | { 255, 255, 255, 255, 255, 255, 255, 255 }, |
| 213 | { |
| 214 | { 1, 256, 1, 256, 1, 256, 1, 256 }, { 2, 255, 2, 255, 2, 255, 2, 255 }, |
| 215 | { 3, 254, 3, 254, 3, 254, 3, 254 }, { 4, 253, 4, 253, 4, 253, 4, 253 }, |
| 216 | { 5, 252, 5, 252, 5, 252, 5, 252 }, { 6, 251, 6, 251, 6, 251, 6, 251 }, |
| 217 | { 7, 250, 7, 250, 7, 250, 7, 250 }, { 8, 249, 8, 249, 8, 249, 8, 249 }, |
| 218 | { 9, 248, 9, 248, 9, 248, 9, 248 }, { 10, 247, 10, 247, 10, 247, 10, 247 }, |
| 219 | { 11, 246, 11, 246, 11, 246, 11, 246 }, { 12, 245, 12, 245, 12, 245, 12, 245 }, |
| 220 | { 13, 244, 13, 244, 13, 244, 13, 244 }, { 14, 243, 14, 243, 14, 243, 14, 243 }, |
| 221 | { 15, 242, 15, 242, 15, 242, 15, 242 }, { 16, 241, 16, 241, 16, 241, 16, 241 }, |
| 222 | { 17, 240, 17, 240, 17, 240, 17, 240 }, { 18, 239, 18, 239, 18, 239, 18, 239 }, |
| 223 | { 19, 238, 19, 238, 19, 238, 19, 238 }, { 20, 237, 20, 237, 20, 237, 20, 237 }, |
| 224 | { 21, 236, 21, 236, 21, 236, 21, 236 }, { 22, 235, 22, 235, 22, 235, 22, 235 }, |
| 225 | { 23, 234, 23, 234, 23, 234, 23, 234 }, { 24, 233, 24, 233, 24, 233, 24, 233 }, |
| 226 | { 25, 232, 25, 232, 25, 232, 25, 232 }, { 26, 231, 26, 231, 26, 231, 26, 231 }, |
| 227 | { 27, 230, 27, 230, 27, 230, 27, 230 }, { 28, 229, 28, 229, 28, 229, 28, 229 }, |
| 228 | { 29, 228, 29, 228, 29, 228, 29, 228 }, { 30, 227, 30, 227, 30, 227, 30, 227 }, |
| 229 | { 31, 226, 31, 226, 31, 226, 31, 226 }, { 32, 225, 32, 225, 32, 225, 32, 225 }, |
| 230 | { 33, 224, 33, 224, 33, 224, 33, 224 }, { 34, 223, 34, 223, 34, 223, 34, 223 }, |
| 231 | { 35, 222, 35, 222, 35, 222, 35, 222 }, { 36, 221, 36, 221, 36, 221, 36, 221 }, |
| 232 | { 37, 220, 37, 220, 37, 220, 37, 220 }, { 38, 219, 38, 219, 38, 219, 38, 219 }, |
| 233 | { 39, 218, 39, 218, 39, 218, 39, 218 }, { 40, 217, 40, 217, 40, 217, 40, 217 }, |
| 234 | { 41, 216, 41, 216, 41, 216, 41, 216 }, { 42, 215, 42, 215, 42, 215, 42, 215 }, |
| 235 | { 43, 214, 43, 214, 43, 214, 43, 214 }, { 44, 213, 44, 213, 44, 213, 44, 213 }, |
| 236 | { 45, 212, 45, 212, 45, 212, 45, 212 }, { 46, 211, 46, 211, 46, 211, 46, 211 }, |
| 237 | { 47, 210, 47, 210, 47, 210, 47, 210 }, { 48, 209, 48, 209, 48, 209, 48, 209 }, |
| 238 | { 49, 208, 49, 208, 49, 208, 49, 208 }, { 50, 207, 50, 207, 50, 207, 50, 207 }, |
| 239 | { 51, 206, 51, 206, 51, 206, 51, 206 }, { 52, 205, 52, 205, 52, 205, 52, 205 }, |
| 240 | { 53, 204, 53, 204, 53, 204, 53, 204 }, { 54, 203, 54, 203, 54, 203, 54, 203 }, |
| 241 | { 55, 202, 55, 202, 55, 202, 55, 202 }, { 56, 201, 56, 201, 56, 201, 56, 201 }, |
| 242 | { 57, 200, 57, 200, 57, 200, 57, 200 }, { 58, 199, 58, 199, 58, 199, 58, 199 }, |
| 243 | { 59, 198, 59, 198, 59, 198, 59, 198 }, { 60, 197, 60, 197, 60, 197, 60, 197 }, |
| 244 | { 61, 196, 61, 196, 61, 196, 61, 196 }, { 62, 195, 62, 195, 62, 195, 62, 195 }, |
| 245 | { 63, 194, 63, 194, 63, 194, 63, 194 }, { 64, 193, 64, 193, 64, 193, 64, 193 }, |
| 246 | { 65, 192, 65, 192, 65, 192, 65, 192 }, { 66, 191, 66, 191, 66, 191, 66, 191 }, |
| 247 | { 67, 190, 67, 190, 67, 190, 67, 190 }, { 68, 189, 68, 189, 68, 189, 68, 189 }, |
| 248 | { 69, 188, 69, 188, 69, 188, 69, 188 }, { 70, 187, 70, 187, 70, 187, 70, 187 }, |
| 249 | { 71, 186, 71, 186, 71, 186, 71, 186 }, { 72, 185, 72, 185, 72, 185, 72, 185 }, |
| 250 | { 73, 184, 73, 184, 73, 184, 73, 184 }, { 74, 183, 74, 183, 74, 183, 74, 183 }, |
| 251 | { 75, 182, 75, 182, 75, 182, 75, 182 }, { 76, 181, 76, 181, 76, 181, 76, 181 }, |
| 252 | { 77, 180, 77, 180, 77, 180, 77, 180 }, { 78, 179, 78, 179, 78, 179, 78, 179 }, |
| 253 | { 79, 178, 79, 178, 79, 178, 79, 178 }, { 80, 177, 80, 177, 80, 177, 80, 177 }, |
| 254 | { 81, 176, 81, 176, 81, 176, 81, 176 }, { 82, 175, 82, 175, 82, 175, 82, 175 }, |
| 255 | { 83, 174, 83, 174, 83, 174, 83, 174 }, { 84, 173, 84, 173, 84, 173, 84, 173 }, |
| 256 | { 85, 172, 85, 172, 85, 172, 85, 172 }, { 86, 171, 86, 171, 86, 171, 86, 171 }, |
| 257 | { 87, 170, 87, 170, 87, 170, 87, 170 }, { 88, 169, 88, 169, 88, 169, 88, 169 }, |
| 258 | { 89, 168, 89, 168, 89, 168, 89, 168 }, { 90, 167, 90, 167, 90, 167, 90, 167 }, |
| 259 | { 91, 166, 91, 166, 91, 166, 91, 166 }, { 92, 165, 92, 165, 92, 165, 92, 165 }, |
| 260 | { 93, 164, 93, 164, 93, 164, 93, 164 }, { 94, 163, 94, 163, 94, 163, 94, 163 }, |
| 261 | { 95, 162, 95, 162, 95, 162, 95, 162 }, { 96, 161, 96, 161, 96, 161, 96, 161 }, |
| 262 | { 97, 160, 97, 160, 97, 160, 97, 160 }, { 98, 159, 98, 159, 98, 159, 98, 159 }, |
| 263 | { 99, 158, 99, 158, 99, 158, 99, 158 }, { 100, 157, 100, 157, 100, 157, 100, 157 }, |
| 264 | { 101, 156, 101, 156, 101, 156, 101, 156 }, { 102, 155, 102, 155, 102, 155, 102, 155 }, |
| 265 | { 103, 154, 103, 154, 103, 154, 103, 154 }, { 104, 153, 104, 153, 104, 153, 104, 153 }, |
| 266 | { 105, 152, 105, 152, 105, 152, 105, 152 }, { 106, 151, 106, 151, 106, 151, 106, 151 }, |
| 267 | { 107, 150, 107, 150, 107, 150, 107, 150 }, { 108, 149, 108, 149, 108, 149, 108, 149 }, |
| 268 | { 109, 148, 109, 148, 109, 148, 109, 148 }, { 110, 147, 110, 147, 110, 147, 110, 147 }, |
| 269 | { 111, 146, 111, 146, 111, 146, 111, 146 }, { 112, 145, 112, 145, 112, 145, 112, 145 }, |
| 270 | { 113, 144, 113, 144, 113, 144, 113, 144 }, { 114, 143, 114, 143, 114, 143, 114, 143 }, |
| 271 | { 115, 142, 115, 142, 115, 142, 115, 142 }, { 116, 141, 116, 141, 116, 141, 116, 141 }, |
| 272 | { 117, 140, 117, 140, 117, 140, 117, 140 }, { 118, 139, 118, 139, 118, 139, 118, 139 }, |
| 273 | { 119, 138, 119, 138, 119, 138, 119, 138 }, { 120, 137, 120, 137, 120, 137, 120, 137 }, |
| 274 | { 121, 136, 121, 136, 121, 136, 121, 136 }, { 122, 135, 122, 135, 122, 135, 122, 135 }, |
| 275 | { 123, 134, 123, 134, 123, 134, 123, 134 }, { 124, 133, 124, 133, 124, 133, 124, 133 }, |
| 276 | { 125, 132, 125, 132, 125, 132, 125, 132 }, { 126, 131, 126, 131, 126, 131, 126, 131 }, |
| 277 | { 127, 130, 127, 130, 127, 130, 127, 130 }, { 128, 129, 128, 129, 128, 129, 128, 129 }, |
| 278 | { 129, 128, 129, 128, 129, 128, 129, 128 }, { 130, 127, 130, 127, 130, 127, 130, 127 }, |
| 279 | { 131, 126, 131, 126, 131, 126, 131, 126 }, { 132, 125, 132, 125, 132, 125, 132, 125 }, |
| 280 | { 133, 124, 133, 124, 133, 124, 133, 124 }, { 134, 123, 134, 123, 134, 123, 134, 123 }, |
| 281 | { 135, 122, 135, 122, 135, 122, 135, 122 }, { 136, 121, 136, 121, 136, 121, 136, 121 }, |
| 282 | { 137, 120, 137, 120, 137, 120, 137, 120 }, { 138, 119, 138, 119, 138, 119, 138, 119 }, |
| 283 | { 139, 118, 139, 118, 139, 118, 139, 118 }, { 140, 117, 140, 117, 140, 117, 140, 117 }, |
| 284 | { 141, 116, 141, 116, 141, 116, 141, 116 }, { 142, 115, 142, 115, 142, 115, 142, 115 }, |
| 285 | { 143, 114, 143, 114, 143, 114, 143, 114 }, { 144, 113, 144, 113, 144, 113, 144, 113 }, |
| 286 | { 145, 112, 145, 112, 145, 112, 145, 112 }, { 146, 111, 146, 111, 146, 111, 146, 111 }, |
| 287 | { 147, 110, 147, 110, 147, 110, 147, 110 }, { 148, 109, 148, 109, 148, 109, 148, 109 }, |
| 288 | { 149, 108, 149, 108, 149, 108, 149, 108 }, { 150, 107, 150, 107, 150, 107, 150, 107 }, |
| 289 | { 151, 106, 151, 106, 151, 106, 151, 106 }, { 152, 105, 152, 105, 152, 105, 152, 105 }, |
| 290 | { 153, 104, 153, 104, 153, 104, 153, 104 }, { 154, 103, 154, 103, 154, 103, 154, 103 }, |
| 291 | { 155, 102, 155, 102, 155, 102, 155, 102 }, { 156, 101, 156, 101, 156, 101, 156, 101 }, |
| 292 | { 157, 100, 157, 100, 157, 100, 157, 100 }, { 158, 99, 158, 99, 158, 99, 158, 99 }, |
| 293 | { 159, 98, 159, 98, 159, 98, 159, 98 }, { 160, 97, 160, 97, 160, 97, 160, 97 }, |
| 294 | { 161, 96, 161, 96, 161, 96, 161, 96 }, { 162, 95, 162, 95, 162, 95, 162, 95 }, |
| 295 | { 163, 94, 163, 94, 163, 94, 163, 94 }, { 164, 93, 164, 93, 164, 93, 164, 93 }, |
| 296 | { 165, 92, 165, 92, 165, 92, 165, 92 }, { 166, 91, 166, 91, 166, 91, 166, 91 }, |
| 297 | { 167, 90, 167, 90, 167, 90, 167, 90 }, { 168, 89, 168, 89, 168, 89, 168, 89 }, |
| 298 | { 169, 88, 169, 88, 169, 88, 169, 88 }, { 170, 87, 170, 87, 170, 87, 170, 87 }, |
| 299 | { 171, 86, 171, 86, 171, 86, 171, 86 }, { 172, 85, 172, 85, 172, 85, 172, 85 }, |
| 300 | { 173, 84, 173, 84, 173, 84, 173, 84 }, { 174, 83, 174, 83, 174, 83, 174, 83 }, |
| 301 | { 175, 82, 175, 82, 175, 82, 175, 82 }, { 176, 81, 176, 81, 176, 81, 176, 81 }, |
| 302 | { 177, 80, 177, 80, 177, 80, 177, 80 }, { 178, 79, 178, 79, 178, 79, 178, 79 }, |
| 303 | { 179, 78, 179, 78, 179, 78, 179, 78 }, { 180, 77, 180, 77, 180, 77, 180, 77 }, |
| 304 | { 181, 76, 181, 76, 181, 76, 181, 76 }, { 182, 75, 182, 75, 182, 75, 182, 75 }, |
| 305 | { 183, 74, 183, 74, 183, 74, 183, 74 }, { 184, 73, 184, 73, 184, 73, 184, 73 }, |
| 306 | { 185, 72, 185, 72, 185, 72, 185, 72 }, { 186, 71, 186, 71, 186, 71, 186, 71 }, |
| 307 | { 187, 70, 187, 70, 187, 70, 187, 70 }, { 188, 69, 188, 69, 188, 69, 188, 69 }, |
| 308 | { 189, 68, 189, 68, 189, 68, 189, 68 }, { 190, 67, 190, 67, 190, 67, 190, 67 }, |
| 309 | { 191, 66, 191, 66, 191, 66, 191, 66 }, { 192, 65, 192, 65, 192, 65, 192, 65 }, |
| 310 | { 193, 64, 193, 64, 193, 64, 193, 64 }, { 194, 63, 194, 63, 194, 63, 194, 63 }, |
| 311 | { 195, 62, 195, 62, 195, 62, 195, 62 }, { 196, 61, 196, 61, 196, 61, 196, 61 }, |
| 312 | { 197, 60, 197, 60, 197, 60, 197, 60 }, { 198, 59, 198, 59, 198, 59, 198, 59 }, |
| 313 | { 199, 58, 199, 58, 199, 58, 199, 58 }, { 200, 57, 200, 57, 200, 57, 200, 57 }, |
| 314 | { 201, 56, 201, 56, 201, 56, 201, 56 }, { 202, 55, 202, 55, 202, 55, 202, 55 }, |
| 315 | { 203, 54, 203, 54, 203, 54, 203, 54 }, { 204, 53, 204, 53, 204, 53, 204, 53 }, |
| 316 | { 205, 52, 205, 52, 205, 52, 205, 52 }, { 206, 51, 206, 51, 206, 51, 206, 51 }, |
| 317 | { 207, 50, 207, 50, 207, 50, 207, 50 }, { 208, 49, 208, 49, 208, 49, 208, 49 }, |
| 318 | { 209, 48, 209, 48, 209, 48, 209, 48 }, { 210, 47, 210, 47, 210, 47, 210, 47 }, |
| 319 | { 211, 46, 211, 46, 211, 46, 211, 46 }, { 212, 45, 212, 45, 212, 45, 212, 45 }, |
| 320 | { 213, 44, 213, 44, 213, 44, 213, 44 }, { 214, 43, 214, 43, 214, 43, 214, 43 }, |
| 321 | { 215, 42, 215, 42, 215, 42, 215, 42 }, { 216, 41, 216, 41, 216, 41, 216, 41 }, |
| 322 | { 217, 40, 217, 40, 217, 40, 217, 40 }, { 218, 39, 218, 39, 218, 39, 218, 39 }, |
| 323 | { 219, 38, 219, 38, 219, 38, 219, 38 }, { 220, 37, 220, 37, 220, 37, 220, 37 }, |
| 324 | { 221, 36, 221, 36, 221, 36, 221, 36 }, { 222, 35, 222, 35, 222, 35, 222, 35 }, |
| 325 | { 223, 34, 223, 34, 223, 34, 223, 34 }, { 224, 33, 224, 33, 224, 33, 224, 33 }, |
| 326 | { 225, 32, 225, 32, 225, 32, 225, 32 }, { 226, 31, 226, 31, 226, 31, 226, 31 }, |
| 327 | { 227, 30, 227, 30, 227, 30, 227, 30 }, { 228, 29, 228, 29, 228, 29, 228, 29 }, |
| 328 | { 229, 28, 229, 28, 229, 28, 229, 28 }, { 230, 27, 230, 27, 230, 27, 230, 27 }, |
| 329 | { 231, 26, 231, 26, 231, 26, 231, 26 }, { 232, 25, 232, 25, 232, 25, 232, 25 }, |
| 330 | { 233, 24, 233, 24, 233, 24, 233, 24 }, { 234, 23, 234, 23, 234, 23, 234, 23 }, |
| 331 | { 235, 22, 235, 22, 235, 22, 235, 22 }, { 236, 21, 236, 21, 236, 21, 236, 21 }, |
| 332 | { 237, 20, 237, 20, 237, 20, 237, 20 }, { 238, 19, 238, 19, 238, 19, 238, 19 }, |
| 333 | { 239, 18, 239, 18, 239, 18, 239, 18 }, { 240, 17, 240, 17, 240, 17, 240, 17 }, |
| 334 | { 241, 16, 241, 16, 241, 16, 241, 16 }, { 242, 15, 242, 15, 242, 15, 242, 15 }, |
| 335 | { 243, 14, 243, 14, 243, 14, 243, 14 }, { 244, 13, 244, 13, 244, 13, 244, 13 }, |
| 336 | { 245, 12, 245, 12, 245, 12, 245, 12 }, { 246, 11, 246, 11, 246, 11, 246, 11 }, |
| 337 | { 247, 10, 247, 10, 247, 10, 247, 10 }, { 248, 9, 248, 9, 248, 9, 248, 9 }, |
| 338 | { 249, 8, 249, 8, 249, 8, 249, 8 }, { 250, 7, 250, 7, 250, 7, 250, 7 }, |
| 339 | { 251, 6, 251, 6, 251, 6, 251, 6 }, { 252, 5, 252, 5, 252, 5, 252, 5 }, |
| 340 | { 253, 4, 253, 4, 253, 4, 253, 4 }, { 254, 3, 254, 3, 254, 3, 254, 3 }, |
| 341 | { 255, 2, 255, 2, 255, 2, 255, 2 }, { 256, 1, 256, 1, 256, 1, 256, 1 } |
| 342 | } |
| 343 | }; |
| 344 | |
| 345 | |
| 346 | |
| 347 | /*************************************************************************** |
| 348 | HIGHER LEVEL OPERATIONS |
| 349 | ***************************************************************************/ |
| 350 | |
| 351 | /*------------------------------------------------- |
| 352 | rgbint_blend - blend two colors by the given |
| 353 | scale factor |
| 354 | -------------------------------------------------*/ |
| 355 | |
| 356 | INLINE void rgbint_blend(rgbint *color1, const rgbint *color2, UINT8 color1scale) |
| 357 | { |
| 358 | *color1 = _mm_unpacklo_epi16(*color1, *color2); |
| 359 | *color1 = _mm_madd_epi16(*color1, *(__m128i *)&rgbsse_statics.scale_table[color1scale][0]); |
| 360 | *color1 = _mm_srli_epi32(*color1, 8); |
| 361 | *color1 = _mm_packs_epi32(*color1, *color1); |
| 362 | } |
| 363 | |
| 364 | |
| 365 | /*------------------------------------------------- |
| 366 | rgbaint_blend - blend two colors by the given |
| 367 | scale factor |
| 368 | -------------------------------------------------*/ |
| 369 | |
| 370 | INLINE void rgbaint_blend(rgbaint *color1, const rgbaint *color2, UINT8 color1scale) |
| 371 | { |
| 372 | rgbint_blend(color1, color2, color1scale); |
| 373 | } |
| 374 | |
| 375 | |
| 376 | /*------------------------------------------------- |
| 377 | rgbint_scale_and_clamp - scale the given |
| 378 | color by an 8.8 scale factor and clamp to |
| 379 | byte values |
| 380 | -------------------------------------------------*/ |
| 381 | |
| 382 | INLINE void rgbint_scale_and_clamp(rgbint *color, INT16 colorscale) |
| 383 | { |
| 384 | __m128i mscale = _mm_set1_epi16(colorscale); |
| 385 | *color = _mm_unpacklo_epi16(*color, _mm_setzero_si128()); |
| 386 | *color = _mm_madd_epi16(*color, mscale); |
| 387 | *color = _mm_srli_epi32(*color, 8); |
| 388 | *color = _mm_packs_epi32(*color, *color); |
| 389 | *color = _mm_min_epi16(*color, *(__m128i *)&rgbsse_statics.maxbyte); |
| 390 | } |
| 391 | |
| 392 | |
| 393 | /*------------------------------------------------- |
| 394 | rgbaint_scale_and_clamp - scale the given |
| 395 | color by an 8.8 scale factor and clamp to |
| 396 | byte values |
| 397 | -------------------------------------------------*/ |
| 398 | |
| 399 | INLINE void rgbaint_scale_and_clamp(rgbaint *color, INT16 colorscale) |
| 400 | { |
| 401 | rgbint_scale_and_clamp(color, colorscale); |
| 402 | } |
| 403 | |
| 404 | |
| 405 | /*------------------------------------------------- |
| 406 | rgb_bilinear_filter - bilinear filter between |
| 407 | four pixel values |
| 408 | -------------------------------------------------*/ |
| 409 | |
| 410 | INLINE rgb_t rgb_bilinear_filter(rgb_t rgb00, rgb_t rgb01, rgb_t rgb10, rgb_t rgb11, UINT8 u, UINT8 v) |
| 411 | { |
| 412 | __m128i color00 = _mm_cvtsi32_si128(rgb00); |
| 413 | __m128i color01 = _mm_cvtsi32_si128(rgb01); |
| 414 | __m128i color10 = _mm_cvtsi32_si128(rgb10); |
| 415 | __m128i color11 = _mm_cvtsi32_si128(rgb11); |
| 416 | |
| 417 | /* interleave color01 and color00 at the byte level */ |
| 418 | color01 = _mm_unpacklo_epi8(color01, color00); |
| 419 | color11 = _mm_unpacklo_epi8(color11, color10); |
| 420 | color01 = _mm_unpacklo_epi8(color01, _mm_setzero_si128()); |
| 421 | color11 = _mm_unpacklo_epi8(color11, _mm_setzero_si128()); |
| 422 | color01 = _mm_madd_epi16(color01, *(__m128i *)&rgbsse_statics.scale_table[u][0]); |
| 423 | color11 = _mm_madd_epi16(color11, *(__m128i *)&rgbsse_statics.scale_table[u][0]); |
| 424 | color01 = _mm_slli_epi32(color01, 15); |
| 425 | color11 = _mm_srli_epi32(color11, 1); |
| 426 | color01 = _mm_max_epi16(color01, color11); |
| 427 | color01 = _mm_madd_epi16(color01, *(__m128i *)&rgbsse_statics.scale_table[v][0]); |
| 428 | color01 = _mm_srli_epi32(color01, 15); |
| 429 | color01 = _mm_packs_epi32(color01, color01); |
| 430 | color01 = _mm_packus_epi16(color01, color01); |
| 431 | return _mm_cvtsi128_si32(color01); |
| 432 | } |
| 433 | |
| 434 | |
| 435 | /*------------------------------------------------- |
| 436 | rgba_bilinear_filter - bilinear filter between |
| 437 | four pixel values |
| 438 | -------------------------------------------------*/ |
| 439 | |
| 440 | INLINE rgb_t rgba_bilinear_filter(rgb_t rgb00, rgb_t rgb01, rgb_t rgb10, rgb_t rgb11, UINT8 u, UINT8 v) |
| 441 | { |
| 442 | return rgb_bilinear_filter(rgb00, rgb01, rgb10, rgb11, u, v); |
| 443 | } |
| 444 | |
| 445 | |
| 446 | #endif /* __RGBUTIL__ */ |
src/emu/machine/scsihd.c
| r1215 | r1216 | |
| 14 | 14 | |
| 15 | 15 | typedef struct |
| 16 | 16 | { |
| 17 | | UINT32 lba, blocks, last_lba; |
| 18 | | int last_command; |
| 17 | UINT32 lba; |
| 18 | UINT32 blocks; |
| 19 | 19 | hard_disk_file *disk; |
| 20 | | UINT8 last_packet[16]; |
| 21 | | UINT8 inquiry_buffer[96]; |
| 22 | 20 | } SCSIHd; |
| 23 | 21 | |
| 24 | 22 | |
| 25 | 23 | // scsihd_exec_command |
| 26 | 24 | |
| 27 | | int scsihd_exec_command(SCSIHd *our_this, UINT8 *pCmdBuf) |
| 25 | int scsihd_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode ) |
| 28 | 26 | { |
| 29 | | int retdata = 0; |
| 27 | UINT8 *command; |
| 28 | int commandLength; |
| 29 | SCSIHd *our_this = SCSIThis( &SCSIClassHARDDISK, scsiInstance ); |
| 30 | SCSIGetCommand( scsiInstance, &command, &commandLength ); |
| 30 | 31 | |
| 31 | | // remember the last command for the data transfer phase |
| 32 | | our_this->last_command = pCmdBuf[0] & 0x7f; |
| 33 | | |
| 34 | | // remember the actual command packet too |
| 35 | | memcpy(our_this->last_packet, pCmdBuf, 16); |
| 36 | | |
| 37 | | switch (our_this->last_command) |
| 32 | switch ( command[0] ) |
| 38 | 33 | { |
| 39 | | case 0: // TEST UNIT READY |
| 40 | | retdata = 12; |
| 41 | | break; |
| 42 | | case 3: // REQUEST SENSE |
| 43 | | retdata = 16; |
| 44 | | break; |
| 45 | | case 4: // FORMAT UNIT |
| 46 | | // (do nothing) |
| 47 | | break; |
| 34 | case 0x03: // REQUEST SENSE |
| 35 | SCSISetPhase( scsiInstance, SCSI_PHASE_DATAIN ); |
| 36 | return SCSILengthFromUINT8( &command[ 4 ] ); |
| 48 | 37 | |
| 49 | | case 0x08: // READ (6 byte) |
| 50 | | our_this->lba = (pCmdBuf[1]&0x1f)<<16 | pCmdBuf[2]<<8 | pCmdBuf[3]; |
| 51 | | our_this->blocks = pCmdBuf[4]; |
| 52 | | if (our_this->blocks == 0) |
| 53 | | { |
| 54 | | our_this->blocks = 256; |
| 55 | | } |
| 38 | case 0x04: // FORMAT UNIT |
| 39 | SCSISetPhase( scsiInstance, SCSI_PHASE_STATUS ); |
| 40 | return 0; |
| 56 | 41 | |
| 42 | case 0x08: // READ(6) |
| 43 | our_this->lba = (command[1]&0x1f)<<16 | command[2]<<8 | command[3]; |
| 44 | our_this->blocks = SCSILengthFromUINT8( &command[4] ); |
| 45 | |
| 57 | 46 | logerror("SCSIHD: READ at LBA %x for %x blocks\n", our_this->lba, our_this->blocks); |
| 58 | 47 | |
| 59 | | retdata = our_this->blocks * 512; |
| 60 | | break; |
| 48 | SCSISetPhase( scsiInstance, SCSI_PHASE_DATAIN ); |
| 49 | return our_this->blocks * 512; |
| 61 | 50 | |
| 62 | | case 0x0a: // WRITE (6 byte) |
| 63 | | our_this->lba = (pCmdBuf[1]&0x1f)<<16 | pCmdBuf[2]<<8 | pCmdBuf[3]; |
| 64 | | our_this->blocks = pCmdBuf[4]; |
| 65 | | if (our_this->blocks == 0) |
| 66 | | { |
| 67 | | our_this->blocks = 256; |
| 68 | | } |
| 51 | case 0x0a: // WRITE(6) |
| 52 | our_this->lba = (command[1]&0x1f)<<16 | command[2]<<8 | command[3]; |
| 53 | our_this->blocks = SCSILengthFromUINT8( &command[4] ); |
| 69 | 54 | |
| 70 | 55 | logerror("SCSIHD: WRITE to LBA %x for %x blocks\n", our_this->lba, our_this->blocks); |
| 71 | 56 | |
| 72 | | retdata = our_this->blocks * 512; |
| 73 | | break; |
| 57 | SCSISetPhase( scsiInstance, SCSI_PHASE_DATAOUT ); |
| 58 | return our_this->blocks * 512; |
| 74 | 59 | |
| 75 | | case 0x12: // INQUIRY |
| 76 | | retdata = 40; // (12) |
| 77 | | break; |
| 78 | | case 0x15: // MODE SELECT (used to set CDDA volume) |
| 79 | | logerror("SCSIHD: MODE SELECT length %x control %x\n", pCmdBuf[4], pCmdBuf[5]); |
| 80 | | retdata = 0x18; |
| 81 | | break; |
| 82 | | case 0x1a: // MODE SENSE (6 byte) |
| 83 | | retdata = 8; |
| 60 | case 0x12: // INQUIRY |
| 61 | SCSISetPhase( scsiInstance, SCSI_PHASE_DATAIN ); |
| 62 | return SCSILengthFromUINT8( &command[ 4 ] ); |
| 84 | 63 | |
| 85 | | // check for special Apple ID code |
| 86 | | if ((pCmdBuf[2]&0x3f) == 0x30) |
| 87 | | { |
| 88 | | retdata = 40; |
| 89 | | } |
| 90 | | break; |
| 91 | | case 0x25: // READ CAPACITY |
| 92 | | retdata = 8; |
| 93 | | break; |
| 94 | | case 0x28: // READ (10 byte) |
| 95 | | our_this->lba = pCmdBuf[2]<<24 | pCmdBuf[3]<<16 | pCmdBuf[4]<<8 | pCmdBuf[5]; |
| 96 | | our_this->blocks = pCmdBuf[6]<<24 | pCmdBuf[7]<<16 | pCmdBuf[8]<<8 | pCmdBuf[9]; |
| 64 | case 0x15: // MODE SELECT (used to set CDDA volume) |
| 65 | logerror("SCSIHD: MODE SELECT length %x control %x\n", command[4], command[5]); |
| 66 | SCSISetPhase( scsiInstance, SCSI_PHASE_DATAOUT ); |
| 67 | return SCSILengthFromUINT8( &command[ 4 ] ); |
| 97 | 68 | |
| 69 | case 0x1a: // MODE SENSE(6) |
| 70 | SCSISetPhase( scsiInstance, SCSI_PHASE_DATAIN ); |
| 71 | return SCSILengthFromUINT8( &command[ 4 ] ); |
| 72 | |
| 73 | case 0x25: // READ CAPACITY |
| 74 | SCSISetPhase( scsiInstance, SCSI_PHASE_DATAIN ); |
| 75 | return 8; |
| 76 | |
| 77 | case 0x28: // READ(10) |
| 78 | our_this->lba = command[2]<<24 | command[3]<<16 | command[4]<<8 | command[5]; |
| 79 | our_this->blocks = command[6]<<24 | command[7]<<16 | command[8]<<8 | command[9]; |
| 80 | |
| 98 | 81 | logerror("SCSIHD: READ at LBA %x for %x blocks\n", our_this->lba, our_this->blocks); |
| 99 | 82 | |
| 100 | | retdata = our_this->blocks * 512; |
| 101 | | break; |
| 102 | | case 0xa8: // READ (12 byte) |
| 103 | | our_this->lba = pCmdBuf[2]<<24 | pCmdBuf[3]<<16 | pCmdBuf[4]<<8 | pCmdBuf[5]; |
| 104 | | our_this->blocks = pCmdBuf[7]<<8 | pCmdBuf[8]; |
| 83 | SCSISetPhase( scsiInstance, SCSI_PHASE_DATAIN ); |
| 84 | return our_this->blocks * 512; |
| 105 | 85 | |
| 86 | case 0xa8: // READ(12) |
| 87 | our_this->lba = command[2]<<24 | command[3]<<16 | command[4]<<8 | command[5]; |
| 88 | our_this->blocks = SCSILengthFromUINT16( &command[7] ); |
| 89 | |
| 106 | 90 | logerror("SCSIHD: READ at LBA %x for %x blocks\n", our_this->lba, our_this->blocks); |
| 107 | 91 | |
| 108 | | retdata = our_this->blocks * 512; |
| 109 | | break; |
| 92 | SCSISetPhase( scsiInstance, SCSI_PHASE_DATAIN ); |
| 93 | return our_this->blocks * 512; |
| 94 | |
| 110 | 95 | default: |
| 111 | | logerror("SCSIHD: unknown SCSI command %x!\n", our_this->last_command); |
| 112 | | break; |
| 96 | return SCSIBase( &SCSIClassHARDDISK, SCSIOP_EXEC_COMMAND, scsiInstance, 0, NULL ); |
| 113 | 97 | } |
| 114 | | |
| 115 | | return retdata; |
| 116 | 98 | } |
| 117 | 99 | |
| 118 | | void scsihd_read_data(SCSIHd *our_this, int bytes, UINT8 *pData) |
| 100 | static void scsihd_read_data( SCSIInstance *scsiInstance, UINT8 *data, int dataLength ) |
| 119 | 101 | { |
| 120 | 102 | int i; |
| 103 | UINT8 *command; |
| 104 | int commandLength; |
| 105 | SCSIHd *our_this = SCSIThis( &SCSIClassHARDDISK, scsiInstance ); |
| 106 | SCSIGetCommand( scsiInstance, &command, &commandLength ); |
| 121 | 107 | |
| 122 | | switch (our_this->last_command) |
| 108 | switch ( command[0] ) |
| 123 | 109 | { |
| 124 | 110 | case 0x03: // REQUEST SENSE |
| 125 | | pData[0] = 0x80; // valid sense |
| 111 | data[0] = 0x80; // valid sense |
| 126 | 112 | for (i = 1; i < 12; i++) |
| 127 | 113 | { |
| 128 | | pData[i] = 0; |
| 114 | data[i] = 0; |
| 129 | 115 | } |
| 130 | 116 | break; |
| 131 | 117 | |
| 132 | 118 | case 0x12: // INQUIRY |
| 133 | | i = sizeof( our_this->inquiry_buffer ); |
| 134 | | if( i > bytes ) |
| 135 | | { |
| 136 | | i = bytes; |
| 137 | | } |
| 138 | | |
| 139 | | memcpy( pData, our_this->inquiry_buffer, i ); |
| 140 | | |
| 141 | | if( i < bytes ) |
| 142 | | { |
| 143 | | memset( pData + i, 0, bytes - i ); |
| 144 | | } |
| 145 | | |
| 119 | memset( data, 0, dataLength ); |
| 120 | data[0] = 0x00; // device is direct-access (e.g. hard disk) |
| 121 | data[1] = 0x00; // media is not removable |
| 122 | data[2] = 0x05; // device complies with SPC-3 standard |
| 123 | data[3] = 0x02; // response data format = SPC-3 standard |
| 124 | // Apple HD SC setup utility needs to see this |
| 125 | strcpy((char *)&data[8], " SEAGATE"); |
| 126 | strcpy((char *)&data[16], " ST225N"); |
| 127 | strcpy((char *)&data[32], "1.0"); |
| 146 | 128 | break; |
| 147 | 129 | |
| 148 | 130 | case 0x1a: // MODE SENSE (6 byte) |
| 149 | 131 | // special Apple ID page. this is a vendor-specific page, |
| 150 | 132 | // so unless collisions occur there should be no need |
| 151 | 133 | // to change it. |
| 152 | | if ((our_this->last_packet[2] & 0x3f) == 0x30) |
| 134 | if ((command[2] & 0x3f) == 0x30) |
| 153 | 135 | { |
| 154 | | memset(pData, 0, 40); |
| 155 | | pData[0] = 0x14; |
| 156 | | strcpy((char *)&pData[14], "APPLE COMPUTER, INC."); |
| 136 | memset(data, 0, 40); |
| 137 | data[0] = 0x14; |
| 138 | strcpy((char *)&data[14], "APPLE COMPUTER, INC."); |
| 157 | 139 | } |
| 158 | 140 | break; |
| 159 | 141 | |
| 160 | | case 0x08: // READ (6 byte) |
| 161 | | case 0x28: // READ (10 byte) |
| 162 | | case 0xa8: // READ (12 byte) |
| 142 | case 0x08: // READ(6) |
| 143 | case 0x28: // READ(10) |
| 144 | case 0xa8: // READ(12) |
| 163 | 145 | if ((our_this->disk) && (our_this->blocks)) |
| 164 | 146 | { |
| 165 | | while (bytes > 0) |
| 147 | while (dataLength > 0) |
| 166 | 148 | { |
| 167 | | if (!hard_disk_read(our_this->disk, our_this->lba, pData)) |
| 149 | if (!hard_disk_read(our_this->disk, our_this->lba, data)) |
| 168 | 150 | { |
| 169 | 151 | logerror("SCSIHD: HD read error!\n"); |
| 170 | 152 | } |
| 171 | 153 | our_this->lba++; |
| 172 | | our_this->last_lba = our_this->lba; |
| 173 | 154 | our_this->blocks--; |
| 174 | | bytes -= 512; |
| 175 | | pData += 512; |
| 155 | dataLength -= 512; |
| 156 | data += 512; |
| 176 | 157 | } |
| 177 | 158 | } |
| 178 | 159 | break; |
| 179 | 160 | |
| 180 | 161 | |
| 181 | | case 0x25: // READ CAPACITY |
| 162 | case 0x25: // READ CAPACITY |
| 182 | 163 | { |
| 183 | 164 | hard_disk_info *info; |
| 184 | 165 | UINT32 temp; |
| r1215 | r1216 | |
| 191 | 172 | temp = info->cylinders * info->heads * info->sectors; |
| 192 | 173 | temp--; |
| 193 | 174 | |
| 194 | | pData[0] = (temp>>24) & 0xff; |
| 195 | | pData[1] = (temp>>16) & 0xff; |
| 196 | | pData[2] = (temp>>8) & 0xff; |
| 197 | | pData[3] = (temp & 0xff); |
| 198 | | pData[4] = (info->sectorbytes>>24)&0xff; |
| 199 | | pData[5] = (info->sectorbytes>>16)&0xff; |
| 200 | | pData[6] = (info->sectorbytes>>8)&0xff; |
| 201 | | pData[7] = (info->sectorbytes & 0xff); |
| 175 | data[0] = (temp>>24) & 0xff; |
| 176 | data[1] = (temp>>16) & 0xff; |
| 177 | data[2] = (temp>>8) & 0xff; |
| 178 | data[3] = (temp & 0xff); |
| 179 | data[4] = (info->sectorbytes>>24)&0xff; |
| 180 | data[5] = (info->sectorbytes>>16)&0xff; |
| 181 | data[6] = (info->sectorbytes>>8)&0xff; |
| 182 | data[7] = (info->sectorbytes & 0xff); |
| 202 | 183 | } |
| 203 | 184 | break; |
| 204 | 185 | |
| 205 | 186 | default: |
| 206 | | logerror("SCSIHD: readback of data from unknown command %d\n", our_this->last_command); |
| 187 | SCSIBase( &SCSIClassHARDDISK, SCSIOP_READ_DATA, scsiInstance, dataLength, data ); |
| 207 | 188 | break; |
| 208 | 189 | } |
| 209 | 190 | } |
| 210 | 191 | |
| 211 | | void scsihd_write_data(SCSIHd *our_this, int bytes, UINT8 *pData) |
| 192 | static void scsihd_write_data( SCSIInstance *scsiInstance, UINT8 *data, int dataLength ) |
| 212 | 193 | { |
| 213 | | switch (our_this->last_command) |
| 194 | UINT8 *command; |
| 195 | int commandLength; |
| 196 | SCSIHd *our_this = SCSIThis( &SCSIClassHARDDISK, scsiInstance ); |
| 197 | SCSIGetCommand( scsiInstance, &command, &commandLength ); |
| 198 | |
| 199 | switch ( command[0] ) |
| 214 | 200 | { |
| 215 | | case 0x0a: // WRITE (6 byte) |
| 201 | case 0x0a: // WRITE(6) |
| 216 | 202 | if ((our_this->disk) && (our_this->blocks)) |
| 217 | 203 | { |
| 218 | | while (bytes > 0) |
| 204 | while (dataLength > 0) |
| 219 | 205 | { |
| 220 | | if (!hard_disk_write(our_this->disk, our_this->lba, pData)) |
| 206 | if (!hard_disk_write(our_this->disk, our_this->lba, data)) |
| 221 | 207 | { |
| 222 | 208 | logerror("SCSIHD: HD write error!\n"); |
| 223 | 209 | } |
| 224 | 210 | our_this->lba++; |
| 225 | | our_this->last_lba = our_this->lba; |
| 226 | 211 | our_this->blocks--; |
| 227 | | bytes -= 512; |
| 228 | | pData += 512; |
| 212 | dataLength -= 512; |
| 213 | data += 512; |
| 229 | 214 | } |
| 230 | 215 | } |
| 231 | 216 | break; |
| 217 | |
| 218 | default: |
| 219 | SCSIBase( &SCSIClassHARDDISK, SCSIOP_WRITE_DATA, scsiInstance, dataLength, data ); |
| 220 | break; |
| 232 | 221 | } |
| 233 | 222 | } |
| 234 | 223 | |
| 235 | | int scsihd_dispatch(int operation, void *file, INT64 intparm, UINT8 *ptrparm) |
| 224 | static void scsihd_alloc_instance( SCSIInstance *scsiInstance, int diskId ) |
| 236 | 225 | { |
| 237 | | SCSIHd *instance; |
| 238 | | void **ptrresult; |
| 226 | SCSIHd *our_this = SCSIThis( &SCSIClassHARDDISK, scsiInstance ); |
| 239 | 227 | |
| 228 | our_this->lba = 0; |
| 229 | our_this->blocks = 0; |
| 230 | |
| 231 | state_save_register_item( "scsihd", diskId, our_this->lba ); |
| 232 | state_save_register_item( "scsihd", diskId, our_this->blocks ); |
| 233 | |
| 234 | #ifdef MESS |
| 235 | our_this->disk = mess_hd_get_hard_disk_file_by_number( diskId ); |
| 236 | #else |
| 237 | our_this->disk = hard_disk_open(get_disk_handle( diskId )); |
| 238 | |
| 239 | if (!our_this->disk) |
| 240 | { |
| 241 | logerror("SCSIHD: no HD found!\n"); |
| 242 | } |
| 243 | #endif |
| 244 | } |
| 245 | |
| 246 | static void scsihd_delete_instance( SCSIInstance *scsiInstance ) |
| 247 | { |
| 248 | #ifndef MESS |
| 249 | SCSIHd *our_this = SCSIThis( &SCSIClassHARDDISK, scsiInstance ); |
| 250 | |
| 251 | if( our_this->disk ) |
| 252 | { |
| 253 | hard_disk_close( our_this->disk ); |
| 254 | } |
| 255 | #endif |
| 256 | } |
| 257 | |
| 258 | static void scsihd_get_device( SCSIInstance *scsiInstance, hard_disk_file **disk ) |
| 259 | { |
| 260 | SCSIHd *our_this = SCSIThis( &SCSIClassHARDDISK, scsiInstance ); |
| 261 | *disk = our_this->disk; |
| 262 | } |
| 263 | |
| 264 | static void scsihd_set_device( SCSIInstance *scsiInstance, hard_disk_file *disk ) |
| 265 | { |
| 266 | SCSIHd *our_this = SCSIThis( &SCSIClassHARDDISK, scsiInstance ); |
| 267 | our_this->disk = disk; |
| 268 | } |
| 269 | |
| 270 | static int scsihd_dispatch(int operation, void *file, INT64 intparm, void *ptrparm) |
| 271 | { |
| 240 | 272 | switch (operation) |
| 241 | 273 | { |
| 242 | 274 | case SCSIOP_EXEC_COMMAND: |
| 243 | | return scsihd_exec_command((SCSIHd *)file, ptrparm); |
| 244 | | break; |
| 275 | return scsihd_exec_command( file, ptrparm ); |
| 245 | 276 | |
| 246 | 277 | case SCSIOP_READ_DATA: |
| 247 | | scsihd_read_data((SCSIHd *)file, intparm, ptrparm); |
| 248 | | break; |
| 278 | scsihd_read_data( file, ptrparm, intparm ); |
| 279 | return 0; |
| 249 | 280 | |
| 250 | 281 | case SCSIOP_WRITE_DATA: |
| 251 | | scsihd_write_data((SCSIHd *)file, intparm, ptrparm); |
| 252 | | break; |
| 282 | scsihd_write_data( file, ptrparm, intparm ); |
| 283 | return 0; |
| 253 | 284 | |
| 254 | 285 | case SCSIOP_ALLOC_INSTANCE: |
| 255 | | instance = (SCSIHd *)malloc_or_die(sizeof(SCSIHd)); |
| 286 | SCSIBase( &SCSIClassHARDDISK, operation, file, intparm, ptrparm ); |
| 287 | scsihd_alloc_instance( *((SCSIInstance **) ptrparm), intparm ); |
| 288 | return 0; |
| 256 | 289 | |
| 257 | | instance->lba = 0; |
| 258 | | instance->blocks = 0; |
| 259 | | |
| 260 | | memset(instance->inquiry_buffer, 0, sizeof(instance->inquiry_buffer)); |
| 261 | | instance->inquiry_buffer[0] = 0x00; // device is direct-access (e.g. hard disk) |
| 262 | | instance->inquiry_buffer[1] = 0x00; // media is not removable |
| 263 | | instance->inquiry_buffer[2] = 0x05; // device complies with SPC-3 standard |
| 264 | | instance->inquiry_buffer[3] = 0x02; // response data format = SPC-3 standard |
| 265 | | // Apple HD SC setup utility needs to see this |
| 266 | | strcpy((char *)&instance->inquiry_buffer[8], " SEAGATE"); |
| 267 | | strcpy((char *)&instance->inquiry_buffer[16], " ST225N"); |
| 268 | | strcpy((char *)&instance->inquiry_buffer[32], "1.0"); |
| 269 | | |
| 270 | | #ifdef MESS |
| 271 | | instance->disk = mess_hd_get_hard_disk_file_by_number(intparm); |
| 272 | | #else |
| 273 | | instance->disk = hard_disk_open(get_disk_handle(intparm)); |
| 274 | | |
| 275 | | if (!instance->disk) |
| 276 | | { |
| 277 | | logerror("SCSIHD: no HD found!\n"); |
| 278 | | } |
| 279 | | #endif |
| 280 | | |
| 281 | | ptrresult = file; |
| 282 | | *ptrresult = instance; |
| 283 | | break; |
| 284 | | |
| 285 | 290 | case SCSIOP_DELETE_INSTANCE: |
| 286 | | free(file); |
| 291 | scsihd_delete_instance( file ); |
| 287 | 292 | break; |
| 288 | 293 | |
| 289 | 294 | case SCSIOP_GET_DEVICE: |
| 290 | | ptrresult = (void **)ptrparm; |
| 291 | | instance = (SCSIHd *)file; |
| 292 | | *ptrresult = instance->disk; |
| 293 | | break; |
| 295 | scsihd_get_device( file, ptrparm ); |
| 296 | return 0; |
| 294 | 297 | |
| 295 | 298 | case SCSIOP_SET_DEVICE: |
| 296 | | instance = (SCSIHd *)file; |
| 297 | | instance->disk = (hard_disk_file *)ptrparm; |
| 298 | | break; |
| 299 | | |
| 300 | | |
| 301 | | case SCSIOP_GET_INQUIRY_BUFFER: |
| 302 | | ptrresult = (void **)ptrparm; |
| 303 | | instance = (SCSIHd *)file; |
| 304 | | |
| 305 | | if( intparm > sizeof( instance->inquiry_buffer ) ) |
| 306 | | { |
| 307 | | *ptrresult = NULL; |
| 308 | | } |
| 309 | | else |
| 310 | | { |
| 311 | | *ptrresult = instance->inquiry_buffer; |
| 312 | | } |
| 313 | | break; |
| 299 | scsihd_set_device( file, ptrparm ); |
| 300 | return 0; |
| 314 | 301 | } |
| 315 | 302 | |
| 316 | | return 0; |
| 303 | return SCSIBase( &SCSIClassHARDDISK, operation, file, intparm, ptrparm ); |
| 317 | 304 | } |
| 305 | |
| 306 | SCSIClass SCSIClassHARDDISK = |
| 307 | { |
| 308 | &SCSIClassDevice, |
| 309 | scsihd_dispatch, |
| 310 | sizeof( SCSIHd ) |
| 311 | }; |
src/emu/machine/scsicd.c
| r1215 | r1216 | |
| 4 | 4 | |
| 5 | 5 | ***************************************************************************/ |
| 6 | 6 | |
| 7 | | #include "driver.h" |
| 7 | #include "state.h" |
| 8 | 8 | #include "scsidev.h" |
| 9 | 9 | #include "cdrom.h" |
| 10 | 10 | #include "sound/cdda.h" |
| r1215 | r1216 | |
| 14 | 14 | |
| 15 | 15 | typedef struct |
| 16 | 16 | { |
| 17 | | UINT32 lba, blocks, last_lba, bytes_per_sector, num_subblocks, cur_subblock, play_err_flag; |
| 18 | | int last_command, last_retval; |
| 17 | UINT32 lba; |
| 18 | UINT32 blocks; |
| 19 | UINT32 last_lba; |
| 20 | UINT32 bytes_per_sector; |
| 21 | UINT32 num_subblocks; |
| 22 | UINT32 cur_subblock; |
| 23 | UINT32 play_err_flag; |
| 19 | 24 | cdrom_file *cdrom; |
| 20 | | UINT8 last_packet[16]; |
| 21 | | UINT8 inquiry_buffer[96]; |
| 22 | 25 | } SCSICd; |
| 23 | 26 | |
| 24 | | |
| 25 | 27 | static void phys_frame_to_msf(int phys_frame, int *m, int *s, int *f) |
| 26 | 28 | { |
| 27 | 29 | *m = phys_frame / (60*75); |
| r1215 | r1216 | |
| 33 | 35 | |
| 34 | 36 | // scsicd_exec_command |
| 35 | 37 | // |
| 36 | | // Execute a SCSI command passed in via pCmdBuf. |
| 38 | // Execute a SCSI command. |
| 37 | 39 | |
| 38 | | int scsicd_exec_command(SCSICd *our_this, UINT8 *pCmdBuf) |
| 40 | static int scsicd_exec_command( SCSIInstance *scsiInstance, UINT8 *statusCode ) |
| 39 | 41 | { |
| 42 | UINT8 *command; |
| 43 | int commandLength; |
| 44 | SCSICd *our_this = SCSIThis( &SCSIClassCDROM, scsiInstance ); |
| 45 | |
| 40 | 46 | cdrom_file *cdrom = our_this->cdrom; |
| 41 | | int retval = 12, trk, temp; |
| 42 | 47 | int cddanum; |
| 48 | int trk; |
| 43 | 49 | |
| 44 | | // remember the last command for the data transfer phase |
| 45 | | our_this->last_command = pCmdBuf[0]; |
| 50 | SCSIGetCommand( scsiInstance, &command, &commandLength ); |
| 46 | 51 | |
| 47 | | // remember the actual command packet too |
| 48 | | memcpy(our_this->last_packet, pCmdBuf, 16); |
| 52 | switch ( command[0] ) |
| 53 | { |
| 54 | case 0x03: // REQUEST SENSE |
| 55 | SCSISetPhase( scsiInstance, SCSI_PHASE_DATAIN ); |
| 56 | return SCSILengthFromUINT8( &command[ 4 ] ); |
| 49 | 57 | |
| 50 | | switch (our_this->last_command) |
| 51 | | { |
| 52 | | case 0: // TEST UNIT READY |
| 53 | | retval = 0; |
| 54 | | break; |
| 55 | | case 3: // REQUEST SENSE |
| 58 | case 0x12: // INQUIRY |
| 56 | 59 | logerror("SCSICD: REQUEST SENSE\n"); |
| 60 | SCSISetPhase( scsiInstance, SCSI_PHASE_DATAIN ); |
| 61 | return SCSILengthFromUINT8( &command[ 4 ] ); |
| 57 | 62 | |
| 58 | | temp = pCmdBuf[5]<<8 | pCmdBuf[4]; |
| 59 | | if (temp < 18) |
| 60 | | { |
| 61 | | retval = temp; |
| 62 | | } |
| 63 | | else |
| 64 | | { |
| 65 | | retval = 18; |
| 66 | | } |
| 67 | | break; |
| 68 | | case 0x12: // INQUIRY |
| 69 | | retval = pCmdBuf[4]; |
| 70 | | break; |
| 71 | | case 0x15: // MODE SELECT (6) |
| 72 | | logerror("SCSICD: MODE SELECT (6) length %x control %x\n", pCmdBuf[4], pCmdBuf[5]); |
| 73 | | retval = 0x18; |
| 74 | | break; |
| 75 | | case 0x1a: // MODE SENSE |
| 76 | | retval = 8; |
| 77 | | break; |
| 78 | | case 0x1b: // START/STOP UNIT |
| 63 | case 0x15: // MODE SELECT(6) |
| 64 | logerror("SCSICD: MODE SELECT(6) length %x control %x\n", command[4], command[5]); |
| 65 | SCSISetPhase( scsiInstance, SCSI_PHASE_DATAOUT ); |
| 66 | return SCSILengthFromUINT8( &command[ 4 ] ); |
| 67 | |
| 68 | case 0x1a: // MODE SENSE(6) |
| 69 | SCSISetPhase( scsiInstance, SCSI_PHASE_DATAIN ); |
| 70 | return SCSILengthFromUINT8( &command[ 4 ] ); |
| 71 | |
| 72 | case 0x1b: // START STOP UNIT |
| 79 | 73 | cddanum = cdda_num_from_cdrom(cdrom); |
| 80 | 74 | if (cddanum != -1) |
| 75 | { |
| 81 | 76 | cdda_stop_audio(cddanum); |
| 82 | | retval = 0; |
| 83 | | break; |
| 84 | | case 0x25: // READ CD-ROM CAPACITY |
| 85 | | retval = 8; |
| 86 | | break; |
| 87 | | case 0x28: // READ (10 byte) |
| 88 | | cddanum = cdda_num_from_cdrom(cdrom); |
| 89 | | if (cddanum != -1) |
| 90 | | cdda_stop_audio(cddanum); |
| 91 | | our_this->lba = pCmdBuf[2]<<24 | pCmdBuf[3]<<16 | pCmdBuf[4]<<8 | pCmdBuf[5]; |
| 92 | | our_this->blocks = pCmdBuf[7]<<8 | pCmdBuf[8]; |
| 77 | } |
| 78 | SCSISetPhase( scsiInstance, SCSI_PHASE_STATUS ); |
| 79 | return 0; |
| 93 | 80 | |
| 94 | | retval = our_this->blocks * our_this->bytes_per_sector; |
| 81 | case 0x1e: // PREVENT ALLOW MEDIUM REMOVAL |
| 82 | SCSISetPhase( scsiInstance, SCSI_PHASE_STATUS ); |
| 83 | return 0; |
| 95 | 84 | |
| 85 | case 0x25: // READ CAPACITY |
| 86 | SCSISetPhase( scsiInstance, SCSI_PHASE_DATAIN ); |
| 87 | return 8; |
| 88 | |
| 89 | case 0x28: // READ(10) |
| 90 | |
| 91 | our_this->lba = command[2]<<24 | command[3]<<16 | command[4]<<8 | command[5]; |
| 92 | our_this->blocks = SCSILengthFromUINT16( &command[7] ); |
| 93 | |
| 94 | logerror("SCSICD: READ(10) at LBA %x for %d blocks (%d bytes)\n", our_this->lba, our_this->blocks, our_this->blocks * our_this->bytes_per_sector); |
| 95 | |
| 96 | 96 | if (our_this->num_subblocks > 1) |
| 97 | 97 | { |
| 98 | 98 | our_this->cur_subblock = our_this->lba % our_this->num_subblocks; |
| r1215 | r1216 | |
| 103 | 103 | our_this->cur_subblock = 0; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | | /* convert physical frame to CHD */ |
| 107 | | if (cdrom) |
| 106 | cddanum = cdda_num_from_cdrom(cdrom); |
| 107 | if (cddanum != -1) |
| 108 | 108 | { |
| 109 | | if (cddanum != -1) |
| 110 | | cdda_stop_audio(cddanum); |
| 109 | cdda_stop_audio(cddanum); |
| 111 | 110 | } |
| 112 | 111 | |
| 113 | | logerror("SCSICD: READ (10) at LBA %x for %d blocks (%d bytes)\n", our_this->lba, our_this->blocks, retval); |
| 114 | | break; |
| 115 | | case 0x42: // READ SUB-CHANNEL |
| 116 | | // logerror("SCSICD: READ SUB-CHANNEL type %d\n", pCmdBuf[3]); |
| 117 | | retval = 16; |
| 118 | | break; |
| 119 | | case 0x43: // READ TOC |
| 112 | SCSISetPhase( scsiInstance, SCSI_PHASE_DATAIN ); |
| 113 | return our_this->blocks * our_this->bytes_per_sector; |
| 114 | |
| 115 | case 0x42: // READ SUB-CHANNEL |
| 116 | // logerror("SCSICD: READ SUB-CHANNEL type %d\n", command[3]); |
| 117 | SCSISetPhase( scsiInstance, SCSI_PHASE_DATAIN ); |
| 118 | return SCSILengthFromUINT16( &command[ 7 ] ); |
| 119 | |
| 120 | case 0x43: // READ TOC |
| 120 | 121 | { |
| 121 | | int start_trk = pCmdBuf[6]; |
| 122 | int start_trk = command[6]; |
| 122 | 123 | int end_trk = cdrom_get_last_track(cdrom); |
| 123 | | int allocation_length = pCmdBuf[7]<<8 | pCmdBuf[8]; |
| 124 | int length; |
| 125 | int allocation_length = SCSILengthFromUINT16( &command[ 7 ] ); |
| 124 | 126 | |
| 125 | 127 | if( start_trk == 0 ) |
| 126 | 128 | { |
| r1215 | r1216 | |
| 131 | 133 | end_trk = start_trk; |
| 132 | 134 | } |
| 133 | 135 | |
| 134 | | retval = 4 + ( 8 * ( ( end_trk - start_trk ) + 1 ) ); |
| 135 | | if( retval > allocation_length ) |
| 136 | length = 4 + ( 8 * ( ( end_trk - start_trk ) + 1 ) ); |
| 137 | if( length > allocation_length ) |
| 136 | 138 | { |
| 137 | | retval = allocation_length; |
| 139 | length = allocation_length; |
| 138 | 140 | } |
| 139 | | else if( retval < 4 ) |
| 141 | else if( length < 4 ) |
| 140 | 142 | { |
| 141 | | retval = 4; |
| 143 | length = 4; |
| 142 | 144 | } |
| 143 | 145 | |
| 144 | 146 | cddanum = cdda_num_from_cdrom(cdrom); |
| 145 | 147 | if (cddanum != -1) |
| 148 | { |
| 146 | 149 | cdda_stop_audio(cddanum); |
| 147 | | break; |
| 150 | } |
| 151 | |
| 152 | SCSISetPhase( scsiInstance, SCSI_PHASE_DATAIN ); |
| 153 | return length; |
| 148 | 154 | } |
| 149 | | case 0x45: // PLAY AUDIO (10 byte) |
| 150 | | our_this->lba = pCmdBuf[2]<<24 | pCmdBuf[3]<<16 | pCmdBuf[4]<<8 | pCmdBuf[5]; |
| 151 | | our_this->blocks = pCmdBuf[7]<<8 | pCmdBuf[8]; |
| 155 | case 0x45: // PLAY AUDIO(10) |
| 156 | our_this->lba = command[2]<<24 | command[3]<<16 | command[4]<<8 | command[5]; |
| 157 | our_this->blocks = SCSILengthFromUINT16( &command[7] ); |
| 152 | 158 | |
| 153 | 159 | // special cases: lba of 0 means MSF of 00:02:00 |
| 154 | 160 | if (our_this->lba == 0) |
| r1215 | r1216 | |
| 160 | 166 | logerror("SCSICD: play audio from current not implemented!\n"); |
| 161 | 167 | } |
| 162 | 168 | |
| 163 | | logerror("SCSICD: PLAY AUDIO (10) at LBA %x for %x blocks\n", our_this->lba, our_this->blocks); |
| 169 | logerror("SCSICD: PLAY AUDIO(10) at LBA %x for %x blocks\n", our_this->lba, our_this->blocks); |
| 164 | 170 | |
| 165 | 171 | trk = cdrom_get_track(cdrom, our_this->lba); |
| 166 | 172 | |
| r1215 | r1216 | |
| 176 | 182 | logerror("SCSICD: track is NOT audio!\n"); |
| 177 | 183 | our_this->play_err_flag = 1; |
| 178 | 184 | } |
| 179 | | retval = 0; |
| 180 | | break; |
| 181 | | case 0x48: // PLAY AUDIO TRACK/INDEX |
| 185 | |
| 186 | SCSISetPhase( scsiInstance, SCSI_PHASE_STATUS ); |
| 187 | return 0; |
| 188 | |
| 189 | case 0x48: // PLAY AUDIO TRACK/INDEX |
| 182 | 190 | // be careful: tracks here are zero-based, but the SCSI command |
| 183 | 191 | // uses the real CD track number which is 1-based! |
| 184 | | our_this->lba = cdrom_get_track_start(cdrom, pCmdBuf[4]-1); |
| 185 | | our_this->blocks = cdrom_get_track_start(cdrom, pCmdBuf[7]-1) - our_this->lba; |
| 186 | | if (pCmdBuf[4] > pCmdBuf[7]) |
| 192 | our_this->lba = cdrom_get_track_start(cdrom, command[4]-1); |
| 193 | our_this->blocks = cdrom_get_track_start(cdrom, command[7]-1) - our_this->lba; |
| 194 | if (command[4] > command[7]) |
| 187 | 195 | { |
| 188 | 196 | our_this->blocks = 0; |
| 189 | 197 | } |
| 190 | 198 | |
| 191 | | if (pCmdBuf[4] == pCmdBuf[7]) |
| 199 | if (command[4] == command[7]) |
| 192 | 200 | { |
| 193 | | our_this->blocks = cdrom_get_track_start(cdrom, pCmdBuf[4]) - our_this->lba; |
| 201 | our_this->blocks = cdrom_get_track_start(cdrom, command[4]) - our_this->lba; |
| 194 | 202 | } |
| 195 | 203 | |
| 196 | 204 | if (our_this->blocks && cdrom) |
| r1215 | r1216 | |
| 200 | 208 | cdda_start_audio(cddanum, our_this->lba, our_this->blocks); |
| 201 | 209 | } |
| 202 | 210 | |
| 203 | | logerror("SCSICD: PLAY AUDIO T/I: strk %d idx %d etrk %d idx %d frames %d\n", pCmdBuf[4], pCmdBuf[5], pCmdBuf[7], pCmdBuf[8], our_this->blocks); |
| 204 | | retval = 0; |
| 205 | | break; |
| 206 | | case 0x4b: // PAUSE/RESUME |
| 211 | logerror("SCSICD: PLAY AUDIO T/I: strk %d idx %d etrk %d idx %d frames %d\n", command[4], command[5], command[7], command[8], our_this->blocks); |
| 212 | SCSISetPhase( scsiInstance, SCSI_PHASE_STATUS ); |
| 213 | return 0; |
| 214 | |
| 215 | case 0x4b: // PAUSE/RESUME |
| 207 | 216 | if (cdrom) |
| 208 | 217 | { |
| 209 | 218 | cddanum = cdda_num_from_cdrom(cdrom); |
| 210 | 219 | if (cddanum != -1) |
| 211 | | cdda_pause_audio(cddanum, (pCmdBuf[8] & 0x01) ^ 0x01); |
| 220 | cdda_pause_audio(cddanum, (command[8] & 0x01) ^ 0x01); |
| 212 | 221 | } |
| 213 | 222 | |
| 214 | | logerror("SCSICD: PAUSE/RESUME: %s\n", pCmdBuf[8]&1 ? "RESUME" : "PAUSE"); |
| 215 | | retval = 0; |
| 216 | | break; |
| 217 | | case 0x55: // MODE SELECT |
| 218 | | logerror("SCSICD: MODE SELECT length %x control %x\n", pCmdBuf[7]<<8 | pCmdBuf[8], pCmdBuf[1]); |
| 219 | | retval = 0x18; |
| 220 | | break; |
| 221 | | case 0x5a: // MODE SENSE |
| 222 | | retval = 0x18; |
| 223 | | break; |
| 224 | | case 0xa5: // PLAY AUDIO (12 byte) |
| 225 | | our_this->lba = pCmdBuf[2]<<24 | pCmdBuf[3]<<16 | pCmdBuf[4]<<8 | pCmdBuf[5]; |
| 226 | | our_this->blocks = pCmdBuf[6]<<24 | pCmdBuf[7]<<16 | pCmdBuf[8]<<8 | pCmdBuf[9]; |
| 223 | logerror("SCSICD: PAUSE/RESUME: %s\n", command[8]&1 ? "RESUME" : "PAUSE"); |
| 224 | SCSISetPhase( scsiInstance, SCSI_PHASE_STATUS ); |
| 225 | return 0; |
| 227 | 226 | |
| 227 | case 0x55: // MODE SELECT(10) |
| 228 | logerror("SCSICD: MODE SELECT length %x control %x\n", command[7]<<8 | command[8], command[1]); |
| 229 | SCSISetPhase( scsiInstance, SCSI_PHASE_DATAOUT ); |
| 230 | return SCSILengthFromUINT16( &command[ 7 ] ); |
| 231 | |
| 232 | case 0x5a: // MODE SENSE(10) |
| 233 | SCSISetPhase( scsiInstance, SCSI_PHASE_DATAIN ); |
| 234 | return SCSILengthFromUINT16( &command[ 7 ] ); |
| 235 | |
| 236 | case 0xa5: // PLAY AUDIO(12) |
| 237 | our_this->lba = command[2]<<24 | command[3]<<16 | command[4]<<8 | command[5]; |
| 238 | our_this->blocks = command[6]<<24 | command[7]<<16 | command[8]<<8 | command[9]; |
| 239 | |
| 228 | 240 | // special cases: lba of 0 means MSF of 00:02:00 |
| 229 | 241 | if (our_this->lba == 0) |
| 230 | 242 | { |
| r1215 | r1216 | |
| 235 | 247 | logerror("SCSICD: play audio from current not implemented!\n"); |
| 236 | 248 | } |
| 237 | 249 | |
| 238 | | logerror("SCSICD: PLAY AUDIO (12) at LBA %x for %x blocks\n", our_this->lba, our_this->blocks); |
| 250 | logerror("SCSICD: PLAY AUDIO(12) at LBA %x for %x blocks\n", our_this->lba, our_this->blocks); |
| 239 | 251 | |
| 240 | 252 | trk = cdrom_get_track(cdrom, our_this->lba); |
| 241 | 253 | |
| r1215 | r1216 | |
| 251 | 263 | logerror("SCSICD: track is NOT audio!\n"); |
| 252 | 264 | our_this->play_err_flag = 1; |
| 253 | 265 | } |
| 254 | | retval = 0; |
| 255 | | break; |
| 256 | | case 0xa8: // READ (12 byte) |
| 257 | | cddanum = cdda_num_from_cdrom(cdrom); |
| 258 | | if (cddanum != -1) |
| 259 | | cdda_stop_audio(cddanum); |
| 260 | | our_this->lba = pCmdBuf[2]<<24 | pCmdBuf[3]<<16 | pCmdBuf[4]<<8 | pCmdBuf[5]; |
| 261 | | our_this->blocks = pCmdBuf[7]<<16 | pCmdBuf[8]<<8 | pCmdBuf[9]; |
| 266 | SCSISetPhase( scsiInstance, SCSI_PHASE_STATUS ); |
| 267 | return 0; |
| 262 | 268 | |
| 263 | | retval = our_this->blocks * our_this->bytes_per_sector; |
| 269 | case 0xa8: // READ(12) |
| 270 | our_this->lba = command[2]<<24 | command[3]<<16 | command[4]<<8 | command[5]; |
| 271 | our_this->blocks = command[7]<<16 | command[8]<<8 | command[9]; |
| 264 | 272 | |
| 273 | logerror("SCSICD: READ(12) at LBA %x for %x blocks (%x bytes)\n", our_this->lba, our_this->blocks, our_this->blocks * our_this->bytes_per_sector); |
| 274 | |
| 265 | 275 | if (our_this->num_subblocks > 1) |
| 266 | 276 | { |
| 267 | 277 | our_this->cur_subblock = our_this->lba % our_this->num_subblocks; |
| r1215 | r1216 | |
| 272 | 282 | our_this->cur_subblock = 0; |
| 273 | 283 | } |
| 274 | 284 | |
| 275 | | /* convert physical frame to CHD */ |
| 276 | | if (cdrom) |
| 285 | cddanum = cdda_num_from_cdrom(cdrom); |
| 286 | if (cddanum != -1) |
| 277 | 287 | { |
| 278 | 288 | cdda_stop_audio(cddanum); |
| 279 | 289 | } |
| 280 | 290 | |
| 281 | | logerror("SCSICD: READ (12) at LBA %x for %x blocks (%x bytes)\n", our_this->lba, our_this->blocks, retval); |
| 282 | | break; |
| 283 | | case 0xbb: // SET CD SPEED |
| 284 | | logerror("SCSICD: SET CD SPEED to %d kbytes/sec.\n", pCmdBuf[2]<<8 | pCmdBuf[3]); |
| 285 | | break; |
| 291 | SCSISetPhase( scsiInstance, SCSI_PHASE_DATAIN ); |
| 292 | return our_this->blocks * our_this->bytes_per_sector; |
| 293 | |
| 294 | case 0xbb: // SET CD SPEED |
| 295 | logerror("SCSICD: SET CD SPEED to %d kbytes/sec.\n", command[2]<<8 | command[3]); |
| 296 | SCSISetPhase( scsiInstance, SCSI_PHASE_STATUS ); |
| 297 | return 0; |
| 298 | |
| 286 | 299 | default: |
| 287 | | logerror("SCSICD: unknown SCSI command %x!\n", our_this->last_command); |
| 288 | | break; |
| 300 | return SCSIBase( &SCSIClassCDROM, SCSIOP_EXEC_COMMAND, scsiInstance, 0, NULL ); |
| 289 | 301 | } |
| 290 | | |
| 291 | | our_this->last_retval = retval; |
| 292 | | return retval; |
| 293 | 302 | } |
| 294 | 303 | |
| 295 | 304 | // scsicd_read_data |
| 296 | 305 | // |
| 297 | 306 | // Read data from the device resulting from the execution of a command |
| 298 | 307 | |
| 299 | | void scsicd_read_data(SCSICd *our_this, int bytes, UINT8 *pData) |
| 308 | static void scsicd_read_data( SCSIInstance *scsiInstance, UINT8 *data, int dataLength ) |
| 300 | 309 | { |
| 310 | UINT8 *command; |
| 311 | int commandLength; |
| 312 | SCSICd *our_this = SCSIThis( &SCSIClassCDROM, scsiInstance ); |
| 313 | |
| 301 | 314 | int i; |
| 302 | 315 | UINT32 last_phys_frame; |
| 303 | | UINT8 *fifo = our_this->last_packet; |
| 304 | 316 | cdrom_file *cdrom = our_this->cdrom; |
| 305 | 317 | UINT32 temp; |
| 306 | 318 | UINT8 tmp_buffer[2048]; |
| 307 | 319 | int cddanum; |
| 308 | 320 | |
| 309 | | switch (our_this->last_command) |
| 321 | SCSIGetCommand( scsiInstance, &command, &commandLength ); |
| 322 | |
| 323 | switch ( command[0] ) |
| 310 | 324 | { |
| 311 | | case 0x03: // REQUEST SENSE |
| 325 | case 0x03: // REQUEST SENSE |
| 312 | 326 | logerror("SCSICD: Reading REQUEST SENSE data\n"); |
| 313 | 327 | |
| 314 | | pData[0] = 0x71; // deferred error |
| 328 | memset( data, 0, dataLength ); |
| 315 | 329 | |
| 316 | | if (our_this->last_retval == -1) |
| 317 | | { |
| 318 | | our_this->last_retval = 16; |
| 319 | | } |
| 330 | data[0] = 0x71; // deferred error |
| 320 | 331 | |
| 321 | | for (i = 1; i < our_this->last_retval; i++) |
| 322 | | { |
| 323 | | pData[i] = 0; |
| 324 | | } |
| 325 | | |
| 326 | 332 | cddanum = cdda_num_from_cdrom(cdrom); |
| 327 | 333 | if (cddanum != -1 && cdda_audio_active(cddanum)) |
| 328 | 334 | { |
| 329 | | pData[12] = 0x00; |
| 330 | | pData[13] = 0x11; // AUDIO PLAY OPERATION IN PROGRESS |
| 335 | data[12] = 0x00; |
| 336 | data[13] = 0x11; // AUDIO PLAY OPERATION IN PROGRESS |
| 331 | 337 | } |
| 332 | 338 | else if (our_this->play_err_flag) |
| 333 | 339 | { |
| 334 | 340 | our_this->play_err_flag = 0; |
| 335 | | pData[12] = 0x64; // ILLEGAL MODE FOR THIS TRACK |
| 336 | | pData[13] = 0x00; |
| 341 | data[12] = 0x64; // ILLEGAL MODE FOR THIS TRACK |
| 342 | data[13] = 0x00; |
| 337 | 343 | } |
| 338 | 344 | // (else 00/00 means no error to report) |
| 339 | 345 | break; |
| 340 | 346 | |
| 341 | | case 0x12: // INQUIRY |
| 342 | | i = sizeof( our_this->inquiry_buffer ); |
| 343 | | if( i > bytes ) |
| 344 | | { |
| 345 | | i = bytes; |
| 346 | | } |
| 347 | | |
| 348 | | memcpy( pData, our_this->inquiry_buffer, i ); |
| 349 | | |
| 350 | | if( i < bytes ) |
| 351 | | { |
| 352 | | memset( pData + i, 0, bytes - i ); |
| 353 | | } |
| 354 | | |
| 347 | case 0x12: // INQUIRY |
| 348 | memset( data, 0, dataLength ); |
| 349 | data[0] = 0x05; // device is present, device is CD/DVD (MMC-3) |
| 350 | data[1] = 0x80; // media is removable |
| 351 | data[2] = 0x05; // device complies with SPC-3 standard |
| 352 | data[3] = 0x02; // response data format = SPC-3 standard |
| 353 | // some Konami games freak out if this isn't "Sony", so we'll lie |
| 354 | // this is the actual drive on my Nagano '98 board |
| 355 | strcpy((char *)&data[8], "Sony"); |
| 356 | strcpy((char *)&data[16], "CDU-76S"); |
| 357 | strcpy((char *)&data[32], "1.0"); |
| 355 | 358 | break; |
| 356 | 359 | |
| 357 | | case 0x25: // READ CAPACITY |
| 360 | case 0x25: // READ CAPACITY |
| 358 | 361 | logerror("SCSICD: READ CAPACITY\n"); |
| 359 | 362 | |
| 360 | 363 | temp = cdrom_get_track_start(cdrom, 0xaa); |
| 361 | 364 | temp--; // return the last used block on the disc |
| 362 | 365 | |
| 363 | | pData[0] = (temp>>24) & 0xff; |
| 364 | | pData[1] = (temp>>16) & 0xff; |
| 365 | | pData[2] = (temp>>8) & 0xff; |
| 366 | | pData[3] = (temp & 0xff); |
| 367 | | pData[4] = 0; |
| 368 | | pData[5] = 0; |
| 369 | | pData[6] = (our_this->bytes_per_sector>>8)&0xff; |
| 370 | | pData[7] = (our_this->bytes_per_sector & 0xff); |
| 366 | data[0] = (temp>>24) & 0xff; |
| 367 | data[1] = (temp>>16) & 0xff; |
| 368 | data[2] = (temp>>8) & 0xff; |
| 369 | data[3] = (temp & 0xff); |
| 370 | data[4] = 0; |
| 371 | data[5] = 0; |
| 372 | data[6] = (our_this->bytes_per_sector>>8)&0xff; |
| 373 | data[7] = (our_this->bytes_per_sector & 0xff); |
| 371 | 374 | break; |
| 372 | 375 | |
| 373 | | case 0x28: // READ (10 byte) |
| 374 | | case 0xa8: // READ (12 byte) |
| 375 | | logerror("SCSICD: read %x bytes, \n", bytes); |
| 376 | case 0x28: // READ(10) |
| 377 | case 0xa8: // READ(12) |
| 378 | logerror("SCSICD: read %x dataLength, \n", dataLength); |
| 376 | 379 | if ((our_this->cdrom) && (our_this->blocks)) |
| 377 | 380 | { |
| 378 | | while (bytes > 0) |
| 381 | while (dataLength > 0) |
| 379 | 382 | { |
| 380 | 383 | if (!cdrom_read_data(our_this->cdrom, our_this->lba, tmp_buffer, CD_TRACK_MODE1)) |
| 381 | 384 | { |
| r1215 | r1216 | |
| 384 | 387 | |
| 385 | 388 | logerror("True LBA: %d, buffer half: %d\n", our_this->lba, our_this->cur_subblock * our_this->bytes_per_sector); |
| 386 | 389 | |
| 387 | | memcpy(pData, &tmp_buffer[our_this->cur_subblock * our_this->bytes_per_sector], our_this->bytes_per_sector); |
| 390 | memcpy(data, &tmp_buffer[our_this->cur_subblock * our_this->bytes_per_sector], our_this->bytes_per_sector); |
| 388 | 391 | |
| 389 | 392 | our_this->cur_subblock++; |
| 390 | 393 | if (our_this->cur_subblock >= our_this->num_subblocks) |
| r1215 | r1216 | |
| 396 | 399 | } |
| 397 | 400 | |
| 398 | 401 | our_this->last_lba = our_this->lba; |
| 399 | | bytes -= our_this->bytes_per_sector; |
| 400 | | pData += our_this->bytes_per_sector; |
| 402 | dataLength -= our_this->bytes_per_sector; |
| 403 | data += our_this->bytes_per_sector; |
| 401 | 404 | } |
| 402 | 405 | } |
| 403 | 406 | break; |
| 404 | 407 | |
| 405 | | case 0x42: // READ SUB-CHANNEL |
| 406 | | switch (fifo[3]) |
| 408 | case 0x42: // READ SUB-CHANNEL |
| 409 | switch (command[3]) |
| 407 | 410 | { |
| 408 | 411 | case 1: // return current position |
| 409 | 412 | { |
| r1215 | r1216 | |
| 415 | 418 | return; |
| 416 | 419 | } |
| 417 | 420 | |
| 418 | | logerror("SCSICD: READ SUB-CHANNEL Time = %x, SUBQ = %x\n", fifo[1], fifo[2]); |
| 421 | logerror("SCSICD: READ SUB-CHANNEL Time = %x, SUBQ = %x\n", command[1], command[2]); |
| 419 | 422 | |
| 420 | | msf = fifo[1] & 0x2; |
| 423 | msf = command[1] & 0x2; |
| 421 | 424 | |
| 422 | 425 | cddanum = cdda_num_from_cdrom(cdrom); |
| 423 | 426 | audio_active = cddanum != -1 && cdda_audio_active(cddanum); |
| r1215 | r1216 | |
| 425 | 428 | { |
| 426 | 429 | if (cdda_audio_paused(cddanum)) |
| 427 | 430 | { |
| 428 | | pData[1] = 0x12; // audio is paused |
| 431 | data[1] = 0x12; // audio is paused |
| 429 | 432 | } |
| 430 | 433 | else |
| 431 | 434 | { |
| 432 | | pData[1] = 0x11; // audio in progress |
| 435 | data[1] = 0x11; // audio in progress |
| 433 | 436 | } |
| 434 | 437 | } |
| 435 | 438 | else |
| 436 | 439 | { |
| 437 | 440 | if (cddanum != -1 && cdda_audio_ended(cddanum)) |
| 438 | 441 | { |
| 439 | | pData[1] = 0x13; // ended successfully |
| 442 | data[1] = 0x13; // ended successfully |
| 440 | 443 | } |
| 441 | 444 | else |
| 442 | 445 | { |
| 443 | | // pData[1] = 0x14; // stopped due to error |
| 444 | | pData[1] = 0x15; // No current audio status to return |
| 446 | // data[1] = 0x14; // stopped due to error |
| 447 | data[1] = 0x15; // No current audio status to return |
| 445 | 448 | } |
| 446 | 449 | } |
| 447 | 450 | |
| r1215 | r1216 | |
| 455 | 458 | our_this->last_lba = 0; |
| 456 | 459 | } |
| 457 | 460 | |
| 458 | | pData[2] = 0; |
| 459 | | pData[3] = 12; // data length |
| 460 | | pData[4] = 0x01; // sub-channel format code |
| 461 | | pData[5] = 0x10 | (audio_active ? 0 : 4); |
| 462 | | pData[6] = cdrom_get_track(cdrom, our_this->last_lba) + 1; // track |
| 463 | | pData[7] = 0; // index |
| 461 | data[2] = 0; |
| 462 | data[3] = 12; // data length |
| 463 | data[4] = 0x01; // sub-channel format code |
| 464 | data[5] = 0x10 | (audio_active ? 0 : 4); |
| 465 | data[6] = cdrom_get_track(cdrom, our_this->last_lba) + 1; // track |
| 466 | data[7] = 0; // index |
| 464 | 467 | |
| 465 | 468 | last_phys_frame = our_this->last_lba; |
| 466 | 469 | |
| r1215 | r1216 | |
| 468 | 471 | { |
| 469 | 472 | int m,s,f; |
| 470 | 473 | phys_frame_to_msf(last_phys_frame, &m, &s, &f); |
| 471 | | pData[8] = 0; |
| 472 | | pData[9] = m; |
| 473 | | pData[10] = s; |
| 474 | | pData[11] = f; |
| 474 | data[8] = 0; |
| 475 | data[9] = m; |
| 476 | data[10] = s; |
| 477 | data[11] = f; |
| 475 | 478 | } |
| 476 | 479 | else |
| 477 | 480 | { |
| 478 | | pData[8] = last_phys_frame>>24; |
| 479 | | pData[9] = (last_phys_frame>>16)&0xff; |
| 480 | | pData[10] = (last_phys_frame>>8)&0xff; |
| 481 | | pData[11] = last_phys_frame&0xff; |
| 481 | data[8] = last_phys_frame>>24; |
| 482 | data[9] = (last_phys_frame>>16)&0xff; |
| 483 | data[10] = (last_phys_frame>>8)&0xff; |
| 484 | data[11] = last_phys_frame&0xff; |
| 482 | 485 | } |
| 483 | 486 | |
| 484 | | last_phys_frame -= cdrom_get_track_start(cdrom, pData[6] - 1); |
| 487 | last_phys_frame -= cdrom_get_track_start(cdrom, data[6] - 1); |
| 485 | 488 | |
| 486 | 489 | if (msf) |
| 487 | 490 | { |
| 488 | 491 | int m,s,f; |
| 489 | 492 | phys_frame_to_msf(last_phys_frame, &m, &s, &f); |
| 490 | | pData[12] = 0; |
| 491 | | pData[13] = m; |
| 492 | | pData[14] = s; |
| 493 | | pData[15] = f; |
| 493 | data[12] = 0; |
| 494 | data[13] = m; |
| 495 | data[14] = s; |
| 496 | data[15] = f; |
| 494 | 497 | } |
| 495 | 498 | else |
| 496 | 499 | { |
| 497 | | pData[12] = last_phys_frame>>24; |
| 498 | | pData[13] = (last_phys_frame>>16)&0xff; |
| 499 | | pData[14] = (last_phys_frame>>8)&0xff; |
| 500 | | pData[15] = last_phys_frame&0xff; |
| 500 | data[12] = last_phys_frame>>24; |
| 501 | data[13] = (last_phys_frame>>16)&0xff; |
| 502 | data[14] = (last_phys_frame>>8)&0xff; |
| 503 | data[15] = last_phys_frame&0xff; |
| 501 | 504 | } |
| 502 | 505 | break; |
| 503 | 506 | } |
| 504 | 507 | default: |
| 505 | | logerror("SCSICD: Unknown subchannel type %d requested\n", fifo[3]); |
| 508 | logerror("SCSICD: Unknown subchannel type %d requested\n", command[3]); |
| 506 | 509 | } |
| 507 | 510 | break; |
| 508 | 511 | |
| 509 | | case 0x43: // READ TOC |
| 512 | case 0x43: // READ TOC |
| 510 | 513 | /* |
| 511 | 514 | Track numbers are problematic here: 0 = lead-in, 0xaa = lead-out. |
| 512 | 515 | That makes sense in terms of how real-world CDs are referred to, but |
| 513 | 516 | our internal routines for tracks use "0" as track 1. That probably |
| 514 | 517 | should be fixed... |
| 515 | 518 | */ |
| 516 | | logerror("SCSICD: READ TOC, format = %d time=%d\n", fifo[2]&0xf,(fifo[1]>>1)&1); |
| 517 | | switch (fifo[2] & 0x0f) |
| 519 | logerror("SCSICD: READ TOC, format = %d time=%d\n", command[2]&0xf,(command[1]>>1)&1); |
| 520 | switch (command[2] & 0x0f) |
| 518 | 521 | { |
| 519 | 522 | case 0: // normal |
| 520 | 523 | { |
| r1215 | r1216 | |
| 525 | 528 | int dptr; |
| 526 | 529 | UINT32 tstart; |
| 527 | 530 | |
| 528 | | start_trk = fifo[6]; |
| 531 | start_trk = command[6]; |
| 529 | 532 | if( start_trk == 0 ) |
| 530 | 533 | { |
| 531 | 534 | start_trk = 1; |
| r1215 | r1216 | |
| 537 | 540 | // the returned TOC DATA LENGTH must be the full amount, |
| 538 | 541 | // regardless of how much we're able to pass back due to in_len |
| 539 | 542 | dptr = 0; |
| 540 | | pData[dptr++] = (len>>8) & 0xff; |
| 541 | | pData[dptr++] = (len & 0xff); |
| 542 | | pData[dptr++] = 1; |
| 543 | | pData[dptr++] = end_trk; |
| 543 | data[dptr++] = (len>>8) & 0xff; |
| 544 | data[dptr++] = (len & 0xff); |
| 545 | data[dptr++] = 1; |
| 546 | data[dptr++] = end_trk; |
| 544 | 547 | |
| 545 | 548 | if( start_trk == 0xaa ) |
| 546 | 549 | { |
| 547 | 550 | end_trk = 0xaa; |
| 548 | 551 | } |
| 549 | 552 | |
| 550 | | in_len = fifo[7]<<8 | fifo[8]; |
| 553 | in_len = command[7]<<8 | command[8]; |
| 551 | 554 | |
| 552 | 555 | for (i = start_trk; i <= end_trk; i++) |
| 553 | 556 | { |
| r1215 | r1216 | |
| 562 | 565 | break; |
| 563 | 566 | } |
| 564 | 567 | |
| 565 | | pData[dptr++] = 0; |
| 566 | | pData[dptr++] = cdrom_get_adr_control(cdrom, cdrom_track); |
| 567 | | pData[dptr++] = i; |
| 568 | | pData[dptr++] = 0; |
| 568 | data[dptr++] = 0; |
| 569 | data[dptr++] = cdrom_get_adr_control(cdrom, cdrom_track); |
| 570 | data[dptr++] = i; |
| 571 | data[dptr++] = 0; |
| 569 | 572 | |
| 570 | 573 | tstart = cdrom_get_track_start(cdrom, cdrom_track); |
| 571 | | if ((fifo[1]&2)>>1) |
| 574 | if ((command[1]&2)>>1) |
| 572 | 575 | tstart = lba_to_msf(tstart); |
| 573 | | pData[dptr++] = (tstart>>24) & 0xff; |
| 574 | | pData[dptr++] = (tstart>>16) & 0xff; |
| 575 | | pData[dptr++] = (tstart>>8) & 0xff; |
| 576 | | pData[dptr++] = (tstart & 0xff); |
| 576 | data[dptr++] = (tstart>>24) & 0xff; |
| 577 | data[dptr++] = (tstart>>16) & 0xff; |
| 578 | data[dptr++] = (tstart>>8) & 0xff; |
| 579 | data[dptr++] = (tstart & 0xff); |
| 577 | 580 | } |
| 578 | 581 | } |
| 579 | 582 | break; |
| 580 | 583 | default: |
| 581 | | logerror("SCSICD: Unhandled READ TOC format %d\n", fifo[2]&0xf); |
| 584 | logerror("SCSICD: Unhandled READ TOC format %d\n", command[2]&0xf); |
| 582 | 585 | break; |
| 583 | 586 | } |
| 584 | 587 | break; |
| 585 | 588 | |
| 586 | | case 0x48: // PLAY AUDIO TRACK/INDEX |
| 587 | | break; |
| 589 | case 0x1a: // MODE SENSE(6) |
| 590 | case 0x5a: // MODE SENSE(10) |
| 591 | logerror("SCSICD: MODE SENSE page code = %x, PC = %x\n", command[2] & 0x3f, (command[2]&0xc0)>>6); |
| 588 | 592 | |
| 589 | | case 0x5a: // MODE SENSE |
| 590 | | logerror("SCSICD: MODE SENSE page code = %x, PC = %x\n", fifo[2] & 0x3f, (fifo[2]&0xc0)>>6); |
| 591 | | |
| 592 | | switch (fifo[2] & 0x3f) |
| 593 | switch (command[2] & 0x3f) |
| 593 | 594 | { |
| 594 | 595 | case 0xe: // CD Audio control page |
| 595 | | pData[0] = 0x8e; // page E, parameter is savable |
| 596 | | pData[1] = 0x0e; // page length |
| 597 | | pData[2] = 0x04; // IMMED = 1, SOTC = 0 |
| 598 | | pData[3] = pData[4] = pData[5] = pData[6] = pData[7] = 0; // reserved |
| 596 | data[0] = 0x8e; // page E, parameter is savable |
| 597 | data[1] = 0x0e; // page length |
| 598 | data[2] = 0x04; // IMMED = 1, SOTC = 0 |
| 599 | data[3] = data[4] = data[5] = data[6] = data[7] = 0; // reserved |
| 599 | 600 | |
| 600 | 601 | // connect each audio channel to 1 output port |
| 601 | | pData[8] = 1; |
| 602 | | pData[10] = 2; |
| 603 | | pData[12] = 4; |
| 604 | | pData[14] = 8; |
| 602 | data[8] = 1; |
| 603 | data[10] = 2; |
| 604 | data[12] = 4; |
| 605 | data[14] = 8; |
| 605 | 606 | |
| 606 | 607 | // indicate max volume |
| 607 | | pData[9] = pData[11] = pData[13] = pData[15] = 0xff; |
| 608 | data[9] = data[11] = data[13] = data[15] = 0xff; |
| 608 | 609 | break; |
| 609 | 610 | |
| 610 | 611 | default: |
| 611 | | logerror("SCSICD: MODE SENSE unknown page %x\n", fifo[2] & 0x3f); |
| 612 | logerror("SCSICD: MODE SENSE unknown page %x\n", command[2] & 0x3f); |
| 612 | 613 | break; |
| 613 | 614 | } |
| 614 | 615 | break; |
| 616 | |
| 617 | default: |
| 618 | SCSIBase( &SCSIClassCDROM, SCSIOP_READ_DATA, scsiInstance, dataLength, data ); |
| 619 | break; |
| 615 | 620 | } |
| 616 | 621 | } |
| 617 | 622 | |
| r1215 | r1216 | |
| 619 | 624 | // |
| 620 | 625 | // Write data to the CD-ROM device as part of the execution of a command |
| 621 | 626 | |
| 622 | | void scsicd_write_data(SCSICd *our_this, int bytes, UINT8 *pData) |
| 627 | static void scsicd_write_data( SCSIInstance *scsiInstance, UINT8 *data, int dataLength ) |
| 623 | 628 | { |
| 624 | | switch (our_this->last_command) |
| 629 | UINT8 *command; |
| 630 | int commandLength; |
| 631 | SCSICd *our_this = SCSIThis( &SCSIClassCDROM, scsiInstance ); |
| 632 | SCSIGetCommand( scsiInstance, &command, &commandLength ); |
| 633 | |
| 634 | switch (command[ 0 ]) |
| 625 | 635 | { |
| 626 | | case 0x15: // MODE SELECT (6) |
| 627 | | case 0x55: // MODE SELECT |
| 628 | | logerror("SCSICD: MODE SELECT page %x\n", pData[0] & 0x3f); |
| 636 | case 0x15: // MODE SELECT(6) |
| 637 | case 0x55: // MODE SELECT(10) |
| 638 | logerror("SCSICD: MODE SELECT page %x\n", data[0] & 0x3f); |
| 629 | 639 | |
| 630 | | switch (pData[0] & 0x3f) |
| 640 | switch (data[0] & 0x3f) |
| 631 | 641 | { |
| 632 | 642 | case 0x0: // vendor-specific |
| 633 | 643 | // check for SGI extension to force 512-byte blocks |
| 634 | | if ((pData[3] == 8) && (pData[10] == 2)) |
| 644 | if ((data[3] == 8) && (data[10] == 2)) |
| 635 | 645 | { |
| 636 | 646 | logerror("SCSICD: Experimental SGI 512-byte block extension enabled\n"); |
| 637 | 647 | |
| r1215 | r1216 | |
| 645 | 655 | break; |
| 646 | 656 | |
| 647 | 657 | case 0xe: // audio page |
| 648 | | logerror("Ch 0 route: %x vol: %x\n", pData[8], pData[9]); |
| 649 | | logerror("Ch 1 route: %x vol: %x\n", pData[10], pData[11]); |
| 650 | | logerror("Ch 2 route: %x vol: %x\n", pData[12], pData[13]); |
| 651 | | logerror("Ch 3 route: %x vol: %x\n", pData[14], pData[15]); |
| 658 | logerror("Ch 0 route: %x vol: %x\n", data[8], data[9]); |
| 659 | logerror("Ch 1 route: %x vol: %x\n", data[10], data[11]); |
| 660 | logerror("Ch 2 route: %x vol: %x\n", data[12], data[13]); |
| 661 | logerror("Ch 3 route: %x vol: %x\n", data[14], data[15]); |
| 652 | 662 | break; |
| 653 | 663 | } |
| 654 | 664 | break; |
| 665 | |
| 666 | default: |
| 667 | SCSIBase( &SCSIClassCDROM, SCSIOP_WRITE_DATA, scsiInstance, dataLength, data ); |
| 668 | break; |
| 655 | 669 | } |
| 656 | 670 | } |
| 657 | 671 | |
| 658 | | int scsicd_dispatch(int operation, void *file, INT64 intparm, UINT8 *ptrparm) |
| 672 | static void scsicd_alloc_instance( SCSIInstance *scsiInstance, int diskId ) |
| 659 | 673 | { |
| 660 | | SCSICd *instance; |
| 661 | | void **ptrresult; |
| 674 | SCSICd *our_this = SCSIThis( &SCSIClassCDROM, scsiInstance ); |
| 662 | 675 | |
| 676 | our_this->lba = 0; |
| 677 | our_this->blocks = 0; |
| 678 | our_this->last_lba = 0; |
| 679 | our_this->bytes_per_sector = 2048; |
| 680 | our_this->num_subblocks = 1; |
| 681 | our_this->cur_subblock = 0; |
| 682 | our_this->play_err_flag = 0; |
| 683 | |
| 684 | state_save_register_item( "scsicd", diskId, our_this->lba ); |
| 685 | state_save_register_item( "scsicd", diskId, our_this->blocks ); |
| 686 | state_save_register_item( "scsicd", diskId, our_this->last_lba ); |
| 687 | state_save_register_item( "scsicd", diskId, our_this->bytes_per_sector ); |
| 688 | state_save_register_item( "scsicd", diskId, our_this->num_subblocks ); |
| 689 | state_save_register_item( "scsicd", diskId, our_this->cur_subblock ); |
| 690 | state_save_register_item( "scsicd", diskId, our_this->play_err_flag ); |
| 691 | |
| 692 | #ifdef MESS |
| 693 | our_this->cdrom = mess_cd_get_cdrom_file_by_number( diskId ); |
| 694 | #else |
| 695 | our_this->cdrom = cdrom_open(get_disk_handle( diskId )); |
| 696 | |
| 697 | if (!our_this->cdrom) |
| 698 | { |
| 699 | logerror("SCSICD: no CD found!\n"); |
| 700 | } |
| 701 | #endif |
| 702 | } |
| 703 | |
| 704 | static void scsicd_delete_instance( SCSIInstance *scsiInstance ) |
| 705 | { |
| 706 | #ifndef MESS |
| 707 | SCSICd *our_this = SCSIThis( &SCSIClassCDROM, scsiInstance ); |
| 708 | if( our_this->cdrom ) |
| 709 | { |
| 710 | cdrom_close( our_this->cdrom ); |
| 711 | } |
| 712 | #endif |
| 713 | } |
| 714 | |
| 715 | static void scsicd_get_device( SCSIInstance *scsiInstance, cdrom_file **cdrom ) |
| 716 | { |
| 717 | SCSICd *our_this = SCSIThis( &SCSIClassCDROM, scsiInstance ); |
| 718 | *cdrom = our_this->cdrom; |
| 719 | } |
| 720 | |
| 721 | static void scsicd_set_device( SCSIInstance *scsiInstance, cdrom_file *cdrom ) |
| 722 | { |
| 723 | SCSICd *our_this = SCSIThis( &SCSIClassCDROM, scsiInstance ); |
| 724 | our_this->cdrom = cdrom; |
| 725 | } |
| 726 | |
| 727 | static int scsicd_dispatch(int operation, void *file, INT64 intparm, void *ptrparm) |
| 728 | { |
| 663 | 729 | switch (operation) |
| 664 | 730 | { |
| 665 | 731 | case SCSIOP_EXEC_COMMAND: |
| 666 | | return scsicd_exec_command((SCSICd *)file, ptrparm); |
| 667 | | break; |
| 732 | return scsicd_exec_command( file, ptrparm ); |
| 668 | 733 | |
| 669 | 734 | case SCSIOP_READ_DATA: |
| 670 | | scsicd_read_data((SCSICd *)file, intparm, ptrparm); |
| 671 | | break; |
| 735 | scsicd_read_data( file, ptrparm, intparm ); |
| 736 | return 0; |
| 672 | 737 | |
| 673 | 738 | case SCSIOP_WRITE_DATA: |
| 674 | | scsicd_write_data((SCSICd *)file, intparm, ptrparm); |
| 675 | | break; |
| 739 | scsicd_write_data( file, ptrparm, intparm ); |
| 740 | return 0; |
| 676 | 741 | |
| 677 | 742 | case SCSIOP_ALLOC_INSTANCE: |
| 678 | | instance = (SCSICd *)malloc_or_die(sizeof(SCSICd)); |
| 743 | SCSIBase( &SCSIClassCDROM, operation, file, intparm, ptrparm ); |
| 744 | scsicd_alloc_instance( *((SCSIInstance **) ptrparm), intparm ); |
| 745 | return 0; |
| 679 | 746 | |
| 680 | | instance->lba = 0; |
| 681 | | instance->blocks = 0; |
| 682 | | instance->bytes_per_sector = 2048; |
| 683 | | instance->num_subblocks = 1; |
| 684 | | instance->cur_subblock = 0; |
| 685 | | instance->play_err_flag = 0; |
| 686 | | |
| 687 | | memset(instance->inquiry_buffer, 0, sizeof(instance->inquiry_buffer)); |
| 688 | | instance->inquiry_buffer[0] = 0x05; // device is present, device is CD/DVD (MMC-3) |
| 689 | | instance->inquiry_buffer[1] = 0x80; // media is removable |
| 690 | | instance->inquiry_buffer[2] = 0x05; // device complies with SPC-3 standard |
| 691 | | instance->inquiry_buffer[3] = 0x02; // response data format = SPC-3 standard |
| 692 | | // some Konami games freak out if this isn't "Sony", so we'll lie |
| 693 | | // this is the actual drive on my Nagano '98 board |
| 694 | | strcpy((char *)&instance->inquiry_buffer[8], "Sony"); |
| 695 | | strcpy((char *)&instance->inquiry_buffer[16], "CDU-76S"); |
| 696 | | strcpy((char *)&instance->inquiry_buffer[32], "1.0"); |
| 697 | | |
| 698 | | #ifdef MESS |
| 699 | | instance->cdrom = mess_cd_get_cdrom_file_by_number(intparm); |
| 700 | | #else |
| 701 | | instance->cdrom = cdrom_open(get_disk_handle(intparm)); |
| 702 | | |
| 703 | | if (!instance->cdrom) |
| 704 | | { |
| 705 | | logerror("SCSICD: no CD found!\n"); |
| 706 | | } |
| 707 | | #endif |
| 708 | | |
| 709 | | ptrresult = file; |
| 710 | | *ptrresult = instance; |
| 711 | | break; |
| 712 | | |
| 713 | 747 | case SCSIOP_DELETE_INSTANCE: |
| 714 | | instance = (SCSICd *)file; |
| 715 | | if( instance->cdrom ) |
| 716 | | { |
| 717 | | #ifndef MESS |
| 718 | | cdrom_close(instance->cdrom); |
| 719 | | #endif |
| 720 | | instance->cdrom = (cdrom_file *)NULL; |
| 721 | | } |
| 722 | | free(file); |
| 748 | scsicd_delete_instance( file ); |
| 723 | 749 | break; |
| 724 | 750 | |
| 725 | 751 | case SCSIOP_GET_DEVICE: |
| 726 | | ptrresult = (void **)ptrparm; |
| 727 | | instance = (SCSICd *)file; |
| 728 | | *ptrresult = instance->cdrom; |
| 729 | | break; |
| 752 | scsicd_get_device( file, ptrparm ); |
| 753 | return 0; |
| 730 | 754 | |
| 731 | 755 | case SCSIOP_SET_DEVICE: |
| 732 | | instance = (SCSICd *)file; |
| 733 | | instance->cdrom = (cdrom_file *)ptrparm; |
| 734 | | break; |
| 735 | | |
| 736 | | case SCSIOP_GET_INQUIRY_BUFFER: |
| 737 | | ptrresult = (void **)ptrparm; |
| 738 | | instance = (SCSICd *)file; |
| 739 | | |
| 740 | | if( intparm > sizeof( instance->inquiry_buffer ) ) |
| 741 | | { |
| 742 | | *ptrresult = NULL; |
| 743 | | } |
| 744 | | else |
| 745 | | { |
| 746 | | *ptrresult = instance->inquiry_buffer; |
| 747 | | } |
| 748 | | break; |
| 756 | scsicd_set_device( file, ptrparm ); |
| 757 | return 0; |
| 749 | 758 | } |
| 750 | 759 | |
| 751 | | return 0; |
| 760 | return SCSIBase( &SCSIClassCDROM, operation, file, intparm, ptrparm ); |
| 752 | 761 | } |
| 762 | |
| 763 | SCSIClass SCSIClassCDROM = |
| 764 | { |
| 765 | &SCSIClassDevice, |
| 766 | scsicd_dispatch, |
| 767 | sizeof( SCSICd ) |
| 768 | }; |