Commodore 128 Programmer's Reference Manual page 105

Hide thumbs Also See for 128:
Table of Contents

Advertisement

ONE STEP BEYOND SIMPLE BASIC
95
CHANGING FUNCTION KEYS
You can change the value assigned to any function key by entering the KEY command
followed by the number (1 through 8) of the key you want changed, a comma, and the
new key instruction in a string format. For example:
KEY1, "DLOAD" +CHR$(34)+ "PROGRAM NAME"
+CHR$(34) + CHR$(13)+ "LIST"+CHR$(13)
This tells the computer to automatically load the BASIC program called "program
name" and list it immediately (whenever Fl is pressed). The character string code value
for the quote character is 34. It is necessary for LOAD and SAVE operations. The
character string code value for RETURN is 13 and provides immediate execution.
Otherwise, the instruction is only displayed on the screen and requires you to supply the
additional response and press the RETURN key.
The following example uses the ASCII value for the ESCape key to assign the F3
key to cause a downward scroll:
KEY3,CHR$(27) + "W"
NOTE: All eight KEY definitions in total must not exceed 246 characters.
USING C64 FUNCTION KEY VALUES
IN C128 MODE
Programs previously written for the C64 which incorporate the function keys may still
be used in C128 mode by first assigning the C64 ASCII values to them with this
instruction:
10J = 132:FORA = 1TO2:FORK = ATO8STEP2:J = J + 1 :KEYK,CHR$(J):NEXT:
NEXT
HOW TO CRUNCH BASIC PROGRAMS
Several techniques known collectively as memory crunching allow you to get the most
out of your computer's memory. These techniques include eliminating spaces, using
multiple instructions, having syntax relief, removing remark statements, using variables,
and in general using BASIC intelligently.
ELIMINATING SPACES
In most BASIC commands, spacing is unnecessary, except inside quotes when you want
the spaces to appear on the screen. Although spaces improve readability, the extra space
consumes additional memory. Here is an instructional line presented both ways:
lOINPUT'FIRST NAME";N$:FOR T = A TO M:PRINT "OK":
10INPUT4 'FIRST NAME'' ;N$:FORT = ATOM:PRINT' 'OK":

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents