src/mess/drivers/pasopia.c
| r8534 | r8535 | |
| 22 | 22 | static UINT8 bank_reg; |
| 23 | 23 | static UINT16 cursor_addr; |
| 24 | 24 | static UINT8 cursor_blink; |
| 25 | static UINT8 plane_reg,attr_data; |
| 25 | 26 | |
| 26 | 27 | static VIDEO_START( paso7 ) |
| 27 | 28 | { |
| 29 | p7_vram = auto_alloc_array(machine, UINT8, 0x10000); |
| 28 | 30 | } |
| 29 | 31 | |
| 30 | 32 | static VIDEO_UPDATE( paso7 ) |
| r8534 | r8535 | |
| 32 | 34 | int x,y; |
| 33 | 35 | int count; |
| 34 | 36 | |
| 35 | | count = 0; |
| 37 | count = 0x0000; |
| 36 | 38 | |
| 37 | 39 | for(y=0;y<25;y++) |
| 38 | 40 | { |
| 39 | 41 | for(x=0;x<40;x++) |
| 40 | 42 | { |
| 41 | | int tile = p7_vram[count]; |
| 43 | int tile = p7_vram[count+0x8000]; |
| 44 | int color = p7_vram[count+0xc000]; |
| 42 | 45 | |
| 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); |
| 44 | 47 | |
| 45 | 48 | 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); |
| 47 | 50 | |
| 48 | 51 | count+=8; |
| 49 | 52 | } |
| r8534 | r8535 | |
| 54 | 57 | |
| 55 | 58 | static READ8_HANDLER( vram_r ) |
| 56 | 59 | { |
| 57 | | if(vram_sel) |
| 58 | | return 0xff; |
| 60 | // if(!vram_sel) |
| 61 | // return 0xff; |
| 59 | 62 | |
| 60 | | return p7_vram[offset]; |
| 63 | return p7_vram[offset | 0x8000]; //TODO |
| 61 | 64 | } |
| 62 | 65 | |
| 63 | 66 | static WRITE8_HANDLER( vram_w ) |
| 64 | 67 | { |
| 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 | } |
| 67 | 75 | } |
| 68 | 76 | |
| 69 | 77 | static WRITE8_HANDLER( pasopia7_memory_ctrl_w ) |
| r8534 | r8535 | |
| 187 | 195 | { |
| 188 | 196 | const address_space *ram_space = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 189 | 197 | mio_sel = 0; |
| 198 | printf("%08x\n",offset); |
| 190 | 199 | //return 0x0d; // hack: this is used for reading the keyboard data, we can fake it a little ... (modify fda4) |
| 191 | 200 | return memory_read_byte(ram_space, offset); |
| 192 | 201 | } |
| r8534 | r8535 | |
| 247 | 256 | AM_RANGE( 0x0000, 0x7fff ) AM_WRITE( ram_bank_w ) |
| 248 | 257 | AM_RANGE( 0x0000, 0x3fff ) AM_ROMBANK("bank1") |
| 249 | 258 | 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 ) |
| 251 | 260 | AM_RANGE( 0xc000, 0xffff ) AM_RAMBANK("bank4") |
| 252 | 261 | ADDRESS_MAP_END |
| 253 | 262 | |
| r8534 | r8535 | |
| 287 | 296 | }; |
| 288 | 297 | |
| 289 | 298 | static 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 ) |
| 292 | 301 | GFXDECODE_END |
| 293 | 302 | |
| 294 | 303 | static const mc6845_interface mc6845_intf = |
| r8534 | r8535 | |
| 316 | 325 | |
| 317 | 326 | static Z80PIO_INTERFACE( z80pio_intf ) |
| 318 | 327 | { |
| 319 | | DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_IRQ0), |
| 328 | DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_IRQ0), //doesn't work? |
| 320 | 329 | DEVCB_NULL, |
| 321 | 330 | DEVCB_NULL, |
| 322 | 331 | DEVCB_NULL, |
| r8534 | r8535 | |
| 350 | 359 | static WRITE8_DEVICE_HANDLER( plane_reg_w ) |
| 351 | 360 | { |
| 352 | 361 | printf("PLANE %02x\n",data); |
| 362 | plane_reg = data; |
| 353 | 363 | } |
| 354 | 364 | |
| 355 | 365 | static WRITE8_DEVICE_HANDLER( video_attr_w ) |
| 356 | 366 | { |
| 357 | 367 | printf("VIDEO ATTR %02x | TEXT_PAGE %02x\n",data & 0xf,data & 0x70); |
| 368 | attr_data = data & 0xf; |
| 358 | 369 | } |
| 359 | 370 | |
| 360 | 371 | static WRITE8_DEVICE_HANDLER( video_misc_w ) |
| r8534 | r8535 | |
| 453 | 464 | // memory_set_bankptr(machine, "bank4", bios + 0x10000); |
| 454 | 465 | } |
| 455 | 466 | |
| 467 | static 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 | |
| 456 | 487 | static MACHINE_DRIVER_START( paso7 ) |
| 457 | 488 | /* basic machine hardware */ |
| 458 | 489 | MDRV_CPU_ADD("maincpu",Z80, XTAL_4MHz) |
| r8534 | r8535 | |
| 478 | 509 | MDRV_SCREEN_SIZE(640, 480) |
| 479 | 510 | MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) |
| 480 | 511 | 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) |
| 483 | 514 | |
| 484 | 515 | MDRV_GFXDECODE( pasopia7 ) |
| 485 | 516 | |