MBASIC TIPS
by Editor, SNUG, August 1987

(A useful program header, plus other tips)

For MBASIC programmers on the  CP/M Kaypro:

10 'ON ERROR GOTO
20 E$=CHR$(27)     '*** ESCAPE
30 DEF FNCUR$(Y,X)=E$+"="+CHR$(31+Y)+CHR$(31+x)  '*** CURSOR POSITIONING
40 CL$=CHR$(26)    '*** CLEAR SCREEN
50 CLRDWN$=CHR$(23)    '*** CLEAR SCREEN FROM CURSOR LINE DOWN
60 CLRLIN$=CHR$924)    '*** CLEAR FROM CURSOR TO END OF LINE
70 BEL$=CHR$(7)        '*** BEEPER
80 PRINT CL$
90 '---------------------------------------------------------

This is a header I put on my BASIC programs to make screen
handling easier and also there is one line for attention getting
(in the case of an unsuitable operator input for example).  The
following are line explanations.

10 - Include this line if you write error trapping routines.  Put
a line  number for the error trap entry point after the GOTO. 
Here the line is commented out because I don't always use error
trapping.

20 - E$ is set as the escape character.  Saves typing.  Useful in
setting printer commands.  Used in line 30.

30 - Uses to position cursor anywhere on screen for a PRINT or
any variation of INPUTing.  Y is the line & X is column.  Syntax: 
PRINT FNCUR$(12,3);"HELLO" would put the word "HELLO" on line 12
column 3.

40 - Blanks the screen.

50 - Blanks the screen from the cursor position to the bottom.

60 - blanks the line that the cursor is on from cursor position
to end of line.

70 - This is the attention getter.  It "beeps" the keyboard.

80 - clears screen for start of your program.

90 - Just a separator between the header and the main program
code.


HELPFUL TIPS

Use descriptive variable names in your BASIC code.  What is
easier to understand, "LINE INPUT LN$" or "LINE INPUT LASTNAME$"? 
If you ever want to go back and revise a program a year after
you've written it you will see the value of this.  If you want to
shorten the program length after you've written it just save the
program as an ASCII (SAVE "ProgramName",A) and use WordStar in
nondocument mode to Find and Replace (^QA) LASTNAME$ with LN$.  I
usually write my programs in WordStar anyway.  If you do the Find
and Replace be sure to keep an archive copy of the original for
future reference.
