Previous 15994 Revisions Next

r8735 Saturday 7th August, 2010 at 18:04:36 UTC by Angelo Salese
[PC6001Mk2]: Implemented 2bpp bitmap mode
[src/mess/drivers]pc6001.c

src/mess/drivers/pc6001.c
r8734r8735
2020
2121    TODO (pc6001mk2 specific)
2222    - vram banking model isn't yet 100% understood;
23    - An additional gfx mode isn't supported yet (used by 3d Golf Simulation Super Version);
2423   - page mode 4 doesn't seem to work properly;
2524   - some games needs particular parameters (with the MON command), they all won't boot;
2625
r8734r8735
2827   - The Outlaw (AX-10): is now broken due of the joycode stuff
2928   - Portpia: hangs after a bunch of text screens
3029   - Galaxy Mission Part I / II: can't start a play
31   - Renritsuhoteishiki (PC6001mk2): has a slight bug with the kanji at the top,
30   - Renritsuhoteishiki (MK2): has a slight bug with the kanji at the top,
3231     probably wrong kanji ROM hook-up
33   - Yakyukyo: waits for an irq, check which one;
32   - Yakyukyo (MK2): waits for an irq, check which one;
33   - Forts 2 (MK2): ASCII gfxs are missing;
34   - Hydlide (MK2): crashes due of a load error;
3435
3536==================================================================================
3637
r8734r8735
131132static UINT32 cas_offset;
132133static UINT32 cas_maxsize;
133134/* PC6001mk2 specific */
134static UINT8 ex_vram_bank, bgcol_bank,exgfx_text_mode,exgfx_bitmap_mode;
135static UINT8 ex_vram_bank, bgcol_bank,exgfx_text_mode,exgfx_bitmap_mode,exgfx_2bpp_mode;
135136
136137//#define CAS_LENGTH 0x1655
137138
r8734r8735
147148   cfg.get_char_rom = pc6001_get_char_rom;
148149   m6847_init(machine, &cfg);
149150   #endif
150   pc6001_video_ram = auto_alloc_array(machine, UINT8, 0x2000); //0x400? We'll see...
151   pc6001_video_ram = auto_alloc_array(machine, UINT8, 0x4000);
151152}
152153
153154static void draw_bitmap_1bpp(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int attr)
r8734r8735
345346{
346347   int x,y,tile,attr;
347348
348   if(exgfx_bitmap_mode)
349   if(exgfx_2bpp_mode)
349350   {
350351      int count,color,i;
351352
r8734r8735
353354
354355      for(y=0;y<200;y++)
355356      {
357         for(x=0;x<320;x+=8)
358         {
359            for(i=0;i<8;i++)
360            {
361               int pen[2];
362
363               /*
364               palette reference:
365               UINT8 pal_num[] = { 0x00, 0x04, 0x01, 0x05 };
366
367               color |= pal_num[(pen[0] & 1) | ((pen[1] & 1) << 1)];
368               */
369
370               pen[0] = pc6001_video_ram[count+0x0000] >> (7-i) & 1;
371               pen[1] = pc6001_video_ram[count+0x2000] >> (7-i) & 1;
372
373               if(bgcol_bank & 4) //PC-6001 emulation mode
374               {
375                  color = 0x08;
376                  color |= (pen[0]) | (pen[1]<<1);
377                  color |= (bgcol_bank & 1) << 2;
378               }
379               else //Mk-2 mode
380               {
381                  color = 0x10;
382                  color |= ((pen[0] & 1) << 2);
383                  color |= ((pen[1] & 1) >> 0);
384                  color |= ((bgcol_bank & 1) << 1);
385                  color |= ((bgcol_bank & 2) << 2);
386               }
387
388               if ((x+i) <= screen->visible_area().max_x && (y) <= screen->visible_area().max_y)
389                  *BITMAP_ADDR16(bitmap, y, (x+i)) = screen->machine->pens[color];
390            }
391
392            count++;
393         }
394      }
395
396   }
397   else if(exgfx_bitmap_mode)
398   {
399      int count,color,i;
400
401      count = 0;
402
403      for(y=0;y<200;y++)
404      {
356405         for(x=0;x<160;x+=4)
357406         {
358407            for(i=0;i<4;i++)
r8734r8735
416465                  pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1;
417466
418467                  fgcol = (attr & 0x0f) + 0x10;
419                  bgcol = ((attr & 0x70) >> 4) + 0x10 + bgcol_bank*8;
468                  bgcol = ((attr & 0x70) >> 4) + 0x10 + ((bgcol_bank & 2) << 2);
420469
421470                  color = pen ? fgcol : bgcol;
422471
r8734r8735
704753{
705754   UINT8 *work_ram = memory_region(machine, "maincpu");
706755
707   popmessage("%02x",vram_bank);
756//   popmessage("%02x",vram_bank);
708757
709   switch(vram_bank)
758   switch(vram_bank & 0x66)
710759   {
711760      case 0x00: pc6001_video_ram = work_ram + 0x8000 + 0x28000; break; //4 color mode
712761      case 0x02: pc6001_video_ram = work_ram + 0xc000 + 0x28000; break;
r8734r8735
724773      case 0x62: pc6001_video_ram = work_ram + 0xa000 + 0x28000; break;
725774      case 0x64: pc6001_video_ram = work_ram + 0x4000 + 0x28000; break;
726775      case 0x66: pc6001_video_ram = work_ram + 0xa000 + 0x28000; break;
727      default:
728         printf("Unhandled vram bank %02x\n",vram_bank);
729         break;
730776   }
731777}
732778
r8734r8735
771817
772818   exgfx_text_mode = ((data & 2) == 0);
773819
820   exgfx_bitmap_mode = (data & 8);
821   exgfx_2bpp_mode = ((data & 6) == 0);
822
774823   {
775      /* Apparently bitmap mode changes the screen res to 320 x 200 */
776      if((exgfx_bitmap_mode & 8) != (data & 8))
824      /* Apparently bitmap modes changes the screen res to 320 x 200 */
777825      {
778826         rectangle visarea = space->machine->primary_screen->visible_area();
779827         int y_height;
780828
781         y_height = (data & 0x08) ? 200 : 240;
829         y_height = (exgfx_bitmap_mode || exgfx_2bpp_mode) ? 200 : 240;
782830
783831         visarea.min_x = visarea.min_y = 0;
784832         visarea.max_y = (y_height) - 1;
r8734r8735
787835         space->machine->primary_screen->configure(320, 240, visarea, space->machine->primary_screen->frame_period().attoseconds);
788836      }
789837   }
790   exgfx_bitmap_mode = (data & 8);
791838
792   popmessage("%02x",data);
839//   popmessage("%02x",data);
793840
794841//   pc6001_video_ram = work_ram + startaddr[(data >> 1) & 0x03];
795842}
796843
797844static WRITE8_HANDLER( pc6001m2_col_bank_w )
798845{
799   bgcol_bank = (data & 2) >> 1;
846   bgcol_bank = (data & 7);
800847}
801848
802849static READ8_HANDLER( unk_r )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team