vt100.sl 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. %
  2. % VT100.SL - EMODE support for VT100 terminals
  3. %
  4. % Author: William F. Galway
  5. % Symbolic Computation Group
  6. % Computer Science Dept.
  7. % University of Utah
  8. % Date: 27 June 1982
  9. % Copyright (c) 1982 University of Utah
  10. %
  11. % Screen starts at (0,0), and other corner is offset by (79,23) (total
  12. % dimensions are 80 wide by 24 down)
  13. (setf ScreenBase (Coords 0 0))
  14. (setf ScreenDelta (Coords 79 23))
  15. % Parity mask is used to clear "parity bit" for those terminals that don't
  16. % have a meta key. It should be 8#177 in that case. Should be 8#377 for
  17. % terminals with a meta key.
  18. (setf parity_mask 8#177)
  19. (DE EraseScreen ()
  20. (progn
  21. % First, erase the screen
  22. (PBOUT (Char ESC))
  23. (PBOUT (Char ![))
  24. (PBOUT (Char 2))
  25. (PBOUT (Char J))
  26. % Then make sure the cursor's at home.
  27. (SetTerminalCursor 0 0)
  28. ))
  29. (DE Ding ()
  30. (PBOUT (Char Bell)))
  31. % Clear to end of line from current position (inclusive).
  32. (DE TerminalClearEol ()
  33. (progn
  34. (PBOUT (Char ESC))
  35. (PBOUT (Char ![))
  36. (PBOUT (Char K))))
  37. % Move physical cursor to Column,Row
  38. (DE SetTerminalCursor (ColLoc RowLoc)
  39. (progn
  40. (PBOUT (char ESC))
  41. (PBOUT (Char ![))
  42. % Use "quick and dirty" conversion to decimal digits.
  43. (PBOUT (plus (char 0) (quotient (add1 RowLoc) 10)))
  44. (PBOUT (plus (char 0) (remainder (add1 RowLoc) 10)))
  45. % Delimiter between row digits and column digits.
  46. (PBOUT (char !;))
  47. (PBOUT (plus (char 0) (quotient (add1 ColLoc) 10)))
  48. (PBOUT (plus (char 0) (remainder (add1 ColLoc) 10)))
  49. (PBOUT (char H)) % Terminate the sequence
  50. ))