Commodore CBM 2001-16N, CBM 2001-16, CBM 2001-32, CBM 2001-32N User Manual

BUSINESS
COMPUTER
BUSINESS
BUSINESS
BUSINESS
CBM
MODEL
USER
16N,
COMPUTER
COMPUTER
COMPUTER
32,
32N,
3016,
MANUAL
3016N,
3032,
3Q32N
LJ
0
0
L
.
j
! |
n
i t
1
'
n
^
•'
,
n
r7
The
informationinthis
no
responsibility
PET
PERSONAL
manual
is
assumed
purposes
has been
for
inaccuracies.
only
and
©
Commodore
2001-16,
16N.32,
COMPUTER
USER
FEBRUARY
is
"All
MANUAL
1979
reviewed
subject
first
Business Machines,
rights
andisbelievedtobe
The
materialinthis
to
change
edition
reserved"
32N
entirely
manualisfor
without
Inc.,
notice.
1979
reliable.
However,
information
Commodore
t
Santa
Business
3330
Scott
Clara,
Blvd.
Ca.
95051
Machines
TABLE
OF
CONTENTS
Chapter1.Welcometo
Chapter2.
UnpackingyourPETandturningiton
Chapter3.Basic
PET
keyboard
Screen
Chapter4.Beginning
The
PRINT
Variables
Direct
Literals
Functions
your
PET
keyboard
editor
input
BASIC
statement
and
program
statements
computer
Chapter5.Eiementaryprogramming
Unconditional
Data
Chapter6.
Advancedprogrammingtechniques
String
Subroutines
FOR
Subscrpted
entry
variables
NEXT
and
conditional
and
functions
loops
variables
looping
1
3
n
19
32
38
Chapter7.PET
communication
PET
interfaces
Commands
peripheral
IEEE-488bus
and
devices
withtheoutsideworld
and
lines
operations
for
Chapter8.Machinelanguageprogramming
Allocation
Commands
Machine
Chapter9.Errorsanddiagnostics
Debug
BASIC
OS
error
of
memory
from
BASIC
language
techniques
error
messages
messages
monitor
57
91
113
LIST
OF
FIGURES
2.1
2.2
2.3
2.4
2.5
2.6
3.1
6.1
6.2
7.1
Rear
viewofPET
PET
memory
Memory
ASCII
codeinmain
ASCII6bit
PET
graphic
PET
keyboard
Functions
Principal
Simplified
bus
mapbyfunctional
code
character
scan
expressedintermsofbuilt-in
pointers
viewofPET
2001
memory
codes
lines
into
PET
blocks
RAM
BASIC
functions
3
4
6
7
7
8
12
43
55
57
7.2
7.3
7.4
7.5
7.6
7.7
7.8
7.9
7.10
7.11
Edge
connectorsJ1and
PET
IEEE
connector
Receptacles
IEEE
standard
Parallel
6522
VIA
Parallel
ConnectorJ3contact
Second
PET
second
for
user
port
addressesinPET
user
port
cassette
pinout
the
IEEE
connectors
information
example
identification
interface
edge
J2
interface
port
connector
J3
57
58
58
59
59
61
62
62
62
63
7.12
Edge
connector
J4
63
iii
LISTOFFIGURES(continued)
7.13
7.14
7.15
7.16
7.17
7.18
7.19
7.20
7.21
7.22
Memory
Multiple
OPEN
OPEN
Status
Default
Examplesofdefault
IEEE
Transfer
Byte
expansion
file
structure
for
write
from
for
readtoPET
word
errors
parameters
bus
contact
bus
transfer
identification
handshake
from
talker to
connector
PET
parameters
sequence
listener
'
63
69
73
74
80
82
82
83
84
85
7.23
7.24
7.25
7.26
8.1
8.2
Signals
Status
IEEE-488
Code
Example
Machine
describedbyIEEE
codes
register
assignments
Floating
Language
for
IEEE
bus
addressesinPET
for
command
Point
Numbers
Monitor
bus
groups
mode
Listing
operation
87
88
88
89
94
100
IV
LIST
OF
APPENDICES
A.
B.
C.
D.
E.
F.
Detailed
BASIC
BASIC
Expressions
Space
Suggested
PET
memory
statements
commands—intrinsic
and
and
speed
reading
map
functions
operators
hints
1-
WELCOME
TO
YOUR
PET
COMPUTER
Congratulations
the
PET
2001
is
now
available
procedures
a
short
period
The
potentials
arise
that
this
WritetousatCommodore
withanewsletter
Commodore
3330
Santa
USA
360
Euston
London
England
3370
Agincourt
and
welcome
you
have
eliminated
for
learning
outlined
Scott
Clara,
Pharmacy
in
this
after
unpacking
of
your
PET
book
has
not
we'llbesending
Systems
Blvd.
Ca.
95050
Road
NWI
3B1
Avenue
M1W2k4
to
the
manual,
the
are
virtually
coveredoreven
with
Divisions:
the
exciting
the
problems
functions
you
shouldbeabletoachieve
shipping
new
of
and
capabilities
container.
limitless.
anticipated.
your
questions.
out
from
We
timetotimetousers.
world
of
personal
getting
This
a personal
of
your
book,byits
will
answer
computers.
computer
system
PET.Infact,ifyou
initial
operation
very
many
that
nature,
is
you
and
By
selecting
running.
Your
followafew
of
your
Pet
2001
limited.
other
Questions
users
will
time
simple
within
will
pose
PETisa
board,
white
by
At
the
operation
The
cannotbedestroyed
memory.
use
In
ordertosatisfy
have used
Summary
programmer.
more
PETabit,
instruction
The
sections
sections
more
PETiscalled
Personal
keyboard,
television
twenty-five
Electronic
computer
monitor,
lines.
heartofyour
of
the
screen,
productisso
(Called
the
PET
three
discussions
detailed
the
works.
third
typeofformat
are
difficult
familiar
construed
Read-Only-Memory)
with
impunity.
the
formatsinthis
When
you
explanations
italicized
for
people
to
with
the
BASIC,anacronym
which
PET
2001isan
keyboard,
because
needsofthe
in
this
are
summary
givesadetailed
who
follow
PET
Transactor.
board,
andaCommodore
displays
cassettes,
that
you
the
computer
serious
manual.
type
font
first
using
which
areinthe
sections
use
the
andwerecommend
operating
for
Everything
characters
MCS
6502
microprocessor.
and
cannot
damage
software,
This
allows both
useraswellasthe
are
designedtoanswer
your
PET
manual,
type
willbeuseful
description
PETatthe
system.
Beginners
machine
he/she
The
is
complete
supplied
inaformat
in
cassette.
that
This
additional
the
or
font
of.the
of
language
All-purpose
peripherals
PET
from
operating
the
first
time
first
the
read
these
preceding
when
you
how
the
PET
level.
The
use
them
onlyonre-reading
which you
Symbolic
one
steel
cabinet.
Thereisa
appeartoyoutobe
microprocessor
which
the
keyboard.
instructions
user
time
userofa
questions
sections
paragraph.
wanttoreview
implementsasection.
first
time
will
Instruction
canbeaddedtothe
are
and
the
of a
lightly
reader
usetocommunicate
It
contains
built-in
forty
totally
The
operating
contained
sophisticated
computer
professional
and
spend
After
you
have
howaparticular
may
find
the
material
Code.
a
CRT
black
and
characters
controls
PET.
system
inafixed
user
to
product,
timeonthe
These
these
with
used
the
when
your
we
It
shouldbenoted
of
usageinmind,
the
appendix.
in
this
particular
The
ultimate
ask
youtouse
case,
this
documentation
examplesofyour
we
invite
commentsonthis
to
resolve
any
which
Someofthese
manual.
teaching
the
own,
unclear
that
there
are
available
manuals
device
PET
along
is
sufficient
any
questions
material
statement.
are
other
to
maybemore
for
learning
with
the
to
which
and
reference
the
material
public.Wehave
usefultosatisfy
how
the
PET
worksisthe
text,
rather
allow
particularly
than
youtoget
might
arise
on
just
startedonan
are
examples
written
about
included
continuously
BASIC,
a
listofsuch
a
specific
PET
itself.Insome
reading
example.Byconstructing
answeredbythe
which you
with
different
suggested
need
whichisnot
cases,wewill
whattodo.Inany
machine
as an
itself.Ofcourse,
individual
types
reading
in
covered
similar
have
used
Lastly,
programming
publications:
descriptions
operate.
book
purchased
since
this
aspectsofthe
Thereisa
of
Detailed
called
Programming
from
manual
the
auxilliary
specifications
Commodore
cannot
MCS
manual
available
devices
of
Manual.
directly.
presumetoprovide
6502
microprocessor,
from
your
which
the
Thisisavailable
generate
computer
all
dealer
the
and
the
for
NOTES
purchase
technical
we
direct
called
control
languageinwhichitoperates
information
youtotwo
Hardware
signals
from
your
of
hardware
other
Manual
necessarytoallow
PET
dealeroreither
Commodore
which
are
or
also
includes
the
PET
to
availableina
can
be
Chapter
2.
UNPACKING
YOUR
PET
AND
TURNINGITON
Please
concealed
shipping
Remove
surface,
check
the
damage.Ifanythingisamiss,
agent.
your
PET
then
plugitinto
carton
from
for
its
protective
any
TV
BRIGHTNESS
ADJUSTMENT
any
special
unpacking
reportly
shipping
standard,
grounded
instructions
this
immediately
carton
and
placeiton
electrical
outlet.
and
carefully
to
both
the
the
counter,
(In
some
countries
examine
placeofpurchase
your
PET
for
and
desk,orother
no
plugisprovided.)
suitable
any
the
The
power
closingitto
position,oran
Immediately,
time-out
screen
characters
The
screen
microprocessor,
current
switchislocatedinthe
the
right
turnsitoff.
ON/OFF
when
circuitina
has
had
power
which
memory
and
contentsofthe
label.)
the
power
special
immediately
reflect
transfertothe
so,
screen
MEMORY
EXPANSION
J4
CONNECTOR
Figure
2.1.
fuse,
line
left
rearofthe
(Thereisa
switchisturned
condition
(reset
priortothis
the
current
contentsofthe
screenisdone
even
when
the
memory.
2NO
CASSETTE
INTERFACE
Rear viewofPET
cord
and
white
J3
USER
2001-8
interfacing
PET.
Closing
dotonthe
on,
powerissuppliedtothe
condition)
time,
you
computer
with
computerisnot
PARALLEL
PORT
J2
SERIAL
NUMBER
ANO
ELECTRICAL
showing
connectors
power
which
will
switch,
the
switchtothe
switchtoindicateitisinthe
initializes
seeonthe
memory
circuitry
operational,
outside
the
3-WIRE
AC
POWER
CORD
SPEC.
left
turns
the
PETonand
poweron
internal
them
circuits.
intoaknown
state.Ifthe
Thereisa
screenavarietyofstrange
whichiscontrolling
controlofthe
screen
always
the
screen.
main
displays
the
At
the
endofthe
temporarily,
power-on
and
then
cycle,
displaysonthe
the
computer
screenamessage
initializes
the
internal
like
the
following:
memory,
blanks
the
screen
The
15359/31743
the
PET
computer
bytes
free
anda32K
If
you
failtoget the
To
get
the
(Input/Output),
The
relationship
referstoavailable
and
corresponds
PET
power-up
display,
and
four
Screen
between
***COMMODORE
15359/31743
READY.
users1
programmable
roughlytoone
will
display
display
different
Memory.
these
31743
the
typesofmemory
memoriesisshowninfigure
letterordigitofinformation.
bytes
first
time,
BYTES
FREE
memory.Abyteisthe
free.
try
turning
are
used:
the
power
ROM,
2.2.
fundamental
A16K
PET
switch
User
Read/Write,
slowly
data
will
display
off,
then
I/O
element
of
15359
back
on.
/
\
ROM
14k
address
\
/
/
RAM
16/32K
TV
\
RAM
1k
and
data-bus
\
/
I/O
2k
7V7v7\
keyboard
\/
IEEE-488
user
port
Figure
2.2.
PET
memory
bus
ROM
(READ
ROM
causes
programs
the
real
the
lowest
operation
keyboard,
powered
I/O
MEMORY
The
second
devices
computer.
interfere
ordertoperform
ONLY
the
PETtoperform
writtenbyCommodore
time
clock,
cost
memory
of
his
machine.
or
from
the
on,
but
also
typeofmemoryisthat
called
PIA*
Except
in
any
way
legitimate
when
MEMORY)
and
execute
for
storing
Thisisbecause
user's
program.
the
user
and
VIA**
special
with
these
Input/Output
mostofits
which
commands
this
Not
program
whichisdevotedtoInput/output
which
allow
I/O
operations
areas.
The
operations.
scan
the
keyboard,
that
the
user
data,
but
also
give
the
operating
onlyisthe
cannot
the
operating
operations.
machine
damage
the
PETtoindividually
are
desired,
system
In
each
PET,
print
the
types
in.
Read
the
user
the
system
memoryisindestructible
available
BASIC
operating
operations.
control
the
user
should
automatically
14KofROM
display,
to
control
Only
most
run
BASIC
system.
memories
protection
from
This
the
bits
not
allow
handles
contains
input/output,
memory
that
his
these
a
series
are
not
and
the
from
the
momentitis
contains
manipulate
program
locations
of
count
only
fastest
the
I/O
the
to
in
USER
The
throughout
$1FFF.Adetailed
RAM,
for
The
location
performing
If
BASIC
memory
is
Later
program
SCREEN
The
makeupthe
which
ROM,
READ-WRITE
third
typeofmemoryisthe
this
I/O,
and
by
the
map,
its
various
message
1024
a
the
number
can
automatically
that
where
programs
on,wewill
overlays.
MEMORY
screen
memoryisphysically
takes
thus
displaying
MEMORY-R.A.M.(RANDOM
book.)Ina
mapofall
Screen
the
tasks,
'7167
and
checkonwhetherornot
was
comes
PET's
the
Memory
first
1024
including
BYTES
cycles
less
than
furnished
are
loaded
discuss
standard
individual
charactersonthe
User
Program
standard8KPET,itis
the
memoryisincluded
are
located
bytesofmemory
the
buffering
FREE"isa
through
the
15359/31743,
checkupto
with
the
and
BASIC
some
techniquestoexpand
composedofthe
memory.Itis
bytesofmemory
fromaprogramming
resultofan
memorytodetermine
the
Read/Write
you
32KofRAMaslongasthe
PET.
This
holds
constantly
and
screen.
ACCESS
Memory
located
are
reserved
of
data
MEMORY)
Space.
from
in
figure
for
from
the
the
cassettes
analysisofBASIC
which
Memoryisworking
may
haveahardware
memoryisreally
allofthe
uses
program
this
memorybyusing
same
kindofchips
being
usedbythe
themtoaddressaspecial
(We
will
call
this
area
location
2.3,
standpoint.
operating
locations
$0000tohexidecimal
showing
where
As
you
systemtouse
and
other
which
starts
are
available,
correctly.
problem.
added
memoryiscontinuous
the
working
memoryinthe
variables.
tape
that
are
used
CRT
control
character
RAM
the
ROM,
can
see
I/O
devices.
at
thereby,
to
the
machine;
files
and
to
electronics,
generator
it
As
mentioned
no
direct
*PIA-Peripheral
**VIA-Versatile
For
information
during
control
over
Interface
Interface
about
the
power-up
it.
Adaptor
Adaptor
these
and
related
discussion,
this
chips,
see
processistotally
6502
automatic,
Hardware
Manual.
and
the
programmer
has
o
1024
8192
16384
32767
32768
33792 34816
RAM
RAM
RAM
RAM
Expansion
Operating
BASIC
User
~UseT
16K
32K
RAM
RAM
system
working
BASIC
Variables
PET
PET
area-24K
TV
ImagesofTV
and
storage
program
RAM
35840
36864
Expansion
49152
59392
61440
n
On
every
cycleoftheTVscreen
($8000)inthe
cornerofthe
givingusan8row
8
dots
each
toptobottom.
controller
on
whetherornotitis
character,
screen
screen.
timeitis
high
This
givesan8
memory
Each
characteronthe
addressed.
automatically
scanning
etc.
65536
(i/©oofa
and
processes
characterinthe
These
bit
wide8bit
changes
the
addressingofthe
the
top
Figure
second),
memoryisaddressed
screen.
dots
lineofa
ImagesofTV
ImagesofTV
ROM
ROM
I/O
ROM
2.3.
PET
memory
the
hardware
the
screen
The
character
are
serially
tall
character
character,
BASIC
operating
data
fedtothe
character
RAM
RAM
area-12K
system
map
starts
with
the
startingatthe
into
the
character
ROM
thatisused
screen,
withnospaces
working
between
generating
the
second
lineofof
least
address
upper
left-hand
generator
generates
from
characters.
ROM,
depending
a
eight
times,
lefttoright
The
and
CRT
There
are
two
character
screenbyPOKEing
the
second
to
try
lower
To
understand
character
this
featuretoseeifyour
case
letters
memory
for
this,
sets
storedinthe
address
set.
After
you
PET
the
graphic
letusreview
set
how
ROM.
You
can
59468
have
performs
witha14(a12turnsitback)
played
thatisavailableinthe
characters
with
this
way.
are
the
The
representedinthe
change
screenalittle
the
second
first
character
set.
character
which
bit,
PET
setonthe
turnsitto
you
may
set
substitutes
andinthe
want
memory.
CHARACTER
The
standard
In
the
PET,
screen.
B
tflfcii
yiii
itjdb
idbl
ikjifcj
ibil
iiwu
iiyi
iiiu
iiil
Exampleinthe
Aisrepresented
Shifted
REPRESENTATIONINPET
ASCII
the
8th
b
i
i
t>
1
i
4
1
1
1
1
1
I
I
I
1
1
1
1
I
1
l
1
1
3
PET:
A
(a
MEMORY
codeisusedtorepresent
bit
(bit7)is
NUL
bOH
b
IX
tift
toi
tNti
H'vK
tftL
Bb
HI
Lh
VI
Hh
CK
bO
bl
spade)
is
usedtosignify
Id
i
i
JL>Lt
L'Ci
D^tL
i;»Cb
i>lJ4
NHK
SYN
t
IB
tw
bUii
Lb'w
hb
•ob
Kb
Vb
Figure
2
Figure
2.4.
ASCII
0100
0001
1100
0001
characters
BASIC
u
1
i
i
b
4
b
V
b
y
in
the
command
wordsorgraphics
i
H
t
Y
'o
H
i
J
K
L
h
H
character
set(7bit
code)
main
memory.
1
y
i
Q
k
b
i
U
V
w
K
V
L
\
J
i
i
1
bh'
a
b
c
d
e
f
h
i
J
k
i
rn
n
o
(RAM)
characters
i
i
1
p
s
t
u
X
2
I
for
the
PET
u
u
Li
U
0
0
The
screen
There
are
memoryisorganized
only64characters
1
fcJbil
i<i
iltli
111U
ilii
withadifferent
from
Figure
the
standard
tt
ft
B
c
t
h
H
1
J
K
L
M
N
0
2.5.
ASCII64character
representation
ASCII
set
that
K
b
i
U
V
X
Y
L
\
j
t
set(6bit
from
are
normally
1
y
code)
the
main
printable.
i
i
b
V
b
y
PET
memory.
0
LJ
U
U
LI
LJ
J
U
These
The
6;
The
additional64dispiayable
This
characters
are
the
same
characters
representation
givingusa
graphic,orshifted
gives
the
are
in
screen
six
bit
code
characters,
following
organizedsothat
memoryisderived
for
characters.
table
that
are
directly
availableonthe
from
the
keyboard
characters.
setisrepresented
for
PET
dispiayable
they
are
justashift
PET
the
standard
by a1in
characters.
from
the
ASCII
bit
sixofthe
It
shouldbenoted
normal
keyboard.
setbydropping
screen
memory,
that
keyboard
character.
bit
giving
allofthe
graphics
an
n
£
b!
i
*s>
I
141
bum*
ki tl tl
i
!JL
fcjtfil
tflltf
Mill
1
i
Itfiu
itfll
11MU
11M1
llltf
1111
i
1
1
i
1
t
a
w
H
c
i>
L
\-
»o
H
i
j
K
L
M
N
0
1
Q
K
b
1
U
V
W
K
Y
^
L
\
J
V
Figure
i
u
11
%
be
*
+
-
/
2.6.
PET
i
••■
»;
graphic
y
1
i
i
y
id
i
4
b
V
b
y
;
>
y
character
i
*•»
-•*
L.
\
/
i
set(7bit
i
'->
l
i
1
X
D
*
if
code)
/•
i
i
i
u
1
i
■i
I
1
1
i
r
T
I
1
1
1
1
r-
L
1
J
fa.
-
J
kc
This
givesusthe
Character
A
f
1
_l
Note
the
reduction
ofAand1.In
field
consistsoftaking
a
white
dot
If
the
operating
memory
translation
screen
with
representation.
between
following
In
main
memory
0100
0001
1100
0001
00110001
10110001
from
seven
memory,
the
dot
black
andablack
systemisused,itautomatically
Both
PRINT
the
screen
conversions:
bit
ASCIItosix
the
8th
bitisusedtostore
pattern
memory
from
dot
withawhite.
and
direct
and
In
screen
memory
00000001 00110001
01110001
bit
gives
the
character
translates
input
the
main
from
memory.
8
the
effectofchanging
reverse
generator
the
the
field.
The
and
values
keyboard
from
resultinautomatic
the
order
reverse
reversing
ASCII
it,
replacing
into
the
screen
USEOFTHE
There
the
normal
As
and
are
appropriate
longasthe
the
memory
the
useofthe
however,
thatisbeing
shouldbedisplayedatthat
it
runs
the
The
second
enabled,
The
third
SCREEN
three
waystoget
MEMORY
memory
updatingofthe
PET
directly
PET
are
contending
only
during
screen
times
memory
givesavisual
passed
more
waytoget
the
character
approachisby
from
flashing
data
being
data
address
screenistoo
controls
for
when
effect of
the
particular
there
onto
useofthe
into
the
screen
the
desired
slow.
the
screen,
accesstothe
the
screen
memory.
translated
thereisno
memory.
memoryisnot
The
character.
apparent
The
routines
being
downtoabout40percentofthe
flashing
PETtothe
will
be.
the
struckonthe
dots,
because
screen
position.
memory,
Whenaprogram
screenisthe
keyboardisautomatically
PRINT
commandinBASIC.
the
screenisdisplaying
rather
keyboard.
firstoftheseisto
Thisisprogrammed
effect
used
speed
obtainable
from
in
the
PET
for
display.
the
change
withaPOKE.
the
than
the
character
pokestothe
Duringatime
displayedonthe
When
screen,
when
POKE
into
only
fact
that
the
This
slows
when
the
screen
The
character
that
the
faster
keyboard
input
screen.
screen
POKE,
is
is
typedtoBASIC,itresultsinthe
Thisisa
The
byaflashing
print
Whatisphysically
i/6othofa
computer
the
be
showninalternating
By
moving
of
the
controlofthe
printofa
next
positionatwhichacharacter
positioninscreen
literal
signal
calledacursor.
fieldinwhich
memory.
happeninginthe
second,aninterrupt
(the
PET)
and
stepsablinker
screen
memory
the
pointer,wecan
keyboard
and
keyboard.
pointerisreversedinthe
normal
some
software
next
line
all
willbedisplayed
The
cursorisa
machineisthat
to
the
PETisgenerated.
counter/When
and
reverse
print
output
called
PRINT
"ABC"
being
printed
ABC
characters
between
visual
everytime
This
this
8th
bit.
This
field,
givingasvisual
any
placeonthe
the
screen
editor,
as:
the
quotes
if
typedonthe
indication
generates
counter
causes
screen.
which
to
the
screenisrecycled,
a
reads
the
reference
effectofblinking.
Thisisdonebyusingacombination
manipulates
are
printed.
keyboardisindicated
the
userofthe
next
about
real-time
37,
the
clockonthe
character
character
screen
referenced
to
memory
under
by
NOTES
10
Chapter
3.
BASIC
KEYBOARD
UNIT
Whenever
keyboardtothe
Keyboard
keyisstruck.
program,
There
is
the
the
keyboard
The
is
similartothat ofatypewriter
However,
PET
The
the
upperorshifted
are
always
a
thin,
leftinplacetoprotect
peelitoffbyusing
the
blinking
screen
cursor
memory.
dataistransferred
Only
afteracarriage
and
thenawhole
are
two
exceptions
useofGET,
which
to
willbediscussedina
dataisaccessed
PET
keyboard
some
1.
Becauseofthe
number
2.
The
number
3.
The
various
4.
The
characters
longer
convenienttohave
5.
All
standard
available
keyboard
has
been
important
changes
high
pad
has
been
pad
has
keys
for
which
require
shifting.
them
characters
by
useofthe
consistsof73
characters
used
unless
transparent
oneofthe
plastic
film
the
the
sticky
appearsonthe
by
the
lineistransferred
this,
directly
optimized
soatouch
useofnumbers
addedtothe
allofthe
screen
are
normally
These
available
are
shift
keys,
displayedonthe
covering
keys
against
sideofa pieceofmasking
screen,
interrupt
returnisthe
neither
routinetothe
keyboard
at
once.
oneofwhich
later
using
for
have
machine
useasa
typist
does
been
made:
and
calculations
rightofthe
mathematical
movement
characters
unshifted,
keys.
including
and
the
shiftofthe
without
These
are
shifting.
so
thatacomplete
graphics
two
shift
editing
keyboardtobe
two
shift
keysispressed
the
keytop
scratching
which
during
the
computer
screen
data
causes
section,
language
computer
not
feel
with
main
keyboard.
operators
are
transfers
memory
transferred
the
cursortoblink.
and
the
programs.
keyboard,
totally
the
inaform
locatedonthe
numbersona
quite
often
usedinBASIC,
64-character
give
the
PET
keys,
either
oneofwhich
operational.
simultaneously.
shouldberemoved.
shipping.Toremove
tapesoastoavoid
data
from
the
each
timeanew
to
the
operating
Oneofthem
other
oneiswhen
though
the
organization
outofplace.
computer,
thatisnormal
standard
significant
a
calculator-like
for
numeric
pad.
keyboard
anditis
graphics
set
line
drawing
maybepressedtocause
Lower
Each
scratching
characters
key
has
This
protection
the
film,
carefully
the
BASIC.
no
is
ability.
was
keytops.
There
the
are
be
The
function
(the
throughtothe
the
The
routine
usingalefttoright
being
over,
Until
is
are64printed
same
keys.
obvious:
diplayedinreverse
reverse
shifted
like
keyisoperational
is
operational
reverse
characters
The
restofthe
carriage
key).
function
shiftofthe
keyboardisscanned
from
repeated8times
the
that
struck.
other.
the
CRT
controller.
scan.
keyboard
keyisreleased,noother
The
scan
later
scanned
on
the
keyboard
keyboard
returnorcursor
field-blackonwhite.
onamemory
untilitis
This
terminatedby
conceptofreversaloffunction,
keys,sothat
usinga6520
Each
The
keyboardisorganizedona
across
routine
the
keeps
keyisthen
consistsoffunction
right
and
basis.
the
complementary
PIA,afour
time
the
keyboard.Toimplement
the
final
keyboard
scans
consideredtobe
with64upper
characters.
left.
Reverseonallows
From
timetotime
a
RETURN
pressedorprinted,
up
functions
linetoten
interrupt
valueofthe
are
11
line
occurs
2 x5row
noise
last
acknowledged
the
next
case,orshifted
characters
Someofthe
all
subsequent
the
keyisstruck,
orbypressing
and
down,
are
usually
decoder
from
the
matrix
protection
scanina
key
right
and
combined,
and
the
interrupt
CRT,
the
keyboardisscanned
with
the
andNkey
buffer.
unlessalater
closure.
The
on
functions
characters
the
reverse-off
leftiscarried
with
one
being
matrix
roll
scanned
algorithm
key
does
to
not
~
^ ^
2
^k
«
a
iilljl
«
o
$
<Z
s
-1
1
CD
Q.
i
IS
Q.
CO
I
S
<D
(0
3
(C
o
AITT
M
a
12
give
classical
in
the
order
The
keyboard
BASIC,
of
for
The
is
All
bit8of
Once
queue.
characters
This
input
to
queue.
characters
that
the
normal
that
row.
shift
pressed,
key
closures
the
the
The
input
stack
determine
The
N
that
is left
checks
functions
keyisa
the
ASCII
hardware
keyboard
canbetransferred
queueisscannedbythe
maybescannedbya
whetherornotitis
keyboard
moved
key
roll
over
but
does
allow
they
are
struck.
scanning
for
the
of
special
software
are
translated
character
translation
queueisloaded
the
last
row,
stop
keytosample
scanning.
multiple
setsaspecial
The
user
key
ciosure
shift
usingaROM-based
whichisthen
is
done,
translated
the
every
to
the
screen.
GET
routine
user
program.
greater
than
queueislocatedat623-632.
down,
andaload
index
pointer
for
legitimate
which
contains
the
input
can
take
advantageofthisbyreading
I/O
andistreated
switch
encoded
timeanew
zero;
whichisusedtochange
look-up
table
into
the
valueistransferred
key
closureissensed
directly
The
decrementedbyone.
user
if it
The
to
allow
program
is,
that
first
character
rejection
the
device,
separately.
screen
of
noise
stop
key.
This
without
If
eitherofthe
for
the
key.
The
representation
intoa10
input
without
can
lookatthe
means
that
thereisdatainthe
maybetaken
and
trappingofthe
allows
the
routine
havingtoperform
the
input
two
the
decodeofthe
shift
keyisencoded
in
the
standard
character
andisunloadedassoon
goingtothe
pointeratlocation
screen.
keys
in
any
character
shift
keys
key.
into
way.
keyboard
as
The
158
keyboard
out;
all
subsequent
Thisisa
new
Both
interruptorwith
Whenever
first
cursor
repeated,
The
keyboard
carriage
the
typed
operating
An
printing
controltoBASIC,
keyboard
shift-run
RETURN"
runisautomatically
dangerous
key
closure
the
GET
the
level
enables
position.
tryingtokeep
second
operating
interesting
level
queue.
return.
system.
andacarriage
system.
outalinetothe
queueisthe
is
encountered,
into
routine,
could
and
keyboard
the
interrupt
screen
the
The
routine
flashes
Meanwhile,
After
trick
for
new
the
keyboard
transferredinthe
storeanew
editor
cursortoflash
the
the
the
carriage
The
returnissent.
the
screen,
line
LOAD/RUN
the
unless
writtenina
machine
value duringatime
input
routine
masked.
routineisoperational,
then
moves
keyboard
cursor
the
first
returnisprinted,
restofthe
more
advanced
forcingacarriage
numbers
sequence
routine
queue.
When
take
careofthat
a
special
and
writes
the
queue
and
translates
level
operating
This
allows
maybeentered
automatically
controlisreturnedtothe
proper
data
from
cursor
one
empty.
character
and
operating
programmeristo
whichisimplementedbythe
order.
system
this
routine
system
for
does
total
return
into
forces
language
that
automatically
the
stores
editingofthe
into
the
memory.
"LOAD,
with
the
interrupt
you
are
scanning
by
two-level
operating
keyboardtoscreen
further
characters
always
automatically
not
see
use
the
the
CARRIAGE
downinmemory.
from
watches
the
characters
line,
PETtowrite
keyboard
Another
keyboard
input
routine,
masked, because
and
changing
only
operating
systemisin
memoryatthe
the
keyboard
the
input
transfers
until
priortohandingitto
its
own
queue
and
exampleofthe
scan
RETURN,
the
load
the
queue.
during
play.
current
The
process
into
stream
the
they
then
program
RUN
followedbythe
for
entire
have
programs.
returning
useofthe
when
CARRIAGE
a
the
The
is
the
a
line
to
been
the
By
a
It
shouldbenoted
bad
effects
can
that
this
keyboard
happentoyour
system.
queueisonly
The
only
known
13
ten
characters
recovery
long
from
andifitisexceeded,
exceeding
this
dramatically
queueisto
power
the
system
keyboard
backonand
and
start
youdonot
over.
have
the
When
fooling
interrupt
with
turned
the
queue,
off,
the
remember
operating
thatifthe
systemisgoingtokill
useristypingonthe
you.
SCREEN
Typingonthe
the
until
understood
examples
To
follow
systemisgolingtointerpret
The
countered,
are
In
this
programming
and
does
The
done
the
EDITOR
keyboard,
screen.
you
This
getitright,
functionislikeasimple
while
but
the cursorisactive,
the
PET
withaPETtoillustrate
are
much
these
more
difficulttodescribe
examples,
two
concepts
the?the
second
treatedbyBASICascharacters
hit
make
first
this
line:
conceptisthat
section
carriage
you
mode).
return.Wewill
the
machine
thing
thatwewanttodoishave
with
your
whenwefollowa?bya
are
operating
BASICisexecuting
the
seeinthe
usefulasa
users'
guide.
transfers
lets
you
it.
The
computer
edit
user
are
necessary.
terminal
your
mistakes
should
thantosee.
follow
Oneisthat
sameasPRINT.
",all
that
you
will
wanttohave
computerinwhatisknown
each
instruction
future
super
calculator.
the
machine
that
like
thisisnot
typeasimple
However,wehopebynow
whatistypedonthe
which
discussions
requires
before
you
youtoretypeawhole
enteraline.
on
his
whenwetypea?
characters
printed
as a
printassoonasyou
the
after
the",
onto
the
direct
mode.
way
most
programs
message.
that
you
understand
keyboard
The
own
PET,asmanyofthe
the
until
screen.
(i.e.
rather
typeitinto
You
should
a
little
directly
editorisbest
BASIC
the
operating
next"is
than
the
are
operated.
have
better.Wetype
to
line
en
system
It
already
?"HI
THERE"
You
will
see
that
BASIC
a
keyonthe
next
character,
occurred,
Letustalk
?HI
THEREB.Whatwewere
For
thoseofyou
keys.Inordertoallow
previously
keyboard.
Ifwestrike
overstrike
outHITHERE
The
delete
want
from
keyboard,
and
nothing
theHITHERE
about
struck
of that
keyisthe
where
the
simplest
who
are
youtoimmediately
character.
the
delete
position.Wecan
PET, a blank
fundamental
you
are
key
respondsbyprintingHITHERE.Itshouldbenoted
the
cursor
appeared
touch
once,
and
moved
else
happened
almost
function;
tryingtotype
typists,
This
keyiscalled
you
line,
and
then
that
you
will
now
finish
READY.
editing
retype.
automatically
until
after
immediatelyonthe
is,
immediately
wasHITHERE
may
correct
the
see
that
typing
tool
which
Thisisthe
one
the
carriage
PET,
have
already
this
mistake,
delete
theBhas
key,
ET;
then
allows
simplest
placetothe
correctingamistake.
disappeared.
hit
youtostrike
right,
return.
screen.
butwehit
made
this
thereisa
locatedinthe
carriage
formofediting.Itis
key
return,
outasmany
that
each
timewestruck
allowingusto
When
the
mistake
Typing
the
carriage
Retype
characterBrather
with
the
which
upper
allowsusto
right-hand
thePresultsinan
causing
the
charactersasyou
implemented
typeinthe
return
the
line
than
P.
PETs
close
erase
a
sideofthe
PETtoprint
by
14
decrementing
pointer
striking
one
before
as
is.
character
you
it
does
organized
Because
the
character
deletes
line
There
movesitup
the
above,
are
the
screen
We
can
go
back
the
delete
see
to
so
of
the
40th
however,
three
and
key.
atatime,
it
blink.
overstrike
that
deleting
fact
that
at
the
beginning
character
thisisa
cursor
movement
down,
Notice
This
one.
and
pointer
and
from
and
erase
two
(2)ifyou
where
the
factsasyou
strike
phenomenon
Also,
notice
the
previous
the
characters
of
of
the
pretty
the
third
character
scan
the
line,
previous
slow
keys
on
your
key
you
are
by
one
and
READY
occurs
that
and
line.
wayofediting.
movesithome
that
are
striking;
fast,
the
because
the
PET
in
memory
from
right
then
striking
Just
keying
PET.
One
is
right
(1)ifyou
cursor
will
it
takes
wraps
moves
to
left
the
back
key
moves
(upper
striking
in
front
actually
15
around
in
40-column
delete
40
the
left-hand
a blank
of
our
cursor
strike
slowly,
move
times
as
the
screen.
the
pointer
chunks,
keyatthe
strokes
erases
cursor
corner)
over
where
by
just
the
cursor
several
long
The
back
right
and
characters
to
blink2characters
screen
over
for
example
beginning
the
READY
or
left;
the
clears
the
screen
continuously
will
move
memory
that
character.
is
deleting
of
the
line,
from
the
second
the
key
screen.
CURSOR
The
see
The
type
we
strike
moves
time.
achieved by
CURSORUPAND
The
same
positions
To cause
getsusbacktoour
Cursor
characters
SCREEN
We
can
PET
all
the
now
substituting
RIGHT
cursor
that
it
moves
cursor
that
four
it
the
Obviously,
cursor
visual
with
the
up
moves
EDITING
now
message.
characters
see
the
AND
right
key
us
left
key
times,
two
more
cursor
pointer
by doing
useofthe
DOWN
down
moves
effectasmovingitdown
the
cursor
cursor
the
lessinscreen
use
the
Once
to
deleteisactually
a
blank.
LEFT
moves
five
is
on
you
times,
the
columns
the
same
will
see
it
moves
one
character
this,
cursorupand
the
pointer
right.
to
move
up,
original
screen
cursor
you
the
position.
memory
memory
movement
are
there,
rightofthe
a
pointer
we
The
hold
matterofmoving
one
character
over.
It
accomplishes
key
as
the
cursor
that
now
we
are
us
around
less
are
able
down
40
columns
one
cursor
down
pointer
than
the
the
in
memory.
to
edit
keys.
to
lineonthe
is
now
the
shift
"up"
current
characters
you
can
now
delete
character
being
on
to
all
to
the
right.
If
this
by
changing
right
and
is
evoked
back
one
character
corner
the
the
40
of
the
previous
Going
screen.
right
screen.
the
same
key
while
characters
position.
get
up
theTby
deleted
the
characters
to
the
However,
from
its
Foranexample,
position
striking
from
in
position
striking
are
movedtothe
we
strike
by
to
left,
current
on
the
its
on
the
in
memory
it
now
the
cursor
shifting
the
right
line.
Cursor
it
moves
faster
editing
position.
try
the
screen,
cursor
up/down
current
the
secondHin
delete
key.
left
one
left
five
times,
pointer
prior
to
of
where
left,
of
one
character
can
This
spacing
but
down
position,
the
You
will
character.
one,
rather
you
in
memory.
striking.
we
If
started.
course,
at
often
be
gives
it
the
over
forty
one
line.
key once;
or
notice
this
rather,
HI
THERE
that
You
than
just
will
we
If
just
a
40
will
INSERT/DELETE
Before
any
concerned
starting
the
replaced
The
analyzing
single
left,
last
line
from
replacing
character.
character
may
with
the
the
insert
position
consistof40or80
characters
the
in
and
delete,weshouldbereminded
characters.
onaline.
of
the
cursor,tothe
character
the
lineisautomatically
preceding
Whenever
endofthe
the
blanked.
that
(See
sectiononscreen
the
delete
line,
cursor.
The
Insertisthe
15
the
screen
keyisstruck,
are
automatically
cursoristhen
reverseofthis
memoryisorganized
memory.)
movedtothe
Insert
allofthe
shifted
characters,
process.
such
that
and
delete
one
character
positionofthe
Ifwewant
are
to
to
fix
the
line
thatwejust
HERE.Inordertodo
the
shifted
which
than
one
right,
charactersonthe
positioned
in
the
noted
the
screen.
complete.
insert
key
saysHITHERE
character,
and
the
cursor
line.
over
theH,then
lineisautomatically
thatinno
time
Thisisbecausewehave
got
through
taking
theTout
of,weneedtoputaT
that,wehavetomakeaspaceinwhichtotype
withasingle
PET,
with
strike
the
pointstothe
For
example,ifwe
delete
handled
has
the
stroke.
the cursor
insert
key
more
first
characterofthe
ailofthe
andweendupwithaperfectly
computer
respondedtothese
not
yet
After
strikingT,you
blinking
hit
extra
pressed
over
than
once;
the
insert
Ts;wewill
carriage
will
the
first
characterofthe
this
moves
insert.
key
This
three
times,
then
see
commands,
returntotell
back
between
theT.To
note
accomplish
that
this
now
insert.Toinsert
all
the
charactersonthe
then
allowsusto
type
T's
until
that
the
back and
recomposed
other
message.Itshould
than
makingachange
the
PET
the
blank
and
this,westrike
createsascreen
more
linetothe
insert
that
several
the
cursor
forth
movement
the
line
is
is
the
be
on
Thatiswhywehave
and
the
screen
the
usertocompose
data,
whetheritbe
corrections.
What
You
LINESONA
Physically,
computer
data
canbeput
characters
allowing
Itisbest
SeeIsWhat
PET
a
lineonthe
business,
per
the
screentodefine
beginningofthe
COMETOTHE
next
line.
You
right
aboveisonly
The
thing
that
beginningofthe
continuation
uporcursor
PETtotheir
kept
whichisthe
positionisthen
Whenever
second
memory
line.
down
proper
scrolling
lineismaintained
locations
been
memory,
BASICorthe
SCREEN
many
into80columns
line,
the
line
AIDOFTHE
will
soon
consideredtobe a
allows
line.
This
occurs,
line
beginning
keptasa
occurs,
224-248.
talking
without
perfect
symbolized
You
screen
userisgiven
belowHITHERE,
see
the
Each
aboutascreen
interfering
text
and
handitto
user
program,toworry
by:
Get.
consistsof40
data
inputs
are
than
into
all
more
than40charactersasa
and
PARTY,wewill
the
screen
considers
40-column
PETtoaccomplish
line
hasamarker
pointeriskeptinthe
the
editor
number.Atany
pointer
the
until
examines
for
the
pointer
line
pointers
the
line
time
disappearsonthe
editor.
in
any
columnsofinformation.
organized
40.
Therefore,
the
flexibility
start
see
that
All
way
with
the
computer
for80column
ofan80-column
typing
after
thistobean80-column
line.
thisisthat
that
indicates
negative
while
first
telling
are
bit
the
statusofthese
the
complete
the
PET
movedupin
editingisaccomplished
the
restofthe
without
about
the intermediate
data
although
line.Ifwe
the
NOWISTHE
typing
theE,the
internally,
whetheritis
positionofthe
line
cursorison
line
whetheritis
suchaway
screen.
from
which
the
This
operating
the
programmer
stepsofmaking
However,
cards
and,ofcourse,
PET
screen
line.
Thisisaccomplished
move
our
cursor overtothe
TIME
FOR
ALL
spaceisautomatically
line
although
thereisa
index
tableofpointersatthe
the
beginningofa
pointer.
pointersinordertoinitialize
screen,
the
greaterorless
that
line
thereisa
cursor
the
conceptofthe
pointer
between
system.
traditionally
can
the
keyboard
This
allows
whoisusing
much
display
in
the
more
only
the
40
by
GOOD
theHITHERE
MEN
on
line
or a
TO
the
PET
Wheneveracursor
the
separate
operates.
than40characters.
tableislocated
The
screen
first
value
line
in
Now
thatweunderstand
insertatthe
the
cursorupand
(it
shouldbenoted
return,
beginning.Toprint
the
PET
prints
that
left,
until
that
this
NOWISTHE
the
PET
this
the
cursor
causes
the
TIMEontwo
can
allow80columns,
line,wehavetoputa?"atthe
blinksontheNof
charactersonthe
consecutive
16
letussee
NOW.Ifwe
linetoall
lines,
what
happens
beginningofthe
insert
twice,wecan
movetothe
spacesaline
right).Ifwe
and
whenwedo
characters.Wemove
then
now
types
READY.Ifwe
the
typea?"
carriage
goupand
the
carriage
even
basic
is
transferred,
apparentasyou
SCROLLING
Now
whenwetrytomove
baseofthe
we
attempttoprint
the
entire
Lines
screen.
istobe
the
screen
lineistobemoved
at
the
screenasit
printing,
makeachangeinthe
returninthe
though
ruleisthat
the
cursorisblinkingontheP,a
whenacarriage
line.Ifwe
whetheritbea40-or
useitwhen
writing
thatwehaveamixtureof40-and
the
cursor
screen.
screenupone
moveupon
Thisisaccomplished
scrolled
memory,
bottomofmemory.
was
the
cursorismoved
Hitting
past
the
the
screenbya
off
the
top,
and
the
off
the
when
you
the
next
thousandth
line.
in
the
bottom80characters
top,
the
The
cursorispositioned
triedtomove
automatically
middleofthe
spaceupto
returnisstruck,
80-column
programs.
80-column
off
the
bottom.Todo
cursor
character
one
lineortwo
hardwarebychecking
81st
character
41st
character
line,wecan
the
word
carriage
regardless
line.
Sophistication
linesonthe
this,wejust
down
causes
on
the
line
jump
the
throughtothe
of
memory
is
movedtothe
PARTY
return
the
automatically
the
cursor
to
down;orin
the
left-hand
see
thatitmakesnodifference
the
first
time
thatitisonthe
causes
of
screen;
entire
screen,
depending
top
line
thousanth
are
sideofthe
the
entire
whereitoccursinthe
in
using
linetobe
the
editor
line,
will
letusinvestigate
cursor
down
until
the
screentomoveupone
the
screen
on
pointer
filled
first,
etc.,
in
the
same
the
caseofa
editor
the
statusofthe
plus
character
with
blanks.Ifonlya40-column
automatically
one.Ifan
are
movedtothe
and40characters
position
at
carriage
bottom
line.
the
wherewehit
screen,
reprinted.
the
become
what
cursorisat
line.
top
lineonthe
80-column
are
now
The
entire
line
more
happens
the
Any
time
moves
line
top
of
blanked
bottomofthe
return
and/or
This
processistotally
bottomofthe
a
program
held
down
HOME
AND
Striking
the
screen
the
cursor
screen
The
moves
screen
providedtoallow
on
positions
PET
the
without
the
screen.
screen.
that
causes
while
printingisoccurring,
CLEAR
the
home
key
memory).
blinkinginthe
and
basically
screen
moves
data
having
movement
This
automatic
Thereisno
scrolling,
moves
Holding
upper
again
data
intoaprogram.
any
effectonthe
allows
the
andiscausedbyattempting
other
the
the
cursortothe
the
shift
left-hand
homing
from
the
around
entire
program
scrolling
the
control
speedonthe
scrolling
willbeslowerbya
upper
key
down
and
pressing
corner.
the
cursor.
keyboardtothe
This
program
the
screen
screentoactasan
Thisisaccomplished
Clearorhome
allows
the
thatisgoingtoreceive
andtoinsertordelete,aswellastype
to
print
over
the
movement.Aswe
PETistoo
left-hand
screen
user
cornerofthe
the
clear
canbegivenatany
and
then
the
flexibility
editing
place
carriage
fasttoread.Ifthe
factorof20.
key
by
moving
whenacarriage
of
the
for
returnorspace
will
see
screen
gives
makingacorrectiononthe
corrected
user-controlled
(the
first
youablank screen
blanks
into
placeonthe
returnisstruck
version.
over
off
the
whenwewrite
reverse
key
is
location of
with
all
thousand
screen.
Keys
are
any
character
input.
17
NOTES
18
Chapter
The
creative
figure
all
problems.
use
THE
A
computer
We
4.
combination
process.
out
instruction
the
PET
canbe-
This
book
the
PETasan
PRINT
will
STATEMENT
can
calculate
begin
our
of
instructions
Someone
sequences
except
whenitis
cannot
instrument.
numbers
discussion
to
solveaparticular
who
knows
to
allow
teach
youtosolve
all
of
BASIC
provided
day
BEGINNING
howtouse
solution
but
with
the
of
with
pre-programmed
your
particular
it
is
of
no
the
PRINT
BASIC
problem
computer
his
cannotbetaughtina
uses
problem.
All
problem.
value
unless
statement
for
text
his
intuition
that
we
softrware
It
can,
the
computations
that
reason.
or
careful
can
cover
-isa
tooltouse
however,
can
book.Itis
planning
in
this
book
for
teach
you
be
displayed.
a
to
and
solving
how
to
When
isaninstruction
this
isaninstruction
Itisusefultonote
it
which
contained
as
Unless
directedtothe
screen,
the
is
computer
characteronthe
typing
caseawordofgreeting.Onthe
writealine,
will
you
physical
accomplished
text,
to
to
print
print
the
in
the
next
can
write
down.
the
computer
built-in
under
the
PRINT
that
controlofBASIC
canbeabbreviated
the
computer
print
the
BASIC
'A1
andona
square
of 1024,afew
section.
has
been
screen.
representation
by
the
screen
automatically
screen.
scrolls
as?.A
PRINT
telling
productof1024
allows
second
ittodisplayonthe
other
hand:
PRINT
multiplied
youtoprint
line
print
PRINT
1024t2,1024f3
spaces,
The
point
hereisthat
instructed
The
characters
andaneditor
on
the
screenis25
automatically
the
otherwise
are
linesby40
folding
screenuponeortwo
statement
"HELLO"
1024
*8
*8.
more
than
'B',itis
and
then
you can
by
meansofCMD
printedinthe
whichiskeeping
suchasthis:
screen
one
possibletowrite
the
all
characters
valueata
cube
of 1024. Details
printasmany
next
trackofthe
characters,
over
the
41st
character
full
lines
whenitreaches
between
given
time.
Rather
the
line:
of
the
values
command,
available
the
printing
acrossaseriesoflines
all
print
print
positiononthe
screen
position.
ofupto80characters
onto
the
the
the
quotes-in
than having
exact
format
outputs
Although
next
line.
one-thousandth
is
are
The
The
command
character
print
variable.
position
automatically
characters,
return
extra
than
BASIC
no
If
the
notation.
the
and
afterB,a;(semicolon)
spaces,
seven
obeys
leadingortrailing
numberisless
number
PRINT
which
For
allows
If
the
dataispresentedinthis
followedbya
tabulates
prints
characters,
falls
'B'
followedbya
variable
the
following
characters
than
example,
between
has
two
major
for
printing
carriage
printing
is
'B'is
printed.
'B'
willbeprinted
roles
.01orgreater
.0034isprintedas3.4
these
forms
the
field
return.
'A'
startingatthe
carriage
used.
PRINT
The
cursorisleftatthe
after
for
printing
sent.Ifthe
thanorequalto999999999.2,
values,
the
under
(2)
the
controlofBASIC.
specified
form,
Data
return.Inordertocause
A;B;
spacing20characters,when
characters.
fieldtobe
E-03
most
after
the
print
the
fieldisprinted
presentedinthe
current
resultsinthe
and-1234567890.5
significant
19
screen
'A'
endofthe
When
the
fieldtobe
printedisa
9
digits
(1)
The
statement
startingatthe
form
PRINTA,B,
position
being
number,
are
then
BASICtonot
printed,
'B'
field.Ifthe
using
printedisa
BASIC
BASIC
is
printsitusing
printedas-J.2345678E
printed,
standard
has
spacing
then
PRINT
plusadecimal
print
single
endedinthe
current
then
send
variable
first
screen
BASIC
over
10
the
carriage
followedbyno
Aismore
AfB.
string,
checks
there
scientific
form
are
its
size.
+
09.
If
point
if
needed.
a
number
It
shouldbenoted
screen,
the
of
Trailing
(unlessitis
unlike
PET,
which
the
data
most
causes
screen
zeroes
after
the
decimal
printedasa
string).
thatinordertotake
BASICS,
being
the
apparent
the
screentoadvance
covered.
point
are
not
full
advantageofthe
space
between
the
screen
printed.
pointerbyone
BASIC
PET's
fieldsisalwaysaskip
always
abilitytocompose
character;
printsaskip
(cursor
it
character
text
materialonthe
right)
does
not
after
character
resultinany
in
Because
programmer
as
literals
compose
display
We
locatedatmemory
ASCII
is
the
When
characters
characters
screen.
representation
In
which
does
floating
VARIABLES
We
functions
intermediate
implement
of
programmingasa
thenabookonbeginning
Allofour
the
PET
allows
has
full
are
clear
screen,
fieldsofany
ableonthe
previously
PET
discussed
location
code,
concatenated
upper-lower
printing
into
for
The
BASIC,
numbers
are
represented
floating
point
have
already
and
case
to
the
the
screen
the
screen
clear
character
for
blankinallofthe
point
numbers.Infact,
print
routine
seen
then
can
valuesorperforming
programmingatany
valuesatany
discussions
one
variable.
the
inclusionofall
controlofthe
home
length
screen.
how
8000
with
bit.
screen,
the
memory
printer.
moves
are
represented
in
two
converts
that
the
print
time.Afunction
If
algebra,orperhaps
after
this
cursor
screen
cursor,
andinany
the
PET
print
cursor
size startinginany
screen
hexa-decimal.
two
additional
print
subroutine
form.
The
The
home
character
the
printer
1000
charactersonthe
as
5-byte
bytes.Asfarasprinting
BASIC
the
PET
canbeusedasa
the
results.
automatically
floating
However,inmany
operations
positioning
position.
right,
memory
The
left,upand
consistsofa
Characters
bits.
Oneofthese
in
the
operating
various
screen
moves
pointertothe
binary
quantities,
is
concerned,
converts
point
numbers
large
until
something
level,weneedtoestablish
that
can
have
any
valueisdefinedinboth
you
are
not
will
concern
familiar
with
the
oneofthe
themselves
very
with
as
literal
cursor
down.Byuseofthese
oneofthe
characters
control
characters
1,000
thousand
are
represented
bitsisa
system
control
the
characters
printer
in
reverse
automatically
pointertothe
beginningofthe
screen.
exceptinthe
BASIC
prints
integerstofloating
into
printable
calculator
cases,
which
programming
equalsacertain
the
useoffunctions
conceptofa
rudimentary
the
variable
textsonBASIC
useofvariables.
withinastring,
availabletouse
literals,
character
characters
screen
field
positions
of
storage
memoryinsix
and
the
second
translates
are
simply
movement
the
one
can
bit
one
ASCII
beginningofthe
screen,
special
characters.
performs
and
inserts
the
caseofintegers,
integers
the
sameasit
point
and
then
mathematical
the
consistsofdeveloping
value.Inorder
which
can
algebra
through
to
haveavariety
and
in
mathematics;
might
help
you.
In
BASIC,
it
hasnotrailing
different
variable
A
andA$are
from
alphabetic
ends
ARRAYS
Arrays
variables
character.
variable.
contains
AA,
etc.
character.
with%,e.g.A%.
are
the
alphanumeric
numeric
BASIC
fourth
are
definedbytwo
The
CharactersA1isathird
and
string
distinguishes
The
second
typeofvariable
character
characterAis
variable,
data,itis
values
a
character
definedasa
respectively
variablebythe
maybeeither
which
can be
alpha
numerics.Ifthe
consideredtobe
but
all
three
string.Astring
and
are
different
fact
that
the
numericoralphabetic.
definedinBASIC.
20
variableisa
the
variableA.CharactersAAis
are
definedasnumeric
variable
variables.
first
characterisalways
Arrays
numeric
values.Ifthe
now
ends
witha$.
AA$,
likewise,
An
integer
are
differentiated
variable
an
then
a
Thus,
is
different
variable
by
the
parentheses
usedinan
A(0,1)
referstothe
A%.
All
for
eachofthe
a
variable.
which
expression.
maybespecified
typesofvariables
follow
first
them.
character
in
the
Parentheses
in
the
second
same
program.
follows,
define
rowofa
Specific
but
first letusaddress
the
particular
two-column
definitions
value
some
withinanarray
array
andisdifferent
and
memory
examplesofhow
allocation
whichisto
fromA,A$
techniques
one
be
and
uses
Equal
mathematical
the
value
Originally
and
To
press
is
used
in
two
function:
right.
Otherwise,
inAwith
BASIC
maybeomitted.
understand
RETURN
when
the
resultant
required
A=2isequivalent
how
variables
after
each
CLR
?A
PET
prints
Now
A=2+2
?A
This
Now
?B
PET
prints
Now
B=2*A
?B
PET
prints
Now
A=2+3
?A
PET
prints5.If
?B
PET
prints8,the
saysB=
0.
type
time
PET
prints
type
0.
replace
the
8.
change
the
2*A,
the
4.
valueofB
valueofAbytyping
you
now
same
valueofB
ways:
If
encountered
the
valuetothe
following
of
the
the
word
leftofthe
a
variable
expression
LET
before
to
operate
command
with
type
valueasbefore.
will
in
BASIC,
you
twice
the
Untilwegiveanew
remain
8.-
in
an
IF-THEN
expressioniscompared
suchasin
to
the
any
LETA=2.The
try
enter.
valueinA,bytyping
type
of
the
expression
right.
variable
the
assignment,
command
following
expression
statement,
CLR
examples
equal
means
and
must
equal
A=2+2,=means
butinPET
sets
all
on
the
LETisoptional
variables
your PET.
forBor
re-execute
the
standardI'
the
value
of
replace
in
PETtozero.
Remember
the
one
the
to
which
r
f
JJ
_
I
|
^
\
I
U
ij
(J
|j
-,
^J
{
^
FLOATING
BASIC
variable
Four
bytes
9
digits
Each
less
thgan
STRING
A
string
character.
POINT
always
variable
assumes
is
assigned
containabinary
precision
is
also
-34
yield
VARIABLES
variable
Thereisa
can
VARIABLES
operation,
space
ofadecimal
specific
in'memory
representation
assigneda1-byte
numbers
containafunction,
or
operates
forastandard
number.
too
setofvariables
Accuracyofmost
exponent
smalltodistinguish
totally,
of
that
whetheritbeanumber,
that
in
floating
floating
precision.
limitedtohavingamaximum
from
allow
extraction
21
point
point
number.
It
givesusthe
calculations
zero.
graphics
and
arithmetic.
capability
is
limitedtothis
packingofdata
Therefore,
of
specifying
representation.
valueof+33.
character,
or
standard
into
each
normal
about
Exponents
ASCII
strings
which
willbediscussed
set of
INTEGERS
functions
Aswehave
with
five
bytes;
many
cases,
memory
PET
value
highest
efficiency,
has
implemented
between
bitofthe
later
on.
that
allow
indicated,
one
variables
an
for
particularly
the
minus
32,767toplus
number
The
stringislimitedtothe80characters
the
construction
integer
the
canbeexpressedinmuch
is
simplyawhole
exponent
and
in
the
caseofarrays
conceptofstoring
32,767
containing
the
of
stringsupto
four
for
certain
maybestoredinthe
sign.
of
the
255
characters
number.
the
simpler
which
Floating
mantissa,
numbers.Inordertoallow the
can
point
which
take
givesanaccuracyof9
significant
numbersastwo-byte
formofa
input
buffer.
(see
variables
Thereisa
later
text).
are
storedinBASIC
amountsofmemory,
integer
two-byte
values.
number
specific
digits.
user
most
Any
integer
with
the
In
the
USEOFPROGRAM
Throughout
PETtorespond
it
directly,
mode,wecan
divide
should
keyboard,
super
computer
program
working
commands,
debuggingorin
true
computing
direct
BASIC
Supposewewant
easily
very
simple.
byaline
the
text,
directly
aswetypeitfrom
use
the
the
resultbya
get
the
answerof2
except
calculator
programs.
canbeexecuted
correctly.
whenitisinthe
and
Break
againindirect
the
element,
mode
andaprogramisthat
will
execute
BASICtoprint
accomplish
number.Aline
thisina
Any
statement
AND
DIRECT
until
now,wehave
to
the
PETasa
STATEMENTS
print
statement.
the
keyboard
super
third,wecan
followedbya
processofexecuting
for
teaching
Variables
with
points
mode,
caseofusing
one
allofthe
program
number
with
can be
GOTO
canbeputinprograms
without
the
hastowrite or
several
statements
ourHITHERE
you
wanttobe
maybeany
been
using the
In
this
and
hit
calculator.
askitthe
For
question
READY.
the
PET,
the
assigned
statementstoassess
intermediate
program
case,
carriage
instance,
?(2+8)/5.Ifyou
The
PET
a
direct
and
havingtomodify
PETasa
but
not
super
loadaBASIC
statements
before
very
treatedbyBASICasa
number
calculator,
canbegrouped
asking
message
easilyina
the
from0to
technique
BASICisobeying
return.
Thisisso-called
ifwewant
will
obey
any
BASIC
program.Inadditiontousingitas
modeisquite
values
why
current
your
program.
user
vertically
direct
and
any
statusofvariables
main
in
ordertoget
The
for
control.
as
statement.
program
63,999.
which
the
the
PETtoadd
have
typed
statement
useful
then
small
particular
program.
difference
togetherinlogical
opposedtohorizontally.
Rules
statement
allowedusto
commandweare
direct
two
thatonthe
givenitfrom
for
debugging
sectionsofthe
pieceofcodeisnot
checked
However,
the
computertoactasa
between
order
for
program
mustbepreceded
get
giving
mode.Inthis
numbers
PET,
the
of
with
print
except
execution
for
and
then
We
entry
the
and
you
a
in
can
are
A
good
habittodevelop
1,2,3,
program.
To
to
Whether
tell
etc.,
use
All
you
printHITHERE,
start
with
line10and
30?'T"
40?"H"
50?"E"
60?"R"
70?"E"
you
are
the
PETtotakealookatwhat
when
typinginlinesofa
10,
20,
30.
This
will
give
you
needtorememberisthat
vertically,
typingina
each
lineofour
make
each
lineamultipleof10.
programorgiving
you
have
programisto
space
BASIC
typed
latertoadd
interprets
program
direct
and
22
use
lines
each
will
type
one
commands
act
like
accordingly.
increnments
and
make
line
numberinorder.
letterofthe
RUN,
you
The
of10or
corrections
message,weare
have
gottohit
lines
ten
100.
Instead
in
your
RETURN
through
seventy
of
going
to
Loading...
+ 128 hidden pages