EasyManua.ls Logo

Commodore CBM - Page 119

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...
When
you run the program, you
will
find
that
it
is
scrolling up one line, leav-
ing a blank line
at
the
bottom
of the screen. This
is
because
PET
BASIC gives a
RETURN
after printing HIT A
KEY
to maye ta a new line in preparation for the next
print.
We
can
see
this by enabling the cursor to blink.
Normally you cannot
see
the cursor because its blinking
is
inhibited by the
PET
before running a program. However,
you
can enable the cursor to blink by
adding the following statement to the beginning of the program:
;;::13
PCW:E
548,13
Enable cursor
This
is
a system location that
is
discussed further in Chapter
6.
Run
the pro-
gram
with
this line added and you
will
see
the cursor blinking at the bottom line.
PHEl~
!
HIT
FI
KE'T'
M
This program does not really need the cursor,
so
delete line 80.
To prevent the blank line, add a semicolon ta the
PRINT
statement in line
90.
We
shou
Id
also add a prompt that
RETURN
is
what
is
used to exit fram the pra-
gram, Ta incorporate these changes, line 90 should
now
be
edited
as
follows:
90
.~,"
H1T
FI
KE'T'
OF.:
<F.:>
TO
Et·jD".:
As a final task, you
might
read over the program and add remarks for any
lines that are not clear. Comment
on
how the number 920 was devised; you can
optionally put the remark
on
the same line, using a colon ta separate statements:
120
FOR
1=1
TO
920
REM
920/40=23
LINES
Add a reminder that :1
is
to
c1ear
the screen; optionally align the remarks:
110
F'F.:
1
tH":1"
.:
F~Et'1
CLEFlF.:
SCREEH
Finally, add a few lines at the beginning of the program to describe it. The final
program BLANKET appears
as
follows. Save
it
on
tape.
10
REM
~~~~~~~
B
LAN
K E T
~~~~*~~
20
REM
COHTINUOUS-LINE
D1SPLAY
OF
ONE
30
REM
CHARACTER ENTERED
FROM
THE
413
REM
KE'T'BOARD
513
REM
~****~~~~**~~~~~~~~~~~~~*******
9';::1
PRIt-H"HIT
A 'Œ'T'
OR
'CR>
TO
END".:
113';::1
GET
C$:
1F
C$=""
GOTO
100
1135
IF
C$=CHR$(13)
GOTO
170
110
PF~
1
NT":1"
.:
:
REM
CLEAR SCREEN
120
FOR
1=1
TO
920
:REM
920/40=23
LINES
1:;:0
PRltH
C$.:
14';::1
NE>::T
150
F'R
1
NT"
PHEl~'
"
160
GOlO
90
170
END
READ'!',
Figure
3-1.
Program
BLANKEl
106

Table of Contents

Other manuals for Commodore CBM

Related product manuals