Previous 15994 Revisions Next

r8576 Wednesday 21st July, 2010 at 18:29:13 UTC by Angelo Salese
[PASOPIA7]: Improved cursor drawing
[src/mess/drivers]pasopia.c

src/mess/drivers/pasopia.c
r8575r8576
2424static UINT8 *p7_vram,*p7_pal;
2525static UINT8 bank_reg;
2626static UINT16 cursor_addr;
27static UINT8 cursor_blink;
27static UINT8 cursor_blink,cursor_raster;
2828static UINT8 plane_reg,attr_data,attr_wrap,attr_latch,pal_sel,x_width;
2929
3030static VIDEO_START( paso7 )
r8575r8576
160160
161161         drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[0],tile,color,0,0,x*8,y*8,0);
162162
163         if(((cursor_addr*8) == count) && !cursor_blink) // draw cursor
164            drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[0],0x5f,7,0,0,x*8,y*8,0);
163         // draw cursor
164         if(cursor_addr*8 == count)
165         {
166            int xc,yc,cursor_on;
165167
168            cursor_on = 0;
169            switch(cursor_raster & 0x60)
170            {
171               case 0x00: cursor_on = 1; break; //always on
172               case 0x20: cursor_on = 0; break; //always off
173               case 0x40: if(screen->machine->primary_screen->frame_number() & 0x10) { cursor_on = 1; } break; //fast blink
174               case 0x60: if(screen->machine->primary_screen->frame_number() & 0x20) { cursor_on = 1; } break; //slow blink
175            }
176
177            if(cursor_on)
178            {
179               for(yc=0;yc<(8-(cursor_raster & 7));yc++)
180               {
181                  for(xc=0;xc<8;xc++)
182                  {
183                     *BITMAP_ADDR16(bitmap, y*8-yc+7, x*8+xc) = screen->machine->pens[0x27];
184                  }
185               }
186            }
187         }
166188         count+=8;
167189      }
168190   }
r8575r8576
190212   {
191213      res &= p7_vram[offset | 0x8000];
192214      attr_latch = p7_vram[offset | 0xc000];
193      i8255a_w(space->machine->device("ppi8255_0"), 1,  (attr_latch << 4) | (attr_latch & 0x7));
215      i8255a_w(devtag_get_device(space->machine, "ppi8255_0"), 1,  (attr_latch << 4) | (attr_latch & 0x7));
194216   }
195217
196218   return res;
r8575r8576
215237         p7_vram[offset | 0x8000] = (plane_reg & 4) ? data : 0xff;
216238         attr_latch = attr_wrap ? attr_latch : attr_data;
217239         p7_vram[offset | 0xc000] = attr_latch;
218         i8255a_w(space->machine->device("ppi8255_0"), 1, (attr_latch << 4) | (attr_latch & 0x7));
240         i8255a_w(devtag_get_device(space->machine, "ppi8255_0"), 1, (attr_latch << 4) | (attr_latch & 0x7));
219241      }
220242   }
221243}
r8575r8576
327349   if(offset == 0)
328350   {
329351      addr_latch = data;
330      mc6845_address_w(space->machine->device("crtc"), 0,data);
352      mc6845_address_w(devtag_get_device(space->machine, "crtc"), 0,data);
331353   }
332354   else
333355   {
334356      /* FIXME: this should be inside the MC6845 core! */
357      if(addr_latch == 0x0a)
358         cursor_raster = data;
335359      if(addr_latch == 0x0e)
336360         cursor_addr = ((data<<8) & 0x3f00) | (cursor_addr & 0xff);
337361      else if(addr_latch == 0x0f)
338362         cursor_addr = (cursor_addr & 0x3f00) | (data & 0xff);
339363
340      mc6845_register_w(space->machine->device("crtc"), 0,data);
364      mc6845_register_w(devtag_get_device(space->machine, "crtc"), 0,data);
341365   }
342366}
343367
r8575r8576
356380
357381   io_port = offset & 0xff; //trim down to 8-bit bus
358382
359   if(io_port >= 0x08 && io_port <= 0x0b)       { return i8255a_r(space->machine->device("ppi8255_0"), (io_port-0x08) & 3); }
360   else if(io_port >= 0x0c && io_port <= 0x0f) { return i8255a_r(space->machine->device("ppi8255_1"), (io_port-0x0c) & 3); }
383   if(io_port >= 0x08 && io_port <= 0x0b)       { return i8255a_r(devtag_get_device(space->machine, "ppi8255_0"), (io_port-0x08) & 3); }
384   else if(io_port >= 0x0c && io_port <= 0x0f) { return i8255a_r(devtag_get_device(space->machine, "ppi8255_1"), (io_port-0x0c) & 3); }
361385//   else if(io_port == 0x10 || io_port == 0x11) { M6845 read }
362386   else if(io_port >= 0x18 && io_port <= 0x1b) { return pac2_r(space, io_port-0x1b);  }
363   else if(io_port >= 0x20 && io_port <= 0x23) { return i8255a_r(space->machine->device("ppi8255_2"), (io_port-0x20) & 3); }
364   else if(io_port >= 0x28 && io_port <= 0x2b) { return z80ctc_r(space->machine->device("ctc"), io_port-0x28);  }
365   else if(io_port >= 0x30 && io_port <= 0x33) { return z80pio_cd_ba_r(space->machine->device("z80pio_0"), (io_port-0x30) & 3); }
387   else if(io_port >= 0x20 && io_port <= 0x23) { return i8255a_r(devtag_get_device(space->machine, "ppi8255_2"), (io_port-0x20) & 3); }
388   else if(io_port >= 0x28 && io_port <= 0x2b) { return z80ctc_r(devtag_get_device(space->machine, "ctc"), io_port-0x28);  }
389   else if(io_port >= 0x30 && io_port <= 0x33) { return z80pio_cd_ba_r(devtag_get_device(space->machine, "z80pio_0"), (io_port-0x30) & 3); }
366390//   else if(io_port == 0x3a)                  { SN1 }
367391//   else if(io_port == 0x3b)                  { SN2 }
368392//   else if(io_port == 0x3c)                  { bankswitch }
r8575r8576
388412
389413   io_port = offset & 0xff; //trim down to 8-bit bus
390414
391   if(io_port >= 0x08 && io_port <= 0x0b)       { i8255a_w(space->machine->device("ppi8255_0"), (io_port-0x08) & 3, data); }
392   else if(io_port >= 0x0c && io_port <= 0x0f) { i8255a_w(space->machine->device("ppi8255_1"), (io_port-0x0c) & 3, data); }
415   if(io_port >= 0x08 && io_port <= 0x0b)       { i8255a_w(devtag_get_device(space->machine, "ppi8255_0"), (io_port-0x08) & 3, data); }
416   else if(io_port >= 0x0c && io_port <= 0x0f) { i8255a_w(devtag_get_device(space->machine, "ppi8255_1"), (io_port-0x0c) & 3, data); }
393417   else if(io_port >= 0x10 && io_port <= 0x11) { pasopia7_6845_w(space, io_port-0x10, data); }
394418   else if(io_port >= 0x18 && io_port <= 0x1b) { pac2_w(space, io_port-0x1b, data);  }
395   else if(io_port >= 0x20 && io_port <= 0x23) { i8255a_w(space->machine->device("ppi8255_2"), (io_port-0x20) & 3, data); }
396   else if(io_port >= 0x28 && io_port <= 0x2b) { z80ctc_w(space->machine->device("ctc"), io_port-0x28,data);  }
397   else if(io_port >= 0x30 && io_port <= 0x33) { z80pio_cd_ba_w(space->machine->device("z80pio_0"), (io_port-0x30) & 3, data); }
398   else if(io_port == 0x3a)                  { sn76496_w(space->machine->device("sn1"), 0, data); }
399   else if(io_port == 0x3b)                  { sn76496_w(space->machine->device("sn2"), 0, data); }
419   else if(io_port >= 0x20 && io_port <= 0x23) { i8255a_w(devtag_get_device(space->machine, "ppi8255_2"), (io_port-0x20) & 3, data); }
420   else if(io_port >= 0x28 && io_port <= 0x2b) { z80ctc_w(devtag_get_device(space->machine, "ctc"), io_port-0x28,data);  }
421   else if(io_port >= 0x30 && io_port <= 0x33) { z80pio_cd_ba_w(devtag_get_device(space->machine, "z80pio_0"), (io_port-0x30) & 3, data); }
422   else if(io_port == 0x3a)                  { sn76496_w(devtag_get_device(space->machine, "sn1"), 0, data); }
423   else if(io_port == 0x3b)                  { sn76496_w(devtag_get_device(space->machine, "sn2"), 0, data); }
400424   else if(io_port == 0x3c)                  { pasopia7_memory_ctrl_w(space,0, data); }
401425//   else if(io_port >= 0xe0 && io_port <= 0xe6) { fdc }
402426   else
r8575r8576
556580//   printf("SYSTEM MISC %02x\n",data);
557581
558582//   if(data & 1)
559//      i8255a_w(device->machine->device("ppi8255_2"), 1, 0);
583//      i8255a_w(devtag_get_device(device->machine, "ppi8255_2"), 1, 0);
560584
561585}
562586
r8575r8576
673697    MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
674698    MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
675699    MDRV_SCREEN_SIZE(640, 480)
676    MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
700    MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1)
677701   MDRV_MC6845_ADD("crtc", H46505, XTAL_3_579545MHz/4, mc6845_intf)   /* unknown clock, hand tuned to get ~60 fps */
678702    MDRV_PALETTE_LENGTH(0x28)
679703    MDRV_PALETTE_INIT(pasopia7)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team