trunk/src/emu/bus/isa/trident.c
| r32231 | r32232 | |
| 14 | 14 | |
| 15 | 15 | #define CRTC_PORT_ADDR ((vga.miscellaneous_output&1)?0x3d0:0x3b0) |
| 16 | 16 | |
| 17 | | #define READPIXEL8(x,y) (vga.memory[(y*offset() + x) % vga.svga_intf.vram_size]) |
| 18 | | #define WRITEPIXEL8(x,y,c) if(x<tri.accel_dest_y_clip && y<tri.accel_dest_y_clip) \ |
| 19 | | (vga.memory[(y*offset() + x) % vga.svga_intf.vram_size] = c) |
| 17 | #define READPIXEL8(x,y) (vga.memory[((y & 0xfff)*offset() + (x & 0xfff)) % vga.svga_intf.vram_size]) |
| 18 | #define WRITEPIXEL8(x,y,c) if((x & 0xfff)<tri.accel_dest_x_clip && (y & 0xfff)<tri.accel_dest_y_clip) \ |
| 19 | (vga.memory[((y & 0xfff)*offset() + (x & 0xfff)) % vga.svga_intf.vram_size] = c) |
| 20 | 20 | |
| 21 | 21 | #define LOG (1) |
| 22 | #define LOG_ACCEL (0) |
| 22 | 23 | |
| 23 | 24 | trident_vga_device::trident_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 24 | 25 | : svga_device(mconfig, TRIDENT_VGA, "Trident TGUI9680", tag, owner, clock, "trident_vga", __FILE__) |
| r32231 | r32232 | |
| 68 | 69 | tri.sr0c = 0x78; |
| 69 | 70 | tri.port_3c3 = true; |
| 70 | 71 | tri.accel_busy = false; |
| 72 | tri.accel_memwrite_active = false; |
| 71 | 73 | } |
| 72 | 74 | |
| 73 | 75 | UINT16 trident_vga_device::offset() |
| r32231 | r32232 | |
| 470 | 472 | break; |
| 471 | 473 | case 8: |
| 472 | 474 | if(tri.gc0f & 0x04) // if enabled |
| 475 | { |
| 473 | 476 | res = svga.bank_w & 0x3f; |
| 477 | } |
| 474 | 478 | else |
| 475 | 479 | res = 0xff; |
| 476 | 480 | break; |
| r32231 | r32232 | |
| 506 | 510 | if(tri.gc0f & 0x04) // if enabled |
| 507 | 511 | { |
| 508 | 512 | svga.bank_w = data & 0x3f; |
| 513 | if(LOG) logerror("Trident: Write Bank set to %02x\n",data); |
| 509 | 514 | if(!(tri.gc0f & 0x01)) // if bank regs are not separated |
| 515 | { |
| 510 | 516 | svga.bank_r = data & 0x3f; // then this is also the read bank register |
| 517 | if(LOG) logerror("Trident: Read Bank set to %02x\n",data); |
| 518 | } |
| 511 | 519 | } |
| 512 | 520 | break; |
| 513 | 521 | case 9: |
| 514 | 522 | if(tri.gc0f & 0x04) // if enabled |
| 515 | 523 | { |
| 516 | 524 | if(tri.gc0f & 0x01) // and if bank regs are separated |
| 525 | { |
| 517 | 526 | svga.bank_r = data & 0x3f; |
| 527 | if(LOG) logerror("Trident: Read Bank set to %02x\n",data); |
| 528 | } |
| 518 | 529 | } |
| 519 | 530 | break; |
| 520 | 531 | default: |
| r32231 | r32232 | |
| 579 | 590 | |
| 580 | 591 | WRITE8_MEMBER(trident_vga_device::mem_w) |
| 581 | 592 | { |
| 593 | if(tri.accel_memwrite_active) |
| 594 | { |
| 595 | tri.accel_transfer = (tri.accel_transfer & (~(0x000000ff << (24-(8*(offset % 4)))))) | (data << (24-(8 * (offset % 4)))); |
| 596 | if(offset % 4 == 3) |
| 597 | accel_data_write(tri.accel_transfer); |
| 598 | return; |
| 599 | } |
| 600 | |
| 582 | 601 | if (svga.rgb8_en || svga.rgb15_en || svga.rgb16_en || svga.rgb32_en) |
| 583 | 602 | { |
| 584 | 603 | if(tri.new_mode) // 64k from 0xA0000-0xAFFFF |
| r32231 | r32232 | |
| 703 | 722 | { |
| 704 | 723 | case 0x02: // Operation Mode |
| 705 | 724 | tri.accel_opermode = (tri.accel_opermode & 0xff00) | data; |
| 706 | | if(LOG) logerror("Trident: Operation Mode set to %04x\n",tri.accel_opermode); |
| 725 | if(LOG_ACCEL) logerror("Trident: Operation Mode set to %04x\n",tri.accel_opermode); |
| 707 | 726 | break; |
| 708 | 727 | case 0x03: |
| 709 | 728 | tri.accel_opermode = (tri.accel_opermode & 0x00ff) | (data << 8); |
| 710 | | if(LOG) logerror("Trident: Operation Mode set to %04x\n",tri.accel_opermode); |
| 729 | if(LOG_ACCEL) logerror("Trident: Operation Mode set to %04x\n",tri.accel_opermode); |
| 711 | 730 | break; |
| 712 | 731 | case 0x04: // Command register |
| 713 | 732 | tri.accel_command = data; |
| r32231 | r32232 | |
| 715 | 734 | break; |
| 716 | 735 | case 0x07: // Foreground Mix? |
| 717 | 736 | tri.accel_fmix = data; |
| 718 | | if(LOG) logerror("Trident: FMIX set to %02x\n",data); |
| 737 | if(LOG_ACCEL) logerror("Trident: FMIX set to %02x\n",data); |
| 719 | 738 | break; |
| 720 | 739 | case 0x08: // Draw flags |
| 721 | 740 | tri.accel_drawflags = (tri.accel_drawflags & 0xffffff00) | data; |
| 722 | | if(LOG) logerror("Trident: Draw flags set to %08x\n",tri.accel_drawflags); |
| 741 | if(LOG_ACCEL) logerror("Trident: Draw flags set to %08x\n",tri.accel_drawflags); |
| 723 | 742 | break; |
| 724 | 743 | case 0x09: |
| 725 | 744 | tri.accel_drawflags = (tri.accel_drawflags & 0xffff00ff) | (data << 8); |
| 726 | | if(LOG) logerror("Trident: Draw flags set to %08x\n",tri.accel_drawflags); |
| 745 | if(LOG_ACCEL) logerror("Trident: Draw flags set to %08x\n",tri.accel_drawflags); |
| 727 | 746 | break; |
| 728 | 747 | case 0x0a: |
| 729 | 748 | tri.accel_drawflags = (tri.accel_drawflags & 0xff00ffff) | (data << 16); |
| 730 | | if(LOG) logerror("Trident: Draw flags set to %08x\n",tri.accel_drawflags); |
| 749 | if(LOG_ACCEL) logerror("Trident: Draw flags set to %08x\n",tri.accel_drawflags); |
| 731 | 750 | break; |
| 732 | 751 | case 0x0b: |
| 733 | 752 | tri.accel_drawflags = (tri.accel_drawflags & 0x00ffffff) | (data << 24); |
| 734 | | if(LOG) logerror("Trident: Draw flags set to %08x\n",tri.accel_drawflags); |
| 753 | if(LOG_ACCEL) logerror("Trident: Draw flags set to %08x\n",tri.accel_drawflags); |
| 735 | 754 | break; |
| 736 | 755 | case 0x0c: // Foreground Colour |
| 737 | 756 | tri.accel_fgcolour = (tri.accel_fgcolour & 0xffffff00) | data; |
| 738 | | if(LOG) logerror("Trident: Foreground Colour set to %08x\n",tri.accel_fgcolour); |
| 757 | if(LOG_ACCEL) logerror("Trident: Foreground Colour set to %08x\n",tri.accel_fgcolour); |
| 739 | 758 | break; |
| 740 | 759 | case 0x0d: |
| 741 | 760 | tri.accel_fgcolour = (tri.accel_fgcolour & 0xffff00ff) | (data << 8); |
| 742 | | if(LOG) logerror("Trident: Foreground Colour set to %08x\n",tri.accel_fgcolour); |
| 761 | if(LOG_ACCEL) logerror("Trident: Foreground Colour set to %08x\n",tri.accel_fgcolour); |
| 743 | 762 | break; |
| 744 | 763 | case 0x0e: |
| 745 | 764 | tri.accel_fgcolour = (tri.accel_fgcolour & 0xff00ffff) | (data << 16); |
| 746 | | if(LOG) logerror("Trident: Foreground Colour set to %08x\n",tri.accel_fgcolour); |
| 765 | if(LOG_ACCEL) logerror("Trident: Foreground Colour set to %08x\n",tri.accel_fgcolour); |
| 747 | 766 | break; |
| 748 | 767 | case 0x0f: |
| 749 | 768 | tri.accel_fgcolour = (tri.accel_fgcolour & 0x00ffffff) | (data << 24); |
| 750 | | if(LOG) logerror("Trident: Foreground Colour set to %08x\n",tri.accel_fgcolour); |
| 769 | if(LOG_ACCEL) logerror("Trident: Foreground Colour set to %08x\n",tri.accel_fgcolour); |
| 751 | 770 | break; |
| 752 | 771 | case 0x10: // Background Colour |
| 753 | 772 | tri.accel_bgcolour = (tri.accel_bgcolour & 0xffffff00) | data; |
| 754 | | if(LOG) logerror("Trident: Background Colour set to %08x\n",tri.accel_bgcolour); |
| 773 | if(LOG_ACCEL) logerror("Trident: Background Colour set to %08x\n",tri.accel_bgcolour); |
| 755 | 774 | break; |
| 756 | 775 | case 0x11: |
| 757 | 776 | tri.accel_bgcolour = (tri.accel_bgcolour & 0xffff00ff) | (data << 8); |
| 758 | | if(LOG) logerror("Trident: Background Colour set to %08x\n",tri.accel_bgcolour); |
| 777 | if(LOG_ACCEL) logerror("Trident: Background Colour set to %08x\n",tri.accel_bgcolour); |
| 759 | 778 | break; |
| 760 | 779 | case 0x12: |
| 761 | 780 | tri.accel_bgcolour = (tri.accel_bgcolour & 0xff00ffff) | (data << 16); |
| 762 | | if(LOG) logerror("Trident: Background Colour set to %08x\n",tri.accel_bgcolour); |
| 781 | if(LOG_ACCEL) logerror("Trident: Background Colour set to %08x\n",tri.accel_bgcolour); |
| 763 | 782 | break; |
| 764 | 783 | case 0x13: |
| 765 | 784 | tri.accel_bgcolour = (tri.accel_bgcolour & 0x00ffffff) | (data << 24); |
| 766 | | if(LOG) logerror("Trident: Background Colour set to %08x\n",tri.accel_bgcolour); |
| 785 | if(LOG_ACCEL) logerror("Trident: Background Colour set to %08x\n",tri.accel_bgcolour); |
| 767 | 786 | break; |
| 768 | 787 | case 0x14: // Pattern Location |
| 769 | 788 | tri.accel_pattern_loc = (tri.accel_pattern_loc & 0xff00) | data; |
| 770 | | if(LOG) logerror("Trident: Pattern Location set to %04x\n",tri.accel_pattern_loc); |
| 771 | | debugger_break(machine()); |
| 789 | if(LOG_ACCEL) logerror("Trident: Pattern Location set to %04x\n",tri.accel_pattern_loc); |
| 772 | 790 | break; |
| 773 | 791 | case 0x15: |
| 774 | 792 | tri.accel_pattern_loc = (tri.accel_pattern_loc & 0x00ff) | (data << 8); |
| 775 | | if(LOG) logerror("Trident: Pattern Location set to %04x\n",tri.accel_pattern_loc); |
| 776 | | debugger_break(machine()); |
| 793 | if(LOG_ACCEL) logerror("Trident: Pattern Location set to %04x\n",tri.accel_pattern_loc); |
| 777 | 794 | break; |
| 778 | 795 | case 0x18: // Destination X |
| 779 | 796 | tri.accel_dest_x = (tri.accel_dest_x & 0xff00) | data; |
| 780 | | if(LOG) logerror("Trident: Destination X set to %04x\n",tri.accel_dest_x); |
| 797 | if(LOG_ACCEL) logerror("Trident: Destination X set to %04x\n",tri.accel_dest_x); |
| 781 | 798 | break; |
| 782 | 799 | case 0x19: |
| 783 | 800 | tri.accel_dest_x = (tri.accel_dest_x & 0x00ff) | (data << 8); |
| 784 | | if(LOG) logerror("Trident: Destination X set to %04x\n",tri.accel_dest_x); |
| 801 | if(LOG_ACCEL) logerror("Trident: Destination X set to %04x\n",tri.accel_dest_x); |
| 785 | 802 | break; |
| 786 | 803 | case 0x1a: // Destination Y |
| 787 | 804 | tri.accel_dest_y = (tri.accel_dest_y & 0xff00) | data; |
| 788 | | if(LOG) logerror("Trident: Destination Y set to %04x\n",tri.accel_dest_y); |
| 805 | if(LOG_ACCEL) logerror("Trident: Destination Y set to %04x\n",tri.accel_dest_y); |
| 789 | 806 | break; |
| 790 | 807 | case 0x1b: |
| 791 | 808 | tri.accel_dest_y = (tri.accel_dest_y & 0x00ff) | (data << 8); |
| 792 | | if(LOG) logerror("Trident: Destination Y set to %04x\n",tri.accel_dest_y); |
| 809 | if(LOG_ACCEL) logerror("Trident: Destination Y set to %04x\n",tri.accel_dest_y); |
| 793 | 810 | break; |
| 794 | 811 | case 0x1c: // Source X |
| 795 | 812 | tri.accel_source_x = (tri.accel_source_x & 0xff00) | data; |
| 796 | | if(LOG) logerror("Trident: Source X set to %04x\n",tri.accel_source_x); |
| 813 | if(LOG_ACCEL) logerror("Trident: Source X set to %04x\n",tri.accel_source_x); |
| 797 | 814 | break; |
| 798 | 815 | case 0x1d: |
| 799 | 816 | tri.accel_source_x = (tri.accel_source_x & 0x00ff) | (data << 8); |
| 800 | | if(LOG) logerror("Trident: Source X set to %04x\n",tri.accel_source_x); |
| 817 | if(LOG_ACCEL) logerror("Trident: Source X set to %04x\n",tri.accel_source_x); |
| 801 | 818 | break; |
| 802 | 819 | case 0x1e: // Source Y |
| 803 | 820 | tri.accel_source_y = (tri.accel_source_y & 0xff00) | data; |
| 804 | | if(LOG) logerror("Trident: Source Y set to %04x\n",tri.accel_source_y); |
| 821 | if(LOG_ACCEL) logerror("Trident: Source Y set to %04x\n",tri.accel_source_y); |
| 805 | 822 | break; |
| 806 | 823 | case 0x1f: |
| 807 | 824 | tri.accel_source_y = (tri.accel_source_y & 0x00ff) | (data << 8); |
| 808 | | if(LOG) logerror("Trident: Source Y set to %04x\n",tri.accel_source_y); |
| 825 | if(LOG_ACCEL) logerror("Trident: Source Y set to %04x\n",tri.accel_source_y); |
| 809 | 826 | break; |
| 810 | 827 | case 0x20: // Dimension(?) X |
| 811 | 828 | tri.accel_dim_x = (tri.accel_dim_x & 0xff00) | data; |
| 812 | | if(LOG) logerror("Trident: Dimension X set to %04x\n",tri.accel_dim_x); |
| 829 | if(LOG_ACCEL) logerror("Trident: Dimension X set to %04x\n",tri.accel_dim_x); |
| 813 | 830 | break; |
| 814 | 831 | case 0x21: |
| 815 | 832 | tri.accel_dim_x = (tri.accel_dim_x & 0x00ff) | (data << 8); |
| 816 | | if(LOG) logerror("Trident: Dimension X set to %04x\n",tri.accel_dim_x); |
| 833 | if(LOG_ACCEL) logerror("Trident: Dimension X set to %04x\n",tri.accel_dim_x); |
| 817 | 834 | break; |
| 818 | 835 | case 0x22: // Dimension(?) Y |
| 819 | 836 | tri.accel_dim_y = (tri.accel_dim_y & 0xff00) | data; |
| 820 | | if(LOG) logerror("Trident: Dimension y set to %04x\n",tri.accel_dim_y); |
| 837 | if(LOG_ACCEL) logerror("Trident: Dimension y set to %04x\n",tri.accel_dim_y); |
| 821 | 838 | break; |
| 822 | 839 | case 0x23: |
| 823 | 840 | tri.accel_dim_y = (tri.accel_dim_y & 0x00ff) | (data << 8); |
| 824 | | if(LOG) logerror("Trident: Dimension y set to %04x\n",tri.accel_dim_y); |
| 841 | if(LOG_ACCEL) logerror("Trident: Dimension y set to %04x\n",tri.accel_dim_y); |
| 825 | 842 | break; |
| 826 | 843 | case 0x24: // Style |
| 827 | 844 | tri.accel_style = (tri.accel_style & 0xffffff00) | data; |
| 828 | | if(LOG) logerror("Trident: Style set to %08x\n",tri.accel_style); |
| 845 | if(LOG_ACCEL) logerror("Trident: Style set to %08x\n",tri.accel_style); |
| 829 | 846 | break; |
| 830 | 847 | case 0x25: |
| 831 | 848 | tri.accel_style = (tri.accel_style & 0xffff00ff) | (data << 8); |
| 832 | | if(LOG) logerror("Trident: Style set to %08x\n",tri.accel_style); |
| 849 | if(LOG_ACCEL) logerror("Trident: Style set to %08x\n",tri.accel_style); |
| 833 | 850 | break; |
| 834 | 851 | case 0x26: |
| 835 | 852 | tri.accel_style = (tri.accel_style & 0xff00ffff) | (data << 16); |
| 836 | | if(LOG) logerror("Trident: Style set to %08x\n",tri.accel_style); |
| 853 | if(LOG_ACCEL) logerror("Trident: Style set to %08x\n",tri.accel_style); |
| 837 | 854 | break; |
| 838 | 855 | case 0x27: |
| 839 | 856 | tri.accel_style = (tri.accel_style & 0x00ffffff) | (data << 24); |
| 840 | | if(LOG) logerror("Trident: Style set to %08x\n",tri.accel_style); |
| 857 | if(LOG_ACCEL) logerror("Trident: Style set to %08x\n",tri.accel_style); |
| 841 | 858 | break; |
| 842 | 859 | case 0x28: // Source Clip X |
| 843 | 860 | tri.accel_source_x_clip = (tri.accel_source_x_clip & 0xff00) | data; |
| 844 | | if(LOG) logerror("Trident: Source X Clip set to %04x\n",tri.accel_source_x_clip); |
| 861 | if(LOG_ACCEL) logerror("Trident: Source X Clip set to %04x\n",tri.accel_source_x_clip); |
| 845 | 862 | break; |
| 846 | 863 | case 0x29: |
| 847 | 864 | tri.accel_source_x_clip = (tri.accel_source_x_clip & 0x00ff) | (data << 8); |
| 848 | | if(LOG) logerror("Trident: Source X Clip set to %04x\n",tri.accel_source_x_clip); |
| 865 | if(LOG_ACCEL) logerror("Trident: Source X Clip set to %04x\n",tri.accel_source_x_clip); |
| 849 | 866 | break; |
| 850 | 867 | case 0x2a: // Source Clip Y |
| 851 | 868 | tri.accel_source_y_clip = (tri.accel_source_y_clip & 0xff00) | data; |
| 852 | | if(LOG) logerror("Trident: Source Y Clip set to %04x\n",tri.accel_source_y_clip); |
| 869 | if(LOG_ACCEL) logerror("Trident: Source Y Clip set to %04x\n",tri.accel_source_y_clip); |
| 853 | 870 | break; |
| 854 | 871 | case 0x2b: |
| 855 | 872 | tri.accel_source_y_clip = (tri.accel_source_y_clip & 0x00ff) | (data << 8); |
| 856 | | if(LOG) logerror("Trident: Source Y Clip set to %04x\n",tri.accel_source_y_clip); |
| 873 | if(LOG_ACCEL) logerror("Trident: Source Y Clip set to %04x\n",tri.accel_source_y_clip); |
| 857 | 874 | break; |
| 858 | 875 | case 0x2c: // Destination Clip X |
| 859 | 876 | tri.accel_dest_x_clip = (tri.accel_dest_x_clip & 0xff00) | data; |
| 860 | | if(LOG) logerror("Trident: Destination X Clip set to %04x\n",tri.accel_dest_x_clip); |
| 877 | if(LOG_ACCEL) logerror("Trident: Destination X Clip set to %04x\n",tri.accel_dest_x_clip); |
| 861 | 878 | break; |
| 862 | 879 | case 0x2d: |
| 863 | 880 | tri.accel_dest_x_clip = (tri.accel_dest_x_clip & 0x00ff) | (data << 8); |
| 864 | | if(LOG) logerror("Trident: Destination X Clip set to %04x\n",tri.accel_dest_x_clip); |
| 881 | if(LOG_ACCEL) logerror("Trident: Destination X Clip set to %04x\n",tri.accel_dest_x_clip); |
| 865 | 882 | break; |
| 866 | 883 | case 0x2e: // Destination Clip Y |
| 867 | 884 | tri.accel_dest_y_clip = (tri.accel_dest_y_clip & 0xff00) | data; |
| 868 | | if(LOG) logerror("Trident: Destination Y Clip set to %04x\n",tri.accel_dest_y_clip); |
| 885 | if(LOG_ACCEL) logerror("Trident: Destination Y Clip set to %04x\n",tri.accel_dest_y_clip); |
| 869 | 886 | break; |
| 870 | 887 | case 0x2f: |
| 871 | 888 | tri.accel_dest_y_clip = (tri.accel_dest_y_clip & 0x00ff) | (data << 8); |
| 872 | | if(LOG) logerror("Trident: Destination Y Clip set to %04x\n",tri.accel_dest_y_clip); |
| 889 | if(LOG_ACCEL) logerror("Trident: Destination Y Clip set to %04x\n",tri.accel_dest_y_clip); |
| 873 | 890 | break; |
| 874 | 891 | case 0x48: // CKEY (Chromakey?) |
| 875 | 892 | tri.accel_ckey = (tri.accel_ckey & 0xffffff00) | data; |
| 876 | | if(LOG) logerror("Trident: CKey set to %08x\n",tri.accel_ckey); |
| 893 | if(LOG_ACCEL) logerror("Trident: CKey set to %08x\n",tri.accel_ckey); |
| 877 | 894 | break; |
| 878 | 895 | case 0x49: |
| 879 | 896 | tri.accel_ckey = (tri.accel_ckey & 0xffff00ff) | (data << 8); |
| 880 | | if(LOG) logerror("Trident: CKey set to %08x\n",tri.accel_ckey); |
| 897 | if(LOG_ACCEL) logerror("Trident: CKey set to %08x\n",tri.accel_ckey); |
| 881 | 898 | break; |
| 882 | 899 | case 0x4a: |
| 883 | 900 | tri.accel_ckey = (tri.accel_ckey & 0xff00ffff) | (data << 16); |
| 884 | | if(LOG) logerror("Trident: CKey set to %08x\n",tri.accel_ckey); |
| 901 | if(LOG_ACCEL) logerror("Trident: CKey set to %08x\n",tri.accel_ckey); |
| 885 | 902 | break; |
| 886 | 903 | case 0x4b: |
| 887 | 904 | tri.accel_ckey = (tri.accel_ckey & 0x00ffffff) | (data << 24); |
| 888 | | if(LOG) logerror("Trident: CKey set to %08x\n",tri.accel_ckey); |
| 905 | if(LOG_ACCEL) logerror("Trident: CKey set to %08x\n",tri.accel_ckey); |
| 889 | 906 | break; |
| 890 | 907 | case 0x58: // Foreground Pattern Colour |
| 891 | 908 | tri.accel_fg_pattern_colour = (tri.accel_fg_pattern_colour & 0xffffff00) | data; |
| 892 | | if(LOG) logerror("Trident: FG Pattern Colour set to %08x\n",tri.accel_fg_pattern_colour); |
| 909 | if(LOG_ACCEL) logerror("Trident: FG Pattern Colour set to %08x\n",tri.accel_fg_pattern_colour); |
| 893 | 910 | break; |
| 894 | 911 | case 0x59: |
| 895 | 912 | tri.accel_fg_pattern_colour = (tri.accel_fg_pattern_colour & 0xffff00ff) | (data << 8); |
| 896 | | if(LOG) logerror("Trident: FG Pattern Colour set to %08x\n",tri.accel_fg_pattern_colour); |
| 913 | if(LOG_ACCEL) logerror("Trident: FG Pattern Colour set to %08x\n",tri.accel_fg_pattern_colour); |
| 897 | 914 | break; |
| 898 | 915 | case 0x5a: |
| 899 | 916 | tri.accel_fg_pattern_colour = (tri.accel_fg_pattern_colour & 0xff00ffff) | (data << 16); |
| 900 | | if(LOG) logerror("Trident: FG Pattern Colour set to %08x\n",tri.accel_fg_pattern_colour); |
| 917 | if(LOG_ACCEL) logerror("Trident: FG Pattern Colour set to %08x\n",tri.accel_fg_pattern_colour); |
| 901 | 918 | break; |
| 902 | 919 | case 0x5b: |
| 903 | 920 | tri.accel_fg_pattern_colour = (tri.accel_fg_pattern_colour & 0x00ffffff) | (data << 24); |
| 904 | | if(LOG) logerror("Trident: FG Pattern Colour set to %08x\n",tri.accel_fg_pattern_colour); |
| 921 | if(LOG_ACCEL) logerror("Trident: FG Pattern Colour set to %08x\n",tri.accel_fg_pattern_colour); |
| 905 | 922 | break; |
| 906 | 923 | case 0x5c: // Background Pattern Colour |
| 907 | 924 | tri.accel_bg_pattern_colour = (tri.accel_bg_pattern_colour & 0xffffff00) | data; |
| 908 | | if(LOG) logerror("Trident: BG Pattern Colour set to %08x\n",tri.accel_bg_pattern_colour); |
| 925 | if(LOG_ACCEL) logerror("Trident: BG Pattern Colour set to %08x\n",tri.accel_bg_pattern_colour); |
| 909 | 926 | break; |
| 910 | 927 | case 0x5d: |
| 911 | 928 | tri.accel_bg_pattern_colour = (tri.accel_bg_pattern_colour & 0xffff00ff) | (data << 8); |
| 912 | | if(LOG) logerror("Trident: BG Pattern Colour set to %08x\n",tri.accel_bg_pattern_colour); |
| 929 | if(LOG_ACCEL) logerror("Trident: BG Pattern Colour set to %08x\n",tri.accel_bg_pattern_colour); |
| 913 | 930 | break; |
| 914 | 931 | case 0x5e: |
| 915 | 932 | tri.accel_bg_pattern_colour = (tri.accel_bg_pattern_colour & 0xff00ffff) | (data << 16); |
| 916 | | if(LOG) logerror("Trident: BG Pattern Colour set to %08x\n",tri.accel_bg_pattern_colour); |
| 933 | if(LOG_ACCEL) logerror("Trident: BG Pattern Colour set to %08x\n",tri.accel_bg_pattern_colour); |
| 917 | 934 | break; |
| 918 | 935 | case 0x5f: |
| 919 | 936 | tri.accel_bg_pattern_colour = (tri.accel_bg_pattern_colour & 0x00ffffff) | (data << 24); |
| 920 | | if(LOG) logerror("Trident: BG Pattern Colour set to %08x\n",tri.accel_bg_pattern_colour); |
| 937 | if(LOG_ACCEL) logerror("Trident: BG Pattern Colour set to %08x\n",tri.accel_bg_pattern_colour); |
| 921 | 938 | break; |
| 922 | 939 | default: |
| 923 | | if(LOG) logerror("Trident: unimplemented acceleration register offset %02x write %02x\n",offset,data); |
| 940 | logerror("Trident: unimplemented acceleration register offset %02x write %02x\n",offset,data); |
| 924 | 941 | } |
| 925 | 942 | } |
| 926 | 943 | |
| r32231 | r32232 | |
| 933 | 950 | break; |
| 934 | 951 | case 0x01: |
| 935 | 952 | if(LOG) logerror("Trident: Command: BitBLT ROP3 (Source %i,%i Dest %i,%i Size %i,%i)\n",tri.accel_source_x,tri.accel_source_y,tri.accel_dest_x,tri.accel_dest_y,tri.accel_dim_x,tri.accel_dim_y); |
| 936 | | logerror("BitBLT: Drawflags = %08x\n",tri.accel_drawflags); |
| 953 | if(LOG) logerror("BitBLT: Drawflags = %08x FMIX = %02x\n",tri.accel_drawflags,tri.accel_fmix); |
| 937 | 954 | accel_bitblt(); |
| 938 | 955 | break; |
| 939 | 956 | case 0x02: |
| r32231 | r32232 | |
| 973 | 990 | int xdir,ydir; |
| 974 | 991 | int xstart,xend,ystart,yend; |
| 975 | 992 | |
| 993 | if(tri.accel_drawflags & 0x0040) // TODO: handle PATMONO also |
| 994 | { |
| 995 | tri.accel_mem_x = tri.accel_dest_x; |
| 996 | tri.accel_mem_y = tri.accel_dest_y; |
| 997 | tri.accel_memwrite_active = true; |
| 998 | return; |
| 999 | } |
| 1000 | |
| 976 | 1001 | if(tri.accel_drawflags & 0x0200) |
| 977 | 1002 | { |
| 978 | 1003 | xdir = -1; |
| r32231 | r32232 | |
| 1036 | 1061 | // if(LOG_8514) logerror("8514/A: Command (%04x) - Line (Bresenham) - %i,%i Axial %i, Diagonal %i, Error %i, Major Axis %i, Minor Axis %i\n",ibm8514.current_cmd, |
| 1037 | 1062 | // ibm8514.curr_x,ibm8514.curr_y,ibm8514.line_axial_step,ibm8514.line_diagonal_step,ibm8514.line_errorterm,ibm8514.rect_width,ibm8514.rect_height); |
| 1038 | 1063 | |
| 1039 | | if(tri.accel_drawflags & 0x400) |
| 1064 | if(tri.accel_drawflags & 0x0400) |
| 1040 | 1065 | { |
| 1041 | 1066 | temp = dx; dx = dy; dy = temp; |
| 1042 | 1067 | } |
| r32231 | r32232 | |
| 1057 | 1082 | } |
| 1058 | 1083 | } |
| 1059 | 1084 | } |
| 1085 | |
| 1086 | // feed data written to VRAM to an active BitBLT command |
| 1087 | void trident_vga_device::accel_data_write(UINT32 data) |
| 1088 | { |
| 1089 | for(int x=31;x>=0;x--) |
| 1090 | { |
| 1091 | if(((data >> x) & 0x01) != 0) |
| 1092 | WRITEPIXEL8(tri.accel_mem_x,tri.accel_mem_y,tri.accel_fgcolour); |
| 1093 | tri.accel_mem_x++; |
| 1094 | } |
| 1095 | if(tri.accel_mem_x > tri.accel_dest_x+tri.accel_dim_x) |
| 1096 | { |
| 1097 | tri.accel_mem_x = tri.accel_dest_x; |
| 1098 | tri.accel_mem_y++; |
| 1099 | if(tri.accel_mem_y > tri.accel_dest_y+tri.accel_dim_y) |
| 1100 | tri.accel_memwrite_active = false; // completed |
| 1101 | } |
| 1102 | } |