Classic Computer Magazine Archive COMPUTE! ISSUE 60 / MAY 1985 / PAGE 10

Commodore INPUT

I would like to get rid of the question mark which appears when my Commodore 64 executes the INPUT command. Is there any easy way?

Scott Mefferd

The INPUT question mark is built into BASIC. There's no easy way to suppress it. As an alternative, you can use the GET command to read individual keypresses, then combine the characters into the string the program is trying to read. Here's a short example:

10 GET A$ : IF A$ = ""THEN10
20 IF A$ = CHR$(13)THEN40
30 B$ = B$ + A$ : GOTO10
40 PRINT B$

This routine waits at line 10 for any input from the keyboard. When you press a key, line 20 immediately checks to see if you pressed RETURN, CHR$(13). If so, control passes to line 40, which prints out every character you entered (or no characters, if RETURN was the first key pressed). If you pressed a key other than RETURN, line 30 stores the character in the string variable B$. Then it loops back to line 10 to wait for another keypress. Additional keypresses are added to B$ by line 30 until line 20 detects RETURN.

Keep in mind that this routine will also add any editing keys you pressed to the string. When the string is printed, the exact keys pressed are "played back." The DEL key won't delete a character from the screen, but just appears to when the string is printed.

This routine can be modified much further. You can add a cursor and true editing. Customized input routines can really enhance the power of a program.