Commodore VIC-20 Programmer's Reference Manual page 43

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

Advertisement

ignores the statement and continues with the statement following
the ON statement.
EXAMPLE 1:
ON X GOTO 100, 130, 180, 220
ONX + 3 GOSUB 9000,20,9000
ON is really an under-used variant of the IF ... THEN . . .
statement which can send the program to one of many possible
lines. Using formulas and logical operators, one ON statement can
replace a whole list of IF statements.
EXAMPLE 2: IF statements
IF A-7 THEN 400
IF A = 3 THEN 900
IF A < 3 THEN 1000
IF A > 7 THEN 100
EXAMPLE 3: ON ... GOTO . . .
ON-(A-7) -2* (A-3) -3*(A<3) -4* (A>7) GOTO 400, 900,
1000, 100*
IF A = 7 is true,
the expression's value
is -1, and its value
is 0 if false!
POKE
Format:
Abbreviation:
Screen Display:
POKE location, value
Pi:^.[Tflo
P |~~
This statement allows you to alter the value of any RAM location
in memory. There are a possible 65,536 locations in the VIC's
memory, and in an unexpanded VIC a little more than 5K of them
are RAM and can be changed. Your 5K of RAM is in locations
numbered from 0 to 1023 and from 4096 to 8191. The memory
maps in Chapter 3 describe the contents of the first 1K. Your BAS IC
program, variables, and the screen memory all go in the 4K area.
27

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents