Previous 15994 Revisions Next

r5559 Tuesday 1st September, 2009 at 22:28:51 UTC by Angelo Salese
[X1]: Improved the PCG uploading handling
[src/mess/drivers]x1.c

src/mess/drivers/x1.c
r5558r5559
569569   //   fatalerror("Data written to the DMA space");
570570}
571571
572/* TODO: still not yet perfect */
572/* TODO: apparently this is for the alternative PCG mode */
573#if 0
573574static UINT16 check_pcg_addr(running_machine *machine)
574575{
575576   if(colorram[0x7ff] & 0x20) return 0x7ff;
r5558r5559
579580
580581   return 0x3ff;
581582}
583#endif
582584
585static UINT8 pcg_write_addr;
586
587static 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
583614static WRITE8_HANDLER( x1_pcg_w )
584615{
585616   int addr,pcg_offset;
r5558r5559
596627
597628   if(addr == 0)
598629   {
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);
604632   }
605633   else
606634   {
r5558r5559
610638//      }
611639//      else
612640      {
613         used_pcg_addr = videoram[check_pcg_addr(space->machine)]*8;
641         used_pcg_addr = pcg_write_addr*8;
614642         pcg_offset = (pcg_index[addr-1]+used_pcg_addr) & 0x7ff;
615643         pcg_offset+=((addr-1)*0x800);
616644         PCG_RAM[pcg_offset] = data;
r5558r5559
687715   else if(offset >= 0x0704 && offset <= 0x0707)   { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x0704); }
688716   else if(offset == 0x0e03)                       { return x1_rom_r(space, 0); }
689717   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); }
690719   else if(offset >= 0x1900 && offset <= 0x19ff)   { return sub_io_r(space, 0); }
691720   else if(offset >= 0x1a00 && offset <= 0x1aff)   { return ppi8255_r(devtag_get_device(space->machine, "ppi8255_0"), (offset-0x1a00) & 3); }
692721   else if(offset >= 0x1b00 && offset <= 0x1bff)   { return ay8910_r(devtag_get_device(space->machine, "ay"), 0); }
r5558r5559
730759   else if(offset >= 0x1fa8 && offset <= 0x1fab)   { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x1fa8,data); }
731760   else if(offset >= 0x1fd0 && offset <= 0x1fdf)   { x1_scrn_w(space,0,data); }
732761   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; }
734763   else if(offset >= 0x4000 && offset <= 0xffff)   { gfx_bitmap_ram[offset-0x4000+(scrn_reg.gfx_bank*0xc000)] = data; }
735764   else
736765   {
r5558r5559
747776   else if(offset >= 0x0704 && offset <= 0x0707)   { return z80ctc_r(devtag_get_device(space->machine, "ctc"), offset-0x0704); }
748777   else if(offset == 0x0e03)                       { return x1_rom_r(space, 0); }
749778   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); }
750780   else if(offset >= 0x1900 && offset <= 0x19ff)   { return sub_io_r(space, 0); }
751781   else if(offset >= 0x1a00 && offset <= 0x1aff)   { return ppi8255_r(devtag_get_device(space->machine, "ppi8255_0"), (offset-0x1a00) & 3); }
752782   else if(offset >= 0x1b00 && offset <= 0x1bff)   { return ay8910_r(devtag_get_device(space->machine, "ay"), 0); }
r5558r5559
791821   else if(offset >= 0x1fa8 && offset <= 0x1fab)   { z80ctc_w(devtag_get_device(space->machine, "ctc"), offset-0x1fa8,data); }
792822   else if(offset >= 0x1fd0 && offset <= 0x1fdf)   { x1_scrn_w(space,0,data); }
793823   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; }
795825   else if(offset >= 0x4000 && offset <= 0xffff)   { gfx_bitmap_ram[offset-0x4000+(scrn_reg.gfx_bank*0xc000)] = data; }
796826   else
797827   {

Previous 15994 Revisions Next


© 1998-2018 The MESS Team