home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / PCGPEV10.ZIP / XTENDED.TXT < prev   
Text File  |  1994-05-10  |  5KB  |  137 lines

  1.  
  2.                  ┌──────────────────────────────────────┐
  3.                  │ Xtended Mode - Unchained 640x400x256 │
  4.                  └──────────────────────────────────────┘
  5.  
  6.                  Written for the PC-GPE by Mark Feldman
  7.             e-mail address : u914097@student.canberra.edu.au
  8.                              myndale@cairo.anu.edu.au
  9.  
  10.                     Please read the file SVGINTRO.TXT
  11.                 (Graphics/SVGA/Intro PC-GPE menu option)
  12.  
  13.                ┌───────────────────────────────────────────┐
  14.                │      THIS FILE MAY NOT BE DISTRIBUTED     │
  15.                │ SEPARATE TO THE ENTIRE PC-GPE COLLECTION. │
  16.                └───────────────────────────────────────────┘
  17.  
  18.  
  19. ┌────────────┬───────────────────────────────────────────────────────────────
  20. │ Disclaimer │
  21. └────────────┘
  22.  
  23. I assume no responsibility whatsoever for any effect that this file, the
  24. information contained therein or the use thereof has on you, your sanity,
  25. computer, spouse, children, pets or anything else related to you or your
  26. existance. No warranty is provided nor implied with this information.
  27.  
  28.  
  29. ┌──────────────┬─────────────────────────────────────────────────────────────
  30. │ Introduction │
  31. └──────────────┘
  32.  
  33. I am calling this mode Xtended mode simply because I don't know if it 
  34. already has a name. It is a variation of mode x and it has worked on every 
  35. SVGA I have tried it on. It seems very very unlikely that I was the first 
  36. person to try this, so if this mode has already been documented elsewhere I 
  37. would very much like to hear about it.
  38.  
  39. Xtended mode is 640x400x256 and will only work on SVGA's supporting the
  40. "regular" 640x400x256 mode. It's advantage is that it requires no
  41. bank switching to access the entire display memory and, like mode x, polygon
  42. fill graphics can be up to 4 times faster.
  43.  
  44. ┌──────────────────────┬─────────────────────────────────────────────────────
  45. │ Setting Xtended Mode │
  46. └──────────────────────┘
  47.  
  48. Xtended mode is set similar to the way unchained mode 13h is set, the only
  49. difference is that you you call BIOS to set the 640x400x256 graphics mode
  50. instead of mode 13h. The 640x400x256 mode number varies from card to card.
  51. The following table lists the mode number for each of the 7 "standard"
  52. SVGAs:
  53.  
  54.            640x400x256 mode numbers for various SVGA cards
  55.                ┌─────────────────────────────────────┐
  56.                │      SVGA Chip          Mode Number │
  57.                ├─────────────────────────────────────┤
  58.                │ ATI                        61h      │
  59.                │ Chips & Technologies       78h      │
  60.                │ Genoa                      7Eh      │
  61.                │ Paradise                   5Eh      │
  62.                │ Trident                    5Ch      │
  63.                │ Tseng                      2Fh      │
  64.                │ Video 7                    66h      │
  65.                └─────────────────────────────────────┘
  66.  
  67. Alternatively the mode can be set with the VESA Set Super VGA Mode BIOS
  68. call, the VESA SVGA mode number is 100h. Refer to the file "VESASP12.TXT"
  69. for more information on VESA BIOS calls.
  70.  
  71. The following Pascal procedure will set Xtended mode for a card with a VESA
  72. driver:
  73.  
  74. const VIDEO     = $10;  { Video interrupt number                    }
  75.       CRTC_ADDR    = $3d4; { Base port of the CRT Controller (color)   }
  76.       SEQU_ADDR    = $3c4; { Base port of the Sequencer                }
  77.  
  78. procedure InitXtended;
  79. begin
  80.  
  81.   { Set VESA 640x400x256 mode }
  82.   asm
  83.     mov ax, $4F02
  84.     mov bx, $100
  85.     int VIDEO
  86.   end;
  87.  
  88.   { Turn the VGA screen off }
  89.   Port[SEQU_ADDR] := 1;
  90.   Port[SEQU_ADDR + 1] := Port[SEQU_ADDR + 1] or $20;
  91.  
  92.   { Turn off the Chain-4 bit (bit 3 at index 4, port 0x3c4) }
  93.   PortW[SEQU_ADDR] := $0604;
  94.  
  95.   { Turn off word mode, by setting the Mode Control register
  96.     of the CRT Controller (index 0x17, port 0x3d4) }
  97.   PortW[CRTC_ADDR] := $E317;
  98.  
  99.   { Turn off doubleword mode, by setting the Underline Location
  100.     register (index 0x14, port 0x3d4) }
  101.   PortW[CRTC_ADDR] := $0014;
  102.  
  103.   { Clear entire video memory, by selecting all four planes, then writing
  104.   color 0 to the entire segment. Stoopid FillChar fills 1 byte too short! }
  105.   PortW[SEQU_ADDR] := $0F02;
  106.   FillChar(Mem[$A000 : 0], $8000, 0);
  107.   FillChar(Mem[$A000 : $8000], $8000, 0);
  108.  
  109.   { Give a small delay to let the screen sort itself out }
  110.   Delay(100);
  111.  
  112.   { Turn the screen back on }
  113.   Port[SEQU_ADDR] := 1;
  114.   Port[SEQU_ADDR + 1] := Port[SEQU_ADDR + 1] and $DF;
  115. end;
  116.  
  117. ┌─────────────────┬─────────────────────────────────────────────────────────
  118. │ Drawing a Pixel │
  119. └─────────────────┘
  120.  
  121. Drawing a pixel in Xtended mode is similar to drawing one in unchained mode
  122. 13h or mode x, we just have to keep in mind that the display is now twice
  123. as wide. Also keep in mind that 640x400 has 4 times as many pixels as
  124. 320x200, so there is only one page in Xtended mode.
  125.  
  126. This example Pascal routine will draw a pixel at any screen position. I'll
  127. let you do the job of converting it to assembly:
  128.  
  129. procedure XtendedPutPixel(x, y : word; color : byte);
  130. begin
  131.   { Set map mask to select proper plane }
  132.   PortW[SEQU_ADDR] := $100 shl (x and 3) + 2;
  133.  
  134.   { Calculate address (y * 160 + x div 4) and write pixel }
  135.   Mem[$A000 : y shl 7 + y shl 5 + x shr 2] := color;
  136. end;
  137.