home *** CD-ROM | disk | FTP | other *** search
/ Shareware 1 2 the Maxx / sw_1.zip / sw_1 / PROGRAM / PCL4C30.ZIP / DOS.C < prev    next >
Text File  |  1992-01-04  |  2KB  |  78 lines

  1. /* dos.c */
  2.  
  3. #define void int
  4. #define BYTE unsigned char
  5.  
  6. #include  <stdio.h>
  7. #include  <dos.h>
  8.  
  9. static BYTE cur_row  = 0;      /* current row */
  10. static BYTE cur_col  = 0;      /* current col */
  11.  
  12. /* write character & attribute without advancing cursor */
  13.  
  14. void AttrWrite(ch,attr)
  15. BYTE ch;
  16. BYTE attr;
  17. {union REGS  reg;
  18.  reg.h.ah = 9;
  19.  reg.h.bh = 0;        /* current text page */
  20.  reg.h.al = ch;       /* character */
  21.  reg.h.bl = attr;
  22.  reg.x.cx = 1;
  23.  int86(0x10, ®, ®);
  24. }
  25.  
  26. /* position cursor at desired row & column */
  27.  
  28. void Position(row, col)
  29. BYTE row, col;
  30. {union REGS reg;
  31.  reg.h.ah = 2;
  32.  reg.h.bh = 0;
  33.  reg.h.dh = row;
  34.  reg.h.dl = col;
  35.  int86(0x10, ®, ®);
  36.  cur_row = row;
  37.  cur_col = col;
  38. }
  39.  
  40. /* returns the current row of the cursor */
  41.  
  42. int GetRow()
  43. {union  REGS  reg;
  44.  reg.h.ah = 3;
  45.  reg.h.bh = 0;
  46.  int86(0x10, ®, ®);
  47.  return(reg.h.dh);
  48. }
  49.  
  50. /* returns the current column of the cursor */
  51.  
  52. int GetCol()
  53. {union  REGS  reg;
  54.  reg.h.ah = 3;
  55.  reg.h.bh = 0;
  56.  int86(0x10, ®, ®);
  57.  return(reg.h.dl);
  58. }
  59.  
  60. /* scrolls area specified # rows */
  61.  
  62. int Scroll(urow, lcol, lrow, rcol, nrows, attr)
  63. unsigned  urow;   /* upper row of area */
  64. unsigned  lcol;   /* left column of area */
  65. unsigned  lrow;   /* lower row of area */
  66. unsigned  rcol;   /* right column of area */
  67. int nrows;        /* # rows to scroll */
  68. int attr;         /* attribute to use for blank lines */
  69. {union REGS reg;
  70.  reg.h.ah = 6;
  71.  reg.h.ch = urow;
  72.  reg.h.cl = lcol;
  73.  reg.h.al = nrows;
  74.  reg.h.bh = attr;
  75.  reg.h.dh = lrow;
  76.  reg.h.dl = rcol;
  77.  int86(0x10, ®, ®);
  78. }