EasyManua.ls Logo

Commodore CBM - Page 392

Commodore CBM
447 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...
The remaining changes are for the message display lines. Lines 85
to
87
create
S$,
a string of 79 blanks. This could have been done
with
a single state-
ment
(S$="<79
blanks>")
but
the three lines are more informative and make
use of the
PET
concatenation feature.
Why
79 instead of
80
blanks (since the
two
lines are each
40
characters long)? You
will
find, if vou have tried this,
that
print-
ing into the last character position of the screen always causes scrolling up one
line. Therefore: first. vou
will
never find a character
that
needs
to
be blanked sit-
ting
in
the last position, so
that
blanking up
to
but
not including the last position
is
far enough. And second,
to
perform the indicated task, vou need
to
blank the bot-
tom
two
lines
of
the screen
but
vou do
not
want
to
scroll the screen up, thereby
losing the
top
line
of
the character display and making the program look
amateurish.
After
the character display has completed
(at
line 141). line 142 calls a
subroutine beginning at line 610
to
print
the blank string
S$,
followed by a con-
tinuous-line format indicator
(;)
to
leave the cursor at the last position on the
screen.
Now
vou
want
to
return the cursor
to
the beginning of the first blank line,
which
is
done by cursor control characters
to
move the cursor up
two
lines and
right
one character position. The subroutine terminates and returns control
to
the
main program, and at line 150 the program prints PHEW!. Then,
as
stipulated by
the task, a delay loop causes the program
to
pause a few seconds by doing
nothing for 1000 iterations. This completes the program's processing of the first
display character.
The task specifies
that
the program blank the
two
message lines before
starting the new character display. This also has
to
be do
ne
for succeeding dis-
play characters,
i.e.,
ail
but
the first one. A flag F
is
used
to
indicate the
"first
time'not
first
time"
condition. Initially F
is
zero.
After
completing the first display
character, at line 157 F
is
set
to
1
so
that
at line 107 the Blank 2 Lines subroutine
is
called before beginning the display
of
the next character. The subroutine begin-
ning at line
600
is
called this time,
which
moves the cursor to the beginning of the
message area by
homing
the cursor and then
moving
the cursor
down
23 lines.
Execution proceeds
to
line
610
to
print
the blank string S$ and return.
(The
cursor
movements at line 610 are irrelevant now, since the next operation on returning
from the subroutine
to
line 110
is
to
home the cursor.)
After
the cursor is homed,
the display loop executes (Iines 120
to
141).
Now
the program again calls the
Blank 2 Lines subroutine (Iine 142) before
printing
the
two
messages. This
is
a
redundant cali, since the
two
lines are being blanked before the display loop for
the second and subsequent display characters. The only
time
the lines need
to
be
blanked at this
point
is
for the first character. This line
is
probably better
written:
142
IF
F=O
THEN GOSUB 610:
REM
Ta
BLANK 2 UNES
379

Table of Contents

Other manuals for Commodore CBM

Related product manuals