Commodore VIC-20 User Manual page 146

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

Advertisement

132
The VIC 20 User Guide
3540 (lET Cf: IF C$-"" THEN 3S48
35Se
NM~·VAL(C')
3560 IF
NM~(LOr.
OR
NM~)HI~
THEN
3~48
3570 PRINT C'J
3590 RETURN
Write a short program that sets values for HI% and LO%, and then
goes to subroutine 3500. Add the previous subroutine and run it.
Can you change the subroutine so that it accepts two-digit input? Try to
write this modified program for yourself.
If
you cannot do it, wait until the
next section, where you will find the necessary subroutine in the program
that controls the input of a date.
ENTERING A VALID DATE
Most programs at some point need relatively simple data input-more
than a simple yes or no, but less than a full screen display. Consider a date.
You must be careful with such apparently simple data entry. In all
likelihood, the date will be just one item in a data entry sequence. By
carefully designing data entry for each small item, you can avoid having to
restart a long data entry sequence whenever the operator messes up a single
entry.
The date is to be entered as follows:
MM-DD-YY
-'-ll§-'-~Lyear
Separator
Day of the month
Separator
Month
The dashes separating the month, day, and year could be slashes or any
other appropriate character. In Europe, the day of the month precedes the
month.
You should program data entry so that it is pleasing to the operator's
eye. The operator should be able to see immediately where data is to be
entered, what type of data is required, and how far the data entry process
has proceeded. A good way of showing where data is to be entered is to
display the entry line in inverse video. For example, the program that asks
for a date might create the following display:

Advertisement

Table of Contents
loading

Table of Contents