SECTION 99. Using the Keyboard in C64 Mode
9.1 USING BASIC 2.0The entire BASIC 2.0 language built into the Commodore 64 computer has been incorporated into the BASIC 7.0 language of the Commodore 128. You can use BASIC 2.0 commands in both C128 and C64 modes. Refer to Sections 3 and 4 in Chapter 2 for a description of these commands. 9.2 KEYBOARD CHARACTER SETSIn the keyboard illustration in Section 3 the outlined key areas contain the keys that can be used in C64 Mode. The keyboard in C64 Mode has the same two character states as in C128 Mode:
When you enter C64 Mode, the keyboard is in the upper case/graphic character set, so that everything you type is in capital letters. In C64 Mode you can only use one character set at a time. To switch back and forth between character sets, press the {shift} key and the {C=} key (the COMMODORE key) at the same time. 9.3 USING THE TYPEWRITER-STYLE KEYSAs in C128 Mode, you can use the typewriter-style keys in C64 Mode to type both upper case letters (capitals) and lower case letters (small letters). You can also type the numerals shown in the top row on the main keyboard. In addition, you can type the graphic symbols on the front of the keys. 9.4 USING THE COMMAND KEYSMost COMMAND keys (i.e. the keys that send messages to the computer, like {return}, {shift}, {ctrl}, etc.) work the same in C64 Mode as they do in C128 Mode. The only difference is that in C64 Mode, you can only move the cursor by using the two {crsr} keys at the bottom right corner of the main keyboard. In C128 Mode, you can also use the four arrow keys located just above the top right side of the main keyboard. 9.5MOVING THE CURSOR IN C64 MODEIn C64 Mode, you use two {crsr} keys on the main keyboard and the {shift} key to move the cursor, as described in Section 3. 9.6 PROGRAMMING FUNCTION KEYS IN C64 MODEThe four keys to the right side of the keyboard, just above the numeric keypad, are called function keys. The keys are marked F1, F3, F5 and F7 on the tops and F2, F4, F6 and F8 on the fronts. These keys can be programmed - that is, they can be instructed to perform a specific task or function. For this reason these keys are often called programmable function keys. You must hold down the {shift} key to perform the functions associated with the markings on the front of the keys - that is, F2, F4, F6 and F8. Therefore, these keys are sometimes called the SHIFTed programmable function keys. The function keys in C64 Mode do not have a printed character assigned to them. They do, however, have CHR$ codes assigned. In fact, each of them has two CHR$ codes - one for when you press the key by itself, and one for when you press the key while holding down the {shift} key. To get the even-numbered function keys, hold down the {shift} key while pressing the function key. For example, to get {f2}, hold down {shift} and press {f1}. The CHR$ codes for the F1-F8 keys range from 133 to 140. However, the codes are not assigned to the keys in numerical order. The keys and their corresponding CHR$ codes are as follows:
You can use the function keys in your program in several ways. To do this, you need to use the GET statement. (See paragraph 4.3.2 of Section 4 for a description of the GET statement.) As an example, the program below prepares the {f1} key to print a message on the screen. 10 ?"PRESS F1 TO CONTINUE" 20 GET A$:IF A$="" THEN 20 30 IF A$<>CHR$(133) THEN 20 40 ?"YOU HAVE PRESSED F1" Lines 20 and 30 do most of the work in this program. Line 20 makes the computer wait until a key is pressed before executing any more of the program. Note that when the command immediately after THEN is a GOTO, only the line number is necessary. Also note that a GOTO command can GOTO the same line it is on. Line 30 tells the computer to go back and wait for another key to be pressed unless the {f1} key has been pressed. |
page URL: www.bigfoot.com/~c128page/c128sg/sect-09.htm
contact: c128page@bigfoot.com