home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / PJ8_3.ZIP / ELLIPSE3.C < prev    next >
Text File  |  1990-02-11  |  907b  |  34 lines

  1. /* *** Listing 3 ***
  2.  *
  3.  * Draws nested ellipses of varying eccentricities in the VGA's
  4.  * hi-res mode, mode 12h.
  5.  * For VGA only.
  6.  * Compile and link with listingX.c (where X is 1 or 4) with:
  7.  *    tcc listingX listing3      (Turbo C)
  8.  *    cl listingX.c listing3.c   (MSC)
  9.  */
  10.  
  11. #include <dos.h>
  12.  
  13. main() {
  14.    int XRadius, YRadius, Temp, Color;
  15.    union REGS Regs;
  16.  
  17.    /* Select VGA's hi-res 640x480 graphics mode, mode 12h */
  18.    Regs.x.ax = 0x0012;
  19.    int86(0x10, &Regs, &Regs);
  20.  
  21.    /* Draw nested ellipses */
  22.    for ( XRadius = 100, YRadius = 2, Color = 7; YRadius < 240;
  23.          XRadius++, YRadius += 2 ) {
  24.       DrawEllipse(640/2, 480/2, XRadius, YRadius, Color);
  25.       Color = (Color + 1) & 0x0F;   /* cycle through 16 colors */
  26.    }
  27.  
  28.    /* Wait for a key, restore text mode, and done */
  29.    scanf("%c", &Temp);
  30.    Regs.x.ax = 0x0003;
  31.    int86(0x10, &Regs, &Regs);
  32. }
  33.  
  34.