Previous 199869 Revisions Next

r32518 Saturday 4th October, 2014 at 01:26:06 UTC by Barry Rodewald
trident: added programmable clock, previous clock select was for TGUI9440CXi and TVGA cards, still lacks a divisor for higher refresh rates, but up to 70Hz modes should be correct now.
[src/emu/bus/isa]trident.c trident.h

trunk/src/emu/bus/isa/trident.c
r32517r32518
311311      return off;
312312}
313313
314int trident_vga_device::calculate_clock()
315{
316   // Bits 0-6: M
317   // Bits 7-11: N
318   // Bit 12: K
319   // Later formula extends each variable by one extra bit (Providia 9685 and later)
320   double freq;
321   UINT8 m,n,k;
322
323   m = tri.vid_clock & 0x007f;
324   n = (tri.vid_clock & 0x0f80) >> 7;
325   k = (tri.vid_clock & 0x1000) >> 12;
326   freq = ((double)(m+8) / (double)((n+2)*(pow(2.0,k)))) * 14.31818f; // there is a 14.31818MHz clock on the board
327
328   return freq * 1000000;
329}
330
314331void trident_vga_device::trident_define_video_mode()
315332{
316333   int divisor = 1;
317334   int xtal;
318335
336   /*  // clock select for TGUI9440CXi and earlier
319337   switch(tri.clock)
320338   {
321339   case 0:
r32517r32518
344362   case 1:   xtal = xtal / 2; break;
345363   case 2:   xtal = xtal / 4; break;
346364   case 3:   xtal = xtal / 1.5; break;
365   }*/
366
367
368   // TGUI9440AGi/9660/9680/9682 programmable clock
369   switch(tri.clock)
370   {
371   case 0:
372   default: xtal = XTAL_25_1748MHz; break;
373   case 1:  xtal = XTAL_28_63636MHz; break;
374   case 2:  xtal = calculate_clock(); break; // how to divide the clock?  Needed for higher refresh rates (75Hz+)
347375   }
348376
377
349378   svga.rgb8_en = svga.rgb15_en = svga.rgb16_en = svga.rgb32_en = 0;
350379   switch((tri.pixel_depth & 0x0c) >> 2)
351380   {
r32517r32518
900929   switch(offset)
901930   {
902931   case 2:
903      if(tri.sr0e_new & 0x02 && tri.sr0e_new & 0x40)
932      if(!(tri.sr0e_new & 0x02) && (tri.sr0e_new & 0x80))
904933      {
905934         tri.mem_clock = (tri.mem_clock & 0xff00) | (data);
906935         if(LOG) logerror("Trident: Memory clock write %04x\n",tri.mem_clock);
907936      }
908937      break;
909938   case 3:
910      if(tri.sr0e_new & 0x02 && tri.sr0e_new & 0x40)
939      if(!(tri.sr0e_new & 0x02) && (tri.sr0e_new & 0x80))
911940      {
912941         tri.mem_clock = (tri.mem_clock & 0x00ff) | (data << 8);
913942         if(LOG) logerror("Trident: Memory clock write %04x\n",tri.mem_clock);
914943      }
915944      break;
916945   case 4:
917      if(tri.sr0e_new & 0x02 && tri.sr0e_new & 0x40)
946      if(!(tri.sr0e_new & 0x02) && (tri.sr0e_new & 0x80))
918947      {
919948         tri.vid_clock = (tri.vid_clock & 0xff00) | (data);
920949         if(LOG) logerror("Trident: Video clock write %04x\n",tri.vid_clock);
921950      }
922951      break;
923952   case 5:
924      if(tri.sr0e_new & 0x02 && tri.sr0e_new & 0x40)
953      if(!(tri.sr0e_new & 0x02) && (tri.sr0e_new & 0x80))
925954      {
926955         tri.vid_clock = (tri.vid_clock & 0x00ff) | (data << 8);
927956         if(LOG) logerror("Trident: Video clock write %04x\n",tri.vid_clock);
trunk/src/emu/bus/isa/trident.h
r32517r32518
6868      UINT32 linear_address;
6969      bool linear_active;
7070      bool mmio_active;
71      // TGUI9440 only?
7271      UINT16 mem_clock;  // I/O 0x43c6
7372      UINT16 vid_clock;  // I/O 0x43c8
7473      UINT16 cursor_x;
r32517r32518
118117   UINT8 trident_gc_reg_read(UINT8 index);
119118   void trident_gc_reg_write(UINT8 index, UINT8 data);
120119
120   int calculate_clock();
121
121122   void accel_command();
122123   void accel_bitblt();
123124   void accel_line();

Previous 199869 Revisions Next


© 1997-2024 The MAME Team