Exercise 5 - Listing And Running Your Program; Exercise 6-Amending The Program - Commodore PET 2001 Series Introduction Manual

Hide thumbs Also See for PET 2001 Series:
Table of Contents

Advertisement

Exercise 5 - Listing and running your
program
Clear the screen and type:
L I S T
LIST is a command to your PET to print the lines of program stored in
memory onto the screen so that you can look at them. You should see
something like this on your screen
The ? that you have typed in as a shorthand for PRINT has been
expanded out in the listing. Other than that, everything should be as
you typed it in. If there
an extra line which should not be there, it
is
may be deleted by typing just the number of the line
followed by
LIST your program again if you wish. When everything is just as you
want it to be type
R U N
There! Your picture will appear on the screen. RUN tells PET to
execute the BASIC program you have entered, starting at the lowest
line number step and proceeding with subsequent steps in ascending
line number order.

Exercise 6-Amending the program

RUN your program again. If you did not clear the screen first, you may
have seen the old rocket disappear at the top of the screen and the new
rocket roll up from the bottom of the screen.
This phenomenon is called "scrolling." When PET is printing in the
bottom-most line of the screen, everything moves up rather than the
1
cursor moving to a lower line. PET cannot scroll the other way,
however. Information that scrolls off the top of the screen is lost.
We can use this scrolling effect to our advantage to produce an ani-
mation in which it appears as though a stream of rockets are blasting
off from the bottom of the screen and are streaking off the top. To
do this we will learn a new BASIC language command.
Type this line in
The line number (100) was chosen so that it would be greater than any
you had used previously and thus would be the last step of your program
to execute.
GOTO is a BASIC command to break the sequential execution of
statements and "go to" the line number specified. If you entered the
rocket picture with line numbers exactly as shown, line 1 is the first
line of the program which prints the rocket picture. Change the target
line of the "go to" to correspond to your first line number if it is not
line 1. The effect of line 100 is to repeatedly print the rocket and scroll it
off the screen.
But, because we don't want the rockets to be touching nose to tail, we'
d like to add some space between them. When we typed LIST, we
noticed that the last line number was 9. (We've since added line 100).
Any numbers greater than 9 and smaller than
correctly in line number sequence by your PET. So let's add the
statements:
will be positioned
100
1
1

Advertisement

Table of Contents
loading

Table of Contents