src/mess/drivers/pc8801.c
| r10081 | r10082 | |
| 23 | 23 | - 177: gameplay is too fast; |
| 24 | 24 | - Acro Jet: hangs waiting for an irq; |
| 25 | 25 | - Aggress: crashes after that it shows the title screen; |
| 26 | | - American Success: uses some ALU characteristics, might be a good test case; |
| 27 | 26 | - American Success: reads the light pen? |
| 28 | 27 | - Alphos: test case for text VRAM attributes; |
| 29 | 28 | - Alphos: text VRAM garbage during gameplay; |
| 30 | 29 | - Alphos: background is supposed to be blue? |
| 31 | 30 | - Bokosuka Wars: doesn't boot, floppy issue; |
| 31 | - Grobda: palette is ugly; |
| 32 | 32 | - Xevious: game is too fast |
| 33 | 33 | |
| 34 | 34 | Notes: |
| r10081 | r10082 | |
| 189 | 189 | #define N88BASIC_BASE 0x88000 |
| 190 | 190 | #define WRAM_BASE 0x00000 |
| 191 | 191 | #define GRAM_BASE 0xc0000 |
| 192 | #define ALU_BASE 0xa0000 |
| 192 | 193 | |
| 193 | 194 | static VIDEO_START( pc8801 ) |
| 194 | 195 | { |
| r10081 | r10082 | |
| 357 | 358 | ram[offset + bankw[2]] = data; |
| 358 | 359 | } |
| 359 | 360 | |
| 361 | static UINT8 alu_r(running_machine *machine, UINT16 ram_addr) |
| 362 | { |
| 363 | int i; |
| 364 | UINT8 *gvram = machine->region("maincpu")->base(); |
| 365 | UINT8 b,r,g; |
| 366 | |
| 367 | /* store data to ALU regs */ |
| 368 | for(i=0;i<3;i++) |
| 369 | { |
| 370 | gvram[ALU_BASE + i] = gvram[GRAM_BASE + i*0x4000 + ram_addr]; |
| 371 | } |
| 372 | |
| 373 | b = gvram[GRAM_BASE + ram_addr + 0x0000]; |
| 374 | r = gvram[GRAM_BASE + ram_addr + 0x4000]; |
| 375 | g = gvram[GRAM_BASE + ram_addr + 0x8000]; |
| 376 | if(!(alu_ctrl2 & 1)) { b^=0xff; } |
| 377 | if(!(alu_ctrl2 & 2)) { r^=0xff; } |
| 378 | if(!(alu_ctrl2 & 4)) { g^=0xff; } |
| 379 | |
| 380 | return b & r & g; |
| 381 | } |
| 382 | |
| 383 | static void alu_w(running_machine *machine, UINT16 ram_addr,UINT8 data) |
| 384 | { |
| 385 | int i; |
| 386 | UINT8 *gvram = machine->region("maincpu")->base(); |
| 387 | |
| 388 | switch(alu_ctrl2 & 0x30) // alu write mode |
| 389 | { |
| 390 | case 0x00: //logic operation |
| 391 | { |
| 392 | UINT8 logic_op; |
| 393 | |
| 394 | for(i=0;i<3;i++) |
| 395 | { |
| 396 | logic_op = (alu_ctrl1 & (0x11 << i)) >> i; |
| 397 | |
| 398 | switch(logic_op) |
| 399 | { |
| 400 | case 0x00: { gvram[GRAM_BASE + i*0x4000 + ram_addr] &= ~data; } break; |
| 401 | case 0x01: { gvram[GRAM_BASE + i*0x4000 + ram_addr] |= data; } break; |
| 402 | case 0x10: { gvram[GRAM_BASE + i*0x4000 + ram_addr] ^= data; } break; |
| 403 | case 0x11: break; // NOP |
| 404 | } |
| 405 | } |
| 406 | } |
| 407 | break; |
| 408 | |
| 409 | case 0x10: // restore data from ALU regs |
| 410 | { |
| 411 | for(i=0;i<3;i++) |
| 412 | gvram[GRAM_BASE + i*0x4000 + ram_addr] = gvram[ALU_BASE + i]; |
| 413 | } |
| 414 | break; |
| 415 | |
| 416 | case 0x20: // swap ALU reg 1 into R GVRAM |
| 417 | gvram[GRAM_BASE + 0x0000 + ram_addr] = gvram[ALU_BASE + 1]; |
| 418 | break; |
| 419 | |
| 420 | case 0x30: // swap ALU reg 0 into B GVRAM |
| 421 | gvram[GRAM_BASE + 0x4000 + ram_addr] = gvram[ALU_BASE + 0]; |
| 422 | break; |
| 423 | } |
| 424 | } |
| 425 | |
| 360 | 426 | static READ8_HANDLER( pc8801_mem_3_r ) |
| 361 | 427 | { |
| 362 | 428 | UINT8 *ram = space->machine->region("maincpu")->base(); |
| 363 | 429 | |
| 430 | if(bankr[3] == 0xa0000) |
| 431 | return alu_r(space->machine,(offset + bankr[3]) & 0x3fff); |
| 432 | |
| 364 | 433 | return ram[offset + bankr[3]]; |
| 365 | 434 | } |
| 366 | 435 | |
| r10081 | r10082 | |
| 368 | 437 | { |
| 369 | 438 | UINT8 *ram = space->machine->region("maincpu")->base(); |
| 370 | 439 | |
| 371 | | ram[offset + bankw[3]] = data; |
| 440 | if(bankw[3] == 0xa0000) |
| 441 | alu_w(space->machine,(offset + bankw[3]) & 0x3fff,data); |
| 442 | else |
| 443 | ram[offset + bankw[3]] = data; |
| 372 | 444 | } |
| 373 | 445 | |
| 374 | 446 | static READ8_HANDLER( pc8801_mem_4_r ) |
| 375 | 447 | { |
| 376 | 448 | UINT8 *ram = space->machine->region("maincpu")->base(); |
| 377 | 449 | |
| 450 | if(bankr[4] == 0xa3000) |
| 451 | return alu_r(space->machine,(offset + bankr[4]) & 0x3fff); |
| 452 | |
| 378 | 453 | return ram[offset + bankr[4]]; |
| 379 | 454 | } |
| 380 | 455 | |
| r10081 | r10082 | |
| 382 | 457 | { |
| 383 | 458 | UINT8 *ram = space->machine->region("maincpu")->base(); |
| 384 | 459 | |
| 385 | | ram[offset + bankw[4]] = data; |
| 460 | if(bankw[4] == 0xa3000) |
| 461 | alu_w(space->machine,(offset + bankw[4]) & 0x3fff,data); |
| 462 | else |
| 463 | ram[offset + bankw[4]] = data; |
| 386 | 464 | } |
| 387 | 465 | |
| 388 | 466 | static UINT32 pc8801_bankswitch_0_r(running_machine *machine) |
| r10081 | r10082 | |
| 454 | 532 | { |
| 455 | 533 | vram_sel = 3; |
| 456 | 534 | if(alu_ctrl2 & 0x80) |
| 457 | | return 0xa0000; // TODO: ALU hook-up |
| 535 | return ALU_BASE; |
| 458 | 536 | } |
| 459 | 537 | |
| 460 | 538 | if(vram_sel == 3) |
| r10081 | r10082 | |
| 469 | 547 | { |
| 470 | 548 | vram_sel = 3; |
| 471 | 549 | if(alu_ctrl2 & 0x80) |
| 472 | | return 0xa0000; // TODO: ALU hook-up |
| 550 | return ALU_BASE; |
| 473 | 551 | } |
| 474 | 552 | |
| 475 | 553 | if(vram_sel == 3) |
| r10081 | r10082 | |
| 484 | 562 | { |
| 485 | 563 | vram_sel = 3; |
| 486 | 564 | if(alu_ctrl2 & 0x80) |
| 487 | | return 0xa0000; // TODO: ALU hook-up |
| 565 | return ALU_BASE + 0x3000; |
| 488 | 566 | } |
| 489 | 567 | |
| 490 | 568 | if(vram_sel == 3) |
| r10081 | r10082 | |
| 504 | 582 | { |
| 505 | 583 | vram_sel = 3; |
| 506 | 584 | if(alu_ctrl2 & 0x80) |
| 507 | | return 0xa0000; // TODO: ALU hook-up |
| 585 | return ALU_BASE + 0x3000; |
| 508 | 586 | } |
| 509 | 587 | |
| 510 | 588 | if(vram_sel == 3) |
| r10081 | r10082 | |
| 821 | 899 | static WRITE8_HANDLER( pc8801_alu_ctrl1_w ) |
| 822 | 900 | { |
| 823 | 901 | alu_ctrl1 = data; |
| 902 | bankr[3] = pc8801_bankswitch_3_r(space->machine); |
| 903 | bankr[4] = pc8801_bankswitch_4_r(space->machine); |
| 904 | bankw[3] = pc8801_bankswitch_3_w(space->machine); |
| 905 | bankw[4] = pc8801_bankswitch_4_w(space->machine); |
| 824 | 906 | } |
| 825 | 907 | |
| 826 | 908 | static WRITE8_HANDLER( pc8801_alu_ctrl2_w ) |
| r10081 | r10082 | |
| 1390 | 1472 | cpu_set_input_line_vector(machine->device("fdccpu"), 0, 0); |
| 1391 | 1473 | |
| 1392 | 1474 | { |
| 1393 | | UINT8 *gvram = machine->region("maincpu")->base() + GRAM_BASE; |
| 1475 | UINT8 *gvram = machine->region("maincpu")->base(); |
| 1394 | 1476 | int i; |
| 1395 | 1477 | |
| 1396 | 1478 | for(i=0;i<0x10000;i++) |
| 1397 | | gvram[i] = 0x00; |
| 1479 | gvram[GRAM_BASE + i] = 0x00; |
| 1480 | |
| 1481 | for(i=0;i<3;i++) |
| 1482 | gvram[ALU_BASE + i] = 0x00; |
| 1398 | 1483 | } |
| 1399 | 1484 | |
| 1400 | 1485 | { |