home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 200-299 / ff239.lzh / JGoodies / Brunjes / CursorControl < prev    next >
Text File  |  1989-08-21  |  2KB  |  61 lines

  1. \
  2. \  Elementary cursor control words.
  3. \
  4. \  Author:  Roy E. Brunjes       20 August 1988
  5. \
  6.  
  7. ANEW  Cursor.Words
  8.  
  9. Base @                           \ Save current base on stack
  10. HEX                              \ The radix of choice for this type of work
  11.  
  12. 9B   CONSTANT  <CSI>             \ The "Control Sequence Introducer"
  13.  
  14.  
  15. : ##      ( n -- addr cnt )      \ Convert n to an ASCII string of 2 chars
  16.      S->D                        \ The #-based formatting words use d's
  17.      <# # # #> ;
  18.  
  19.  
  20. : Cursor.XY ( row column -- )    \ Send cursor to (X=row, Y=column)
  21.      <CSI> EMIT
  22.      SWAP
  23.      ##    TYPE
  24.      3B    EMIT
  25.      ##    TYPE
  26.      48    EMIT ;
  27.  
  28.  
  29. : Cursor.Up        ( n -- )      \ Make cursor go up n lines
  30.     <CSI>    EMIT                \ Tell Console handler that we're coming
  31.     ##       TYPE                \ Send # of lines to go up
  32.     41       EMIT   ;
  33.  
  34.  
  35. : Cursor.Down      ( n -- )      \ Make cursor go down n lines
  36.     <CSI> EMIT                   \ Tell Console handler that we're coming
  37.     ##    TYPE                   \ Send # of lines to go down
  38.     42    EMIT   ;
  39.  
  40.  
  41. : Cursor.Forward   ( n -- )      \ Make cursor go forward n spaces
  42.     <CSI> EMIT                   \ Tell Console handler that we're coming
  43.     ##    TYPE                   \ Send # of spaces to go forward
  44.     43    EMIT   ;
  45.  
  46.  
  47. : Cursor.Backward  ( n -- )      \ Make cursor go backward n spaces
  48.     <CSI> EMIT                   \ Tell Console handler that we're coming
  49.     ##    TYPE                   \ Send # of spaces to go backward
  50.     44    EMIT   ;
  51.  
  52.  
  53. : Cursor.Next.Line ( n -- )      \ Make cursor go down n lines & to col 1
  54.     <CSI> EMIT                   \ Tell Console handler that we're coming
  55.     ##    TYPE                   \ Send # of lines to jump down
  56.     45    EMIT   ;
  57.  
  58.  
  59. Base !                           \ Put old Base back into effect
  60.  
  61.