src/mess/drivers/fmtowns.c
| r5938 | r5939 | |
| 97 | 97 | static UINT8 towns_palette_g[256]; |
| 98 | 98 | static UINT8 towns_palette_b[256]; |
| 99 | 99 | static UINT8 towns_degipal[8]; |
| 100 | static UINT16 towns_kanji_offset; |
| 101 | static UINT8 towns_kanji_code_h; |
| 102 | static UINT8 towns_kanji_code_l; |
| 100 | 103 | |
| 101 | 104 | static void towns_update_video_banks(const address_space* space); |
| 102 | 105 | |
| r5938 | r5939 | |
| 405 | 408 | |
| 406 | 409 | static READ8_HANDLER( towns_video_cff80_r ) |
| 407 | 410 | { |
| 411 | UINT8* ROM = memory_region(space->machine,"user"); |
| 408 | 412 | if(towns_mainmem_enable != 0) |
| 409 | 413 | return mess_ram[offset+0xcff80]; |
| 410 | 414 | |
| r5938 | r5939 | |
| 412 | 416 | { |
| 413 | 417 | case 0x01: // read/write plane select (bit 0-3 write, bit 6-7 read) |
| 414 | 418 | return ((towns_vram_rplane << 6) & 0xc0) | towns_vram_wplane; |
| 419 | case 0x16: // Kanji character data |
| 420 | return ROM[(towns_kanji_offset << 1) + 0x180000]; |
| 421 | case 0x17: // Kanji character data |
| 422 | return ROM[(towns_kanji_offset++ << 1) + 0x180001]; |
| 415 | 423 | case 0x19: // ANK CG ROM |
| 416 | 424 | if(towns_ankcg_enable != 0) |
| 417 | 425 | return 0x01; |
| r5938 | r5939 | |
| 440 | 448 | towns_update_video_banks(space); |
| 441 | 449 | logerror("VGA: VRAM wplane select = 0x%02x\n",towns_vram_wplane); |
| 442 | 450 | break; |
| 451 | case 0x14: // Kanji offset (high) |
| 452 | towns_kanji_code_h = data & 0x7f; |
| 453 | break; |
| 454 | case 0x15: // Kanji offset (low) |
| 455 | towns_kanji_code_l = data & 0x7f; |
| 456 | // this is a little over the top... |
| 457 | if(towns_kanji_code_h < 0x30) |
| 458 | { |
| 459 | towns_kanji_offset = ((towns_kanji_code_l & 0x1f) << 4) |
| 460 | | (((towns_kanji_code_l - 0x20) & 0x20) << 8) |
| 461 | | (((towns_kanji_code_l - 0x20) & 0x40) << 6) |
| 462 | | ((towns_kanji_code_h & 0x07) << 9); |
| 463 | } |
| 464 | else if(towns_kanji_code_h < 0x70) |
| 465 | { |
| 466 | towns_kanji_offset = ((towns_kanji_code_l & 0x1f) << 4) |
| 467 | + (((towns_kanji_code_l - 0x20) & 0x60) << 8) |
| 468 | + ((towns_kanji_code_h & 0x0f) << 9) |
| 469 | + (((towns_kanji_code_h - 0x30) & 0x70) * 0xc00) |
| 470 | + 0x8000; |
| 471 | } |
| 472 | else |
| 473 | { |
| 474 | towns_kanji_offset = ((towns_kanji_code_l & 0x1f) << 4) |
| 475 | | (((towns_kanji_code_l - 0x20) & 0x20) << 8) |
| 476 | | (((towns_kanji_code_l - 0x20) & 0x40) << 6) |
| 477 | | ((towns_kanji_code_h & 0x07) << 9) |
| 478 | | 0x38000; |
| 479 | } |
| 480 | break; |
| 443 | 481 | case 0x19: // ANK CG ROM |
| 444 | 482 | towns_ankcg_enable = data & 0x00000100; |
| 445 | 483 | towns_update_video_banks(space); |
| r5938 | r5939 | |
| 702 | 740 | NULL |
| 703 | 741 | }; |
| 704 | 742 | |
| 743 | // for debugging |
| 744 | static const gfx_layout x1_chars_16x16 = |
| 745 | { |
| 746 | 16,16, |
| 747 | RGN_FRAC(1,1), |
| 748 | 1, |
| 749 | { 0 }, |
| 750 | { 0, 1, 2, 3, 4, 5, 6, 7,8,9,10,11,12,13,14,15 }, |
| 751 | { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 }, |
| 752 | 16*16 |
| 753 | }; |
| 754 | |
| 755 | /* decoded for debugging purpose, this will be nuked in the end... */ |
| 756 | static GFXDECODE_START( towns ) |
| 757 | GFXDECODE_ENTRY( "user", 0x180000, x1_chars_16x16, 0, 0x100 ) //needs to be checked when the ROM will be redumped |
| 758 | GFXDECODE_END |
| 759 | |
| 705 | 760 | static SYSTEM_CONFIG_START(towns) |
| 706 | 761 | CONFIG_RAM_DEFAULT(0x6000000) // 6MB will do to start, standard amount for the Marty |
| 707 | 762 | SYSTEM_CONFIG_END |
| r5938 | r5939 | |
| 721 | 776 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) |
| 722 | 777 | MDRV_SCREEN_SIZE(640, 480) |
| 723 | 778 | MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1) |
| 779 | MDRV_GFXDECODE(towns) |
| 724 | 780 | |
| 725 | 781 | /* sound hardware */ |
| 726 | 782 | MDRV_SPEAKER_STANDARD_MONO("mono") |