[comp.sys.ibm.pc.misc] ATI VGA Wonder programming info

jwbirdsa@amc-gw.amc.com (James Birdsall) (09/07/90)

   Several people have asked for this again, so here it is, straight from
ATI's BBS...


File Name : PROGINFO.DOC
Source    : Disk P/N 008004811  Rev. 1.07
Date      : February 21, 1990

========================================================================

1.0  INTRODUCTION

1.1  PURPOSE

     The purpose of this document is to aid professional programmers who
     wish to write software to use the high resolution modes supported by
     this VGA video board. Working knowledge of EGA/VGA graphics and
     assembly language programming is required and assumed. The document
     describes several features unique to this VGA board and how each high
     resolution mode is similar or is different compared to standard VGA
     modes. It does not contain any programming information about standard
     EGA/VGA modes. Refer to the Reference list in the appendix for
     recommended EGA/VGA programmer's references.

1.2  CONVENTIONS

     The code segments contained in this document follow the conventions of
     the MicroSoft MASM assembler. Numbers given in hexadecimal end with a
     lower case h.

2.0  FEATURES OF THE VGA BOARD

2.1  STANDARD VIDEO MODES

     AH = 0  ;set video mode

     AL =    MODE/             RESOLUTION      DIM/          START
             TYPE                              COLOR         ADDRESS
     ---------------------------------------------------------------
     0h      color/alpha       320x200         40x25/ BW     b800:0h
     1h      color/alpha       320x200         40x25/ 16     b800:0h
     2h      color/alpha       640x200         80x25/ BW     b800:0h
     3h      color/alpha       640x200         80x25/ 16     b800:0h
     0*      color/alpha       320x350         40x25/ BW     b800:0h
     1*      color/alpha       320x350         40x25/ 16     b800:0h
     2*      color/alpha       640x350         80x25/ BW     b800:0h
     3*      color/alpha       640x350         80x25/ 16     b800:0h
     0+      color/alpha       360x400         40x25/ BW     b800:0h
     1+      color/alpha       360x400         40x25/ 16     b800:0h
     2+      color/alpha       720x400         80x25/ BW     b800:0h
     3+      color/alpha       720x400         80x25/ 16     b800:0h
     4h      color/graphics    320x200         40x25/  4     b800:0h
     5h      color/graphics    320x200         40x25/ BW     b800:0h
     6h      color/graphics    640x200         80x25/ BW     b800:0h
     7h      mono/alpha        720x350         80x25/ BW     b000:0h
     0dh     color/graphics    320x200         40x25/ 16     a000:0h
     0eh     color/graphics    640x200         80x25/ 16     a000:0h
     0fh     mono/graphics     640x350         80x25/ BW     a000:0h
     10h     color/graphics    640x350         80x25/ 16     a000:0h
     11h     color/graphics    640x480         80x30/ BW     a000:0h
     12h     color/graphics    640x480         80x30/ 16     a000:0h
     13h     color/graphics    320x200         80x25/256     a000:0h

2.2  ENHANCED VIDEO MODES

     23h     color/alpha       1056x350        132x25/16     b800:0h
     27h     mono/alpha        1056x350        132x25/BW     b000:0h
     33h     color/alpha       1056x352        132x44/16     b800:0h
     37h     mono/alpha        1056x352        132x44/BW     b000:0h
     53h     color/graphics    800x600         16            a000:0h
     54h     color/graphics    800x600         16            a000:0h
     61h     color/graphics    640x400         256           a000:0h
     62h     color/graphics    640x480         256           a000:0h
     63h     color/graphics    800x600         256           a000:0h
     65h     color/graphics    1024x768        16            a000:0h
     67h     color/graphics    1024x768        4             a000:0h

2.3  REQUIRED CONFIGURATIONS

     Some enhanced modes require 512K memory rather than 256K memory.
     Some enhanced modes are supported only on certain monitor types. The
     following chart describes the requirements for each enhanced mode.

     Mode#   Resolution      Colors/         Memory          Monitors
     (hex)                   Palette         Required        Supported
     -----------------------------------------------------------------
     23      132x25          16/64           256K            1,2,5
     27      132x25          B&W             256K            1,2,5
     33      132x44          16/64           256K            1,2,5
     37      132x44          B&W             256K            1,2,5
     54      800x600         16/256K         256K            5
     61      640x400         256/256K        256K            3,4,5
     62      640x480         256/256K        512K            3,4,5
     63      800x600         256/256K        512K            5
     65      1024x768        16/256K         512K            4,5
     67      1024x768        4/16            256K            4,5

     Monitors: (1) TTL mono (2) EGA (3) VGA (4) IBM 8514 (5) Multisync

3.0  DETERMINING THE STATUS OF THE CARD

     The VGA BIOS features some special functions which will allow the
     programmer to determine if a compatible VGA board is installed and how
     the card is configured within his program.

3.1  IDENTIFYING THE VIDEO CARD

     All EGA and VGA display adapters manufactured by ATI Technologies will
     contain the character string: "761295520" starting at address: C000:31.

     VGA boards which are based on the 18800 series VGA chip set are
     identified by the character string "31" at address C000:40. The card is
     further identified by 2 bytes. The definition of the byte at address
     C000:42 is:

          bit 0   = 0 hardware is fixed at either 8 or 16 bits ROM operation
          bit 0   = 1 hardware can be switched between 8 and 16 bits ROM
                    operation        
          bit 1   = 1 mouse port present on display adapter
          bit 2   = 1 supports non-interlaced 1024x768
          bit 3   = 1 microchannel product
          bit 4   = 1 contains programmable video clock chip
          bit 5-7 = not currently defined

     The character at address C000:43 contains the revision of the VGA gate
     array. Currently, revisions 1, 2 and 3 exist and other revisions may
     follow in the future.

3.2  DETERMINING THE MONITOR TYPE

     The following assembler code segment can be used to determine for
     which monitor the VGA board is currently configured.

                         cli
                         mov     dx,EXTENDED_REG
                         mov     al,DATA_I
                         out     dx,al
                         inc     dx
                         in      al,dx
                         sti
                         and     al,0fh

     returns  al =       0       EGA monitor
                         1       PS/2 monochrome monitor
                         2       TTL monochrome monitor
                         3       PS/2 color monitor
                         4       RGB color monitor
                         5       Multisync monitor
                         7       PS/2 8514 monitor
                         9       NEC MultiSync 2A
                         b       NEC MultiSync 3D
                         d       NEC MultiSync XL

     where
                         EXTENDED_REG = see section 4.41 in this document
                               DATA_I = 0bbh

     Note : We reserve the right to add more monitor types at any time. We
     recommend that if an undefined value is returned that the program
     assumed that a multisync is installed.

3.3  DETERMINING MEMORY SIZE

     The follow code segment can be used to determine the amount of video
     memory installed.

               cli
               mov       dx,EXTENDED_REG
               mov       al,DATA_I
               out       dx,al
               inc       dx
               in        al,dx
               sti
               and       al,020h

              al = 0  ; 256K display memory installed
                 = 20h; 512K display memory installed

              where EXTENDED_REG = see section 4.41 of this manual
                          DATA_I = 0bbh

3.4  DETERMINING WHETHER A MODE IS SUPPORTED

     Your VGA board implements an extended video BIOS call which can be
     used to determine if a particular mode is actually available in the
     user's current configuration. The following assembler routine
     demonstrates this technique:

               push      bp
               mov       bp,sp
               push      es
               mov       al,ARG
               mov       ah,12h
               mov       bx,5506h
               mov       bp,0ffffh
               int       10h
               mov       ax,bp
               pop       es
               pop       bp
               ret

               where ARG = mode desired in hexadecimal

     If this routine returns ax = 0ffffh, that mode is not supported in the
     current configuration. If the mode is supported, ax will contain the
     offset start address of the CRTC parameter table for that mode.

     Note : We recommend this technique as the only reliable means of
     determining if a particular mode is supported on our EGA or VGA boards.

4.0  PROGRAMMING THE HIGH RESOLUTION MODES

4.1  SETTING THE VIDEO MODE

     The VGA card can be set into a video mode through the BIOS by using
     the standard IBM method: AH is set to 0, AL is set to the video mode
     number, and a call to software interrupt 10h is executed. See sections
     2.1 and 2.2 of this manual for a list of available modes. The
     following example will perform this function:

              mov ah,0            ;set mode function
              mov al,MODE         ;select video mode
              int 10h             ;make BIOS call by using the video
                                  ;interrupt

     We recommend that programmers select the video mode through BIOS
     whenever possible rather than programming the mode via the registers.
     For any particular video mode, the configuration of the internal
     registers may differ depending on the type of monitor installed.
     Also, we reserve the right to change the product in a way which would
     be transparent to BIOS but which would have an impact on software
     which writes to the registers.

4.2  VIDEO MEMORY ADDRESSING

4.21 ADDRESS RANGE OF VGA BOARD

     The VGA board uses the RESERVED area designated by IBM for video
     RAM and the video BIOS (A000 to C7FF). The organization is as follows:

     Mono text video RAM:  B000-B7FF
     Color text video RAM: B800-BFFF
     Graphics video RAM:   A000-AFFF (upto eight 64k banked pages with 512K
                                      RAM)
     Video BIOS:           C000-C7FF

4.22 PAGES and PLANES:

     There are two memory mapping systems used with VGA graphics modes:

     Bit-packed and Planar organization.

     The Bit-packed mapping scheme is associated with pages and uses
     contiguous memory to describe each pel. IBM VGA mode 13h uses this
     system. Extended modes 61, 62, 63, and 65h also use the Bit-packed
     scheme but they use a unique method to select which page is
     available for reading and writing.

     The Planar organized memory mapping scheme is associated with
     planes and uses a bit from each plane to describe a pel. IBM VGA
     mode 12h uses this system as does Extended modes 54 and 67h.

4.23 SELECTING MEMORY PAGES:

     The memory organization of extended modes 61, 62, 63, and 65h are
     arranged into 64k page segments. The data in each page is displayed on
     a specific region of the screen image. For example, mode 63h has eight
     pages. The first page is displayed on the top eighth of the screen
     image, the second page is displayed on the second eighth of the screen
     image, and so on. Data can be read or written to one page at a time.
     The default active page is Page 0. A special code segment is required
     to be executed before data can be read or written to a specific page.
     A page selecting code segment is provided below. VGA cards with 256K
     of RAM have a maximum of four pages available and those with 512K have
     eight. Modes 61, 62, 63h require 1 byte per pel and mode 65h requires
     1/2 byte per pel.

     The following code segment can be used to select the required page:

              cli
              mov     dx,EXTENDED_REG
              mov     al,PAGE_SELECT
              out     dx,al
              inc     dl
              in      al,dx
              mov     ah,al
              and     ah,PAGE_MASK
              shl     ch,1
              or      ah,ch
              mov     al,PAGE_SELECT
              dec     dl
              out     dx,ax
              sti

     where    ch = required page value (0 to 7 for mode 63h for example)
              PAGE_SELECT  = 0B2h
              PAGE_MASK    = 0E1h
              EXTENDED_REG = value of extended register stored at memory
                             address C000:0010h. See section 4.31


     The following is a table that describes the visible range for
     each extended mode which uses the bit-packed memory organization:

     Mode 61h (640 x 400 - 256 colors):

     Page            Visible range  (column,row)              Memory range
     0               (0,0)      -->  (255,102)                A0000 - AFFFF
     1               (256,102)  -->  (511,204)                A0000 - AFFFF
     2               (512,204)  -->  (127,307)                A0000 - AFFFF
     3               (128,307)  -->  (639,399)                A0000 - AE7FF

     Mode 62h (640 x 480 - 256 colors):

     Page            Visible range  (column,row)              Memory range
     0               (0,0)      -->  (255,102)                A0000 - AFFFF
     1               (256,102)  -->  (511,204)                A0000 - AFFFF
     2               (512,204)  -->  (127,307)                A0000 - AFFFF
     3               (128,307)  -->  (383,409)                A0000 - AFFFF
     4               (384,409)  -->  (639,479)                A0000 - AAFFF

     Mode 63h (800 x 600 - 256 colors):

     Page            Visible range  (column,row)              Memory range
     0               (0,0)      -->  (735,81)                 A0000 - AFFFF
     1               (736,81)   -->  (671,163)                A0000 - AFFFF
     2               (672,163)  -->  (607,245)                A0000 - AFFFF
     3               (608,245)  -->  (543,327)                A0000 - AFFFF
     4               (544,327)  -->  (479,409)                A0000 - AFFFF
     5               (480,409)  -->  (415,491)                A0000 - AFFFF
     6               (416,491)  -->  (351,573)                A0000 - AFFFF
     7               (352,573)  -->  (799,599)                A0000 - A561F

     Mode 65h (1024 x 768 - 16 colors):

     Page            Visible range  (column,row)              Memory range
     0               (0,0)      -->  (1023,127)               A0000 - AFFFF
     1               (0,128)    -->  (1023,255)               A0000 - AFFFF
     2               (0,256)    -->  (1023,383)               A0000 - AFFFF
     3               (0,384)    -->  (1023,511)               A0000 - AFFFF
     4               (0,512)    -->  (1023,639)               A0000 - AFFFF
     5               (0,640)    -->  (1023,767)               A0000 - AFFFF
     6                        spare
     7                        spare

4.3  DETAILS OF EACH EXTENDED VIDEO MODE

4.31 132X25 - Color text (Mode 23h)
     132x25 - B&W text (Mode 27h)
     132X44 - Color text (Mode 33h)
     132X44 - B&W text (Mode 37h)

     Video Memory Organization:

     The memory organization of very similar to standard text modes. Only 
     one page of 6,660 bytes (132X25 modes) or 11,616 bytes (132X44 modes) 
     is available. 

     Video Data Organization:

     The video data organization is identical to standard text modes.

     BIOS support

     All BIOS calls supported on standard text modes are supported. 

     NOTE! It is a good idea to avoid DOS calls when using the 132X44 text 
     modes. Most versions of ANSI.SYS are not compatible with text modes 
     which have more than 25 lines. This is particularly a problem when 
     scrolling the screen.

4.32 800x600 - 16 COLORS (Mode 54h)

     Video Memory Organization:

     The memory organization is identical to 16 color IBM EGA/VGA modes
     and consists of 256K organized into 4 maps of 64K each. One bit from
     each of the 4 maps is used to compose each pel. The IBM EGA/VGA Map
     Mask Register is used to select any or all the maps to be updated.

      A0000:0 -> ---------- <===========================================\
                | 60,000   |----------                                  |
                |          | 60,000   |----------                       |
                |----------|          | 60,000   |--------- <==\     240,000
                | Reserved |----------|          | 60,000  |   |        |
                 ----------| Reserved |----------|         |   |64K     |
                   Plane 0  ----------| Reserved |---------|<==|=======/
                              Plane 1  ----------| Reserved|   |       
                                          Plane 2 --------- <==/       
                                                     Plane 3

     Video Data Format:

     The video data format is identical to the 16 color IBM EGA/VGA modes. 

     Color Mapping:

     Color selection and palette changing is identical to the 16 color IBM 
     EGA/VGA modes.

4.33 640x400 - 256 COLORS (Mode 61h)

     Video Memory Configuration:

     This enhanced resolution mode uses a page memory system unique to this
     VGA board. The memory is organized into contiguous 64K blocks located
     at A0000H to AFFFFH. A VGA board equipped with 256K or 512K of RAM
     will support this mode. Mode 61h uses four 64K pages.  For information
     on selecting the active page, refer to section 4.23 "SELECTING MEMORY
     PAGES" of this document.

      A0000:0 -> ---------- <=========================================\
                |          |----------                                |
                |   64K    |          |----------                     |
                |          |          |          |----------       256,000
                |          |   64K    |          |  59,392  |         |
                 ----------|          |   64K    |          |         |
                  Page 0    ----------|          |----------|<========/ 
                               Page 1  ----------| Reserved |        
                                          Page 2  ----------  
                                                     Page 3


     Video Data Format:

     The video data format is identical to IBM VGA mode 13h (320x200-256
     color). Each pel is represented by 1 byte.

     Color Mapping:

     Color selection and palette changing is identical to VGA mode 13h.

4.34 640x480 - 256 COLORS (Mode 62h)

     Video Memory Configuration:

     This enhanced resolution mode uses a page memory system unique to this
     VGA board. The memory is organized into contiguous 64K blocks located
     at A0000H to AFFFFH. The VGA board must be equipped with 512K of RAM
     to support this mode. Mode 62h uses five 64K pages. For information on
     selecting the active page, refer to section 4.23 "SELECTING MEMORY
     PAGES" of this document.


      A0000:0 -> ---------- <=============================================\
                |          |---------                                      |
                |  64K     |         |---------                            |
                |          |  64K    |         |---------                  |
                |          |         |  64K    |         |---------     307,200
                 ----------|         |         |  64K    | 45,056  |       |
                   Page 0   ---------|         |         |         |       |
                              Page 1  ---------|         |---------|<=====/ 
                                        Page 2  ---------| Reserved|       
                                                  Page 3  --------- 
                                                            Page 4


     Video Data Format:

     The video data format is identical to IBM VGA mode 13h (320x200-256
     color). Each pel is represented by 1 byte.

     Color Mapping:

     Color selection and palette changing is identical to VGA mode 13h.

4.35 800x600 - 256 COLORS (Mode 63h)

     Video Memory Configuration:

     This enhanced resolution mode uses a page memory system unique to this
     VGA board. The memory is organized into contiguous 64K blocks located
     at A0000H to AFFFFH. The VGA board must be equipped with 512K of RAM
     to support this mode. Mode 63h uses eight 64K pages. For information
     on selecting the active page, refer to section 4.23 "SELECTING MEMORY
     PAGES" of this document.


      A0000:0 -> ----------<==============================================\
                |          |----------                                     |
                | 64K      |          |----------                          |
                |          |  64K     |          | \                       |
                |          |          |  64K     |  \                      |
                 ----------|          |          |   \                  480,000
                    Page 0  ----------|          |    \                    |
                               Page 1  ----------       ----------         |
                                          Page 3  \    |  21,248  |        |
                                                   \   |          |        |
                                                    \  |----------|<======/
                                                     \ | Reserved |  
                                                        ---------- 
                                                           Page 7


     Video Data Format:

     The video data format is identical to IBM VGA mode 13h (320x200-256
     color). Each pel is represented by 1 byte.

     Color Mapping:

     Color selection and palette changing is identical to VGA mode 13h.

4.36 1024x768 - 16 COLORS (Mode 65h)

     Video Memory Organization:

     This enhanced resolution mode uses a page memory system unique to this
     VGA board. The memory is organized into contiguous 64K blocks located
     at A0000H to AFFFFH. The VGA board must be equipped with 512K of RAM
     to support this mode. Mode 65h uses six 64K pages. For information
     on selecting the active page, refer to section 4.23 "SELECTING MEMORY
     PAGES" of this document.

     A0000:0 -> ---------- <=============================================\
               |          |----------                                    |
               |  64K     |          |----------                         |
               |          |   64K    |          | \                      |
               |          |          |  64K     |  \                     |
                ----------|          |          |   \                    |
                  Page 0   ----------|          |    \                   |
                              Page 1  ----------       ----------     393,216
                                        Page 2   \    |          |       |
                                                  \   |  64K     |       |
                                                   \  |          |       |
                                                    \ |          |       |
                                                       ---------- <=====/
                                                          Page 5

     Video Data Format:

     The video data format is unique to this mode. Each pel requires 4 bits
     or half a byte.

       ____________________________________________ High Order
      |    |    |    |    |                              Pixel
      |____|____|____|____|____ ____ ____ ____
      |  H |  H |  H |  H |  L |  L |  L |  L |
      |____|____|____|____|____|____|____|____|
                          |    |    |    |    |
                          |____|____|____|____|________ Low Order
                                                            Pixel

     Color Mapping:

     This mode has a different memory organization than standard EGA mode
     10h. If users want to use colors other than the standard 16 colors,
     users are required to reprogram the external palettes (3C8h/3C9h). Re-
     programming the internal palettes (3C0h) will not work the same as it
     would in EGA mode 10h because the color mapping in mode 65h is
     different. It is not recommended to change the internal palettes at
     all for mode 65h. The following table shows the mapping of colors and
     external palettes.

     Palette registers available for reprogramming are:

      Palette register   Palette register       default color   color
      (low order pels)   (high order pels)      assignment      value
      ----------------   -----------------      -------------   -----
           00h                 00h                Black           0h
           01h                 10h                Blue            1h
           02h                 20h                Green           2h
           03h                 30h                Cyan            3h
           04h                 40h                Red             4h
           05h                 50h                Magenta         5h
           06h                 60h                Brown           6h
           07h                 70h                White           7h
           08h                 80h                Dark Gray       8h
           09h                 90h                Light Blue      9h
           0Ah                 A0h                Light Green     Ah
           0Bh                 B0h                Light Cyan      Bh
           0Ch                 C0h                Light Red       Ch
           0Dh                 D0h                Light Magenta   Dh
           0Eh                 E0h                Yellow          Eh
           0Fh                 F0h                Bright White    Fh

     For example, to change the default color assignment for palette
     register 4 from Red to Bright White, palette register 4 and 40h would
     need to be reprogrammed with the values:

            Red Intensity = 3Fh
            Green Intensity = 3Fh
            Blue Intensity = 3Fh

     so that both the low order AND high order pels are affected. The only
     exception is palette register 0 (Black); reprogramming this register
     will affect both the low order and high order pels.

     An Example:

     The following example uses a standard IBM EGA/VGA BIOS call. If more
     information is required, consult the IBM EGA/VGA programmers reference
     list included in this document.

     Example segment to reprogram a palette register:

       mov    ah,10h                ;EGA/VGA Set Palette Register BIOS call
       mov    al,10h
       mov    bx,PALETTE_REG_LOW    ;Palette register to be reprogrammed
                                    ; for low order pels.
       mov    ch,GREEN_INTENSITY    ;Load new values
       mov    cl,BLUE_INTENSITY
       mov    dh,RED_INTENSITY
       int    10h

       mov    ah,10h                ;EGA/VGA Set Palette Register BIOS call
       mov    al,10h
       mov    bx,PALETTE_REG_HIGH   ;Palette register to be reprogrammed
                                    ; for high order pels.
       mov    ch,GREEN_INTENSITY
       mov    cl,BLUE_INTENSITY
       mov    dh,RED_INTENSITY
       int    10h

     where:
       PALETTE_REG_LOW  = low  pel palette register (00,01,02,..,0F)
       PALETTE_REG_HIGH = high pel palette register (00,10,20,..,F0)

       GREEN_INTENSITY
       BLUE_INTENSITY  = 6 bit intensity values for defining the default color
       RED_INTENSITY


4.37 1024x768 - 4 COLORS (Mode 67h)

     Video Memory Organization:

     The memory organization is identical to the IBM 16 color EGA and VGA
     modes. 256K of RAM is divided into 4 maps of 64k. The IBM EGA/VGA Map
     Mask Register is used to select the maps to be updated.

      A0000:0 -> ---------- <===========================================\
                | 49,152   |----------                                  |
                |    C0    | 49,152   |----------                       |
                |----------|    C1    | 49,152   |--------- <==\     196,608
                | Reserved |----------|    C0    | 49,152  |   |        |
                 ----------| Reserved |----------|    C1   |   |64K     |
                ^  Plane 0  ----------| Reserved |---------|<==|=======/
                |             Plane 1 ^----------| Reserved|   |       
                |                     |  Plane 2  ---------^<==/       
                \------odd pels-------/            Plane 3 |
                                      ^                    | 
                                      |                    |
                                      |                    |
                                      \------even pels----/

     Video Data Format:

     This mode uses a unique data format where 2 bits are required per pel.
     Plane 0 and 1 contain the data for odd numbered pels and Planes 2 and
     3 contain the data for the even numbered pels.

     Color Mapping:

     This mode supports four palette selections. The palette or color set
     is selected by setting bits 0 & 1 of the IBM EGA/VGA Color Select
     Register.

                                   Color Values (C0, C1)
     Color set #        C0=0,C1=0  C0=1,C1=0  C0=0,C1=1  C0=1,C1=1

         0              black        white      gray     bright white
         1              black        cyan       red      white
         2              black        green      red      yellow
         3              black        cyan       magenta  white

     Examples:

     The following examples use standard IBM EGA/VGA registers. If more
     information is required, consult the EGA/VGA programmers reference
     list included in this document.


     Segment example for selecting the active palette or color set:

       mov   dx,03dah      ;Load Input Status Register One
                           ;
     wait:
       in    al,dx         ;Wait for vertical retrace bit to be set
       test  al,8          ; (bit 3 = 1)
       jnz   wait          ;It is good practice to wait for the vertical
                           ; retrace bit before directly modifying the
                           ; palette registers

       mov   ah,ARG        ;Arg = color set # (0 to 3)
       mov   cl,4          ;Multiply arg by 8 so that bits 4 & 5 of the
       shl   ah,cl         ; palette registers can be modified
       mov   dx,03c0h      ;Load Palette Control Register
       mov   cx,16         ;16 Palette registers to be modified
       xor   bl,bl         ;Start from 0
                           ;
     repeat:               ;Modify bits 4 & 5 of all 16 palette registers with
       mov   al,bl         ; Arg value (color set #)
       out   dx,al         ;Select palette register
       or    al,ah
       out   dx,al         ;Write modified data to selected palette register
       loop  repeat

       mov   al,20h        ;Restore internal registers access to palette data 
       out   dx,al         ; bit 5 must be zero during palette data writing 
                           ; and one after data writing is complete


     Segment example for selecting Bit Planes to be modified during a
     memory write:

       mov   dx,03c4h      ;Load Sequencer Address Register
       mov   al,2          ;Load index of Map Mask Register
       out   dx,al         ;Select Map Mask Register
       inc   dl
       mov   al,ARG        ;Value to select which bit planes are to be
                           ; modified during a memory write
       out   dx,al         ;Select EGA/VGA planes to be modified


     IBM EGA/VGA Map Mask Register (3C5h, index 2) organization:

       Bits:   0     Controls access to Bit Plane 0
               1     Controls access to Bit Plane 1
               2     Controls access to Bit Plane 2
               3     Controls access to Bit Plane 3
               4-7   Not used

       A bit value of 0 disables access to the corresponding Bit Plane and a
       bit value of 1 enables it.

4.4  SPECIAL NOTES

4.41 NOTE ON EXTENDED REGISTER ADDRESS

     Hard-coding this value is not recommended since it is programmable
     and may be changed in subsequent BIOS releases. The value of
     EXTENDED_REG should be retrieved from the BIOS at location C000:0010h.
     The 'mov dx, EXTENDED_REG statement in the page selecting segment can
     be replaced with code to load the value of EXTENDED_REG from its stored
     location. The registers that need to be saved will depend greatly on
     the particular application:

              push es         ;save registers es and bx
              push bx
              mov  ax,0c000h  ;define storage location of EXTENDED_REG
              mov  es,ax
              mov  bx,10h
              mov  dx,es:[bx] ;get the value of EXTENDED_REG from contents
                              ;of the storage location C000:0010h
              pop  bx         ;restore registers es and bx
              pop  es

4.42 NOTE ON DAC REGISTER PROGRAMMING

     In IBM VGA mode 13h (320x200 - 256 color), each color is controlled by
     a corresponding DAC register. There are a total of 256 18-bit DAC
     registers. Therefore, each DAC register can be assigned a color value
     from 0 (BLACK) to 262,143 (BRIGHT WHITE). The first 16 DAC registers
     have assigned color values that correspond to the 16 colors used in
     mode 12h (640x480 - 16 color).  DAC register zero, which has an
     assigned color value of 0 (BLACK), also controls the color of the
     overscan border. This function is also supported in ATI modes 61, 62,
     63, and 65h. On some analog monitors, a non-BLACK overscan border may
     cause line wrapping at either the top or bottom of the screen image
     due to the video bandwidth required. For this reason, it is not
     recommended to change the color value of this DAC register.

4.43 BIOS FUNCTION SUPPORT

     Some of the extended graphics modes do not support certain video BIOS
     function calls. The following chart lists the modes affected and the
     functions which are not supported:

              MODE #              BIOS FUNCTION

              61h, 62h, 63h       ah = 06h - Scroll active page up
                                  ah = 07h - Scroll active page down

              65h, 67h            ah = 06h - Scroll active page up
                                  ah = 07h - Scroll active page down
                                  ah = 09h - Read Character at Cursor
                                  ah = 0ch - Write Dot
                                  ah = 0dh - Read Dot
                                  ah = 0eh - Write TTX

     All extended modes have only one active page regardless of the amount
     of memory installed.

5.0  APPENDIX

5.1  LIST OF SUGGESTED REFERENCES

     TITLE:       Programmer's Guide to the EGA/VGA *
     AUTHOR:      George Sutty and Steve Blair
     PUBLISHER:   Brady Books / Simon and Schuster, Inc.
     DATE:        1988

     TITLE:       Programmer's Guide to IBM PC and PS/2 Video Systems
     AUTHOR:      Richard Wilton
     PUBLISHER:   MicroSoft Press
     DATE:        1987

     TITLE:       Programmer's Guide to the EGA and VGA Cards
     AUTHOR:      Richard F. Ferraro
     PUBLISHER:   Addison - Wesley Publishing Co.
     DATE:        July, 1988

     TITLE:       EGA/VGA A Programmer's Reference Guide
     AUTHOR:      Bradley Dyck Kliewer
     PUBLISHER:   McGraw Hill
     DATE:        1988

     TITLE:       Personal System/2 Model 50 and 60 Technical Reference
     AUTHOR:      unknown
     PUBLISHER:   IBM
     DATE:        April, 1987

     TITLE:       Personal System/2 and Personal Computer BIOS Interface
                  Technical Reference
     AUTHOR:      unknown
     PUBLISHER:   IBM
     DATE:        April, 1987

              * recommended


     TO OBTAIN A PRINT COPY OF THIS DOCUMENT ON YOUR SYSTEM
     PRINTER, ENTER THE FOLLOWING COMMAND AT THE DOS PROMPT:

              TYPE PROGINFO.DOC>PRN <rtn>
-- 
---
James W. Birdsall        jwbirdsa@amc.com         71261.1731@compuserve.com
          Compu$erve: 71261,1731            GEnie: J.BIRDSALL2
For it is the doom of men that they forget. -- Merlin

kleonard@gvlv1.gvl.unisys.com (Ken Leonard) (09/10/90)

In article <3019@amc-gw.amc.com> jwbirdsa@polaris.amc.com (James Birdsall) writes:
* 
*    Several people have asked for this again, so here it is, straight from
* ATI's BBS...
* 
* [...]
* 
----------
Hummm....   Now where can we find tha same good info for a VGA built
on the C&T chipset with Cardinal BIOS?
-----------
regardz,
Ken

torkil@Pacesetter.COM (Torkil Hammer) (09/13/90)

Notice the part about finding out about supported modes.  I did
exactly so for all the 256 modes and found to my surprise that
additional undocumented modes are:

0x55, a 1024 by 768 by 16 colors graphics mode similar to 0x54 and 0x12
in encoding.  It does the same as 0x65 but uses the customary "planar"
encoding with 8 pixels per byte, each pixel occupying 4 planes.
The 0x55 BGI driver is remarkably faster than the 0x65 one,
and the use of the palette is simpler for the 0x55.

0x5b, a text mode with 30 lines of 80 chars using the 16 bit font,
34 x 80 using the 14 bit font, and 60 x 80 very flat lines using
the 8 bit font.  This is because it gives 480 vertical scan lines, while
mode 0x03+ gives 400, otherwise 0x5b and 0x03+ are identical.
(0x03+ is the VGA mode you get when a multisync terminal is connected).

In addition, it appears that 0x53 and 0x54 does the same.  Their mode
tables have the same address in the ATI BIOS rom.  The same observation
holds true for 0x00,0x01 and 0x02,0x03.

Try it, you'll like it.  Your modeage may vary.  My ATI card is from
July '89.  Of course, you need a multisync monitor to have these modes.

Torkil Hammer