home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / prof_c / 05oslib / bios / writea.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-08-11  |  740 b   |  33 lines

  1. /*
  2.  *    writea -- write attribute only to screen memory (faked by
  3.  *    reading char and attr and writing back the original
  4.  *    character and the new attribute at each position)
  5.  */
  6.  
  7. #include <local\std.h>
  8.  
  9. int writea(a, n, pg)
  10. unsigned char a;/* video attribute */
  11. int n;        /* number of positions to write */
  12. int pg;        /* screen page */
  13. {
  14.     int i;
  15.     int status;
  16.     unsigned short chx, attrx;
  17.     unsigned short r, c;
  18.  
  19.     /* get starting (current) position */
  20.     status = 0;
  21.     status = readcur(&r, &c, pg);
  22.     for (i = 0; i < n; ++i) {
  23.         status += putcur(r, c + i, pg);
  24.         status += readca(&chx, &attrx, pg);
  25.         status += writeca(chx, a, 1, pg);
  26.     }
  27.  
  28.     /* restore cursor position */
  29.     status += putcur(r, c, pg);
  30.  
  31.     return (status);
  32. }
  33.