home *** CD-ROM | disk | FTP | other *** search
- /* Mode set routine for VGA 640x400 16-color mode.
- Tested with Borland C++ 4.02 in small model by Jim Mischel 12/16/94
- */
- #include <dos.h>
-
- void Set640x400()
- {
- union REGS regset;
-
- /* First, set to standard 640x350 mode (mode 10h) */
- regset.x.ax = 0x0010;
- int86(0x10, ®set, ®set);
-
- /* Modify the sync polarity bits (bits 7 & 6) of the
- Miscellaneous Output register (readable at 0x3CC, writable at
- 0x3C2) to select the 400-scan-line vertical scanning rate */
- outp(0x3C2, ((inp(0x3CC) & 0x3F) | 0x40));
-
- /* Now, tweak the registers needed to convert the vertical
- timings from 350 to 400 scan lines */
- outpw(0x3D4, 0x9C10); /* adjust the Vertical Sync Start register
- for 400 scan lines */
- outpw(0x3D4, 0x8E11); /* adjust the Vertical Sync End register
- for 400 scan lines */
- outpw(0x3D4, 0x8F12); /* adjust the Vertical Display End
- register for 400 scan lines */
- outpw(0x3D4, 0x9615); /* adjust the Vertical Blank Start
- register for 400 scan lines */
- outpw(0x3D4, 0xB916); /* adjust the Vertical Blank End register
- for 400 scan lines */
- }
-
-