home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / basic / mbastips.txt < prev    next >
Text File  |  1994-07-13  |  2KB  |  63 lines

  1. MBASIC TIPS
  2. by Editor, SNUG, August 1987
  3.  
  4. (A useful program header, plus other tips)
  5.  
  6. For MBASIC programmers on the  CP/M Kaypro:
  7.  
  8. 10 'ON ERROR GOTO
  9. 20 E$=CHR$(27)     '*** ESCAPE
  10. 30 DEF FNCUR$(Y,X)=E$+"="+CHR$(31+Y)+CHR$(31+x)  '*** CURSOR POSITIONING
  11. 40 CL$=CHR$(26)    '*** CLEAR SCREEN
  12. 50 CLRDWN$=CHR$(23)    '*** CLEAR SCREEN FROM CURSOR LINE DOWN
  13. 60 CLRLIN$=CHR$924)    '*** CLEAR FROM CURSOR TO END OF LINE
  14. 70 BEL$=CHR$(7)        '*** BEEPER
  15. 80 PRINT CL$
  16. 90 '---------------------------------------------------------
  17.  
  18. This is a header I put on my BASIC programs to make screen
  19. handling easier and also there is one line for attention getting
  20. (in the case of an unsuitable operator input for example).  The
  21. following are line explanations.
  22.  
  23. 10 - Include this line if you write error trapping routines.  Put
  24. a line  number for the error trap entry point after the GOTO. 
  25. Here the line is commented out because I don't always use error
  26. trapping.
  27.  
  28. 20 - E$ is set as the escape character.  Saves typing.  Useful in
  29. setting printer commands.  Used in line 30.
  30.  
  31. 30 - Uses to position cursor anywhere on screen for a PRINT or
  32. any variation of INPUTing.  Y is the line & X is column.  Syntax: 
  33. PRINT FNCUR$(12,3);"HELLO" would put the word "HELLO" on line 12
  34. column 3.
  35.  
  36. 40 - Blanks the screen.
  37.  
  38. 50 - Blanks the screen from the cursor position to the bottom.
  39.  
  40. 60 - blanks the line that the cursor is on from cursor position
  41. to end of line.
  42.  
  43. 70 - This is the attention getter.  It "beeps" the keyboard.
  44.  
  45. 80 - clears screen for start of your program.
  46.  
  47. 90 - Just a separator between the header and the main program
  48. code.
  49.  
  50.  
  51. HELPFUL TIPS
  52.  
  53. Use descriptive variable names in your BASIC code.  What is
  54. easier to understand, "LINE INPUT LN$" or "LINE INPUT LASTNAME$"? 
  55. If you ever want to go back and revise a program a year after
  56. you've written it you will see the value of this.  If you want to
  57. shorten the program length after you've written it just save the
  58. program as an ASCII (SAVE "ProgramName",A) and use WordStar in
  59. nondocument mode to Find and Replace (^QA) LASTNAME$ with LN$.  I
  60. usually write my programs in WordStar anyway.  If you do the Find
  61. and Replace be sure to keep an archive copy of the original for
  62. future reference.
  63.