src/mess/drivers/pc6001.c
| r8734 | r8735 | |
| 20 | 20 | |
| 21 | 21 | TODO (pc6001mk2 specific) |
| 22 | 22 | - vram banking model isn't yet 100% understood; |
| 23 | | - An additional gfx mode isn't supported yet (used by 3d Golf Simulation Super Version); |
| 24 | 23 | - page mode 4 doesn't seem to work properly; |
| 25 | 24 | - some games needs particular parameters (with the MON command), they all won't boot; |
| 26 | 25 | |
| r8734 | r8735 | |
| 28 | 27 | - The Outlaw (AX-10): is now broken due of the joycode stuff |
| 29 | 28 | - Portpia: hangs after a bunch of text screens |
| 30 | 29 | - Galaxy Mission Part I / II: can't start a play |
| 31 | | - Renritsuhoteishiki (PC6001mk2): has a slight bug with the kanji at the top, |
| 30 | - Renritsuhoteishiki (MK2): has a slight bug with the kanji at the top, |
| 32 | 31 | probably wrong kanji ROM hook-up |
| 33 | | - Yakyukyo: waits for an irq, check which one; |
| 32 | - Yakyukyo (MK2): waits for an irq, check which one; |
| 33 | - Forts 2 (MK2): ASCII gfxs are missing; |
| 34 | - Hydlide (MK2): crashes due of a load error; |
| 34 | 35 | |
| 35 | 36 | ================================================================================== |
| 36 | 37 | |
| r8734 | r8735 | |
| 131 | 132 | static UINT32 cas_offset; |
| 132 | 133 | static UINT32 cas_maxsize; |
| 133 | 134 | /* PC6001mk2 specific */ |
| 134 | | static UINT8 ex_vram_bank, bgcol_bank,exgfx_text_mode,exgfx_bitmap_mode; |
| 135 | static UINT8 ex_vram_bank, bgcol_bank,exgfx_text_mode,exgfx_bitmap_mode,exgfx_2bpp_mode; |
| 135 | 136 | |
| 136 | 137 | //#define CAS_LENGTH 0x1655 |
| 137 | 138 | |
| r8734 | r8735 | |
| 147 | 148 | cfg.get_char_rom = pc6001_get_char_rom; |
| 148 | 149 | m6847_init(machine, &cfg); |
| 149 | 150 | #endif |
| 150 | | pc6001_video_ram = auto_alloc_array(machine, UINT8, 0x2000); //0x400? We'll see... |
| 151 | pc6001_video_ram = auto_alloc_array(machine, UINT8, 0x4000); |
| 151 | 152 | } |
| 152 | 153 | |
| 153 | 154 | static void draw_bitmap_1bpp(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect,int attr) |
| r8734 | r8735 | |
| 345 | 346 | { |
| 346 | 347 | int x,y,tile,attr; |
| 347 | 348 | |
| 348 | | if(exgfx_bitmap_mode) |
| 349 | if(exgfx_2bpp_mode) |
| 349 | 350 | { |
| 350 | 351 | int count,color,i; |
| 351 | 352 | |
| r8734 | r8735 | |
| 353 | 354 | |
| 354 | 355 | for(y=0;y<200;y++) |
| 355 | 356 | { |
| 357 | for(x=0;x<320;x+=8) |
| 358 | { |
| 359 | for(i=0;i<8;i++) |
| 360 | { |
| 361 | int pen[2]; |
| 362 | |
| 363 | /* |
| 364 | palette reference: |
| 365 | UINT8 pal_num[] = { 0x00, 0x04, 0x01, 0x05 }; |
| 366 | |
| 367 | color |= pal_num[(pen[0] & 1) | ((pen[1] & 1) << 1)]; |
| 368 | */ |
| 369 | |
| 370 | pen[0] = pc6001_video_ram[count+0x0000] >> (7-i) & 1; |
| 371 | pen[1] = pc6001_video_ram[count+0x2000] >> (7-i) & 1; |
| 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 | } |
| 387 | |
| 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]; |
| 390 | } |
| 391 | |
| 392 | count++; |
| 393 | } |
| 394 | } |
| 395 | |
| 396 | } |
| 397 | else if(exgfx_bitmap_mode) |
| 398 | { |
| 399 | int count,color,i; |
| 400 | |
| 401 | count = 0; |
| 402 | |
| 403 | for(y=0;y<200;y++) |
| 404 | { |
| 356 | 405 | for(x=0;x<160;x+=4) |
| 357 | 406 | { |
| 358 | 407 | for(i=0;i<4;i++) |
| r8734 | r8735 | |
| 416 | 465 | pen = gfx_data[(tile*0x10)+yi]>>(7-xi) & 1; |
| 417 | 466 | |
| 418 | 467 | fgcol = (attr & 0x0f) + 0x10; |
| 419 | | bgcol = ((attr & 0x70) >> 4) + 0x10 + bgcol_bank*8; |
| 468 | bgcol = ((attr & 0x70) >> 4) + 0x10 + ((bgcol_bank & 2) << 2); |
| 420 | 469 | |
| 421 | 470 | color = pen ? fgcol : bgcol; |
| 422 | 471 | |
| r8734 | r8735 | |
| 704 | 753 | { |
| 705 | 754 | UINT8 *work_ram = memory_region(machine, "maincpu"); |
| 706 | 755 | |
| 707 | | popmessage("%02x",vram_bank); |
| 756 | // popmessage("%02x",vram_bank); |
| 708 | 757 | |
| 709 | | switch(vram_bank) |
| 758 | switch(vram_bank & 0x66) |
| 710 | 759 | { |
| 711 | 760 | case 0x00: pc6001_video_ram = work_ram + 0x8000 + 0x28000; break; //4 color mode |
| 712 | 761 | case 0x02: pc6001_video_ram = work_ram + 0xc000 + 0x28000; break; |
| r8734 | r8735 | |
| 724 | 773 | case 0x62: pc6001_video_ram = work_ram + 0xa000 + 0x28000; break; |
| 725 | 774 | case 0x64: pc6001_video_ram = work_ram + 0x4000 + 0x28000; break; |
| 726 | 775 | case 0x66: pc6001_video_ram = work_ram + 0xa000 + 0x28000; break; |
| 727 | | default: |
| 728 | | printf("Unhandled vram bank %02x\n",vram_bank); |
| 729 | | break; |
| 730 | 776 | } |
| 731 | 777 | } |
| 732 | 778 | |
| r8734 | r8735 | |
| 771 | 817 | |
| 772 | 818 | exgfx_text_mode = ((data & 2) == 0); |
| 773 | 819 | |
| 820 | exgfx_bitmap_mode = (data & 8); |
| 821 | exgfx_2bpp_mode = ((data & 6) == 0); |
| 822 | |
| 774 | 823 | { |
| 775 | | /* Apparently bitmap mode changes the screen res to 320 x 200 */ |
| 776 | | if((exgfx_bitmap_mode & 8) != (data & 8)) |
| 824 | /* Apparently bitmap modes changes the screen res to 320 x 200 */ |
| 777 | 825 | { |
| 778 | 826 | rectangle visarea = space->machine->primary_screen->visible_area(); |
| 779 | 827 | int y_height; |
| 780 | 828 | |
| 781 | | y_height = (data & 0x08) ? 200 : 240; |
| 829 | y_height = (exgfx_bitmap_mode || exgfx_2bpp_mode) ? 200 : 240; |
| 782 | 830 | |
| 783 | 831 | visarea.min_x = visarea.min_y = 0; |
| 784 | 832 | visarea.max_y = (y_height) - 1; |
| r8734 | r8735 | |
| 787 | 835 | space->machine->primary_screen->configure(320, 240, visarea, space->machine->primary_screen->frame_period().attoseconds); |
| 788 | 836 | } |
| 789 | 837 | } |
| 790 | | exgfx_bitmap_mode = (data & 8); |
| 791 | 838 | |
| 792 | | popmessage("%02x",data); |
| 839 | // popmessage("%02x",data); |
| 793 | 840 | |
| 794 | 841 | // pc6001_video_ram = work_ram + startaddr[(data >> 1) & 0x03]; |
| 795 | 842 | } |
| 796 | 843 | |
| 797 | 844 | static WRITE8_HANDLER( pc6001m2_col_bank_w ) |
| 798 | 845 | { |
| 799 | | bgcol_bank = (data & 2) >> 1; |
| 846 | bgcol_bank = (data & 7); |
| 800 | 847 | } |
| 801 | 848 | |
| 802 | 849 | static READ8_HANDLER( unk_r ) |