EasyManua.ls Logo

Commodore VIC-20 - CHAPTER 1 Introducing the VIC 20 Computer

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...
11
SECTION THREE
USING PROGRAMMER’S AID
AS A TOOL
3.1 Introduction
This section will show you the stages of
writing a complete BASIC program using
PROGRAMMER’S AID. A sample program will
be used together with instructions and
illustrations designed to demonstrate the
advantages PROGRAMMER’S AID gives in
program writing, editing and debugging.
3.2 The BASIC Program
The BASIC program illustrated here is a
simple random number “dice game” giving the
player an initial stake and asking him to match a
number between 1 and 6. The color and sound
attributes of the VIC are used in only limited
ways in order not to confuse the less
experienced VIC BASIC programmer.
3.3 The Procedure
Insert the PROGRAMMER’S AID cartridge
into the expansion port of your VIC with the
power OFF. Switch the power on and type
SYS 28681 (RETURN)
Your VIC is now in PROGRAM mode. Carry
out the instructions listed below to list and
redefine the commands that have been auto-
matically assigned to the function keys. Type:
KEY (RETURN)
Now type the letters:
CLR (RETURN)
Redefine the function keys to appear as below
by moving to the proper location, typing the new
characters on that line and pressing the RETURN
key. To change the next command, clear the
screen and repeat the process. (See Section 2.4.8.)
KEY 1, “LIST”
KEY 2, “FOR“
KEY 3, “RUN”
KEY 4, “NEXT“
KEY 5, “GOTO”
KEY 6, “G– A$:IFA$=“
KEY 7, “INPUT”
KEY 8, “PRINT“
KEY 9, “IFA$=”
KEY 10/ , “GOSUB”
KEY 11, “RETURN”
KEY 12, “POKE“
NOTE: G– (obtained by typing G, holding the
SHIFT key down and typing E) is the abbreviated
form of the BASIC keyword “GET”. For a
comprehensive list of the abbreviated form of all
BASIC keywords, see Appendix D of your VIC 20
Computer Guide.
WARNING: Do not attempt to enter EDIT mode
after redefining the function keys. This will replace
the newly defined functions with the original
information assigned by the PROGRAMMER’S
AID CARTRIDGE. All EDIT commands that are
required can be typed in full.
3.4 Entering the Program
Begin numbering your program lines at line 50/
in increments of 25 lines by typing the following:
AUTO 50/ ,25 (RETURN)
The VIC will display the line number 50/ and
await your input. (See Section 2.2.2.) As you
press RETURN at the end of each line of code,
the next line number will be displayed to the
screen.
Type in the program below using the function
keys. They are shown enclosed in square
brackets, e.g. [F4]. When you have finished
entering the program, press RETURN
immediately following the next automatically
displayed line number to cancel the AUTO
command.