Introduction. This is intended as a collection of documentation about all the various display adapters for the IBM PC series (and relatives). This is NOT intended as an introduction to basic VGA programming or as a ready-to-use library. There are numerous books available on the subject with much better general VGA/graphics programming sections. Neither is this intended to cover benchmarking, highlevel graphics algorithms, graphics file formats or specific graphics programs. This compilation (c) Copyright 1991-95 Finn Thoegersen. All Rights Reserved. See the file README.1ST for contact information and conditions for use and distribution. This file MUST be included unmodified in all distributions. Terminology/style: The BIOS calls are mostly taken directly from Ralf Brown's interrupt list and tends to follow its style and structure. The register descriptions are sorted by the register number. All register addresses, data values et cetera are given in hexadecimal. 3d4h means 3D4h when in color mode and 3B4h when in monochrome mode. 3CEh index 3 means register 3CEh is set to 3 and register 3CFh is the data port. See notes on register 3C0h under VGA registers. On some cards write operations can be done with a single OUTW instruction. This may fail on some cards or machines. ATI cards require the index to be updated before each access to the dataport. (R) means the register is Read Only. (W) means the register is Write Only. (R/W) means the register is both Readable and Writable. Sometimes the size of the registers is given as: W(R/W): The register is 2 bytes (16 bits) long. If the register is indexed, the low byte is in the low index (n) and the high byte is in the high index (n+1) unless otherwise indicated. 3(R/W): The register is 3 bytes (24 bits) long. The lowest byte is in the low index (n), the middle byte is in the middle index (n+1) and the upper byte in the high index (n+2). Examples are in Turbo Pascal for readability (your mileage may vary, I don't discuss politics, choice of computer, editor, keyboard, programming language or other religious matters on the net :-) ). Seriously while assembler can be more precise and/or efficient for the low-level register access, the complexity and volume of assembler can make even simple examples totally incomprehensible to all but experts. Also when I started this my "C" was not up to the task, so ... A short translation of terms: Pascal: C: Assembler: Description: x:byte; unsigned char x; x DB ? 8 bit unsigned byte y:word; unsigned int y; y DW ? 16 bit unsigned word. z:integer; int z; z DW ? 16 bit signed word. w:longint; long w; w DD ? 32 bit signed Dword s:string[20]; char s[21]; x DB 20 dup(?) a 20 character string $ABCD 0xABCD 0ABCDh The value 43981 (ABCD hex) x:=port[$3CC] x=inp(0x3CC) MOV DX,03CCh Read an 8bit value from IN AL,DX I/O port $3CC. y:=portw[$3CE] y=inpw(0x3CE) MOV DX,03CEh Read a 16bit value from IN AX,DX I/O ports $3CE and $3CF port[$3C2]:=x outp(0x3C2,x) MOV DX,03C2h Write an 8bit value to OUT DX,AL I/O port $3C2. portw[$3CE]:=y outpw(0x3CE,y) MOV DX,03CEh Write a 16bit value to OUT DX,AX I/O ports $3CE and $3CF a shr 3 a>>3 SHR AX,3 Shifts a 3 bits rights (Divides by 8). a shl 3 a<<3 SHL AX,3 Shifts a 3 bits left inc(a) a++ INC [a] Increments a by 1 dec(a) a-- DEC [a] Decrements a by 1 {Comment} /* comment */ ;comment Comments. 'string' "string" DB "string" Text string procedure x; void x(void) x PROC A procedure/function var x:integer; { ;Alloc x on stack with no parameters begin int x; _code_ a local variable _code_ _code_ ;reset stack and main body. end; } RET function y: int y(void) Well you A function returning integer; { figure it out! an integer. begin y:=123; return(123) end; } The examples use a number of simple rutines: procedure vio(ax:word); {Calls interrupt 10h with register AX=parameter ax other registers can be set in the rp structure. rp.ax is set to the return value in the AX register} function inp(reg:word):byte; {returns a byte from I/O port REG.} procedure outp(reg,val:word); {writes the byte VAL to I/O port REG} function rdinx(pt,inx:word):word; {read register PT index INX} procedure wrinx(pt,inx,val:word); {write VAL to register PT index INX} procedure modinx(pt,inx,mask,nwv:word); {In register PT index INX change the bits indicated by MASK to the ones in NWV keeping the other bits unchanged). function tstrg(pt,msk:word):boolean; {Returns true if the bits specified in MSK are read/writable in register PT} function testinx(pt,rg:word):boolean; {Returns true if all 8 bits of register PT index RG are read/writable} function testinx2(pt,rg,msk:word):boolean; {Returns true if the bits specified in MSK are read/writable in register PT index RG} procedure dac2pel; {Forces the DAC back to PEL (normal) mode} procedure dac2comm; {Enter command mode of HiColor DACs} References: Richard F. Ferraro's Programmer's guide to the EGA and VGA cards 2nd ed. Addison-Wesley 1990. ISBN 0-201-57025-4. Richard F. Ferraro's Programmer's guide to the EGA, VGA and Super VGA cards: including XGA cards, 3rd ed. Addison-Wesley 1994. ISBN 0-201-62490-7. George Sutty and Steve Blair's Advanced Programmers Guide to Super VGAs. Brady Books 1990. ISBN 0-13-010455-8. John Mueller and Wallace Wang's The Ultimate DOS Programmer's Manual. Windcrest/McGraw-Hill 1990. ISBN 0-8306-3434-3. Jake Richter's Power Programming the IBM XGA. MIS Press 1992. ISBN 1-55828-127-4 (1-55828-124-9 with disc). Ralf Brown's interrupt list version 47. (Simtel: info/inter47a.zip - info/inter47f.zip) This is based on contributions from many people, including: Dennis Grinberg dennis+@cs.cmu.edu MCGA/VGA Michael A. Moran Michael@cup.portal.com VGA INT 10h Gary E. Miller GEM@cup.portal.com Paradise, WD90c & Diamond Stealth 24X VGA Michael Shiels mshiels@ziebmef.uucp ATI VIP INT 10h Robert Seals rds95@leah.Albany.EDU ATI VGA Wonder modes Peter Sawatzki IN307@DHAFEU11.BITNET Video7 extended INT 10 Ben Myers 0003571400@mcimail.com Everex Viewpoint VGA, NCR 77c22 modes Mark Livingstone markl@csource.oz.au TVGA video modes Patrick Ibbetson ibbetsom@nes.nersc.gov NEL Electronics BIOS, Cirrus chipsets A. Peter Blicher Oakland, CA Genoa Super EGA Tim Farley tim@magee.mhs.compuserve.com XGA Bent Lynggaard lynggaard@risoe.dk misc video Frank Klemm pfk@rz.uni-jena.de Diamond Speedstar 24X Mikael Rydberg Sweden Cirrus/UM587/etc video modes Jens Vollmar Erlangen, Germany Trident/C&T video Aki Korhonen aki@holonet.net Cirrus Logic BIOS Alexi Lookin alexi@riaph.irkutsk.su Realtek RTVGA, Avance Logic, C&T video Win Osterholt 2:512/56.198 Cirrus Logic BIOS 3.02 And many, many others... John Bridge's VGAKIT52. (Simtel: vga/vgakit52.zip) Fractint v18.1 source (primarily video.asm). (Simtel: graphics/frasr181.zip) Configuration files and drivers from amongst others: CSHOW: (Simtel: graphics/cshw860a.zip) VPIC: (Simtel: gif/vpic60.zip) VUIMAGE: (Simtel: gif/vuimg340.zip) SVGA: (Simtel: gif/svga112.zip) XFree86 3.1.2 - X11 Unix SVGA driver. Available from: ftp.x.org: /contrib/XFree86 ftp.physics.su.oz.au: /XFree86 ftp.win.tue.nl: /pub/XFree86 ftp.prz.tu-berlin.de: /pub/pc/src/XFree86 The XFree86 team includes: Robert Baron Robert.Baron@ernst.mach.cs.cmu.edu David Dawes dawes@physics.su.oz.au Dirk Hohndel hohndel@informatik.uni-wuerzburg.de Glenn Lai glenn@cs.utexas.edu Rich Murphey Rich@Rice.edu Jon Tombs jon@gtex02.us.es David Wexelblat dwex@goblin.org, dwex@aib.com Thomas Wolfram wolf@prz.tu-berlin.de Orest Zborowski orestz@microsoft.com E-mail regarding XFree86 should be sent to xfree86@physics.su.oz.au PCVISION plus Frame Grabber User's Manual. Enhanced Graphics Adapter Reference Manual from HP. Commodore Advanced Graphics Adapter (AGA) manual. Data sheet for the Analog Devices ADV7160,ADV7162 Data sheets for the Chips and Technologies Inc 82c455A, 82c456, 82c457, 82c480, 65520/530, 82c425, 82c426, 82c9001A. Technical Reference Manual for the Cirrus Logic CL-GD542x True Color VGA Family, January 1994 Data sheet for the IC Designs ICD2061A Data sheets for the MUSIC MU9c1880 and MU9c9750 Data sheets for the NCR 77c22E+ and 77c32BLT Data sheets for the S3 86c911, 86c801/5, 86c928 and 86c964 Data sheet for the Tseng ET3000 and ET4000/W32 Data sheets for the Western Digital PVGA1A and WD90c24A Data sheet for the Yamaha 6388 VPDC. Programmer's Guide to the Mach32 Registers (ATI P/N: REG688000-15) VGA Wonder Programmer's Reference Manual (ATI P/N: PRG2888000-13) ATI Mouse Driver Programmer's Reference Manual (ATI P/N: PRG188200-12) Mach64 BIOS Kit (P/N: BIO-C012XX1-04), VGA Register Guide (P/N: VGA-C012XX1-04), Register Reference Guide (P/N: RRG-C012XX1-04) and Programmer's Guide (P/N: PRG-C012XX1-04) Truevision Targa+ Hardware Technical Reference Manual. Device Drivers Kit (DDK)'s for Microsoft Windows 3.1, Windows for Workgroups 3.11, Windows NT 3.51 and Windows 95 (pre-release). The following have donated reference material: H.R.R van Roosmalen and E. Zoer, Delft University of Technology, The Netherlands huub@dutetvd.ET.TUDelft.NL (no longer valid) Kendall Bennett kjb@cgl.citri.edu.au Joel Finch jfinch@ozemail.com.au Wieland Weiss weiss@metw3.met.fu-berlin.de The following have contributed information: Darren Senn sinster@scintilla.capitola.ca.us Tomi H Engdahl then@vipunen.hut.fi Jori Hamalainen jhamala@kannel.lut.fi Eric ?? praetzel@marconi.uwaterloo.ca Frank Klemm pfk@rz.uni-jena.de Michael Schindler michael@eichow.tuwien.ac.at Kendall Bennett kjb@cgl.citri.edu.au Danny Halamish dny@cs.huji.ac.il Daniel Sill sill@zoe.as.utexas.edu GARY GEM@rellim.com Paolo Severini lendl@dist.dist.unige.it Royce Shih Wea Liao liaor@umich.edu Testers: Ross Ackland rackland@csis.dit.csiro.au Chris Bailey cbailey@crl.com Ross Becker beckerr@pyrite.som.cwru.edu Darren Brown de2brown@undergrad.math.uwaterloo.ca Carlos Henrique Cantu cahcantu@pintado.ciagri.usp.br Murray Chapman muzzle@cs.uq.oz.au Frank Dikker dikker@cs.utwente.nl Michael Eichow michael@eichow.tuwien.ac.at Torben H. Hansen 100024,3066@compuserve.com Heikki Julkunen dp93hju@txfs1.hfb.se Nanda G. Kutty eapu290@orion.oac.uci.edu Leonardo Loureiro loureiro@fiu.edu Steven Martin Steven.Martin@eng.monash.edu.au Jouni Miettunen jon@stekt.oulu.fi Jack Nomssi Nomssi@physik.tu-chemnitz.de Juho-Pekka Rosti atjuro@uta.fi Lode Vande Sande stud11@cc4.kuleuven.ac.ec Joel Finch jfinch@ozemail.com.au Disclaimer: All information herein is presented as is and without warranty. Use at your own risk. IBM PC, PC/XT, PC/AT, PCjr, PS/2, Micro Channel, Personal System/2,Enhanced Graphics Adapter, Color Graphics Adapter, Video Graphics Adapter, IBM Color Display, IBM Monochrome Display, 8514/A and XGA are trademarks of International Business Machines Corporation. MS-DOS, Microsoft and Windows are trademarks of Microsoft, Incorporated. Hercules is a trademark of Hercules Computer Technology, Inc. Multisync is a trademark of Nippon Electric Company (NEC). ATI, VGAWonder, Mach8, Mach32, 8514 ULTRA, GRAPHICS ULTRA, GRAPHICS VANTAGE, GRAPHICS ULTRA+ and GRAPHICS ULTRA PRO are trademarks of ATI Technologies Inc. Brooktree and RAMDAC are trademarks of Brooktree Corporation. SMARTMAP is a trademark of Chips and Technologies, Incorporated. TARGA is a registered trademark of Truevision, Inc. Cirrus Logic and SimulSCAN are trademarks of Cirrus Logic, Inc. HiColor is a trademark of Sierra Semiconducter, Inc. i386, i486 and Intel are trademarks of Intel Corp. Inmos and SGS-Thompson are trademarks of SGS-Thompson, Ltd. IIT is a trademark of Integrated Information Technology, Inc. Motorola is a trademark of Motorola Corp. TIGA is a trademark of Texas Instruments. VBE, VESA and VSE are trademarks of the Video Electronics Standards Association. Western Digital, AutoSwitch and TrueShade are trademarks of Western Digital Corporation. WEITEK and WEITEK Power are trademarks of WEITEK Corporation All other product names are copyright and registered trademarks/tradenames of their respective owners.