Previous 15994 Revisions Next

r8728 Saturday 7th August, 2010 at 11:35:24 UTC by Angelo Salese
[PC6001Mk2]: Improved video emulation and vram banking
[src/mess/drivers]pc6001.c

src/mess/drivers/pc6001.c
r8727r8728
126126static UINT8 cas_switch,sys_latch;
127127static UINT32 cas_offset;
128128static UINT32 cas_maxsize;
129/* PC6001mk2 specific */
130static UINT8 ex_vram_bank, bgcol_bank,exgfx_mode;
129131
130132//#define CAS_LENGTH 0x1655
131133
r8727r8728
342344
343345   attr = pc6001_video_ram[0];
344346
345   if(attr == 0x0f)
347   if(exgfx_mode)
346348   {
347      int xi,yi,pen,fgcol,color;
349      int xi,yi,pen,fgcol,bgcol,color;
348350      UINT8 *gfx_data = memory_region(screen->machine, "gfx1");
349351
350352      for(y=0;y<25;y++)
r8727r8728
360362               {
361363                  pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1;
362364
363                  fgcol = /*(attr & 2) ? 2 : */7;
365                  fgcol = (attr & 0x0f) + 0x10;
366                  bgcol = ((attr & 0x70) >> 4) + 0x10 + bgcol_bank*8;
364367
365                  if((attr & 0x0f) == 0x00) //TODO
366                     color = pen ? 0 : fgcol;
367                  else
368                     color = pen ? fgcol : 0;
368                  color = pen ? fgcol : bgcol;
369369
370                  if ((x*8+xi) < screen->visible_area().max_x && (y*12+yi) < screen->visible_area().max_y)
370                  if ((x*8+xi) <= screen->visible_area().max_x && (y*12+yi) <= screen->visible_area().max_y)
371371                     *BITMAP_ADDR16(bitmap, ((y*12+yi)), (x*8+xi)) = screen->machine->pens[color];
372372               }
373373            }
r8727r8728
644644   i8255a_w(device,offset,data);
645645}
646646
647static void vram_bank_change(running_machine *machine,UINT8 vram_bank)
648{
649   UINT8 *work_ram = memory_region(machine, "maincpu");
650
651   popmessage("%02x",vram_bank);
652
653   switch(vram_bank)
654   {
655      case 0x04: pc6001_video_ram = work_ram + 0x30000; break;
656      case 0x06: pc6001_video_ram = work_ram + 0x34000; break;
657      case 0x24: pc6001_video_ram = work_ram + 0x34000; break;
658      case 0x40: pc6001_video_ram = work_ram + 0x34000; break;
659      case 0x44: pc6001_video_ram = work_ram + 0x28000; break;
660      case 0x46: pc6001_video_ram = work_ram + 0x30000; break;
661      case 0x60: pc6001_video_ram = work_ram + 0x34000; break;
662      default:
663         printf("Unhandled vram bank %02x\n",vram_bank);
664         break;
665   }
666
667   exgfx_mode = ((vram_bank & 2) == 0);
668}
669
647670static WRITE8_HANDLER ( pc6001m2_system_latch_w )
648671{
649672//   UINT8 *work_ram = memory_region(space->machine, "maincpu");
r8727r8728
670693   }
671694
672695   sys_latch = data;
673//   printf("%02x B0\n",data);
696   vram_bank_change(space->machine,(ex_vram_bank & 0x06) | ((sys_latch & 0x06) << 4));
697
698   //printf("%02x B0\n",data);
674699}
675700
676701
677702static WRITE8_HANDLER( pc6001m2_vram_bank_w )
678703{
679   UINT8 *work_ram = memory_region(space->machine, "maincpu");
704//   UINT32 startaddr[] = {WRAM(6), WRAM(6), WRAM(0), WRAM(4) };
680705
681   UINT32 startaddr[] = {WRAM(6), WRAM(6), WRAM(0), WRAM(4) };
706   ex_vram_bank = data;
707   vram_bank_change(space->machine,(ex_vram_bank & 0x06) | ((sys_latch & 0x06) << 4));
682708
683   pc6001_video_ram = work_ram + startaddr[(data >> 1) & 0x03];
709//   pc6001_video_ram = work_ram + startaddr[(data >> 1) & 0x03];
710}
684711
685   printf("%08x\n",startaddr[(data >> 1) & 0x03]);
686
687   printf("%02x c1\n",data);
712static WRITE8_HANDLER( pc6001m2_col_bank_w )
713{
714   bgcol_bank = (data & 2) >> 1;
688715}
689716
690717static ADDRESS_MAP_START(pc6001m2_map, ADDRESS_SPACE_PROGRAM, 8)
r8727r8728
710737   AM_RANGE(0xa1, 0xa1) AM_DEVWRITE("ay8910", ay8910_data_w)
711738   AM_RANGE(0xa2, 0xa2) AM_DEVREAD("ay8910", ay8910_r)
712739   AM_RANGE(0xb0, 0xb0) AM_WRITE(pc6001m2_system_latch_w)
740   AM_RANGE(0xc0, 0xc0) AM_WRITE(pc6001m2_col_bank_w)
713741   AM_RANGE(0xc1, 0xc1) AM_WRITE(pc6001m2_vram_bank_w)
714742   AM_RANGE(0xf0, 0xf0) AM_WRITE(pc6001m2_bank_r0_w)
715743   AM_RANGE(0xf1, 0xf1) AM_WRITE(pc6001m2_bank_r1_w)
r8727r8728
11451173
11461174};
11471175
1176static const rgb_t mk2_defcolors[] =
1177{
1178   MAKE_RGB(0x00, 0x00, 0x00),   /* BLACK */
1179   MAKE_RGB(0xff, 0xaf, 0x00),   /* ORANGE */
1180   MAKE_RGB(0x00, 0xff, 0xaf),   /* tone of GREEN */
1181   MAKE_RGB(0xaf, 0xff, 0x00),   /* tone of GREEN */
1182   MAKE_RGB(0xaf, 0x00, 0xff),   /* VIOLET */
1183   MAKE_RGB(0xff, 0x00, 0xaf),   /* SCARLET */
1184   MAKE_RGB(0x00, 0xaf, 0xff),   /* LIGHT BLUE */
1185   MAKE_RGB(0xaf, 0xaf, 0xaf),   /* GRAY */
1186   MAKE_RGB(0x00, 0x00, 0x00),   /* BLACK */
1187   MAKE_RGB(0xff, 0x00, 0x00),   /* RED */
1188   MAKE_RGB(0x00, 0xff, 0x00),   /* GREEN */
1189   MAKE_RGB(0xff, 0xff, 0x00),   /* YELLOW */
1190   MAKE_RGB(0x00, 0x00, 0xff),   /* BLUE */
1191   MAKE_RGB(0xff, 0x00, 0xff),   /* PINK */
1192   MAKE_RGB(0x00, 0xff, 0xff),   /* CYAN */
1193   MAKE_RGB(0xff, 0xff, 0xff)   /* WHITE */
1194};
1195
11481196static PALETTE_INIT(pc6001)
11491197{
11501198   int i;
r8727r8728
11531201      palette_set_color(machine, i+8,defcolors[i]);
11541202}
11551203
1204static PALETTE_INIT(pc6001m2)
1205{
1206   int i;
1207
1208   for(i=0;i<8;i++)
1209      palette_set_color(machine, i+8,defcolors[i]);
1210
1211   for(i=0x10;i<0x20;i++)
1212      palette_set_color(machine, i,mk2_defcolors[i-0x10]);
1213}
1214
11561215static const cassette_config pc6001_cassette_config =
11571216{
11581217   pc6001_cassette_formats,
r8727r8728
12551314   MDRV_MACHINE_RESET(pc6001m2)
12561315
12571316   MDRV_VIDEO_UPDATE(pc6001m2)
1317   MDRV_PALETTE_LENGTH(16+32)
1318   MDRV_PALETTE_INIT(pc6001m2)
12581319
12591320   /* basic machine hardware */
12601321   MDRV_CPU_MODIFY("maincpu")

Previous 15994 Revisions Next


© 1998-2018 The MESS Team