Previous 15994 Revisions Next

r8757 Tuesday 10th August, 2010 at 16:17:53 UTC by Angelo Salese
[PC-6001SR]: Hooked up some (rather broken) gfxs
[src/mess/drivers]pc6001.c

src/mess/drivers/pc6001.c
r8756r8757
1212      it's not worth the effort...
1313    - Identify and hook-up the FDC device, apparently PC-6001 and PC-6600 doesn't even use the same thing;
1414    - PC-6600: mon r-0 type games doesn't seem to work at all on this version?
15    - PC-6001SR: get it to boot, also implement MK-2 compatibility mode (it changes the memory map to behave like the older versions)
1516    - Currently rewriting the video part without the MC6847 for two reasons:
1617        A) the later models have a custom video chip in the place of the MC6847,
1718           so this implementation will be used in the end.
r8756r8757
146147static UINT8 bank_r0,bank_r1,gfx_bank_on,bank_w,bank_opt;
147148static UINT8 timer_irq_mask2, timer_irq_vector;
148149static UINT32 cgrom_bank_addr;
150/* PC6001SR specific */
151static UINT8 sr_video_mode;
149152
150153#define IRQ_LOG (0)
151154
r8756r8757
536539   int xi,yi,pen,fgcol,bgcol,color;
537540   UINT8 *gfx_data = memory_region(screen->machine, "gfx1");
538541
539   for(y=0;y<20;y++)
542
543   if(sr_video_mode & 8) // text mode
540544   {
541      for(x=0;x<40;x++)
545      for(y=0;y<20;y++)
542546      {
543         tile = pc6001_video_ram[(x+(y*40))*2+0];
544         attr = pc6001_video_ram[(x+(y*40))*2+1];
545         tile+= ((attr & 0x80) << 1);
547         for(x=0;x<40;x++)
548         {
549            tile = pc6001_video_ram[(x+(y*40))*2+0];
550            attr = pc6001_video_ram[(x+(y*40))*2+1];
551            tile+= ((attr & 0x80) << 1);
546552
547         for(yi=0;yi<12;yi++)
548         {
549            for(xi=0;xi<8;xi++)
553            for(yi=0;yi<12;yi++)
550554            {
551               pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1;
555               for(xi=0;xi<8;xi++)
556               {
557                  pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1;
552558
553               fgcol = (attr & 0x0f) + 0x10;
554               bgcol = ((attr & 0x70) >> 4) + 0x10 + ((bgcol_bank & 2) << 2);
559                  fgcol = (attr & 0x0f) + 0x10;
560                  bgcol = ((attr & 0x70) >> 4) + 0x10 + ((bgcol_bank & 2) << 2);
555561
556               color = pen ? fgcol : bgcol;
562                  color = pen ? fgcol : bgcol;
557563
558               if ((x*8+xi) <= screen->visible_area().max_x && (y*12+yi) <= screen->visible_area().max_y)
559                  *BITMAP_ADDR16(bitmap, ((y*12+yi)), (x*8+xi)) = screen->machine->pens[color];
564                  if ((x*8+xi) <= screen->visible_area().max_x && (y*12+yi) <= screen->visible_area().max_y)
565                     *BITMAP_ADDR16(bitmap, ((y*12+yi)), (x*8+xi)) = screen->machine->pens[color];
566               }
560567            }
561568         }
562569      }
563570   }
571   else //4bpp bitmap mode (TODO)
572   {
573      int count;
564574
575      count = 0;
576
577      for(y=0;y<200;y+=2)
578      {
579         for(x=0;x<320;x+=4)
580         {
581            color = pc6001_video_ram[count] & 0x0f;
582
583            if ((x+0) <= screen->visible_area().max_x && (y+0) <= screen->visible_area().max_y)
584               *BITMAP_ADDR16(bitmap, (y+0), (x+0)) = screen->machine->pens[color+0x10];
585
586            color = (pc6001_video_ram[count] & 0xf0) >> 4;
587
588            if ((x+1) <= screen->visible_area().max_x && (y+0) <= screen->visible_area().max_y)
589               *BITMAP_ADDR16(bitmap, (y+0), (x+1)) = screen->machine->pens[color+0x10];
590
591            color = pc6001_video_ram[count+1] & 0x0f;
592
593            if ((x+2) <= screen->visible_area().max_x && (y+0) <= screen->visible_area().max_y)
594               *BITMAP_ADDR16(bitmap, (y+0), (x+2)) = screen->machine->pens[color+0x10];
595
596            color = (pc6001_video_ram[count+1] & 0xf0) >> 4;
597
598            if ((x+3) <= screen->visible_area().max_x && (y+0) <= screen->visible_area().max_y)
599               *BITMAP_ADDR16(bitmap, (y+0), (x+3)) = screen->machine->pens[color+0x10];
600
601            color = pc6001_video_ram[count+2] & 0x0f;
602
603            if ((x+0) <= screen->visible_area().max_x && (y+1) <= screen->visible_area().max_y)
604               *BITMAP_ADDR16(bitmap, (y+1), (x+0)) = screen->machine->pens[color+0x10];
605
606            color = (pc6001_video_ram[count+2] & 0xf0) >> 4;
607
608            if ((x+1) <= screen->visible_area().max_x && (y+1) <= screen->visible_area().max_y)
609               *BITMAP_ADDR16(bitmap, (y+1), (x+1)) = screen->machine->pens[color+0x10];
610
611            color = pc6001_video_ram[count+3] & 0x0f;
612
613            if ((x+2) <= screen->visible_area().max_x && (y+1) <= screen->visible_area().max_y)
614               *BITMAP_ADDR16(bitmap, (y+1), (x+2)) = screen->machine->pens[color+0x10];
615
616            color = (pc6001_video_ram[count+3] & 0xf0) >> 4;
617
618            if ((x+3) <= screen->visible_area().max_x && (y+1) <= screen->visible_area().max_y)
619               *BITMAP_ADDR16(bitmap, (y+1), (x+3)) = screen->machine->pens[color+0x10];
620
621
622            count+=4;
623         }
624      }
625   }
626
565627   return 0;
566628}
567629
r8756r8757
13371399      ROM[offset+(SR_EXRAM0(bank_num))] = data; \
13381400} \
13391401
1340
13411402static WRITE8_HANDLER( sr_work_ram0_w ) { SR_WRAM_BANK_W(0); }
13421403static WRITE8_HANDLER( sr_work_ram1_w ) { SR_WRAM_BANK_W(1); }
13431404static WRITE8_HANDLER( sr_work_ram2_w ) { SR_WRAM_BANK_W(2); }
r8756r8757
13491410
13501411static WRITE8_HANDLER( pc6001sr_mode_w )
13511412{
1413   sr_video_mode = data;
1414
13521415   if(data & 1)
13531416      assert("PC-6001SR in Mk-2 compatibility mode not yet supported!\n");
13541417}
r8756r8757
13601423   pc6001_video_ram = work_ram + 0x70000 + ((data & 0x0f)*0x1000);
13611424}
13621425
1426static WRITE8_HANDLER ( pc6001sr_system_latch_w )
1427{
1428   if((!(sys_latch & 8)) && data & 0x8) //PLAY tape cmd
1429   {
1430      cas_switch = 1;
1431      //cassette_change_state(space->machine->device("cass" ),CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);
1432      //cassette_change_state(space->machine->device("cass" ),CASSETTE_PLAY,CASSETTE_MASK_UISTATE);
1433   }
1434   if((sys_latch & 8) && ((data & 0x8) == 0)) //STOP tape cmd
1435   {
1436      cas_switch = 0;
1437      //cassette_change_state(space->machine->device("cass" ),CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR);
1438      //cassette_change_state(space->machine->device("cass" ),CASSETTE_STOPPED,CASSETTE_MASK_UISTATE);
1439      //irq_vector = 0x00;
1440      //cputag_set_input_line(space->machine,"maincpu", 0, ASSERT_LINE);
1441   }
1442
1443   sys_latch = data;
1444
1445   timer_irq_mask = data & 1;
1446   //vram_bank_change(space->machine,(ex_vram_bank & 0x06) | ((sys_latch & 0x06) << 4));
1447
1448   //printf("%02x B0\n",data);
1449}
1450
1451static WRITE8_DEVICE_HANDLER(necsr_ppi8255_w)
1452{
1453   if (offset==3)
1454   {
1455      if(data & 1)
1456         port_c_8255 |=   1<<((data>>1)&0x07);
1457      else
1458         port_c_8255 &= ~(1<<((data>>1)&0x07));
1459
1460      switch(data) {
1461           case 0x08: port_c_8255 |= 0x88; break;
1462           case 0x09: port_c_8255 &= 0xf7; break;
1463           case 0x0c: port_c_8255 |= 0x28; break;
1464           case 0x0d: port_c_8255 &= 0xf7; break;
1465           default: break;
1466      }
1467
1468      port_c_8255 |= 0xa8;
1469
1470      if(0)
1471      {
1472         UINT8 *gfx_data = memory_region(device->machine, "gfx1");
1473         UINT8 *ext_rom = memory_region(device->machine, "cart_img");
1474
1475         //printf("%02x\n",data);
1476
1477         if((data & 0x0f) == 0x05)
1478            memory_set_bankptr(device->machine, "bank1", &ext_rom[0x2000]);
1479         if((data & 0x0f) == 0x04)
1480            memory_set_bankptr(device->machine, "bank1", &gfx_data[0]);
1481      }
1482   }
1483   i8255a_w(device,offset,data);
1484}
1485
1486
13631487static ADDRESS_MAP_START(pc6001sr_map, ADDRESS_SPACE_PROGRAM, 8)
13641488   ADDRESS_MAP_UNMAP_HIGH
13651489   AM_RANGE(0x0000, 0x1fff) AM_ROMBANK("bank1") AM_WRITE(sr_work_ram0_w)
r8756r8757
13801504   AM_RANGE(0x80, 0x80) AM_DEVREADWRITE("uart", msm8251_data_r,msm8251_data_w)
13811505   AM_RANGE(0x81, 0x81) AM_DEVREADWRITE("uart", msm8251_status_r,msm8251_control_w)
13821506
1383   AM_RANGE(0x90, 0x93) AM_MIRROR(0x0c) AM_DEVREADWRITE("ppi8255", nec_ppi8255_r, necmk2_ppi8255_w)
1507   AM_RANGE(0x90, 0x93) AM_MIRROR(0x0c) AM_DEVREADWRITE("ppi8255", nec_ppi8255_r, necsr_ppi8255_w)
13841508
13851509   AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x0c) AM_DEVWRITE("ay8910", ay8910_address_w)
13861510   AM_RANGE(0xa1, 0xa1) AM_MIRROR(0x0c) AM_DEVWRITE("ay8910", ay8910_data_w)
13871511   AM_RANGE(0xa2, 0xa2) AM_MIRROR(0x0c) AM_DEVREAD("ay8910", ay8910_r)
13881512   AM_RANGE(0xa3, 0xa3) AM_MIRROR(0x0c) AM_NOP
13891513
1390   AM_RANGE(0xb0, 0xb0) AM_WRITE(pc6001m2_system_latch_w)
1514   AM_RANGE(0xb0, 0xb0) AM_WRITE(pc6001sr_system_latch_w)
13911515   /* these are disk related */
13921516//   AM_RANGE(0xb1
13931517//   AM_RANGE(0xb2
r8756r8757
15691693   cpu_set_input_line(device, 0, ASSERT_LINE);
15701694}
15711695
1696static INTERRUPT_GEN( pc6001sr_interrupt )
1697{
1698   static UINT8 kludge;
1699
1700   kludge^= 1;
1701
1702   cur_keycode = check_joy_press(device->machine);
1703   if(IRQ_LOG) printf("VRTC IRQ called 0x16\n");
1704   irq_vector = (kludge) ? 0x22 : 0x16;
1705   cpu_set_input_line(device, 0, ASSERT_LINE);
1706}
1707
15721708static IRQ_CALLBACK ( pc6001_irq_callback )
15731709{
15741710   cpu_set_input_line(device, 0, CLEAR_LINE);
r8756r8757
21102246   MDRV_CPU_REPLACE("maincpu", Z80, XTAL_3_579545MHz) //*Yes*, PC-6001 SR Z80 CPU is actually slower than older models
21112247   MDRV_CPU_PROGRAM_MAP(pc6001sr_map)
21122248   MDRV_CPU_IO_MAP(pc6001sr_io)
2113   MDRV_CPU_VBLANK_INT("screen", pc6001_interrupt)
2249   MDRV_CPU_VBLANK_INT("screen", pc6001sr_interrupt)
21142250MACHINE_DRIVER_END
21152251
21162252/* ROM definition */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team