[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]

the question mark (?) which is the BASIC abbreviation for the PRINT command. However, if you LIST a program that has abbreviations, the Commodore 64 will automatically print out the listing with the full-length keywords. If any program line exceeds 80 characters (2 lines on the screen) with the keywords unabbreviated, and you want to change it, you will have to re-enter that line with the abbreviations before saving the program. SAVEing a program incorporates the keywords without inflating any lines because BASIC keywords are tokenized by the Commodore 64. Usually, abbreviations are added after a program is written and it isn't going to be LISTed any more before SAVEing.

SHORTENING PROGRAM LINE NUMBERS

Most programmers start their programs at line 100 and number each fine at intervals of 10 (i.e., 100, 110, 120). This allows extra lines of instruction to be added (111, 112, etc.) as the program is developed. One means of crunching the program after it is completed is to change the fine numbers to the lowest numbers possible (i.e., 1, 2, 3) because longer line numbers take more memory than shorter numbers when referenced by GOTO and GOSUB statements. For instance, the number 100 uses 3 bytes of memory (one for each number) while the number I uses only 1 byte.

PUTTING MULTIPLE INSTRUCTIONS ON EACH LINE

You can put more than one instruction on each numbered line in your program by separating them by a colon. The only limitation is that all the instructions on each line, including colons, should not exceed the standard 80-character line length. Here is an example of two programs, before and after crunching:

BEFORE CRUNCHING: AFTER CRUNCHING:
 10 PRINT"HELLO...";            
 20 FOR T=1 TO 500: NEXT           
 30 PRINT"HELLO, AGAIN..."
 40 GOTO 10
10 PRINT "HELLO...";:FORT=1TO500:NEXT:
PRINT"HELLO, AGAIN...":GOTO10

REMOVING REM STATEMENTS

REM statements are helpful in reminding yourself-or showing other programmers - what a particular section of a program is doing. However, when the program is completed and ready to use, you probably


[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]
This page has been created by Sami Rautiainen.
Read the small print. Last updated December 22, 2002.