示例#1
0
int putch(int c)
{
  int     row, col;

  ScreenGetCursor(&row, &col);

  /*  first, handle the character */
  if (c == '\n')
    {
      row++;
    }
  else if (c == '\r')
    {
      col = txinfo.winleft - 1;
    }
  else if (c == '\b')
  {
      if (col > txinfo.winleft - 1)
          col--;
      else if (row > txinfo.wintop -1)
      {
          /*
           * Turbo-C ignores this case; we are smarter.
           */
          row--;
          col = txinfo.winright-1;
      }
  }
  else if (c == 0x07)
    bell();
  else {
    /* short   val = c | (ScreenAttrib << 8); */
    /* puttext(col + 1, row + 1, col + 1, row + 1, &val); */
    ScreenPutChar(c, ScreenAttrib, col, row);
    col++;
  }

  /* now, readjust the window     */

  if (col >= txinfo.winright) {
    col = txinfo.winleft - 1;
    row++;
  }

  if (row >= txinfo.winbottom) {
    /* scrollwin(0, txinfo.winbottom - txinfo.wintop, 1); */
    if (_wscroll)
    {
      ScreenSetCursor(txinfo.wintop-1,0);
      delline();
    }
    row--;
  }

  ScreenSetCursor(row, col);
  txinfo.cury = row - txinfo.wintop + 2;
  txinfo.curx = col - txinfo.winleft + 2;
  return c;
}
示例#2
0
void
gotoxy(int col, int row)
{
    ScreenSetCursor(row + txinfo.wintop - 2, col + txinfo.winleft - 2);
    txinfo.curx = col;
    txinfo.cury = row;
}
示例#3
0
int cputs(const char *s)
{
  int     row, col,c;
  const unsigned char *ss = (const unsigned char *)s;
  short *viaddr;
  short sa = ScreenAttrib << 8;
  ScreenGetCursor(&row, &col);
  viaddr = (short *)VIDADDR(row,col);
  /*
   * Instead of just calling putch; we do everything by hand here,
   * This is much faster. We don't move the cursor after each character,
   * only after the whole string is written, because ScreenSetCursor
   * needs to long because of switching to real mode needed with djgpp.
   * You won't recognize the difference.
   */
  while ((c = *ss++))
    {
      /*  first, handle the character */
      if (c == '\n')
	{
	  row++;
	  viaddr += txinfo.screenwidth;
	}
      else if (c == '\r')
	{
	  col = txinfo.winleft - 1;
	  viaddr = (short *)VIDADDR(row,col);
	}
      else if (c == '\b')
        {
          if (col > txinfo.winleft-1)
          {
              col--;
              viaddr--;
          }
          else if (row > txinfo.wintop -1)
          {
              /*
               * Turbo-C ignores this case. We want to be able to
               * edit strings with backspace in gets after
               * a linefeed, so we are smarter
               */
              row--;
              col = txinfo.winright-1;
              viaddr = (short *)VIDADDR(row,col);
          }
        }
      else if (c == 0x07)
          bell();
      else {
        short q = c | sa;
        dosmemput(&q, 2, (int)viaddr);
	viaddr++;
	col++;
      }

      /* now, readjust the window     */

      if (col >= txinfo.winright) {
	col = txinfo.winleft - 1;
	row++;
	viaddr = (short *)VIDADDR(row,col);
      }

      if (row >= txinfo.winbottom) {
	ScreenSetCursor(txinfo.wintop-1,0); /* goto first line in window */
	delline();                          /* and delete it */
	row--;
	viaddr -= txinfo.screenwidth;
      }
    }

  ScreenSetCursor(row, col);
  txinfo.cury = row - txinfo.wintop + 2;
  txinfo.curx = col - txinfo.winleft + 2;
  return(*(--ss));
}
示例#4
0
文件: term_dos.c 项目: Hamcha/iotaid
void term_goto(int x, int y) {
	ScreenSetCursor(x, y);
}