EasyManua.ls Logo

Commodore VIC-20 - Page 12

Commodore VIC-20
20 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...
8
The value of a variable can be changed by
moving the cursor over the value, typing the new
value and re-executing the program from the
point after the line containing the original
variable definition. If there are a lot of variables,
holding down either SHIFT or CTRL key will
control the rate of variable display to the screen.
Pressing the STOP key will halt the DUMP
completely.
EXAMPLE : To display the value of all variables
in the following program:
10/ A$ = “RANDOM NUMBERS”
20/ PRINT A$
30/ X = INT(RND(8) * 15) + 1
40/ Y = INT(RND(8) * 7) + 1
50/ R = X * 16 + 8 + Y
60/ POKE 36879,R
70/ FOR CO = 1 TO 10/0/ 0/ :NEXT CO
80/ GOTO 20/
TYPE : RUN (RETURN)
ACTION : After a few seconds, press the
STOP key
DISPLAY : READY
COMMAND : DUMP (RETURN)
DISPLAY : A$ = “RANDOM NUMBERS”
X = 5
Y = 6
R = 94
CO = 995
2.4.12 TRACE
FORMAT : TRACE
PURPOSE : To display the number of the program
line as it is being executed.
The TRACE command is entered before
executing a program. A “window” will appear in
the top right corner of the VIC’s screen. The
window will display program line numbers as
they are executed. A maximum of six lines can
be displayed in the window at any one time in
the format: # (line number). The lines in the
window will scroll up so that the last program
line number executed will appear at the bottom
of the list inside the window.
CAUTION: The window will overwrite anything
that would have been displayed in its position on
the screen. Therefore if you are using the BASIC
code “INPUT”, the place for the user to respond
must be below the window containing the line
numbers currently being executed.
The use of TRACE will slow down program
execution but the display of line numbers may
still appear too quickly to be able to follow.
Hold the CTRL or SHIFT keys down to control
the rate at which program lines are displayed on
the VIC’s screen. The lines will be displayed at a
speed of approximately 2 lines per second. To
cancel the TRACE command, see Section 2.4.14.
EXAMPLE : To display the program lines
while a program is executing:
COMMAND : TRACE (RETURN)
TYPE : RUN (RETURN) and hold down
the SHIFT key
DISPLAY : See figure 2-1.
Figure 2-1. A TRACE Display
2.4.13 STEP
FORMAT : STEP
PURPOSE : To halt the program after each
program instruction and display the
first line number of the next
instruction.
If the STEP command is executed before
running the program, each program instruction
will be executed individually.
A “window” on the screen will contain the
program lines associated with that instruction
(to a maximum of six lines) and the first line of
the next instruction. Pressing the SHIFT or CTRL
key will cause the next instruction to be executed
and the line number of the following instruction
to be displayed. Holding either of these keys
down will cause the program to execute
continuously.
Pressing the STOP key will halt program
execution. To terminate the STEP command
see Section 2.4.14.
EXAMPLE : To execute a program by single
stepping:
COMMAND : STEP (RETURN)
TYPE : RUN (RETURN)