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

  1. /* *** Listing 2 ***
  2.  *
  3.  * Draws a series of concentric ellipses that should appear to be
  4.  * circles in the EGA's hi-res mode, mode 10h. (They may not appear
  5.  * to be circles on monitors that don't display mode 10h with the
  6.  * same aspect ratio as the Enhanced Color Display.)
  7.  * For EGA or VGA.
  8.  * Compile and link with listingX.c (where X is 1 or 4) with:
  9.  *    tcc listingX listing2      (Turbo C)
  10.  *    cl listingX.c listing2.c   (MSC)
  11.  */
  12.  
  13. #include <dos.h>
  14.  
  15. main() {
  16.    int BaseRadius, Temp, Color;
  17.    union REGS Regs;
  18.  
  19.    /* Select EGA's hi-res 640x350 graphics mode, mode 10h */
  20.    Regs.x.ax = 0x0010;
  21.    int86(0x10, &Regs, &Regs);
  22.  
  23.    /* Draw concentric ellipses */
  24.    for ( BaseRadius = 2, Color = 7; BaseRadius < 58; BaseRadius++ ) {
  25.       DrawEllipse(640/2, 350/2, BaseRadius*4, BaseRadius*3, Color);
  26.       Color = (Color + 1) & 0x0F;   /* cycle through 16 colors */
  27.    }
  28.  
  29.    /* Wait for a key, restore text mode, and done */
  30.    scanf("%c", &Temp);
  31.    Regs.x.ax = 0x0003;
  32.    int86(0x10, &Regs, &Regs);
  33. }
  34.  
  35.