home *** CD-ROM | disk | FTP | other *** search
/ ftp.whtech.com / ftp.whtech.com.tar / ftp.whtech.com / club100 / pg / pg200 / esc-y.tip < prev    next >
Text File  |  2006-10-19  |  2KB  |  57 lines

  1. In a recent conversation I became aware that the ESC sequence for cursor
  2. positioning was not fully understood ( mainly because the Tandy manuals do not
  3. fully explain it).
  4.  
  5. Page 84 of the Tandy 200 Basic Reference Guide lists a variety of ESC
  6. sequences for manipulating the LCD screen.
  7.  
  8. ESC Y r,c is listed as the sequence for moving the cursor to row r, column c.
  9.  
  10. This is rather ambiguous because r and c are not clearly defined.  Here's how
  11. to use this ESC sequence...
  12.  
  13. Row can be 1-16 (1-8 on the M100), and Column is 1-40.  31 must be added to
  14. Row and Column before it is sent in the ESC Y sequence.  Here's a simple
  15. example that will put the cursor at ROW 5, COLUMN 5 and print "X".
  16.  
  17.  
  18. 10 R=5:C=5
  19. 20 PRINTCHR$(27)"Y"CHR$(R+31)CHR$(C+31);
  20. 30 PRINT"X"
  21.  
  22. Note the semicolon at the end of line 20 so a <CR> is not sent to the LCD.
  23.  
  24. You can use this as a subroutine when trying to adapt a program that uses
  25. LOCATE X,Y instead of PRINT@.
  26.  
  27. It can further be argued that...
  28.  
  29. 10 R=5:C=5
  30. 20 PRINT@ (R-1)*40+(C-1),"";
  31. 30 PRINT"X"
  32.  
  33. ...is the functional equivalent and saves 4 bytes, so the programmer does
  34. have two fairly equivalent options.
  35.  
  36. These two approaches also have the same benchmark times in a 500 iteration loop
  37. so execution time is of little significance.
  38.  
  39.  
  40. This can also be used in M/L programs preceding the string to be printed, and
  41. the string will be properly positioned.
  42.  
  43. MSG:    DB 27,89,32,32,'print this',0
  44.  
  45. This is quite useful in customizing M/L programs for which the assembly 
  46. language source code is not available.  
  47. In BASIC is helps bridge the compatibility gap between M100 and NEC,
  48. and in M/L is is one less CALL that must be converted for another machine.
  49.  
  50.  
  51. No doubt there are many potential uses for the ESC Y sequence, and for each 
  52. use it can be argued that another approach will do equally well.  I will
  53. not dispute that idea.  I am simply presenting the use of ESC Y and how to
  54. implement it, so you have a choice.
  55.  
  56. Paul Globman [72227,1661]
  57.