src/mess/drivers/pasopia.c
| r8575 | r8576 | |
| 24 | 24 | static UINT8 *p7_vram,*p7_pal; |
| 25 | 25 | static UINT8 bank_reg; |
| 26 | 26 | static UINT16 cursor_addr; |
| 27 | | static UINT8 cursor_blink; |
| 27 | static UINT8 cursor_blink,cursor_raster; |
| 28 | 28 | static UINT8 plane_reg,attr_data,attr_wrap,attr_latch,pal_sel,x_width; |
| 29 | 29 | |
| 30 | 30 | static VIDEO_START( paso7 ) |
| r8575 | r8576 | |
| 160 | 160 | |
| 161 | 161 | drawgfx_transpen(bitmap,cliprect,screen->machine->gfx[0],tile,color,0,0,x*8,y*8,0); |
| 162 | 162 | |
| 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; |
| 165 | 167 | |
| 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 | } |
| 166 | 188 | count+=8; |
| 167 | 189 | } |
| 168 | 190 | } |
| r8575 | r8576 | |
| 190 | 212 | { |
| 191 | 213 | res &= p7_vram[offset | 0x8000]; |
| 192 | 214 | 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)); |
| 194 | 216 | } |
| 195 | 217 | |
| 196 | 218 | return res; |
| r8575 | r8576 | |
| 215 | 237 | p7_vram[offset | 0x8000] = (plane_reg & 4) ? data : 0xff; |
| 216 | 238 | attr_latch = attr_wrap ? attr_latch : attr_data; |
| 217 | 239 | 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)); |
| 219 | 241 | } |
| 220 | 242 | } |
| 221 | 243 | } |
| r8575 | r8576 | |
| 327 | 349 | if(offset == 0) |
| 328 | 350 | { |
| 329 | 351 | 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); |
| 331 | 353 | } |
| 332 | 354 | else |
| 333 | 355 | { |
| 334 | 356 | /* FIXME: this should be inside the MC6845 core! */ |
| 357 | if(addr_latch == 0x0a) |
| 358 | cursor_raster = data; |
| 335 | 359 | if(addr_latch == 0x0e) |
| 336 | 360 | cursor_addr = ((data<<8) & 0x3f00) | (cursor_addr & 0xff); |
| 337 | 361 | else if(addr_latch == 0x0f) |
| 338 | 362 | cursor_addr = (cursor_addr & 0x3f00) | (data & 0xff); |
| 339 | 363 | |
| 340 | | mc6845_register_w(space->machine->device("crtc"), 0,data); |
| 364 | mc6845_register_w(devtag_get_device(space->machine, "crtc"), 0,data); |
| 341 | 365 | } |
| 342 | 366 | } |
| 343 | 367 | |
| r8575 | r8576 | |
| 356 | 380 | |
| 357 | 381 | io_port = offset & 0xff; //trim down to 8-bit bus |
| 358 | 382 | |
| 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); } |
| 361 | 385 | // else if(io_port == 0x10 || io_port == 0x11) { M6845 read } |
| 362 | 386 | 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); } |
| 366 | 390 | // else if(io_port == 0x3a) { SN1 } |
| 367 | 391 | // else if(io_port == 0x3b) { SN2 } |
| 368 | 392 | // else if(io_port == 0x3c) { bankswitch } |
| r8575 | r8576 | |
| 388 | 412 | |
| 389 | 413 | io_port = offset & 0xff; //trim down to 8-bit bus |
| 390 | 414 | |
| 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); } |
| 393 | 417 | else if(io_port >= 0x10 && io_port <= 0x11) { pasopia7_6845_w(space, io_port-0x10, data); } |
| 394 | 418 | 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); } |
| 400 | 424 | else if(io_port == 0x3c) { pasopia7_memory_ctrl_w(space,0, data); } |
| 401 | 425 | // else if(io_port >= 0xe0 && io_port <= 0xe6) { fdc } |
| 402 | 426 | else |
| r8575 | r8576 | |
| 556 | 580 | // printf("SYSTEM MISC %02x\n",data); |
| 557 | 581 | |
| 558 | 582 | // 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); |
| 560 | 584 | |
| 561 | 585 | } |
| 562 | 586 | |
| r8575 | r8576 | |
| 673 | 697 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 674 | 698 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 675 | 699 | 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) |
| 677 | 701 | MDRV_MC6845_ADD("crtc", H46505, XTAL_3_579545MHz/4, mc6845_intf) /* unknown clock, hand tuned to get ~60 fps */ |
| 678 | 702 | MDRV_PALETTE_LENGTH(0x28) |
| 679 | 703 | MDRV_PALETTE_INIT(pasopia7) |