Classic Computer Magazine Archive COMPUTE! ISSUE 42 / NOVEMBER 1983 / PAGE 10

Another Perfect Commodore INPUT

In the last several issues I have seen a number of "Perfect INPUT'S" to avoid Commodore's return to READY from input. All of these methods work. In my opinion, however, since you can continue from READY by entering CONT on a clear line, their disadvantages outweigh their advantages.

I have another way of avoiding this problem. It uses the standard INPUT statement and CBM's active screen. When an input statement is executed, CBM BASIC prints a ? at the current cursor position, then moves the cursor to the right one additional space. All of the positions to the right of the cursor are automatically allocated for inputting data (up to 80 characters). By printing some default value into this area before executing the input statement, not only do you avoid the return to READY, but you also allow for inputting default values by just hitting RETURN.

For example:

10 VA = 10 : REM SET DEFAULT VALUE TO 0
20 PRINT "WHAT IS THE NEW VALUE": PRINT " "; VA; "{UP}"
30 INPUT VA
40 PRINT "THE CURRENT VALUE IS"; VA
50 INPUT "IS THE VALUE CORRECT (Y/N) {3 SPACES}Y{3 LEFT}": A$
60 PRINT "WHAT IS THE VALUE"; TAB(20); "D EFAULT VALUE"
70 PRINT TAB(18); "{UP}";
80 INPUT DV$

This appears on the screen as:

WHAT IS THE NEW VALUE ? 10
THE CURRENT VALUE IS 10
IS THE VALUE CORRECT [Y/N] ? Y
WHAT IS THE VALUE ? DEFAULT VALUE

The flashing cursor is positioned over the 1, Y, and D respectively.

By hitting only the RETURN key (3 times), you INPUT 10 to VA, Y to A$, and DEFAULT VALUE to DV$. If you want some other value, you need only type it in before hitting RETURN.

By taking a little time in choosing default values when writing a program, you can save a lot of time when running it and entering data.

Dennis D. Duke