home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / PCGPEV10.ZIP / SVGINTRO.TXT < prev    next >
Text File  |  1994-05-11  |  28KB  |  474 lines

  1.             ┌─────────────────────────────────────────────┐
  2.             │ Introduction to Programming the SVGA Cards  │
  3.             └─────────────────────────────────────────────┘
  4.  
  5.             Written for the PC-GPE by Mark Feldman
  6.             e-mail address : u914097@student.canberra.edu.au
  7.                              myndale@cairo.anu.edu.au
  8.  
  9.              ┌───────────────────────────────────────────┐
  10.              │      THIS FILE MAY NOT BE DISTRIBUTED     │
  11.              │ SEPARATE TO THE ENTIRE PC-GPE COLLECTION. │
  12.              └───────────────────────────────────────────┘
  13.  
  14.  
  15. ┌────────────┬───────────────────────────────────────────────────────────────
  16. │ Disclaimer │
  17. └────────────┘
  18.  
  19. I assume no responsibility whatsoever for any effect that this file, the
  20. information contained therein or the use thereof has on you, your sanity,
  21. computer, spouse, children, pets or anything else related to you or your
  22. existance. No warranty is provided nor implied with this information.
  23.  
  24.  
  25. ┌───────────────────────┬────────────────────────────────────────────────────
  26. │ SVGA Section Overview │
  27. └───────────────────────┘
  28.  
  29. The vast majority of the information presented in the PC-GPE was obtained
  30. from the book "Programmer's Guide to the EGA and VGA Cards - Includes Super
  31. VGAs, Second Edition" by Richard Ferraro, ISBN 0-201-57025-4, published
  32. by Addison-Wesley. This book is by far the most comprehensive VGA/SVGA
  33. reference I have seen to date and is more than worth it's price tag. I
  34. heartily recommend it to anyone wishing to do any serious graphics
  35. programming for the PC.
  36.  
  37. The PC-GPE SVGA section was originally not going to be included in version 1
  38. due to the fact that I have only been able to verify that the info on the
  39. Paradise SVGA is correct. I will include it however, in the hope that
  40. everyone (and I mean *EVERYONE*) who reads these files and tries out the
  41. routines will e-mail me with the results they get so I can make the
  42. modifications in time for version 2.
  43.  
  44. I will need to know these things:
  45.  
  46. 1) Your SVGA board name
  47.  
  48. 2) The id and revision number of the chip inside (if possible)
  49.  
  50. 3) What you tried and the results you got. This applies to *all* routines,
  51.    bank switching, chip detection etc....  I need to know everything!
  52.  
  53. If a routine doesn't work as expected then let me know if it's doing anything
  54. at all. "The routine is stuffed you idiot" won't exactly help me much, but
  55. "I can only read pixels in bank 0 you idiot" just might......
  56.  
  57. And of course there's always the chance that I've misunderstood my references
  58. so I need to have my mistakes pointed out to me as well. I'm a big boy...I
  59. can take it!
  60.  
  61. ┌──────────────────────────┬────────────────────────────────────────────────
  62. │ Writing to the VGA Ports │
  63. └──────────────────────────┘
  64.  
  65. Many of the PC-GPE SVGA texts have the PortW Pascal command as follows:
  66.  
  67. PortW[PORTNUM] := VALUE;
  68.  
  69. This command writes a 16 bit word to the port, the same as the asm op code:
  70.  
  71. out dx, ax
  72.  
  73. The effect of this code is the same as the following two Pascal statements:
  74.  
  75. Port[PORTNUM] := Lo(VALUE);
  76. Port[PORTNUM + 1] := Hi(VALUE);
  77.  
  78. I'm not sure if this is common to all the PC ports or only works on the
  79. VGA. (Perhaps someone could enlighten me?)
  80.  
  81. The PortW command is very handy when writing to the SVGA extended registers.
  82. The SVGA register sets are all extensions of the VGA register sets and
  83. use an indexed addressing scheme to cut down on the number of ports they
  84. use. The texts often have register maps which look similar to the following:
  85.  
  86.           PR0A Address Offset A
  87.           Index : 09h at port 3CEh
  88.           Read/Write at port 3CFh
  89.           ┌───┬───┬───┬───┬───┬───┬───┬───┐
  90.           │ 7 │ 6 │ 5 │ 4 │ 3 │ 2 │ 1 │ 0 │
  91.           └───┴───┴───┴───┴───┴───┴───┴───┘
  92.                 └───────────┬───────────┘
  93.                            Bank
  94.  
  95. For this particular map, the register name is PR0A Offset A. To select the
  96. register and get it ready for reading and/or writing you write the value
  97. 09h to port 3CEh (the index port). The register can then be read from or
  98. written to port 3CFh (the read/write port).
  99.  
  100. ┌────────────────┬──────────────────────────────────────────────────────────
  101. │ Bank Switching │
  102. └────────────────┘
  103.  
  104. In real mode, the PC has addresses A000:0000-B000:FFFF allocated for video
  105. memory, although most graphics modes only use the A000 segment.
  106.  
  107. If you set an SVGA card to 640x480x256 color mode (for example) then there
  108. will be a total of 307200 pixels on the screen. Since each pixel takes up
  109. one byte in 256 color modes around 300K of video memory will be used to
  110. store the screen data. In most cases all this memory is accessed through the
  111. A000 segment. When you initially set the mode, bank 0 on the card will be
  112. active and anything you read to or write from this segment will be in the
  113. first 64K bytes in video memory (i.e. lines 0-101 and the first 256 bytes in
  114. line number 102). If you want to access the next 64K you must switch the
  115. card to bank number 1 so that the A000 segment now maps to the second bank,
  116. and so forth.
  117.  
  118. The problem here is that each card has a different method of doing the bank
  119. switching. The PC-GPE files contain info on how to do the bank switching for
  120. a number of the most commonly used SVGA cards. The VESA standard helped
  121. inject some sanity into the otherwise chaotic world of SVGA programming by
  122. introducing a "standard" method of bank switching for all cards.
  123.  
  124. A note should be made here about bank granularity. In the section above I
  125. assumed that bank 0 corresponded to the first 64K, bank 1 to the next etc..
  126. ie each bank has a 64K granularity. This is true for most cards, but some
  127. do have smaller granularities (see the table below). The Paradise for
  128. instance has a 4K granularity. It's very similar in concept to the PC's
  129. segmented memory, segments are 64K long but they have a 16 byte granularity.
  130. The Paradise chip's banks are also 64K long, but they have a 4K granularity.
  131. All the bank switching code given in the PC-GPE SVGA files adjust for this
  132. so that your code can assume the card has a 64K granularity in all cases.
  133.  
  134.  
  135. ┌────────────────┬───────────────────────────────────────────────────────────
  136. │ SVGA Libraries │
  137. └────────────────┘
  138.  
  139. There are a few SVGA libraries available via anonymouse ftp. I haven't had
  140. a chance to use any of them yet, but I've heard some of them are pretty good,
  141. so they might be worth checking out. Here's two C libraries that I know of:
  142.  
  143.      site: ftp.fasttax.com
  144. directory: /pc/graphic/scitech/beta
  145.  filename: svkt44bl.zip
  146.  
  147.      site: garbo.uwasa.fi
  148. directory: /pc/programming
  149.  filename: SVGACC20.ZIP
  150.  
  151.  
  152. ┌───────────────────┬───────────────────────────────────────────────────────
  153. │ Common SVGA Cards │
  154. └───────────────────┘
  155.  
  156. The PC-GPE files contain information on programming the 7 VGA "standards"
  157. as covered by Ferraro. According to Ferraro the majority of SVGA cards on
  158. the market today conform to one of these standards. The standards are
  159. Ati, Chips and Technologies, Genoa, Paradise, Trident, Tseng and Video7.
  160. I've also included a file on the VESA specifications (VESASP12.TXT). VESA
  161. seems to be the way to go now since public domain drivers are available for
  162. most cards and you only need to write one set of graphics drivers if you use
  163. it. VESA BIOS calls can be slow however, so if your program needs to do LOTS
  164. of bank switching then you may need to work with the cards on a hardware
  165. level.
  166.  
  167. The following is a list of common SVGA's along with the chip it is based on,
  168. the number of banks the card contains and the modes they support. The GR
  169. field is the bank granularity. This information was obtained by examining
  170. the configuration files in the shareware program VPIC. VPIC is a great
  171. little program which supports numerous graphics file formats as well
  172. as all the cards listed below (and a few more). VPIC can be obtained via
  173. anonymous ftp from oak.oakland.edu, directory /pub/msdos/gif, filename
  174. vpic. I tried to contact the author so I'd feel better about blatently
  175. ripping all the info out of his data files but he doesn't seem to have an
  176. e-mail address. Are you out there Bob Montgomery?
  177.  
  178. Quite a number of the chip sets in the list are not mentioned in Ferraro. If
  179. anyone has information on programming any of them drop me a line.
  180.  
  181. Each mode in the table below has a mode number. To set the mode, load the AX
  182. register with this value and do an interrupt 10h. Some modes below have two
  183. numbers. In these cases load AX with the first number and BX with the second
  184. before calling interrupt 10h.
  185.  
  186. Only 16 and 256 color are presented in the table below. True-color modes
  187. are not included in this version.
  188.  
  189.  
  190. Board                   Chip           Banks     Modes    Resolution  Col GR
  191. ─────────────────────────────────────────────────────────────────────────────
  192.  
  193. Acumos                  ACUMOS         8         5Eh      640x400     256 64k
  194.                                                  5Fh      640x480     256 64k
  195.                                                  5Ch      800x256     256 64k
  196.                                                  10h      640x350     16  64k
  197.                                                  12h      640x480     16  64k
  198.                                                  58h      800x600     16  64k
  199.                                                  5dh      1024x768    16  64k
  200.  
  201. Ahead A Chip            AHEADA         4/8       60h      640x400     256 64k
  202.                                                  61h      640x480     256 64k
  203.                                                  62h      800x600     256 64k
  204.                                                  6Ah      800x600     16  64k
  205.                                                  74h      1024x768    16  64k
  206.  
  207. Ahead B Chip            AHEADB         8/16      60h      640x400     256 64k
  208.                                                  61h      640x480     256 64k
  209.                                                  62h      800x600     256 64k
  210.                                                  63h      1024x768    256 64k
  211.                                                  6Ah      800x600     16  64k
  212.                                                  74h      1024x768    16  64k
  213.  
  214. ATI VGA Wonder          ATI OLD        4/8       61h      640x400     256 32k
  215.                                                  62h      640x480     256 32k
  216.                                                  63h      800x600     256 32k
  217.                                                  54h      800x600     16  32k
  218.                                                  65h      1024x768    16  64k
  219.  
  220. ATI VGA Wonder+         ATI NEW        4/8/16    61h      640x400     256 32k
  221.                                                  62h      640x480     256 32k
  222.                                                  63h      800x600     256 32k
  223.                                                  64h      1024x768    256 32k
  224.                                                  54h      800x600     16  32k
  225.                                                  55h      1024x768    16  32k
  226.  
  227. ATI Ultra 8514A GA      ATI NEW        4/8/16    61h      640x400     256 32k
  228.                                                  62h      640x480     256 32k
  229.                                                  63h      800x600     256 32k
  230.                                                  54h      800x600     16  32k
  231.                                                  55h      1024x768    16  32k
  232.  
  233. ATI XL                  ATI NEW        4/8/16    61h      640x400     256 32k
  234.                                                  62h      640x480     256 32k
  235.                                                  63h      800x600     256 32k
  236.                                                  64h      1024x768    256 32k
  237.                                                  54h      800x600     16  32k
  238.                                                  55h      1024x768    16  32k
  239.  
  240. Chips & Technology      Chips and      4/8       78h      640x400     256 16k
  241.                         Technologies             79h      640x480     256 16k
  242.                                                  7Ah      720x540     256 16k
  243.                                                  7Bh      800x600     256 16k
  244.                                                  70h      800x600     16  16k
  245.                                                  71h      960x720     16  16k
  246.                                                  72h      1024x768    16  16k
  247.  
  248. Cirrus Logic GD54       VESA           16/64  4F02h,100h  640x400     256  4k
  249.                                               4F02h,101h  640x480     256  4k
  250.                                               4F02h,103h  800x600     256  4k
  251.                                               4F02h,105h  1024x768    256  4k
  252.                                               4F02h,102h  800x600     16   4k
  253.                                               4F02h,104h  1024x768    16   4k
  254.  
  255. Definicon, 16 Bit       TSENG 4000     8/16      2dh      640x350     256 64k
  256.                                                  2fh      640x400     256 64k
  257.                                                  2eh      640x480     256 64k
  258.                                                  30h      800x600     256 64k
  259.                                                  38h      1024x768    256 64k
  260.                                                  29h      800x600     16  64k
  261.                                                  37h      1024x768    16  64k
  262.                                                  3Dh      1280x1024   16  64k
  263.  
  264. Diamond 24x             PARADISE       4/16      5eh      640x400     256  4k
  265.                                                  5fh      640x480     256  4k
  266.                                                  5ch      800x600     256  4k
  267.                                                  60h      1024x768    256  4k
  268.                                                  58h      800x600     16   4k
  269.                                                  5Dh      1024x768    16   4k
  270.                                                  6Ch      1280x960    16   4k
  271.                                                  64h      1280x1024   16   4k
  272.  
  273. Diamond Speedstar 24    TSENG 4000     8/16      2dh      640x350     256 64k
  274.                                                  2fh      640x400     256 64k
  275.                                                  2eh      640x480     256 64k
  276.                                                  30h      800x600     256 64k
  277.                                                  38h      1024x768    256 64k
  278.                                                  29h      800x600     16  64k
  279.                                                  37h      1024x768    16  64k
  280.  
  281. Everex EV-673           EVEREX         4/8       70h,13h  640x350     256 64k
  282.                                                  70h,14h  640x400     256 64k
  283.                                                  70h,15h  512x480     256 64k
  284.                                                  70h,30h  640x480     256 64k
  285.                                                  70h,31h  800x600     256 64k
  286.                                                  70h,02h  800x600     16  64k
  287.                                                  70h,20h  1024x768    16  64k
  288.  
  289. Everev 678              TRIDENT        4/8       70h,14h  640x400     256 64k
  290.                         8800                     70h,15h  512x480     256 64k
  291.                                                  70h,30h  640x480     256 64k
  292.                                                  70h,31h  800x600     256 64k
  293.                                                  70h,02h  800x600     16  64k
  294.                                                  70h,20h  1024x768    16  64k
  295.  
  296. Everex Vision VGA HC    TSENG 4000     8/16      2fh      640x400     256 64k
  297.                                                  2eh      640x480     256 64k
  298.  
  299. Genoa 5400              TSENG 3000     4/8       2dh      640x350     256 64k
  300.                                                  2eh      640x480     256 64k
  301.                                                  30h      800x600     256 64k
  302.                                                  29h      800x600     16  64k
  303.                                                  37h      1024x768    16  64k
  304.  
  305. Genoa 6400              GENOA          4/8       2bh      640x350     256 64k
  306.                                                  2eh      640x480     256 64k
  307.                                                  30h      800x600     256 64k
  308.                                                  29h      800x600     16  64k
  309.                                                  37h      1024x768    16  64k
  310.  
  311. Genoa 7900 24 bit       TSENG 4000     8/16      2dh      640x350     256 64k
  312.                                                  2fh      640x400     256 64k
  313.                                                  2eh      640x480     256 64k
  314.                                                  30h      800x600     256 64k
  315.                                                  38h      1024x768    256 64k
  316.                                                  29h      800x600     16  64k
  317.                                                  37h      1024x768    16  64k
  318.  
  319. Headland 1024i          HEADLAND       4/8    6F05h,66h   640x400     256 64k
  320.                                               6F05h,67h   640x480     256 64k
  321.                                               6F05h,68h   720x540     256 64k
  322.                                               6F05h,69h   800x600     256 64k
  323.                                               6F05h,61h   720x540     16  64k
  324.                                               6F05h,62h   800x600     16  64k
  325.                                               6F05h,65h   1024x768    16  64k
  326.  
  327. Hi Res 512              ZYMOS          4/8       5ch      640x400     256 64k
  328.                                                  5dh      640x480     256 64k
  329.                                                  5eh      800x600     256 64k
  330.                                                  6ah      800x600     16  64k
  331.                                                  5fh      1024x768    16  64k
  332.  
  333. Maxxon                  TRIDENT 8800   4/8       5ch      640x400     256 64k
  334.                                                  5dh      640x480     256 64k
  335.                                                  5eh      800x600     256 64k
  336.                                                  5bh      800x600     16  64k
  337.                                                  5fh      1024x768    16  64k
  338.  
  339. C&T MK82452             CHIPS AND      8         78h      640x400     256 16k
  340.                         TECHNOLOGIES             79h      640x480     256 16k
  341.                                                  70h      800x600     16  16k
  342.                                                  72h      1024x768    16  16k
  343.  
  344. NCR 77C22               NCR            8/16      5eh      640x400     256 64k
  345.                                                  5fh      640x480     256 64k
  346.                                                  5ch      800x600     256 64k
  347.                                                  62h      1024x768    256 64k
  348.                                                  58h      800x600     16  64k
  349.                                                  5dh      1024x768    16  64k
  350.  
  351. OAK                     OAK            8/16      53h      640x480     256 64k
  352.                                                  54h      800x600     256 64k
  353.                                                  59h      1024x768    256 64k
  354.                                                  52h      800x600     16  64k
  355.                                                  56h      1024x768    16  64k
  356.  
  357. Orchid
  358. Fahrenheight 1280       S3             8/16   4F02h,201h  640x480     256 64k
  359.                                               4F02h,203h  800x600     256 64k
  360.                                               4F02h,205h  1024x768    256 64k
  361.                                               4F02h,202h  800x600     16  64k
  362.                                               4F02h,204h  1024x768    16  64k
  363.                                               4F02h,206h  1280x960    16  64k
  364.                                               4F02h,206h  1280x1024   16  64k
  365.  
  366. Orchid Pro
  367. Designer II             TSENG 4000     8/16      2dh      640x350     256 64k
  368.                                                  2fh      640x400     256 64k
  369.                                                  2eh      640x480     256 64k
  370.                                                  30h      800x600     256 64k
  371.                                                  38h      1024x768    256 64k
  372.                                                  29h      800x600     16  64k
  373.                                                  37h      1024x768    16  64k
  374.  
  375. Paradise VGA Pro        PARADISE       4/16      5eh      640x400     256  4k
  376.                                                  5fh      640x480     256  4k
  377.                                                  5ch      800x600     256  4k
  378.                                                  60h      1024x768    256  4k
  379.                                                  58h      800x600     16   4k
  380.                                                  5Dh      1024x768    16   4k
  381.  
  382. Primus P2000 GA         PRIMUS         8/16      2dh      640x480     256 64k
  383.                                                  2bh      800x600     256 64k
  384.                                                  31h      1024x768    256 64k
  385.                                                  37h      1280x1024   256 64k
  386.                                                  2ah      800x600     16  64k
  387.                                                  30h      1024x768    16  64k
  388.                                                  36h      1280x1024   16  64k
  389.  
  390. Compaq QVision          QVISION        8/16      32h      640x480     256  4k
  391.                                                  38h      1024x768    256  4k
  392.                                                  10h      640x350     16   4k
  393.                                                  12h      640x480     16   4k
  394.                                                  29h      800x600     16   4k
  395.                                                  37h      1024x768    16   4k
  396.  
  397. Realtek RTVGA           REALTEK        8/16      25h      640x400     256 64k
  398.                                                  26h      640x480     256 64k
  399.                                                  27h      800x600     256 64k
  400.                                                  28h      1024x768    256 64k
  401.                                                  1Fh      800x600     16  64k
  402.                                                  21h      1024x768    16  64k
  403.                                                  2Ah      1280x1024   16  64k
  404.  
  405. Realtek RTVGA           REALTEK        8/16      25h      640x400     256 64k
  406.                                                  26h      640x480     256 64k
  407.                                                  27h      800x600     256 64k
  408.                                                  28h      1024x768    256 64k
  409.                                                  1Fh      800x600     16  64k
  410.                                                  21h      1024x768    16  64k
  411.                                                  2Ah      1280x1024   16  64k
  412.  
  413. S3 Graphics Accelerator S3             8/16   4F02h,201h  640x480     256 64k
  414.                                               4F02h,203h  800x600     256 64k
  415.                                               4F02h,205h  1024x768    256 64k
  416.                                               4F02h,202h  800x600     16  64k
  417.                                               4F02h,204h  1024x768    16  64k
  418.                                               4F02h,206h  1280x960    16  64k
  419.  
  420. STB EM 16               TSENG 4000     8/16      2dh      640x350     256 64k
  421.                                                  78h      640x400     256 64k
  422.                                                  2eh      640x480     256 64k
  423.                                                  30h      800x600     256 64k
  424.                                                  38h      1024x768    256 64k
  425.                                                  29h      800x600     16  64k
  426.                                                  37h      1024x768    16  64k
  427.  
  428. Phoebes                 TRIDENT 8800CS 4/8       5ch      640x400     256 64k
  429.                                                  5dh      640x480     256 64k
  430.                                                  5bh      800x600     16  64k
  431.                                                  5fh      1024x768    16  64k
  432.  
  433. Maxxon                  TRIDENT 8800CS 4/8       5ch      640x400     256 64k
  434.                                                  5dh      640x480     256 64k
  435.                                                  5eh      800x600     256 64k
  436.                                                  5bh      800x600     16  64k
  437.                                                  5fh      1024x768    16  64k
  438.  
  439. Trident 8900            TRIDENT 8900   8/16      5Ch      640x400     256 64k
  440.                                                  5Dh      640x480     256 64k
  441.                                                  5Eh      800x600     256 64k
  442.                                                  62h      1024x768    256 64k
  443.                                                  5Bh      800x600     16  64k
  444.                                                  5Fh      1024x768    16  64k
  445.  
  446. Tseng ET-3000           TSENG ET3000   4/8       2dh      640x350     256 64k
  447.                                                  2eh      640x480     256 64k
  448.                                                  30h      800x600     256 64k
  449.                                                  29h      800x600     16  64k
  450.                                                  36h      960x720     16  64k
  451.                                                  37h      1024x768    16  64k
  452.  
  453. Tseng ET-4000           TSENG ET4000   8/16      2dh      640x350     256 64k
  454.                                                  2fh      640x400     256 64k
  455.                                                  2eh      640x480     256 64k
  456.                                                  30h      800x600     256 64k
  457.                                                  38h      1024x768    256 64k
  458.                                                  29h      800x600     16  64k
  459.                                                  37h      1024x768    16  64k
  460.  
  461. Video 7 VRAM            VIDEO7         4/8    6f05h,66h   640x400     256 64k
  462.                                               6f05h,67h   640x480     256 64k
  463.                                               6f05h,68h   720x540     256 64k
  464.                                               6f05h,69h   800x600     256 64k
  465.                                               6f05h,61h   720x540     16  64k
  466.                                               6f05h,62h   800x600     16  64k
  467.                                               6f05h,65h   1024x768    16  64k
  468.  
  469. Western Digital 90C     PARADISE      4/8        5eh      640x400     256  4k
  470.                                                  5fh      640x480     256  4k
  471.                                                  5ch      800x600     256  4k
  472.                                                  58h      800x600     16   4k
  473.                                                  5Dh      1024x768    16   4k
  474.