Commodore 16 Manual 1984
Commodore 16 Manual 1984
Cz commodore ig
i
; USER MANUAL
»:
Mh '
ninni nioivFI (
I -.1 l<! I «
fS commodore £z commodore
I HHnK'R.Ruwt.\\vlil.iii.( orliY.NoriluHf.NNI7 IU\
COMMODORE 16
USER MANUAL
TABLE OF CONTENTS
CHAPTER 1 Selling Up 5
CHAPTER 2 The Keyboard 1 7
CHAPTERS Software 29
CHAPTER 4 The First Steps 41
CHAPTER 5 Numbers and Calculations 53
CHAPTER 6 Graphics and Colour. ..... 63
CHAPTER 7 Sound and Music B3
INDEX ....... 1
IB'
I
I
CHAPTER 1
SETTING
I
I
UP
Unpacking your Commodore 1
Troubleshooting chart
I
• Peripherals
I
t
I
I
6 6
1
r r
1 Your Commodore 1
6 I
1
standard electrical wall socket AFTER connecting the first end into your
Commodore 16. If you hook up your computer to a television set. you
won't need to use this.
computer.
1 Plug in Ihe POWER SUPPLY on the right side of your computer and
then into a wait plug.
2 Connect Ihe TV cable (Ihe thin black one) from Ihe aerial socket on
your TV to Ihe RF SOCKET on the back ol your computer
Make sure that you have enough eiectncal wall outlets to plug
The Back Of Your Computer everything in near where you decide to set up your computer. You may
need a power strip or extension cord for more outlets, especially If
you're also hooking up a printer or a disk drive. Remember that the
THE MEMORY EXPANSION PORT power on everything (computer, TV, etc.) should be turned OFF until
Commodore 16 software cartridges plug in here. Before you insert or you are completely set up and ready lo go.
remove cartridges, make sure the power is OFF
THE RF JACK
1: Connecting The Power Supply
This where you plug in one end of the TV cable (the thin black cable).
is
Only one end fits into this lack; the other end fits Into the TV serial
• FIRST plug Ihe round end of the POWER SUPPLY into the power
socket.
jack on me right side ol your computer.
I
9
8
'
Finally . . .
Now it's time lo turn on your compuler (If you've been paying attention,
• Plug ore end of the TV cable (only one will fit) mlo Ihe serial socket The flashing cursor unoer ihe READY message you that your
tells
on your TV Commodo'e 6 1 is wailing lor you lo start typing The background
colour is white, while Ihe letters are printed In black, with a light purple
• P'ug Ihe other end or me cable Into the RF fack on the back of your i
border around the screen
computer
TROUBLESHOOTING CHART
Symptom Cause Remedy
Indicator light nol Computer not turned Make sure power switch is
ON' ON in ON posilion
Power cable not Check power socket tor
plugged in loose or disconnected
power cable
10 I
11
Symptom Cause Remedy Peripherals give you the capability to save and store data, print out
what appears onscreen (in black and white or colour), use software
No picture TV cable nol Check TV cable connection programs that are stored on cassette tape and tioppy diskelte. and give
plugged In you a sharp, clear picture of your computer's display.
TV nol on Turn TV on
Jom patlern on Cartridge nol Reinsert cartridge after
TV with cartridge properly inserted turning OFF powet
in place
PERIPHERALS (
Peripherals are Ihe accessories that you can get to go with your
To save or recall programs, you'll need a device lhai stores data I
lata
Commodore 16 that increase what you can do with your computer can be recorded on and retrieved from both cassette tapes and
These accessories are available al your Commodore dealer, and allow r To use cassette tape software (and to record your own
diskettes.
you to use your computer lo the fullest. programs on cassettes), you'll need the Commodore 1 531.
12 \ \ 13
I
DATASSETTE lape recorder For diskettes, Ihere are several DISK When us»ng a wordprocesslng program or a graphics package on your
DRIVES Disk drives are typically fast and efficient lo
that are suitable. )
Commodore 16. a printer will reproduce what is on the screen on
use Disk drives that are compatible with your Commodore 1 6 are the paper Tnere are several models of Commodore printers available that
Commodore models 1 541 and 1 551 1 work with your computer These include the MPS-801 MPS-802, MPS-
,
Your television set may not give you as clear a picture as you'd like for
your computer Commodore colour monitors are specially designed lo
give you the sharpest, brightest picture for viewing your Commodore
1
6 output There are several models available. Including the
Commodore 1 702, 1 802 and 803.1
14 15
CHAPTER 2
THE KEYBOARD
• A tour of the keyboard
I
• Special keys
! (
• Graphic keys
J I
• Function keys
J I
! f
:
I
I I
! f
I I
J I
1 I
J I
I f
( 1
16 17
1
:
I
) (
symbols,
Also, several olher keys {+. -. ,
@. *, and E ) may be typed shift key allows you lo type capita! letters, graphic
alone. Most punctuation marks need lo be typed with Ihe shift Key If punctuation marks, and a few olher things— with a little help from
you want to do some "regular" typing, you can type in capital and another key You'll be seeing more of Ihe SOFT key's functions
lowercase letters {like you would on a typewriter) by pressing the Ihroughout Ihis section, for things such as getting graphic symbols
I
start key along with a letter, you get a capital letter. Numbers and
SHFT LOCK is on, every character you type Is SHIFTED. To release
punctuation keys work the same as they would in regular (non-typing) is back
i ;
the lock, |ust press SHIFT lock again, and everything you type
mode To gel out of typing mode, just press the two keys shift and i
to normal
C* ) together again.
I
i
SHIFT
+ A = A When you hold down me SHIFT and roh/stop keys simultaneously.
+ A - r —Ebb\ 1
Ihe Commodore 16 loads and runs the first program on a disk in the
disk drive.
1 i
18 S 1 I
19
The Cursor Keys KEY + EFFECT
I
INST/DEL DELETE (ERASE
TYPED
SHIFT
CHARACTERS)
(§@R I
v
'
SHIFT
CLEAR HOME
iKST/DEL INSERT (ADD
SPACES)
The cursor, the (lashing block thai marks where you are on the This key serves two primary functions: HOME and CLEAR. When you
computer screen, can be moved quickly and eas>ly around the screen press this key alone, the cursor immediately moves to the top left
by using the CURSOR KEYS. There are four separate cursor keys, coiner of the screen (which Is known as the HOME position). The resf
each with an arrow pointing out the direction the key moves the cursor of your screen stays Ihe same. If you hold down the SHOT key and
up, down, ielt. or right. You can use the cursor keys lo move the press clem/home not only does Ihe cursor move lo HOME, but
,
cursor over anything on the screen without affecting those characters. everything on Ihe screen is erased (or cleared). All that remains on the
Like all keys on the Commodore 1 6 keyboard, each cursor key can screen is Ihe blinking cursor at the top left corner of the screen.
automatically repeal. Ttvs means mat if you continually hold the key
down, the cursor continuously moves In the direction of the key you're
pressing (saving you from having to perform the tabled "rapid-fire key- EFFECT
KEY
press").
CLEAR /ROME HOME POSITION
CLEAR-HOME SHIFT CLEAR SCREEN
INST /DEL
SHIFT i -CLEAR
HOME
You can INSERT and DELETE
typing with thts key. When you
letters
press
and numbers from Ihe
(his key by the typed
itsell,
line you are cnit (Control) \
characler immediately to the left of the cursor disappears, and the
cursor moves over to where the missing characler was You can use
the cursor keys to go back to the middle of a line and then use DEL to The cm key is like theSHOT *oy in that always works wiih another
it
erase a letter. When you do this, the letter to the left is deleted, and the key. You must hold it down while you press other keys. CTBL is used
in three instances.
rest of the letters on Ihe line move over one space to the left to close
the gap. I i) As the COLOUR KEYS section explains, pressing CTBL and a
colour key lels you change the colour of the texl printed on Ihe
screen.
To open up space lo insert letters and numbers, type this key along You can pause a program thai is PRINTing or LISTing on Ihe screen
2)
with SHOT Space opens to the right of the cursor; the cursor tiself
f
by pressing CTBl and Ihe S key
does not move When you insert space In the middle of a line of letters. (To re-slart the program, press any key except bun/stop )
2C I
21
I
I I I
(
again.
>i
mode, where you can use both upper- and lowercase letters.
2) The O
key always acts as a shift lo let you type the graphic
symbol pictured on the LEFT tronl ot each key. Just hold down <J KEY - EFFECT
and press the graphic key you want
3) The O
key is used like the erst key lo cnange the colour ot whal
you type onscreen when pressed with a COLOUR KEY. CTBL + FLASH ON CHARACTERS
4) When you want to slow down a scrolling d-splay (a program thai I FLASH
appears line-by-ilne on the screen but might be going by too fast to
CTRL
follow), hold down the O
key. The display scrolling speed slows
down considerably When you release (he key, it goes back to
normal speed (Hey. the Jfc key can do something by itselfl)
22
23
> !
Hashing black. When you lype anything. Ihe characters appear in Graphic Keys
black. To changeIhe cursor {and what you type) to a different colour,
use Ihe colour keys On the Ironl ol the keys numbered from i to 8. Each letler key (and a tew other symbol keys) on your Commodore 1
there are two colours written Press cm along with a number key to ( ! I has two boxes on the front of the key. each wrth a different tine,
get the colour fisted on top. at the O key with a number to get the squiggle, Of symbol These are the graphic keys. When first turned on,
colour on the bottom You can change only the colour of the your Commodore 1 6 prints capital letters. When you type one of these
characters using the colour keys. To change the screen background or -•.'v ! 'j -villi the SHIFT or
i
.i ©
key. you type the graphic symbols
border colour, you must use a BASIC command (More on that later.) shown on the front of Ihe key on the screen. You can type the full set
ol more than 60 graphics you see on the fronts of many of the keys
NOTE: When changing colours be careful that you do not press the
number (colour) key even a split second belore pressing cm or KEY EFFECT
O you do, all you'll do is print a number on the screen rather
II
+ A - (GRAPHIC ON RIGHT
than change the colour f
SIDE OF KEY)
+ A = r (GRAPHIC ON LEFT SIDE
OF KEY)
SHIFT
KEY + EFFECT KEY + [ (
You can create pictures, charts, and designs by printing graphics side
CTHl + 1 * BLACK + 1 = ORANGE by side or on top ol each other, like building blocks. You can make
your graphics more interesting by using the colour keys to "draw" In
different colours T-y printing with some ol Ihe graphics keys to see
crtC + 2 = WHITE Cf + 2 - BROWN how they work. Cnapler 6 explains more about graphics.
I
When you're in typing mode, you can only use the graphic symbols on
CTRL f 3 = RED 3 = YEUOW GREEN the left front ol Ihe keys (by pressing & and the appropnate key) The
left side graphics are ideal for creating charts, graphs, and business
+ - CYAN forms,
CTHL 1 + 4 = PINK
1
1
1 r
1
1 i
24 1 1
l 25
! \
I I
f
mode A situation where you might want to redefine a (unction key Is
when you use a command frequently, and want to save time Instead of
repealedly typing in the command. Tne new definitions are erased
£ I | I
when you turn off your computer You can redefine as many keys as
f 1 Tne keys on the righi side ol
lour
you want and as many times as you want
your keyboard {apart Itom the I
f 4 \ resl ol Ihe keys) are special
function keys ifiat let you save I i
( The Help Key
f 2 time by performing repelitlve
(asks with the stroke of jus! one
f 5 \ key. The top of each key reads
HELP
fl 12. t3. and HELP You can
f 3
,
ji
gel these functions by just
I f] pressing the key by itself. The
17 \
f 16 keys read 14. 15. te
fronts ol Ihe
and f? Press shift and f; f2.
I HELP
,
message to you whal you did wrong These error messages are
tell
,7 -1 Ihese (unctions
further explained in the Appendices In Ihe back of this manual
V i
You can gel more assistance with errors by using Ihe HELP key Alter
I
an message, press HELP lo locale your error exaclly. When you
error
Here's what each key does
press HELP, the line with the error is displayed on the screen with the
error flashing on and off For example
GRAPHICS command is necessary for giving graphics HELP You press HELP
commands such as CIRCLE or PAINT More on GRAPHICS in ( 10 PRONT "COMMODORE
Chapter 6 COMPUTERS" The mistake ts displayed (lashing
KEY 2 prints DLOAD" on me screen you do
All Is enter the program i
on and oil
name to load a program from disk and hfl BETUM instead of
lyptng oul DLOAD" yourself. i
i
Hashing prml
I ! (
You can redefine any ol these keys to perform a (unction mat suils your
needs Redetinlng is easy, using Ihe KEY command. You can redefine
26 :
i 27
I
I
(
I
CHAPTER 3
I f
SOFTWARE
(
Introduction
I
I
• Cartridges
!
Cassettes
I
Diskettes
I
I
I (
r i
i
I
I I
I (
I I
I I
I I
I (
I I
2B
( I 29
i
INTRODUCTION
i
TAPE, and DISKETTE form, available Irom your Commodore dealer. All
you do is load them Into your Commodore 16. You can also create and I I
I I
CARTRIDGES
I I
I
Loading Cartridges I
I I
I 31
I
STEP 1 Insert the cassette into your Dalassette and close the door PRESS PLAY ON TAPE
f }
The screen goes blank while your computer then "reads' the program
into its memory. If the entire tape goes by without the FOUND
STEP 4 Press the PLAY button on the Datassette The screen goes
blank as me Datassette starts When a program is found, the I f message, rewind the tape and try again. Once your computer has
digested the entire program, your Commodore i 6 tells you;
screen displays this message:
I I
READY.
SEARCHING I I
RUN
STEP 5 Press the Commodore key C
to load the program that was f I
When the program Is loaded, the word READY appears if you want to Saving Programs on Cassette Tape
I
stop the loading before it's complete, press hun'STC* on the
keyboard and then the STOP button on the Datassette. After the When you a program yourself and you want to keep for later use
write it
software is 'Oaoed. type RUN to start the program. You can also LIST f
or modification, you can SAVE that program When you SAVE a
the program or change it. if it is a BASIC program. program, you are in effect recording on a form of software (tape or
it
I ( disk) that allows you to recall the program so you can RUN It. make
Loading A Specific Program changes, etc When you want to save a program on cassette tape,
follow these sleps
To LOAD a specific program on the tape, use the LOAD "program STEP! Type
I f
nBrne" form of the LOAD command. The instructions are the same as
typing LOAD with no name, with just a few differences SAVE "program name"
r f
32 t i
33
cassettes, you only have and type the
to put the disk Into the disk drive
The program name you use can be anything you want, bul can
commands to LOAD or SAVE programs; there are no buttons to push
be no more than 16 letters and/or numbers long
There are a couple ot small lights on me front o( the disk drive. The
STEP 2 Press the key The computet displays this message: green light ts the power light, telling you whether the disk drive is turned
on or oh*. The red light letts you two things. During normal disk drive
use. when a program is being LOADed or SAVEd, It is Ht while the disk
PRESS PLAY & RECORD ON TAPE is spinning in the drive If there is a problem with the diskette or drive,
the red light flashes on and oft. even after the disk stops spinning in the
STEP 3 Press the RECORD and PLAY buttons on your Datassetto. The drive.
screen goes blank. When your program Is saved, the word
READY appears on the screen.
Loading Programs From Diskette
Examples ot SAVE Commands lor Cassette Tape:
STEP 1 Make sure that your disk drive is pluggea >n and the serial
DISKETTES
DIsks are last ana easy !o use. Be sure to handle your disks and your
disk drive carefully Disks may be referred to as diskettes, floppy disks,
or floppies interchangeably, they are all the same thing Unlike
34
[1 1
STEP 3 Close the protective "door" on the disk drive afler you insert
IMPORTANT: DO NOT HEADER A DISK THAT HAS ANYTHING ON
the disk. 1 1 1
ITUNLESS YOU WANT TO ERASE THE ENTIRE DISK. HEADERING
ERASES EVERYTHING ALREADY ON A DISK,
STEP 4 Type: 1 1 1
( ) 1
HEADER 'disk name" l,Udevice#]|,Iid.#],Ddhve#
(To save lime, you could press FUNCTION KEY 2 and the
• The name you use is the name of the entire disk. Give the disk any
type in
program name ana the second quote marks.)
'
! 1 name up to 16 characters.
• Udevice # specifies which peripheral device number (which disk
'
drive unit), and defaults lo 8 (primary disk drive).
STEP 5 Press the return key The disk spins and your screen says:
rji • The id. the letter I and any two letters and/ or numbers, like 12 1.
is
SEARCHING FOR program name IR5, etc Give the disk any id. you want, but you should give every
FOUND program name disk a different d to avoid contusion. (Note: the firsl characler
I
READY.
i i • II you have a dual drive fa disk drive with two slots tor disks), you
should specify Ihe drive number with a Drive number is
- cursor
ALWAYS included in the command,
or 1 .
STEP 6 Your software is now ready lo use. Type RUN and press the 1 1 !
ARE YOU SURE?
As soon as you press
^^^
return alter typing the HEADER command,
return Key io start ihe program.
i
your Commodore 1 6 asks ARE YOU SURE? This is to give you s last
(
DLOAD is finished,
1
f
Here are some examples of HEADER commands.
to find oul what went wrong. 1
1
HEADER "LETTERS",I07,D1
Examples of DLOAD commands: HEADER "FINANCES", U8.IS3, DO
(
DLOAD "•" LOADs the 1st program on the disk
DLOAD "FILES" LOADs a disk program called FILES.
NOTE: If you want to erase all files on a disk (as opposed to
I
DLOAD "SOF*"
1
Inai disk.
Headering A Diskette 1
Headering prepares a new BLANK disk for use Any blank disk must 1 1 Now that you know how to HEADER a disk, you're ready lo use disks lo
be formafted before it may be used, by using ihe HEADER command. write and save programs on your Commodore 6 (of any olher 1
1 1
1 37
'
i
I
1 1
When you SAVE programs on disk, the computer keeps a listing of all
SAVE
1
When you reSAVE a program, you are replacing the old version with You can also display just part of the table of contents:
the new one. If you want to keep both the old and the changed
versions, you have lo give the new one a different name when you
I
tetters MY.
Follow these steps to save a program on disk: DIRECTORY "'^PRG" Lists every program file.
I
DIRECTORY "«=SEQ" Lists every sequential file.
READY.
I 1
( 1
Example
up lo 1 6 characters long
1
f
It the red light on the disk drive blinks after the DSAVE is finished,
1 (
to learn what went wrong.
not accept your output} you must turn the drive OFF, then ON again
( 1
I 98
I (
I f
I [
CHAPTER 4
THE
FIRST
i (
STEPS
Introduction
i
i
i • Correcting mistakes
f
)
• Screen windows
i r
i i
40 41
i
Not only can you change Ihe colour of the cursor and characlers you
The purpose ol this chapter is to begin to acquaint you wilh some of the type (and your computer displays) on your monitor screen, you can
r
characteristics and capabilities of your and how
Commodore 16, to also reverse the character and background colours. That means that If
take the first steps toward programming with your computer you have Wack characters on a while background and you turn reverse
i
printing on (by typing coo, and 91 everything that appears on the
The Screen Display screen is reversed: Ihe characlers are in white, while the background
I behind those characters is black. You can experiment with changing
the character colour and using reverse printing, by following these
i
instructions'
STEP1 Hold down the key and press Ihe bvs on >-.
f
/
I
i CTHL
r
STEP 2 Release the keys and nold down ihe space bar
i
STEP 3 Hold down the space bar as long as you want While you hold
down the space bar. a line the same colour as the letters on
i your sceen should get longer. K Ihe line gels to the end of the
row, tt continues on the next row
Your Commodore comings and goings a'e seen on your TV or
1 6's f
monitor display screen Whatever you type, whatever your computer STEP 4 Release Ihe space bar (but don't press the return key).
has lo say about what you type, whatever programs you load
shows up on your monitor screen, whether you're hooked up to a
all . II
f STEP 5 Hold down the cm
key and press one of the colour keys
(not a colour that's already on your screen) As soon as you
colour or Wack and whtte TV, or a Commodore colour monitor Your
do this, the cursor changes to the colour of Ihe key you
Commodore 1 B screen, no matter what type ot monitor or TV you're [
pressed.
using, is 40 columns wide. That means that you can type 40 characters
trom Ihe left edge of the screen lo the right. There, are 25 rows, so thai r STEP 6 Hold the space bar down again. Now your computer draws a
an entirely filled screen can contain spaces tor 1000 (25 X 40) line in ihe now Keep changing colours wilh the CTtt
colour
characters. The Commodore 1 6's screen display is made up of Ihree r or keys and Ihe colour keys. Then ho'd down the space
elements: the characters (the letters, numbers and graphic symbols), bar to make more different coloured lines,
Ihe background, and the border When you first turn your computer on.
the characters are black, the background is white, and the boroer is
STEP by holding down
7 Turn off reverse prim and pressing the cm
light blue You've already seen how to change the colour of the
bvs off key Pressing ihe return key also turns oh reverse
printing
characlers using the number keys along witn CTRL or
j£t ,n Chapter
2. You can make the characters any of 1 6 different colours in this
fashion. There are a few oiher things you can do to make printing
characters more interesting.
42 i
43
1
I
r f
—
stripe on your screen, select a colour you like and type (he symbol
fby pressing s&FT and E) across an entire line. Then turn on
reverse printing; fill the next line with the same-symbol. only
i
i
The run/stop key breaks into whatever program the computer is
running, and returns control of the keyboard back to you.
reversed. On Ihe next line, type SHIFT and R (still in reversed print). r i
Then turn off reverse, and fill (he last line with iuft and R (no
TIP: Want lo slow down this program (or any olher) without slopping
longer reversed). Now your screen has a racing stripe In whatever
colour you chose; perhaps is a it humble achervement, but it does
!
it? Just hold down the © key
give your screen a certain flair .
. .
i (
I
The following, although is only two lines long, qualifies as a program.
it READY You don't type this; this is your
Type it exactly as appears here. Don't leave out the numbers at the
it
computer letting you know that
i r
beginning each line, since they are the line numbers; they tell your
ot It's READY tor new commands or
computer what order to read and perform the lines of the program. Be programs.
sure to press the return key at the end of each tine you type. i i
20 GOTO 10
words FIRST TRY on your screen
44 [ i
45
Now try tne same line, bul replace BfS ON and HVS oft with your compulef to execute or into your
for that matter) either for
and FLASH oit (the < and > keys): computer's memory, you must press Ihe heturh key
10 PRINT" I
COMMODORE I" Press CTRL and flash on
1. YOU CAN EDIT A LINE by overtyping.
Press; CTRL and FLASH OFF Use the CURSOR KEYS to move to the place In the line thai you want
lo change Now just type over whal you want to change Press
When you RUN this, it PRINTS oul COMMODORE
16 |ust once. But the when you linistv
46 47
this by typing UST. whichdisplays a ilne-by-line LISTing of your
Now add the other letters'.
program as it stored
is in the computer's memory. When you LIST a
program, all lines appear In correct order and the replaced lines don't
10 PRINT "COMMODORE"
appear
You can see what the COLOR command does In this example. For a
10 PRINT "AFTERNOON SCHEDULE" more complete explanation, see Chapter 6, or look up COLOR in Ihe
BASIC Encyclopedia.
You can change this lo WEEKLY SCHEDULE by moving the cursor to
Replacing lines In a program is also a good way to experiment with
Ihe E in AFTERNOON, pressing Ihe msT/DFZ key three times, and
your computer When you replace a line, the new one doesn't have to
typing WHDO.Y
be anything like Ihe old line. For example, instead ot correcting Ihe
I spelling of COLOR, you can enter this line:
10 PRINT "AFTERNOON SCHEDULE"
and press inst/del three times 10 PRINT'COMMODORE 4 TIMES COMMODORE 4 «^'
4. YOU CAN RETYPE A LINE anytime, even after you've RUN the pro-
gram Your Commodore 1 6 automatically replaces the old line with
Ihe new one when you press return lo enter the new line. The old 5. YOU CAN ERASE AN UNWANTED LINE just by typing the number
tine still appears on the screen, but your computer ignores it. When of the line and pressing HETuWi The computer ignores the line
you have two statements with the same line number, your Commo- even Ihough still appears on the screen Type UST to get tne pro-
it
dore 1B only uses the last one entered. For example, in a brief pro- gram LISTing to make sure the line is gone from Ihe program.
gram using the COLOR command to change the colour ol the screen
"
background, a mistake might occur: 10PRINT "COMMODORE 4 TIMES COMMODORE 4 -
20 PRINT "COMMODORE 16"
I
Now Ihe first line 1 is replaced by the second line 1 0. You can check 20 PRINT "COMMODORE 16"
49
48
CLEARING THE SCREEN SCREEN WINDOWS
I
There will be times when your screen is loo crowded, or you wanl to
reorganize what you've lyped, or you're |ust plain unhappy with what's
on the screen and want to banish it to wherever It is that print goes
I
once leaves the monitor screen. There are a few ways to accomplish
't
One way to clear the screen is lo hold the space bab down, until it
2. Press the aan and CU/HOMK keys together This clears the Windows let you aefine a specific area of the screen as your
screen and repositions the cursor at the lop left-hand corner, (the workspace. Everything you type (lines you type. USTmgs of programs,
'home position')
etc.) after setting a window appears within the window's boundaries,
3. Type not attecting Ihe screen outside the window area. You can set up a
window anywhere on the screen.
SCNCLR and press return
This Is a BASIC language commanc that your computer Interprets as To set a wmoow, follow these steps
instruction lo clear the screen.
STEP 1 Move Vie cursor to ihe screen position you want as the top
4. Press the RESET BUTTON. This resets the machine, bringing left comer ot the window
Pack
the starling screen and clearing all programs out ot your computer's
STEP 2 Press the ESC key and release tt. and then press T.
memory.
STEP 3 Move the cursor to the position you want to be the bottom
right comer ot the window
if you want lo dear the computer's memory but. not the screen, lype:
50 51
KEY FUNCTION
A
B
C
D
Automatic insert
Set the bottom right comer of the screen window
(at the current cursor location)
Cancel automatic
Delete current line
insert
CHAPTER 5
1 Insert a line
J
K
Move
Move
to the beginning of the current line
to the end ot the current line
NUMBERS
Turn on scrolling
L
M
N
Turn of) scrolling
Return lo normal screen display size
AND
P
Cancel insert, quote, reverse, and flash modes
Erase everything from the beginning ot the line to the cursor
CALCULATIONS
Erase everything Irom the cursor to the end of the line
R Reduce screen display Introduction
T Set the top left corner of the screen window
V Scroll screen up Numbers and operations
W Scroll screen down
X Cancels the previous Escape function • Calculations
Variables
Numeric functions
52 53
INTRODUCTION Fractions and Decimals
You don't have lo be a mathematics genius to understano and make You can write a fraction like this 5
use ol the mathematics capabilities ol your Commodore 6. In addition
1
or like this: 1/2 Your computer Is actually
lo the straight-forward operations like addition, subtraction, performing the division
multiplication and division, you can use your computer to figure out
advanced functions like square roots and sines. You'll leaxn about the If you pul a a PRINT statement, your answer
fraction in is always
different types of variables,and how to use them. Your computer can returned as a decimal or whole number For example.
handle single digit whole numbers or complex numbers of up to 38
places expressed m exponential notation with equal efficiency You can PRINT 139/493 + 5 RETURN
do your calculations directly or as part of programs finally, this chapter 5.28194726
gives you a brief explanation of now lo set up your own functions lor
your computer lo evaluate.
THE PI KEY
NUMBERS AND OPERATIONS
Hore's an example that uses pi (3 1 41 59265 J,
which represents
You can use your computer like a simple calculator. Besides tne the ratio ol the circumference ol a circle to its diameter. Use ihis value
standard + and — operalion signs, your Commodore 1 6 uses the •
by Just pressing Ihe 7T key ( and =}:Q
sign for mulllplication and the / sign lor division and fractions.
I
or > <
< Here
notation
is how the number 198.505.478 would be written in scientific
NOTE: Your computer doesn't accept commas as left of the decimal point
pari ol a number.
For example, you have lo lype 30359 Instead of 30.359. It you put a
comma in a number, your computer thinks you mean two numbers 1 .98505478E + B This number is ihe number of
(separated by Ihe comma), and would read it as 30 and 359 instead
digit places the decimal poini is
of 30359. :
moved
I
54 J
55
Fof a number less than one with several decimal places, Ihe second 10 PRINT "2001/2010="
number would be a - instead ol a +, indicating ihat Ihe decimal point 2001/2010 I
don't forget the semicolon
Is moved lo the right. RUN
For example
2001/2010= .995522388 this space >s left tor the answer's
1984 sign
0003359 - 3.359E - 4 Ihe answer for line 20 stays the
20 = 2E + 1 the decimal point is moved 1 digit left If you want to both PRINT the problem AND solve il you have to type it
105000= 1 05E + 5 the decimal point is moved 5 digits left twice once in quoles and once out ot quotes, as line 1 shows.
.0666 - 6.66E - 2 the decimal point is moved 2 digits right
Order of Calculation
PERFORMING CALCULATIONS
You can perform more than one calculation in one line. Try typing this.
3 1
Your Commodore 1 6 always performs calculations in a certain order.
Problems are solved from left to right; within thai general rule, some
types of calculations are solved first. The order thai your computer
evaluates expressions is called the order of precedence.
For the first time, PRINT didn't print exactly what you typed In the
statement. Instead, your computer solved the calculations and PRINTed FIRST: Your computer checks for negative numbers (not subtrac-
only tho answers. All you have to do to use PRINT to calcuiato is omit negative numbers).
tion, just
the quotation marks, Now try this: SECOND; Your computer soVes any exponents.
THIRD: Your computer solves all multiplication and division, from left
NEW to right.
10 PRINT "2001/2010" FOURTH. Your computer solves addition and subtraction, from left to
20 PRINT 2001 - 17 right
RUN
2001/2010
11984 one space here
NOTE: Your Commodore 1 6 always solves any pari of the problem
is left lor Ihe
that's surrounded by parentheses first. You can even put
answer's sign
parentheses within parentheses: 36 • (1 2 + (A / 3)). The contents of
the Innermost parentheses are solved first.
Since line 10 Is in quoles, your computer |ust PRINTs the problem as if
itwere regular lext: exactly as it appears between the quotation marks.
Notice that no space is left for the number's sign from line 10, as it is in Sometimes a good idea to oul negative numbers in parentheses lor
it's
the printout for line 20. Now move the cursor back lo line 1 and clarity. For example, if you want to multiply 45 by -5, type II like this:
change the line lo this: 4S*<— 5) Your computer can understand it with or without parentheses.
I
56 57
MORE ABOUT PRINTING ON THE SCREEN print' a" rwro'rD" ;•&","?'
You've probably noticed thai certainprograms had you lype commas In spaces the letters like this on your screen:
certain places, white in others there were semicolons. Your computer COLUMN
1 11 21 3' 40
inlerprets commas and semicolons as instructions lor the spacing of the
ROW 1 A B C D
printout
2 E F
same with spacing ol both text in quotes (called "text strings") and When you use semicolons to separate items In a PRINT statement, your
numbers being calculated Try typing this brief program Commodore 16 ignores the print zones and PRiNTs all the items one
after another;
NEW
10 PRINT "0"."K" PRINT "A";"B";"C";"D";"E";"F"
20 PRINT "O'V'K"
PRINTS ims
I
ZONE 1 ZONE 2 ZONE 3
When you use a commaa PRINT statement, the
to separate items in
items are PRINTed several spaces apart When you use a semicolon, ABCDEFGHJJKL M
the items are PRINTed right next to each other,
As you recall, your computer's screen has 40 columns across. These NOTE: Sometimes youli type a particularly long line on your
columns are divided into four 1 space areas, called PRINT ZONES computer, such as this:
When you use a comma to separate PRINTed items, your Commodore
1 6 PRINTS the first item In ihe first print zone, tne second item in the
second print zone. etc. The commas work like tabs on a typewriter. 10 PRINT "I LIKE YOUR TOUCH ON MY KEYBOARD. DO YOU
COME HERE OFTEN?"
PRINT ZONE < PRINT ZONE 2 PRINT ZONE 3 PRINT ZONE *
<
r i . i • i « !'pii».nini(.wiiDi>M»JH'B»B»nanimi"»n«i<coiw™ You'll notice lhat you run out ol room on one row. But
as you type this,
O K
keep typing; the Commodore 1 6 automatically moves on io the nexl
row and continues printing there until your line is linished. You can type
Ifyou try to PRINT more than four items separated by commas, your as many as BO characters on one program line (up to two full 40-column
computer automatically goes to the next line to PRINT For example: rows}.
Now try RUNnlng this one line program. The message is printed on two
f
58
59
tows. If your than one row. your Commodore 1 6 lets It
lino is longer Make sure that you always use the nght variable type. If you try to do
spill over row Your computer considers the line ended
to the next I something like assign a word to an integer variable, your program won't
when you press Ihe HETUWf key, nol when you lype lo the end of the work. This program shows you what variable can or can't be used in
a
row You'll get used to tins as you use your Commodore 1
given situation, and you can find oui what happens when you try out
different types ol data:
If you RUN this program, the screen result is. When you RUN this program, try to enter these values (one each time
you RUN when you're asked and see whal happens
it)
SAMPLE
TYPE SYMBOL DESCRIPTION EXAMPLES VALUES
Floating real (decimal) X, AB, T4 23.5. 12.
point or whole f
60 61
You could also include one of the functions in a program line, as the
example shows;
following I
10 FOB X= 1TOS
20 PRINT "THE
30 NEXT X
SQUARE ROOT OF"; X;"IS"; SQR(X) CHAPTER 6
You'll find a complete listing of the numeric functions In the BASIC
Encyclopedia In the back of this manual. GRAPHICS
NOTE: Most commands have an abbreviation mat you can type
AND
instead o( typing out the entire BASIC name. Your Commodore 16
interprets the abbreviation exactly as It would read the full name. An COLOUR
example of an abbreviation is as follows
• Graphics characters
Lthen O prints L on your screen !
I
Your computer reads this as It you'd typed out LOAD. Abbreviations Character animation
are useful as a tlmesaver. There Is a complete list of the accepted
abbreviations m the BASIC Encyclopedia
Controlling colours
Here is a statement utilizing the user defined function for calculating Ihe
value of a secant
[
10DEFFNS(X)-1/COS(X)
This figures out the value of Ihe secant of any number entered lor X.
FNS is the name of the function defined by this statement Appendix C I
understand
62 63
To draw the left Keeping the shift loot down, go to the space
side:
GRAPHICS CHARACTERS
'
!
directly beneath the curved edge (where you pressed the "U" in the last
I
You should remember from Chapter 2 that each letter key contains 2
step. Press the "B" key. then cursor to Ihe space directly beneath Ihe
line segment you just drew and press "B" again. Do this until you've
different graphic characters, as do the @. -, ", and £ keys for a total I
f
of62 different graphic characters To these graphic characters, you
print
pressed the "B" key a total ol 7 limes. (Using the cursor keys win be
tough at first; you'll gel belter with practice.)
must hold down the shift or O keys while you press the key tor the
1 1
graphics symbol you want.
and press a tetter key lo print the graphics character on the right side of
key These characters include the playing card suits, a solid
that letter 1 r
and a hollow ball, and a set of lines and connecting characters that you
can use to draw many different pictures on your screen. 1 i
Pick a Card, Any Card To draw the bottom edge. Similar to Ihe lop edge, you press "J" once
1 i
Here an example to help give you a better idea ol how to use the
is
and then press the "C" key 5 times, finishing off with the "K" key.
graphic characters to create representations. Follow these instructions 1 i
u i 1 i
V /
1 1
Now time lo draw Ihe top edge of the card: Press the mutt loci
it's
key so that it stays down Press "U". followed by the C" key 5 times,
1
i
'
and then the T. To draw Ihe right edge: Draw Ihis in the same fashion as the left edge,
1 i pressing Ihe 'B' key a total of 7 times (while cursoring lo the appropriate
place).
1
i
i
B 1
1 i
1 i
64 1 i 65
1
1
1 1
NOTE: When the shift lock down, you can press return and
is
I
not get a SYNTAX ERROR from your computer as a response. Even
1
1
though you had characters on the line that weren't commands thai
1
I
the computer can understand, your computer interprets the return
key as just an Instruction to return to the beginning of the next line
1 1 when the OVT key is held down. Your computer does nol try lo
read or interpret what has been typed as BASIC language
1 1
1 commands when shift oi shift loci is down.
You can use the graphic keys to enhance your printout For example,
(one space down end one space over from the rounded edge) pfess the
'6*. Go to the bottom right corner, position
1 J here's how to underline a word or column-
the cursor one space up and
space lo the lelt and type another 'ff
1 1
move the cursor to the line below what you want to underline.
First,
Then hold down the -fr key and the "T" key, which prints an underline
SHIFT S I
space. Hold these two keys down until the entire portion of text is
1
\ underlined.
6 1 1
1 I The purpose ot this section is to show you how the graphic symbols of
W9 1 I
your Commodofe 1 6 can be manipulated to creale different shapes and
figures and used in a more practical sense in addition to the 62 graphic
characters available to you, you can also use the reverse of these
characters. (Remember the racing stripe!) Now that you have a good
1
:
r idea ot what is involved in using the graphic symbols to build different
L J. forms, you should experiment with them yourself, and see what you
1
1 :
come up with.
Now to ge t down
to the heart of the matter—6 of them to be exact.
1 1
Press the SHIFT LOCK down again. Go one space down from and one
space lo the right, from where you typed the 6. Press the 'S' key, hit the CHARACTER ANIMATION
SPACE BAR and press the 'S' again Cursor down two rows and repeat
,
1 1
the 'S- SPACE -S' sequence. Add the last two hearts two more rows
Movies are really a sequence of still piclures Each picture is a tittle
down You now have an official six ol hearts playing card This won'l 1 !
f differeni from the one that came before. The protector shows each
do you too mucn good In a game of blackjack, however. If you want to ptclure tor a very short time, then goes on to the next one. The scene
improve your hand, creale a couple ol cards of your own 1 1 becomes animated.
1 1
Computer animation works the same way First the computef draws
one picture, then it changes the picture slightly. Your Commodore 16 is
fast enough to move objects smoothly around the screen In your games
l : 1
i
1
66 i I
67
! I
I I
"
this Illusion on your computer is lo use a program lo draw a picture, 10 PRINT " HOME SHUT M SHIFT W SHIFT N
wait for a split second, (ben change to a new picture. 20 PRINT" SPACE O + SPACE
30 PRINT " SHIFT N SPACE SHIFT M"
I
I 40 FOR L= 1 TO 300: NEXT L
To get program
the create pictures you would use the PRINT
to
SO PRINT " HOME SPACE SHIFT W
statement with the graphic characters. The simplest type of animation
involves alternating two characters to gel the effect of movement, 60 PRINT " O T C> + T" <
70 PRINT " SPACE © G fr. G"
80 FOR L= 1 TO 300: NEXT L
i
This progr am sim ulates animation by alternating ihe circle shift & O)
( II
90 GOTO 10
and heart (JHfBt & S) symbols. It you use your imagination, you could
consider this a heartbeat ol sorts
I
Type RUN and press Betuhn
! I
IMPORTANT TO NOTE: Each time SOFT or O is referred to, il Inbolh examples of animation so far. the figure has been stationary In
should be typed at the SAME TIME as the key following it when I
i
one area on Ihe screen. The next step is lo move the animated figure
entering the program, since nolhtng happens when either Is typed by around. The TAB function helps when you want to move objects from
Itself ( the led edge, (The TAB function is explained in detail In ihe BASIC
Encyclopedia) The following program portrays a snake crawling on Ihe
i l screen.
Remember
program, and press
lo type NEW and press mft before entering each new (
I
I
30 NEXT L "
type these keya i
20 PRINT TAB (A) " SHIFT U SHUT I SHIFT U SHIFT I
40 PRINT " HOME SHIFT simultaneously
I
30 PRINT TAB (A) " SHIFT K SHIFT I SHIFT K SHIFT I SHIFT Q"
50 FOR M=l TO 200 40 FOR L=l TO 100: NEXT L
60 NEXT I
50 PRINT " SHIFT CLE "
70 GOTO 10 60 PRINT TAB (A + 1)" SHIFT I SHIFT U SHUT 1 SHIFT U SWT W"
( 70 PRINT TAB (A+l)" SHUT I SHIFT K SHIFT I SHIFT K"
80 FOR L=l TO 100: NEXT L
You'll see Ihe obvious limitation of animation alternating two characters 90 NEXT A
when you RUN this program To stop it press Ihe boh/stop key
I
I
I
'
Lines 60 and 70 will look like this;
vxr
I
I 69
f
Using characters like the ball (SHIFT O), you can play video games on The second number after COLOR setecls the colour you want to put on
the screen. To move a bail, just erase ihe ball ana replace it at a new
I
the area of the screen you've specified. The colour numbers
position, as In th<s program conespond 1o the colour keys on Ihe keyboard.
"
10 PRINT " SHIFT a* I
When you RUN the program, remember to press the MB/stc* Key 1 BLACK 9 ORANGE
when you want stop moving the 2 WHITE BROWN
to ball.
M 3 RED
1
11 YELLOW GREEN
CONTROLLING COLOURS 4 CYAN 12 PINK
i
Separate colours can be put Inlo each pan at the screen The border
i
5 PURPLE 13 BLUE GREEN
can be one colour, the background a different one, and each character 6 GREEN 14 LIGHT BLUE
can have Its own colour You already know how to set the character i
7 BLUE 15 DARK BLUE
colours using the keyboard. Vou can change the colours ol Ihe other 8 YELLOW 16 LIGHT GREEN
scroen areas using the BASIC language command COLOR i
For example, you can turn Ihe border of your screen 'ea by typing the Each colour also has an adjustable brightness level, called the
command COLOR 4,3 and pressing the MlUM
key. The number 4 in
f
luminance You can add a number from (darkest) through 7 (brighies!)
after the colour number to vary the colour Type COLOR 4 ,3, and
the command stands lor the border area, and colour number 3 is red
(the same number as on the key marked RED).
f
press KTOlK The border becomes a dark red. Type COLOR 4, 3, 7
and the border changes 10 a bright red
Try typing COLOR 0, 7 and hitting betum The screen background (
now turns blue. The number stands for the background, while the 7 is
In short, the COLOR command looks like this
blue {also the same as the keyboard) ! COLOR area, colour, luminance
The first number after the word COLOR specifies Ihe area on the
Here is a quick program to show you all your Commodore 1 6's colours.
screen you want to change This table lists what each screen area (
number controls; you'll learn about areas 2 and 3 when vou get inlo First type NEW and press hetubm
multi-colour graphics later m this chapter !
3 Multi-colour 2 90 NEXT
4 Border 100 PRINT
I
CHARACTERS 110 RESTORE
BACKGROUND 120 NEXT N.M
1
130COLOR1,2, 4
BORDER 200 DATA 7,14,4,13,6,16,11,8,10.9.3,12,5,15,2,1
I
70 71
I
I
I I
but you won't be able to see any commands you type. You can switch
interchangeably. back and forth from graphics to text using the GRAPHIC command
(
(
The command GRAPHIC switches the screen back to text, while
GRAPHIC 2 switches back to hign-res without erasing Ihe screen
THE GRAPHIC COMMAND 1 I
Adding ,1 after the command erases the screen
( I
The graphics you've seen so There is another way to clear the high-resotulton screen. The
use only the keyboard without really
tar
taking advantage of your computer's capabilities. The BASIC language command SCNCLR erases the screen without changing the graphic
of your Commodore 1 6 contains commands to draw shapes and forms
1 1
mode Once you use high-resolution graphics, Ihe computer sots aside
through programs. To use the graphics-related commands of you' 10K of memory for your high-res screen. This memory is taken trom
computer, you must enter a new mode, the GRAPHIC mode. Graphic 1 1 the BASIC program area. When you are through using graphics, you
mode can be considered the drawing mode, since all the drawing can reclaim this memory by using ihe command GRAPHIC CLR.
commands are "activated". You can't use these commands until you 1 1
specify exactly what graphics mode you want to use; you specify
which type ot graphics mode you want by using the GRAPHIC I 1
GRAPHIC command, you can even have part-text, part-graphic screens HIGH RESOLUTION GRAPHICS
that 'ol you can write on one pari ol Ihe screen and draw on the rest.
1 (
The command to enter this new mode is GRAPHIC Your Commodore 1 6 screen contains 25 rows of 40 characters each.
( ! 1
or 1 000 total character positions on the screen. Each character is
In general the GRAPHIC command looks like this formed out ol single dots, with 8 rows of 8 dots each making an entire
Texl dots Drawing a racing stripe or a playing card is a nice little exercise,
1 High-resolution graphics bul your creation is limited to using the characters (letters, graphic
'
f symbols, etc.) on your computer keyboard. You can slill create all
2 High-resolution graphics + text
Multi-colour graphics kinds of shapes and figures but just a fraction of what you could do if
Multi-colour graphics + text
1 1 you could control each dot by itself The high resolution graphics
capability of your Commodore 16 lets you do |ust that Resolution
(
Clwr number Effect
1
1 Clear screen
I f
72 i 1
73
refers lo the precision and control you have in drawing; with nigh Some forms of the DRAW command are
resolution graphics, you can use commands thai let you draw and I
!
I COMMAND RESULT
There is one limit to high-resolution (hi-res tor short) graphtcs. Your DRAW colou' source, column, row POINT
computer can only use two colours in each 8*8 character position, I
DRAW colour source, column, row TO column,
That Is. each 8x8 space on the screen (where a* single character row LINE
would fit) is limited to two colours {foreground and Background colour I DRAW colour source TOcolumn, row LINE DRAWN FROM
tor that square) You can use different colours for each different LAST POINT
character position, but only two colours within mat position. Anolhei
graphic mode that will be covered later in this section, multi-colour
Colour source Is for the background. for the foreground. Anything
I
{erase a dot). The next two numbers are for the column and row
Clear the computer's memory with the NEW command so you're sure
that there are no "left-over" program tines, and then (
positions for the dot. So you wanted to draw a dot at column 1 7. row
if
type.
20, you would type DRAW 1,17,20. To erase the same dot, you'd Type
I
DRAW 0,17,20
10 COLOR 0,1
20 GRAPHIC 1,1 (
30 FOR L=2 TO 16 The DRAW command can also draw a line between any two points.
40 COLOR 1.L.2 Justadd the word TO and the coordinates of the other end, like this.
50 DRAW 1,0,L*12 TO 319.LM2
I
DRAW 1 ,1 ,1 TO 1 00,1 00. This draws a line Irom the dot at 1 .1 lo
60 DRAW l.L'18,0 TO L-18, 199 100.100. You can erase this line by typing the same command, just
70 NEXT L
I
substituting a for the 1 immediately after DRAW
80FORL-lTOS000:NEXT
90 COLOR 1,2 J I
100 GRAPHIC If you are used drawing graphs in malh, you might get a little
lo
! confused at first while using the computer. The coordinate system in
your Commodore 1 6 is different from what you've used before. In math
Notice mat the colours change near the intersections. This is due lo the I
the 0.0 point would either be at Ihe cenire or Ihe lower left comer of the
limitations of hi-res graphics, with too many colours too close together. screen, but on your computer n Is the upper left corner. You'll get used
to this system as you practice.
(
Points, Lines and Labels Once you have put a on the screen, you can draw a line
point or line
from it to DRAW 1 TO 150,50. This draws a
any other point like this:
Type the commands GRAPHIC 2,1 DRAW 1,0,0 and press betdrn line from Ihe last poinl drawn lo column 50 row 150. your program If
Look closely at the upper left corner of the screen. Your Commodore uses a loi ol DRAW TO commands, you could place Ihe first dot at a
1 6 drew a white dot there The DRAW command can be used to draw position on Ihe screen by using the LOCATE command, as in
a single dot anywhere on tho screen, a line, or a shape. LOCATE 100,100, to Immediately return lo Ihe first position
I I
74 (
I
75
(
(
This program draws a curve based on Ihe sine lunclioo 81 CHAR 1,0,0,"GRAPH OF':CHAR l.O.l/'FORMULA"
f 82CHAR1,0,2,"Y»SW(X)"
83 DRAW 1,0,100 TO 319,100,189,0 TO 189. 199
NEW r 84CHAR 1,0,12,"X-AXIS": CHAR 1,22,0, "Y"
10 COLOR 0,1 85 CHAR 1,22,2,"A": CHAR 1,22,3,"X"
20 COLOR 1.2 86 CHAR 1.22,4/T*: CHAR 1.22.VS"
i
30GRAPHIC 1.1
40LOCATE 0,100
50FORX = TO 319 1
i
100 NEXT L
110 GRAPHIC
Drawing Rectangles
This program plots the same curve using points Instead ol lines.
I i
One ot the graphic commands ot your Commodore 1 6 makes easieri(
IIyou would like lo draw a solid box instead of just Ihe outline, you just
Leave the last Iwo programs In ihe computer, don't type NEW Add f (
add a comma 1 alter the angle. A solid box at the centre of the screen
these lines: is shown as BOX 1,100,50,220,150., 1. Notice thai you need a comma
f I
f l
76 77
1 1 i
i
'
r
lo lake the p'ace Ql the angie, even though you don't want the box The usual forms of the CIRCLE command are:
rotated This ts so your computer reads the comma as the DEFAULT i
i
Is read as the angle lor the box to be rotated. CIRCLE on. centre column, centre row, radius circle
1
I
1
CIRCLE on, c-col, c-row, width, height wa
CIRCLE on, c-col, c-row, wid, hi, start, finish arc
Some typical forms of the BOX command are: CIRCLE on, c-col, c-row, wtdth, height., .angle rotated oval
1 1
specify. Column 1 row 1 is the upper left corner of the box while row
, 1 1
using the CIRCLE command. Just tell the computer how many
10 COLOH 0,1 i
degrees to go between points on the circle, like Ihis. CIRCLE
1 (
20 COLOR 1,2 1,160, 100,50,42,,,. 120. This command draws a triangle, since each
30 GRAPHIC 2,1 side is 1 20 degrees (Remember that omitting number values while
40 A = RND(1)'20+ 10
1 1
including commas in a graphic command causes your computer to read
50 FOR L=0 TO 359 STEP A standard default values lor the missing number.) A simple (ormula to
10 GRAPHIC 2,1
20 INPUT-HOW MANY SIDES";A
30 IF A < 2 OR A > 100 THEN PRINT "DONT BE RIDICULOUS":
GOTO 20
Drawing Circles 40 CIRCLE l.I60.80,40,33„ M 360/A
I 50 GOTO 20
Your Commodore 16 also has commands lor drawing circles Uke the
BOX command, you can vary the shape of the circle (to form an oval or
I
an ellipse), and you can rotate the oval. You can also just draw a You can choose to draw only an arc Instead o> a whole circle. The
section ol me shape (called an arc). CIRCLE command accepts the starting and ending angles In degrees,
(
78 79
f
10 COLOR 0, (
20 COLOR 1,2
30 GRAPHIC 1,1 MULTI-COLOUR GRAPHICS
A = RND(l)" 20+ 10
:
I
40
SO FOR L=0 TO 359 STEP A The Commodore 1 6 high resolution graphics give you control over
60 CIRCLE 1, 160. 100, 80, 40...L I
every single dot or "pixel" on the screen, but you have seen that the
70 NEXT L ability to put colours close together is limited. Most hkes programs
I
This program will be slightly different each time you RUN
To begin using multi-colour graphics, review the GRAPHIC command
f
see that the multi-colour screen without
earlier in this chapter. You'll
text is GRAPHIC 3 and the multi-colour screen with 5 lines of text Is
To make a circle or other shape more than just an outline, you can use (
Ihe PAINT command The PAINT command fills In any enclosed area Now look at the table listing the COLORcommand. There are two
up to the boundaries formed by lines drawn on the screen. If there are areas that we haven't used yet, areas 2 and 3. These areas hold two
f
no lines rjrawn, the screen is filled right to the edge. The BOX extra colours. You can use any of the three colours (1 the text colour;
.
command has a fill option that colours In boxes and rectangles. The 2. an extra colour; and 3, another extra colour) These colours do not
f
PAINT command can colour in irregular shapes and other non-uniform Interfere with each other on the screen the way the hi-res colours do in
areas on the screen that can't be filled with other commands. some previous programs In this chapter.
To see what the PAINT command does, add this line to the last
This program makes use of multi-colour graphics, showing a "neon
program:
sign" effect.
,i
BO
"I
; t
NEW
10 COLOR 0,1 !
20 GRAPHIC 3,1
30 COLOR 3,1
40 TRAP 200
50 DRAW 3,10,10
60
TO 10,100: DRAW
DRAW 3,30,10 TO 30,100: DRAW
3,10,5S TO 30,55
3,50,10 TO 80,10
f
(
CHAPTER 7
70 DRAW 3,65,10 TO 65,100: DRAW 3,50,100 TO 80,100
80FORL=0TO7
90 COLOR 3,2,L
i
SOUND
100 FOR M= TO 100: NEXT M
AND
f
1
110 NEXT L
120 COLOR 3,1 [
130
140
FOR M-l TO
GOTO 80
100: NEXT M
f
MUSIC
200 GRAPHIC 0: COLOR 1,2,7
Introduction
r
Colour area 3, the second of the multicolour areas, has a special ability
Volume command
t
thatnone ol the others has Once you have drawn on the screen using
area 3, you can change that colour everywhere it appears on the Sound command
screen by using the COLOR command, If you set the colour with i
COLOR 3,5 and draw using that colour, your graphics appear in • Creating sound effects
purple. you then change the colour with COLOR 3,6, all the purple
II f
areas would change to green. This doesn't work with any other area.
The Series 264 Programmer's Reference Guide contains more Making some music
information about graphics
[
The Mustc Machine
82 [ 83
M BM
i
Try the example again and use a different number after the VOL
first
INTRODUCTION command. The larger the number, the louder the note is played.
Here Isa short program lo make music on your Commodore 16. Alic
you've typed it in, when you RUN It, a question mark will appear on f
your scree" Type any number trom lo 1 01 5 as your response and
The Sound Command
press return To stop the program, enter a zero as your value.
i
The SOUND command tells your computer everything it needs to know
aboul Ihe sound you want to otay The SOUND command is followed
10 VOL 8 i
LOOP UNTIL X-0 The number In the sound command refers lo voice. The number
first
50
i
for vo'ce can be a .2 or 3 The Commodore 1 6 sound is produced by
1
i
two different "voices", 1 for Ihe first voice and 2 for the second vo»ce.
Pressing the huh /stop key also stops the program
1
The third voice option applies lu voice 2's capacity to produce either a
i
lone or noise.
Voice 1 - This voice plays only tones Select INs voce wllh a 1 after
First Type VOL 8 and press ( I the SOUND command
Second Type SOUND 1,266,60 and press return i i
Voice 2 - This voice is like voice i , but can be used lo play tones o'
noise tor sounds. Type a 2 In the command lo use this voice for tones,
i
You should hear a note play tor about a second and Ihen stop. You
i
or a 3 to use this voice for noise, to make sound effects like thunder
I
I sound effects.
The VOL command controls the VOlume ol the notes that your
Commodore 1 6 plays. The number thai comes after VOL
is the selting
i I
torthe volume This command works pretty much like the volume knob This displays a! of the notes in one scale, along with Ihe note value to
on your TV When it is set at zero (VOL 0). the volume is ott and you use There is a complete chart ot notes tor the Commodore 6 n Ihe 1
f
won'l hear anything When you set it at 8 (VOL 8), the volume is appendix.
turned up all the way. and your computer plays as loud as it can.
84 I 85
which counts time in sixtieths of a second A duration of 60 keeps the
I note on lor one second The rule ol thumb lor duration is the larger the
number, Ihe longer the note stays on. In tact, II you use 65535. the nole
Ill II III 41 III II I stays on lor over 16 minutes. To turn a sound off, use a zero duration,
which does not allow Ihe sound to be produced.
NEXT loop with a negative STEP, to count down from a high number lo
NOTE A a lower one by 25 at a time
B C D E F G f
VALUE 770 798 810 834 854 864 881
ACTUAL FREQUENCY 440.4 494.8 522.7 588.7 658 699 782.2 10 VOL 8 sets VOLume at 8
(HZ) 20 FOR S= 1000 TO 700 STEP -25 creates loop, with
30 SOUND 1, S, 1 downward STEPs
Try the Wowing program:
40 NEXT S
NEW
! Type RUN ano press return to near the sound effect, The key is line
20. which selects a number range from 1 000 to 700 going down the
10 VOL 8 -<— sets VOLume scale. STEPping down 25 numbers at a time Finally, line 30 instructs
20 X -0 (
your Commodore 16 to play each note lor (us: an instanl by selttng the
30 DO DURATION to 1 which is 1 /60 ol a second. Experimenting with
40 SOUND l.X.5 « plays nole
,
different number and duration values can give you some very
50 X= X +S
interesting effects.
60 LOOP UNTIL X - 1015
70 VOL -* turns off VOLume
80 END (
Creating a Noise Sound Effect
Using a value ol 3 selecting a voice in the SOUND command
when
This program shows of some ol your Commodore '6's musical range. (
spc-cilies noise. This isused lo create sound effects with noise rather
than tone. The following program uses voice 3 lo create the sounds ol
The third number after the word SOUND controls the Duration (length) f
a windstorm.
note This tells your computer how long to play the note. This
ol the
number can be anything Irom to 65535. This number sets a timer, I
10 VOL 2 -« sets VOLume level
20 R-INTIRND{0)-10) + 1 < selects RaNDom number Irom 1
(
30FORX = 1TOR to 10
40SOUND 3, 600+ 30*X, 10
(
86 I 87
r
50 NEXT X Press numbers 1 Ihrough 8 to play notes. The screen border even
( (he urge to play a popular song. Here are Ihe numbers lo press lo play
110 GOTO 20
a well-known song that surely must be considered a classic.
I
I
Lines 30 and 60 up FOR
sel .NEXT loops lor the nole value
.
mmm
(frequency) ol Ihe sound, one increasing and one decreasing, based on 115 5 6 6 5
f
the random number from line 20. Is Important to have variation in
11
I
4 3 3 2 2
4
pilch, since windstorms have different forces of gusts of wind. Lines 40 5 5 4 4 3 3 2
and 70 are the SOUND commands that creale Ihe noise. Lines 9C and
100 sel up a random delay lo recreate the uneven nature of a
windstorm wllh lime lapses between howls The program selects a
I
f
(
5 5 4 4 3 3
115 5 6 6
4 4 3 3 2 2
2
5
1
i
RaNDom number that is used for the duration of another SOUND
command. This SOUND command stays at ihe same pilch and
provides a consistent background noise that serves as a counterpoint to This next program plays a song by reading a list ol DATA statements
the gusts of wind. This may seem pretty complicated, like you need to Your compute' READs the numbers contained in the DATA statement
be an experienced programmer to be able 10 do But it's really
li.
as values for variables (in this case X and Y), changing the values with
nothing more than experimenting, trying different things, and seeing each loop The DATA statements are in pairs. The first number Is the
note value for the SOUND command and the second number Is ihe
what noise comes out. Creating sound effects using noise is
challenging, trying to capture Ihe right elements of the sound you want duration for the SOUND command
exactly To be good al it. you have lo be willing lo experiment
Row Boat
90 LOOP UNTIL A = 32
100 VOL 0: COLOR 4, 2, 7 1
110 DATA 169, 262, 345. 383, 4S3, 516, 571, 596
1 1
1
Bfl ( !
\
THE GREAT COMMODORE 16 As you can see, music and sound can be used lo enhance programs or
be the focus of the program itself. The examples in this chapter just
MUSIC MACHINE give you a taste of the music capabilities of your Commodore 1 6 Don't
1 r be afraid to try new sounds and noises and create your own
The (asl program is a little longer. Tnis is the "GREAT COMMODORE masterpiece.
16 MUSIC MACHINE". When you press a key from 1 through 9, the
1 i
note is played, and a note appears on the start on the correct line.
By now, you've begun a handle on some ot the things you can
to get
1 r do with your Commodore 6. The aim of this manual has been to give
1
5 GOSUB 1000 you a taste ot computing, to have you try new things and see wnat
6F0RX = 1T0 9: READ N(X}: NEXT X 1 happens, to learnabout your computer and lo have fun In the process
8 CHAR 1. 8, 1,"*THE GREAT MUSIC MACHINE*" But there's still so much more programming, for example. This
, ,
10 VOL 7 1 r manual has touched on how lo begin lo use BASIC, but is nol a tutorial
20 DO ( 1 or BASIC lexlbook by any means. The BASIC Encyclopedia
30 GET A$: AS=
THEN 30 ,[
IF " 'no space (Immediately lollowlng this chapter) gives a complete listing of ALL the
1
35A = ASC(A$) IF A < 49 OR A > 57 THEN
: 50 BASIC commands on your Commodore 1 6. with explanations and
36N= A 48 - examples. In many of the programs in the last couple of chapters, you
1
(
40SOUNDi,N(N), 4 may not have understood exactly what steps were doing what. To
45 GSHAPE N$, 150, 8 <6+(9-N)), 4 learn more aooul programming with the BASIC language, you should
46 FOR Z=l TO 50: NEXT Z 1 1 read books lhal were written to leach BASIC A list of these books
47 GSHAPE N$, ISO, 8 ' (6+(9-N)). 4 appears in the appendix. It you are really interested in programming,
50 LOOP UNTIL A = 32 1
( you might want to gel the Series 264 Programmers Reference Guide,
55 VOL 0: GRAPHIC 0: SCNCLR whicn focuses on the hows and whys of programming, revealing the
60 END ( i
secret and not-so-secret tricks of the programming trade Now thai
100 DATA 345, 383. 4S3, 516, 571, 596, 643. 68S, 704 you've finished reading this manual, you mighl think that you're on your
1000 GRAPHIC 1,1 own, bul not entirely. You can read any o' the many computer
1
f
1010 FOR Y=60 TO 124 STEP 16 magazines, some of which are entirely devoted to Commodore
1020 DRAW 1, 100, Y TO 200, Y 1
computers, peripherals and software You can also become part of a
group of people near you who share your interest in Commodore
(
1030 NEXT Y
1040 AS="FEDCBAGFE" computers; a Commodore User's Group. For moie Information on these
1050 FOR X = l TO 9: C- 13 CBM
1
1110SSHAPENS, 1,1,8, 16
1120 GSHAPE N$, 1 1,4 (
1 [
1130 RETURN
1
(
i (
1
(
90 r
<
f
BASIC 3.5
(
ENCYCLOPEDIA
(
Introduction
Commands
I
Statements
I
Functions
(
<
I
I
I
f
I
i
92 [
ftt
EXAMPLE LOAD'program name",D0. U8
INTRODUCTION
.additional arguments
You've seen manual an assortment ot exercises using Ihe BASIC
in Ihis
keywords \ irgument
ar (possibly optional)
language, to give you a (eel tot computer programming and some ot
Ihe parts of the command or statement that you must type In exactly as
ihe vocabulary Involved. This encyclopedia gives a complete list ol the they appear are highlighted in a darker lype in Ihe format listing, while
rules and lerms (SYNTAX) of the BASIC 3.5 language, along with a
the name of the command is in capital letters. The words that you don't
concise description ot each Experiment with these commands, and
type in exactly, such as the name of a program, are printed in lighter
remember that you can't damage your Commodore 1 6 by typing in
italic type. When quote marks (" "> appear (usually around a program
programs, and that Ihe best way to learn computing Is by doing
or file name), you should include them in the command or statement,
like In Ihe format example
The encyclopedia provides formats and briet explanations and
examples ol Ihe BASIC 3 5 commands and statements. Is not It
The BASIC Encyclopedia is organized along the lines ot the tallowing Arguments are the parts of a command or statement that you select;
they complemenl keywords by providing specific information aboul the
• COMMANDS: the commands used lo work with programs, edit,
command or statement. For example, a keyword tells Ihe computer lo
store, and erase them. load a program, while an argument tells Ihe computer which specific
• STATEMENTS: the BASIC p*ogram statements used In numbered I
program lo load and e second argument specifies which drive the disk
programs.
lines ot containing the program is in Arguments Include filenames, variables,
• FUNCTIONS: the string numeric, and prim functions line numbers, etc.
• VARIABLES AND OPERATORS: the dllterent types of variables,
legal variable names, and arithmetic and logical operators.
• SQUARE BRACKETS [| show OPTIONAL arguments You select
A luiler explanation of BASIC 3.5 commands is provided in Ihe Series any or none ot the arguments iisted. depending on your requirements
264 Programmer's Reierence Guide, available from your Commodore
dealer or your local bookstore.
• ANGLE BRACKETS < > indicate that you MUST choose one of the
arguments
COMMAND AND STATEMENT FORMAT listed.
clear as possible. In most cases, there are several examples to choices are limited lo those arguments listed, and you can't use any
Illustrate whal the aclual command looks tike The following example
other arguments. When the vertical bar appears in a list enclosed in
shows some of the format conventions that are used In Ihe BASIC SQUARE BRACKETS, your choices are limited to the items in the list,
but you still have the option not lo use any arguments
commands and statements;
94
• ELLIPSIS . . , a sequence ol three dots, means lhal an option or BACKUP
argument can be repealed mote than once.
• VARIABLE refers to any valid BASIC variable name, such as X. A$. any information on the diskette onto which you're copying information
orT% So it you're backing up onto a previously used diskette, make sure it
NOTE: This command can only oe used with dual disk drive.
BASIC COMMANDS
AUTO I EXAMPLES:
AUTO [line*
f
BACKUP DO TO Dl Copies all files from the disk in drive
Turns on the automatic line numbering feature which eases the job of to tne disk in drive 1
entering programs by typing the line numbers for you. As you enter
each program line and press retubn the next line number is printed on BACKUP DO TO Dl ON U9 , Copies all files from drive C to drive
the screen, with the cursor In position to begin typing thai line. The
1 In disk drive unit 9
[line#J argument relers to the increment between line numbers. AUTO
with NO ARGUMENT turns oft auto line numbering, as does RUN This
slatement is executable only In direct mode
EXAMPLES
COLLECT
AUTO 10 automatically numbers line in increments o( ten
96 97
[ I
CONT
DELETE
CONT (Continue)
DELETE [first Hne#J |- iasl llne*|
lines of the program (or even (ust moved the cursor to a program line EXAMPLES:
and hit return without changing anything), the program slopped due
if
f
DELETE -30 Deletes all tines from the beginning ol the
COPY program up to and Including line 50.
COPY [Ddrive#,J "source file" TO [Ddrivejf ,) "other file" [,ON Uuntt#] DELETE 75- Deletes ail lines from 75 on to Ihe end of the
program
COPYs a file on the disk in one drive (the source file) to the disk in the
I
other on a dual disk drive only, or creaies a copy of a file on the same
drive (with a different file name).
[
EXAMPLES- DIRECTORY
I
renaming it NIGHT
f Displays a disk directory on the Commodore ^6 screen Use CTRL -S
COPY DO, "STUFF" TO Dl, "STUFF" Copies STUFF from lo pause Ihe display (any other key restarts the display after a pause)
drive to drive 1 (
Use me fr key Commodore key) to slow down. The
(Ihe II
"'.'/
f
BB
EXAMPLES The DLOAO command can be used within a BASIC program lo find and
RUN another program on disk. This is called chaining.
DIRECTORY List all files on the disk
DIRECTORY "AB*" Lists all files starting with the letters DSAVE filename" |,Ddrrve#] [,Uunrt#]
"AB", like ABOVE. ABOARD, etc.
This command stores a program on disk (Use SAVE to store
DIRECTORY DO, "FILE ?.BAK" The ? Is a wild-card that matches programs on tape.) You must supply a program name.
any single character in thai
position: FILE 1 .BAK, FILE 2.BAK.
FILE 3.BAK all match the siring. EXAMPLES
NOTE: To print out the OIRECTORY ot drive 0, unit 8, use the DSAVE (AJ) SAVEs to disk program whose name
following.
is In the variable AS.
LOAD"$0",8
r DSAVE "PROG 3", D0.U9 SAVES Ihe program "PROG 3" lo the
OPEN4,4:CMD4:UST
PRINT#4;CLOSE4 disk drive with a unit number of 9.
HEADER
DLOAD
HEADER "dtskname" ,Ddrlve# [,Iid #| |,ON Uunit#]
DLOAD "filename" [,Ddrive#| [,Uun«*|
Before you can use a new diskette for the firsl time you must format it
This command loads a program from disk into current memory. (Use with Ihe HEADER command. you want to erase an entire diskette for
If
LOAD to load programs on lape.) You must supply a program name. re-use you can use the HEADER command. This command divides the
disk Into sections calleo blocks, and it creates a table of contents,
called a directory or catalog, on the disk The d<skname can be any
EXAMPLES name up to 6 characters long The d. number is any 2 characters.
1 i
100 101
! 'I
HEADER "THEBALL", US, Dl, US 10 FOR I - 1T0 8: KEY I, defines the function keys as
I ( CHR$(I+132):NEXT they are defined on the
Commodore 64 and VIC 20
) I
HELP I To resfore all function keys to Iheir default values, reset your
Commodore 1 6 by turning it off and on, or press the RESET bulton,
I I
HELP
The HELP command Is used after you gel an error in your program.
When you type HELP, the line where Ihe error occured is listed, with LIST
me portion containing the error displayed in Mashing characters.
LIST [first line) I
-[last tine]]
The LIST command lets you look al lines of a BASIC program that have
KEY been typed or LOADed into the Commodore 1 6's memory. When LIST
is used alone (without any numbers following it), you get a complete
LISTlng of the program on your screen, which may be slowed down by
KEY |key#. string) holding down ihe &
key, paused by CTKL -S (unpaused by pressing
I I
( any other key), or STOPped by pressing the mm/no* key. you II
There are eight Keys availaDle follow Ihe word LIST with a line number, your Commodore 1 6 only
(8) function to Ihe user on your
Commodore 16 compuler tour unshitted and lour shifted Your I
'
I shows that line number If you type LIST wilh iwo numbers separated
Commodore 16 allows you to define what each key does when by a dash, the Commodore 1 8 shows all lines from the first to the
pressed. KEY without any parameter specified gives a listing displaying I second line number. you type LIST followed by a number and just a
If
all the current KEY assignments: The data you assign to a key is typed dash, ilshows all the lines from that number lo the end of the program
out when that lunction key is pressed. The maximum length tor all the I
I
And if you type LIST, a dash, and then a number, you get all the lines
definitions together is 1 28 characters. Entire commands or a series of from the beginning ol the program to that line number Using these
commands) can be assigned to a key. For example: variations, you can examine any portion of a program, or easily bring
I I
lines lo the screen for modification.
EXAMPLES.
causes the compuler lo select lexl mode and list your program I
whenever Ihe 'F7' key is depressed (in direct mode). The CHR5(1 3) is LIST Shows entire program
the ASCII character for ktuwi Use CHR$<34) to incorporate a I
double quote into a KEY string. LIST I0Q- Shows from line 100 until the end of me program.
I .
1
I .
I
102 I
[ 103
LIST 10 Shows onfy line 10.
i
to LOAD from the point where It was SAVEd. The delaull value of the
i
LOAD ["filename" (.device*] [.relocate flag) ] relocate Hag is 0. This is generally used only when loading machine
i
language programs.
This the command to use when you want to use a program stored
Is on
cassette tape or on disk. It you type just LOAD and hit the hetorn i
key, the Commodore 16 scieen goes blank. Press play, and the
Commodore 1 6 starls looking for a program on the tape When llnds It
one. the Commodore 1 6 prints FOUND "lliename" You can hit the
i
NEW
C" key to LOAD; rf you don't press Ihe key, the compuier resumes
i
searching on the tape after a brief interval. Once the program is
LOADed, you can RUN. LIST, or change D
NEW
i
This command erases the entire program in memory and clears out any
variables that may have been used Unless the program was stored
You can also type the word LOAD followed by a program name, which i
somewhere. It 'S lost uniil you type il in again. Be careful when you use
Is most often a name In quoles("program name"). The name may be
followed by a comma (outside of Ihe quotes) and a number (or numeric
tnis command
i
variable), which acts as a device number to determine where Ihe The NEW command can also be used as a statement m a BASIC
program is stored (disk or tape) tt there is no number given, your program. When your Commodore 16 gels to this line, the program Is
[
computer assumes device number 1 which is the cassette tape
, erased and everything stops. This is not especially useful under normal
recorder. circumstances
The other device commonly used w<m the LOAD command Is usually I
1CM i
105
(
EXAMPLES:
RENUMBER I
I
The increment is the spacing belween line numbers, e. 10, 20, 30
it also defaults to 1 0,
I etc.
SAVE
I
location, so be careful with your tapes If you type the SAVE command
I
I
EXAMPLES
I
Once a program has been typed Into memory or LOADed, the RUN SAVE AS Stores on tape with name m variable AS
I
program.
f
Oh 107
.
EXAMPLE:
SCRATCH "file name" |.D drive #][.U unit #|
EXAMPLE: checks.
I
disk m drive 1
BASIC STATEMENTS
(
I
BOX
don't match (which you already knew) Now the tape is where you EXAMPLES
want it, and you can store the next program without fear of erasing an I
I
old one.
BOX 1, 10, 10, 60, 60 Draws Ihe outline of a rectangle
I
(
1
08 I ( 109
BOX , 10, JO, 60, 60, 45, 1 Draws a filled, rolaled box (a T . Starting arc angle (default 0)
diamond) Ending arc angle (detault 360)
angle .Rotation in clockwise degrees
BOX , 30, 90, . 45, 1 Draws a tilled, rotated polygon I (default is degrees)
•nc Degrees between segments
2 degrees)
(default is
CHAR
CHAR [colour source fLx.y. string' [.reverse flag)
!
colour source Colour source (0 - 3)
A i * • * i
* Character column {0 - 39)
y Character row (0 - 24) f
"slnng" , , i ,
Text to be printed
reverse. Reverse fiold flag (0 = off, 1 » on) [
With the CIRCLE command you can draw a circle, ellipse, arc, triangle
Text (alphanumeric strings) can be displayed on any screen at a given or an octagon The final coordinate Is on the circumference ot the
location by the CHAR command. Character data is read from the
I
circle at the ending arc angle. Any rotation is about the centre. Arcs
Commodore 1 6 character ROM area. You supply the x and y are drawn Irom the starling angle clockwise lo the ending angle The
I
coordinates of the starting position and the text string you want to segmeni Increment controls the coarseness of the shape, with lower
display. Colour source and reverse imaging are optional values for inc creating rounder shapes.
(
The string is continued on the next line If it attempts to print past the EXAMPLES
I
right edge of me screen. When used In TEXT mode, the string printed
by the CHAR command works just like a PRINT string, including
i
reverse field, cursors, flash on/off, efc. These control functions inside
Ihe string do not work when the CHAR command Is used to display text CIRCLE, 160,100.65,10 Draws an ellipse.
in GRAPHIC mode. CIRCLE, 160.1Q0,6S,50 Draws an oval.
CIRCLE ,60,40,20,18,, ,.45 Draws an octagon
CIRCLE, 260,40,20,,, „90 Draws a diamond
CIRCLE , 60,140,20,18,,,, 120 Draws a triangle.
CIRCLE
i
CS . Colour source (0 - 3)
a.b Centre coordinate (scaled)
(defaults to the Pixel Cursor |PC])
xr X radius (scaled) i
110
111
I
I I
i
i
N umber Sourca
background
CLR i 1 foreground
i
2 multicolour 1
CI.R 3 multicolour 2
i I
4 border
This command erases any variables In memory, but leaves Ihe program
I
ilseif intact. This command ib automatically executed when a RUN or I
NEW command is given, or when any editing Is performed Colours you can use are in the range 1 - 16 (t is Wack, 2 is white, 9 is
i
'
orange, etc. from your keyboard colour keys) As an option, you can
Include the luminance level 0-7, with being lowest and 7 being
i '
highest. Luminance defaults to 7 Luminance lets you select from eight
levels of brightness for any colour except black.
CMD
'
I
CMD sends the output which normally would go to the screen (I.e.
PRINT statement, LISTS, but not POKEs into the screen) (o another i '
toilowed by a number or numeric variable referring to the (lie. DATA list of constants separated by commas
'
(
CMD1 AH normal output now goes to the printer two commas have nothing between them, the value will be READ as a
zero for a number, or an empty string The DATA statement must be
i
'
UST The USTing goes to the pnnter, not the screen part of a program, otherwise it will not be recognized. Also see the
even the word READY. RESTORE statment. which allows your Commodore 16 lo reread data
i I
'
112
i
113
(
EXAMPLE: DIM
(
DATA 100, 200, FRED, "WILMA", , 3. 14. ABC123 i DIM variable (subscripts) [ variable* subset ipts))
(
Betore you can use an array of variables, the program must ftrsl
execute a DIM statement to establish the DIMensions of that array
(unless there are 1 1 or fewer elements in the array). The statement DtM
i
DEF FN isfollowed by the name of trie array, whicn, may be any legal variable
name. Then, enclosed In parentheses, you put the number (or numeric
variable) of elements In each dimension An array with more lhan one
i
DEF FN name (variable) - expression dimension is called a malnx You may use any number of dimensions,
!
but keep tn mind that the whole list of variables you are creating takes
up space In memory, and Is easy lo run out of memory you gel
it if
This command allows you lo define a complex calculation as a lunclion
I carried away. To figure the number of variables created with each DIM.
In the case of a long formula thai is used several times within
i
The name you give the numeric function begins with the letters FN, I I
followed by any lega' numeric variable name. First you must define the NOTE: Integer (single-digit) arrays take up 2/5ths of Ihe space of
function by using the statement DEF followed by the name you've given floating point arrays
I !
the function Following trie name Is a set ol parentheses with a
(J
numeric variable (in this case. X) enclosed. Then you have an equal
I I
sign, followed by the formula you want
to define. You can "call" the
formula, substituting any number for X. using the format shown in line EXAMPLE
I
20 of the example below: I
10 DIM AS(40).B705).CC%<4.4,4)
( 1
10DEFFNA(X)=12'(34.75-XA3)+X You can dimension more than one array In a DIM statement by
I
I
separating the arrays by commas. It the program executes a DIM
20 PRINT FNA(7) statement for any array more lhan once, you'll get a re'DIMed array
The number 7 is inserted each I
I !
114 (
I 115
I
'(
(
LOOP[UNTIL booiean argumeni WHILE boolean argument] END
f
(An example of a boolean argumeni Is A=l or H>-57
END
Performs the siatemenis between ihe DO statement and the LOOP I (
statement. If no UNTIL or WHILE modifies either the DO or the LOOP When the program executes an END statement, the program stops
statement, execution of the intervening statements continues I RUNnlng Immediately. You may use the CONT command to re-start
Indefinitely. If an EXIT statement is encountered io the body of END
a DO the program at Ihe statement following the statemenL
loop, execution is transferred to the first statement lollowing the LOOP
f
Itthe UNTIL parameter is used. Ihe program continues looping until the ( ( FOR . . . TO . . . STEP
boolean argument is satisfied (becomes TRUE). The WHILE parameter
Isbasically the opposite of the UNTIL parameter; the program continues
looping as long as the boolean argument is TRUE. FOR variable = start value TO end value (STEP increment]
I I
This statemenl works with the NEXT
statement to set up a section of
EXAMPLE: number of times. You may Just want
the program that repeals for a set
I
I your computer to count up to a large number so the program pauses for
DOUNTTLX-0ORX-1 a few seconds, in case you need something counted, or something
I < must be done a certain number o' times (such as printing).
LOOP
DO WHILE A$="":GET A$:LOOP I (
The loop variable is the variable that is added to or subtracted from
during the FOR/NEXT loop. The start value and the end value are the
I ( beginning and ending counts tor the loop variable.
DRAW I (
The logic ol Ihe FOR statemenl is as loiiows First, the loop variable Is
set to tne start value. When the program reaches a line with the
I f
DRAW (colour source *\ [, al. b1][,TOa2, b2.][ .] command NEXT, it adds tne STEP increment (default 1 ) to the value
of the loop variable and checks to see If Is higher than the end of loop
It
With this command you can draw Individual dots, lines, and shapes.
( I
value. If It not higher, the next line executed is the statement
is
You supply colour source (0-3). starting (al , b1 ) and ending poinls (a2. immediately following the FOR statement. If the loop variable is larger
b2). I ( than the end of loop number, then Ihe next statement executed Is the
one following the NEXT statement A STEP value can be positive or
( ( negative. See also the NEXT statement.
EXAMPLES:
a dot DRAW 1. 100, 50 — no endpolnt specified, defaults to I
(
EXAMPLE'
a1 ,b1 value tor a2.b2 to create a dot
lines: DRAW 10.10, TO 100,60
. I
. f 10 FOR L - 1 TO 20
DRAW TO 25,30 20 PRINT L
a shape: DRAW 10,10 TO 10.60 TO
, 100,60 TO 10,10 ( ( 30 NEXT L
40 PRINT "BLACKJACK! L - "I
I .
f
116 (
f 117
.
f 'I
I (
This program prints Ihe numbers from one lo twenty on Ihe screen,
lollowed by Ihe message BLACKJACK! L
The word GET Is followed by a variable name, usually a string variable,
21
: I tfa numeric were used and any key other than a number was hit, the
program would stop with an error message. The GET statement may
The end of loop value may be lollowed by (he word STEP and another i r also be put into a loop, checking for an empty result, which waits for a
number or variable In this case, Ihe value following ihe STEP is added key lo be struck to continue. The GETKEY statement could also be
each lime instead ol one. This allows you lo count backwards, by i i
used in this case. This command can only be executed within a
fractions, or any way necessary. program.
i i
You can setup loops inside one another. This Is known as nesting EXAMPLE.
loops. You must be careful to nest loops so that the last loop to start is i i
10 FOR L = 1 TO 100 i
EXAMPLE:
i i
10 GETKEY AS This line waits tor a key to be
GET i i
struck. Typing any key will
continue the program
The GET statement is a way to get data from the Keyboard one i
i
character at a time When the GET Is executed, the character that was
typed Is received If no character was typed, 'hen a null (empty) i
i
character is returned, and the program continues without waning for a GET
key There is no need to press tne return key. and m fact the i
t
hetuum key can be received with a GET
GET* file number, variable list
I . !
118 I ( 111
1
Used with a previously QPENed device or file to input one character at in direct mode. GOTO line # allows you to start execution of the
a lime. Otherwise, it works like the GET statement program at the given line number witnout clearing the variables
EXAMPLE:
EXAMPLE: (
10 PRINT "REPETITION IS THE MOTHER OF LEARNING"
GET*1,A$ 20 GOTO 10
I
GOSUB f
GOSUB line #
This statement is like the GOTO statement, except that your r GRAPHIC
Commodore 6 remembers where
1 It came
a with a
from When line
RETURN statement is encountered, the program Jumps back to the .
i
statement immediately following the GOSUB The target of a GOSUB GRAPHIC mode [.clear option]
statement is called a subroutine A subroutine is useful it there is a i
routine In your program that can be used by several different portions of This statement puts your Commodore 16 in one of lis 5 graphic modes
the program Instead of duplicating the section of program over and 1
over, you can set it up as a subroutine, and GOSUB to it from the mode description
different parts of the program See also the RETURN statement. normal text
(
1 high-resolution graphics
2 high-resolution graphics, spilt screen
EXAMPLE f 3 multicolour graphics
EXAMPLES:
GOTO or GO TO (
GRAPHIC 1,1 Selects hhres graphic mode and clears the screen.
GOTO line #
i
GRAPHIC 4,0 Selects multi-colour graphics with an area lor text,
without clearing the screen
After a GOTO statement is executed, the next line to be executed wiil
be the one with the line number following the word GOTO. When used
i
120 121
EXAMPLE
GRAPHIC CLR
i
50 IF X>0 THEN PRINT"OK": Checks the value ol X. II X Is
This is actually a lorm of the GRAPHIC statement; instead of specifying isn't. IfX is not greater than 0.
a mode to use graphics, this statement clears the 10* of memory [ ( the ELSE clause is executed and
allocated to the graphic area, and that memory space becomes the THEN clause Isn't.
( (
IF . . . THEN . . :ELSE [
I
I
I
INPUT
IF expression THEN then-clause [:ELSE else-clause]
IF THEN lets the computer analyze a BASIC expression preceded [ ( INPUT ["prompt string".] variable list
directly to the next line, unless an ELSE clause is present. The The program stops, prints a Question mark (?) on the screen, and wails
I
expression being evaluated may be a variable or formula. In which case for the person to type Hie answer and press the BETUHN key
It is considered true if nonzero, and false if zero. In most cases, there Is
AND. OR. NOT). The word INPUT is followed by a variable name or list of variable
I names separated by commas. There may be a message Inside
quotes before the list of variables lo be input. If this message (called a
The ELSE clause. present, must be In
It the same line as the IF-THEN prompt) is present, there must be a semicolon (,) after the closing quote
I
pan When an ELSE clause is present. It is executed when the THEN of the prompt. When more than one variable is to be INPUT. Ihey
clause isn't executed. In other words, the ELSE clause executes when should be separated by commas when typed In If not. the computer
I I
the IF expression is FALSE asks for the remaining values by printing two question marks {??) II
yoj press the BETurn key witnout INPUTting values, the INPUT
I I variables retain the values previously held for those variables This
1^1 statement can only be executed within a program.
! I
1
OK EXAMPLE:
I
No \ End I
20 INPUT "AND YOUR FAVORITE COLOR"; B$
30 INPUT "WHAT'S THE AIR SPEED OF A SWALLOW";A
: I
I (
122 [ f 123
'
i '
INPUT LOCATE
i r
This works tike INPUT, but lakes (he data from a previously OPENed The LOCATE command lets you put the pixel cursor (PC) anywhere on
file or device. No prompt string is allowed This command can only be
(
the screen. The PC is the current location of the starting point ot the
used in program mode next drawing. Unlike the regular cursor, you can't see the PC. but you
t I
can move II with the LOCATE command. For example.
EXAMPLE:
I
INPUTS, AS, C, D$
positions the PC In the centre of the high resolution screen You won't
' see anything until you actually draw something. You can find out
i
where the PC Is at any time by using the RDOT(0) function to get the X-
coordinate and RDOT(l to get the Y-coordlnate. The colour source of
)
I the dot at the PC can be found by PRINTing PDOT(2). (In all drawing
LET commands where a colour option Is available, you may select a value
I from to 3. corresponding to Ihe background, foreground, multicolour
1 or multicolour 2 as the colour source.)
[LET) variable - expression
,
left side of the equal sign, and the number or formula is on the right
MONITOR
side. !
This command takes you out of BASIC Into the built-in machine
f r language monitor program The monitor is used to develop, debug,
EXAMPLE:
and execute machine language programs more easily than from BASIC.
( See the section on monitor commands for more Information (When In
10 LET A= 5 the monitor, typing an 'X' and pressing arrufiN gets you back to
I i BASIC.)
20 B= 6 LET is implied (but not necessary)
in lines 20, 30 and 40. I
30 C » A • B + 3
- "HELLO-
i
NEXT
40 DJ
! I
I I
124
I
f 125
.
The NEXT slalemeni Is used with ihe FOR statement. When the EXAMPLE:
computer encouniers a NEXT statement, goes back to the it
corresponding FOR statement and checks the loop variable (See FOR
statement tor more detail.) It the loop is finished, execution proceeds 10 INPUT X:IF X<0 THEN 10 When X = 1 . ON
with the statement after the NEXT statement. The word NEXT may be 20 ON X GOTO 50, 30, 30, 70 sends control to the
followed by a variable name, a list ot variable names separated by 25 PRINT "FELL THROUGH":GOTO 10 lirsl line number in the
commas, or no variable names. It there are no names listed, the last 30 PRINT "TOO HIGH":GOTO 10 lisl (50) When X - 2.
loop started is me one being completed H the variables are given, they 50 PRINT'TOO LOW'rGOTO 10 ON sends control to
are completed In order trom left to right l ;
70 END the second line (30),
etc.
f
EXAMPLE:
10 FOR L «
1 TO 10:NEXT
20 FOH L <
1 TO 10:NEXT L OPEN
30 FOR L 1 TO 10:FOR M = 1 TO 10: NEXT M, L
I
OPEN Me [.device # (.secondary address f.
"filename, type, mode"]|l
f
The OPEN statement allows your Commodore 16 lo access devices
such as the Datassette recorder and disk for data, a primer or even the
f ! monitor screen The word OPEN is followed by a logical file number,
ON which is the number to which all other BASIC statements will refer This
I number is from 1 to 255. There is normally a second number after the
first called Ihe device number Device number is the Commodore 16
ON expression <GOTO/GOSUB> line #1 [. line #2,
I
keyboard. 3 is Ihe screen, 1 is the Datassette recorder (default), 4 is the
printer. 8 is usually the disk. A *ero (0) may be included in tront of the
device number digit (e g 08 to* 8. which are interchangeable as far as
This command can make GOTO and GOSUB statements mlo
the I
,
an ILLEGAL QUANTITY ERROR results Reference Manual or the manual lor each specific device for more
I
(
information on secondary addresses There may also be a string
following the third number, which could be a command to the disk
I I
drive or the name ol the file on tape or disk. The type and mode refer
i r
^26 127
to disk dies only. (File types are prg.seq, rel, and usr; modes are mode. .0 = paint an area detmed by the colour source
read and write.) f selected
1 - paint an area defined by any non-background
f source
EXAMPLES:
l The PAINT command lets an area with colour It tills m the area
you fill
10 OPEN 3,3 OPENS the SCREEN as around the specified point until a boundary ot the same colour (or any
device. non-background colour, depending on which mode you have chosen) Is
encountered The final position of the PC will be at the starting point
10 OPEN 1,0 OPENs the keyboard as f <a b).
(
device.
I
NOTE: the starting point is already the colour ot colour source you
If
tor writing.
POKE
r !
See also CLOSE, CMD, GET.*, INPUT*, and PRINT* statements, POKE address, value
system variable ST, DS, and DS$. I
I
used to control anything on the screen, from placing a character at that
location to changing the colour there.
Colour source (0-3); (default is foreground colour)
l ,
EXAMPLE:
f '
f
10 POKE 16000,8 Sets location 16000 to 8
12B 129
20 POKE 16*1000,27 Jelt. ocation I6000to27 PRINT
Nole; PEEK, a function related lo POKE, ts listed under FUNCTIONS.
PRINT* file*, print list
There are a few differences between this statement and the PRINT.
First of Ihe
all. word PRINT#
followed by a number, which rotors to
is
PRINT
the device or data file previously OPENed. The number is followed by
r a comma, and a list of things to be PRINTed. The semicolon acts In the
PRINT printilst same manner for does in the PRINT staiemenl The
spacing as it
The PRINT statement is the major output statement In BASIC. While separator for disk files (see the Programmer's Reference Guide and ihe
the PRINT statement is the lirst BASIC statement most people learn to Disk Drive Manuai). Some devices may not work with TAB and SPC.
use. there are many subtleties lo be mastered nere as well. The word
PRINT can be followed by any combinations ol Ihese items, which is
considered the phntlist EXAMPLE
PRINT USING
Tne characters inside ol quotes are often called
because they
literals
are printed exactly as they appear. Variable names have the value they
PRINT i^filenumber.] USING formal list, prml list
contain (either a number or a string) pnnted Functions also nave their
number values primed. Punctuation marks are used lo help format the
These statements let you define the format of string and numeric Items
data neatly on the screen The comma divides the screen into 4
you want to print to the screen, pnnter, or another device. Put the
columns for data, while the semicolon doesn't add any spaces. Either
format you want in quotes This is the format list. Then add a
mark can be used as the last symbol in the statement. This results in
semicolon ana a list of what you want printed in the format lor the print
the next PRINT statement acting as if is continuing the last PRINT
list The list can be variables or the actual values you want printed. For
it
statement.
example:
130 131
[
Line 20 prints this: ifyou use a minus sign and the number is positive, a blank is printed in
I the character position indicated by the minus sign
CBM CAT leaves three spaces before printing "CBM" as
defined in format list If you don't use either a plus or minus sign In your formal field for a
I
numeric data Item, a minus sign is printed before the first digit or dollar
CHARACTER NUMERIC STRING I
symbol if the number is negative and no sign is printed If the number Is
positive. This means that you can print one character more If Ihe
Hasn Sign (#) X X
Plus(+)
number is positive. II (here are too many digits to fit into the field
X + an overflow occurs and the
specified by the # and / - signs, then field
Minus {-) X is filled with asterisks (•).
Decimal Point f.) X f
Comma (.) X
Dollar Sign ($) X A decimal pointsymbol designates the position of the decimal point
f
)
[
Four Carets (TTTt) X in the number You can only have one decimal point in any format
Equal Sign (*=) X field. If you don't specify a decimal point In your format field, the value
I
Greater Than Sign <>) X is rounded to the nearest integer and primed without any decimal
places.
f
The hash sign (0) reserves room lor a single cha.'acter In the output
field. the data item contains more characters lhan you have
If in your I
When you specify a decimal point, the number of digits preceding Ihe
format field, the following occurs: decimal point (including the minus sign, if the value is negative) must
nol exceed Ihe number of * before Ihe decimal point. If there are too
f
many digits an overflow occurs and the field is filled with asterisks {*).
For a numeric Hem. the entire field is filled with asterisks <). No f
numbers are printed.
A comma (,) lets you place commas in numeric fields. The position of
Ihe comma in Ihe format lisl indicates where me comma appears In a
r
printed number Only commas within a number are printed. Unused
For example:
commas !o the left of the first digit appear as the filter character. At
[
least one must precede the first comma in a field.
10 PRINT USING "0000")%
I
For these values for X, this format displays: If you specify commas in a field and the number is negative, then a
minus sign is printed as the firs! character even if Ihe character position
A -12.34 12 i
is specified as a comma.
A = 567.89 568 i
EXAMPLES:
A -123456 ••**
f FIELD EXPRESSION RESULT COMMENT
For a STRING item, the string data Is truncated at the bounds ol the ##.# + -.01 0.01- Leading zero added.
field. Only as many characters are printed as there are hash signs (#) in f
00.0 1.0
1 Trailing zero added.
the format item. Truncation occurs on the right
0000 -100.5 -101 Rounded to no decimal
places.
The plus f +) and minus
(-) signs can be used in either the first or last 0000 -1000 Overflow because four digits
position of a format field but nol boih. The plus sign is printed if the i and minus sign cannol fil in
number is positive. The minus sign is printed If the number is negative. field.
132 i
133
##*. 10 1 Decimal point added. PUDEF lets you redefine up to 4 symbols in the PRINT USING
#%#* 1 SI Leadings sign statement. You can change blanks, commas, decimals points, and
dollar signs into some other character by placing Ihe new character In
A symbol shows that a dollar sign will be printed m Ihe
dollar sign (S) the correct position in the PUDEF control string.
number you wani
If the dollar sign to float (always be placed before trie
number), you mus! specify at least one # before Ihe dollar sign If you
Position 1 is the filler character. The default is a blank Place a new
specify a dollar sign without a leading 0, the dollar sign is printed in the
character here when you want another character lo appear in place of
position shown in the format fietd.
blanks.
If you specify commas and/or a plus or minus sign in a format field with
a ooilar sign, your program prints a comma or sign before the dollar Position 2 is Ihe comma character. Default is a comma
Position 3 is the decimal point
The lour up arrows or carels (tnt) symbol Is used to specify mat the Position A is the dollar sign.
number is to be printed In E + format. You must use # >n addition to
the Iff T to specify the field width. The TTT1 must appear after the # in
the format field
EXAMPLES
A greater than sign ( > ) is used to right justify a string in a field. You READ variable list
.VI
I
135
REM Usea to return to execution after TRAPping an error. With no
arguments. RESUME attempts lo re-execute the line in which Ihe error
occurred. RESUME NEXT resumes execution at Ihe next slatement
REM message following the slatement containing the error; RESUME line will GOTO
the specific Ime and begin execution the/e.
The REMark a nolo (o whoever Is reading a LIST ol Ihe program
is jus!
ll may explain a section of Ihe program, give informalion aboul Ihe
aulhor, elc.REM stalemenls In no way effort Ihe operation of Ihe
program, except to add to ils length (and therefore slow il down) The
word REM may be followed by any text, although use of graphic
characters gives strange results.
RETURN
RETURN
EXAMPLE
This statementis always used with the GOSUB statement Whan Ihe
10 NEXT X: REM THIS LINE IS UNNECESSARY program encounters a RETURN statement, goes to trie statement
II
RESTORE
RESTORE [line #]
SCALE
When executed in a program, the pointer to Ihe item in a DATA
slatement which ts lo be read next is reset to the first ItBm in the Irst SCALE <l/0>
This gives you the ability to re-READ the information II a pine #]
follows the RESTORE statement, the pointer is sat to that line
The scaling of Ihe bit maps in multicolour and high resolution modes
Otherwise the pointer Isreset lo the first DATA statement In Ihe
can be changed with Ihe SCALE command. Entering:
program.
EXAMPLE: SCALE 1
RESTORE 200 turns scaling on. Coordinates may then be scaled from lo 1 023 In
both X and Y rather than the normal scale values, which are.
136 137
SCNCLR SSHAPE/GSHAPE
I
SCNCLH SSHAPE and GSHAPE are used to save and restore rectangular areas
of multicolour or high resolution screens using BASIC string variables.
Clears the current screen, whether graphics, text, or both (split screen). The command lo save an area Is;
This statement produces a SOUND using one at three voices with a Because BASIC limits siring lengths to 255 characters, the size of the
frequency control in the range 0-1023 lor a duration ot - 65535 60ths area you may save is limited. The string size required can be
oi a second calculatea using one of (he following (unsealed) formulas:
Voice
L<mcm) - INT( (ABS(a1-a2) + 1) I 4 + 99) • <ABS(b1-b2> + 1) + 4
2 Voice 2 (tone)
3 Voice 2 (white noise) (mem) refers lo multi-colour mode; (h-r) Is high tesolulion
same N is still playing. BASIC watts for the previous SOUND lo contain the column and row lengths less one (I.e.: A8S (a1-a2) ) in low/
oomplete. SOUND with a duration of is a special case. causes It high byte format (if scaled divide the lengths by 3.2 (X) and 5.1 2 (Y) ).
BASIC to turn oft the current SOUND for that voice immediately,
regardless of the time remaining on the previous SOUND See the The command lo display a saved shape on any area of the screen
MUSIC NOTE TABLE In the appendix for the frequency control values
that correspond to real notes
GSHAPE string variable name [. la.b] [.mode] J
138 (
139
EXAMPLES:
TRAP
SSHAPE "VARIABLES", 0, Saves screen area from me upper
left corner lo where me cursor is
TRAP (lineal
positioned under me name
VARIABLES. When turned on TRAP intercepts all error conditions (including Ihe
ntm/STOP key) except "UNDEF'D STATEMENT ERROR" Intneeveni
GSHAPE "VARIABLES".,,! of any execution error, tne error flag is set, and execution is transferred
DisplaysVARIABLES shape with
background and foreground colours lo the line number named in the TRAP statement. The line number in
reversed, with me loo left ol me which Ihe error occurred can be tound by using me system variable EL.
snope positioned at the cursor The specific error condition is contained In system variable ER. The
string function ERRSfER) gives the error message corresponding to any
error condition ER,
TRON
mode When you are in trace mode, as each statement executes, the
line number of Ihat stalement is printed
SYS
SYS address
140 141
VOL LOCATE +100,-23 moves the PC right 1 00 pixels and up
25
VOL volume level
DRA Wl + 10, + 10TO100, 100
,
draws a line 1 pixels right and 1
pixels below Ihe current value of Ihe
Seis Ibe current VOLume level (or SOUND commands. VOLume may PC to the absolute point 100.100
be set from to 8, where 8 is maximum volume, and is off. VOL
affeels both voices
I
You can also specify a distance and and angle relative to the current
PC by separating the two parameters by a semicolon
f
For example:
WAIT (
LOCATE 50;45 moves the PC from its current location
by a distance of 50 dots at an angle of
WAIT address, value 1 (. value 2]
I ( 45 degrees.
The WAIT statement is used to halt the program until the contents ol a I
The content of the memory location is first exclusive-ORed with value 2 Numeric Functions
(if and Ihen logically ANDed with value 1
present), the result is zero,
It
the program checks the memory location again When the result is not I
Numeric functions are classified as such because Ihey return numbers.
zero, the program continues with the next statement. The functions they perform range from calculating matnematical
! functions lo specifying a screen location Numeric functions follow the
form.
f
There are a few concepts that apply to ail ol the bit map graphics where the argument can be a numerical value, variable, or string
I
142 143
INSTB string 2 [.starting-position])
ATN(X) (arclangeni) (string 1 .
EXAMPLE:
I
COS(X) (cosine)
Returns decimal value of hexadecimal-string (0< nexadeclmal- Returns Ihe integer portion of X. with all decimal places to the right of
slrlng<FFFF)
I
the decimal pc-nl removed. The result is always tess-than or equal to
X, Thus, any negative numbers with decimal places become
the
EXAMPLE:
Integer icss-than their current value (e.g. INT(-4.5)--5)
I
N=DEC("F4")
f
If the INT function Is to be used lor rounding off, Ihe form is INT(X + .5)
or INT(X - .5).
EXAMPLE;
EXP(X)
JOY <n)
(
FNxx(x)
When n - 1 Position of joystick #1
n 2.. - Position ofioystick #2
a DEF FNxx
-
Returns Ihe value ol Ihe user-delined lunction xx created In
statement
Any value of 1 28 or more means Ihe fire button is also depressed. The
-
144 I «S
r
UP N-OtorXPOS
fire= 128 + I for YPOS
1
8 2 colour source
LEFT 7 3 RIGHT
6
5
DOWN RGB(X)
EXAMPLE: (
[ I RLUM(N)
LOG(X) (logarithm)
This returns the natural log of X The natural log is log to the base e
(see EXP(X)J To convert to log base 0, divide by LOGO 0).
1
I
I RND(X) (random number)
PEEK(X) Thi6 function returns a random number between and 1 This is useful .
1 ,11
in games, to simulate dice roils and other elements of chance, and is
This (unction gives tne contents ol memory location X, where X is also used ir some statistical applications. The first random number
I I
located in the range ol should be generated by the formula RND(-TI), to stan things off
to 65535, returning a result from to 255. This
differently every time. After this, the number In X should be a 1 or any
is often used in conjunction with the POKE statement.
.
I
I
positive number. (X represents the seed, or what the RaNDom number
is based on If X is zero. RND is re-seeded from the hardware clock
)
I
i
every time RND is used. A negative value lor X seeds the random
number generator using X and gives a random number sequence. The
RCLR(N) [ ( use o' the same negative number for X as a seed results in the same
sequence of random numbers. A positive value gives random numbers
Returns current colour assigned to source N (0 =< N=< 4) I I
based on the previous seed.
(0-background, -foreground. 2=multicolour
1 1, 3=multicolout 2.
4= border)
1
I
To simulate the rolling of a die, use the formula INT(RND<1 J*6+l ). First
the random number from 0-1 Is multiplied by 6. which expands the
1 1 range lo 0-6 (actually, grealer than zero and less then six) Then 1 is
added, making the range 1 to under 7 The INT function chops off all
Returns Information about the current position of the pixel cursor (PC) at
1 1
To simulate 2 dice, add two of the numbers oblained by the above
XPOS/YPOS. lormula together
i r
i
46 i i
1 47
f
EXAMPLE. USR(X)
'
100X=lNT(RND(l)-6)+INT(RND(l)*6)+2 Simuiales 2 dice. When used, the program lumps to a machine language
this function is
program whose starting point is contained in memory locations 1281
I
VAL<XS)
I
SW<X) {sine) most character lo Ihe right, tor as many characters as are In recognizable
f number format. If the Commodore 16 lirvds illegal characters, only the
portion ol the siring up to that point Is converted
This Is the trigonometric sine tunction. The result is the sine of X.
10X«VAL("123.4S6") X-123.456
SQR(X) (square root)
10X=VAL("3E03") X=3000
This function returns the square root of X, where X is a positive
number or It X is negalive. an ILLEGAL QUANTITY ERROR results.
10X*VAL{"12A13B") X-12
TAN(X) (tangent)
10X-VALT-1.23.23.23") X— 1 .23
US 149
String Functions MIDS(X$,N,X)
I
EXAMPLE
ERR$(N) I
Returns string describing error condifion N (see TRAP) I 10 A$-"THE LAST GOODBYE":
20 PRINT AS
f
30 MIDS(AJ,6,3>="ONG"
40 PRINT AS
HEXJ(N)
STR${X)
LEN(X$)
This returns a string which is identical to the PRINTed version of XS.
Returns the number of characters (including spaces and other symbols) EXAMPLE
in tne siring X$
AS=STR$(X)
1
50 15i
i
Other Functions Normal NUMERIC VARIABLES, also called floating point variables.
can have any value Irom 30 to * M with up to nine digits of accuracy.
,
i
When a number becomes larger than nine digits can show, as In
FRF. (X) 10' ,0 or 10 *'° your computer displays In scientific notation form,
It
,
l
wilh the number normalized to 1 digit and eighl decimal places,
This function returns the number ot unused bytes available in memory, followed by the letter E and the power ot ten by which the number is
X is a Gummy argument. multiplied. For example, the number 1 2345678901 is displayed as
1.234356789E + 10.
POS (X) INTEGER VARIABLES can be used when the number Is trom +32767
to -32768, and with no fractional portion An integer variable is a
number of the column (0-39) where the next
This function returns the number like 5, 10, or -100. Integers take up less space than floating
l
PRINT staiement begins on the screen X Is a dummy argument. po«nt variables when used in an array.
STRING VARIABLES are those used for character data, which may
SPC(X) ( contain numbers, letters, and any other character that your Commodore
1 6 can make. An example of a string variable is "COMMODORE 1
6".
(
This is used in the PRINT staiement to skip over X spaces. X can have
a value trom 0-255 VARIABLE NAMES
Variable names may consist ol a single letter,a letter followed by a
number, or two letters Variable names may be longer than 2
I
traders, but only the first Iwo are significant
TAB (X)
TT (PI)
EXAMPLES:
The pi symbol, when used in an equation, has the value ol 3.1 41 59265, I
Variables
ARRAYS are lists ot variables with the same name, using an extra
!
number (or numrjets) to specify an element ot tne array. Arrays are
Your Commodore 16 uses three lypes ol variables in BASIC. These defined using the DIM statement, and may be floating point, integer, or
are: normal numeric, Integer numeric, and string (alphanumeric) [ string variables arrays. The array variable name <s followed by a set of
variables. parentheses ( } enclosing the number of the variable in the list
I I
153
1
1
1
1 1
EXAMPLES: A(7).BZ%<1 1),AS(87)
The variable DS reads the disk drive command channel, and returns the
Arrays may have mote lhan one dimension. A two dimensional array 1 current status of the drive. To gel this Information In words. PRINT
may be viewed as having rows and columns, with the first number DSS. These status variables are used after a disk operation, like a
Identltylng the column and the second number in the parentheses 1 1 DLOAD or DSAVE. to find out why the red error light on the disk drive
is blinking.
Identifying the row {as it specifying a certain grid on a map)
1 1
EXAMPLES: A(7.2) BZ%(2.3,4)7S<3.2) ER, EL. and ERRS are variables used in error trapping routines. They
are usually only useful within a program ER returns the last error
1
1
encountered since the program was RUN. EL is the line where the error
RESERVED VARIABLE NAMES occured. ERRS is a function which allows your program to prinl one of
There are seven variable names which are reserved for use by the 1 1
the BASIC error messages. PRINT ERRS(ER) prints out the proper error
Commodore '6. and may not be used for another purpose. These are message.
the variables DS, DSS. ER, EL. ST.TI, and TIS. You also can'i use 1
1
KEYWORDS such as TO and IF, or any names that contain BASIC OPERATORS
KEYWORDS, such as SRUN. RNEW, or XLOAD as variable names. 1 1
characters are the minutes, and the 5th and 6th characters are the
to make sure that your equations have the same number of left
seconds. This variable can be set to any value (so long as all characters
I
I
parentheses as right parentheses, or you will gel a SYNTAX ERROR
are numbers), and will be automatically updated as a 24 hour clock
message when your program is njn.
1 !<
There are also operators for equalities and inequalities, called
EXAMPLE: TIS = "101530" sets the dock to 10 1 5 and 30 seconds RELATIONAL operators Arithmetic operators always take priority over
(AM) 1 1
relational operators.
'
f
1 155
>= o, => | S greater lhan or equal to
<> or >< is noi equal lo
BASIC Abbreviation and Reference Chart
Finally, there are three LOGICAL operators, with lower priority than KEYWORD '.V-i.f ./|.^ ON TYPE
both arithmetic and relational operators; ABS a SHIFT 6 tunction— numeric
AND ASC a SHIFT s function— numeric
OR ATN 3 SHIFT T luncllon— numeric
NOT AUTO a SHUT U command
BACKUP b SHUT A command
BOX b SHIFT statement
These are used most often lo Join multiple tormulas in IF . . .
THEN CHAR ch SHIFT A statement
statements. When they are used with arithmetic operators, they are
CHR$ c SHIFT H lunctton— string
evaluated last {i.e after + and -)
CIRCLE
,
i
c SHIFT 1 statement
CLOSE cl SHIFT statement
EXAMPLES; CLR c SHIFT L statement
CMD c SHIFT M statement
IFA=BANDC=DTHEN100 requires both A-B & C-D to be l COLLECT col SHIFT L command
true COLOR CO SHIFT L statement
CONT c SHIFT command
IF A = B OR C=D THEN 100 allows either A=B or C-D to be COPY CO SHIFT P command
true COS none (unction— numeric
DATA d SHIFT A statement
A-S:B-4:PRrNTA=B displays a value ot
DEC f Or e function— numeric
A-9:B«4:PRINTA>B displays a value ot -1
DEFFN d SOTT E statement
DELETE de SHIFT L command
PRINT 123 AND 15:PRINT 5 OR 7 displays 11 and? DIM d SHIFT 1 statement
I DIRECTORY di SHIFT R command
DLOAD d SHIFT L command
DO none statement
DRAW d SHIFT R statement
DSAVE d SHIFT S command
END e SHOT N statement
ERRS e SHIFT R tunction— string
EXP e SHIFT X (unction- numeric
•. j«_ p.
FOR I SHOT statement
FRE f SHOT R tunction- numeric
GET g SHIFT E statement
GETKEY getk SHIFT E statement
GET* none statement
GOSUB go SHOT S statement
GOTO g SHIFT statement
GRAPHIC SHIFT R statement
i
SB :
'
157
I
GSHAPE wttn
I I RENAME re SHIFT N command
S statement
HEADER
g
he SHIFT A command RENUMBER ren FT U command
SHOT
I I
RESTORE re SfflFT S statement
HEXS h E function— string
RESUME res JHHFT U statement
IF.. GOTO none statement
..THEN none
i
:
i
RETURN re SHUT T statemenl
IF ELSE statement
INPUT none statement RGR SHIFT G function— numeric
INPUT* wmrr mem
i i
RIGHTS SHIFT (unction— string
( N state 1
1 (
1 58
1 f 1 S9
I
1 r
[ APPENDICES
1 ( Error messages
[ i
Disk error messages
i
Deriving mathematical (unctions
1
1 l
Musical note lable
1
[
• Screen display and ASCII codes
i
1
Book list
1 i
1 (
1 (
1 (
1
i
1 r
1 (
1 (
1 (
1 f
1 (
l
1
(
1
1
i
160 f '
161
F |t
1
1
APPENDIX A because of missing or extra
Error Messages 1 parenthesis, misspelled
These messages are printed by BASIC You can also PRINT
error keyword, etc
1
Ihe messages through the use of the ERRS() lunclion. Ttie error RETURN WITHOUT A RETURN slatement en-
1
12
number refers only to the number assigned to the error for use with GOSUB countered when no GOSUB
mis function 1
i statement was active
1 1
15 OVERFLOW The result of a compu-
3 FILE NOT OPEN The file number specified In lation is larger than the
an I/O statement must be ( [ largest number allowed
opened belo'e use (1 70141 1833E+38)
4 FILE NOT FOUND No file wilh that name exisfs 1 (
16 OUT OF MEMORY Either there no more room
is
(disk) for program and program
5 DEVICE NOT PRESENT The required I'O device not
1 ( variables, or there are loo
I
r
162 f f 163
.
i
K
!
(ewer parentheses)
1 1
26 CANT CONTINUE The CONT command does
not work If the program was
not RUN, there was an error, 1 '
Try again
piogram execution
31 CAN'T RESUME A RESUME statement en- 1 1
a program
35 NO GRAPHICS AREA A command (DRAW, BOX. 1 (
(
1
l 1
164 ( 1 166
1 !
1 r
APPENDIX B byte This message may also
indicate grounding problems.
Disk Error Messages 1 r
These error messages are relumed through the DS and DS$ 25 WRITE ERROR This message is generated il the
1 i
reserved variables (write- verify error) controller detects a mismatch
between the written data and ihe
NOTE ;
Error message numbers less lhan20 should be ignored
1 i
data in the DOS memory
with the exception ol 01 which gives inlormation about the num-
,
1 i 26 WRITE PROTECT ON This message is generated when
ber of tiles scratched with the SCRATCH command Ihe controller has been requested
1 to write a data block white the
20 READ ERROR The disk controller is unable to lo- write protect switch is depressed
been destroyed
27 READ ERROR The controller has delected an
i header
21 READ ERROR The disk controller is unable to
1
23 READ ERROR This error message indicates that 29 DISK ID MISMATCH This message is generated when
(checksum error Ihere is an error in one or more ol 1 i
Ihe controllei has been requested
.n data block) Ihe data byles The data has been to access a diskette which has
read Into the DOS memory, but not been initialized. The message
the checksum over the data is tn
1
can also occur II a diskette has a
error This message may also in-
bad header
1
r
dicate grounding problems.
30 SYNTAX ERROR The DOS cannot interpret the
24 READ ERROR The data or header has been read 1 i
(general syntax) command sent lo the command
(byte decoding error) into the DOS memory, but a hard
channel Typically, this is caused
1
ware error has been created due I
1 i
167
i
(invalid command) command The command must 52 FILE TOO LARGE Record position within g relative
start in Ihe first position. file indicales that dish Overflow
will result.
32 SYNTAX ERROR The command sent is longer than
(Invalid command) 58 characters 60 WRITE FILE OPEN Thismessage is generaied
when a write file lhat has not
33 SYNTAX ERROR Pattern matching is invalidly used been closed is being opened
(invalid die name) m the OPEN or SAVE command I' for reading
f
(invalid command) mand sent to command channel 62 FILE NOT FOUND The requested file does nol exist
(secondary address 15) is unrec- I
on the indicated drive.
ognized by the DOS
63 FILE EXISTS The file name of the file being
(
50 RECORD NOT PRESENT Result of disk 'eading past the created already exists on the
last record through INPUT*, or diskette.
I
168 169
66 ILLEGAL TRACK The DOS has attempted to ac- attempt is made to write upon a
AND SECTOR cess a track or block which does disk which has been formatted in
170 171
t
APPENDIX C APPENDIX D
Deriving Mathematical Functions Musical Note Table
Functions thai are nol intnnsic lo BASIC 3 5 may be calculated as 1
1 NOTE SOUND REGISTER VALUE ACTUAL FREQUENCY (HZ)
follows;
A 7 110
B
1
!
'
1
C 596 261.4
INVERSE COTANGENT ARCOT!X)-ATN(X).ir'2 D 643 293.6
HYPERBOLIC SINE SINH(X) E (EXP(X)-EXP|-X)K2 E 685 330
HYPERBOLIC COSINE I I
COSH(X)=<EXP(X)- *EXP( X]V2 F 704 3496
HVPERBOUC TANGENT TANH(X)-EXP(- X)/(EXPI«) - EXP
l-Wt+1
G 739 392.5
HYPERBOLIC SECANT SECH(X)-a(EXP(X).EXP( X))
1 1
A 770 440.4
HYPERBOLIC COSECANT C5CHtX)=?J (EXP(X)-EXP(-X)) B 798 4949
HYPERBOLIC COTANGENT COTH(X)-EXP( - XHEXP(X) 1 r C 810 522 7
INVERSE HYPERBOLIC SINE
-EXPt-X))*:-'-
ARCS1NH(X) = L0G(X SORfX'X • 1»
D 834 588.7
i
i The above table conlains the sound regisier values of toui octaves ot
notes The sound registei values are used as ihe second parameter
i :
ol the SOUND command To use the first note In the table (A — sound
'
1 (
i
[
1 f
172 1 1 173
register value 7) use The 7 as the second number afler the SOUND APPENDIX E
command—SOUND 1.7.30
Screen Display Codes
Use the following formula fo find the sound register values lor frequen-
The following chart lists all ol the characters built into the Commodore
cies other than those in the table:
character sets shows which numbers should be POKEd Into screen
It
SOUND REGISTER VALUE - 1024-(111860 781/FREQUENCY) memory (locations 3072 to 4095) to gel a desired character (Remem-
ber lo set color memory —2048 to 3071 ) Also shown is which char-
Both the table of sound register values arid the above formula are lor acter corresponds to a number PEEKed Irom the screen
NTSC televisions This Is the television standard used throughout the
United States and all ol Canada If you are in a country where PAL is Two character sets are available, but only one set at a time. This means
the television standard, you should use the following formula to calcu- that you cannot have characiers from one set on the screen at the
late new sound register values for the entire table same lime you have characters from the other set displayed. The
SOUND REGISTER VALUE = 1024— (11T840.45/FREQUENCY) sets are switched by holding down the shift and O keys
simultaneously.
174 175
SET I SETS POKE 5ET1 9ET? KKf SETI SET1 POKE SET! 5£T2 POKE sen SET 2 POKE SET! WT* POKE
A a 1 U U 21 >
41 - 61 a U 85 109
B o 2 V V 22
*
42 > 62 & V 86 h! 110
c c 3 w w 23' f 43 7 63 o W 87 111
D a A X X 24 . 44 B 64 i* X 88 H 112
E B 5 Y y 25 - 45 a A 65 a V 89 ^ 113
F ( 6 z Z 26 , 48 m B 66 si z 90 ^r 114
G g 7 I 27 / 47
B C 67 b 91 H 115
H h 8 f 28 48
B 68 E 92 II 116
1 i 9 I
29 1 49 H E 69 ;i 93 LI 117
J i
10 I 30 2 50 F 70 s 8 94
-1 118
K k 11 - 31 3 51
D G 71 H K 95 119
L 1 12 SPACE 32 A 52 a H 72 SPACE i
96 H 120
M m 13 I 33 5 53
B I 73 E 97 U 121
N n M >
34 6 54
a J 74
B 98 j y
# 35 7 55 K 75 99 123
15 .
P P 16 1 36 8 56 L 76 D 100 a 124
Q Q 1? % 37 9 57
s M 11 101 Fl 125
R r 18 & 38 58 N 78 m 102
B 126
S s 19
i
39 i
59 79 a 103
B 127
P 80 a 104
B1 105
R 82 106
§ S B3 CB 107
176 177
If
E 69 i. 98
H 127 Ml 156
This appendix shows you what characters will appear [you PRINT ii
CHR$(X). (or all possible values of X li will also show the values ob-
F 70
B 99 128 157
i
K 75
a 104 H 133 a 162
2 SL P
s 3
3 K 19
20 %
S 36
37
5
6
53
54
|
,
Q
BO
81
109
110
'*
«
138
139 B
167
168
Bt 5 22 39 8 56 i
I
s 63
L] 112 «" «T™» '41 170
SWITCH TO
6 23 ( 40 9 57 T 84 113 UPPERCASE '42 CB 171
7 24 41 1
* 58 I U 85
- 114 143 . 172
DISABLES BITOT O 8 25
!
•
42 59 , V 86
Ii 115 1L» 144 ^ 173
ENABLES rairt O 9 26 + 43 < 60 *
w 87 116 1 145 v 174
10 ESCAPE 27 i 44 - 61 I
X 88 Lr 117 8S 146 _ 175
i
i 96
CD 125
ES 154
n 183
178 1
179
a
29 J 1 6
APPENDIX G
INDEX
Books For Commodore Products
Conociing M slakes
The following lisis Include a sampling ol ihe computer and program- Abbreviations 62, 157-199 Erasing Ihe Screen 50
ming books available The title of ihe book is listed first, followed by the Addition 54 Une Earwig 46-49. 61-52
author and publisher. Animation 87-70
Airays 153-154
Commodore Books ASCII Codes APPENDIX F
END Stalemer.l 1 1 T
COLLECT Command 97-08 Entering Commands 46
Colour
Machine Language Programming Erasing Cnatacwa (See Screen Editing)
ChangmgColou'843-44, 70- '2 Erasing L'nes (See Screen Enilirig)
Machine Language 'or Beginners, Mansfield, COMPUTE 1
Books COLOR Statement '0-71.113
Error Messages 38. 38. APPENDIX A
Programming the 6502, Zaks, Sybex Colour Kays 23-25. fij-44
ESC Key 23, 51
6502 Assembly Language Programming. Leventhal, Osborne/ L drrnnance 71 Exponentiation 65
Mulb-colou' ModeSi -32
McGraw-Hill PAINT Siatement 80-81 , 1 28-1 29
I
6502 Micro Chart, Micro Logic Corp. Reverse 22 43-44
Printing
6502 Software Design. Scanlon. Sams COLOR Statement 70-71 113 Floating Poinl Variables GO-61 . 1 53
The &S02 Software Gourmet Guide & Cookbook. Findlay. Hayden I
Connectflo the Computer 9-1 FOR .
TO . . . STEP Siaiemenl
CQPV Command 93-39 117-118
(
'80 I 181
•
1 89 9 1
I (
Formatting a Diskette 36-38. 10 Numbera RETURN Key 1
Multi-coioui 81-82 INST/OEL Key 20-21, 47-48 OPEN Statement 127-128 SCNCLB Command 50. 73. 1 38
GRAPHIC Statement 72-73. 121 RETURN Key 19. *7 Operatois SCRATCH Command 108
GRAPHIC CLR Statement 122 RUN/STOP Key 19 I Logical 155-156
Scieen Display 42
OnpNn RVS ON/OFF Keys 22. 43-48 Mathematical 54. 155-156
Screen Deploy Codes APPENDIX E
Animation 67-70 SHIFT Key 1 8-1 Relational 54. 155-' 58
Screen Editing
BOX Siatemeni 77-78 SHIFT LOCK Key 19 I
Correcting Mistakes 46-49
CHAR Slalomont 76-77 Typing Mode 1
CLEAR/HOME Key 21 50.51
CIRCLE Stelement 78-80 I Clearing the Screen 50
DRAW Statement 74-75 PAINT Statement B0-8V 128-129 ESC Key 23. 51
H gn Resolution 73-82 Penaherats 12-10 INST/OEL Key 20-21. 47-48
Muttl-Co>omB1-82 LET Statement 1 24 Pi 19,55 Printing On the Screen 58-60
PAINT Statement 80-81 Commano 27. 103-104
LIST
P<*eiCurso* {PC) 142-^43 Scieen Wmoows 51-52
and Labels 74-76
Po-nis. Lines LOAD Command 32-33. 104-105 POKE Statemem 1 29-1 30 Serial Socket 9
I
Cuctesana Polygons 77-80
Srjjates. Loading Setting Up the Computer 9- 2
Power Supply 7-10
Us*ig Graph»c Keys 25. 64-67 Cartridges 30 Software
PrinivniG
QSHAPE Slalemenl 39 ' 40 1 Cassettes 31-33 I Printing on the Screen 43-49. 58-60 CaMrtrtge 30-31
Diskettes 35-36
PRINT Statement T30 Cassette 31-34
LOCATE Statement 125. 142-143 PRINT* Statement 1 31 Diskette 34-38
H Luminance. 71 l
PRINT USING Statemem i31-'.34
Souno
HEADER Command 38-38. Prim Zones 58-60
I0>-102 Musica Nole Table APPENDIX D
HELP Command 102 Programming Mode 46
M SOUND Slalemenl 85-87
HELP Kay 27 PUDEF Sialement 134-135
VOL Slalemenl 84
High Resolution Graphics 73-82 Mathematical Opetaiois 54. 155-156 Sound Effects
Memory Eipanslon Pod 8. 30 Music 87 88
MONITOR Statement - 25 Noise 67-88
I Monitors 10. 14 READ Statemem 1 35 SOUND Siatemeni
Mult<-<:olour Graphics 91-82 inai Operators 54. 55-1 56 Duration 86-67
IF THEN ELSE Statement 1
182
I
(
I
Swlcnes and Sockets— cont TVCaW«6. 10
Joystick Sockett 7
II
Memory Expansion Port 9. 30 l
On/On* Switch 7
Uwt Defined Functions 62
Power Socket 7-9
Reset Bumy, 7. 50 V I
VideoSocKeI8.9. 11
~BKt Siring Variables 50-61 , 1 S3
VOlume Statement 64-65. 142
fRAP Statement 141
rnoFF Statement 141 W I
184