home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / ue312os2.zip / src / temp < prev    next >
Text File  |  1994-08-26  |  4KB  |  146 lines

  1. int PASCAL NEAR ibmputc(ch) /* put a character at the current position in the
  2.            current colors */
  3.  
  4. int ch;
  5.  
  6. {
  7.     /* if its a newline, we have to move the cursor */
  8.     if (ch == '\n' || ch == '\r') {
  9.         rg.h.ah = 3;
  10.         int86(0x10, &rg, &rg);
  11.         if (rg.h.dh == 24) {
  12.             ibmmove(20, 0);
  13.             /* we must scroll the screen */
  14.             rg.h.ah = 6;    /* scroll up */
  15.             rg.h.al = 1;    /* # of lines to scroll by */
  16. #if    COLOR
  17.             rg.h.bh = cfcolor; /* attribute for blank line */
  18. #else
  19.             rg.h.bh = 0; /* attribute for blank line */
  20. #endif
  21.             rg.x.cx = 0;    /* upper left corner of scroll */
  22.             rg.x.dx = 0x184f;/* lower right */
  23.             int86(0x10, &rg, &rg);
  24.             rg.h.dh = 23;
  25.         }
  26.         ibmmove(rg.h.dh + 1, 0);
  27.         return(TRUE);
  28.     }
  29.  
  30. #if    1
  31.     if (ch == '\b') {
  32.  
  33.         /* backup the cursor by 1 position */
  34.         rg.h.ah = 3;        /* read current position */
  35.         int86(0x10, &rg, &rg);
  36.         rg.h.dl--;        /* move it forward one */
  37.         rg.h.ah = 2;        /* set its new position */
  38.         int86(0x10, &rg, &rg);
  39.     
  40.         rg.h.ah = 9;        /* write char with attributes to cursor position */
  41.         rg.h.bh = 0;        /* display page zero */
  42.         rg.x.cx = 1;        /* only one please! */
  43.         rg.h.al = ' ';        /* character to write */
  44. #if    COLOR
  45.         rg.h.bl = ((ctrans[gbcolor] << 4) | ctrans[gfcolor]);/* attribute */
  46. #else
  47.         rg.h.bl = 07;
  48. #endif
  49.         int86(0x10, &rg, &rg);
  50.         return(TRUE);
  51.     }
  52.  
  53.     if (ch == 7) {
  54.         TTbeep();
  55.         return(TRUE);
  56.     }
  57.  
  58.     rg.h.ah = 9;        /* write char with attributes to cursor position */
  59.     rg.h.bh = 0;        /* display page zero */
  60.     rg.x.cx = 1;        /* only one please! */
  61.     rg.h.al = ch;        /* character to write */
  62. #if    COLOR
  63.     rg.h.bl = ((ctrans[gbcolor] << 4) | ctrans[gfcolor]);    /* attribute */
  64. #else
  65.     rg.h.bl = 07;
  66. #endif
  67.     int86(0x10, &rg, &rg);
  68.  
  69.     /* advance the cursor by 1 position */
  70.     rg.h.ah = 3;        /* read current position */
  71.     int86(0x10, &rg, &rg);
  72.     rg.h.dl++;        /* move it forward one */
  73.     rg.h.ah = 2;        /* set its new position */
  74.     int86(0x10, &rg, &rg);
  75. #else
  76.     rg.h.ah = 14;        /* write char to screen with current attrs */
  77.     rg.h.al = ch;
  78. #if    COLOR
  79.     if (dtype != CDMONO)
  80.         rg.h.bl = cfcolor;
  81.     else
  82.         rg.h.bl = 0x07;
  83. #else
  84.     rg.h.bl = 0x07;
  85. #endif
  86.     int86(0x10, &rg, &rg);
  87. #endif
  88. }
  89.  
  90. int PASCAL NEAR ibmeeop()
  91.  
  92. {
  93.     rg.h.ah = 6;        /* scroll page up function code */
  94.     rg.h.al = 0;        /* # lines to scroll (clear it) */
  95.     rg.x.cx = (term.t_roworg << 8) | (term.t_colorg);
  96.                 /* upper left corner of scroll */
  97.     rg.x.dx = ((term.t_nrow + term.t_roworg) << 8) |
  98.             (term.t_ncol + term.t_colorg - 1);
  99.                 /* lower right corner of scroll */
  100. #if    COLOR
  101.     if (dtype != CDMONO)
  102.         if (revflag)
  103.             rg.h.bh = ((ctrans[gfcolor] & 15) << 4) | (ctrans[gbcolor] & 15);
  104.         else
  105.             rg.h.bh = ((ctrans[gbcolor] & 15) << 4) | (ctrans[gfcolor] & 15);
  106.     else
  107.         if (revflag)
  108.             rg.h.bh = 70;
  109.         else
  110.             rg.h.bh = 07;
  111. #else
  112.     rg.h.bh = 07;
  113. #endif
  114.     int86(0x10, &rg, &rg);
  115. }
  116.  
  117. int PASCAL NEAR ibmclrdesk()
  118.  
  119. {
  120.     int attr;        /* attribute to fill screen with */
  121.  
  122.     rg.h.ah = 6;        /* scroll page up function code */
  123.     rg.h.al = 0;        /* # lines to scroll (clear it) */
  124.     rg.x.cx = 0;        /* upper left corner of scroll */
  125.     rg.x.dx = (desk_rows << 8) | desk_cols;
  126.                 /* lower right corner of scroll */
  127. #if    COLOR
  128.     if (dtype != CDMONO)
  129.         if (revflag)
  130.             attr = ((ctrans[gfcolor] & 15) << 4) | (ctrans[deskcolor] & 15);
  131.         else
  132.             attr = ((ctrans[deskcolor] & 15) << 4) | (ctrans[gfcolor] & 15);
  133.     else
  134.         if (revflag)
  135.             attr = 70;
  136.         else
  137.             attr = 07;
  138. #else
  139.     attr = 07;
  140. #endif
  141.  
  142.     rg.h.bh = attr;
  143.     int86(0x10, &rg, &rg);
  144. }
  145.  
  146.