src/mess/drivers/x1.c
| r5510 | r5511 | |
| 12 | 12 | - Fix the interrupts (uses IM 2) |
| 13 | 13 | |
| 14 | 14 | per-game specific TODO: |
| 15 | | - 177 / Dragon Buster: fix the keyboard flags otherwise these doesn't boot |
| 16 | | - Dragon Buster: uses PCG + sets bitmap in a weird way; |
| 15 | - 177 / Dragon Buster: fix the keyboard flags otherwise these doesn't boot; |
| 16 | - Dragon Buster: Maybe the pcg tilemap uses scrolling and priorities are wrong; |
| 17 | 17 | - Shanghai: tests the ay8910 read regs, mouse/joystick perhaps? |
| 18 | | - Gaia: Hits a FDC drive assert; |
| 18 | - Gaia/Space Harrier: Hits the FDC drive assert, the latter boots but has heavy emulation |
| 19 | video/logic problems; |
| 19 | 20 | |
| 20 | 21 | ================================================================================================= |
| 21 | 22 | |
| r5510 | r5511 | |
| 198 | 199 | int pcg_bank = (colorram[x+(y*40*w)] & 0x20)>>4; |
| 199 | 200 | int region = (width+(height<<1)) & 3; |
| 200 | 201 | |
| 201 | | if(pcg_bank) |
| 202 | | { |
| 203 | | region = 4; |
| 204 | | width = 0; |
| 205 | | height = 0; |
| 206 | | } |
| 202 | if(pcg_bank) { region+= 4; } |
| 207 | 203 | else if(tile == 0) continue; //<- correct? |
| 208 | 204 | |
| 209 | 205 | if(color & 0x38) |
| r5510 | r5511 | |
| 316 | 312 | { |
| 317 | 313 | UINT8 *ROM = memory_region(space->machine, "maincpu"); |
| 318 | 314 | |
| 319 | | memory_set_bankptr(space->machine, 1, &ROM[0x00000]); |
| 315 | if(data) |
| 316 | memory_set_bankptr(space->machine, 1, &ROM[0x00000]); |
| 320 | 317 | } |
| 321 | 318 | |
| 322 | 319 | static WRITE8_HANDLER( rom_data_w ) |
| r5510 | r5511 | |
| 402 | 399 | break; |
| 403 | 400 | case 0x0ffc: |
| 404 | 401 | /* data & 3 = disk drive, TODO */ |
| 405 | | if(data & 3) |
| 406 | | fatalerror("FDC: Using more than 1 floppy disk drive!"); |
| 402 | //if(data & 3) |
| 403 | // fatalerror("FDC: Using more than 1 floppy disk drive!"); |
| 407 | 404 | wd17xx_set_drive(dev,0); |
| 408 | 405 | floppy_drive_set_motor_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 0), data & 0x80); |
| 409 | 406 | floppy_drive_set_ready_state(image_from_devtype_and_index(space->machine, IO_FLOPPY, 0), data & 0x80,0); |
| r5510 | r5511 | |
| 461 | 458 | if(addr == 0) |
| 462 | 459 | { |
| 463 | 460 | /* maybe data actually? */ |
| 464 | | pcg_index[0] = 0; |
| 465 | | pcg_index[1] = 0; |
| 466 | | pcg_index[2] = 0; |
| 461 | pcg_index[0] = data*8; |
| 462 | pcg_index[1] = data*8; |
| 463 | pcg_index[2] = data*8; |
| 467 | 464 | } |
| 468 | 465 | else |
| 469 | 466 | { |
| 470 | | pcg_offset = ((pcg_index[addr-1]*8)+(offset & 7)) & 0x7ff; |
| 467 | pcg_offset = (pcg_index[addr-1]) & 0x7ff; |
| 471 | 468 | pcg_offset+=((addr-1)*0x800); |
| 472 | 469 | PCG_RAM[pcg_offset] = data; |
| 473 | 470 | |
| 474 | 471 | pcg_offset &= 0x7ff; |
| 475 | 472 | |
| 476 | | gfx_element_mark_dirty(space->machine->gfx[2], pcg_offset >> 3); |
| 473 | gfx_element_mark_dirty(space->machine->gfx[4], pcg_offset >> 3); |
| 474 | gfx_element_mark_dirty(space->machine->gfx[5], pcg_offset >> 3); |
| 475 | gfx_element_mark_dirty(space->machine->gfx[6], pcg_offset >> 3); |
| 476 | gfx_element_mark_dirty(space->machine->gfx[7], pcg_offset >> 3); |
| 477 | 477 | |
| 478 | | if((offset & 7) == 7) |
| 479 | | pcg_index[addr-1]++; |
| 478 | pcg_index[addr-1]++; |
| 480 | 479 | } |
| 481 | 480 | } |
| 482 | 481 | |
| r5510 | r5511 | |
| 506 | 505 | AM_RANGE(0x1900, 0x19ff) AM_READWRITE(sub_io_r,sub_io_w) //sub port comms, mirrored |
| 507 | 506 | AM_RANGE(0x1a00, 0x1a03) AM_MIRROR(0xfc) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w) //8255, mirrored |
| 508 | 507 | AM_RANGE(0x1b00, 0x1bff) AM_DEVREADWRITE("ay", ay8910_r, ay8910_data_w) //PSG / ay-3-8910 data port |
| 509 | | // AM_RANGE(0x1b00, 0x1bff) AM_DEVWRITE("ay", ay8910_data_w) //PSG / ay-3-8910 data port |
| 510 | 508 | AM_RANGE(0x1c00, 0x1cff) AM_DEVWRITE("ay", ay8910_address_w) //PSG / ay-3-8910 reg port |
| 511 | 509 | AM_RANGE(0x1d00, 0x1dff) AM_READNOP AM_WRITE(rom_bank_1_w) //ROM/RAM bankswitch = ROM |
| 512 | 510 | AM_RANGE(0x1e00, 0x1eff) AM_WRITE(rom_bank_0_w) //ROM/RAM bankswitch = RAM |
| r5510 | r5511 | |
| 564 | 562 | 8*8 |
| 565 | 563 | }; |
| 566 | 564 | |
| 565 | static const gfx_layout x1_pcg_8x8 = |
| 566 | { |
| 567 | 8,8, |
| 568 | RGN_FRAC(1,3), |
| 569 | 3, |
| 570 | { RGN_FRAC(1,3),RGN_FRAC(2,3),RGN_FRAC(0,3) }, |
| 571 | { 0, 1, 2, 3, 4, 5, 6, 7 }, |
| 572 | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, |
| 573 | 8*8 |
| 574 | }; |
| 575 | |
| 576 | static const gfx_layout x1_pcg_8wx8 = |
| 577 | { |
| 578 | 16,8, |
| 579 | RGN_FRAC(1,3), |
| 580 | 3, |
| 581 | { RGN_FRAC(1,3),RGN_FRAC(2,3),RGN_FRAC(0,3) }, |
| 582 | { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7 }, |
| 583 | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, |
| 584 | 8*8 |
| 585 | }; |
| 586 | |
| 587 | static const gfx_layout x1_pcg_8x8w = |
| 588 | { |
| 589 | 8,16, |
| 590 | RGN_FRAC(1,3), |
| 591 | 3, |
| 592 | { RGN_FRAC(1,3),RGN_FRAC(2,3),RGN_FRAC(0,3) }, |
| 593 | { 0, 1, 2, 3, 4, 5, 6, 7 }, |
| 594 | { 0*8, 0*8, 1*8, 1*8, 2*8, 2*8, 3*8, 3*8, 4*8, 4*8, 5*8, 5*8, 6*8, 6*8, 7*8, 7*8 }, |
| 595 | 8*8 |
| 596 | }; |
| 597 | |
| 598 | static const gfx_layout x1_pcg_8wx8w = |
| 599 | { |
| 600 | 16,16, |
| 601 | RGN_FRAC(1,3), |
| 602 | 3, |
| 603 | { RGN_FRAC(1,3),RGN_FRAC(2,3),RGN_FRAC(0,3) }, |
| 604 | { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7 }, |
| 605 | { 0*8, 0*8, 1*8, 1*8, 2*8, 2*8, 3*8, 3*8, 4*8, 4*8, 5*8, 5*8, 6*8, 6*8, 7*8, 7*8 }, |
| 606 | 8*8 |
| 607 | }; |
| 608 | |
| 567 | 609 | static const gfx_layout x1_chars_16x16 = |
| 568 | 610 | { |
| 569 | 611 | 16,16, |
| r5510 | r5511 | |
| 575 | 617 | 16*16 |
| 576 | 618 | }; |
| 577 | 619 | |
| 578 | | static const gfx_layout x1_pcg_8x8 = |
| 579 | | { |
| 580 | | 8,8, |
| 581 | | RGN_FRAC(1,3), |
| 582 | | 3, |
| 583 | | { RGN_FRAC(2,3),RGN_FRAC(1,3),RGN_FRAC(0,3) }, |
| 584 | | { 0, 1, 2, 3, 4, 5, 6, 7 }, |
| 585 | | { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, |
| 586 | | 8*8 |
| 587 | | }; |
| 588 | | |
| 589 | 620 | /* TODO: separe the different x1 decodings accordingly */ |
| 590 | 621 | static GFXDECODE_START( x1 ) |
| 591 | 622 | GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8x8, 0, 0x40 ) |
| r5510 | r5511 | |
| 593 | 624 | GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8x8w, 0, 0x40 ) |
| 594 | 625 | GFXDECODE_ENTRY( "cgrom", 0x00000, x1_chars_8wx8w, 0, 0x40 ) |
| 595 | 626 | GFXDECODE_ENTRY( "pcg", 0x00000, x1_pcg_8x8, 0x80, 1 ) |
| 627 | GFXDECODE_ENTRY( "pcg", 0x00000, x1_pcg_8wx8, 0x80, 1 ) |
| 628 | GFXDECODE_ENTRY( "pcg", 0x00000, x1_pcg_8x8w, 0x80, 1 ) |
| 629 | GFXDECODE_ENTRY( "pcg", 0x00000, x1_pcg_8wx8w, 0x80, 1 ) |
| 596 | 630 | GFXDECODE_ENTRY( "cgrom", 0x01800, x1_chars_16x16, 0, 0x40 ) //only x1turboz uses this so far |
| 597 | 631 | GFXDECODE_ENTRY( "kanji", 0x27000, x1_chars_16x16, 0, 0x40 ) //needs to be checked when the ROM will be redumped |
| 598 | 632 | GFXDECODE_END |
| r5510 | r5511 | |
| 939 | 973 | memset(gfx_bitmap_ram,0x00,0xc000); |
| 940 | 974 | |
| 941 | 975 | for(i=0;i<0x1800;i++) |
| 976 | { |
| 942 | 977 | PCG_RAM[i] = 0; |
| 978 | } |
| 979 | |
| 980 | for(i=0;i<0x0400;i++) |
| 981 | { |
| 982 | gfx_element_mark_dirty(machine->gfx[4], i); |
| 983 | gfx_element_mark_dirty(machine->gfx[5], i); |
| 984 | gfx_element_mark_dirty(machine->gfx[6], i); |
| 985 | gfx_element_mark_dirty(machine->gfx[7], i); |
| 986 | } |
| 943 | 987 | } |
| 944 | 988 | |
| 945 | 989 | static void ctc0_interrupt(const device_config *device, int state) |