Commodore VIC-20 User Manual page 159

Hide thumbs Also See for VIC-20:
Table of Contents

Advertisement

Chapter 4 Advanced BASIC Programming
145
the entry line disappears, and the subroutine returns with the full entry
contained in CC$. The subroutine also checks for the
INST/DEL
key; ifthis
key was pressed, the subroutine branches to line 8170.
If the character entered is neither
RETURN
nor
INST / DEL,
then the
character entered in C$ is concatenated to CC$, which contains all of the
characters entered so far. Notice the logical test on this line.
8140 IF
LEN(ee')<LN~
THEN CCS-CC'+C':PRINT eli
If the length of CC$ is not yet equal to the maximum number of
characters allowed for the entry (in LN%), then C$ is tacked onto the end of
CC$, the character entered is displayed on the screen, and a branch back to
the GET statement occurs. If the maximum entry length was reached, the
character in C$ is simply ignored.
What do the statements on lines 8160 through 8190 do? A branch
to these statements occurs if the operator presss the
INST/DEL
key.
If the operator presss
INST / DEL
but the entry string CC$ is empty, then
no characters need to be deleted. The IF-THEN statement on line 8160
checks for this condition and branches back to line 8110 if no characters
need to be deleted. Otherwise, program logic continues with line 8170.
Line 8170 prints the
CRSR LEFT
and
RVS ON
characters to position the
cursor on the last character entered, a space (in inverse video) that wipes out
that character, then a
RVS OFF
and a
CRSR LEFT.
What all this does is move
left, delete the last character entered, and move left once again to the space.
Line 8180 deletes the last character of CC$ 'by measuring the length of
CC$ using the LEN function, subtracting 1, and reassigning CC$ all of its
original characters except the last.
Once the character is deleted from the screen and from CC$, the
subroutine branches back to the GET statement on line 8110.
You should study the name-and-address program carefully and under-
stand the data entry aids that have been included. They are as follows:
Reversing the field on the current entry line clearly indicates what
data is expected and how many characters are available.
. An operator does not have to fill in all the characters on an entry line.
When the operator presses the
RETURN
key, the balance of the entry
is filled out with blanks.
. At any time the operator can backspace and correct errors on an entry
line by pressing the
INST/DEL
key.

Advertisement

Table of Contents
loading

Table of Contents