src/mess/drivers/pc6001.c
| r8735 | r8736 | |
| 18 | 18 | B) It's easier to me to see what the attribute vram does since I don't |
| 19 | 19 | have any docs atm. |
| 20 | 20 | |
| 21 | | TODO (pc6001mk2 specific) |
| 22 | | - vram banking model isn't yet 100% understood; |
| 23 | | - page mode 4 doesn't seem to work properly; |
| 24 | | - some games needs particular parameters (with the MON command), they all won't boot; |
| 25 | | |
| 26 | 21 | TODO (game specific): |
| 27 | 22 | - The Outlaw (AX-10): is now broken due of the joycode stuff |
| 28 | 23 | - Portpia: hangs after a bunch of text screens |
| r8735 | r8736 | |
| 32 | 27 | - Yakyukyo (MK2): waits for an irq, check which one; |
| 33 | 28 | - Forts 2 (MK2): ASCII gfxs are missing; |
| 34 | 29 | - Hydlide (MK2): crashes due of a load error; |
| 30 | - American Truck (MK2): It has various gfx bugs |
| 35 | 31 | |
| 36 | 32 | ================================================================================== |
| 37 | 33 | |
| r8735 | r8736 | |
| 346 | 342 | { |
| 347 | 343 | int x,y,tile,attr; |
| 348 | 344 | |
| 349 | | if(exgfx_2bpp_mode) |
| 345 | /* note: bitmap mode have priority over everything else, check American Truck */ |
| 346 | if(exgfx_bitmap_mode) |
| 350 | 347 | { |
| 351 | 348 | int count,color,i; |
| 352 | 349 | |
| r8735 | r8736 | |
| 354 | 351 | |
| 355 | 352 | for(y=0;y<200;y++) |
| 356 | 353 | { |
| 357 | | for(x=0;x<320;x+=8) |
| 354 | for(x=0;x<160;x+=4) |
| 358 | 355 | { |
| 359 | | for(i=0;i<8;i++) |
| 356 | for(i=0;i<4;i++) |
| 360 | 357 | { |
| 361 | 358 | int pen[2]; |
| 362 | 359 | |
| 363 | 360 | /* |
| 364 | 361 | palette reference: |
| 365 | | UINT8 pal_num[] = { 0x00, 0x04, 0x01, 0x05 }; |
| 362 | UINT8 pal_num[] = { 0x00, 0x04, 0x01, 0x05, |
| 363 | 0x02, 0x06, 0x03, 0x07, |
| 364 | 0x08, 0x0c, 0x09, 0x0d, |
| 365 | 0x0a, 0x0e, 0x0b, 0x0f }; |
| 366 | 366 | |
| 367 | | color |= pal_num[(pen[0] & 1) | ((pen[1] & 1) << 1)]; |
| 367 | color |= pal_num[(pen[0] & 3) | ((pen[1] & 3) << 2)]; |
| 368 | 368 | */ |
| 369 | 369 | |
| 370 | | pen[0] = pc6001_video_ram[count+0x0000] >> (7-i) & 1; |
| 371 | | pen[1] = pc6001_video_ram[count+0x2000] >> (7-i) & 1; |
| 370 | pen[0] = pc6001_video_ram[count+0x0000] >> (6-i*2) & 3; |
| 371 | pen[1] = pc6001_video_ram[count+0x2000] >> (6-i*2) & 3; |
| 372 | 372 | |
| 373 | | if(bgcol_bank & 4) //PC-6001 emulation mode |
| 374 | | { |
| 375 | | color = 0x08; |
| 376 | | color |= (pen[0]) | (pen[1]<<1); |
| 377 | | color |= (bgcol_bank & 1) << 2; |
| 378 | | } |
| 379 | | else //Mk-2 mode |
| 380 | | { |
| 381 | | color = 0x10; |
| 382 | | color |= ((pen[0] & 1) << 2); |
| 383 | | color |= ((pen[1] & 1) >> 0); |
| 384 | | color |= ((bgcol_bank & 1) << 1); |
| 385 | | color |= ((bgcol_bank & 2) << 2); |
| 386 | | } |
| 373 | color = 0x10; |
| 374 | color |= ((pen[0] & 1) << 2); |
| 375 | color |= ((pen[0] & 2) >> 1); |
| 376 | color |= ((pen[1] & 1) << 1); |
| 377 | color |= ((pen[1] & 2) << 2); |
| 387 | 378 | |
| 388 | | if ((x+i) <= screen->visible_area().max_x && (y) <= screen->visible_area().max_y) |
| 389 | | *BITMAP_ADDR16(bitmap, y, (x+i)) = screen->machine->pens[color]; |
| 379 | if (((x+i)*2+0) <= screen->visible_area().max_x && (y) <= screen->visible_area().max_y) |
| 380 | *BITMAP_ADDR16(bitmap, y, (x+i)*2+0) = screen->machine->pens[color]; |
| 381 | if (((x+i)*2+1) <= screen->visible_area().max_x && (y) <= screen->visible_area().max_y) |
| 382 | *BITMAP_ADDR16(bitmap, y, (x+i)*2+1) = screen->machine->pens[color]; |
| 390 | 383 | } |
| 391 | 384 | |
| 392 | 385 | count++; |
| 393 | 386 | } |
| 394 | 387 | } |
| 395 | | |
| 396 | 388 | } |
| 397 | | else if(exgfx_bitmap_mode) |
| 389 | else if(exgfx_2bpp_mode) |
| 398 | 390 | { |
| 399 | 391 | int count,color,i; |
| 400 | 392 | |
| r8735 | r8736 | |
| 402 | 394 | |
| 403 | 395 | for(y=0;y<200;y++) |
| 404 | 396 | { |
| 405 | | for(x=0;x<160;x+=4) |
| 397 | for(x=0;x<320;x+=8) |
| 406 | 398 | { |
| 407 | | for(i=0;i<4;i++) |
| 399 | for(i=0;i<8;i++) |
| 408 | 400 | { |
| 409 | 401 | int pen[2]; |
| 410 | 402 | |
| 411 | 403 | /* |
| 412 | 404 | palette reference: |
| 413 | | UINT8 pal_num[] = { 0x00, 0x04, 0x01, 0x05, |
| 414 | | 0x02, 0x06, 0x03, 0x07, |
| 415 | | 0x08, 0x0c, 0x09, 0x0d, |
| 416 | | 0x0a, 0x0e, 0x0b, 0x0f }; |
| 405 | UINT8 pal_num[] = { 0x00, 0x04, 0x01, 0x05 }; |
| 417 | 406 | |
| 418 | | color |= pal_num[(pen[0] & 3) | ((pen[1] & 3) << 2)]; |
| 407 | color |= pal_num[(pen[0] & 1) | ((pen[1] & 1) << 1)]; |
| 419 | 408 | */ |
| 420 | 409 | |
| 421 | | pen[0] = pc6001_video_ram[count+0x0000] >> (6-i*2) & 3; |
| 422 | | pen[1] = pc6001_video_ram[count+0x2000] >> (6-i*2) & 3; |
| 410 | pen[0] = pc6001_video_ram[count+0x0000] >> (7-i) & 1; |
| 411 | pen[1] = pc6001_video_ram[count+0x2000] >> (7-i) & 1; |
| 423 | 412 | |
| 424 | | color = 0x10; |
| 425 | | color |= ((pen[0] & 1) << 2); |
| 426 | | color |= ((pen[0] & 2) >> 1); |
| 427 | | color |= ((pen[1] & 1) << 1); |
| 428 | | color |= ((pen[1] & 2) << 2); |
| 413 | if(bgcol_bank & 4) //PC-6001 emulation mode |
| 414 | { |
| 415 | color = 0x08; |
| 416 | color |= (pen[0]) | (pen[1]<<1); |
| 417 | color |= (bgcol_bank & 1) << 2; |
| 418 | } |
| 419 | else //Mk-2 mode |
| 420 | { |
| 421 | color = 0x10; |
| 422 | color |= ((pen[0] & 1) << 2); |
| 423 | color |= ((pen[1] & 1) >> 0); |
| 424 | color |= ((bgcol_bank & 1) << 1); |
| 425 | color |= ((bgcol_bank & 2) << 2); |
| 426 | } |
| 429 | 427 | |
| 430 | | if (((x+i)*2+0) <= screen->visible_area().max_x && (y) <= screen->visible_area().max_y) |
| 431 | | *BITMAP_ADDR16(bitmap, y, (x+i)*2+0) = screen->machine->pens[color]; |
| 432 | | if (((x+i)*2+1) <= screen->visible_area().max_x && (y) <= screen->visible_area().max_y) |
| 433 | | *BITMAP_ADDR16(bitmap, y, (x+i)*2+1) = screen->machine->pens[color]; |
| 428 | if ((x+i) <= screen->visible_area().max_x && (y) <= screen->visible_area().max_y) |
| 429 | *BITMAP_ADDR16(bitmap, y, (x+i)) = screen->machine->pens[color]; |
| 434 | 430 | } |
| 435 | 431 | |
| 436 | 432 | count++; |
| r8735 | r8736 | |
| 743 | 739 | if((data & 0x0f) == 0x05) |
| 744 | 740 | memory_set_bankptr(device->machine, "bank4", &ROM[banksw_table_r0[(bank_r0 & 0xf0)>>4][3]]); |
| 745 | 741 | if((data & 0x0f) == 0x04) |
| 746 | | memory_set_bankptr(device->machine, "bank4", &gfx_data[0]); //FIXME: check this (CGROM 2) |
| 742 | memory_set_bankptr(device->machine, "bank4", &gfx_data[0x2000]); //FIXME: check this (CGROM 2) |
| 747 | 743 | } |
| 748 | 744 | } |
| 749 | 745 | i8255a_w(device,offset,data); |