Line Input For The PET
Unfortunately, as many users will agree, the INPUT command on the Commodore Pet contains several undesirable features. First of all, if the RETURN key is pressed before any data is entered, the program will abruptly end and the user will be left with a READY. message. Although there are several "tricks" that the programmer can use to prevent this from happening, they do not alleviate another major problem.
No matter how an INPUT is programmed, when it is encountered the computer waits for a key to be typed, echoes it back to the screen, and waits for another until the RETURN key is pressed. The problem is that if the user enters a cursor movement key, its function will be echoed back to the screen. The user could, for example, clear the screen, and have no way of recovering the lost information.
Some computers offer a command that will accept one line of input from the user. The only acceptable keys are un-shifted letters from A-Z, digits from 0-9, the space bar, the delete key, and the return key. All other keys are ignored. Pressing RETURN, DELete, or SPACE before something else is typed will have no effect, and trailing spaces are ignored. This command, usually called INLINE (INput LINE), or LINPUT (Line INPUT), can be used in place of INPUT.
Below is a program written in machine language, that when called with a SYS command to its starting location, will do a LINPUT on the Commodore Pet with "upgrade" ROMs. Whatever the user types will be returned in the basic variable IN$. The program is completely relocatable, and occupies 305 bytes. The program is presented in assembler, and as a Basic loader. You may locate the program anywhere in memory, or have the loader program POKE it into the end of memory, and adjust the necessary pointers to protect it from being erased by string storage.