home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / basic / bascmnot.lbr / BASCOM3.NQT / BASCOM3.NOT
Encoding:
Text File  |  1986-07-14  |  4.0 KB  |  127 lines

  1.           Notes on the Use of BASCOM #3
  2.  
  3.            TRANSPORTABLE CLEAR SCREEN
  4.  
  5.         (C) Copyright 1985 Merlin R. Null
  6.              (818) 762-1429
  7.  
  8. When you need the user to configure a program for clear screen in
  9. an interpreted MBASIC program it is easy to set up a string to be
  10. changed:
  11.  
  12. 100 CLS$=CHR$(126)+CHR$(28) 'Change to your clear screen sequence
  13. 110 PRINT CLS$
  14.  
  15. And then just use PRINT CLS$  whenever  you  want  to  clear  the
  16. screen.   If  you want  your  compiled  program  to  be  just  as
  17. transportable, you must use something else.  One possiblity is to
  18. use a small external data file:
  19.  
  20. 100 OPEN "I",#1,"CLS.DAT"
  21. 110 WHILE NOT EOF(1)
  22. 120   LINE INPUT #1, A$
  23. 130   CLS$=CLS$+CHR$(VAL(A$))
  24. 140 WEND
  25. 150 CLOSE
  26. 160 PRINT CLS$
  27.  
  28. It would also be useful to add error checking for missing CLS.DAT:
  29.  
  30. 600 IF ERR=53 AND ERL=100 THEN CLOSE ELSE 630
  31. 610   PRINT"CLS.DAT the clear screen data file not found, please create it."
  32. 620   RESUME 500    ' end
  33. 630 ON ERROR GOTO 0
  34.  
  35. The following code could be used to have the program install  its
  36. own clear screen sequence:
  37.  
  38. 600 IF ERR=53 AND ERL=100 THEN CLOSE ELSE 900
  39. 610   PRINT STRING$(18,10)
  40. 620   PRINT BL$;"CLS.DAT, the clear screen data file, not found."
  41. 630   PRINT"Please enter your clear screen sequence"
  42. 640   PRINT"one byte at a time in Decimal numbers.  End your"
  43. 650   PRINT"entries with a <RETURN> to generate CLS.DAT"
  44. 660   PRINT
  45. 670   FOR I=1 TO 9
  46. 680     PRINT"Clear Screen character";I;
  47. 690     LINE INPUT C$
  48. 700     IF C$="" AND I>1 THEN 790
  49. 710     IF C$="" THEN 680
  50. 720     IF LEN(C$)>3 THEN 680
  51. 730     FOR J=1 TO LEN(C$)
  52. 740       IF ASC(MID$(C$,J,1))<48 OR ASC(MID$(C$,J,1))>57 THEN PRINT BL$;
  53.  
  54.           "Whole decimal numbers only.":GOTO 680
  55. 750     NEXT J
  56. 760     IF I>1 THEN CLR$=CLR$+CHR$(13)+CHR$(10)
  57. 770     CLR$=CLR$+C$
  58. 780   NEXT I
  59. 790   PRINT"Writing CLS.DAT";
  60. 800   OPEN "O",#1,"CLS.DAT"
  61. 810   PRINT #1,CLR$
  62. 820   CLOSE
  63. 830   RESUME 100
  64. 900 ON ERROR GOTO 0
  65.  
  66. This adds quite a bit of code to the program,  so you  might just
  67. want to add instructions to the documentation for your program on
  68. how to create CLS.DAT.
  69.  
  70. For any terminal that uses ^Z for the clear screen, CLS.DAT would
  71. simply be:
  72.  
  73. 26
  74.  
  75. Just two six return.  For a most Hazeltine terminals it would be:
  76.  
  77. 126
  78. 28
  79.  
  80. If you did not want to use  the  clear  screen,  a  CLS.DAT  that
  81. causes scrolling could be created:
  82.  
  83. 10
  84. 10
  85. 10
  86. 10
  87. 10
  88. 10
  89. etc.
  90.  
  91. As many line feeds as you might want each time you would normally
  92. call for a clear screen.
  93.  
  94. Another possiblity is  to  create  CLS.DAT  with  a  menu  driven
  95. installation program.   This way the user would only have to know
  96. his terminal or computer type to install a program.
  97.  
  98. All of the above code can be used in an  interpreted  program  as
  99. well as one compiled with BASCOM.
  100.  
  101. There is a drawback to all of this.  It does take a separate file
  102. for CLS.DAT.   It may only hold a few bytes,  but it will take up
  103. a whole block and a directory entry.   If the user's  system  has
  104. little disk space or a limited number of directory entries,  this
  105. can be a problem.
  106.  
  107.  
  108.         Why bother with the clear screen?
  109.  
  110. Often, a program is much faster if a full screen of text does not
  111. have to scroll off.   The new text can be printed  from  the  top
  112. down in the time it takes scrolling to move 1 or 2 lines.  If you
  113. have gone to a lot of trouble to make your search or sort routine
  114. run as fast as possible, why waste it in screen update time?
  115.  
  116. There are times when the clear screen is a pain in the neck.   If
  117. you have ever had some important data vanish in an  instant,  you
  118. know what I mean.   With  many programs, the usual use is to call
  119. for a directory listing and then run the  program.   The  initial
  120. prompt may require a filename from this  directory  listing.   If
  121. you can't get a directory from inside your program or  enter  the
  122. second filename for the CP/M command line,  then  you  force  the
  123. user to remember that filename.
  124.  
  125.                     7-21-85
  126.  
  127. BASCOM AND MBASIC are trademarks of Microsoft
  128. e disk space or a limited number of