src/mess/drivers/x1.c
| r5558 | r5559 | |
| 569 | 569 | // fatalerror("Data written to the DMA space"); |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | | /* TODO: still not yet perfect */ |
| 572 | /* TODO: apparently this is for the alternative PCG mode */ |
| 573 | #if 0 |
| 573 | 574 | static UINT16 check_pcg_addr(running_machine *machine) |
| 574 | 575 | { |
| 575 | 576 | if(colorram[0x7ff] & 0x20) return 0x7ff; |
| r5558 | r5559 | |
| 579 | 580 | |
| 580 | 581 | return 0x3ff; |
| 581 | 582 | } |
| 583 | #endif |
| 582 | 584 | |
| 585 | static UINT8 pcg_write_addr; |
| 586 | |
| 587 | static READ8_HANDLER( x1_pcg_r ) |
| 588 | { |
| 589 | #if 0 |
| 590 | int addr; |
| 591 | UINT8 *BIOS_ROM = memory_region(space->machine, "cgrom"); |
| 592 | static UINT8 bios_offset,res; |
| 593 | |
| 594 | addr = (offset & 0x300) >> 8; |
| 595 | |
| 596 | if(addr == 0) |
| 597 | { |
| 598 | /* TODO: requires an offset conversion */ |
| 599 | res = BIOS_ROM[0x1800+bios_offset+(pcg_write_addr*0x10)]; |
| 600 | |
| 601 | bios_offset++; |
| 602 | bios_offset&=0xf; |
| 603 | return res; |
| 604 | } |
| 605 | else |
| 606 | { |
| 607 | //... |
| 608 | } |
| 609 | #endif |
| 610 | |
| 611 | return mame_rand(space->machine); |
| 612 | } |
| 613 | |
| 583 | 614 | static WRITE8_HANDLER( x1_pcg_w ) |
| 584 | 615 | { |
| 585 | 616 | int addr,pcg_offset; |
| r5558 | r5559 | |
| 596 | 627 | |
| 597 | 628 | if(addr == 0) |
| 598 | 629 | { |
| 599 | | /* FIXME: this is wrong (it's for the BIOS GFX ROM, read only) */ |
| 600 | | /* maybe data actually? */ |
| 601 | | pcg_index[0] = data*8; |
| 602 | | pcg_index[1] = data*8; |
| 603 | | pcg_index[2] = data*8; |
| 630 | /* NOP */ |
| 631 | logerror("Warning: write to the BIOS PCG area! %04x %02x\n",offset,data); |
| 604 | 632 | } |
| 605 | 633 | else |
| 606 | 634 | { |
| r5558 | r5559 | |
| 610 | 638 | // } |
| 611 | 639 | // else |
| 612 | 640 | { |
| 613 | | used_pcg_addr = videoram[check_pcg_addr(space->machine)]*8; |
| 641 | used_pcg_addr = pcg_write_addr*8; |
| 614 | 642 | pcg_offset = (pcg_index[addr-1]+used_pcg_addr) & 0x7ff; |
| 615 | 643 | pcg_offset+=((addr-1)*0x800); |
| 616 | 644 | PCG_RAM[pcg_offset] = data; |
| r5558 | r5559 | |
| 687 | 715 | else if(offset >= 0x0704 && offset <= 0x0707) { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x0704); } |
| 688 | 716 | else if(offset == 0x0e03) { return x1_rom_r(space, 0); } |
| 689 | 717 | else if(offset >= 0x0ff8 && offset <= 0x0fff) { return x1_fdc_r(space, offset-0xff8); } |
| 718 | else if(offset >= 0x1400 && offset <= 0x17ff) { return x1_pcg_r(space, offset-0x1400); } |
| 690 | 719 | else if(offset >= 0x1900 && offset <= 0x19ff) { return sub_io_r(space, 0); } |
| 691 | 720 | else if(offset >= 0x1a00 && offset <= 0x1aff) { return ppi8255_r(devtag_get_device(space->machine, "ppi8255_0"), (offset-0x1a00) & 3); } |
| 692 | 721 | else if(offset >= 0x1b00 && offset <= 0x1bff) { return ay8910_r(devtag_get_device(space->machine, "ay"), 0); } |
| r5558 | r5559 | |
| 730 | 759 | else if(offset >= 0x1fa8 && offset <= 0x1fab) { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x1fa8,data); } |
| 731 | 760 | else if(offset >= 0x1fd0 && offset <= 0x1fdf) { x1_scrn_w(space,0,data); } |
| 732 | 761 | else if(offset >= 0x2000 && offset <= 0x2fff) { colorram[offset-0x2000] = data; } |
| 733 | | else if(offset >= 0x3000 && offset <= 0x3fff) { videoram[offset-0x3000] = data; } |
| 762 | else if(offset >= 0x3000 && offset <= 0x3fff) { videoram[offset-0x3000] = pcg_write_addr = data; } |
| 734 | 763 | else if(offset >= 0x4000 && offset <= 0xffff) { gfx_bitmap_ram[offset-0x4000+(scrn_reg.gfx_bank*0xc000)] = data; } |
| 735 | 764 | else |
| 736 | 765 | { |
| r5558 | r5559 | |
| 747 | 776 | else if(offset >= 0x0704 && offset <= 0x0707) { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x0704); } |
| 748 | 777 | else if(offset == 0x0e03) { return x1_rom_r(space, 0); } |
| 749 | 778 | else if(offset >= 0x0ff8 && offset <= 0x0fff) { return x1_fdc_r(space, offset-0xff8); } |
| 779 | else if(offset >= 0x1400 && offset <= 0x17ff) { return x1_pcg_r(space, offset-0x1400); } |
| 750 | 780 | else if(offset >= 0x1900 && offset <= 0x19ff) { return sub_io_r(space, 0); } |
| 751 | 781 | else if(offset >= 0x1a00 && offset <= 0x1aff) { return ppi8255_r(devtag_get_device(space->machine, "ppi8255_0"), (offset-0x1a00) & 3); } |
| 752 | 782 | else if(offset >= 0x1b00 && offset <= 0x1bff) { return ay8910_r(devtag_get_device(space->machine, "ay"), 0); } |
| r5558 | r5559 | |
| 791 | 821 | else if(offset >= 0x1fa8 && offset <= 0x1fab) { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x1fa8,data); } |
| 792 | 822 | else if(offset >= 0x1fd0 && offset <= 0x1fdf) { x1_scrn_w(space,0,data); } |
| 793 | 823 | else if(offset >= 0x2000 && offset <= 0x2fff) { colorram[offset-0x2000] = data; } |
| 794 | | else if(offset >= 0x3000 && offset <= 0x3fff) { videoram[offset-0x3000] = data; } |
| 824 | else if(offset >= 0x3000 && offset <= 0x3fff) { videoram[offset-0x3000] = pcg_write_addr = data; } |
| 795 | 825 | else if(offset >= 0x4000 && offset <= 0xffff) { gfx_bitmap_ram[offset-0x4000+(scrn_reg.gfx_bank*0xc000)] = data; } |
| 796 | 826 | else |
| 797 | 827 | { |