trunk/src/emu/bus/isa/trident.c
r32670 | r32671 | |
30 | 30 | #define CRTC_PORT_ADDR ((vga.miscellaneous_output&1)?0x3d0:0x3b0) |
31 | 31 | |
32 | 32 | #define LOG (1) |
33 | | #define LOG_ACCEL (0) |
| 33 | #define LOG_ACCEL (1) |
34 | 34 | |
35 | 35 | trident_vga_device::trident_vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
36 | 36 | : svga_device(mconfig, TRIDENT_VGA, "Trident TGUI9680", tag, owner, clock, "trident_vga", __FILE__) |
r32670 | r32671 | |
120 | 120 | case 0x5a: // XOR PAT |
121 | 121 | src = dst ^ src; |
122 | 122 | break; |
| 123 | case 0xb8: // PAT xor (SRC and (DST xor PAT)) (correct?) |
| 124 | src = src & (dst ^ src); |
| 125 | break; |
123 | 126 | } |
124 | 127 | return src; |
125 | 128 | } |
r32670 | r32671 | |
140 | 143 | void trident_vga_device::WRITEPIXEL(INT16 x,INT16 y, UINT32 data) |
141 | 144 | { |
142 | 145 | if(svga.rgb8_en) |
143 | | WRITEPIXEL8(x,y,(((data >> 16) & 0xff) | ((data >> 8) & 0xff) | (data & 0xff))); // XFree86 3.3 sets bits 0-7 to 0 when using mono patterns, does it OR each byte? |
| 146 | WRITEPIXEL8(x,y,(((data >> 8) & 0xff) | (data & 0xff))); // XFree86 3.3 sets bits 0-7 to 0 when using mono patterns, does it OR each byte? |
144 | 147 | if(svga.rgb15_en) |
145 | 148 | WRITEPIXEL15(x,y,data & 0x7fff); |
146 | 149 | if(svga.rgb16_en) |
r32670 | r32671 | |
184 | 187 | void trident_vga_device::device_reset() |
185 | 188 | { |
186 | 189 | svga_device::device_reset(); |
187 | | svga.id = 0xd3; // identifies at TGUI9660XGi (set to 0xe3 to identify at TGUI9440AGi) |
| 190 | svga.id = 0xd3; // 0xd3 identifies at TGUI9660XGi (set to 0xe3 to identify at TGUI9440AGi) |
188 | 191 | tri.revision = 0x01; // revision identifies as TGUI9680 |
189 | 192 | tri.new_mode = false; // start up in old mode |
190 | 193 | tri.dac_active = false; |
191 | 194 | tri.linear_active = false; |
192 | 195 | tri.mmio_active = false; |
193 | 196 | tri.sr0f = 0x6f; |
194 | | tri.sr0c = 0x78; |
| 197 | tri.sr0c = 0x70; |
| 198 | tri.cr2a = 0x03; // set ISA interface? |
195 | 199 | tri.mem_clock = 0x2c6; // 50MHz default |
196 | 200 | tri.vid_clock = 0; |
197 | 201 | tri.port_3c3 = true; |
r32670 | r32671 | |
517 | 521 | case 0x1f: |
518 | 522 | res = tri.cr1f; |
519 | 523 | break; |
| 524 | case 0x20: |
| 525 | res = tri.cr20; |
| 526 | break; |
520 | 527 | case 0x21: |
521 | 528 | res = tri.cr21; |
522 | 529 | break; |
r32670 | r32671 | |
533 | 540 | case 0x29: |
534 | 541 | res = tri.cr29; |
535 | 542 | break; |
| 543 | case 0x2a: |
| 544 | res = tri.cr2a; |
| 545 | break; |
536 | 546 | case 0x38: |
537 | 547 | res = tri.pixel_depth; |
538 | 548 | break; |
r32670 | r32671 | |
618 | 628 | case 0x1f: |
619 | 629 | tri.cr1f = data; // "Software Programming Register" written to by the BIOS |
620 | 630 | break; |
| 631 | case 0x20: // FIFO Control (old MMIO enable? no documentation of this register) |
| 632 | tri.cr20 = data; |
| 633 | break; |
621 | 634 | case 0x21: // Linear aperture |
622 | 635 | tri.cr21 = data; |
623 | 636 | tri.linear_address = ((data & 0xc0)<<18) | ((data & 0x0f)<<20); |
624 | 637 | tri.linear_active = data & 0x20; |
625 | | //if(tri.linear_active) |
626 | | //popmessage("Trident: Linear Aperture active - %08x, %s",tri.linear_address,(tri.cr21 & 0x10) ? "2MB" : "1MB" ); |
| 638 | if(tri.linear_active) |
| 639 | popmessage("Trident: Linear Aperture active - %08x, %s",tri.linear_address,(tri.cr21 & 0x10) ? "2MB" : "1MB" ); |
627 | 640 | break; |
628 | 641 | case 0x27: |
629 | 642 | vga.crtc.start_addr = (vga.crtc.start_addr & 0xfff9ffff) | ((data & 0x03)<<17); |
r32670 | r32671 | |
632 | 645 | tri.cr29 = data; |
633 | 646 | vga.crtc.offset = (vga.crtc.offset & 0xfeff) | ((data & 0x10)<<4); |
634 | 647 | break; |
| 648 | case 0x2a: |
| 649 | tri.cr2a = data; |
| 650 | break; |
635 | 651 | case 0x38: |
636 | 652 | // bit 0: 16 bit bus |
637 | 653 | // bits 2-3: pixel depth (1=15/16bit, 2=24/32bit, 0=anything else) |
r32670 | r32671 | |
1006 | 1022 | } |
1007 | 1023 | } |
1008 | 1024 | |
| 1025 | READ8_MEMBER(trident_vga_device::vram_r) |
| 1026 | { |
| 1027 | if (tri.linear_active) |
| 1028 | return vga.memory[offset % vga.svga_intf.vram_size]; |
| 1029 | else |
| 1030 | return 0xff; |
| 1031 | } |
| 1032 | |
| 1033 | WRITE8_MEMBER(trident_vga_device::vram_w) |
| 1034 | { |
| 1035 | if (tri.linear_active) |
| 1036 | { |
| 1037 | if(tri.accel_memwrite_active) |
| 1038 | { |
| 1039 | tri.accel_transfer = (tri.accel_transfer & (~(0x000000ff << (24-(8*(offset % 4)))))) | (data << (24-(8 * (offset % 4)))); |
| 1040 | if(offset % 4 == 3) |
| 1041 | accel_data_write(tri.accel_transfer); |
| 1042 | return; |
| 1043 | } |
| 1044 | vga.memory[offset % vga.svga_intf.vram_size] = data; |
| 1045 | } |
| 1046 | } |
| 1047 | |
1009 | 1048 | READ8_MEMBER(trident_vga_device::mem_r ) |
1010 | 1049 | { |
| 1050 | if((tri.cr20 & 0x10) && (offset >= 0x1ff00)) // correct for old MMIO? |
| 1051 | { |
| 1052 | return old_mmio_r(space,offset-0x1ff00); |
| 1053 | } |
| 1054 | |
1011 | 1055 | if (svga.rgb8_en || svga.rgb15_en || svga.rgb16_en || svga.rgb32_en) |
1012 | 1056 | { |
1013 | 1057 | int data; |
r32670 | r32671 | |
1029 | 1073 | |
1030 | 1074 | WRITE8_MEMBER(trident_vga_device::mem_w) |
1031 | 1075 | { |
| 1076 | if((tri.cr20 & 0x10) && (offset >= 0x1ff00)) // correct for old MMIO? |
| 1077 | { |
| 1078 | old_mmio_w(space,offset-0x1ff00,data); |
| 1079 | return; |
| 1080 | } |
| 1081 | |
1032 | 1082 | if(tri.accel_memwrite_active) |
1033 | 1083 | { |
1034 | 1084 | tri.accel_transfer = (tri.accel_transfer & (~(0x000000ff << (24-(8*(offset % 4)))))) | (data << (24-(8 * (offset % 4)))); |
r32670 | r32671 | |
1054 | 1104 | vga_device::mem_w(space,offset,data,mem_mask); |
1055 | 1105 | } |
1056 | 1106 | |
| 1107 | // Old style MMIO (maps to 0xbff00) |
| 1108 | void trident_vga_device::old_mmio_w(address_space& space, UINT32 offset, UINT8 data) |
| 1109 | { |
| 1110 | if(offset >= 0x20) |
| 1111 | accel_w(space,offset-0x20,data); |
| 1112 | } |
| 1113 | |
| 1114 | UINT8 trident_vga_device::old_mmio_r(address_space& space, UINT32 offset) |
| 1115 | { |
| 1116 | if(offset == 0x20) |
| 1117 | { |
| 1118 | if(tri.accel_busy) |
| 1119 | return 0x20; |
| 1120 | } |
| 1121 | if(offset > 0x20) |
| 1122 | return accel_r(space,offset-0x20); |
| 1123 | else |
| 1124 | return 0x00; |
| 1125 | } |
| 1126 | |
| 1127 | |
1057 | 1128 | // 2D Acceleration functions (very WIP) |
1058 | 1129 | |
1059 | 1130 | // From XFree86 source: |
r32670 | r32671 | |
1131 | 1202 | else |
1132 | 1203 | res = 0x00; |
1133 | 1204 | break; |
| 1205 | // Operation mode: |
| 1206 | // bit 8: disable clipping if set |
1134 | 1207 | case 0x02: // Operation Mode |
1135 | 1208 | res = tri.accel_opermode & 0x00ff; |
1136 | 1209 | break; |
trunk/src/emu/bus/isa/svga_trident.c
r32670 | r32671 | |
81 | 81 | m_isa->install_device(0x3b0, 0x3bf, 0, 0, read8_delegate(FUNC(trident_vga_device::port_03b0_r),m_vga), write8_delegate(FUNC(trident_vga_device::port_03b0_w),m_vga)); |
82 | 82 | m_isa->install_device(0x3c0, 0x3cf, 0, 0, read8_delegate(FUNC(trident_vga_device::port_03c0_r),m_vga), write8_delegate(FUNC(trident_vga_device::port_03c0_w),m_vga)); |
83 | 83 | m_isa->install_device(0x3d0, 0x3df, 0, 0, read8_delegate(FUNC(trident_vga_device::port_03d0_r),m_vga), write8_delegate(FUNC(trident_vga_device::port_03d0_w),m_vga)); |
| 84 | m_isa->install_device(0x43c4, 0x43cb, 0, 0, read8_delegate(FUNC(trident_vga_device::port_43c6_r),m_vga), write8_delegate(FUNC(trident_vga_device::port_43c6_w),m_vga)); |
84 | 85 | m_isa->install_device(0x83c4, 0x83cb, 0, 0, read8_delegate(FUNC(trident_vga_device::port_83c6_r),m_vga), write8_delegate(FUNC(trident_vga_device::port_83c6_w),m_vga)); |
85 | | m_isa->install_device(0x43c4, 0x43cb, 0, 0, read8_delegate(FUNC(trident_vga_device::port_43c6_r),m_vga), write8_delegate(FUNC(trident_vga_device::port_43c6_w),m_vga)); |
86 | 86 | |
87 | 87 | m_isa->install_memory(0xa0000, 0xbffff, 0, 0, read8_delegate(FUNC(trident_vga_device::mem_r),m_vga), write8_delegate(FUNC(trident_vga_device::mem_w),m_vga)); |
88 | 88 | |
r32670 | r32671 | |
90 | 90 | // m_isa->install_memory(0x4400000, 0x45fffff, 0, 0, read8_delegate(FUNC(trident_vga_device::vram_r),m_vga), write8_delegate(FUNC(trident_vga_device::vram_w),m_vga)); |
91 | 91 | |
92 | 92 | // win95 drivers |
93 | | m_isa->install_memory(0x4000000, 0x41fffff, 0, 0, read8_delegate(FUNC(trident_vga_device::vram_r),m_vga), write8_delegate(FUNC(trident_vga_device::vram_w),m_vga)); |
| 93 | // m_isa->install_memory(0x4000000, 0x41fffff, 0, 0, read8_delegate(FUNC(trident_vga_device::vram_r),m_vga), write8_delegate(FUNC(trident_vga_device::vram_w),m_vga)); |
94 | 94 | |
95 | 95 | // acceleration ports |
96 | 96 | m_isa->install_device(0x2120, 0x21ff, 0, 0, read8_delegate(FUNC(trident_vga_device::accel_r),m_vga), write8_delegate(FUNC(trident_vga_device::accel_w),m_vga)); |