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

Now RUN the program. Notice that no cursor appears on the screen, but any character you type will be printed in the screen. This 2-line program can be turned into part of a screen editor program as shown below.

There are many things you can do with a screen editor. You can have a flashing cursor. You can keep certain keys like <CLR/HOME> from accidentally erasing the whole screen. You might even want to be able to use your function keys to represent whole words or phrases. And speaking of function keys, the following program lines give each function key a special purpose. Remember this is only the beginning of a program that you can customize for your needs.

   20 IF A$ = CHR$(133) THEN POKE 53280,8: GOTO 10
   30 IF A$ = CHR$(134) THEN POKE 53281,4: GOTO 10
   40 IF A$ = CHR$(135) THEN A$="DEAR SIR:"+CHR$(13)
   50 IF A$ = CHR$(136) THEN A$="SINCERELY,"+CHR$(13)

The CHR$ numbers in parentheses come from the CHR$ code chart in Appendix C. The chart lists a different number for each character. The four function keys are set up to perform the tasks represented by the instructions that follow the word THEN in each line. By changing the CHR$ number inside each set of parentheses you can designate different keys. Different instructions would be performed if you changed the information after the THEN statement.

HOW TO CRUNCH BASIC PROGRAMS

You can pack more instructions - and power - into your BASIC programs by making each program as short as possible. This process of shortening programs is called "crunching."

Crunching programs lets you squeeze the maximum possible number of instructions into your program. It also helps you reduce the size of programs which might not otherwise run in a given size; and if you're writing a program which requires the input of data such as inventory items, numbers or text, a short program will leave more memory space free to hold data.

ABBREVIATING KEYWORDS

A list of keyword abbreviations is given in Appendix A. This is helpful when you program because you can actually crowd more information on each line using abbreviations. The most frequently used abbreviation is


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