home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_09_01 / 9n01137a < prev    next >
Text File  |  1990-12-16  |  1KB  |  46 lines

  1.  
  2.  
  3. /* works with Microsoft C V6.0, PC with EGA */
  4.  
  5. #include <stdio.h>
  6. #include <dos.h>
  7.  
  8. void cchar(int chr, int color, int background, int blink, int page);
  9.  
  10. #define BLACK   O
  11. #define BLUE    1
  12. #define GREEN   2
  13. /* etc. */
  14.  
  15. void main()
  16. {
  17.     printf("%c", 65);                 /* prints 'A' */
  18.     printf("%c", l);                  /* prints smiley face */
  19.  
  20.     printf("%c", 7);                  /* rings bell */
  21.     putchar(7);                       /* rings bell */
  22.  
  23. /* above functions call DOS (probably via INT 21H), which
  24. ** executes some control codes with their traditional meaning.
  25. */
  26.  
  27. /* now bypass DOS and use ROM-BIOS *   /
  28. cchar(7, GREEN, BLACK, 1, 0);          /* blinking green diamond */
  29. }
  30.  
  31.  
  32. /* color character at present cursor location */
  33. void cchar( int chr, int color, int background, int blink, int page)
  34. {
  35. union REGS regs;
  36.  
  37.     regs.h.ah = 9;                    /* write character function */
  38.     regs.h.al = chr;                  /* character code */
  39.                                       /* attribute */
  40.     regs.h.bl = (blink ? Ox80 : 0) | ((background & 7) << 4) | (color & 0x0f);
  41.     regs.h.bh = page;                 /* display page */
  42.     regs.x.cx = l;                    /* repetition count */
  43.     int86(0xlO, ®s, ®s);        /* call BIOS video function */
  44. }
  45.  
  46.