11.07.2015 Views

Here - 1000 BiT

Here - 1000 BiT

Here - 1000 BiT

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

LESSON 28ACTION GAMES AND THE FUNCTION KEYSTHE FUNCTION KEYSThe four large keys on the right side of the C-64 are called function keys.They have these ASCII numbers:fl£2f3f4f5f6f7f8133134135136137138139140(shifted fl)(shifted f3)(shifted f5)(shifted f7)How can you find out if a function key is being pressed?You cannot use the INPUT command. It ignores the function keys. You use the GETcommand.nEnter10 REM FUNCTION KEYS15 D$="clr dn dn dn dn dn sp"16 PRINT D$20F1$=CHR$(133)30 GET K$:IF K$="" THEN 3040 IF K$=F1$ THEN PRINT D$;"YOU PRESSED F1":GOTO 3050 PRINT D$;K$;60 GOTO 30(Remember:"sp" means push the space bar.)Run it Press any key and see that it is printed to the screen. But when you press the flkey, the special message gets printed.nNotice that trying to PRINT character number 133 gives nothing. The eight characterswhich are function keys do not print.USING THE FUNCTION KEYS INPROGRAMSFirst you GET a one-character string from the keyboard. If it has an ASCII number 133through 140, it is one of the function keys. The little program above shows how to do this.n157

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!