src/mess/video/fmtowns.c
| r6696 | r6697 | |
| 552 | 552 | |
| 553 | 553 | void towns_crtc_draw_scan_layer_hicolour(bitmap_t* bitmap,const rectangle* rect,int layer,int line,int scanline) |
| 554 | 554 | { |
| 555 | | int off = 0; |
| 555 | UINT32 off = 0; |
| 556 | 556 | int x; |
| 557 | 557 | UINT16 colour; |
| 558 | 558 | int hzoom = 1; |
| 559 | int linesize; |
| 559 | 560 | |
| 560 | | if(towns_vram_page_sel != 0) |
| 561 | | off = 0x20000; |
| 561 | if(layer == 0) |
| 562 | linesize = towns_crtc_reg[20] * 4; |
| 563 | else |
| 564 | linesize = towns_crtc_reg[24] * 4; |
| 565 | |
| 562 | 566 | if(layer != 0) |
| 563 | 567 | { |
| 564 | 568 | if(!(towns_video_reg[0] & 0x10)) |
| 565 | 569 | return; |
| 566 | | off += 0x40000; |
| 567 | | off += towns_crtc_reg[21]; // initial offset |
| 570 | off += (towns_crtc_reg[21] & 0xfffe) << 2; // initial offset |
| 568 | 571 | if(towns_crtc_reg[27] & 0x0100) |
| 569 | 572 | hzoom = 2; |
| 570 | 573 | } |
| 571 | 574 | else |
| 572 | 575 | { |
| 573 | | off += towns_crtc_reg[17]; // initial offset |
| 576 | off += (towns_crtc_reg[17] & 0xfffe) << 2; // initial offset |
| 574 | 577 | if(towns_crtc_reg[27] & 0x0001) |
| 575 | 578 | hzoom = 2; |
| 576 | 579 | } |
| 577 | 580 | |
| 578 | | off += (line * (512 / hzoom) * 2); |
| 579 | | |
| 581 | off += line * linesize; |
| 582 | |
| 580 | 583 | if(hzoom == 1) |
| 581 | 584 | { |
| 582 | 585 | for(x=rect->min_x;x<rect->max_x;x++) |
| 583 | 586 | { |
| 584 | | colour = (towns_gfxvram[off] << 8) | towns_gfxvram[off+1]; |
| 585 | | if(colour != 0) |
| 587 | if(towns_video_reg[0] & 0x10) |
| 588 | off &= 0x3ffff; // 2 layers |
| 589 | else |
| 590 | off &= 0x7ffff; // 1 layer |
| 591 | |
| 592 | colour = (towns_gfxvram[off+(layer*0x40000)+1] << 8) | towns_gfxvram[off+(layer*0x40000)]; |
| 593 | if(colour != 0 || colour >= 0x8000) |
| 586 | 594 | { |
| 587 | 595 | *BITMAP_ADDR32(bitmap,scanline,x) = |
| 588 | | ((colour & 0xf800)) |
| 589 | | | ((colour & 0x07c0) << 13) |
| 590 | | | ((colour & 0x003e) << 2); |
| 596 | ((colour & 0x001f) << 3) |
| 597 | | ((colour & 0x7c00) << 1) |
| 598 | | ((colour & 0x03e0) << 14); |
| 591 | 599 | } |
| 592 | 600 | off+=2; |
| 593 | 601 | } |
| r6696 | r6697 | |
| 596 | 604 | { // x2 horizontal zoom |
| 597 | 605 | for(x=rect->min_x;x<rect->max_x;x+=2) |
| 598 | 606 | { |
| 599 | | colour = (towns_gfxvram[off+1] << 8) | towns_gfxvram[off]; |
| 600 | | if(colour != 0) |
| 607 | if(towns_video_reg[0] & 0x10) |
| 608 | off &= 0x3ffff; // 2 layers |
| 609 | else |
| 610 | off &= 0x7ffff; // 1 layer |
| 611 | colour = (towns_gfxvram[off+(layer*0x40000)+1] << 8) | towns_gfxvram[off+(layer*0x40000)]; |
| 612 | if(colour != 0 || colour >= 0x8000) |
| 601 | 613 | { |
| 602 | 614 | *BITMAP_ADDR32(bitmap,scanline,x) = |
| 603 | 615 | ((colour & 0x001f) << 3) |
| r6696 | r6697 | |
| 701 | 713 | hzoom = 2; |
| 702 | 714 | } |
| 703 | 715 | |
| 704 | | off += (line * ((rect->max_x - rect->min_x) / 2)); |
| 716 | off += (line * ((rect->max_x - rect->min_x) / 2)); // offset at this scanline |
| 705 | 717 | |
| 706 | 718 | if(hzoom == 1) |
| 707 | 719 | { |
| r6696 | r6697 | |
| 763 | 775 | { |
| 764 | 776 | int line; |
| 765 | 777 | int scanline; |
| 778 | int height; |
| 766 | 779 | |
| 767 | 780 | if(layer == 0) |
| 768 | 781 | { |
| 769 | 782 | scanline = rect->min_y; |
| 783 | height = (rect->max_y - rect->min_y); |
| 784 | if(towns_crtc_reg[27] & 0x0010) |
| 785 | height /= 2; |
| 770 | 786 | switch(towns_video_reg[0] & 0x03) |
| 771 | 787 | { |
| 772 | 788 | case 0x01: |
| 773 | | for(line=0;line<(rect->max_y - rect->min_y);line++) |
| 789 | for(line=0;line<height;line++) |
| 774 | 790 | { |
| 775 | 791 | towns_crtc_draw_scan_layer_16(bitmap,rect,layer,line,scanline); |
| 776 | 792 | scanline++; |
| r6696 | r6697 | |
| 782 | 798 | } |
| 783 | 799 | break; |
| 784 | 800 | case 0x02: |
| 785 | | for(line=0;line<(rect->max_y - rect->min_y);line++) |
| 801 | for(line=0;line<height;line++) |
| 786 | 802 | { |
| 787 | 803 | towns_crtc_draw_scan_layer_256(bitmap,rect,layer,line,scanline); |
| 788 | 804 | scanline++; |
| r6696 | r6697 | |
| 794 | 810 | } |
| 795 | 811 | break; |
| 796 | 812 | case 0x03: |
| 797 | | for(line=0;line<(rect->max_y - rect->min_y);line++) |
| 813 | for(line=0;line<height;line++) |
| 798 | 814 | { |
| 799 | 815 | towns_crtc_draw_scan_layer_hicolour(bitmap,rect,layer,line,scanline); |
| 800 | 816 | scanline++; |
| r6696 | r6697 | |
| 810 | 826 | else |
| 811 | 827 | { |
| 812 | 828 | scanline = rect->min_y; |
| 829 | height = (rect->max_y - rect->min_y); |
| 830 | if(towns_crtc_reg[27] & 0x1000) |
| 831 | height /= 2; |
| 813 | 832 | switch(towns_video_reg[0] & 0x0c) |
| 814 | 833 | { |
| 815 | 834 | case 0x04: |
| 816 | | for(line=rect->min_y;line<rect->max_y;line++) |
| 835 | for(line=0;line<height;line++) |
| 817 | 836 | { |
| 818 | 837 | towns_crtc_draw_scan_layer_16(bitmap,rect,layer,line,scanline); |
| 819 | 838 | scanline++; |
| r6696 | r6697 | |
| 825 | 844 | } |
| 826 | 845 | break; |
| 827 | 846 | case 0x08: |
| 828 | | // 256 colour - TODO |
| 847 | for(line=0;line<height;line++) |
| 848 | { |
| 849 | towns_crtc_draw_scan_layer_256(bitmap,rect,layer,line,scanline); |
| 850 | scanline++; |
| 851 | if(towns_crtc_reg[27] & 0x1000) // vertical zoom |
| 852 | { |
| 853 | towns_crtc_draw_scan_layer_256(bitmap,rect,layer,line,scanline); |
| 854 | scanline++; |
| 855 | } |
| 856 | } |
| 829 | 857 | break; |
| 830 | 858 | case 0x0c: |
| 831 | | // Highcolour - TODO |
| 859 | for(line=0;line<height;line++) |
| 860 | { |
| 861 | towns_crtc_draw_scan_layer_hicolour(bitmap,rect,layer,line,scanline); |
| 862 | scanline++; |
| 863 | if(towns_crtc_reg[27] & 0x1000) // vertical zoom |
| 864 | { |
| 865 | towns_crtc_draw_scan_layer_hicolour(bitmap,rect,layer,line,scanline); |
| 866 | scanline++; |
| 867 | } |
| 868 | } |
| 832 | 869 | break; |
| 833 | 870 | } |
| 834 | 871 | } |
| r6696 | r6697 | |
| 850 | 887 | |
| 851 | 888 | bitmap_fill(bitmap,cliprect,0x00000000); |
| 852 | 889 | |
| 853 | | if(towns_video_reg[1] & 0x01) |
| 890 | if(!(towns_video_reg[1] & 0x01)) |
| 854 | 891 | { |
| 855 | | towns_crtc_draw_layer(bitmap,&towns_crtc_layerscr[1],1); |
| 856 | | towns_crtc_draw_layer(bitmap,&towns_crtc_layerscr[0],0); |
| 892 | if(!input_code_pressed(screen->machine,KEYCODE_Q)) |
| 893 | towns_crtc_draw_layer(bitmap,&towns_crtc_layerscr[1],1); |
| 894 | if(!input_code_pressed(screen->machine,KEYCODE_W)) |
| 895 | towns_crtc_draw_layer(bitmap,&towns_crtc_layerscr[0],0); |
| 857 | 896 | } |
| 858 | 897 | else |
| 859 | 898 | { |
| 860 | | towns_crtc_draw_layer(bitmap,&towns_crtc_layerscr[0],0); |
| 861 | | towns_crtc_draw_layer(bitmap,&towns_crtc_layerscr[1],1); |
| 899 | if(!input_code_pressed(screen->machine,KEYCODE_Q)) |
| 900 | towns_crtc_draw_layer(bitmap,&towns_crtc_layerscr[0],0); |
| 901 | if(!input_code_pressed(screen->machine,KEYCODE_W)) |
| 902 | towns_crtc_draw_layer(bitmap,&towns_crtc_layerscr[1],1); |
| 862 | 903 | } |
| 863 | 904 | |
| 864 | 905 | |
| r6696 | r6697 | |
| 935 | 976 | } |
| 936 | 977 | |
| 937 | 978 | #ifdef CRTC_REG_DISP |
| 938 | | popmessage("CRTC: %i %i %i %i %i %i %i %i %i\n%i %i %i %i | %i %i %i %i\nZOOM: %04x\nShifter: %02x %02x\nText=%i", |
| 979 | popmessage("CRTC: %i %i %i %i %i %i %i %i %i\n%i %i %i %i | %i %i %i %i\n%i %i %i %i | %i %i %i %i\nZOOM: %04x\nVideo: %02x %02x\nText=%i", |
| 939 | 980 | towns_crtc_reg[0],towns_crtc_reg[1],towns_crtc_reg[2],towns_crtc_reg[3], |
| 940 | 981 | towns_crtc_reg[4],towns_crtc_reg[5],towns_crtc_reg[6],towns_crtc_reg[7], |
| 941 | 982 | towns_crtc_reg[8], |
| 942 | 983 | towns_crtc_reg[9],towns_crtc_reg[10],towns_crtc_reg[11],towns_crtc_reg[12], |
| 943 | 984 | towns_crtc_reg[13],towns_crtc_reg[14],towns_crtc_reg[15],towns_crtc_reg[16], |
| 985 | towns_crtc_reg[17],towns_crtc_reg[18],towns_crtc_reg[19],towns_crtc_reg[20], |
| 986 | towns_crtc_reg[21],towns_crtc_reg[22],towns_crtc_reg[23],towns_crtc_reg[24], |
| 944 | 987 | towns_crtc_reg[27],towns_video_reg[0],towns_video_reg[1],towns_tvram_enable); |
| 945 | 988 | #endif |
| 946 | 989 | |
src/mess/drivers/fmtowns.c
| r6696 | r6697 | |
| 1602 | 1602 | AM_RANGE(0x000f0000, 0x000f7fff) AM_RAM //READWRITE(SMH_BANK(12),SMH_BANK(12)) |
| 1603 | 1603 | AM_RANGE(0x000f8000, 0x000fffff) AM_READ_BANK("bank11") AM_WRITE_BANK("bank12") |
| 1604 | 1604 | AM_RANGE(0x00100000, 0x005fffff) AM_RAM // some extra RAM - seems to be needed to boot |
| 1605 | | AM_RANGE(0x80000000, 0x8003ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffffffff) AM_MIRROR(0x1c0000) // VRAM |
| 1605 | AM_RANGE(0x80000000, 0x8007ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffffffff) AM_MIRROR(0x180000) // VRAM |
| 1606 | 1606 | AM_RANGE(0x81000000, 0x8101ffff) AM_RAM // Sprite RAM |
| 1607 | 1607 | AM_RANGE(0xc2000000, 0xc207ffff) AM_ROM AM_REGION("user",0x000000) // OS ROM |
| 1608 | 1608 | AM_RANGE(0xc2080000, 0xc20fffff) AM_ROM AM_REGION("user",0x100000) // DIC ROM |
| r6696 | r6697 | |
| 1628 | 1628 | AM_RANGE(0x00100000, 0x005fffff) AM_RAM // some extra RAM - seems to be needed to boot |
| 1629 | 1629 | AM_RANGE(0x00600000, 0x0067ffff) AM_ROM AM_REGION("user",0x000000) // OS |
| 1630 | 1630 | AM_RANGE(0x00680000, 0x0087ffff) AM_ROM AM_REGION("user",0x280000) // EX ROM |
| 1631 | | AM_RANGE(0x00a00000, 0x00a3ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffffffff) AM_MIRROR(0x1c0000) // VRAM |
| 1631 | AM_RANGE(0x00a00000, 0x00a7ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffffffff) AM_MIRROR(0x180000) // VRAM |
| 1632 | 1632 | AM_RANGE(0x00e80000, 0x00efffff) AM_ROM AM_REGION("user",0x100000) // DIC ROM |
| 1633 | 1633 | AM_RANGE(0x00f00000, 0x00f7ffff) AM_ROM AM_REGION("user",0x180000) // FONT |
| 1634 | 1634 | AM_RANGE(0x00fc0000, 0x00ffffff) AM_ROM AM_REGION("user",0x200000) // SYSTEM ROM |
| 1635 | | AM_RANGE(0x80000000, 0x8003ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffffffff) AM_MIRROR(0x1c0000) // VRAM |
| 1635 | AM_RANGE(0x80000000, 0x8007ffff) AM_READWRITE8(towns_gfx_high_r,towns_gfx_high_w,0xffffffff) AM_MIRROR(0x180000) // VRAM |
| 1636 | 1636 | AM_RANGE(0x81000000, 0x8101ffff) AM_RAM // Sprite RAM |
| 1637 | 1637 | AM_RANGE(0xc2000000, 0xc207ffff) AM_ROM AM_REGION("user",0x000000) // OS ROM |
| 1638 | 1638 | AM_RANGE(0xc2080000, 0xc20fffff) AM_ROM AM_REGION("user",0x100000) // DIC ROM |