EasyManua.ls Logo

Commodore VIC-20 - Page 122

Commodore VIC-20
404 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
108
The VIC 20
User
Guide
prompt string
is
too long, BASIC tries to read the prompt along with the
input typed
at
the keyboard. This will happen only if the prompt extends
beyond the end
of
a row on the screen.
To
avoid this problem, always make
sure your prompts are less
than
22
characters long. The problem can also
arise if the
INPUT
statement follows a
PRINT
statement that ends with a
semicolon. Since the
prompt
starts in the middle
of
the line, it must be short
enough to ensure that it does not "overflow" to the next row
of
the display.
If
you inadvertently make a prompt too long, you may find yourself
trapped. BASIC will keep telling you to
"REDO"
your response, then
display the prompt again. To escape from this trap, use the
DEL key to delete
the prompt, then type your response. The only other way
is
to press the
RUN/STOP
and RESTORE keys simultaneously. This aborts the program.
"PRESmING"
THE
RESPONSE
TO
INPUT
After printing your prompt,
INPUT
prints a question mark and a
space. Anything to the right
of
that space on the screen
is
treated as if it were
typed from the keyboard.
By
adding backspaces to your prompt, you can
"preset" the response so that the user need only press
RETURN. To use this
feature, add two spaces to your prompt string, followed by the response.
Then use
CRSR
LEFT
to move the cursor back to the first
of
the added spaces.
When
INPUT
prints its question mark
and
space, they will replace your two
spaces, positioning the cursor
on
the response.
If
the user simply presses
RETURN,
INPUT
will read the response you have set up on the screen.
You can also preset responses by assigning a value in advance to the
variable you will INPUT.
If
the user responds with
just
a RETURN, the value
already in the variable
is
not changed. Note, however,
that
if you
INPUT
multiple variables, this
is
an all-or-nothing proposition:
If
the value for the
first variable
is
typed in, values for all variables must be given.
GET
STATEMENT
The GET statement inputs a single character. No carriage return
is
needed. The single character input can be
any
character the VIC recognizes,
or
it can be a numeric value between 0
and
9.
The entry will be interpreted as
a character if a string variable name follows GET. Type in the following
program and run it:
113
GET
Fl$
20
PRINT
FI$
313
OOTO
10

Other manuals for Commodore VIC-20

Related product manuals