Previous 15994 Revisions Next

r10083 Tuesday 18th January, 2011 at 01:38:52 UTC by Angelo Salese
[PC-8801]: Added gvram monochrome mode, used by Balance of Power
[src/mess/drivers]pc8801.c

src/mess/drivers/pc8801.c
r10082r10083
2727   - Alphos: test case for text VRAM attributes;
2828   - Alphos: text VRAM garbage during gameplay;
2929   - Alphos: background is supposed to be blue?
30   - Balance of Power: attempt to use the SIO port for mouse polling, worked around for now;
3031   - Bokosuka Wars: doesn't boot, floppy issue;
3132   - Grobda: palette is ugly;
3233   - Xevious: game is too fast
r10082r10083
220221   return 0;
221222}
222223
223static void draw_bitmap_3bpp_h200(running_machine *machine, bitmap_t *bitmap)
224static void draw_bitmap_3bpp(running_machine *machine, bitmap_t *bitmap)
224225{
225226   int x,y,xi;
226227   UINT32 count;
r10082r10083
250251   }
251252}
252253
253static void draw_bitmap_1bpp_h400(running_machine *machine, bitmap_t *bitmap)
254static void draw_bitmap_1bpp(running_machine *machine, bitmap_t *bitmap)
254255{
255   popmessage("%02x VIDEO MODE",gfx_ctrl);
256   int x,y,xi;
257   UINT32 count;
258   UINT8 *gvram = machine->region("maincpu")->base() + GRAM_BASE;
256259
257   // ...
260   count = 0;
261
262   for(y=0;y<200;y++)
263   {
264      for(x=0;x<640;x+=8)
265      {
266         for(xi=0;xi<8;xi++)
267         {
268            int pen;
269
270            /* TODO: dunno if layer_mask is correct here */
271            if(!(layer_mask & 2)) { pen = ((gvram[count+0x0000] >> (7-xi)) & 1) << 0; }
272
273            *BITMAP_ADDR16(bitmap, y, x+xi) = machine->pens[pen ? 7 : 0];
274         }
275
276         count++;
277      }
278   }
279
280   count = 0;
281
282   if(!(gfx_ctrl & 1)) // 400 lines
283   {
284      for(y=200;y<400;y++)
285      {
286         for(x=0;x<640;x+=8)
287         {
288            for(xi=0;xi<8;xi++)
289            {
290               int pen;
291
292               /* TODO: dunno if layer_mask is correct here */
293               if(!(layer_mask & 4)) { pen = ((gvram[count+0x4000] >> (7-xi)) & 1) << 0; }
294
295               *BITMAP_ADDR16(bitmap, y, x+xi) = machine->pens[pen ? 7 : 0];
296            }
297
298            count++;
299         }
300      }
301   }
258302}
259303
260304static VIDEO_UPDATE( pc8801 )
r10082r10083
268312   if(gfx_ctrl & 8)
269313   {
270314      if(gfx_ctrl & 0x10)
271         draw_bitmap_3bpp_h200(screen->machine,bitmap);
315         draw_bitmap_3bpp(screen->machine,bitmap);
272316      else
273         draw_bitmap_1bpp_h400(screen->machine,bitmap);
317         draw_bitmap_1bpp(screen->machine,bitmap);
274318   }
275319
276320   if(!(layer_mask & 1) && dmac_mode & 4 && crtc.status & 0x10 && crtc.irq_mask == 3)
r10082r10083
663707   bankw[1] = pc8801_bankswitch_1_w(space->machine);
664708}
665709
710static void pc8801_dynamic_res_change(running_machine *machine)
711{
712   rectangle visarea;
713
714   visarea.min_x = 0;
715   visarea.min_y = 0;
716   visarea.max_x = 640 - 1;
717   visarea.max_y = ((gfx_ctrl & 1) ? 200 : 400) - 1;
718
719   /* low screen res if graphic screen is disabled */
720   if((gfx_ctrl & 0x8) == 0)
721      visarea.max_y = 200 - 1;
722
723   machine->primary_screen->configure(640, 480, visarea, machine->primary_screen->frame_period().attoseconds);
724}
725
666726static WRITE8_HANDLER( pc8801_gfx_ctrl_w )
667727{
668728   /*
r10082r10083
679739   bankr[1] = pc8801_bankswitch_1_r(space->machine);
680740   bankw[0] = pc8801_bankswitch_0_w(space->machine);
681741   bankw[1] = pc8801_bankswitch_1_w(space->machine);
742
743   pc8801_dynamic_res_change(space->machine);
682744}
683745
684746static READ8_HANDLER( pc8801_vram_select_r )
r10082r10083
919981   printf("Write to PCG-8100 %02x %02x\n",offset,data);
920982}
921983
984/* Balance of Power temp work-around */
985static READ8_HANDLER( sio_status_r )
986{
987   return 0;
988}
989
922990static ADDRESS_MAP_START( pc8801_io, ADDRESS_SPACE_IO, 8 )
923991   ADDRESS_MAP_GLOBAL_MASK(0xff)
924992   ADDRESS_MAP_UNMAP_HIGH
r10082r10083
9401008   AM_RANGE(0x0f, 0x0f) AM_READ_PORT("KEY15")
9411009   AM_RANGE(0x00, 0x02) AM_WRITE(pc8801_pcg8100_w)
9421010//   AM_RANGE(0x10, 0x10) AM_WRITE(pc88_rtc_w)
943//  AM_RANGE(0x20, 0x21) AM_NOP                                     /* RS-232C and cassette */
1011   AM_RANGE(0x21, 0x21) AM_READ(sio_status_r)                                /* RS-232C and cassette */
9441012   AM_RANGE(0x30, 0x30) AM_READ_PORT("DSW1") //AM_WRITE(pc88sr_outport_30)
9451013   AM_RANGE(0x31, 0x31) AM_READ_PORT("DSW2") AM_WRITE(pc8801_gfx_ctrl_w)
9461014   AM_RANGE(0x32, 0x32) AM_READWRITE(pc8801_misc_ctrl_r, pc8801_misc_ctrl_w)
r10082r10083
14671535   bankw[3] = pc8801_bankswitch_3_w(machine);
14681536   bankw[4] = pc8801_bankswitch_4_w(machine);
14691537
1538   pc8801_dynamic_res_change(machine);
1539
14701540   fdc_irq_opcode = 0; //TODO: copied from PC-88VA, could be wrong here ... should be 0x7f ld a,a in the latter case
14711541
14721542   cpu_set_input_line_vector(machine->device("fdccpu"), 0, 0);
r10082r10083
15651635   MCFG_SCREEN_REFRESH_RATE(60)
15661636   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
15671637   MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
1568   MCFG_SCREEN_SIZE(640, 220)
1638   MCFG_SCREEN_SIZE(640, 480)
15691639   MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1)
15701640   MCFG_GFXDECODE( pc8801 )
15711641   MCFG_PALETTE_LENGTH(0x10)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team