Previous 15994 Revisions Next

r8535 Sunday 18th July, 2010 at 13:28:45 UTC by Angelo Salese
[PASOPIA7]: Added color attribute
[src/mess/drivers]pasopia.c

src/mess/drivers/pasopia.c
r8534r8535
2222static UINT8 bank_reg;
2323static UINT16 cursor_addr;
2424static UINT8 cursor_blink;
25static UINT8 plane_reg,attr_data;
2526
2627static VIDEO_START( paso7 )
2728{
29   p7_vram = auto_alloc_array(machine, UINT8, 0x10000);
2830}
2931
3032static VIDEO_UPDATE( paso7 )
r8534r8535
3234   int x,y;
3335   int count;
3436
35   count = 0;
37   count = 0x0000;
3638
3739   for(y=0;y<25;y++)
3840   {
3941      for(x=0;x<40;x++)
4042      {
41         int tile = p7_vram[count];
43         int tile = p7_vram[count+0x8000];
44         int color = p7_vram[count+0xc000];
4245
43         drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[0],tile,0,0,0,x*8,y*8);
46         drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[0],tile,color,0,0,x*8,y*8);
4447
4548         if(((cursor_addr*8) == count) && !cursor_blink) // draw cursor
46            drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[0],0x5f,0,0,0,x*8,y*8);
49            drawgfx_opaque(bitmap,cliprect,screen->machine->gfx[0],0x5f,7,0,0,x*8,y*8);
4750
4851         count+=8;
4952      }
r8534r8535
5457
5558static READ8_HANDLER( vram_r )
5659{
57   if(vram_sel)
58      return 0xff;
60//   if(!vram_sel)
61//      return 0xff;
5962
60   return p7_vram[offset];
63   return p7_vram[offset | 0x8000]; //TODO
6164}
6265
6366static WRITE8_HANDLER( vram_w )
6467{
65   //if(!vram_sel)  //TODO: investigate on this
66      p7_vram[offset] = data;
68//   if(vram_sel)
69
70   if((plane_reg & 0x44) == 0x44)
71   {
72      p7_vram[offset | 0x8000] = data;
73      p7_vram[offset | 0xc000] = attr_data;
74   }
6775}
6876
6977static WRITE8_HANDLER( pasopia7_memory_ctrl_w )
r8534r8535
187195   {
188196      const address_space *ram_space = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
189197      mio_sel = 0;
198      printf("%08x\n",offset);
190199      //return 0x0d; // hack: this is used for reading the keyboard data, we can fake it a little ... (modify fda4)
191200      return memory_read_byte(ram_space, offset);
192201   }
r8534r8535
247256   AM_RANGE( 0x0000, 0x7fff ) AM_WRITE( ram_bank_w )
248257   AM_RANGE( 0x0000, 0x3fff ) AM_ROMBANK("bank1")
249258   AM_RANGE( 0x4000, 0x7fff ) AM_ROMBANK("bank2")
250   AM_RANGE( 0x8000, 0xbfff ) AM_READWRITE(vram_r, vram_w ) AM_BASE(&p7_vram)
259   AM_RANGE( 0x8000, 0xbfff ) AM_READWRITE(vram_r, vram_w )
251260   AM_RANGE( 0xc000, 0xffff ) AM_RAMBANK("bank4")
252261ADDRESS_MAP_END
253262
r8534r8535
287296};
288297
289298static GFXDECODE_START( pasopia7 )
290   GFXDECODE_ENTRY( "font",   0x00000, p7_chars_8x8,    0, 1 )
291   GFXDECODE_ENTRY( "kanji",  0x00000, p7_chars_16x16,  0, 1 )
299   GFXDECODE_ENTRY( "font",   0x00000, p7_chars_8x8,    0, 0x10 )
300   GFXDECODE_ENTRY( "kanji",  0x00000, p7_chars_16x16,  0, 0x10 )
292301GFXDECODE_END
293302
294303static const mc6845_interface mc6845_intf =
r8534r8535
316325
317326static Z80PIO_INTERFACE( z80pio_intf )
318327{
319   DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_IRQ0),
328   DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_IRQ0), //doesn't work?
320329   DEVCB_NULL,
321330   DEVCB_NULL,
322331   DEVCB_NULL,
r8534r8535
350359static WRITE8_DEVICE_HANDLER( plane_reg_w )
351360{
352361   printf("PLANE %02x\n",data);
362   plane_reg = data;
353363}
354364
355365static WRITE8_DEVICE_HANDLER( video_attr_w )
356366{
357367   printf("VIDEO ATTR %02x | TEXT_PAGE %02x\n",data & 0xf,data & 0x70);
368   attr_data = data & 0xf;
358369}
359370
360371static WRITE8_DEVICE_HANDLER( video_misc_w )
r8534r8535
453464//   memory_set_bankptr(machine, "bank4", bios + 0x10000);
454465}
455466
467static PALETTE_INIT( pasopia7 )
468{
469   int i;
470
471   for (i = 0x000; i < 0x020; i++)
472   {
473      UINT8 r,g,b;
474
475      if(((i & 0x11) == 0x01) || ((i & 0x11) == 0x10))
476      {
477         r = ((i >> 3) & 1) ? 0xff : 0x00;
478         g = ((i >> 2) & 1) ? 0xff : 0x00;
479         b = ((i >> 1) & 1) ? 0xff : 0x00;
480      }
481      else { r = g = b = 0x00; }
482
483      palette_set_color_rgb(machine, i, r,g,b);
484   }
485}
486
456487static MACHINE_DRIVER_START( paso7 )
457488    /* basic machine hardware */
458489    MDRV_CPU_ADD("maincpu",Z80, XTAL_4MHz)
r8534r8535
478509    MDRV_SCREEN_SIZE(640, 480)
479510    MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
480511   MDRV_MC6845_ADD("crtc", H46505, XTAL_3_579545MHz/4, mc6845_intf)   /* unknown clock, hand tuned to get ~60 fps */
481    MDRV_PALETTE_LENGTH(2)
482    MDRV_PALETTE_INIT(black_and_white)
512    MDRV_PALETTE_LENGTH(0x20)
513    MDRV_PALETTE_INIT(pasopia7)
483514
484515   MDRV_GFXDECODE( pasopia7 )
485516

Previous 15994 Revisions Next


© 1998-2018 The MESS Team