Radio Shack Hardware Manual PC 3 Owners 19xx Tandy Text

User Manual: manual pdf -FilePursuit

Open the PDF directly: View PDF PDF.
Page Count: 289

DownloadRadio Shack Hardware Manual PC-3 Owners 19xx Tandy Text
Open PDF In BrowserView PDF
W0i

f^l'.t-

''2--iij

;

r:r
-

-p^

!

fife?'

r
!
••:f-'5i -

«^i^

lfe$3

Itllljii

lilM

IpJlli

l»if

«ifjt*.

j''*||fi$

®|li

l%i£-

jifft^

''sUNt

ppn Jiiillj

Hi;

SrunMI

*- J

:

il'i'"'r

r
.

M&ji.

.j^i-Jv

^

'.^
-

TRS-80 MODEL PG-3
m^s^H

fff»»H3$

isragsaii

frdu^wh

mi mm Ca hj

tmmmtth

l3j

fssaa

mmm
Fit

msm
i

earasQsiiBimcKiiDS 09
m m m n ra p n rS]
ijti

•^3Mjj fJfcMi^^gl

f?SiK^3f£i>3&

hs
^i||S^K»i8s

TERMS AND CONDITIONS OF SALE AND LICENSE OF RADIO SHACK COMPUTER EQUIPMENT AND SOFTWARE
PURCHASED FROM A RADIO SHACK COMPANY-OWNED COMPUTER CENTER, RETAIL STORE OR FROM A
RADIO SHACK FRANCHISEE OR DEALER AT ITS AUTHORIZED LOCATION

LIMITED
I.

WARRANTY

CUSTOMER OBLIGATIONS
A

CUSTOMER assumes

responsibility that this Radio

full

Shack software included with the Equipment
versatility,
B.

and other requirements

CUSTOMER assumes

Shack computer hardware purchased (the "Equipment"), and any copies of Radio
separately (the "Software") meets the specifications, capacity, capabilities,

or licensed

CUSTOMER.

responsibility for the condition and effectiveness of the operating environment

full

are to function, and for

of

its

in

which the Equipment and Software

installation.

RADIO SHACK LIMITED WARRANTIES AND CONDITIONS OF SALE
A.

For a period of ninety (90) calendar days from the date of the Radio Shack sales

SHACK

document

received

upon purchase

of -the

Equipment, RADIO

CUSTOMER that the Equipment and the medium upon which the Software is stored is free from manufacturing
WARRANTY IS ONLY APPLICABLE TO PURCHASES OF RADIO SHACK EQUIPMENT BY THE ORIGINAL CUSTOMER FROM
RADIO SHACK COMPANY-OWNED COMPUTER CENTERS, RETAIL STORES AND FROM RADIO SHACK FRANCHISEES AND DEALERS AT ITS
defects.

warrants to the original

THIS

AUTHORIZED LOCATION. The

warranty is void if the Equipment's case or cabinet has been opened, or if the Equipment or Software has been
subjected to improper or abnormal use. If a manufacturing defect is discovered during the stated warranty period, the defective Equipment
must be returned to a Radio Shack Computer Center, a Radio Shack retail store, participating Radio Shack franchisee or Radio Shack dealer
for repair, along with a

a defect

is

expense. RADIO
B.

copy

of the sales

document

or lease agreement.

The

original

CUSTOMER'S

sole and exclusive

limited to the correction of the defect by repair, replacement, or refund of the purchase price, at

SHACK

has no obligation

RADIO SHACK makes no warranty
paragraph. Software

is

is

remedy

RADIO SHACK'S

in

its

"AS

IS" basis, without warranty. The original

repair or

replacement within

thirty (30)

CUSTOMER'S

exclusive remedy,

in

Except as provided herein no employee, agent, franchisee, dealer or other person
of

is

in

this

the event of a

calendar days of the date of the Radio Shack sales

received upon license of the Software. The defective Software shall be returned to a Radio Shack Computer Center, a Radio Shack
participating Radio Shack franchisee or Radio Shack dealer along with the sales document
C.

the event of

election and sole

expendable items.

as to the design, capability, capacity, or suitability for use of the Software, except as provided

licensed on an

Software manufacturing defect,

to replace or repair

document

retail

store,

authorized to give any warranties of any nature on behalf

RADIO SHACK.

D

Except as provided herein,

E.

PARTICULAR PURPOSE.
Some states do not allow

RADIO SHACK MAKES NO WARRANTIES, INCLUDING WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
limitations

on how long an implied warranty

lasts,

so the above limitation(s)

may

not apply to

CUSTOMER.

LIMITATION OF LIABILITY
A.

EXCEPT AS PROVIDED HEREIN, RADIO SHACK SHALL HAVE NO LIABILITY OR RESPONSIBILITY TO CUSTOMER OR ANY OTHER PERSON
OR ENTITY WITH RESPECT TO ANY LIABILITY, LOSS OR DAMAGE CAUSED OR ALLEGED TO BE CAUSED DIRECTLY OR INDIRECTLY BY
"EQUIPMENT" OR "SOFTWARE" SOLD, LEASED, LICENSED OR FURNISHED BY RADIO SHACK, INCLUDING, BUT NOT LIMITED TO, ANY
INTERRUPTION OF SERVICE, LOSS OF BUSINESS OR ANTICIPATORY PROFITS OR CONSEQUENTIAL DAMAGES RESULTING FROM THE
USE OR OPERATION OF THE "EQUIPMENT" OR "SOFTWARE". IN NO EVENT SHALL RADIO SHACK BE LIABLE FOR LOSS OF PROFITS, OR
ANY INDIRECT, SPECIAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY BREACH OF THIS WARRANTY OR IN ANY MANNER
ARISING OUT OF OR CONNECTED WITH THE SALE, LEASE, LICENSE, USE OR ANTICIPATED USE OF THE "EQUIPMENT" OR "SOFTWARE".

NOTWITHSTANDING THE ABOVE LIMITATIONS AND WARRANTIES, RADIO SHACK'S LIABILITY HEREUNDER FOR DAMAGES INCURRED BY
CUSTOMER OR OTHERS SHALL NOT EXCEED THE AMOUNT PAID BY CUSTOMER FOR THE PARTICULAR "EQUIPMENT" OR "SOFTWAREINVOLVED.

«

not apply to

CUSTOMER.

LICENSE
RADIO SHACK SOFTWARE

,V.

RADIO SHACK grants

to

,

„.,

C

CUSTOMER may

CUSTOMER

SHACK

paid-up license to
a non-exclusn/e,

m

:

°;:
on one
r
use Software

: PUte

and

_

so

««

re ft

™

subject to
Software on one computer,

one or

mw .

^

tffe

following

-^^ — -«

^

«.

^

as

|$

;
spec folly
,

j&M

Software License to

-

r-i.*:from

state to state.

CUSTOMER

-

or to a

transacts

^^ ^^

w

— — — - - — ™™
•• "•

e

"

-""

"

Qf the

" "™

SERVICE POLICY
Radio Shack's nationwide network

and

reliable repair services for

Warranty service

will

all

of service facilities

of

be performed

Warranty. Non-warranty service

will

provides quick, convenient,

computer products, in most instances.
accordance with Radio Shack's Limited

its

in

be provided

at

reasonable parts and labor

costs.

Because

of the sensitivity of computer equipment, and the problems which can
from improper servicing, the following limitations also apply to the services
offered by Radio Shack:
result

1

any of the warranty seals on any Radio Shack computer products are broken.
Radio Shack reserves the nght to refuse to service the equipment or to void any
If

remaining warranty on the equipment.
2.

If

any Radio Shack computer equipment has been modified so

within manufacturer's specifications, including, but not limited

to,

that

it

is

not

the installation

any non-Radio Shack parts, components, or replacement boards, then Radio
Shack reserves the right to refuse to service the equipment, void any remaining
warranty, remove and replace any non-Radio Shack part found in the equipment, and perform whatever modifications are necessary to return the equipment to ongmal factory manufacturer's specifications.
of

3.

The cost for the labor and parts required to return the Radio Shack computer
equipment to onginal manufacturer's specifications will be charged to the
customer in addition to the normal repair charge.

^

CONTENTS
INTRODUCTORY NOTE
CHAPTER 1. HOW TO USE THIS MANUAL
CHAPTER 2. INTRODUCTION TO THE PC-3

...

7

"

^
^

g

'

'

"

'

"

Description of System

12

Description of Keys

^

-

Description of Display

ALL RESET

Button

17
.

19

Installing the Batteries

CHAPTER

3.

Start

Up

Shut

Down

23

USING THE PC-3 AS A CALCULATOR

"

*

24
"

Auto Off

Some

^

.... 23
'

'

24

Helpful Hints
.

25

.

Simple Calculations

26
'

Recalling Entries

.... 31

Errors

32
'

Serial Calculations

Negative

.

.

.

.

Numbers

Compound

Calculations and Parentheses

-

1

34
36

Page
Using Variables

in

37

Calculations

Chained Calculations

CHAPTER

39

•

CONCEPTS AND TERMS OF BASIC

4.

41
41

Numeric Constants
Scientific Notation

41

Limits

43

Hexadecimal Numbers

43
44

String Constants
•

Variables

Simple Numeric Variables

45
45

•

Simple String Variables

45

Numeric Array Variables

46

String Array Variables

47

Preallocated Variables

47

Expressions

49

Numeric Operators

49

String Expressions

•
-

51

Relational Expressions
Logical Expressions

•

52
55

Parentheses and Operator Precedence
Calculator

50

56

Mode
2

Page

56
Functions

CHAPTER

59

PROGRAMMING THE

5.

•

PC-3

59

Programs

59

BASIC Statements

59

Numbers

60

Line

BASIC Verbs

60
"

BASIC Commands

61

Modes

61

Beginning to Program on the PC-3

2
Example Example 3 Example 4 -

Example

1

Storing Programs

CHAPTER

6.

62

Entering and Running a Program

•

'

'

"

'
"

63

'

Editing a

Program

Using Variables

in

Programming

'

the PC-3's

"

66
"

6Q

More Complex Programming
in

"

•

•

70

Memory

73

SHORTCUTS

73
*
*

The DEF Key and Labelled Programs
ReSerVe Mode
Templates

CHAPTER

7.

'

74
76

•

_*

INTERFACE
USING THE PC-3 PRINTER/CASSETTE

Description of System

Introduction of the Machine

77
'

\\\\\\\\\

77
77

3

Page

Power

7^

Connecting the PC-3 Pocket Computer to the PC-3 Printer/Cassette Interface

81

Loading the Paper

83
85

Using the Printer

Using

Recorder

a Cassette

•

87

•

Care and Maintenance

90

Errors

9^

CHAPTER

8.

95

BASIC REFERENCE

96

Commands

97

Verbs
Functions

98

•

-

Pseudovariables

174

-

Numeric Functions
String Functions

CHAPTER

9.

*

•

183
.

187

PROGRAMMING EXAMPLES

187

Loan Payments

-

189

Sort
Slot Machine Simulation

Federal

/0

190
.

193

Tax Estimator

Relationship of
Minefield

Game

Two

Variables

198
,i30
•

201

Page

CHAPTER

10.

.

TROUBLESHOOTING

.

.

.207

'

Machine Operation

'

"

'

208

BASIC Debugging

CHAPTER

11.

MAINTENANCE OF THE

PC-3

211

POCKET COMPUTER

APPENDICES
213
Appendix A:

Error Messages

Appendix

ASCII Character Code Chart

B:

918

Appendix C:

Formatting Output

Appendix D:

Expression Evaluation and Operator Priority

Appendix

E:

Feature Comparison of the PC-1, PC-2, and PC-3

Appendix

F:

Specifications

223

234

'

'NDEX

237
"

PROGRAM EXAMPLES

*

'

'

M1

INTRODUCTORY NOTE
Welcome

Few

to the world of Radio Shack owners!

industries in the world

computing. Computers which
of dollars,

now

fit

in

today can match the rapid growth and technological advances being made
just a short

time ago would have

filled a

huge room, required

the palm of your hand, are easily programmed, and cost so

little

in

the field of personal

a Ph.D. to program, and cost thousands

that they are within the reach of nearly

everyone.

Your new Radio Shack PC-3 was designed

to bring

one of the most sophisticated hand-held computers

MEMORY SAFEGUARD

you

in

all

of the latest state of the art features of this computing revolution. As

the world today,

-the PC-3 remembers

it

incorporates

many advanced

stored programs and variables even

when you

capabilities:

turn

it

off.

Battery-powered operation for true portability.

AUTO POWER OFF

function which conserves the batteries by turning the power off

if

no

activity takes place within a

specified time limit.

Programmable functions which allow the PC-3 to be used

An expanded version of BASIC which provides
chaining and many other advanced features.
An

as a

"smart"' calculator.

formatted output, two-dimensional arrays, variable length strings, program

optional Printer/Cassette Interface (Model PC-3) for long-term storage and hard-copy printout of programs and data.

Congratulations on entering an exciting and enjoyable

new world. The Radio Shack PC-3

specific mathematical, scientific, engineering, business

and personal computing needs. With the Radio Shack PC-3 you can begin

NOW providing the solutions you'll

need tomorrow!
7

is

a

powerful tool, designed to meet your

CHAPTER
This manual

is

Whether you

1

HOW TO USE

THIS

*

^"

^

n
te
as a «' u
and features of your PC-3 and to serve
designed to introduce you to the capabilities
w.th the PC-3 by readmg
computers, you should acquamt yourse.f
time user" or an "old hand" with

are a

'first

and working through Chapters 2 through

6.

*

the PC-3.
Chapter 2 describes the physical features of

*

Chapter 3 demonstrates the use of the PC-3

*

MANUAL

as a calculator.

and
which are essential for BASIC programming,
Chapter 4 defines some terms and concepts
considerations of these concepts on the PC-3.

BASIC programming on

the PC-3, showing you

how

tells

you about the specal

to enter, correct, and run programs.

*

Chapter 5 introduces you to

*

more enjoyable.
using your new computer easier and
Chapter 6 discusses some shortcuts that make

programming.
Chapter 8

is

a reference section covering

all

the verbs,

commands, and functions of BASIC arranged

in

convenient alphabets,

groupings.
interesting programs that
Chapter 9 provides examples of useful and

PC-3.

illustrate

some

of the techniques of using

BAS.C on

the

If

you have never programmed

or

Lend

a

BASIC

class,

before

The remainder of the manual
*

Chapter 7

*

Chapter 10

*

Chapter

1 1

-

book on
BASIC before, we suggest that you buy a separate
This manual is not intended
trying to work through these chapters.

^7

in

m
^»^
2
how

B ^' C

h you
to teach

a
to program.

consists of:

Basic information

on the optional PC-3 Printer/Cassette

- A troubleshooting
- The

,n «

Interface.

programming problems.
guide to help you solve some operating and

care and maintenance of

your new computer.

provide
Detailed Appendices, at the end of the manual,

you with

the use and operation of the PC-3.

10

discussions concerning
useful charts, comparisons, and special

CHAPTER

INTRODUCTION TO THE

2

PC-3

The Radio Shack PC-3 Pocket Computer
system consists of:
*

52-character keyboard

*

24-character display.

*

Powerful

*

8-bit

*

2.2KB RAM.

*

Optional PC-3 Printer/Cassette

BASIC

CMOS

Interface.

in

24K ROM.
DEL

)

processor.

Figure

keyboard.

I

ElEJEJEJElElGDEllDli)

mOGDEJlUOElD

familiarize

„

[Qj0(ii0ri][ij0[bi£]0
P~»NP

SPC

To

M=l

ON

INS

(

you with the placement and functions of

parts of the

ENTER

PC-3 (Front View)

PC-3 keyboard, we

each.
For now, just locate the keys and read the description of

11

1.

'

In

Chapter

3,

will

we

now

study each section of the

will begin using

your new machine.

H
DEL

HO CD CD

INS

CD

[S]

i»

!

EJEl(|][R](T][7)[UJ[t]E][F]

EJE][£j|3[G][H](j](K)[r]g]

00EJEIEI00D
Figure

(A> CD

®
O

2.

Alphabet keys. You are probably familiar
with these keys
display, the characters always appear in
upper case.

PM

E

r ":

,°:.t

, a special; function.
has

,his

kev

is

nM

P++NP

from the standard typewriter keyboard

used *° indiM,e ,he e - d
°< •

On

the PC-3

-»— * «s.c «— *» «. „, w

SPC

P<

>NP

m^l

SPaCe key. Pressing this key advances the cursor,
leaving a blank space.
over a character erases that character.

mm

key.

When you

press this key, whatever

you previously typed
12

is

Pressing (spc) while the cursor

"entered

•

into the computer's

i
is

positioned

memory. This

key

is

simi.ar to the Carriage Return key

numeric input from the keyboard.

on

a typewriter.

Pressing

You must

G9

press

^^^^Z

PC-3 Pocket Computer
before pressmg th,s key will cause the

(HE)

calculations on the PC-3 printer.
to switch on and off the printing of

®

(def)

fSmFTl

key. This

CD

BASIC programs.

character above
key which has a character above it and the
Press this key before pressing any
keys on the PC-3 are in upper case)
used to capitalize letters as all alphabet

Not

Down Arrow

key.

program line. Pressing
Press this key to display the next

a left parenthesis.

Up Arrow

<±>

is

displayed.

key

(SHU©
(Note-

a special key used to execute

is

key.

program line. Pressing
Press this key to display the previous

@ft)

before pressing this key produces

(»

before pressing this key produces

a right parenthesis.

previously typed characters. Pressing
the cursor to the left without erasing
Backspace key. This key allows you to move
cursor is "on top of
key will DELete whatever character the
(SHJFT) before pressing this

DEL

.

fS

Pressing
erasing previouslytypec character.

the cursor to the right without
Forward key. This key allows you to move
cursor
directly before the character the
@jft) before pressing this key makes a space

I

,s

on top of

You

can

.

INSert new characters into this space.

HR)
«

$

"

%

The (brk) key temporarily
OFF turns the computer back on.

BREAK
#
&

key.

interrupts a

program which

row of alphabet keys.
These symbols are found above the top
symbols.
the character desired displays these
13

is

an
being executed. Pressing this key after

AUTO

key under
Pressing (sSEl) and then the alphabet

ON
RSV
PRO
RUN
OFF

.

Use
in

this

power

~ C9D CZD
QD
CA
(CL)

slide switch to turn the

any one of three modes:

Clear key.

Nurr| ber keys.

PC-3

RUN, PROgram,

ON

and OFF. Notice that the machine

The layout of these keys

Pressing Clear erases the characters

pressing this key activates the

CA

is

ON when

this switch

is

positioned

and ReSerVe.
is

similar to that

you have

(reset) function.

CA

just

typed

found on the standard calculator.
in

and "releases"

clears the display

14

errors.

Pressing

and resets the computer.

(shift)

before

„•

CD

•

•

Pros

I,.*

Mu „ ip ,io«ion
thiQ

,ov.

this

operator
k,v .0 include the division

P,. SS

,U

k ev.oioolode.e

in calculations.

o
«
Pr eSS m.

mU ,.,plio a tiooo F,r a ,orioo„oo, a

remind

SEE)

,ion,

and then
odd

this

key

will

« iB

character.
kpv disolavs the "less than"

>
character.
displays the "greater than"

operator
k ev to indude the addition

EXP

Addition key. Pre ss this
character used
dispiavs the exponentiation

C+3

V«
BUSY
BUST

P
r

".

«

S""i

These three characters

in scientific

n[f
»in
DEGRAD

|i"

-

T

F

'::.::.
s:'.:i

1

H

I

I™

I

«

and then

this

key

^

v

desired^^^^
E

SHIFT
i ,,

•

.3 !

»

.
! a a*

a

^^i^J^^J
5

Pressing

notatior,.

po.nt and 3 keys.
found above the zero, decimal

are

the symbol
and then thechar acter under
DEF

caption,

in

t

|

.

Display
Figure 4. Sample PC-3

right.

The

display consists of:

The prompt.

This symbol appears

when

the computer

replaced by the cursor.
15

is

awa.tmg input.

As you

press, the

nrompt
promp

disappears and

is

The cursor

This symbol (the underline)

typing, the'cursor replaces the prompt.
using

tells

As you begin
location of the next character to be typed in.
when
characters
certain
also used to position the computer over

you the

The cursor

is

the INSert and DELete functions.

when characters
a program, this indicator is lit (except
Program Execution Indicator. When the PC-3 is executing
from the d,splay
disappears
while the BUSY indicator is on. BUSY
displayed). The PC-3 will not undergo AUTO OFF
are

BUSY

when execution

is

completed.
print option
This indicator appears whenever you elect the

p

Printer Indicator.

DEF

Definable

DEGRAD

Angular Measurement Indicator.

OEG\
RAD

functions

Mode

Indicator. This

symbol

lights

when

using the PC-3 as a calculator.

up whenever you press the DEF key.

for the inpul
This indicator displays the current unit of angles

Depending on the mode

in use,

the display will read

DEC

(degrees),

RAD

(radians), or

*

^™ ^

GRAD

met

(grad,ents).

,GRAD/

SHIFT

Shift

Key

Indicator.

This indicator lights up

when

the

<§hjfj)

key has been depressed. Remember, the

must be released before depressing any other key.
E

Error indicator. Whenever an error

is

encountered,

this indicator

16

is

displayed.

(smFr)

key

RESET button

Figure

ALL RESET:

Reset button.

This button

is

used to reset the computer

5.

when CLear or CA

PC-2 (Rear Panel)

is

not sufficient to correct the problem.

NOTE
To

reset the PC-3, hold

This preserves

all

down any key on

the keyboard and simultaneously press the

RESET

button on the back.

programs, variables, and reserve memory.

Hold down
any key
Press the

RESET

button-

f

;

<^1I1H

ALL RESET

button with any pointed object

such as a Da ""P°' nt P en
Do not use easily broken
points such as mechanical pencils or the tips of needles.

4T^

-

PC-3 Pocket Computer

Figure 6

17

If

you

With

get no response

this operation, the

from any key, even when the above operation
program, data and

all

is

RESET button without any key.
the RESET button without any key

performed, push the

reserved contents are cleared

,

so

do not

press

unless the above trouble occurs.

RESET

button

Figure

PC-3

Turn the control
display,

Contrast Control

and turn

in
it

the direction of the arrow for a brighter
in the opposite direction for a dimmer

display.

Adjust

Figure 8.

18

it

so that the display

is

easy to see.

BATTERY REPLACEMENT FOR THE

PC-3

The PC-3 Pocket Computer operates on the lithium battery alone. When connected to the PC-3 Printer/Cassette Interface, the
PC-3 can also be supplied from the PC-3 Printer/Cassette Interface if it has enough power voltage and the lithium battery power
decrease. This minimizes the power consumption of the lithium battery.

When

replacing the batteries, these precautionary instructions will eliminate

•

Always replace both of the

•

Do not mix

•

Use only:

a

new

batteries at the

many problems:

same time.

battery with a used battery.

Lithium battery (type CR-2032) x 2

INSTALLING THE BATTERIES
The display

is

dim and

difficult to see

computer counterclockwise

as far as

it

when viewed from
goes.

the front, even after turning the contrast control on the right of the

This indicates that the battery power

is

depleted.

In this case, replace

promptly. (Using the optional PC-3 Printer/Cassette Interface peripheral equipment, record programs and data on tape

19

the battery
in

advance.)

(1)

Turn off the computer by
slide switch to the

(2)

Remove

Remove

power

position.

the screws from the back cover with a

small screwdriver.

(3)

OFF

setting the

(Fig. 9)

the battery cover by silding

direction of the arrow

shown

it

in

the

in figure 10.

Figure 9

Screw

Battery cover

Figure 10

20

(4)

Replace the two batteries observing the correct
polarity.

(Fig. 11)

Lithium Battery

Figure 11
(5)

Replace the battery cover by sliding
reverse direction of the arrow

(6)

Hook

shown

in

it

in

the claws of the back cover into the

of the computer proper.

the

figure 2.
slits

(Fig. 12)

Battery cover

(7)

Push the back cover

(8)

Turn on the computer by setting the power

in slightly

Then check the following

while replacing the screws.
slide switch to the

ON

position and press the

Prompt symbol
Figure 13. Sample Display

the display

is

On

Start-Up

blank or displays any symbol other than the prompt " y-

Then check the display

button to clear the computer.

display.

'

If

RESET

",

remove the

batteries and install

them

again.

again.

NOTE:
Keeping

a

dead battery may

result in

damage

to the

computer due to solvent leakage of the battery.

promptly.

CAUTION: Keep

battery out of reach of children.

22

Remove

a

dead battery

CHAPTER
Now

that

you

capabilities of

3

USING THE PC-3 AS A CALCULATOR

are familiar with the layout and

will begin investigating the exciting

your new computer.

Because the PC-3 allows you the
(useful in

components of the Radio Shack PC-3, we

more complex

full

calculation),

range of calculating functions, plus the increased
it

is

commonly

referred to as a "smart" calculator.

power of BASIC programming

abilities

That, of course, makes you a "smart"

user!

(Before using the PC-3, be sure that the batteries are correctly installed.)

Up
To turn ON
Start

the PC-3, slide the power switch up and select one of three modes:

PC-3 must be

Shut
To

in

the

RUN

mode. When the machine

is

ON,

the prompt

(»

will

RUN, PRO,

or

RSV. For

use as a calculator, the

appear on the display.

Down

turn

OFF

the PC-3, slide the power switch to the

OFF

position.

When you turn OFF the machine, you clear (erase) the display. However, the PC-3 does remember all programs, reserve keys, and
mode settings which were in use when the computer was turned OFF. All of these settings are still in effect when the machine is
turned back ON.
When the BEEP instruction or CLOAD command is executed, stop the execution by pressing the (brk) key and slide the power
switch to the

OFF

position.

23

1

Auto Off
r

aner

W6ar the " C - 3 aUt0matical| V P°wers down
when no keys have been pressed for about
OFF while you are executing a program.)

"
w T'rl ZT-n not AUTO

min°ut (Note: The PC-3
minutes.

*' """""*'
occurred"

Some

will

^

'"

AUT° 0FF

vou

rjzzs~ retakes.
:r r
For now,

The

'

^ ^^M
*'

hine

rect thes

'

you
if

are

you

be 6XaCtly as the
*

bound to make mistakes whne entering data
get an Error Message, press

«•» when

-

Lat

- - *«»

CLear and retype the entry.

- you cannot get to respond at all - press the ALL RESET button (See Chapter
PROMPT (» tells you that the PC-3 is awaiting input. As you
enter data the

the

AUTO OFF

If

«™ - P

<*«»«

.e

the computer "hangs

it

right

()

and

left

G*)

arrows move the cursor within a

^JuS^pmq^S I™
BY

UP^DN

^^^

3re finiSh6d

THECOMAS

emering

When performing numeric

calculations, input appears

When

key

using the

GEE®

(Sjjg)

in

2)

prompt disappears and the

to the right, indicating the next available
location in the display.

The

"""^ Wi "

1

Helpful Hints

Wat' to co
ways
up

'

CURSOR

<-) moves

line.

"^ and Si9nalS the COmpUter to P erform the ind '^ed operations
""*

on the

left

" "^ ° R Y0UR CALCULAT,0NS WILL ^ BE ACTED
of the screen, the results appear on the right
of the display.

conjunction with another key (to access square
root, for example), press
^ft) is active for only one key at a time.

key, then press the other key.

24

@jf£)

release the
-

Do not

use dollar signs or

commas when

meanings
entering calculations into the PC-3. These characters have special

in

the

BASIC

programming language.
manual we use the

In this

To

to indicate zero, so that you can distinguish between the

help get you started entering data correctly,

(shift)

is

produce the

used,
(

we

will represent

we

will

number

show each keystroke necessary

the desired character

in

the following keystroke.

QD

character. These keystrokes are written (shift)

(0)

and the

letter (0).

to type in the example calculations.

For example, pressing

(shift)

and

When

CD

will

.

calculations).
Be sure to enter CLear after each calculation (unless you are performing serial
memory.
computer's
the
in
stored
the error condition. It does not erase anything

CLear erases the display and

resets

Simple Calculations
ten-digit precision.

The PC-3 performs calculations with
in

the

RUN

mode.

Now try

If

you have not already done

these simple arithmetic examples.

ON

your computer by

to CLear between calculations.

Display

Input

CA)C03(+3CA)C0D

Remember

so, turn

(ENTER

100.
)

50.

(T3CE)CE)Q CADC03 (§NTEg)
C1D C0D C*3 (3D C0D

(iNiEg)

C3lC0)C0)CDC5r)

(ENTER)

600.
60.
25

setting

it

QQD

QDCE)

(SHIFT)

CD®

(SHIFT) (71) (ENTER

(SHIFT)

CZ3

(A)GD

100.

(ENTER)

6.

283185307

)

(ENTER

)

Recalling Entries
Even after the PC-3 has displayed the
right

(}

The

left

The

right

your calculaiton, you can redisplay your

last

entry.

To

recall, use

the

left

G*)

and

arrows.

arrow

Q^)

recalls

arrow (+^)

Remember
in

results of

that the

the

recalls

left

and

last

entry with the cursor positioned over the

last character.

the entry with the cursor positioned "on top of" the

first character.

right arrows are also used to position the cursor along a line.

The

right

and

left

arrows are very helpful

editing (or modifying) entries.

You

will

become

familiar with the use of the right and left arrows in the following examples.

and perform the calculations

As the head of personnel

in

as

we

Now, take

the role of the manager

discuss them.

a large

marketing division, you are responsible for planning the annual sales meeting.

300 people to attend the three day conference.

For part of this time, the sales force will

26

meet

in

small groups.

You

You expect
believe that

groups of

six

.

would be

a

good

size.

How many

groups would this be?

—

Display
- -

.

Input

50.

CD C0) CE CZ3 CS (Inter)
On second throught you
entry using the

C^D

number of participants might be more effective.
decide that groups containing an odd

last

Display

300/6_

s>
ca,cu,ate the

new number

Because you recalied the

last

the cursor one space to the

of groups

replace the six with an

you must

entry by using the

S>

.

the cursor

is

positioned at the end

to

make

of the d,s P lay.

™"™*£ m
Use the

S>

to

™
move

Display

3

Notice that after you
it

odd number. Five seems

left.

Input

character,

your

.

Input

To

Recall

will

move

the cursor

it

becomes

a

flashing block

be displayed as the flashing cursor.
27

00/1

1. Whenever you

position the cursor "on top of" an existing

Type

in a

original

is

5 to replace the

6.

One caution

gone forever! You cannot

recall

in

replacing characters

-

one you type

a

new

character over an existing character, the

an expression that has been typed over.
Display

Input

300/5.
60.

Sixty seems like a reasonable
Recall

is

also useful to verify

had performed

number
your

of groups, so

you decide that each

last entry, especially

when you

small group will consist of five participants.

results

do not seem to make

sense.

For instance, suppose you

this calculation:

Display

Input

6.

GDQDGQGD dHlIE>
Even

a tired,

overworked manager

reds of people!

Input

Recall

like

you

your entry using the

realizes that

6 does not seem to be

Q^D
Display

®

10/5
28

a reasonable result

when you

are dealing with

hund-

Because you recalled using the
entry,

you need to

insert

()

,

another zero.

the flashing cursor

Using the

()

is

,

now

positioned over the

move the

cursor until

INSert, position the flashing cursor over the character before which you wish to

it

first

is

make

character

in

To correct this
When making an

the display.

positioned over the zero.

the insertion.

Display

Input

31/5

 CD CD C1D ^nter)
The

results

Recall

seem much too

your entry using the

large.

(])

If

you only have 300 people attending the meeting, how could you have 600 "small groups'?

.

Display

Input

1000/5


0^)

or

of saying.

or

(}

"I

don't

know what

.

C*^) key, the flashing cursor indicates the point at which the computer got confused.

wonder, you have too many operators! To correct

this error, use the

Input

And no

DELete key.

Display

(shift ) (del) (enter

When

way

G*3

300/15

Whether you use the

upon

simply the computer's

Display

Input

If,

is

your entry using either the

recalling

60.

)

your entry

after an

ERROR

1,

you

find that

you have omitted

using the PC-3 as a calculator, the majority of the errors

plete listing of error messages, see

APPENDIX

you encounter

a character, use the

will

be

ERROR

1

INSert sequence to correct

(an error in syntax).

For

a

it.

com-

A.

Serial Calculations

The PC-3 allows you to use the

You
rence
total

results of

one calculation

as part of the following calculation.

are planning a special conference and are expecting
is

to

draw up

a

detailed budget for approval.

300 people to attend.

You know

Part of your responsibility in planning this confe-

that your total budget

budget:
32

is

$150.00 for each attendant. Figure your

Display

Input

r^)(W)CW)C*T)CT)C5-)CW)
Of

this

amount you plan

to use

15%

45000.

(ENTER)

for the final night's awards presentation.

cessary to retype your previous results, but

DO NOT

CLear between

What

is

serial calculations,

it is

not ne-

the awards budget?

Display

Input

CSOQDOD
Notice that, as you type
at the left of the screen

45000.
in

the second calculation (*. 15), the

and includes

always, you end the entry with

NOTE: The (%) key

it

(enter

)

can not be used

Example: 45000

C*D

15

in

the

new

calculation.

*.

15_

computer automatically displays the result of your first calculation
In serial calculations, the entry must begin with an operator. As

.

in

the calculation. The (j%) key should be used as a character only.

(shift)

(%) - ERROR

1

Display

Input

(ENTER

entries.)

(When performing

6750.
)

Continue allocating your budget. The hotel

will cater

your dinner for $4000:
33

Input

Display

6750. -4

OODC03CI3C0D
(ENTER

2750.

)

Decorations

will

be $1225:

Input

Display

GDCT)CT)C^)C5l (ENTER)
Finally,

you must

allocate

$2200

1525.

for the speaker and entertainment:

Input

Display

CDC2)CW)CW) (ENTER)

-675.

Obviously, you will have to change either your plans or your allocation of resources!

Negative Numbers
Since you want the awards dinner to be really special, you decide to stay with the planned agenda and spend the additional money.

34

However, you wonder what percentage of the

total

budget

will

be used up by this item,

First,

change the sign of the remaining

sum:
Display

Input

® CZ)QD

-675.

*-1_
675.

(ENTE R)

Now

add

this result to

your

original presentation budget:

Display

Input

C+)

7425.

C© CD CA3 C0D (ENTig)

Dividing by

45000

gives

you the percentage of the

total

budget

CVJ(^)CT)CW)CW)CW)
you decide

new

figure represents:

Display

Input

Fine,

this

to allocate

16.5%

0.165

(enter)

to the awards presentation.

35

Compound
In

Calculations and Parentheses

performing the above calculations, you could have combined several of these operations into one step. For instance, you might

have typed both these operations on one

line:

675+6750/45000

Compound

calculations, however,

675+6750/45000 might

must be entered very

carefully:

be interpreted as

^
675 +

675 + 6750

6750

c

45000

45000

When performing compound calculations, the PC-3 has specific rules of expression evaluation and
DIX D). Be sure you get the calculation you want by using parentheses to clarify your entries:
(675+6750) /45000

To

illustrate the difference that the

or

675+ (6750/45000)

placement of parentheses can make, try these two examples:

Input

(shift)

operator priority (see

Display

CD® CT) CED t±) CE (U d3 (0D

dHUS CD

O

C33 C£> (3D CE> (3D

0.165

ds®

36

APPEN-

CD CD CD CD (shift) CD CD CD CD (D
CD CD CD CD CD CD dmED (D (§nt|^
Using Variable
The PC-3 can

in

store

Calculations
up to 26 simple numeric

variables under the alphabetic characters

cept of variables, they are more fully explained

A

5

B

-2

You can

675. 15

also assign the value of

one variable

in

Chapter

(right) to

4.

You

A to

Z.

If

you

are unfamiliar with the con-

designate variables with an Assignement Statement.

another variable

(left):

C = A+ 3
D = E

A

variable

Now

may

be used

in

place of a

number

in

any calculation.

You wish to allocate
you have planned your awards dinner, you need to complete arrangements for your conference.
Assign a variable (R)
available.
still
is
money
much
how
of your budget by percentages also. First you must find out

that

the rest
to be the

amount

left

from the

total:

Input

Display

GD®CIDCE)CECE)C!DCE)CZ)C5D

R=45000-7425_
37

(ENTER

37575.

)

As you press

(enter)

the PC-3 performs the calculation and displays the

any variable by entering the alphabetic character

it is

(ENTER

You can

display the current value of

Display

37575.

)

You can then perform
You wish

value of R.

stored under:

Input

CW)

new

to allocate

calculations using your variable.

60%

of the remaining

Input

money

to

The value of

room

(R) will not change until

you

assign

it

a

new

value.

rental:

Display

R*. 60.

CBDC*3CZ)C63(S

22545.
Similarly,

you want

to allocate

25%

of

your remaining budget to conduct management training seminars:

38

Display

input

CD

® CD O
(X)

9393. 75

dSHD

Variables will retain their assigned values even

if

the machine

is

turned

OFF

or undergoes an

AUTO

OFF.

Variables are lost only

when:

*
*
*
*

You

assign a

new

value to the

same

variable.

You type in CLEAR (ENTER (not the CLear
You clear the machine using the ALL RESET
)

key).

button.

The batteries are changed.

There are certain limitations on the assignment of variables, and certain programming procedures which cause them to be changed.
See Chapter 4 for a discussion of assignment. See Chapter 5 for a discussion of the use of variables in programming.

Chained Calculations
In

addition to combining several operators

the other

-

without having to press

of the final calculation
including

(enter

)

is

displayed.

in

Center)

one calculation, the PC-3 also allows you to perform several calculations one after
before moving on. You must separate the equations with commas. Only the result

(Remember, too, that the maximum

line length

accepted by the computer

is

80 characters,

.)

You wonder how much money would

have been available for rooms

awards dinner:

39

if

you had kept

to your original allocation of

15%

for the

Input

Display

CS

©CDS) (X)C*DC©CD®®

C0D

(srjft)

R=. 85*45000

mtinGonore^rpi

Although the computer performs

all

the calculations

in

the chain,

Input

(ENTER

To

it

,

R*.60.

displays only the final result.

Display

22950.

)

find the value of $ used in this calculation, enter R.

Input

QD
Now

It's

Display

38250.

Center)

Your Turn

The concludes our discussion of using the PC-3
capabilities

and special features, you

But calculating
of the

BASIC

is

only one of the

language, as

it

is

will find

many

as a calculator.

many new and

Undoubtedly,

potential uses of the PC-3.

used by the PC-3.

as

you become more

familiar with

your machine's

useful applications for this "smart" calculator.
In

the next chapter

Then you can begin
40

to create your

we

will

examine the concepts and terms

own, unique, problem-solving programs.

CHAPTER
chapter

In this

when used

we

CONCEPTS AND TERMS OF BASIC

4
will

examine some concepts and terms of the BASIC language. Because the PC-3 uses many features of BASIC

as a calculator,

of these concepts are also useful for advanced calculator functions.

some

Numeric Constants
In

Chapter 3 you entered simple numbers for use

in

calculations, without worrying

represented, or the range of numbers that the Radio Shack PC-3 can process.

more about how this computer

of you, however,

may need

to desire to

know

uses numbers.

The Radio Shack PC-3 recognizes three

*
*
*

Some

about the different ways that numbers can be

different

ways to represent numbers:

Decimals.

Exponential or scientific notation.

Hexadecimal numbers.

Decimal numbers are familiar to most of you. Scientific notation and hexadecimal numbers

may

require

some explanation.

Scientific Notation
People

who

In scientific

The
is

in

first

need to deal with very large and very small numbers often use
notation, a

number

is

broken down into two

part consists of a regular decimal

powers of

a special

format called exponential or

scientific notation.

parts.

number between

1

and 10.

The second

part represents

how

large or small the

number

10.

As you know the

first

number

to the left of the decimal point

in a regular

41

decimal number shows the number of

1's,

the second

shows the number of

10's, the third

the number of 10's, and the fourth the number of 1000's. These are simply increasing powers

of 10.

10 =1,

10

1

= 10,

10

Scientific notation breaks

number

is

2

= 100,

down

a

10

3

= 1000,

etc.

decimal number into two parts: one shows what the numbers are; the second shows

to the left or right of the decimal point.

1234 becomes 1.234 times 10 3

how

far a

For example:

(3 places to the right)

654321 becomes 6.54321 times 10 5 (5 places to the right)
.000125 becomes 1.25 times 10" 4 (4 places to the left)
Scientific notation

87 zeros! But,
1.0 x 10

is

useful for

in scientific

87

The PC-3 uses

many

shortcuts.

notation this

scientific notation

symbol, the

number looks

it

would take

IE,

to

mean "times

is

displayed as 1.23456789

.000000000001

is

displayed as

show

1.0 times 10

87

-

a

1

and

1.

E

IE

large to display using

decimal notation.

This computer uses a

ten to the":

12

-12

are unfamiliar with this type of notation should take

numbers to note how they

a lot of writing to

like this:

whenever numbers become too

1234567890000

Those of you who

see that

1.0 E 87

or

special exponentiation

You can

are displayed.

42

some time to put

in a

few very

large

and very small

Limits

The

largest

number

number which the PC-3 can handle

is

ten significant digits, with two-digit exponents.

In

other words, the largest

is:

9.999999999 E 99 = 9999999999000000000000000000000000000000000000000000000000000000000000000000000

and the smallest number

is:

9.999999999 C -99

=

000000000000000000009999999999

Under certain circumstances, when numbers
special limits

ground

will

under which

imposed on the

size of

will

be used frequently, the PC-3 uses a special compact form.

numbers, usually either

to

65535 or

-32768

to +32767.

recognize both these numbers as the largest range which can be represented
this

form

is

used are noted

in

Chapter

in

In

these cases there are

Those with some computer back-

16 binary

bits.

The circumstances

8.

Hexadecimal Numbers
Another which has become quite important when
numbers,
using computers is the hexadecimal system. The hexadecimal system is based on 16 instead of 10. To write hexadecimal
~ 9 and 6 more "digits": A, B, C, D, E, and F. These correspond to 10, 11, 12, 13, 14, and 15. When
you use the familiar

The decimal system

is

only one of

many

different systems to represent numbers.

43

you want the PC-3

to treat a

&A

= 10

&10
&100

= 16
= 256

&FFFF

= 65535

number

as

hexadecimal, put an ampersand (&) character

Those with some computer background may notice that the
group of

limits discussed

applications where

it is

in

the

last

paragraph.

last

number (65535)

Hexadecimal notation

is

is

in

front of the numeral:

the same as the largest

never required

in

number

in

the special

using the PC-3, but there are special

convenient.

String Constants
In

addition to numbers, there are

many ways

that the Radio Shack PC-3 uses letters and special symbols. These letters, numbers,

and special symbols are called characters. These characters are available on the PC-3.

1234567890
ABCDEFGHI JKLMNOPQRSTUVWXYZ
!"#$%&()*+,-.
;< = >?@y ~7T^iE
r

/

In

BASIC,

of

a

a collection of characters

program, such

The following

are

as verbs or variable

examples of

is

:

called a string.

In

order for the PC-3 to

tell

the difference between a string and other parts

names, you must enclose the characters of the string

string constants:

44

in

quotation marks

(").

"HELLO"

"GOODBYE"
"RADIO SHACK
The following

PC-3"

are not valid string constants:

"COMPUTER

No ending quote

"ISN'T"

Quote

can't be used within a string

Variables
In

are

addition to constants, whose values

do not change during

names used to designate locations where information

is

a

program, BASIC has variables, whose values can change. Variables

stored.

These variables are

like

the letters used

in

algebraic equations.

Just as there are numeric and string constants, there are numeric and string variables.

Simple Numeric Variables
You have

are used to store a single

A

when working with the PC-3
designated by a single letter (A— Z):

already used simple numeric variables

number and

are

as a calculator in

Chapter

3.

Simple numeric variables

= 5

C = 12.345
Simple numeric variables

may

take the same range of values as numeric constants.

Simple String Variables
String variables are used to hold strings

(a

collection of characters).

45

They

are

named by

a single letter

followed by

a dollar sign:

A$
C$

A

string variable

first

may be from
When a string

7 will be saved.

to 7 characters long.
variable

empty, or

is

If

its

you

length

try to store
is

zero,

it is

more than 7 characters
called

NUL

or the

NUL

in a string variable,

only the

string.

Numeric Array Variables
For some purposes

it

is

useful to deal with

groups are called arrays.
designated

in

numbers

as

an organized group, such as a

array can be either one-dimensional, like a

list,

list

of scores or a tax table.

or two-dimensional, like a table.

the same manner as simple variable names, except that they are followed by parentheses.

are referred to
a

An

by

a

number

inside the parentheses;

when

the array

is

The

B

The element

(3,2)

fifth

element of

Arrays are created using the

in

DIM

a

one-dimensional array A.

the third row and second column of a

verb or

command. To

Note that DIM X(5) actually creates an array with

X(0)
Similarly

DIM

X(1)

X(2)

X(3)

Y(2, 2) creates an extra

X(4)

two dimensional B

create an array, give

DIMX(5)
DIM Y (32)
six entries:

X(5).

row and an extra

column:
46

BASIC

these

The elements of an

array

two-dimensional, there must be two numbers separated by

comma.

A (5)

In

Array names are

its

name and

array.

its size.

Y(M)

Y(0,1)

Y(0,2)

Y(1,0)

Y{1,1)

Y(1,

Y(2,0)

Y(2,1)

Y(2,2)

2)

This extra element, or row and column,

you

might total the elements of the

The form and use of the DIM verb
Note:

The

A

X

is

is

often used by programmers to hold partial products during computations.

array by

covered

summing them

in detail in

Chapter

8.

element and does not need to be DIMensioned

array does not have the extra

For example,

into X(0).

(see section

below on Preallocated

Variables).

String Array Variables
String array variables have the same relationship to numeric array variables as simple string variables have to simple numeric variables

—

their

C$(5)

names

are the

The

same except

fifth string

element

for the addition of a dollar sign:
in

the array

With string arrays, the length of each string

will

C$

be 16 characters unless you specifically choose a different length

in

the

DIM

statement.

DIM X$(12) *8

DIMensionsa

Chapter 8 details the use of the

DIM

string array with 12 elements, each a string

8 characters long.

statement.

Preallocated Variables

Some

of the variables which you will use most frequently have already been allocated space
47

in

the PC-3's

memory. Twenty-six

A-

locations are reserved for numeric variables

or string array A$(26).

Num.

Loc.

Z$, numeric array A(26),

Nu m.

Str. Var.

Arr. Var.

Sti'. Arr.

Var.

1

A

A$

A(1)

A$(1)

B

B$

A(2)

A$(2)

3

C$

A(3)

A$(3)

4

C
D

D$

A(4)

A$(4)

23

W

w$

A(23)

A$(23)

24

X

A(24)

AS (24)

25

Y

x$
Y$

A(25)

A$(25)

26

Z

z$

A(26)

A$(26)

you use

number

)

make A(
will

are only

location

24

twenty -six locations and you must be careful not to use the same location
to store a numeric value in

A(24) and then store another number

in

The A(
26 on

Var.

A$ -

Z, string variables

locations are assigned as follows:

2

NOTE: There
If

The

and A$(

)

A$(

)

)

or

be stored

from

arrays are different
larger than
in a

locations are not cleared

26 but,

if

a

then try to print X$, you

X, you will over-write the

other arrays

you do, the

different part of the

when you RUN

all

X and

in

first

—

two

number, but you

will

It

will use the reserved locations

that

you

will notice this,

Similarly,

if

you

store a

not get an error message.
is

possible to use

DIM

to

while the elements from

however,

All other array variables are cleared with each

48

different ways.

an Error 9.

they don't have a zero element.

26 elements

memory. The only way

program.

first

will get

in

is

that these

new RUN. By

26

special

using good

programming practice and always
If

DIM

is

used to allocate the A(

initializing

)

or

A$(

your variables to the desired value, you
)

arrays larger than

26 elements, there

can cause the part of the array from A(27) or A$(27) on to become inaccessible.

will avoid

any possible confusion.

are certain special conditions in
If

this occurs,

it is

which an error

necessary to redimension the

array.

Expressions

An

expression

is

some combination of

which you entered

variables, constants,

and operators which can be evaluated to

Chapter 3 were examples of expressions.

in

Expressions are an intrinsic part of

a single value.

The calculations

BASIC programs. For example,

an expression might be a formula that computes an answer to some equation, a test to determine the relationship between two
quantities, or a

means

to format a set of strings.

Numeric Operators
The PC-3 has

five

as a calculator in

+

*
/

A
A

These are the arithmetic operators which you used when exploring the use of the PC-3

numeric operators.

Chapter 3:

Addition
Subtraction
Multiplication
Division

Power

numeric expression

is

constructed

in

the same

way

that

you entered compound calculator operations.

Numeric expressions

can contain any meaningful combination of numeric constants, numeric variables, and these numeric operators:
49

(A* B)^2

A (2, 3)+A(3,4)

+ 5.(J-C

(A/B) * (C + D)
In certain

circumstances the multiplication operator can be implied:

2A

is

the same as

7C

is

the same as

ABC

is

the same as

As you can see from the
so don't use this

NOTE:

*A
*C
A* B *C
2
7

last

example, there

form unless the context

Negative numbers

may not

is

is

implied multiplication could be confused with other

a possibility that

be raised to a power with the ^operator since you

numbers

are

You

then have to change the result to the appropriate

will

encountered

in a

may

obtain incorrect signs.

program, convert the numbers to positive numbers using

ABS

String expressions are similar to numeric expressions except that there

makes one longer
the

string.

You should

work space used by the PC-3

NOTE:

When

in

making more complex

for string calculations

is

a string value into a

negative

only one string operator

—

concatenation

string concatenations

(+).

This

first string

is

and

and other string operations because

limited to only 79 characters.

String quantities and numeric quantities cannot be

which convert

is

use with a pair of strings, the + attaches the second string to the end of the

take care

If

before using the ^operator.

sign.

String Expressions

the same symbol used for plus.

BASIC words,

very clear.

combined

numeric value or vice

versa.

50

in

the same expression unless one uses one of the functions

"15"+

10

"15" + "10"

is

illegal

is

"1510", not "25"

Relational Expressions

A

relational expression

compares two expressions and determines whether the stated relationship

is

True or

False.

The

relational

operators are:

>
>=

Greater Than or Equal

=

Equals

<>

Not Equal To

<=

Less

Than or Equal To

<

Less

Than

Greater Than

The following

To

are valid relational expressions:

A =

5

D(3)<>8
If

A

was equal to 10, B equal to 12, CO,

Character strings can also be compared
to their
a

or

ASCII

NUL

will

in

2) equal to 6,

and D(3) equal to

relational expressions.

value, starting at the first character (see

The two

Appendix B

for

9,

all

of these relational expressions

strings are

ASCII

compared character by character according

values).

If

one

string

be used for any missing positions. All of the following relational expressions are True:
51

would be True.

is

shorter than the other,

"ABCDEF" = "ABCDEF"
"ABCDEF" <> "ABCDE"
"ABCDEF"> "ABCDE"
Relational expressions are either True or False.

an expression which evaluates to

Good programming

1

or

more

will

The PC-3 represents True by

a 1; False

is

represented by a 0.

be regarded as True, while one which evaluates to

In

any

logical test,

or less will be considered False.

practice, however, dictates the use of an explicit relational expression instead of relying

on

this coincidence.

Logical Expressions
Logical expressions are relational expressions which use the operators
relational expressions; the value of the

A AND

Value of

B

Value

combined expression

is

shown

A

True

False

True

True

False

False

False

False

of

B

A OR

B

Value of

Value

A

True

False

True

True

True

False

True

False

of

B

(Cf Values of
.

A and

B must be

or

1

52

in

AND, OR,

and NOT,

the following tables:

AND

and

OR

are used to

connect two

Decimal numbers can be expressed

in

the binary notation of 16 bits as follows:

BINARY NOTATION
OF 16 BITS

DECIMAL
NOTATION
3276 7

0111111111111111

3

0000000000000011

2

0000000000000010

1

0000000000000001

0000000000000000
-1

1111111111111111

-2

1111111111111110

"3

1111111111111101

-32768

1000000000000000

The negative (NOT) of

NOT
(Negative)

a

binary

number 0000000000000001

is

taken as follows:

0000000000000001

1111111111111110
53

rted

in

iS

,"
ThenVh
Then
the ffollowing

^ °' 3nd ° t0
will result

0000000000000001
+)

+

From

and

NOT

1

are

is

"<°

^ke

(-{)

is:

NOT

X

in

X

= ^1

an equation of

=

-(X+

NOT

X

=

-X-1

1)

this equation, the following
results are

found

IMOT0--1

NOT -1-0
NOT -2 = 1

(A<9) AND (B>5)

(A>=10) AND NOT
(C = 5) OR (C = 6) OR

(A

negative

added together:

(1)

1111111111111 111

NOT

6aCh bit Which
'

1

(notd

This results
i.e.

f° r

mi 1111 ir nnio

(NOT X)

X

1

when

>

20)
(C = 7)
54

(NOT)

••

on 16-bit quantities. (See note on relational expressions and
(True and False), which result from a
True and False.) In normal operations this is not significant because the simple 1 and
or 1, it works on each bit inrelational expression, use only a single bit. If you apply a logical operator to a value other than

The PC-3 implements

logical operators as "bitwise" logical functions

dependently. For example,

if

is

17 and B

17

in

binary notation

is

10001

22

in

binary notation

is

10110

17

OR

10111
If

A

you

22
is

10111

is

23

in

(1

if 1

22, (A or B)

in

either

is

23:

number, otherwise

0)

decimal.

are a proficient

programmer, there

stick to clear, simple

grammers should

is

are certain applications

True or False

where

this

type of operation can be very useful. Beginning pro-

relational expressions.

Parentheses and Operator Precedence

When

evaluation complex expressions the PC-3 follows a predefined set of priorities which determine the sequence

tors are evaluated.

5 +

2*3

could be:

2*3

or

7*3 =21

To

avoid having to

= 6

6 + 5 = 11

rules of "operator

of evaluation.

which opera^

This can be quite significant.

5 + 2 = 7

The exact

in

precedence" are given

remember

all

The above example

in

these rules and to
is

clarified

Appendix D.

make your program

by writing

either:

55

clearer,

always use parentheses to determine the sequence

(5

+

2)

*

3

c

nr
or

.„

5 + (2

*

3)

Mode

Calculator

Input
Display

(5>3)

AND (2<6)
1.

The

1

means that the expression

is

True.

Functions
Functions are special components
of thp RA^ir i*~

« .*.

«a ri8btas

absolute .alue of

ABS
ABS
is

a

„ n „ se „,l „
B argument.

ii :z

- aiue

(-5)

is

5

(6)

is

6

LOG
LOG

(100)

is

2

(1000)

is

3

—

___

md

j ;,"::::::
""""* "' ex P

i

function which computes the log

-

._

1

56

,rms,

ress '°"s-

-m
ABS

is

*»
a

«*- —• *«««

function which produces the

A

function can be used any place that a variable can be used.

LOG
You must

100

is

a

complete

list

functions do not require the use of parentheses.

LOG

the same as

use parentheses for functions which have

See Chapter 8 for

Many

(100)

more than one argument. Using parentheses always makes programs

of functions available on the PC-3.

57

clearer.

CHAPTER
In

PROGRAMMING THE

5

the previous chapter

we examined some

of the concepts and terms of the

use these elements to create programs on the PC-3.

BASIC. What

this

chapter will do

is

PC-3

familiarize

BASIC programming

Let us reiterate, however, that this

is

language.

not

a

In this

chapter you

will

manual on how to program

in

you with the use of BASIC on your PC-3.

Programs

A

program consists of

a set of instructions to the

computer.

Remember

the PC-3

is

only a machine.

It

will

perform the exact

operations that you specify. You, the programmer, are responsible for issuing the correct instructions.

BASIC Statements
The PC-3

interprets instructions according to a predetermined format.

statements

in

the same pattern. Statements

10:

PRINT "HELLO"

20:

READ
END

30:

Line

Numbers

Each

line of a

computer.
if

you

tell

a

unique

the PC-3 the order

are a beginning

lowest line

start

with a

line

This format

is

called a statement.

You always

enter

BASIC

number:

B (10)

program must have

They

must

programmer,

number and moves

it is

in

line

number

—

any integer between

1

and 999. Line numbers are the reference for the

which to perform the program. You need not enter

probably

less

lines in sequential

order (although

confusing for you to do so). The computer always begins execution with the

sequentially through the lines of a program

59

in

ascending order.

When programming,

it

insert additional lines,

CAUTION: Do
number

wise to allow increments

in

your

line

numbering

(10, 20, 30,

.

.

.

10, 30,

50

etc).

This enables you to

necessary.

not use the same

deleted

is

is

if

when you

line

enter the

numbers

new

in different

programs.

If

you use the same

line

number, the oldest

line

with that

line.

BASIC Verbs
All

BASIC statements must

program and,

as such,

is

10

PRINT "HELLO'

20

READ
END

30

Some statements

Verbs

tell

the

computer what action to perform.

A

verb

is

always contained within

a

B(10)

require or allow an operand:

10

PRINT "HELLO'

20

READ
END

30

contain verbs.

not acted upon immediately.

B(10)

Operands

provide information to the computer telling it what data the verb
will act upon. Some verbs require operandswith
other verbs they are optional. Certain verbs do not allow operands.
(See Chapter 8 for a complete listing of BASIC verbs and
their
uses on the PC-3.)

BASIC Commands
Commands

are instructions to the

computer which

are entered outside of a program.

60

Commands

instruct the

computer to perform

some action with your program or to
Unlike verbs,
the

command

set

modes which

commands have immediate
will

be executed.

effects

Commands

-

as

how your programs

effect

soon

as

are executed.

you complete entering the command (by pressing the
number:

(enter

key),

)

are not preceded by a line

RUN
NEW
RADIAN
Some

verbs

may

also be used as

commands.

(See Chapter 8 for a complete listing of

BASIC commands and

their uses

on the PC-3.

Modes
You

will

The

RUN mode

remember
is

that,

when

using the PC-3 as a calculator,

also used to execute the

The PROgram mode

is

(see

Chapter

set in the

RUN

mode.

programs you create.

used to enter and edit your programs.

The RSV or ReSerVe mode enables you

gramming

it is

to designate and store predefined string variables and

is

used

in

more advanced

pro-

6).

Beginning to Program on the PC-3
After

all

your practice

in

using the PC-3 as a calculator,

we show an entry, we will not show every
EVERY LINE BY PRESSING THE (ENTEfj

Now you

are ready to program!

keystroke.
)

you

are probably quite at

Remember

to use

(shift)

home

on,

when

END

with the keyboard.

KEY.

Set the slide switch to the

PROgram mode and
61

From now

to access characters above the keys and

enter this

command:

Input

Display

NEW
The

>

NEW command

indicating that the

Example
Make

1

—

clears the PC-3's

computer

is

memory

of

all

existing programs and data.

is

in

the

PRO mode

PRINT "HELLO"
when you push

10:
(enter]

slide the selector switch to the

Input

press

(enter

)

,

Display

,

and the verb. Verify that the statement

Now

you

and enter the following program:

Input

Notice that

after

Entering and Running a Program

sure the PC-3

10

The prompt appears

awaiting input.

PRINT

"HELLO"

the PC-3 displays your input, automatically inserting a colon (:) between the line
is

RUN

in

the correct format.

mode:
Display

HELLO

RUN

62

number

Since this

is

the only line of the program, the computer will
stop executing at this point. Press
if you wish to execute the program
again.

and reenter

RUN

Example 2

-

(enter)

to get out of the program

Editing a Program

Suppose you wanted to change the message that you program
was displaying; that is, you wanted to edit your program With
a
program you could just retype the entry, but as you develop
move complex programs editing becomes a very important
component of your programming. Let's edit the program you have
just written.
single line

Are you

still

You need

in

the

to recall

RUN mode?

yourprogram

P^tely executed, the

QD

so, switch

If

in

order to edit

will recall

((break)) key to stop execution, the

program, use the
the next

line).

If

CD
held

move up
down, the
to

back to the

in

the

CD

last line

it.

Use the Up Arrow (t) to

of the program.

will recall the line in

your program

CD

PROgram mode.

and the

(recall

CD

If

recall

your program.

which the error or

the previous line) and the

will scroll verticaly; that

is,

BREAK

occurred.

CD

move down

they

to

will display

your program.

You

will

remember that

to

position the cursor over the

!^

move
first

the cursor within

a line

you use the

character you with to change:

®

(right

arrow) and

10:

PRINT

if

you used the

®

(left

"HELLO'

BREAK

To make changes
in

in

your

your program (display

each line moving up or

Display

63

your program was com-

If

there was an error in the program, or

arrow).

down

Using the

®

in

Input

Display

10:
Notice that the cursor

is

now

in

the flashing block form, indicating that

Input

Center

)

at the

end of the

line.

Switch into the

m Pu*

new kind

mode.

ERROR
of error message.

which the error occurs
Switch back into the
last line

RUN

Display

RUN
a

in:

10PRINT"GOODBYE"! _

Don't forget to press

is

"on top of" an existing character. Type

Display

GOODBYE"!

This

it is

PRINT "iELLO"

is

Not only

is

1

IN 10

the error type identified (our old friend the syntax error), but the iine

number

in

also indicated.

PROgram mode. You must

be

in

the

PROgram mode

of your program.

64

to

make changes

in a

program. Using the f

,

recall

the

Input

Display

10:
The
all

flashing cursor

is

positioned over the problem area.

characters must be contained within quotation marks.

In

Chapter 4 you learned that, when entering string constants

let's

put the

in

BASIC,

Display

DEL
Now

"GOODBYE'H

Use the DELete key to eliminate the "!".

Input

in

PRINT

10:

!

in

the correct location.

editing calculations (see Chapter 3).

When

editing programs,

Using the

®

PRINT

DELete and INSert

"GOODBYE"are used in exactly the

following the insertion.

Input

Display

10:
Press the INSert key.

A

_

will indicate the

same way

position the cursor on top of the character which will be the

spot where the

new

65

PRINT

data will be entered.

"GOODBYE «

as

first

they are

character

Input

Display

INS

Type

in

10:

the

!.

The display looks

"

like this:

Input

Display

10:
Remember

to press

NOTE:

you wish

If

PRINT "GOODBYES

(enter)

to

PRINT "GOODBYE!!

so the correction will be entered into the program.

DELete an

entire line

from your program,

just

type

in

the line

number and the

original line will be elimi-

nated.

Example 3
If

you

—

Using Variables

are unfamiliar with the use of

Using variables

in

Remember, you

A
To

in

Programming
numeric and

string variables in

BASIC, reread these sections

programming allows much more sophisticated use of the PC-3's computing

assign simple

numeric variables using any

letter

from

A to

in

Chapter

4.

abilities.

Z.

- 5

assign string variables,

you

also use a letter following

by

a dollar sign.

66

Do not

use the same letter in designating a numeric and

You cannot

a string variable.

Remember

A$
The

=

designate

A and A$

the same program.

in

that simple string variables cannot exceed 7 characters

in

length:

"TOTAL"

values assigned to a variable can change during the execution of a program, taking on the values typed

the program.

One way

to assign a variable

response to the data typed

in

is

answering the inquiry

"WORD?";A$
B= LEN (A$)
PRINT "WORD IS ";
END

INPUT verb. In the following program,
"WORD?". Enter this program:

to use the

in

or

the value of

computed during

A$

will

change jn

10 INPUT

20
30

40

Before you

^ ^

RUN

LETTERS"

^

means space

the program, notice several

When

PC-3's display.

B; "

as the 24-character

a line

is

maximum

new

features.

Line 30 of this program exceeds the 24-character

longer than 24 characters (up to the 79-character
is

exceeded.

maximum), PC-3 moves

This does not destroy the previous input.

maximum

of the

the characters to the

This moves to the

left

is

left

referred to as

horizontal scrolling.

The second new element

in this

computer that the program

As your programs
LIST command.
Try

listing this

get

is

program

completed.

is

the use of the

It is

END

statement to signal the completion of

always good programming practice to use an

more complex, you may wish

LIST, which can only be used

in

to review

the

END

a

program:
67

END

tells

the

statement.

them before you begin execution. To look

PROgram mode,

program.

at

your program, use the

displays programs beginning with the lowest line number.

Input

Display

LIST

Use the

INPUT

10:

CD

and

CD

arrows to move through your program

contains more than 24 characters,

move

until

"WORD?"; A$

you have reviewed the

entire program.

To review

a line

which

the cursor to the extreme right of the display and the additional characters will
appear

on the screen.
Input

This

Display

RUN

WORD?_

HELP

WORD

(ENTER)

>

is

the end of your program.

entertaining

entering

if

RUN

Return to the

it

it

LETTERS

RUN. However, this program would be a bit more
now modify the program so it will keep running without

again by entering

presented more than one opportunity for input.

We

will

after each answer.

PRO mode

You may type 40
40:

Of course you may begin

IS 4.

GOTO

and use the up or down arrows

to Delete the entire line or use the

(or

®

LIST) to reach

line

40.

to position the cursor over the E in End.

10
68

Edit line

40 so

that

it

reads:

Now RUN
The

the modified program.

GOTO

statement causes the program to loop (keep repeating the same operation).

keep going forever (an "infinite" loop). To stop

When you
With the

this

program

hit the

BREAK

have stopped a program using the (brk) key, you can restart

CONT command, the

Example 4

—

program

will restart

on the

line

it

(

(

brk

using the

)

)

Since you put no limit on the loop

it

will

key.

CONT command. CONT stands

for

CONTinue.

which was being executed when the (brk key was pressed.
)

More Complex Programming

The following program computes N

Factorial (N!).

The program begins with

1

and computes N! up to the limit which you enter.

Enter this program.

100 F =

1:

WAIT

128

110 INPUT "LIMIT?
120

FOR N

=

F*

N

130 F =

1

TO

";

L

L

140 PRINT N, F
150
160
Several

NEXT N
END

new

features are contained

before the program continues.
display

is

set

by the

in this

program.

The numbers and

WAIT statement

The WAIT verb

you wish on one

line,

100 controls the length of time that displays

their factorials are displayed as they are

to approximately 2 seconds, instead of waiting for

Also on line 100, notice that there are two statements on the same
as

in line

line

69

computed. The time they appear on the

you to

press

separated by a colon (:).

separating each by a colon, up to the 80-character

maximum

are held

(enter

)

.

You may put

including

(enter

)

.

as

many statements

Multiple statement

lines

can

ments

make

a

program hard to read and modify, however, so

are very simple or there

is

some

special reason to

it is

good programming practice to use them only where the

want the statements on one

state-

line.

this program we have used the FOR verb on line 120 and the NEXT verb on line
150 to create a loop. In Example 3, you
created an "infinite" loop which kept repeating the statements inside the loop until you
pressed the (brk) key. With this FOR/
NEXT loop, the PC-3 adds 1 to N each time execution reaches the NEXT verb. It then tests to see if N is larger than the limit L.
If N is less than or equal to L, execution returns to
the top of the loop and the statements are executed again. If N is greater than
L, execution continues with the 160 and the program stops.

Also

in

You may
at

use any numeric variable

We

have labelled this program with

have several programs

RUN
In

in a

FOR/NEXT

loop.

You

also

do not have

to start counting at

1

and you can add any amount

each step. See Chapter 8 for details.

in

memory

at

line

numbers

one time. To

starting with 100,

RUN

this

Labelling programs with different line

program instead of the one

at line

numbers allows you to

10 enter:

100

addition to executing different programs by giving their starting line number, you can
give programs a letter

them with the DEF key

You

RUN

will

(see

Chapter

notice that while the program

the program a few

more times and

Storing Programs

in

You

will

that settings,

also

remain

remember
in

the PC-3's

memory when you

name and

start

6).

is

running, the

try setting

N

BUSY

indicator

is

lit

at those times that there

is

nothing on the display.

is

turned

at several different values.

Memory
ReSerVe keys, and functions remain
turn off the PC-3, or

it

undergoes an
70

in

the computer even after

AUTO

OFF.

Even

if

it

you use the

OFF. Programs

(BRK)

,

CLear or

CA

keys, the programs will remain.

Programs are

*
*
*
*

You

lost

enter

from memory only when you perform the following actions:

NEW

before beginning programming.

You initialize the computer using the ALL RESET button.
You create a new program using the SAME LINE NUMBERS
You change the batteries.

as a

program already

in

memory.

This brief introduction to programming on the PC-3 should serve to illustrate the exciting programming possibilities of your

computer. For more practice

in

programming

exercises, please see Chapter 9.

71

new

CHAPTER
The PC-3 includes

SHORTCUTS

6

which make programming more convenient by reducing the number of keystrokes required
to

several features

enter repetitive material.

One such

feature

is

the availability of abbreviations for verbs and

This chapter discusses

two

commands

(See Chapter 8).

additional features which can eliminate unnecessary typing

—

the

DEF

key and the ReSerVe mode.

The DEF Key and Labelled Programs
Often you
line

will

numbers.)

want

to store several different programs in the PC-3's

Normally, to

start a

of each program (see Chapter 8).
using only

Put

two keystrokes. This
a label

on the

is

first line

program with

But, there

how

is

a

memory at one time. (Remember that each must have unique
or GOTO command, you need to remember the beginning line number
way! You can label each program with a letter and execute the program

RUN

an easier

to label a program and execute

of each program that

you want

it

using

DEF:

to reference.

The

label consists of a single character in quotes,

followed by a colon.

10

"A": PRINT "FIRST"

20

END

80

"B":

90

END

Any one

PRINT "SECOND"

of the following characters can be used:

these are the keys

keyboard to make

in
it

the

last

easier for

A, S, D, F, G, H,

J,

K, L, =, Z, X, C, V, B, N,

two rows of the alphabetic portion of the keyboard.
you to remember.
73

M, and SPC. Notice that

This area has been darkened on your

To execute

the program, instead of typing

used as a label.

When DEF

RUN

80 or

GOTO

10,

you need only

the above example, pressing (def) and then 'B' would cause

used to execute a program, variables and

is

Chapter 8 for

In

mode

to press the (def) key and then the letter

'SECOND'

settings are affected in the

to appear on the display.

same way

as

when

GOTO

is

used.

See

details.

ReSerVe Mode
Another timesaving feature of the PC-3

is

the ReSerVe mode.

memory of the PC-3, 47 characters are designated for "Reserve Memory".
used expressions, which are then recalled by a simple two-keystroke operation.
Within the

NOTE: You
Try

this

store the strings in the

example of storing and

ReSerVe mode and

mode by moving

Type NEW, followed by the

(ente§)

Type

(Shift)

lr>

the

for use in the

key.

the slide switch to the

RSV

RUN

memory

to store frequently-

and PROgram modes.

position.

This will clear out any previously stored characters

PROgram mode.

followed by

P ut

(shift)

in

them

can use this

recalling a reserved string.

Switch the PC-3 into ReSerVe

stored programs

recall

You

'A'.

Display

a

A: _
74

in

the same

way

NEW clears out

Notice that the

"A"

appears

in

the display at the

Enter the word 'PRINT' and press the

lr|

followed by

a colon.

key.

P ut

PRINT

A

(enter)

left

Display

(ENTER)

A:

space appears after the colon signalling you that 'PRINT'

Switch the PC-3 into

and then press

PROgram mode. Type

(shift)

is

NEW followed

now
by

(enter)

(shift)

a

memory under

to clear the program

the letter A.

memory. Type

'10' as a line

number

10 PRINT.
10:

Immediately the word

"PRINT"

will

appear

character sequence can be stor ed

or the

RUN mode

DEF,

those

i.e.,

the reserve

Display

(ENTER)

Any

in

and the 'A' key:

Input

10

stored

PRINT

in

in

in

PRINT

the display after the line number.

ReSerVe Memory. The stored

by typing (SHlFT )and the key that the

string

is

the dark area of the keyboard.

75

strings can be recalled at

stored under.

The keys

any time

available are the

in

same

either the
as those

program

used with

To

edit a stored character sequence, switch into the

You can then

When

the

example,

edit using the Left

last
if

character

you

in a

stored sequence

store the string

execution of the program at

ReSerVe mode and press (SHiFT) and the key under which the sequence

Arrow, Right Arrow, DEL, and INS keys
is

"GOTO 100@"

line

100.

a '@' character,

under the

Without the

it

is

in

interpreted as

'G' key, typing

'@' character,

the same

(shift)

you must

press

way

as in

(enter)

and
(

when

'G' in the

enter

)

is

stored.

other modes.
the sequence

RUN mode

after the

(shift)

is

recalled.

immediately

For
starts

and 'G' to begin

execution.

Templates

Two templates are provided with the
or DEF key assignments. After you
is

associated with each key.

You

PC-3.

You can

use these templates to help

you remember frequently used ReSerVe sequences

have labelled the programs or created the sequences, mark the templates so you
can then execute programs or recall sequences using the two-keystroke operation.

know what

For example, if you have one group of programs which you often use at the same time, label the
programs with letters and mark
the template so that you can easily begin execution of any of the programs with two keystrokes.
You might also store frequentlyused BASIC commands and verbs in the Reserve Memory and mark a template to speed to entering

BASIC programs.

Example:

SIN

COS TAN ASN ACS ATN

RUN NEW

Dnnnnnnnt:
INP.

PR|

a*A B*B

76

j

CHAPTER

7

USING THE PC-3 PRINTER/CASSETTE INTERFACE

The PC-3 Printer/Cassette Interface allows you to add
The PC-3 Printer/ Cassette Interface features:

a printer

and cassette interface to your Radio Shack PC-3 Pocket Computer.

24-character-wide thermal printer with approximately a 48-line-per-minute print speed.

Convenient paper feed and tear

bar.

Simultaneous printing of calculations

as desired.

Easy control of display or printer output

in

BASIC.

Cassette interface to connect to any standard cassette recorder.

Manual and program control of recorder for storing programs, data, and reserve key
Filenames and passwords on tape for control and security.
Built-in rechargable
*

Nickel-Cadmium

settings.

batteries for portability.

Recharger supplied.

Introduction to the Machine
Before you begin to use the PC-3 Printer/Cassette Interface you should
front of the machine:

77

first

become

familiar with

its

components.

Examine the

PAPER TAPE

COMPARTMENT

PINS

FOR

AC ADAPTER
JACK

COMPUTER

PAPER FEED

CHECK CONNECTOR

BUTTON

For service only)

LOW BATTERY INDICATOR
PRINTER SWITCH

REMOTE SWITCH

Figure 14. Printer/Cassette Interface (Front View)
78

CASSETTE RECORDER
JACK

REMOTE

switch. This switch

PRINTER ON/OFF.

LOW BATTERY

is

used to operate the Cassette Recorder manually.

This switch

indicator.

is

used to turn the printer on and off to conserve batteries

This indicates

Paper feed button. Pressing this key

will

when

there

feed the paper

PC-3

is

in

insufficient

when not

in use.

power to operate the PC-3 Printer/Cassette

Interface

the printer.

POCKET COMPUTER

AC ADAPTER
JACK

PC-3

PRINTER/

CASSETTE INTERFACE

REMOTE JACK
MICROPHONE JACK
EARPHONE JACK

Figure 15. PC-3 Printer/Cassette Interface (Right Side View)

Power
The PC-3 Printer/Cassette Interface is powered by
when the low battery indicator comes ON.

a rechargeable Nickel

79

Cadmium

battery.

It is

necessary to recharge the battery

To

recharge the battery, turn the

Cassette Interface, and plug the
is

Computer and

AC

Printer/Cassette Interface

adapter into a wall outlet.

power OFF, connect the

(See the diagram.)

It

will

AC

adapter to the Printer/

take about 15 hours before the battery

fully charged.

Important Note!

Using any

AC

adapter other than the one supplied
PC-3

POCKET COMPUTER

may damage

the Printer/Cassette Interface.

AC ADAPTER

PLUG

PRINTER/CASSETTE
INTERFACE

AC ADAPTER CONNECTING

PC-3

JACK OF PC-3 PRINTER/
CASSETTE INTERFACE
Figure 16.

How

Always connect the recharger to the Printer/Cassette Interface

When

the batteries

lights

up and the unit

Cassette Interface

before

its first

the PC-3 Printer/Cassette Interface

in

it is

will

not function.

At

this point,

likely that the batteries insufficiently

WALL OUTLET

to Connect the

first.

AC

Adapter

Then plug the recharger

become discharged,

the low battery indicator on the front of the unit

you must recharge the

batteries.

charged due to the time spent

use.

80

into the wall socket

When you

in storage.

first

The

receive

your Printer/

unit will require charging

NOTE: When

the

power

will

Computer

used with the Printer/Cassette interface and the battery power of the
Computer decreases, the
be supplied to the Computer from the Printer/Cassette Interface.
is

Connecting the PC-3 Pocket Computer to the PC-3 Printer/Cassette Interface
To connect the PC-3 Pocket Computer to the PC-3 Printer/Cassette Interface, use the following
1.

Turn

OFF

NOTE:
up".
2.

If

Remove

the power

It

this

is

in

procedure:

both units.

important that the power be

should occur, use the

OFF

ALL RESET

the protective pin cover from the

on the Computer before connecting the

units, or the

Computer may "hang

button to clear the Computer.

left side

of the Computer and snap

it

into place

on the bottom of the Printer/

Cassette Interface.

Snap
Protective pin cover

Figure 17

Figure 18.

81

into place here

3. Place

4.

5.

the

Computer on the

Lay the Computer down
Gently

slide the

Printer/Cassette Interface

in

Fig. 19.

flat.

Computer

Computer.

shown

to the left so that the pins on the Printer/Cassette
Interface are inserted into the plug on the

DO NOT FORCE

the Computer and Printer/Cassette Interface together.
check to see that the parts are correctly aligned.

Figure 19.

If

the two parts do not mate easily

Figure 20.

82

STOP and

6.

To

use the Printer, turn on the PC-3

Computer power

switch, and then the Printer switch.

Press the (CL) key.
If

Note:

the (CL) key
If

is

not pressed, the Printer may not operate.

executed when the Printer switch

indicator

may

In this case,

light

up

is

set at the

OFF

position, printing causes an error

(ERROR

code

8).

(The low battery

at this point.)

turn the Printer switch

ON, and

press the

(CD

key. Then, execute the printing again.

Loading the Paper
(1)

Turn off the Printer switch.

(2)

Open the paper

cover.

(Fig. 21)

Paper cover
Figure 21.
(3)

Insert the leading

edge of the

roll

of paper into the slot located

(Any curve or crease near the beginning of the paper
makes

in

the paper tape compartment. (Fig. 22) (Fig
23)

insertion difficult.)

83

Figure 22.
Figure 23.

NOTE:

Use of irregular paper tape may cause
irregular paper feeding or paper
m,sfeed. Therefore, be sure to tighten the
roll before using, as shown
in
the figure.

Paper tape

Cs^>
R 9 ure24

(4)

Turn on the Printer switch and press the paper feed button

until th e

the

roll

((«o
Right

(Fig.

25)

Paper feed button

Figure 25.
Install

Wrong

-

paper comes out of the Printer mechanism.

Paper cutter

(5)

-

roll

of paper into the compartment.
Printer switch

84

(6)

Close the paper cover.

(Fig. 26.!

Paper

cover——

Roll of Paper

Figure 26.

P3Per

fr °

m

the Print6r

lunTiZ
Do not

pull the

'

paper backwards,

'^

the P3Per ° n the
''^ ° f tHe PaPer

as this

may

r

°" compartment and then P u " *

strai 9 h t

out to the

cause damage to the Printer mechanism.

—

CAUTION:
Paper tape

is available wherever the PC-3
Printer/Cassette Interface is sold.
Please order replacement paper tape
to your local Radio Shack store. Please specify

^ll^ !^!^^^^^

Model name when ordering

The paper

01

damage

to the unit

Using the Printer
If

you

are using the

PC-3 Computer

as

y accomphshed by pressing the
Played.

If

not, press the

gfijlj)

adulator, you may

mD

and

fNTER)

^

use the PC-3 Printer to simultaneously
print your calculations. This

key and then the

key

keys. Check to see that the

85

(p

„

mode

Np)
switch

(Jhe
is

set at the

RUN

position.)

is

"_

indicator

After

this,

t:z :z^,zzr

of

• c8icuis,i ° n ' ,he

™" ms

^^ -

—
- **- -

- «« - *. «,„,

wil

,

*

Input

Paper

300

50

The only difference

wide.

you to
as

/

is

that,

see the extra characters.

required.

is

if

you PR N t some

in

the program (see

statements.

Chap

8

print

etl,

r

PR.NT=PR,
wi „ reset this
IF statement allowing
a choice of o
u

NT

it

9

Lu^r ; ;:z::

given with

may

LUST

tf

"

wil1

'° n9er

'

each separate

no

^

f° r

line,

'

*" **"*'
'^

jition tn

"» '
St3tement Wi " aCt 3S

it

time
im e the
t
program „ used (see Relationship
of

pled

ThT econd
programme

is

k«

com

h

24 Characters

be Printed on a second and
possibly a third

iT^Zl^T *" * M
" Z" ™\ ™ T^ ^ ^ * ''"^

^

' re

*< CharaCt6rS there

Two

z ^7^,:^
r
I™
ZT °T * ^ "^

to limit the lines wh
be used to print one program
line

will clearly identify

"to

"
With the LPR INT
NT verb the
th P 6Xtra characters

Programs which have been written
with

ment

^ *' »"""
TZ "TT *' ^'^
*'"
'

hi

^

,

d

J

J

86

(see

T""""'
9 " neS

chapter 8 for

"

"

*"

,n

^

* nted

they were LPR| NT
'" '

Variables example

detai,s)

-

P

""™

in

in a "

Chapter

—
^^^ ^
,f

9).

used

* ""

*'" 24

f ° Ur

if

™

"""*»'

CharaCterS

y

a S°
'

tW° ° r more

s

° that

^

be

lines

""• number

Caution

•

:

(ERROR code 8) occurs due to a paper misfeed, tear off the paper tape, and
paper tape completely out of the Printer. Then press the (CL) key
to clear the error condition.
In case

an error

• When the Printer/Cassette Interface

is

exposed to strong external

electrical

noise,

it

may

pull the

print

remaining part of the

numbers

at

random.

If

this

happens, depress the (brk) key to stop the printing; then
press the (CD key.
Pressing the (CL) key will return the Printer to its normal
condition.

Twhen

the Printer causes a paper misfeed or

normally and only the symbol

"BUSY"

is

is

exposed to strong external

displayed.

If

this

electrical noise while printing,

happens, depress the

£r®

however, the Printer

will

stop

if

the (CL) key

is

pressed. Therefore, be sure to press the

(CD

With the Cassette Recorder connected, you can use the following
commands:
Saves the contents of a program or reserve
Retrieves a program or reserve

CLOAD?

Compares the program on tape with the contents of memory to

memory on
memory from tape.

87

tape.

insure that

you have

a

is

key upon completion

Using a Cassette Recorder

CLOAD

operate

PRINT command

of printing.

CSAVE

may not

key to stop the printing. (Release

L.the paper misfeed.) Press the (CL) key.
• When the PC-3 Printer/Cassette Interface is not in use, turn off the Printer switch
to save the battery life.
• Even while printing under the LPRINT command, the entry can be executed when
an INPUT, INKEY$ or
performed.
In this case,

it

good copy.

MERGE

Combines

PR INT#

Saves the contents of variables on tape.

INPUT#
CHAIN

Retrieves the contents of variables from tape.

a

program on tape with one already

Starts execution of a

programs are

CSAVEd.

modify the programs

in

in

memory, they cannot be

program or data

is

all

will

This allows the unambigous storage of
be searched to find the appropriate

these verbs and

file.

many programs on
If

programs have

stored on tape, but a password can be assigned at the time that unprotected
will

not be able to LIST or

commands.

recorded on tape,

serves to advance the tape past

NOTE:

be stored on the tape.

Such password-protected programs can be used by other person, but they
any way.

See Chapter 8 for details on
a

will

Programs can then be retrieved by name and the tape

been password-protected

When

memory.

program which has been stored on tape.

Programs may be assigned filenames which

one tape.

in

it will be preceded by a high-pitched tone of approximately 7 seconds.
any leader and to identify the beginning of each program or set of data.

Whenever you wish to read

in

something from tape,

it

is

essential that the tape be positioned

This tone

on one of these leader

tone areas.

When

searching for a filename, the tape can read only

in

a

forward direction.

This search

is

relatively slow, so

it

is

sometimes

preferable to keep track of program locations by using tape counter. Using fast forward, rewind or play, the tape can be manually

positioned to the leader tone area of the correct program before the retrieval
able to hear the high tones which begin each program.

In

is

between these high tones

indicates programs or data.

88

started.
will

While scanning the tapes, you

will

be

be a mixed high and low tone sound which

See the Operation Manual supplied with
the PC-3 Printer/Cassette Interface for more
detailed o perating instructions.

PRINTER/CASSETTE
INTERFACE

PC-3

CASSETTE RECORDER

Figure 27. Cassette Cables and Interface Jacks

Figure 28.

89

Recorder Connected to Interface

• To transfer program and data from the tape, use the tape recorder with which the tape was prerecorded.
different

A

tape recorder,

if

from that used for recording, may cause no transfer of the prerecorded tape.

Care and Maintenance
*

Be sure that the power

is

OFF

on both units when connecting or disconnecting the Printer/Cassette Interface and the

Computer.
*

The

Printer should be operated on a level surface.

*

The

unit should be kept

*

Use

a soft,

*

Keep foreign objects out of the

away from extreme temperatures, moisture,

dry cloth to clean the

unit.

DO NOT

use solvent or a

dust, and loud noises.

wet

cloth.

unit.

Errors
If

the batteries

become

Pocket Computer
Cassette Interface

low, or

if

the Printer/Cassette Interface

is

subjected to strong noise, the unit

cease to function and the

may "hang up". This can also occur if the units are connected and the power is not turned on the Printer/
a LPRINT or LLIST command is used. In some cases, ERROR 8 may be displayed on the Computer.

when

The CLear key may usually be used

to clear this condition, but in

some

adequate power to Printer/Cassette Interface before attempting to use

Examples
The procedures

may

for the

Computer and the Cassette Recorder operation

90

it

cases the
again.

ALL RESET may

be required. Be sure to restore

1.

Saving

REMOTE

(1)

Turn

off the

tape into the Cassette Recorder.

(2)

Put

(3)

Turn on the

(4)

Depress the

(5)

With the same

a

REMOTE switch.
RECORD button.
command which

Your filename cannot be

poses.

CSAVE
Your program
track of.

switch.

" PRO-1

(SHIFT)

will be saved

saves your program,

(SHIFT)

is

To

give the

save the

program

a

program with

"filename".

This

is

for reference pur-

a filename, type:

"

with the name "PRO-1".

Also, note that there

you must

longer than 7 characters.

You can

a 7-character length limit for

assign

any name you

your filename.

If

the

desire,

name

is

whatever

is

easiest for

you to keep

longer than 7 characters, the excess

is ignored.
A good practice is to maintain a program log, which includes the program name, starting and stopping locations on
tape (use the counter numbers), and a brief description of what the program does.

Press the

(enter)

key.

At

indicator should light up.
this

does not happen,

Once

the

"prompt"

computer
will

memory from

this time,

This

start again

tells

you should hear

from the beginning

arrives at the

the tape as explained

in

In

is

"busy" transferring your program from memory to the

"BUSY"
tape.

If

of the section.

end of the program, the

re-appear on the display.

buzzing sound, and the tape should be turning. Also, the

a shrill

you that the computer

"BUSY"

indicator light will go off, the recorder will stop, and the

order to insure that this has

the next section.

91

in fact

been accomplished, we can read

it

back into

2. Collating

Now
use the
(1)

the Computer and Tape Contents

that the your program

CLOAD? command.
Turn off the REMOTE

Rewind the tape to the place
Turn on the

REMOTE

(4)

Depress the

PLAY

(5)

To

collate the

somehow

If all

wili

at

which you

started, again using the

program with
(shift)

?

a

)

Turn off the

it is

really there.

To do

this

is

relatively simple;

number counter.

filename type:

"PRO-1

(shift)

(shift)

"

key.

Center)

CSAVEd

program with the one

from the program

in

in

its

memory.

be displayed, usually

computer's memory.

If all

went

ERROR

8.

well,

This

,^v

REMOTE

switch.

to the place at which

(2)

Rewind the tape

(3)

Stop rewinding.

(4)

Turn the

REMOTE

(5)

Press the

PLAY

switch back

you

it

will display the

tells

started, again using the

ON.

button.

92

number counter.

"prompt" and end

you that the program on tape

Erase that portion of tape and start again.

Transfer from Tape
(1

if

switch to set remote control functions.

did not go well, an error message will

different

no doubt want to see

button.

The computer compares the
check.

you

switch to clear remote control functions.

(3)

Press the

3.

saved on tape,

(2)

CLOAD

its

is

is

-

(6)

Type:

CLOAD

"PRO-1

(shift)

(shift)

"

and press the (enter key.
)

(Remember "PRO-1 " is the filename we have
must use that name instead of PRO-1 .)
(7)

The "BUSY" indicator

(8)

The
If

cassette retains a

an error message

now

will

light up,

copy of the program,

(ERROR

8)

is

given to your program.

and the program
so

you can

CLOAD

will

If

you saved the program under another name, you

be brought back into the Computer's

memory

for use.

the same program over and over again!

displayed while loading, start again from the above step

(1).

Precautions for collation and transfer

The program

is

recorded on tape as illustrated below:

Tape transport direction

_

r

Non-signal
section (Beep)

Program
t

Filename

Figure 28.

When

the tape

is

played back,

its

non-signal section produces a specific continuous beep, while the filename and
program-

recorded sections cause an intermittent beep.

93

If

collation or transfer

was not done properly, the "BUSY" symbol does not disappear and the tape does not

tape operation, press the (brk key. Then, try again from the beginning.
)

94

stop.

To

stop the

CHAPTER

8

The following chapter

Commands:

is

BASIC REFERENCE
divided into three sections:

Instructions which are used outside a program to change the
working environment, perform utilities, or control

programs.
Verbs:

Action words used

Functions:

Special operators used

in

programs to construct BASIC statements.
in

BASIC programs

to change one variable into another.

Commands and

verbs are arranged alphabetically. Each entry is on a separate
page for easy reference. The contents of each section
the tables below so that you can quickly identify the category
to which an operator belongs. Functions are grouped
according to four categories and arranged alphabetically within
each category.
are

shown

in

95

Commands
Program Control

Variables Control

CONT
GOTO*
NEW
RUN

CLEAR
DIM*
Angle Mode Control

DEGREE*
GRAD*

Cassette Control

CLOAD

RADIAN*

CLOAD?
CSAVE
INPUT#*

Other

BEEP*
PASS*

MERGE
PRINT#*

RANDOM*
USING*
WAIT*

Debugging

LIST

LLIST

TROFF*
TRON*
*These commands are also BASIC verbs. Their effect
the

command

as

commands

reference section. See the verb reference section for

96

is

identical to their effect as verbs, so they are

more information.

not described

in

Verbs
Control and Branching

CHAIN

END
FOR
GOSUB
GOTO
IF. .THEN
NEXT
ON
GOSUB
ON
GOTO
RETURN
.

.

.

.

.

.

.

STOP
Assignment and Declaration

Input and Output

Other

AREAD

BEEP

CSAVE

DEGREE

DATA

GRAD

INPUT

RADIAN

INPUT#

RANDOM

LPRINT
PAUSE
PRINT

REM
TROFF
TRON

PRINT#
USING

READ
RESTORE
WAIT

CLEAR
DIM
LET

97

Functions
Pseudovariables

Numeric Functions

INKEY$

ABS
ACS
ASN

MEM
PI

ATN
ASC

COS
DEG

CHR$

DMS

LEFTS
LEN
MID$
RIGHTS
STR$

EXP

VAL

SGN

String Functions

INT

LOG
LN

RND
SIN

SQR

TAN

98

COMMANDS
1

2

CLOAD
CLOAD

"filename"

Abbreviations: CLO.,

See also:

CLOA.

CLOAD?, CSAVE, MERGE, PASS

Purpose

Ze'ueZlZT^

" ""*

"

^ ^^ ™" "^ ^ ™ ^
°"

*

'<

be

"«*

with the optional PC-3 Printer/

Use

C mP '"e,

I'i'J"

,°

^

" *' PROgn,m

"

RUN

m0t"' <"° g " m

99

m ' mo "

ls

loaded '""" <"• op..

Whe„

ft.

Com„ u ,.r

is

in

,h„

Examples

CLOAD
CLOAD "PR03"

Loads the

first

program from the tape.

Searches the tape for the program named

"PR03" and

loads

it.

Notes:
1.

The computer cannot
the reserved contents
inoperative.

2.

If

If

this

In this case,

a reserve.

Therefore,

if

a

mode

is

designated incorrectly,

be transferred to the program area or the program to the reserve area, causing the computer to remain

happens, reset the computer by pressing the

the designated filename

end.

program or

identify the stored contents as a

may

is

not retrieved, the computer

will

stop the retrieval function by pressing the

RESET

button on the back of the computer.

continue to search for the filename even after the tape reaches the

J^

key. This applies to

MERGE, CHAIN, CLOAD?

and

INPUT#

(

commands
3.

If

to be described later.

an error occurs during

will

CLOAD

or

CHAIN command

(to be described later) execution, the

be invalid.

100

program stored

in

the computer

1

2

CLOAD?
CLOAD?

"filename

Abbreviations:

See also:

"

CLO.?, CLOA.?

CLOAD, CSAVE, MERGE, PASS

Purpose
,

:r «rp« P™:zi °r ,r
P

8

program sared on

""-"•

~ «» - »-

»

«

rf

Use

^r:™r
™z::i,"°^:r
?

oommand

::

cwes

**

— ——

nd ssarch8s ,he ,,pe

•— *

f° r ,he

» »;»

h °*

—

*.

>

fl

- »* - - -

„ PWm SKr d

—

.

*- »

Examples

CLOAD?
CLOAD? "PR03"

Compares the

first program from the tape
with the one in memory
Searches the tape for the program named
'PROS' and compares it to the one stored

101

in

memory.

„ the tape

,

- *» -

1

CONT

Abbreviations:

See also:

a, co., CON,

RUN STOP

verb

Purpose
The

CONT command

is

used to continue a program which has been temporarily halted.

Use

When

the

STOP

verb

is

used to halt a program during execution, the program can be continued by entering

CONT

in

response to

the prompt.

When

a

program

is

halted using the

(

brk key, the program can be continued by entering
)

Examples

CONT

Continues an interrupted program execution.

102

CONT

in

response to the prompt.

2

CSAVE
CSAVE

3

CSAVE, "password "

4

CSAVE

1

"

"

filename "

filename ", "password"

Abbreviations: CS., CSA.,

CSAV.

CLOAD, CLOAD?, MERGE, PASS

See also:

Purpose
The^

CSAVE contend

is

used to save a program to cassette tape.

,t

can be used with the optiona. PC-3
Printer/Cassette ,nte,

Use
Th,

„* ,„ m

ZZ"
*.

,0

>—

of

,h„

™

°'

c,„

„„

CSAVE commmd

^

CSWE

„m

„

°° mma " d

^r

Pn

ites a||

""""

of (he
'" °'

proorms

"»

jn

—

mmory on(o

<"°*™ *

^ cassem ^

"™ *•

sr«rji; z^zrr

^ ^^

— » *.

^

and as sig „s

by anvone but on,y !om
'

*. Seated

- ne wh ° k -°ws

filename and password.
It

the PC-3

Computer

ReSerVe mode,

reserve

in PROgram or RUN mode, program memory
memory is loaded.

is

is

loaded to the tape.

When

the PC-3

Computer

in

the

name 'PR03', protected with

the

is

Examples

CSAVE "PR03", "SECRET"

Saves the programs

now

in

memory onto

password 'SECRET'.

104

the tape under the

GOTO

1

expression

Abbreviations:

G.,

GO., GOT.

RUN

See also:

L_
Purpose
The

GOTO command

is

used to start execution of a program.

Use

GOTO
1

2)

differs

from

RUN

in

four respects:

The value of the interval for WAIT is
not reset.
The display format established by USING

statements

3) Variables

4)

PRINT

5)

The pointer

=

is

not cleared.

and arrays are preserved.

LPRINT
for

status

READ

Execution of a program with

is

is

not

not

GOTO

is

reset.

reset.

identical to execution with the
(def) key.

Examples

GOTO

100

Begins execution of the program
at line 100.
105

1

LIST

2

LIST expression

Abbreviations:

See also:

L.,

Li.,

LIS.

LLIST

Purpose
The LIST command

is

used to display a program.

Use
The

List

command may

only be used

in

the

PROgram mode. The

first

form of the

list

command

displays the statement with the

lowest line number.

The second form displays the statement with the nearest line number
Down Arrow keys may then be used to examine the program.

Examples
LIST 100

Displays line

number

100.

106

greater than the value of the expression.

The Up Arrow and

LLIST

1

2 LLIST expression^

Abbreviations:

See also:

LL.,

,

expression-2

LLI.,. LLIS.

LIST

Purpose
The LLIST command

is

used for printing a program on the
optional PC-3 Printer/Cassette Interface.

Use
The LLIST command may only be used

The

first

form prints

The second form
1

.o

».

™ mst

all

of the programs

prints the statements

,„

equal to or ar«

PROgram mode.

in

the

in

memory.

from the

line

number with the

mr than the value of expression

2

nearest line equal to or greater than the
«
value of expression

There must te

Examples
LIST 100, 200

Lists the

statements between line numbers 100 and
200.

107

at ieast t

wo

iines

^jj^zz:.

1

2

MERGE
MERGE

"filename

Abbreviations:

See also:

"

MER., MERG.

CLOAD, CLOAD?, CSAVE; PASS

verb

Purpose
The

MERGE command

is

used to load a program saved on cassette tape and merge

it

with programs existing

in

memory.

It

can

only be used with the optional PC-3 Printer/Cassette Interface.

Use
The
it

first

form of the

MERGE command

with programs already

The second form of the

in

MERGE command

with the programs already

in

Programs with overlapping

line

If

the program

on cassette

is

in

loads the first program stored on the tape, starting at the current position, and merges

memory.

memory

is

searches the tape for the program whose

name

is

given by "filename", and merges

it

memory.
numbers

are treated as

one program

after merging.

passward-protected, another password-protected program cannot be merged with

not password-protected,

it

becomes protected by the password of the program

108

in

it.

If

memory when merged.

the program

Example

MERGE
MERGE "PR03"
Note:

Merges the

first

program from the tape.

Searches the tape for the program

For example, assume the Computer
10:

20:

named 'PR03' and merges

memory contains the
PRINT "DEPRECIATION ALLOWANCE"
INPUT "ENTER METHOD: " A

it.

following program:

;

"DEP,- o„
Nowtype:

„.

,

j

taPe

„

zzti:*z, T.r

MERGE "DEP1" and

The computer
something

Cue

in

press

now load "DEP1"
memory similar to this:
will

are curren,iv co " s,ruo,in9

-

The

f,r! '

"" * ,o ,m *•

- -*

(enter)

into

memory

IN

ADDITION

109

tn the
th Q above
*k
to
program.

After

"DEP1"

is

loaded,

you might

find

PRINT "DEPRECIATION ALLOWANCE"
20 INPUT "ENTER METHOD: "; A
10

"DEP1"

REM

>>

SECOND MODULE
PRINT "INTEREST CHARGES"
INPUT "AMOUNT BORROWED: "; B

10

20
30

:

<<

(etc)

Note

that, unlike the

duplicated.

together (See
It is

CLOAD command,

Also note that

a "label"

the

new program DID

was used on the

LINKING MERGED MODULES -

NOT

first line

replace the existing one and that

of the merged module.

This allows

some

line

numbers have been

"LINKING"

of the modules

below).

important that you review the following information before proceeding with any further
editing or programming:

IMPORTANT NOTES
Once

a

MERGE

is

:

performed, no INSERTIONS,

DELETIONS,

or

CHANGES

110

are allowed to previously existing

program

lines.

Examples:

10

"A" REM THIS

20

FOR T=1 TO

IS

EXISTING

PROGRAM

100

LPRINT T
40 NEXT T
30

:

BEFORE
Then

doing

MERGE

a

(Etc)

MERGE

of the next program,

the next program:

10

"B"

REM

make any

MERGE "PROG2"
THIS

IS

necessary changes to this program.

(example)

MERGED PROGRAM

INPUT "ENTER DEPRECIATION:
30 INPUT "NUMBER OF YEARS: "
20

40

Now you may make

.

"
;

;

D

Y

Etc.

changes to the above program since

it

was the

111

last

MERGED

portion.

LINKING

MERGED MODULES

(programs)

TOGETHER

Since the processor executes your program lines

numbering;
are valid:

i.e.,

if

line

numbers

GOTO "B" "GOSUB

30

10, 20,

"B",

IF

.

.

.

in

logical

are followed

THEN "B"

sequence,

by duplicate

(B

is

it

will

line

stop

when

numbers

it

in a

encounters a break

the sequence

in line

second module, the following techniques

used for example only, you can use any label).

112

in

1

NEW

Abbreviations: none

Purpose

NEW command

The

is

used to clear the existing program or
reserve memory.

Use

When

used

in

the

When used

in

the ReSerVe mode, the

The

PROgram mode,

NEW command

is

not defined

the

in

NEW command
NEW command

the

RUN mode

clears

clears

and

all

all

programs and data which are currently

existing reserve

will result in

Examples
NEVV

Clears

program or reserve memory

113

memory.

an Error 9.

in

memory

PASS

1

'

'character strin g"

Abbreviations: none

CSAVE, CLOAD

See also:

Purpose
The PASS command

is

used to set and cancel passwords.

Use
Passwords are used to protect programs from inspection or modification by other users.

which

is

!"#$%&(
Once

a

)*

PASS command

or modified
If

several

program

A

password consists of a character string

no more than seven characters long. The seven characters must be alphabetic or one of the following

in

programs are
is

has been given, the programs

memory.

It

in

in

memory

cannot be output to tape or

memory and PASS

is

listed

entered,

are protected.

PASS statement with

A

password-protected program cannot be examined

with LIST or LLIST, nor

all

programs

merged with a protected program, the merged program

execute another

the same password or to enter

is

in

memory

protected.

NEW

Establishes the password

'SECRET'

for

all

programs

114

in

is it

possible to add or delete

are protected.

The only way

If

to

(which erases the programs).

Examples
PASS "SECRET"

special symbols:

-/,. :;<=>?@V~7r-

+

memory.

a

program

lines.

non-password-protected

remove

this protection

is

to

RUN
RUN

1

2

expression

Abbreviations:

See also:

R.,

RU.

GOTO

Purpose
The

RUN command

is

used to execute a program

in

memory.

Use
The

first

form of the

RUN command

v'alThe

^Ln

RUN

from

differs

executes a program beginning with the
lowest numbered statement

^ ^^

e
-

GOTO

1

The value of the

2)

The

**"*""

'

be9inm ng

^*^

interval for

WAIT

is

reset.

USING

statements

is

cleared.

and arrays other than the fixed variables are
cleared

4)

PRINT

5)

The pointer for

=

^^

in five respects:

display format established by

3) Variables

*

PRINT status

READ

is

is

set.

reset to the beginning

DATA statement.
115

numb8red

»™

in

memory.

"« ^

or

^

to the

Execution of

NEXT

and

a

program with

GOSUB

nesting

is

GOTO

is

identical to execution with the

DEF

cleared.

Examples

RUN

100

Executes the program which begins at

line

number 100.

116

key.

In all

three forms of program execution,

FOR/

VERBS
AREAD

1

variable

name

Abbreviations: A., AR., ARE.,

See also:

INPUT

AREA.

verb and discussion of the use of the

DEF

key

in

Chapter

6.

Purpose
The

AREAD

verb

is

used to read

in a single

value to a program which

is

started using the

DEF

key.

Use

When

a

program

is

single starting value

the label.

If

it

labelled with a letter, so that

without the use of the

appears elsewhere

in

it

INPUT

the program,

can be started using the

verb.

it

will

AREAD

The

DEF

key, the

AREAD

verb must appear on the

verb can be used to enter a

first line

be ignored. Either a numeric or string variable

of the program following

may

be used, but only one

can be used per program.

To

use the

AREAD

the program.

If

verb, type the desired value in the

a string variable

is

being used,

it

is

RUN mode

and press the

DEF

key, followed by the letter which identifies

not necessary to enclose the entered string

1

17

in

quotes.

.

Examples
1(1

AREAD N

"X":

20 PRINT
30

N^2

END

Entering "7 (5ef)

X"

will

produce a display of "49".

Notes:
1

2.

When
When

PROMPT

the display indicates

(">")

the contents are displayed by the

Example: When the program below

at the start of

PRINT
is

program execution, the designated variable

verb at the start of program execution, the following

is
is

cleared.

stored:

executed;

PRINT "ABC", "DEFG"
20 "S"
AREAD A$: PRINT A$
RUN mode
10

"A"

(def)

.(def)

QD

-

(JJ

-+

ABC
DEFG

DEFG

• When the display indicates

PRINT numeric

expression, numeric expression or

PRINT

"String", "String", the contents on the

right of the display are stored.

• When the display
first

indicates

PRINT Numeric

expression; Numeric expression; Numeric expression..., the contents displayed

(on the extreme left) are stored.

• When the display indicates

PRINT

"String"; "String"; "String"..., meaningless contents

118

may

be stored.

1

BEEP

expression

Abbreviations:

B.,

BE.,

BEE.

Purpose
The BEEP verb

is

used to produce an audible tone.

Use
The BEEP verb causes the PC-3 Computer to emit one or more audible tones at 4 kHz. The number of beeps is determined by the
expression, which must be numeric. The expression is evaluated, but only the integer part is used to determine the number of
beeps.

BEEP may
after the

also be used as a

(enter

)

key

is

command

using numeric literals and predefined variables.

pressed.

Examples
10

A

= 5

:

B$="9"

20 BEEP 3
30 BEEP

A

Produces 3 beeps.
Produces 5 beeps.

40 BEEP (A+4)/2

Produces 4 beeps.

50 BEEP B$

This

60 BEEP —4

Produces no beeps, but does not produce an error message.

is

illegal

and

will

produce an

ERROR

9 message.

119

In this case,

the beeps occur immediately

1

2

3
4

CHAIN
CHAIN
CHAIN
CHAIN

expression
"
"filename

"filename ", expression

Abbreviations: CH., CHA., CHAI.

See

also:

CLOAD, CSAVE, and RUN

Purpose
The CHAIN verb

is used to start execution
of a program which has been stored on cassette tape.
with the optional PC-3 Printer/Cassette Interface.

It

can only be used

in

connection

Use

To

use the

CHAIN

running program,

The

first

a

form of

verb,

one or more programs must be stored on a
is loaded from the cassette and
executed.

cassette.

Then, when the

CHAIN

verb

is

encountered

in a

number

the

program

CHAIN

program. The effect

is

loads the first program stored

the same as having entered

The second form of CHAIN

CLOAD

on the tape and begins execution with the lowest
and the

RUN when

in

the

RUN

loads the first program stored on the tape and begins
execution with the line

expression.

120

line

in

mode.

number

specified

by the

The

third

form of

CHAIN

searches the tape for the program

execution with the lowest

line

The fourth form of CHAIN
and begins execution with the

whose name

is

indicated

by "filename",

loads the program,

and begins

number.
will searches
line

number

the tape for the program whose

name

is

indicated

by "filename", loads the program,

indicated by the expression.

Examples
10

CHAIN

20 CHAIN "PRO-2", 480

Loads the

first

program from the tape and begins execution with the lowest

Searches the tape for a program named PRO-2, loads

121

it,

line

number.

and begins execution with

line

number 480,

For example,

CHAIN

let's

assume you have three program sections named PRO-1, PRO-2, PRO-3.

Each of these sections ends with

statement.

"PRO-1"
Magnetic tape

10:

20:

("

f " indicates the position of the tape recorder head.

Execution

CHAIN

400:

400:

Filename

Filename

"PRO-2"

"PRO-3"

CHAIN "PRO-2", 410

."PRO-2"
410:

Execution

700:

700:

CHAIN

CHAIN "PRO-3", 710
122

Filename

Filename

"PRO-2"

"PRO-3"

a

990:

manner,

all

Filename

"PRO-3"

END

During execution, when the Computer encounters the
In this

Filename

"PRO-2"

CHAIN

statement, the next section

of the sections are eventually run.

123

is

called into

memory and

executed.

CLEAR

1

Abbreviations:

See

also:

CL, CLE., CLEA.

DIM

Purpose
The

CLEAR

verb

is

used to erase

all

variables

which have been used

in

the program and to reset

all

preallocated variables to zero or

NUL
Use
The

CLEAR

part of a

verb recovers space which

program are not required

of a program

when

several

in

is

being used to store variables.

This might be done

the second part and available space

programs are resident

in

is

CLEAR may

limited.

memory and you want

when

the variables used

in

the

first

also be used at the beginning

to clear out the space used by execution of prior

programs.

CLEAR
(see

A-

does not free up the space used by the variables

Chapter

4).

CLEAR

Z,

A$ -

Z$, or A(1)

Examples
10

20

A = 5 DIM
CLEAR
:

-

A(26) since they are permanently assigned

does reset numeric variables to zero and string variables to NUL.

C(5)
Frees up the space assigned to C(

)

and

resets

124

A to zero.

1

DEGREE

Abbreviations: DE.,

See

also:

GRAD

and

DEC, DEGR., DEGRE.

RADIAN

Purpose
The

DEGREE

verb

is

used to change the form of angular values to decimal degrees.

Use
The PC-3 Computer has three forms for representing angular
in

specifying the arguments to the SIN,

COS, and

TAN

values

-

decimal degrees, radians, and gradient. These forms are used

functions, and

in

returning the results from the

ASN, ACS, and ATN

functions.

The
The

DEGREE function changes
DMS and DEG functions can

the form for

all

angular values to decimal-degree form until a

Examples

DEGREE
= ASN 1
X
20
10

X now

GRAD

or

RADIAN

be used to convert decimal degrees to degree, minute, second form and vice versa.

has a value of 90,

i.e.,

90 degrees, the Arcsine of

125

1

verb

is

used.

DATA

1

expression

Where: expression

:

expression

or:

expression

list is

Abbreviations: DA.,

See

list

,

expression

list

DAT.

READ, RESTORE

also:

Prupose
The

DATA

verb

is

READ

used to provide values for use by the

verb.

Use

When

FOR
ment
of

assigning initial values to an array,
.

.

is

NEXT

Succeeding

READs

values are listed in each

statement have no effect

seems appropriate.

the values

in a

it

is

convenient to

loop to load the values into the array.

returned.

how many

DATA
it

.

Many programmers

DATA statement can

When

the values

the

first

in a

READ

DATA
is

like

in

or

how many DATA

statement and use

executed, the

use succeeding values in the sequential order in

DATA statement

encountered

if

list

first

a

READ

value in the

which they appear

in

statement

first

in a

DATA state-

the program, regardless

statements are used.

the course of regular execution of the program, so they can be inserted wherever

to include

them immediately following the

be read a second time by using the

126

RESTORE

statement.

READ

which uses them.

If

desired,

Examples
10

DIM BOO)

FOR
30 READ
40 NEXT
20

50
70

DATA
DATA

I

=

1

Sets up an array.

TO

10

B(l)
I

Loads the values from the
B(1) wilt be 1,B(2)

will

DATA statement

be 2, B(3) will be 3,

1,2,3,4,5,6
7,8,9,10

127

into B(
etc.

).

1

DIM dim

Where:

and:

list

dim

list

dimension spec.

and:

numeric dim spec

and;

string

dim spec

and:

numeric name

and:

string

and:

dims

and:

size

and:

len

Abbreviations:

name

is:

dimension spec.

or:

dimension spec, dim

is:

numeric dim spec.

or:

string

is:

numeric name

is:

string

name

(dims)

or:

string

name

(dims)

is:

valid

dim

list

spec.
(size)

*

len

numeric variable name

name

is:

valid string variable

is:

size

or:

size, size

is:

number

is:

length of each string in a string array

of elements

D., Dl.

Purpose
The DIM verb

is

used to reserve space for numeric and string array variables.

128

Use
Except for A(26) and A$(26), which are predefined
variable.

An

array variable and a simple variable

same name except

of elements specified

reserves B(0), B(1), B(2),
In string arrays,

one

maximum
a

A(

and A$(

)

4), a

DIM

verb must be used to reserve space for any array

A

sting array

and

a

numeric array may have the

in

any array

is

two: the

maximum

size of

any one dimension

the dimension statement, one additional "zeroeth" element
In

two-dimensional arrays, there

specifies the size of each string

which

are each a

element

maximum

in

is

is

is

255.

reserved.

In

addition to the

For example, Dim B(3)

an extra "zeroeth" row and column.

addition to the

of 12 characters long.

number of elements. For example, DIM B$(3) * 12
If

the length

is

not specified, each string can contain

of 16 characters.

When

numeric array

preallocated

in

and B(3).

reserves space for 4 strings
a

Chapter

have the same name.

for the dollar sign.

The maximum number of dimensions

number

(see

may not

is

dimensioned,

all

values are initially set to zero; in a string array the values are set to

may be dimensioned to sizes larger
memory and part is in program memory.
)

than 26 with the

DIM

statement.

In this case

NUL.

part of the array

is

in

the

(See Chapter 4.)

Examples
10

DIM B(10)

20 DIM C$(4,4)

Reserves space for numeric array with

*

10

1 1

elements.

Reserves space for a two-dimensional string array with 5 rows and 5 columns: each string will be a maxi-

mum

of 10 characters.

129

END

1

Abbreviations:

E.,

EN.

Purpose
The

END

verb

is

used to signal the end of

a

program.

Use

When

multiple programs are loaded into

so that execution does not continue

memory

at the

same time,

a

mark must be included

from one program to another. This

is

to indicate

done by including an

END

where each program ends

verb as the

last

statement

in

the program.

Examples
10

PRINT "HELLO"

With these programs

20

END

'GOODBYE'.

30

PRINT "GOODBYE"

40

END

in

memory

a

'RUN

130

10' prints

'HELLO', but not 'GOODBYE'. 'RUN 30'

prints

1

2

FOR
FOR

numeric variable = expression

1

numeric variable = expression

1

STEP
Abbreviations:

See

TO
TO

expression 2
expression 2

expression 3
F.

and FO.; STE.

NEXT

also:

Purpose
The FOR verb

is

used

in

combination with the

NEXT

verb to repeat a series of operations a specified

number

of times.

Use
The FOR and the

NEXT

group of statements

is

verbs are used in pairs to enclose a group of statements which are to be repeated.

The

first

time this

executed the loop variable (the variable named immediately following the FOR) has the value of expression

1.

When execution

reaches the

NEXT

verb, this value

equal to expression 2, the loop variable

with the statement following the FOR.
the value of the loop variable

3.

If

the

NEXT. Because

Expression

1

the comparison

is

is

is

is

tested against expression 2.

If

the value of the loop variable

increased by the step size and the enclosed group of statements
In

the

first

form, the step size

is 1

;

in

at the end, the

and expression 2 may have any value

in

statements within

the numeric range.
131

a

FOR/NEXT

When

expression

is

less

than or

executed again, starting

the second form, the step size

greater than expression 2, execution continues with the statment

made

is

is

given by expression

which immediately follows

pair are always executed at least once.
1

and expression 2 are compared, only

the integer part

The loop

is

variable

used.

may

Expression 3 must be an integer

in

the range of

-32768

to 32767;

it

may

not be zero.

be used within the group of statements, for example as an index to an array, but care should be taken

in

changing the value of the loop variable.

Programs should be written so that they never jump from outside
Similarly, programs

To do

this, set

must never

leave a

FOR/NEXT

pair

the loop variable to a value higher than expression

The group of statements enclosed by

a

FOR/NEXT

loop variable, as long as the enclosed pair

is

NEXT must

pairs

also be included.

FOR/NEXT

FOR/NEXT

pair to a statement within a
a

FOR/NEXT

loop via the

FOR/NEXT pair.
NEXT statement.

2.

pair can include another pair of

completely enclosed:

may

a

by jumping out. Always exit

i.e.,

if

a

FOR

FOR/NEXT statements

statement

be "nested" up to five levels deep.

132

is

included

in

which use

a different

the group, the matching

Examples
10

FOR

1

=

20 PRINT
30

NEXT

TO

1

5

1, 2, 3, 4, 5.

I

40 FOR N- 10
50 PRINT N
60

NEXT N

70

FOR N

80

X=

=

1

TO

TO

STEP -1-n

This group of statements counts

down

10, 9, 8, 7, 6, 5, 4,

3 2 1,0.
#

10

1

FOR F = 1 TO N
X = X*F
110 NEXT F
120 PRINT X
130 NEXT N

90

This group of statements prints the numbers

I

This group of statements computes and prints

100

133

N

factorial for the

numbers from

1

to 10.

GOSUB

1

expression

Abbreviations:

See

also:

GOSUB.

GOS.,

GOTO, ON

.

.

.

GOSUB, ON

.

.

.

GOTO, RETURN

Purpose
The

GOSUB

verb

is

used to execute a

BASIC

subroutine.

Use
When you wish

to execute the

statements

in several

The group

of statements

tion.

A

programs,

is

in

the program at

following the

END

main body of the program, where subroutines

capability for subroutines using the

some

location

last line

The expression

include a

in a

GOSUB.

GOSUB

Subroutines

statement

may

the course of a program, or use a previously written set of

where they are not reached

indicated line

may

GOSUB

in

GOSUB

and

RETURN

verbs.

the normal sequence of execu-

At those locations

in

the

statement with an expression which indicates

of the subroutine must be a

then transferred back to the statement following the

A subroutine may

in

are to be executed, include a

number of the subroutine. The
PC-3 Pocket Computer transfers control to the
is

time

BASIC

statement which marks the end of the main program.

the starting line

Control

several

convenient to use the

included

is

frequent location

same group of statments
it is

RETURN. When GOSUB

number and processes the statements

until a

is

executed, the

RETURN

reached.

is

GOSUB.

be "nested" in this fashion up to 10 levels deep.

not include

a

comma,

e.g.,

'A(1,2)' cannot be used. Since there

is

an

ON

.

.

.

GOSUB

structure for choosing different subroutines at given locations in the program, the expression usually consists of just the desired line

134

number. When

a

numeric expression

is

used,

it

must evaluate to

a valid line

number,

i.e., 1

to 999, or an

EXAMPLES
10

20

GOSUB
END

100 PRINT
110

100

When

this

program

is

run

it

prints the

"HELLO"

RETURN

13.R

word 'HELLO' one time

ERROR

4

will occur.

1

GOTO

expression

Abbreviations:

See also:

G.,

GOT.

GO.,

GOSUB, ON

.

.

.

GOSUB, ON

.

.

.

GOTO

Purpose
The

GOTO

verb

is

used to transfer control to a specified line number.

Use
The

GOTO

verb transfers control from one location

does not "remember" the

The expression

in a

in a

to another location.

Unlike the

'A(1,2)' cannot be used.

Since there

BASIC program

GOSUB

verb,

GOTO

location from which the transfer occurred.

GOTO

statement

may

not include

a

comma,

e.g.,

is

an

ON

.

.

.

GOTO

structure for choosing different destinations at given locations in the program, the expression usually consists of just the desired
4 will occur.
line number. When a numeric expression is used, it must evaluate to a valid line number, i.e., 1 to 999, or an

ERROR

Well-designed programs usually flow simply from beginning to end, except for subroutines executed during the program.
fore, the principal use of the

GOTO

verb

is

as a part

of an

I

F ...

TH EN

136

statement.

There-

Examples
10 INPUT

30

A$
IFA$= "Y" THEN GOTO
PRINT "NO"

40

GOTO 60

20

This program prints 'YES'

if

50

50 PRINT "YES"

60

END

137

a 'Y'

is

entered and prints 'NO'

if

anything else

is

entered.

1

GRAD

Abbreviations:

See also:

GR.

DEGREE

,

GRA.

and

RADIAN

Purpose

GRAD

The

verb

is

used to change the form of angular values to gradient form.

Use
The PC-3 Pocket Computer has three forms
are used in specifying the

ATN
The

for representing angular values

arguments to the SIN, COS, and

TAN

-

decimal degrees, radians, and gradient. These forms

functions and

in

returning the rusults from the

GRAD

function changes the form for

form represents angular measurement

in

all

angular values to gradient form until a

terms of percent gradient,

i.e.,

a 45° angle

is

DEGREE

a

50%

Examples
10

ASN, ACS, and

functions.

GRAD

20 X =

ASN

1

X now

has a value of 100,

i.e.,

a

100%

gradient, the Arcsine of

138

1.

or

RADIAN

gradient.

verb

is

used. Gradient

THEN

statement

1

IF condition

2

IF condition statement

Abbreviations: none for IF, T., TH.,

THE.

Purpose
The

IF

.

.

.

THEN

verb pair

is

used to execute or not execute a statement, depending onconditionsat the time the program

is

run.

Use
In

BASIC program, statements
made during execution

the normal running of a

verb pair allows decisions to be

condition part of the

F statement

I

The condition part of the
numeric expression
zero or a negative

as a

number

LET

THEN

verb

itself

statement

is

true, the statement

IF statement can be

any

is

so that a given statement

executed; when

it is

is

THEN may

be any

BASIC

Unless the statement

is

an

I

is

or

ON

.

are identical in action, but the first

139

form

is

clearer.

.

is

.

The

IF

Any

.

.

.

THEN

When

the

skipped.

4.

It

is

also possible to use a

expression which evaluates to

considered True.

statement, including another IF.

END, GOTO,

is

Chapter

less clear.

the next one executed, regardless of whether or not the condition

The two forms of the F statement

statement

relational expression as described in

considered False; any which evaluates to a positive number

must appear.

which they occur.

executed only when desired.

is

False, the

condition, although the intent of the statement will be

The statement which follows the
the

is

are executed in the sequence in

GOTO,
True.

.

.

THEN.

If it is

a

LET statement,

the statement following the IF

.

.

.

Examples
10 INPUT "CONTINUE?";

20 IF

30 IF

60

This program continues to ask

A$ "YES" THEN GOTO 10
A$ = "NO" THEN GOTO 60

40 PRINT "YES
50

A$

=

GOTO
END

'NO'

is

'CONTINUE?'

as long as

'YES'

is

entered;

it

stops

if

entered, and complains otherwise.

OR NO, PLEASE"

10

Note:
This unit

is

capable of calculation for

side the unit

up to 12

digits,

a

mantissa of up to 12

the result of which

is

digits.

To

increase accuracy, however, the mantissa

rounded to the 10th

digit for display.

is

calculated

For example, 5/9 and 5/9

*

calculated as follows:

5.55555555555E-01

5/9

t

-This

Display

5.555555556E-01

5/9*9

4.99999999999E00
-This

is

rounded to the 10th

digit.

is

rounded to the 10th

digit.

Display

Thus, calculations are carried out for mantissas of up to 12

performed

in

digits.

This

succession and independently.

140

may

cause a difference

in

the results of calculations

in-

9 are

when

[Example

3-9

1]

Successive calculation:

3

(shift)

Independent calculation:

3

(shift)

CZD

Q

GE)

2

2 (enter

Q9

Even

in

may

the IF statement, this difference

[Example

10 INPUT

2]

20 IF
With
In this case,

(

ENTER

A
AA2

20

B>=9THEN

-

)

-9.E-11

-»

9.

-

0.

)

cause the program not to work

THEN

as

planned for any successive calculations.

50

3^2 results in 8.99999999991 E 00, making an

3,

reprogram the calculation by using variables so that

15 B =

)

A

A^2>=9

A=

(ENTER

9

it is

independent,

IF statement unformulated.
as follows:

10 INPUT

IF

Power calculations

50

are based

A^2

\

The

J

ditional expression.

result of

is

on log x and 10 x thus tending to cause
,

the computer.

A^
•

When

the

A

is

negative,

substituted for a variable, which

B

B must be an

M0 B

!ogA

integer.

141

a difference in the results

is

used to formulate con-

from those calculated

inside

INPUT

1

Where:

and:

input

input

list

list

input group

and:

var

and:

prompt

list

Abbreviations:

See

INPUT

also:

IN.,

I.,

#,

INP.,

is:

input group

or:

input group, input

is:

var

or:

prompt

,

var

list

or:

prompt

;

var

list

is:

variable

list

list

or:

variable

is:

any

,

var

list

string constant

INPU

READ

Purpose
The INPUT verb

is

used to enter one or more values from the keyboard.

Use
When you want
In its

to enter different values each time a program

simplest form, the

INPUT statement

of the display with the cursor next to

it.

does not include

A

value

is

is

run, use the

a

prompt

INPUT

string; instead, a question

then entered, followed by the
142

verb to enter these values from the keyboard.

(ENTER)

mark

is

displayed on the

key. This value

is

left

edge

assigned to the

first

variable in the
If

a

prompt

prompt

included

is

string

other variables are included

if

list,

is

in

the

INPUT

displayed at the

left

immediately following the prompt.
the display

When

a

is

cleared and the

prompt

first

If

If

If

INPUT statement,

statement, the process

the prompt

is

is

a

If

is

more than one
second prompt

a

comma,

displayed at the

is

variable in the
is

this process

is

repeated until the

list is

exhausted.

exactly the same except that, instead of the question mark, the

the prompt string

followed by

character of the input

prompted with the question mark.
follows

the same

edge of the display.

specified and there

is

in

included

in

the

left

list

the

is

followed by a semicolon, the cursor

prompt

is

displayed; then,

when

a

is

positioned

key

is

pressed,

edge.

following

list,

it

is

it,

the second and succeeding variables are

displayed for the variable which immediately

it.

alphabetic characters are entered for a numeric variable, the variable

and no input

is

provided, the variable retains the value

had before the

it

is

assigned a value of zero,

if

the

(enter

)

key

is

pressed

INPUT statement.

Examples
10 INPUT

A

Clears the display and puts a question

"
20 INPUT "A =

;

30 INPUT "A = "

,

?

;

at the left edge.

Displays 'A ='

When
40 INPUT "X =

mark

Displays ''A =" and then displays the input data continuously.

A
A
x

,

"Y

the data

Displays 'X =

and 'Y =

?' is

is

?'

input,

"A ="

disappears and then the data

and waits for

displayed at

143

left

first

edge.

input.

After

Center

)

is

displayed.
is

pressed, display

is

cleared

INPUT
INPUT
3 INPUT
4 INPUT

#
#
#
#

1

2

where: var

'

'

'filename"

;

var

list

list

Abbreviations:

See also:

'filename"

varlist

is:

variable

or:

variable

l.#, IN. #, INP. #,

INPUT, PRINT #,

var

list

INPU.L

READ

Purpose
The INPUT #verb

is

used to enter one or more values from the cassette tape.

Use

PRINT #

saves the values of variables on tape.

They can then be read back

into the

same or another program using the INPUT#

verb.

With the

first

form, the values are read from the tape and assigned to the 26 preallocated storage locations. They can be used by

referring to variables

A~Z

and

With the second form, the tape

A$ ~
is

Z$, as appropriate.

searched for the indicated filename and the variables are loaded, as

144

in

the

first

form.

With the third form, variables are read from the tape, starting
at the current location, and loaded into the variables in
the order in
which they appear in the variable list. If there are not enough
values on the tape for the number of variables in the list, then
zero
or

NUL

values are assigned to the remainder.

With the fourth form, the tape

There

a special variable

is

enclosed

in

is

searched for the indicated filename and the variables are loaded
from the values saved

form which may be used

the parentheses,

e.g.,

B(*) or F$(*).

including the simple variable of the
ly stored.

You may

not read

same name;

a single

in

the variable

This form causes
i.e.,

B(

*

)

list.

all

restores B

It

in

that

file.

looks like an array variable except that an asterisk

values of the indicated variable to be restored

and B(0), B(1), B(2),

etc.,

many

for as

is

from the tape

values as were original-

element of an array.

Examples
10 INPUT

A,B,C,

20 INPUT

"FIL2"; D,

30

"FIL3"; G(*)

#
#
INPUT #

Reads three values from the current position of the tape.
E,

F

Searches the tape for the

file

Searches the tape for the

'FIL2' and reads

file

in

'FIL3' and reads

three values.
in

G and

as

many

values of G(

)

as are

available.

NOTES:
1. When

the prerecorded data on tape

is

or string variable), size, and length.
will

transferred to a variable, the data and variable should be
coincident in shape (numerical
error (ERROR 8) will result unless they are coincident in size
and length. No error

An

occur when they are not coincident

numerical data

is

in shape.
In this case, however, the transfer of incorrect data may result
when the
transferred to a string variable or the string data to a numerical variable.
Therefore, the data and variable should

also be coincident in shape.
2.

The data
is

out, or

transfer to variables in the fixed variables and/or in the shape
of

when

the

Computer memory

is

filled to capacity.

145

A

(

)

terminates

when

the prerecorded data on tape

1

LET

2

variable = expression

variable = expression

Abbreviations:

LE.

Purpose
The LET verb

is

used to assign a value to a variable.

Use
The LET verb
variable,

assigns the value of the expression to the designated variable.
The type of the expression must match that of the
only numeric expressions can be assigned to numeric variables
and only string expressions can be assigned to string
In order to convert from one type to the other, one
of the explicit type conversion functions, STR$ or VAL, must be

i.e.,

variables.

used.

The LET verb may be omitted
ment.

In this

one case, the

LET

in all

LET

statements except those which appear

verb must be used.

Examples

f
20

I

= 10

A=

5*1

30 X$ = STR$ (A)
40 IFI>10 THEN LET Y$ = X$+".00"

Assigns the value 10 to

I.

Assigns the value 50 to A.
Assigns the value '50' to X$.
Assigns the value '50.00' to Y$.

146

in

the

THEN

clause of an IF

.

.

.

THEN

state-

LPRINT
LPRINT
LPRINT

1

2

3

Where:

and:

print expr

print expr
print

print

,

print expr

list

list

s:

print expr

or:

print expr

s:

expression

j

print expr

j

or:

The USING clause
Abbreviations:

See also:

is

LP.,

USING

described separately under

LPR.,

PAUSE, PRINT,

LPR I.,

;

print

clause

;

list

expression

USING

LPRIN.

USINT, and WAIT

Purpose
The LPRINT verb

is

used to print information on the Printer of the optional PC-3 Printer/Cassette
Interface.

Use
The LPRINT verb

used to print prompting information, results of calculations, etc. The
first form of the LPRINT statement
If the expression is numeric, the value will
be printed at the far right edge of the paper. If it is a string
expression, the print is made starting at the far left.
is

prints a single value.

147

::::™:i:z:^

i~

z ,":;;;:: r t: ::;;r
in

It is

-f

possible to cause

at the ,eft

PRINT statements

is

is

*

divided

-

tw °

and each vaiue

to

work

as

LPRINT

printed

statements. See the

PRINT

characters, the first

no halt or wait after execution of an

»~ -- - - - — « *~> — - —

is

e

an^LPRINT statement contains more than
24

Unlike PRINT, there

the paper

LPRINT

verb for details.

24 are printed on one

statement as there

is

line,

the next 24 on the next

with PRINT.

Examples
Paper

10

20

30
40
50

A=10 B=20 X$="ABCDEF"
LPRINT A
LPRINT X$
LPRINT A, B
LPRINT A;B;X$
:

:

10.

ABCDEF
10.

10. 20.

148

ABCDEF

20.

line,

and

1

NEXT

numeric variable

Abbreviations:

See also:

N.,

NE.,

NEX.

FOR

Purpose

NEXT verb

The

is

used to mark the end of a group of statements which are being repeated

in a

FOR/NEXT

loop.

Use
The use of the

NEXT

verb

is

variable in the corresponding

generally described under

FOR. The numeric

FOR.

Examples

FOR

1

=

20 PRINT

I

10

30

NEXT

1

TO

10

Prints the

numbers from

I

149

1

to 10.

variable in a

NEXT

statement must match the numeric

ON

1

GOSUB

expression

Where: expression

Abbreviations:

expression

list

:

expression

or:

expression

i

S

,

expression

list

GOS., GOSU.

0.,

GOSUB, GOTO, ON

See also:

list

.

.

.

GOTO

Purpose
The

ON

.

.

.

GOSUB

verb

is

used to execute one of

a set

of subroutines, depending on the value of a control
expression.

Use

When

the

ON

.

.

.

GOSUB

value of the mteger

subroutine

m

is

the

list

which follows the

ON

If

the expression

is

1,

is

first

executed, the expression between
subroutine

in

executed, and so forth.

is

.

verb

the

.

.

the

list

After the

is

ON

executed

RETURN

and

GOSUB

as in a

normal

is

evaluated and reduced to an integer

GOSUB.

If

the expression

is

2, the

If

the

second

from the subroutine, execution proceeds with the statement

GOSUB.

zero, negative, or larger than the

execution proceeds with the next

line of

number of subroutines provided

in

the

list,

no subroutine

is

executed and

the program.

NOTE: Commas may not be used in the
commas in expressions and commas between

expressions following the
expressions.

150

GOSUB.

The PC-3 Computer cannot

distinguish

between

Examples

Z
END

20 uim
^w
30

T A
A G
bOt>UB
OSUB 100,200,300
100 200 300

^ "T *

^ ^^

9
'
"' *
input does not produce any print.

100 PRINT "FIRST"
110

RETURN
"SECOND
RETURN

200 PRINT

210

300 PRINT "THIRD"
310 RETURN

151

™

"
%

SEC0ND ";

3

P*"* "THIRD". Any

other

ON

1

GOTO

expression

Where: expression

Abbreviations:

expression

list

0., G., GO.,

is:

expression

or:

expression

,

expression

list

GOT.

GOSUB, GOTO, ON

See also:

list

.

.

.

GOSUB

Purpose

ON

The

.

.

.

GOTO

verb

is

used to transfer control to one of a set of locations, depending
on the value of a control expression.

Use
When

the

ON

.

.

.

GOTO

value of the integer

second location
If

in

the expression

line

is

the
is

1,

verb

is

control

list,

executed, the expression between
is

ON

and

transferred to the first location in the

GOTO

list.

If

is

evaluated and reduced to an integer.

the expression

is

2, control

is

If

the

transferred to the

and so forth.

zero, negative, or larger than the

number of

locations provided

in

the

list,

execution proceeds with the next

of the program.

NOTE: Commas may not be used
in expressions and commas between

in

the expressions following the

expressions.

152

GOTO. The Computer

can not distinguish between

commas

Examples

w oTiVoTO
Abuio
II uim
30

GOTO

100
200 300
100,200,300

^

"
1 PrimS
F,RST "' 2 PrlntS " SEC0ND "; 3 Prinu
'
""'Idoes not produce any print
input

900

100 PRINT "FIRST"
110 GOTO 900

200 PRINT "SECOND"

GOTO 900
300 PRINT "THIRD"
310 GOTO 900
210

900

END

153

'THIRD". Any other

1

2

3

PAUSE
PAUSE
PAUSE

print expr
print expr
print

Where: print

,

print expr

list

list

is:

primexpr

or:

print expr

s:

expression

and: print expr

j

or:

The USING

clause

Abbreviations:

See also:

is

USING

described separately under

PA., PAU.,

;

print

clause

;

list

expression

USING

PAUS.

LPRINT, PRINT, USING, and WAIT

Purpose
The

PAUSE

verb

is

used to print information on the display for
a short period.

Use

PAUSE verb is
PRINT except that,
The

used to display prompting information,
results of calculations, etc. The operation
of PAUSE is identical to
PAUSE, the PC-3 Computer waits for a short preset
interval of about .85 seconds and the
c n'inues
execut.on of the program without waiting for
the ENTER key or the WAIT interval.
after

154

The

first

form of the

end of the display.

PAUSE

If it is

a single value.

a string expression, the value

With the second form of the
in

statement displays

PAUSE

is

If

the expression

printed at the far

statement, the display

is

left

divided into

is

numeric, the value

is

printed at the far right

end of the display.

two 12-character

halves.

The two values

With the third form, the display
left to right,

PAUSE
While

it

starts at the left

statements are not affected by the
is

edge and each value

displayed immediately following the previous value from

is

with no intervening space.

possible to write

display. There

is

no way

PAUSE

PRINT-LPRINTstatement

(see

PRINT).

statements which would display more than 24 characters, only the leftmost 24 appear

to see the other characters.

Examples
10

A

= 10

20 PAUSE

:

B = 20

:

X$= "ABCDEF"

Display

A

10.

30 PAUSE X$

ABCDEF

40 PAUSE A, B
50

are displayed

each half, according to the same rules as above.

PAUSE

A; B;

10.

X$

10. 20.

155

ABCDEF

20.

in

the

PRINT print expr
PRINT print expr
3 PRINT print list
4 PRINT = LPRINT
5 PRINT = PRINT
1

2

Where: print

lis t

,

print expr

is:

and: print exp r

or:

printexpr

is:

expression

or:

The USING

clause

Abbreviations:

See also:

P.,

is

printexpr

USING

described separately under

;

print

list

clause expression

USING

PR., PR|., prim.

LPRINT, PAUSE, USING, and WAIT

Purpose
The PRINT verb

Use

is

used to print information on the display
or Printer of the PC-3 Printer/Cassette
Interface.

sion, the value

is

printed at the far

With the second form of the
in

PRINT

end of the display.

statement, the display

is

divided into

two 12-characters

halves and the

two

values are displayed

each half, according to the same rules as above.

With the third form, the display
left

starts at the left

edge and each value

is

displayed immediately following the previous value from

to right, with no intervening space.

The fourth and
in

left

statements

will again

While

possible to write

it

is

display. There

is

PRINT

forms of the

fifth

the program to be treated as

if

statement do no printing. The fourth form causes

they were

work with the

LPRINT

statements.

The

fifth

form

all

PR INT statements which follow

resets the fourth condition so that the

display.

PRINT statements which would display more than 24 characters, only the leftmost 24
appear
no way to see the other characters.

Examples
10

A=

10

:

B = 20

20 PRINT

A

30 PRINT

X$

:

X$

=

"ABCDEF"

Display

ABCDEF

40 PRINT A, B
20.

50 PRINT A; B;

it

PRINT

X$

10. 20.

157

ABCDEF

in

the

PRINT
PRINT
PRINT
PRINT

1

2

3
4

#
#
#
#

Where: var

"
-filename
"
"
filename
"

;

var

list

Abbreviations:

See also:

filename "

list

:

variable

or:

variable

j

P.

INPUT

S

#. PR. #, PRj. #, PR|N.
#,

PRINT,

,

var

list

#

READ

Purpose
The PR INT

# verb

is

used to store one or more values on the cassette tape.

Use
Using
the

PRINT

INPUT*

With the

first

#, the values of variables can be saved on tape. These can then be read back into the
verb.

form, the values of the 26 preallocated storage locations (variables

A-Z

and

A$ -

same or another program using

Z$) are stored on the tape.

With the second form, the 26 preallocated storage locations are stored on
the tape under the designated filename.

158

With the third form, the indicated variables are stored on the
tape, starting

at the current location.

With the fourth form, indicated variables are stored on the
tape under the designated filename.

There

is

enclosed

a special variable
,n

form which may be used

the parentheses,

e.g.,

B(*) or F$<*).

including the s.mple variable of the

You may not

same name,

in

the variable

list.

This form causes

all

It

looks like an array variable, except that an asterisk

is

values of the indicated variable to be saved on the tape

B<*) saves B and B<0), B(1

i.e.,

'

),

B(2), etc., for as

many

values as are in the array!

save a single element of an array.

Examples
10

PRINT #

20 PRINT
30

A, B,

C

"FIL2"

#
PRINT# "FIL3";G<*)
;

D, E, F

Saves three values on the tape at the current position.
Saves three values on the tape under the filename "FIL2".

Saves

G and

all

values of G(

)

on the tape under the filename "FIL3".

Note:

A

variable

executed.

above A(27), or
If

the variable

is

a

dimensional variable, must be secured into the program/data area before
the

not designated before the

PRINT # command,

159

an error

(ERROR

3) will result.

PRINT # command

is

RADIAN

1

Abbreviations:

See also:

RAD., RADI., RADIA.

DEGREE

and

GRAD

Purpose
The

RADIAN

verb

is

used to change the form of angular values to radian form.

Use
The PC-3 Pocket Computer has three forms
are used in specifying the

ATN

TAN

-

decimal degrees, radians, and gradient. These forms

functions and

in

returning the results from the

represents angles
is

in

for

all

angular values to radian form until a

terms of the length of the arc with repect to

a radius,

i.e.,

DEGREE

360°

is

or

G RAD

2 PI times the radius.

RADIAN
ASN

20 X =

1

x now

has a value of

1.570796327 or

160

verb

is

used.

Radian form

2PI radians, since the circumference of a

Examples
10

ASN, ACS and

functions.

The RADIAN function changes the form
circle

for representing angular values

arguments to the SIN, COS, and

PI/2, the Arcsine of

1.

RANDOM

1

Abbreviations:

RA.,

RAN., RAND.,

RANDO.

Purpose

RANDOM

The

verb

is

used to reset the seed for random number generation.

Use

When random numbers

RANDOM

number. The

The

are generated, using the

verb resets this seed to a

starting seed will be the

RND

,s

RND

function, the PC-3 Computer
new randomly-determined value.

begins with a predetermined "seed" or starting

same each time the PC-3 Computer

the same each time, unless the seed

is

changed.

This

is

is turned on, so the sequence of
random numbers generated with
very convenient during the development of a program because
it

means that the behav,or of the program should be the same each
time
want the numbers, to be truly random, the RANDOM statement

it is

run, even though

can be used to

it

make the seed

includes a
itself

RND

function

When you

random.

Examples
10

RANDOM

20

X

=

RND

1

When

run from

line

20, the value of

X

is

based on the standard seed.

used.

161

When

run from line 10, a

new

seed

is

READ

1

variable

Where: variable

Abbreviations:

Sea also:

list

list

is:

variable

or:

variable

,

variable

list

REA.

DATA, RESTORE

Purpose

READ

The

verb

is

used to read values from a

DATA statement and

assign

them

to variables.

Use

When

FOR

assigning initial values to an array,
.

ment
less

If

of

.

in

.

NEXT

returned.

how many

it

is

convenient to

loop to load the values into the array.

Succeeding

READs

When

the values in a
the

first

READ

DATA
is

statement and use

executed, the

use succeeding values in the sequential order

values are listed in each

desired, the values in a

list

in

be read a second time by using the

162

are used.

RESTORE

a

READ

statement

value in the first

which they appear

DATA statement or how many DATA statements

DATA statement can

first

statement.

in

in a

DATA state-

the program, regard-

Examples
10

20

30
40
50

60

DIMBO0)
FOR = 1 TO
l

READ B(l)
NEXT
DATA 1,2,
DATA 7, 8,

Sets up an array

10
Loads the values from the

DATA statement

I

3,4,5,6
9,

10

1fi3

into B(

)

—

B(1) is1,B(2)

is

2, B(3)

is

3, etc.

REM

1

remark

Abbreviations:

none

Purpose

REM

The

verb

is

used to include

comments

in a

program.

Use
Often

it

is

useful

to include explanatory

comments

in

a

program.

modification, usage notes, reminders about algorithms used, etc. These

The
the

REM statement has no
REM verb in that line

is

effect

comments

titles,

are included

on the program execution and can be included anywhere

treated as a

comment, so the

REM

verb must be the

lines are used.

Examples
10

These can provide

REM THIS LINE HAS NO EFFECT.

164

last

in

names of authors, dates of

by means of the
the program.

statement

in a line

REM

last

statement.

Everything following

when

multiple statement

RESTORE
RESTORE

1

2

expression

RES., REST., RESTO.,

Abbreviations:

RESTOR.

DATA, READ

See also:

Purpose

RESTORE

The

verb

is

used to reread values

in a

DATA statement

or to change the order in which these values are read.

Use
in

the regular use of the

READ

verb, the

the

first

DATA

value of the first

statement, so that

it

The

first

and provalue of

line

number

is

first

value

form of the

can be read again. The second

DATA statement whose

DATA statement

RESTORE statement resets the pointer to the first
form of the RESTORE statement resets the pointer to

PC-3 Pocket Computer begins reading with the

ceeds sequentially through the remaining values.

greater than the value of the expression.

165

in a

the

first

Examples
10

DIM

20

FOR

30

READ

40
50

RESTORE
NEXT

60

DATA

B(10)
1

=

1

TO

B(l)

Set up an array.

10
Assigns the value 10 to each of the elements of B(

I

10

166

)

1

RETURN

Abbreviations:

See also:

RE.,

RET., RETIL,

GOSUB, ON

.

.

.

RETUR.

GOSUB

Purpose
The

RETURN

verb

is

used at the end of a subroutine to return control to the statement
following the originating

GOSUB.

Use

A

may have more than one RETURN statement, but the first one executed
terminates the execution of the subroutine
The next statement executed will be the one following the GOSUB
or ON
GOSUB which calls the subroutine. If a RETURN is
subroutine

.

executed without

a

GOSUB,

.

.

an Error 5 will occur.

Examples
10

20

GOSUB
END

100 PRINT
110

100

When

run, this

program prints the word

"HELLO"

"HELLO"

RETURN

167

one time.

STOP

1

Abbreviations:

See

END,

also:

S.,

ST., STO.,

CONT command

Purpose
The STOP verb

is

used to halt execution of a program for diagnostic purposes.

Use
When

the

'BREAK

STOP

verb

is

encountered

IN 200' where 200

is

the

in

program execution, the PC-3 Computer execution

number

of the line containing the

check the flow of the program or examine the state of
the Left

Arrow

or Right

Arrow keys

after a

STOP

variables.

STOP. STOP

Execution

restores the display to

Examples
10

STOP

Causes

"BREAK

IN

10" to appear

in

the display.

168

its

may

is

halts

and

a

message

is

displayed, such as

used during the development of a program to

be restarted using the

condition prior to the STOP.

CONT command.

Pressing

1

TROFF

Abbreviations:

See also:

TROF.

TRON

Purpose

TROFF

The

verb

is

used to cancel the trace mode.

Use
Execution of the

TROFF

verb restores normal execution of the program.

Examples
10

TRON

FOR =
30 NEXT!
40 TROFF
20

I

When
1

TO

run, this

program displays the

3

169

line

numbers

10, 20, 30, 30,

30 and 40.

TRON

1

Abbreviations: TR.,

See also:

TRO.

TROFF

Purpose
The

TRON

verb

is

used to initiate the trace mode.

Use
The

trace

mode

provides assistance

moving on to

mode

debugging programs.

When the trace mode is on, the line number of each statement is disThe PC-3 Computer then halts and waits for the Down Arrow key to be pressed
before
the next statement. The Up Arrow key may be pressed to see the
statement which has just been executed. The

played after each statement

is

in

executed.

trace

continues until

a

TROFF

verb

is

executed.

Examples
10

TRON

When

FOR 30 NEXT
40 TROFF
20

I

1

TO

run, this program displays the line

3

I

170

numbers

10, 20,

30 30 30 and 40

1

2

USING
USING

"editing specification ''

Abbreviations:

See also:

U.,

US., USI., USIN.

LPRINT, PAUSE, PRINT

Further guide to the use of

USING

is

provided

in

Appendix C

Purpose
The USING verb

is

used to control the format of displayed or printed output.

Use
The USING verb can be used by
a specified

The

format for

all

itself

or as a clause within a

output which follows

editing specification of the

USING

until

LPRINT, PAUSE,

changed by another

USING

verb consists of a quoted string

Right-justified

•

Decimal point.

numeric

field character.

^

Used to indicate that numbers should be displayed

&

Left-justified

alphanumeric

in scientific

field.

171

PRINT

statement. The

USING

verb establishes

composed of some combination of the following

characters:

#

or

verb.

notation.

editing

-

;:nr^^^^^
Editing specifications may include
character field next to each other.
If

the editing specifications

is

more than one

missing, as in format

1

field.

,

For
--or

examole "###*«,*,*,*,"
example,
u be
k used
^ *
could
####&&&& „„
to print
.

special formatting

is

a

numeric and

turned off and the built-in display rules
pertain.

Examples
10

A

Display

=

125:X$="ABCDEF"

20 PRINT USING
30 PRINT USING

"##.##~~» ;A

"&&&&&&&&"; X$

1.25E

[~ABCD EF

40 PRINT USING "####&&&"; A; X$

1

172

25ABC

02

a

WAIT
WAIT

1

2

expression

Abbreviations:

See

also:

W., WA., WAI.

PAUSE, PRINT

Purpose
The WAIT verb

is

used to control the length of time that displayed information

is

shown before program execution continues.

Use
in

normal execution, the PC-3 Pocket Computer

halts

execution after

WAIT command causes the PC-3 Computer to display
PAUSE verb). The expression which follows the WAIT
value from

65535

is

until the

to 65535.

Each increment

about 17 minutes.
(enter)

key

is

WAIT

is

a

PRINT command

verb determines the length of the interval.

about one sixty-fourth of

a

second.

WAIT

64

(enter

)

key

is

pressed.

The

WAIT

is

too

The

interval

may

be set to any

fast to be read reasonably;

WAIT

with no following expression resets the PC-3 Computer to the original condition of waiting

pressed.

Examples
10

until the

for a specified interval, and then proceed automatically (similar to the

Causes

PRINT

to wait about

173

1

second.

FUNCTIONS
Pseudovariables
Pseudovariables are a group of
functions which take no argument
and are used

like

simple variables wherever required.

INKEY$

1

INKEY$ is a string pseudovariable which
Up Arrow, Down Arrow Left Arrow,
Arrow and

has the value of the last kev
oressPri nn *h« keyboard
v
k
a
c
Enter CL, CA. SHIFT, DEF
°
Rinht Arrow
a
„
Right
all have a value of
-j...
NUL
INKFY

=

THEN GOTO

10

it * £ :i°r :r;.r ::; 'is and
t

read instead of a key pass.

™

$

-

on

r"*"-t,o " 0wm

174

»

r

— —-—
»

-

PRINTt" p AUSE.,he

*•

«

contents of the display

a„

MEM

1

MEM

is

a

numeric pseudovariable which has the value of the number of characters of program memory remaining. The available

program memory will be the total memory, less the space consumed by programs and
command. Immediately following reset, MEM has a value of 1438.

1

PI

a

is

array variables.

MEM may

also be used as a

PI

numeric pseudovariable which has the value of

Like other numbers, the value of PI

is

PI.

It is

identical to the use of the special PI character

{it)

on the keyboard.

kept to 10-digit accuracy (3.141 592654).

Numeric Functions
Numeric functions

are a

group of mathematical operations which take

a single

numeric value and return

a

numeric value. They

include trigonometric functions, logarithmic functions, and functions which operate on the integer and sign parts of a number.

Many

dialects of

BASIC

require that the argument to a function be enclosed in parentheses.

require these parentheses, except

when

it

is

The PC-3 Pocket Computer does not

necessary to indicate what part of a more complex expression

argument.

175

is

to be included

in

the

LOG

100 + 100

will

(LOG 100) + 100
If

the same function

LOG (LOG

1

ABS

is

100)

be interpreted as:

not

to be used

LOG (100+
two or more times

not

in

100).

succession, parentheses must be
used:

LOG LOG 100

numeric expression

™Z™!X"£t ,7 T

9 abi °' U,e

"'" °" h '

"-*-»-•

S

1

ACS

*»

—« —

"*. «a.ue o f , „™ te

numeric expression

^^T^^z::™'":

,he

°i

rr

,,c

176

r8umen '' The ,recosin -

is

* e •*

— «— -»

ASN

1

ASN

is

numeric function which returns the arcsine of the numeric argument.

a

expression.

ASN

.5

1

ATN

is

numeric expression

is

The value returned depends on whether the PC-3 Computer

30

ATN

a

in

The

numeric function which returns the arctangent of the numeric argument.

COS

arcsine

is

the angle whose sine

decimal degree, radian, or gradient

is

equal to the

mode

for angles.

numeric expression

for angles.

1

in

the decimal degree mode.

The

equal to the expression.

mode

is

ATN

1

.

is

value returned depends on whether the PC-3 Pocket

45

in

the decimal degree mode.

numeric expression

177

The arctangent

Computer

is

in

is

the angle whose tangent

is

decimal degree, radian, or gradient

^^'

^ ^^ ^ ^

"

Comoutlr
Computer ir'H'
,s ,n decmal degree,

DEG

1

»

1

1

B

DMS

"""''" "" """"

"

'

a^!"J

™

""

the an9le ar9U

for angles.

™ nt

COS 60

n,

'"

° MS

,Dli9

™-

MlnuM

'

rePreSen ' '*" SeCond! ,nd an

is

The

.5 in

"turned depends on whether the PC-3
the decimal degree mode.
value

'

^""l

°"™<

f

»

DEG

(Decimal

D e,r.e form
|

In

DMS
'

' ,u ' ,to *<>>«

"P"-"'

"eclmal arconds

For ex.mpl

numeric expression

nUm6riC fUnCti ° n WhlCh C ° nVertS

55^445

*

mode

numeric expression

^m^V mT"
5B*

radian, or gradient

"

3n9le ar9Ument

" ° EG f ° rmat

178

t0

DMS

for

™< <-

DEG).

DMS

55. 179

2778

is

EXP

1

EXP

a

is

numeric expression

numeric function which returns the value of

the numeric argument.

is

a

is

1

is

e

(2.718281828

-

the base of the natural logarithms) raised to
the value of

2.718281828.

numeric function which returns the integer part of

LOG

1

LOG

1

INT numeric expression

1

INT

EXP

a

its

numeric argument. INT

is

3.

numeric expression

numeric function which returns the logarithm to the
base 10 of

LIM

PI

numeric expression

179

its

numeric argument.

LOG

100

is

2.

LN

a

is

numeric function which retuns the logarithm to the base

e

(2.718281828) of

numeric argument

its

LN

1(

4.605170186.

RND

1

RND

is

a

numeric function which generates random numbers.

to zero, the
to

random number

the result

1

numeric expression

is

,

than

1

which

and not an
is

a

is

less

random number
integer, the result

larger than the

the value of the argument

If

than one and greater than or equal to zero.
greater than or equal to
is

a

random number

and

1

less

If

is

Ar 9 ument

greater than or equal to

1

and

-

-

an integer greater than or equal

less

If

the argument

is

greater

than or equal to the smallest integer

Result

-

Lower Bound

Upper Bound

<1

2

1

2

2.5

1

3

The same sequence of random numbers
turned on.

is

than or equal to the argument.

•5

is

than one but greater than or equal

argument:

-

puter

less

the argument

To randomize

is

normally generated because the same "seed"

the seed, see the

RANDOM

verb.

180

is

used each time the PC-3 Pocket

Com-

SGM

1

SGN

is

a

numeric function which returns

the argument

a

is

puter

is

1

is

zero, the result

0;

is

if

a value

based on the sign of the argument.

the argument

is

negative, the result

is

-1.

If

SGN -5

the
is

argument

is

positive, the result

is

1

if

-1.

SIN numeric expression

1

SIN

numeric expression

numeric function which returns the
in

decimal degree, radian, or gradient

SQR

sine of the angle

mode

for angles.

The value returned depends on whether the PC-3 Com-

argument.

SIN 30

is

.5

numeric expression

u
io
" h ch
?^'' a
: 4:
r::ii
:r SQR
(\0 on the
keyboard.

is

r

rns the square root of

its

argument

2.

1R1

!t is

identicai

* ^ «»

f

*.

.p*... «,„.,. r0 ot sy mb oi

1

TAN

is

TAN

numeric expression

numeric function which returns the tangent of

a

Computer

is

in

decimal degree, radian, or gradient

mode

its

angle argument.

for angles.

TAN

45

is

The value returned depends on whether the PC-3

1

(CALCULATION RANGE)
Dynamic range

Functions

-1

x 10

l00

0:0

< Ox

must be an

2\

(Ex.)

J
intege

SINx

COSx

TANx

DEG: Ix l< x 10 i0
RAD: lil<-fx 10 10
1

GRAD: Ixl<^-x10 10

0^0
0^5

- ERROR 2
0.
[ENTER (ENTERS ERROR 2

|ENTER|

]

(-4)^0.5
r.

In

TAN

!

LNx
LOGx
EXPx

x, however, the

following cases are excluded.

DEG: Ix
RAD: Ix

GRAD:

Dynamic range

Functions

1

l

Ix

-90 (2n-1)
= -|- (2n-1)
1

= 100 (2n-1)
(n: integer)

182

\fx

1

x 10

100

x10" 6. E-10

String Functions
String functions are a group of operations
used for manipulating strings.

Some take a string argument and return a numeric value
take a string argumennt and return a string.
Some take a numeric value and return a string. Some take a
string argument
and one or two numeric arguments and return
a string. Many dialects of BASIC require the
argument of a function to be enclosed
in parentheses.
The PC-3 does not require these parentheses, except
when it is necessary to indicate what part of a more complex
expression is to be included in the argument.
String functions with two or three arguments
all require the parentheses
For
example, CHR$ 65 + 4 is interpreted as (CHR$
65) + 4, which is an illegal mixture of string and numeric
quantities; CHR$ (65 + 4)

Some

IS

V3I JQ,

183

ASC

1

ASC

string expression

a string

is

function which returns the numeric ASCII code value of the

codes and their relationship to characters

CHR$

1

CHR$

is

is

given in

a string

LEFTS

LEFT$

is

B,

ASC "A"

is

first

character

in its

argument.

The chart of ASCII

65.

numeric expression

function which returns the character which corresponds to the numeric ASCII code of

of ASCII codes and their relationship to characters

1

Appendix

(string expression

a string

,

is

given in

Appendix

B.

CHR$

65

is

its

argument. The chart

"A".

numeric expression)

function which returns the leftmost part of the string

determined by the numeric expression.

LEFT$ ("ABCDEF",

2)

is

"AB".

184

first

argument.

The number of characters returned

is

LEN

1

LEN

is

a string

1

MIDS„.

1

MID $

string expression

function which returns the length of the
string argument.

(

string expression

. !trlng functio „

RIGHTS

,

num.exp.

mhich retums

string expression

,

1

,

is

6.

num. exp. 2

.

,

LEN "ABCDEF"

midd|e port on rf (h6

.

st

ng

first

numeric expressi on

:z£ :z ^zjt^v^^vp
185

,,rs
*

aw ™ m

-

n

-

^ *— -°f

-

STR$

1

STR$
of

is

a string function

VAL STR$

VAL

1

VAL

is

a string

number
If

numeric expression

is

1.59

is

which returns

a string

which

is

the character representation of

its

numeric argument.

(2

function which returns the numeric value of

zero. Val

Space

on the

is

LBS

5

the reverse

string expression

"1.59"

is

its

string

argument.

It is

the reverse of

OZ)

STR$. The

VAL

of a non-

1.59.

the string contains alphanumeric character, any numeric character on the
right of the alphanumeric

VAL

It is

"1.59".

is

ignored.

will return "2"..

usually regarded as non-existing.

right of space

is

However,

if

space

is

included

ignored.

186

in

the exponent portion (after E), any numeric character

CHAPTER

PROGRAMMING EXAMPLES

9

This chapter presents a series of programming examples
whifh; illustrate

PC-3 Computer.

Each example

PC-3 Computer

being used.

is

is

some of the

potential programming capabilites of your
and structure of the program and the way in which the
complete guide to programming. New programmers should

briefly discussed to indicate the logic

This discussion

is

not meant to be

a

book on how to program.

consult a separate

Loan Payments
This program illustrates

The program
It

how

first solicits

then calculates the loan

P*
A =

+

(1

Where:

(1

A
P

+

I)

is

I)

N

N

-

Computer can be used
amount borrowed, the rate of
payment using this formula:

*

the PC-3

the

total cost of the loan

the monthly mortgage payment
the Principal; the
the interest for

is

the

number

of

Then the program computes the
The program asks

payment and the

and the number of months that the loan

|

is

N

interest,

1

is

I

to calculate the size of a loan

1

amount borrowed
month expressed as

a

decimal fraction

(i.e.,

1% =

.01

months

total cost of the loan over the entire loan period

for the interest for a

whole year because

this

is

and the

total

amount of

the basis usually used to discuss interest.

187

interest.

will run.

Loan Payment Calculator Program
INPUT "PRINCIPAL?

10:

";

P

Get the amount borrowed

20 INPUT "YEARLY^ INTEREST?";
30 - 1/12

Get the interest for a whole year
Divide by 12 to get the interest for a month

I

I

40:

1

= 1/100

Divide by 100 to turn percent into a decimal fraction

INPUT "MONTHS?

50:

;N

Get number of months

60:T = (P*((1 + I)^N))*|
B = ((1 + I)^N)-1

Compute top half of formula
Compute bottom half of formula

70:
80:

A

= T/B

Divide top by bottom

90:A = INT «A * 100) + .5))/100
100: PRINT "MO- PAYMENT = " A
{

Convert to even cents

;

110:Z =

A*N

Multiply monthly

120:

PRINT "TOTAL_COST

130:

X = Z-P
PRINT "TOTAL^INTEREST

140:

150:

= "

;

Z

The computation
first

in line

throws away any extra decimal

The amount

is

90

two decimal

for total

Print interest

Ask for repeat

(

100 moves the

amount times months

Subtract principal from total cost to get interest

;X

=

Go back

to top
Otherwise end

END

Note:

amount

Display total cost

INPUT "ANOTHER? ";G$
LEFTS (Q$,1) -' 'Y") THEN GOTO 10

160: IF
170:

Display monthly payment

is

a little

programming "trick"

digits to the left of the

digits.

.5

is

added

then divided by 100 again to restore

first
its

so thif

it

188

first

for rounding off

decimal point.

prior scale.

if

will

character

is

numbers to

'Y'

a desired precision.

Taking the integer part of

round up

if

the part which

is

this

to be

Multiplying by

with the INT function

thrown away

is

over

.5.

Sort

writing

When writing programs, you often need to get items into
a particular order, i.e. to sort them.
have been developed, each of which is better or
worse for particular circumstances.
One

sort by search

Many

different sorting techniques

of the simplest sorting techniques

is

the

technique the program scans an array of unsorted
data looking for the largest item. It puts this in the top
element of a new array and goes back to look for the
next largest item. It puts this item in the next element
of the array and so
on. Each element selected in the unsorted array
is then set to a very small
number so it won't be found on the next search.
'.

In this

'

Sorting Program
10:
20:

30:

INPUT "HOWMANY^. ITEMS TO SORT?
DIM 0

M)THEN LETM-R(I)
+

Determine random stopping time for each window
M to longest stopping time

Set

I

260: WAIT F
270: E = (G-F)/{M-C)

FOR A

290: IF
300:
310:
320:

=

(A>

to fastest interval

amount to slow the interval
during each turn of the slow down phase

TO M
THEN WAIT F + ((A-C)* E)
FOR = 1 TO 3
IF (R(l)>0) THEN LET D(l) = D(l) + 1
IF T) THEN LET D(l) = 1

280:

WAIT

Reset

Compute

1

the

Loop from

1

C)

in

If

I

to longest stopping time

slow-down phase, then slow down rotation by one
increment

Loop through each window

window

If

it still

Cycle back to

330:R(|) = R{|)-1
340: NEXT

turning, then advance to next object
object if over top

first

Reduce count of remaining turns

I

350:

PRINT

360:

NEXT A

370:

WAIT H

380:

PRINT

390:

P${D(1); P$(D(2)); P$(D(3)

P$(D(1)); P${D(2)); P$(D(3))

W = -1
THEN PRINT "YOU_WIN";

Z;

W

440:

ON

450:

PRINT

460:

GOTO

<2t

SGN

Reset

WAIT

LET

W-2

(S))

GOTO

"DOLLARS"

450, 470, 490
'

to longest interval

Set winnings this turn to expected loss of
$1
If all objects are the same,
then set to win amount
If loss, then say so
If

win, then say so

Add

'SOJAR YOU—HAVE

500

current objects

Redisplay ending position

400: IF (D(1) = D(2}) AND (D(2) = D(3)) THEN
410: IF W<0 THEN PRINT "YOU_LOSE"

420: IF W>0
430: S - S +

Show

LOST $"; ABS

r

this turn to total

Jump
(S)

winnings

to message depending on sign of winnings
Message for S<0

Go
192

to

common

end

470:

PRINT

"YOU^ARE

480:

GOTO

500

PRINT

"SOJAR J'OU^JHAVE _JVON $"; S

490:

BREAKING

EVEN"

Message for S =

'

Go

500:

INPUT "ANOTHER _TRY?"; Q$

510: IF

520:

LEFT${Q$,1) = "Y")

(

common end

to

Message for

i

S>0

Ask about another turn
Check first character of answer

THEN GOTO 200

END

Federal Tax Estimator

:^z^:::^::^:^2r
d

'nLTfor

veB

b

I

va ue S

',

f

C

PUt n

fT

ea c h

t °tL

nC ° me T3><

+

va

n

'

;

,s

"

'^
""*

"
"

**«««

TaX Rate

^

^ *"*"•

M™

down

"" -com

the
i

(,) P6rCent ° f tHe 6XCeSS ° V6r
B( ""- The
the baseline
'
not 9reater than the income
'* determines the appropiate
bracket and app,ies the ruie

"

h

computed

is

-

^
7 T l"^
T
^
1
9

»Z™'£m£T
O T E T he

'
'

t ;

r

no

Federa

social security tax

P^«" -",

'

-

^

S inC Uded
thlS Pr ° 9ram 3re
° n th ° Se in the 1982 Dedaration f Esti
"
Tax for Individuals (Form
°
ES
Th'rPm am Pr6Sented
h6re t0 iMUStrate the CapabMitieS ° f
"
the PC 3 Pocket Computer and is not
intended to be a"
;•
uth
f
author,™.
bas,s f
for any individuals

10 4

'

)

^

"x

™^

"

actua,

a

tax

liability.

Individual circumstances and changing

s,mple pro9ram such as this one to be
compiete

193

-

consu,t

a tax pr ° fessi ° nai

if

laws P

^--

—z

ode

ma nv

too

t

United States Federal Tax Estimator Program
10: DIM B<15),M(15),P{15)

in

bracket, P

20:

USING "######,"

Set format for

30:

WAIT 128

Set

40:

80:

PRINT "FILING STATUS:"
PRINT "1 = SINGLE"
PRINT "2 = MARRIED FILING SEPAR."
PRINT "3 = MARRIED FILING JOINT"
PRINT "4 = HEAD OF HOUSEHOLD"

90:

WAIT

50:

60:
70:

"; F

Get

OR 4)) THEN GOTO 40
"NO. OF EXEMPTIONS? ";E

110: IF < "Y") THEN GOTO 270
INPUT "EST. TOTAL DEDUCT.? "; D
IF ((F = 1) OR (F = 4)) THEN LET D = D-2300
IF (F = 2) THEN LET D = D-3400
IF (F = 3) THEN LET D = D-1700
IF (D<0) THEN LET D = l-D
PRINT "INC. LESS DED. =" ;

I

";

190: IF

200:
210:
220:
230:

240:
250:

260:

WAIT for

I

I

I

(

all

B
)

is

baseline for tax bracket,

(

)

is

percent within bracket

M

'

displays

Status options display

Display options for filing status

Reset

INPUT "STATUS?

100:

-

Allocate arrays

WAIT

so that Enter

is

required after each display

filing status

Check if valid
Get number of exemptions
Get salary income
Get self-employment income
Get other income
Total the incomes

And

display

Ask about itemizing deductions
If

not then skip itemizing section

Get total itemized deductions
Subtract standard deduction according to

Minimum deduction

is

zero

Reduce income by excess over standard

And
194

display

filing status

1

is

minimum

tax

Note: Tax tables have standard deduction
built-in

=I-(E*1000)
IF (KO)THEN LET =0
PRINT "INC. LESS EXMP.

270:1
280:

290:

I

300:

W = 750 +

310:

RESTORE W

320:

READ

L

330:

FOR X

=

340:

READ

350: IF

360:

Compute income less exemptions
Minimum income is zero

1

=";

I

Display

*F)

(50

TO

Compute line number
And restore so READ

Read number of lines in table
Loop to read in table
Read baseline, minimum tax, and percent for each
tax bracket

L

B(X), M(X), P(X)

(l>B{X))THEN LETJ = X

Save pointer to highest applicable bracket

NEXT X

370:T = M(J) + (P(J)*(|_B(J)))
380: PRINT "FIT = ";T
390:
400:

of appropriate tax table for filing status
will get right table

Compute FIT

INPUT "AMT. OF ADD. TAX?

";

A

INPUT "AMT. OF TAX CREDITS?

410: Z

430: IF

";C

=S*.0935

420: IF Z>3029.40

THEN LET Z

Z>0 THEN PRINT

440: T = T +

A-C +

= 3029.40
"S.S. TAX = ";Z

Z

450:

PRINT "EST. TOTAL TAX

460:

END

(see text)

Display FIT

Get any miscellaneous tax obligations
Get any miscellaneous tax credits

Compute

social security tax

Limit S.S. tax to
Display

if

S.S. tax

Total tax

= "; T

And

195

display

on self-employment income

maximum
is

greater than zero

REM TABLE FOR SINGLE TAXPAYERS
DATA 14
802: DATA 0,0,0
803: DATA 2300,0,. 12
804: DATA 3400, 132,. 14
805: DATA 4400,272,. 16
806: DATA 6500,608,. 17
807: DATA 8500,948,. 19
808: DATA 10800, 1385, .22
809: DATA 12900,1847,. 23
810: DATA 15000,2330,. 27
811: DATA 18200,3194,-31
812: DATA 23500,4837,. 35
813: DATA 28800, 6692,. 40
814: DATA 34410,8812,.44
815: DATA 41500,12068,-50
800:

801:

REM TABLE FOR MARRIED FILING SEPAR.
DATA 13
852: DATA 0,0,0
853: DATA 1700,0,. 12
854: DATA 2750,126,. 14
855: DATA 3800,273,. 16
856: DATA 5950,6 17,. 19
857: DATA 8000,1006,. 22
858: DATA 10100,1468,-25
859: DATA 12300,2018,. 29
860: DATA 14950,2787, .33
861: DATA 17600,3661,-39
862: DATA 22900,5728,.44
850:

851:

196

863:
864:

DATA
DATA

30000,8852, .49

42800,15124,.50

REM TABLE FOR MARRIED FILING JOINT
DATA 13
902: DATA 0,0,0
903: DATA 3400,0,. 12
904: DATA 5500,252,. 14
905: DATA 7600,546,. 16
906: DATA 11 900, 1234,. 19
907: DATA 16000,2013,. 22
908: DATA 20200,2937,. 25
909: DATA 24600,4037,. 29
910: DATA 29900,5574,. 33
911: DATA 35200,7323,-39
912: DATA 45800,1 1457,.44
913: DATA 60000,17705,.49
914: DATA 85600,30249,.50
900:
901:

REM TABLE FOR HEAD OF HOUSEHOLD
DATA 14
952: DATA 0,0,0
953: DATA 2300,0,. 12
954: DATA 4400,252,, 14
955: DATA 6500,546,. 16
956: DATA 8700,898,. 20
957: DATA 11800,1518,. 22
958: DATA 15000,2222,.23
959: DATA 18200,2958,. 28
960: DATA 23500,4442,. 32
950:

951:

197

961

:

962:
963:
964:

DATA
DATA
DATA
DATA

28800, 6138, .38
34100, 8152, .41

44700, 12498, .49
60600, 20289, 50
.

Relationship of

Two

Variables

The PC-3 Computer an
which are entered
ent

is

Y.

If

many

excellent tool for making

calculates the basic tests

When

in pairs.

a series

The program loops through the observations and computes

Sum

of paired observations.

this capability, this

The program

solicits the

there are an independent and a dependent variable, the dependent variable

the variables are independent, then simply assign one to

These quantities are the

As an example of

small statistical tests.

which are often used to compare

of X, the

Sum

of

X2

,

Sum

the

X and one

Sum

X and

of

which

Y

2
,

are used to calculate the desired statistics.

and the

Sum

of

X#Y. The mean of X

computed with the formula:
..

Mean v =

Sum

of

X

N
Where N

Sum

is

the

number of observation

of Squares
x

= Sum

Standard Deviation x

of

X2

pairs.

The standard

(Sum of X)

deviation of

2

N

-

/ Sum

of Squares,

198

X

is

the independ-

to Y.

several quantities

of Y, the

is

program

observations

then calculated with these formulas:

is

then

The mean and standard deviation of Y
correlation coefficient between the

Sum

of Products, v

Correlation

Sum

coefficients are then
a

+ bx

Relationship of

(Sum of Squares x

.

y

shown

in

50:

)

* (Sum

linear regression equation using the formulas:

= Mean y -

(b x-y

* Mean x

)

X

Two

Variables Program

A

;

WAIT 48
PAUSE "ENTER

of Squ ares v

the regression equation:

20:

40:

(x.y)

a

= 0, B = 0, C = 0, D = 0, V =
INPUT "NUMBER OF OBSERV.? " N
30:DIMX(N),Y(N)
10:

quantities are then used to calculate the

(Sum of X) * (Sum of Y)
N

of Products

Sum of Products,
>x,y
Sum of Squares v

'x-y

Y =

X * Y -

program computes the coefficients for the

,

The

of

computed with the same formulas. These

are

variables using the formulas:

*,y

V
Finally the

- Sum

two

";

N; " PAIRS

Initialize variables to accumulate sums
Get number of observations

Allocate arrays to hold observations
Set 3/4 second wait for prompts during data entry

OF

OBS."

Prompt
199

start of data

entry

60:
70:

80:
90:

100:

FOR = 1 TO N
PRINT "PAIR ";
INPUT "X? "; X(l)
INPUT "Y? ";Y<0

Loop for number of observations
Prompt with number of pair
Prompt and input X
Prompt and input Y

I

I

NEXT

I

110:WAIT 128
120:

INPUT "DISPLAY OR PRINTER? ";W$
LEFTS (W$, 1) = "P") THEN PRINT = LPRINT

Ask

INPUT "LIST OF DATA? "; W$
LEFTS (W$, 1) = "Y") THEN LET V =

Ask

130: IF

140:

150: IF

160:

Reset

(

(

FOR

I

=

(V-

170: IF

1

1)

TON
X(l), Y(l)

240:

WAIT

250: F
260:
270:

280:

output

listing

to display or printer

is

printer, then switch

if

listing

of data

so, set flag; default

If

flag

is

set,

Accumulate
Accumulate
Accumulate
Accumulate
Accumulate

220: E=E+(X(I)*Y(I))

NEXT

If

if

time for data

is

desired

V=0

set in line

then print observation pair
the
the
the
the

the

sum
sum
sum
sum
sum

of

X

of the squares of
of

Reset

=A/N
";

F

";

G

WAIT

of the squares of

200

of

X

of

Y

Y

of the products of the pairs

so that Enter

Compute mean
And display
Compute mean
And display

X

Y

I

PRINT "MEAN OF X G =C/N
PRINT "MEAN OF Y =

10

Loop through data

THEN PRINT

180:A = A + X(l)
190:B = B + X(I)A2
200:C = C + Y(l)
210:D = D + (Y(I)a2)
230:

1

If

WAIT

is

required

290:J=B-((AA2)/N)

300:K=SQR
310:

(J/(N

-

Compute the sum of squared deviates of X
Compute the standard deviation of X
And display

1))

PRINT "STD. DEV. X

- ";

K

320:L = D-{(CA2)/N)

Compute the sum of squared deviates of Y
Compute the standard deviation of Y

330:M = SQR (L/(N - 1))
340: PRINT "STD. DEV. Y= ";M

And

350:0 -E -((A* C)/N)
=0/SQR (J*L)
370: PRINT "CORREL. COEF. =

Compute the sum of products of the
Compute the correlation
And display

360: R

";

R

380: P = O/J

Q = G - 9)) THEN PRINT
"1 TO 9 ONLY, PLEASE" GOTO 280
230:

Ask

for direction from numeric pad
Convert keystroke to number
If not from numeric pad, then ask again

:

260: IF
270: IF

6) THEN GOSUB 500
(D<4) THEN GOSUB 550

280: IF ((D =

3)OR((D-6)OR

(D

If

If

= 9))

THEN GOSUB

600

If

203

from top row then GOSUB to north subroutine
from bottom row, then GOSUB to south subroutine
from right side, then GOSUB to east subroutine

-

Needed to

clear

out

«D

290: IF

=

1)

OR

(D = 4)

300: IF -piMK£:&\
:

216

PC-3 does not recognize codes

in

shaded area.

If

you enter the code number

217

in

the shaded area, an error
will result.

APPENDIX C FORMATTING OUTPUT
It is

sometimes important or useful to control the format

USING

display formats with the
*

The number of

verb.

as

well as the content of output.

The PC-3 Pocket Computer controls

This verb allows you to specify:

digits

The location of the decimal point
format

Scientific notation

The number of

string characters

These diffrerent formats are specified with an "output mask". This mask may be
10:

USING "####"

20:

M$

30:

USING M$

When
40:

the

constant or

a string variable:

"&&&&&&

USING

verb

is

used with no mask,

all

special formatting

is

cancelled.

USING

A USING
50:

=

a string

verb

may

also be used within a

PRINT

statement:

PRINT USING M$, N

Wherever

a

USING

verb

is

used,

it

will control the

format of

all

output

218

until a

new USING

verb

is

encountered.

Numeric Masks

A

USING mask may

numeric

constant or variable

only be used to display numeric values,

displayed while a numeric

is

USING mask

is

i.e.,

in effect,

numeric constants or numeric variables

mask

the

will

be ignored.

A

value which

If a

string

to be diswithin the space provided by the mask. The mask
must reserve space for the sign character even when the
number w.ll always be positive. Thus, a mask which shows
four display positions may only be used to display
numbers with three

played must always

is

fit

digits.

Specifying

Number

of Digits

The desired number of

digits

or print always contains as

is

specified using the •#• character.

many

characters as are designated

in

Each '#•
the mask.

in

the

mask

reserves space for one digit.

The number appears to

remaining positions to the

The display

the far right of this field- the

left are filled with spaces.
Positive numbers, therefore, always have at least
one space at the left of' the
Since the PC-3 Pocket Computer maintains a
maximum of 10 significant digits, no more than 11 <#' characters should
be
used in a numeric mask.
field.

NOTE:

In all

examples

show

the size of the field.

Statement
-

10:

USING "####"

in this

appendix, the beginning and end of the displayed field

PRINT 25

30:

PRINT -350

40:

print 1000

be marked with an

*

I'

character to

Display
(Set the
press

20:

will

(

pc 3 Computer
_

ENTER

)

t0 the

.)

2 5
3 5

ERROR7IIM40
219

R(JN posjtion/ type RU|S^ apd

Notice that the

provided

in

statement produced an error because 5 positions (4

last

digits

and

a sign space)

were required, but only 4 were

the mask.

Specifying a Decimal Point

A

decimal point character,

'.',

may

be included

in a

numeric mask to indicate the desired location of the decimal point.

If

the

mask provides fewer

significant decimal digits than are required for the value to be displayed, the
remaining positions to the right
will be filled with zeros. If there are more significant decimal digits
in the value than in the mask, the extra digits will be truncated

(not rounded):

Statement

Display

10:

USING "####.##"

20:

PRINT 25

30:

PRINT -350.5

40:

PRINT

25.00

-350.50
2.54

2.547

Specifying Scientific Notation

A "^"

may

character

'.' characters are

displayed to the

left

be included

in the mask to indicate that the number is to be displayed in
scientific notation. The '#' and
the mask to specify the format of the "characteristic" portion of the number, i.e., the part
which is
of the IE. Two '#' characters should always be used to the left of the decimal point
to provide for the sign

used

in

220

—

Clmal P ° int
inC Uded bUt iS n0t required
UP
9 '#' ch
ters may appear to the
the CharaCteristic P° rtion the
exponentiation character, IE, will be displayed
followed by o
osi ion
th S 9n
, tW
° Siti0nS
° P
'" tHe eXP ° nent ThUS the Small6St
notation field would be provided
of
h h would pnnt numbers
wh,ch
of the form 2 IE 99'. The largest
scientific notation field would be <<##
w-iHHfmFFHmF
which would print numbers such as -1.234567890
IE— 12':

TZZ«
T'^
##

r

POm

T,

"^

"^ ^

*

'

'

'

'

™»^

'

'^

'

I

•

####^##7^

—

Statement

^.
Display
,

10:

USING "###.##*"

20:

PRIWT2

30:

PRINT -365.278

2.00E00
-3

.

6 5

E

2

Specifying Alphanumeric Masks
String constants and variables are
displayed using the •&• character. Each •&•
indicates one character in the field to be
displayed
n
6 P0S tl0n d
the eft 6nd ° f thlS fie d
f the Strin9 iS Sh ° rter tha
the field the raining spaces
"
e
w.ll be
e f-I.ed
f IN d wth
h spaces. ;Iff the string is
longer than the field, the string will be
truncated to the length of the field:
'

'

'

^

w

Statement
10:

USING "&&&&&&"

20:

PRINT "ABC"

30:

PRINT "ABCDEFGHI"

-

'

'

n..

.

Display

ABC
A
221

B C D E

X

Mixed Masks
In

most applications,

one

USING mask,

a

USING mask

will

contain either

however, for certain purposes.

versa,

marks the boundary for

a different value.

values

—

is

a

numeric value which

In

all

numeric or

Thus,

a

mask

Both may be included

in

of

"#####&&&&"
is

is

a specification for displaying

two

separate

allocated 4 positions:

Display

10:

PRINT USING "###.##&&";

20:

PRINT -5.789, "DB"
Once

string formatting characters.

allocated 5 positions and a string value which

Statement

Remember:

all

such cases, each switch from numeric to string formatting characters or vice

specified, a

"CR"

25;

USING format

2 5

.

C R

-5.78DB
is

used for

all

output which follows

verb.

222

until cancelled or

changed by another USING

APPENDIX D EXPRESSION EVALUATION AND OPERATOR
PRIORITY
When
which

the Radio Shack PC-3 Pocket
,s

Computer

is

given a

complex expression,

determined by the priority of the individual parts of
the expression.

If

it

evaluates the parts of the expression

in a

sequence

you enter the expression:

100/5+45
as either a calculation or as a part of a

100

program, the PC-3 Computer does not

=2

Since the PC-3 Computer must have some

way

you mean:

a value of

65

1.

-f^+45=65

to decide between these options,

'priority" than addition (see below),

choose the second option and return

if

„
or

5 + 45

division has a higher

know

it

will

it

uses

its

choose to do the division

rules of operator priority

first

and then the addition

for the expression.

Operator Priority
Operators on the Ratio Shack PC-3 Computer are
evaluated with the following priorities from highest
to lowest:
1.

Parentheses

2.

Variables and Pseudovariables

3.

Exponentiation (~) when preceded by

4.

Multiplication which omits the operator

5.

Functions

6.

Exponentiation (^)

a multiplication

which omits the operator

223

Because
i

e

it

will

)

7.

Unary minus, negative

8.

Multiplication and division (#,

9.

Addition and subtraction

10.

Relational operators

11.

Logical operators

The fourth item

sign (-)
/)

—
(<,<=,= <>, >=, »
(+,

(AND, OR)

refers to usage such as

2A

or 5C(2)

in

which

to the combination of this with exponentiation, such as

done

first

When
with

or

5D^1.5.

operator
In these

is

implied, but not shown.

combined

The

third refers

cases the exponentiation will be

and the multiplication second.

there are

A+B— C,

When an

a multiplication

3A^3

two

or

more operators

for example, the answer

is

at the

the

same

priority level, the expression will be evaluated

same whether the addition or the subtraction

expression contains multiple nested parentheses, the innermost set

is

evaluated

is

first

done

from

left

to right.

Note that

first.

and evaluation then proceeds outward.

Sample Evaluation
Starting with the expression:

(

(3+5-2) *6+2)

/

10^ LOG 100

The PC-3 Computer would
from

left

(

Then

it

to right and would

first

evaluate the innermost set of parentheses.

do the addition

first:

(8-2)* 6+2) /10^LOG 100
would do subtraction:
224

Since

'+'

and '-' are at the same

level,

it

would move

((6)*6+2)/10-LOG 100
or:

(6*6+2)
In the

/10^LOG

100

next set of parentheses,

it

would do the multiplication

first:

(36+2)/ 10^ LOG 100

And

then the addition:
(38)

/10^LOG

100

or:

38/ 10^LOG 100

Now

that the parentheses are cleared,
the

LOG

function has the highest priority,
so

38/10^2
The exponentiation

is

done next:

38/100
And

last

of

all,

the division

is

performed:

0.38
This

is

the value of the expression.

225

it is

done next:

APPENDIX

E

FEATURE COMPARISON OF THE

PC-1, PC-2,

The three Radio Shack Pocket Computers, the PC-1, the PC-2, and the
PC-3, have many features
Sometimes the same features are present, yet act in a slightly different

significant differences.

In the

Commands

following chart, the symbol:

M

indicates that the feature can only be used

P

indicates that the feature can only be used within a
program.

B

indicates that the feature can be used in both contexts.

When no symbol

AREAD
ARUN
BEEP
CHAIN

CLEAR
CLOAD
CLOAD?
CLS

is

common, but

fashion.

use of programs on different models, the following comparison
charts are provided.

Verbs and

in

shown, the feature

is

in

manual execution,

i.e.,

as a

command.

not available on that machine.

PC-1

PC-2

PC-3

P

B

P

See Note

PC-2 has tone and duration

Comments
1

P

P

B

B

P

P

P

B

B

B

M
M

M
M

M
M

B
226

AND

PC-3

there are

some

In order to facilitate the

PC-1

PC-2

M
M

M

M

B

B

COLOR
CONT
CSAVE
CSIZE

B
B
B

B

P

P

B

B

M

DIM
STEP

P

P

P

P

P

P

P

P

P

P

B

B

B

GPRINT

B

GRAD
GRAPH
IF. ..THEN
INPUT
INPUT
LET

Comments

P

CURSOR
DEGREE
DATA
DEBUG
END
FOR ...TO.
GOSUB
GOTO
GCURSOR

PC-3

B
B
P

P

P

P

P

P

B

B

B

P

P

P
227

PC-1

LF

PC-2

PC-3

Comments

B

LINE
LIST

B

M

M

M
M

PC-1 can emulate with LIST

See Note 2

LLIST

B

LOCK

B

LPRINT

B

P

MERGE
NEW
NEXT
ON ... ERROR
GOSUB
ON
ON
GOTO

M
M

M
M

M
M

P

P

P

PAUSE

P

P

...

P

P

...

P

P

B

P

PASS
PRINT

PRINT*
RADIAN

M
P

B

P

B

B

B

B

B

B

B

B

P

P

P

P

P

P

RANDOM
READ
REM
RESTORE

P

See Note 2

228

PC-1

PC-2

RETURN

PC-3

P

RLINE

B

RMTOFF
RMTON
ROTATE
RUN
SORGN

B

B
B

M

M

M

B

STOP
TAB
TEST

P

B
B

TEXT
TROFF
TRON
UNLOCK

B

USING

B

B

WAIT

B

B

Note

Comments

1
:

B
B

B

B

B

See Note 3

There are some minor differences between
the PC-3 and the PC-1
problems in ordinary usage.

are unlikely to cause

Note

2:

Note

3:

Add PR.NT=LPRINT and

On

the PC-1 the

Precedes the verb.

On

PREPRINT statements to

USING format

applies to

the other models, the

all

in

the behavior of

following rmiN
ronowing
PRINT but these

USING

applies only to disp.ays which

229

i

,

PC-1 programs to achieve the desired results
on the

displays on the line in which the

USING format

AREAD

clause appears even

fo„ow

PC3

l^^.,*'^
if

the variable

until cancelled

by another

USING

verb.

Example:
10

A

= -123.456

20 PAUSE USING "####,##";

30 PAUSE A, USING "####";

When

A
A

executed, this program displays the following:

PC-1

-123.45
-123

•

-123

PC-3

-123.45

-123.45
C

e

PC

-123

1
tHe PC 3
f3Ster
" Pr ° CeSSing Speed
"
the PC-11 are used with
l the PC-3, adjust the
game speed, etc.

l °T "J^

Tic

6

'

"

'

f° r

-'-lations.

Therefore,

when game programs

Pseudovariables
In this

and the following charts, the features are simply
marked with
PC-1

PC-2

PC-3

Y
Y

Y
Y
Y
Y

Y
Y
Y

INKEY$

MEM
PI

or?r

TIME

a *Y'

when

the machine has the feature.

Comments

PC-1 has only n

230

for

Numeric Functions

ABS
ACS
ASN

ATN
COS
DEG

DMS
EXP
INT

LOG
LN

KU-1

PC-2

PC-3

Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y

Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y

Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y
Y

NOT
POIN1

RND
SGN
SIN

SQR or\J~
STATUS

TAN

Y
Y
Y
Y

Y
Y
Y
Y

Comments

PC-1 has only

Y
231

\T

String Functions
PC-1

ASC

CHR$
LEFTS
LEN
MID$
RIGHTS
STR$

VAL

PC-2

PC-3

Y
Y
Y
Y
Y
Y
Y
Y

Y
Y
Y
Y
Y
Y
Y
Y

Comments

Operators

SK

*r

1,

+,

-

>,>=,= <>,<=<

PC-1

PC-2

PC-3

Comments

Y
Y
Y

Y
Y
Y
Y
Y

Y
Y
Y
Y
Y

See Note 4

AND, OR,

&
Note 4: Raising

a negative

number

to a

power with

the

~

operator can result

232

in

incorrect signs. See Chapter 4.

Precautions

Programs for the PC-1, when loaded from its tape, can be used
with the PC-3. When entering the PC-1 programs into
from PC-3 keyboard, however, the following precautions should be
observed:
For example, the following are keyed-in for program entry:
10

IFN^LPRINTA

With the PC-1,

(

ENTER

this results in a

)

command

for "If

N = LPRINTA). With the PC-3, however,
error (ERROR 1) to occur when executed.
(IF

Therefore, an IF statement should be keyed-in

10 IF N = L

this unit

N = L,

it

This

is

A"
command

display

becomes

a

for "If

print A" (IF N = LPRINT A), causing a syntax
LPRINT command unavailable from the PC-1.

N=,

because the PC-3 has an

as:

THEN PRINT A

Thus, a character string for "variable and

command"

with the PC-1

233

may

be regarded as "a

command".

APPENDIX

F

Model:

SPECIFICATIONS
PC-3 Pocket Computer

Processor:

8-bit

Programming Language:

BASIC

Memory

System

Capacity:

CMOS CPU
ROM:

24 K Bytes

RAM
System

About 500 Bytes

User

Fixed

Memory Area

208 Bytes

(A~Z, A$~Z$)
Reserve Area

48 Bytes

Program/Data Area
Stack:

Subroutine:

FOR-NEXT:
Function:

10 stacks
5 stacks

16 stacks

Data:

Operators:

1438 Bytes

8 stacks

Addition, subtraction, multiplication,
division, exponentiation, trigonometric
and inverse trigonometnc funct.ons logarithmic and
exponential functions, angle conversion,
square root, si n aosoiute,
a
integer, relational operators,
logical operators

oZ

Numeric Precision:

10

digits (mantissa)

+ 2

Editing Features:

Cursor

left

Memory

CMOS

Battery backup

Protection:

and

digits

right, line

(exponent)

up and down, character

234

insert, character delete

Display:

keys:

24-character liquid crystal display
with 5 x 7 dot characters

SMCial

SVmb °' S ""'

Power Supply:

Xv DC ZTZCT'

Power Consumption:

6.0VDC@O.O3W

Operating Temperature:

^^c^t^^™™*

fUnC,i0nS;

'

""""* Md

'-

*'«

Type: CR-2032

Dimensions:

135(W)x 70(D) x 9.5(H)

3o ° hours usa9e without externai ° wer
sup ^p

mm

6"(W) x 2-3/4"(D) x 3/8"(H)
Approximately 1 1 5g (0.25 lbs.) (with
5-5/1

Weight:
Accessories:

Option:

Wallet,

two lithium

batteries)
batteries (built-in), two keyboard

Printer/Cassette Interface

235

templates, and owner's manual

»"•

INDEX
&

44

ALL RESET

*

49
49

AND
AREAD

117

Commands

49

ASC

184

Compatability

49

ASCII

215

Constants

49

ASN

177

DATA

181

ATN

177

46

DEF
DEG

24

DEGREE

/

<
<=

<>
>

51

Arrays

26

Auto

51

BEEP

51

Batteries,

51

Busy

51

CAkey
CHAIN

26

>=

off (Auto

71

175

t

208

i

208

CHR$
CLEAR
CLOAD
CLOAD?

176

C Lear key

ABS
AC adapter,

51

PC-3 Printer/Cassette

Cursor

16

Cassette

87

119
PC-3 Computer

96,99

226
41,44
126

key

73
178

DELete key

125

31,65

19

DIM

128

16

DMS

178

Debugging

208

14

120

Display

15

184

END
ENTER

130

124

99
101

14

key

EXP
Editing calculations
Editing programs

12,24
179

26
63

80

CONT

102

Error Messages

213

COS
CSAVE

177

Exponentiation

179

176

103

Expressions

Interface

ACS

Power Off)

17

52

237

49

FOR,.. TO... STEP

131

Logical expressions

Formatting output

218

Loops

Functions

GOSUB
GOTO

GRAD
Hexadecimal
IF...

THEN

INKEY$
INPUT

INPUT*
INSert key

INT

LEFT$
LEN
LET
LIST

LLIST

98,174
134

105,136
138

139

174
142

145

66

PRINT*
PROgram mode

MID$

61

185

Paper feed

84

211

Parentheses

36

219

Power

79

Prealiocated variables

47

Masks

Memory

Protection

NEW
NEXT
NOT
Numeric expressions
Numeric

106

ON
ON
ON
OR

107

Operator precedence

variables

(Start up)
...
.

.

.

GOSUB
GOTO

179

Operator priority

LOG

179

Operators

147

P

^

70
113

Printer

149

Priority

IMP

Program

49

Pseudovariables

46

RADIAN

160

23

RANDOM

161

READ
REM

162

164

RESET
RESTORE

165

223

RETURN

167

49

RIGHT$

85

RND
RUN
RUN mode

150
152

36

Labelled programs

73

PASS

114

Limits of numbers

43

PAUSE

154

59

PC-3 Printer/Cassette
238

Line numbers

85

223

52

52

LN

LPRINT

158

175

108

179

146

156

175

184
185

PI

PRINT

MEM
MERGE
Maintenance

43

52
69

77

Range of numbers

59

174

17

185
180
115
61

43

ReSerVe mode

74

Verbs

Relational expressions

51

WAIT

Remote On/off

79

SGN
SHIFT key
SIN

SQR
STOP
STR$
Scientific notation

Square root

24
181
181

168

186
41
181

59

String expressions

50

String variables

47

Subroutines

134

TAN
TROFF
TRON

169

Templates
Troubleshooting

182

170

87

76
207

USING

171

VAL

186

Variables

173

181

Statements

Tape

97, 117

45
239

Program Examples
In the preceding pages,

you have probably acquired some new information on a number of
program commands. Like driving
by actual practice, you can improve your programming only by generating

or playing tennis, things that can be improved

programs

as possible, regardless of

your

skill.

as

It is

also important for

pages contain a variety of suggestions for programs using the
also inclube flowcharts. The rest is up to you!

(Radio Shack and/or

its

you to

refer to

a car

many

programs generated by others. The following

BASIC commands. We provide you with the

necessary equations and

franchises assume no responsibilities or obligations to any
losses or damages that could arise through the

use of the software programs employed

in this

owner's manual.)

241

CONTENTS
(program

title)

(page)

.... 243

248
.... 255

•

TYPING PRACTICE

•

SOFTLANDING GAME
MEMORY CHECKER

•

•
•

•

BUGHUNT
DOUBLE ROTATION.

.

......

2)

RUN position
CLEAR (enter)
M38 CE) MEM

.261

... 270

.

end of the

D

.

... 275

.

At

.

.... 265

^

-

number

of bytes.

242

.

.281

... 287

TYPING

Program

NEWTON'S METHOD FOR FINDING ROOTS OF
EQUATIONS

Title:

OVERVIEW

(mathematical)

Finding

*.

roots of equations

When

root

1

is

is

usually troublesome, but by using
Newton's Method, the approximate roots of
equations can

found, depending on the interval width,
by using Newton's Method, the starting
point automatically changes.

CONTENTS
f\xn )
If the absolute value of
the distance between X„ and
tho
t a
xthe f:«
first
derivative is defined
in the following way;

*••_.

^

f'fy)

y

Change

,

- /(* + *)-/(*)

IE-8 in line

j"

340

X" +1
^

is

•

—

,.

.

(«

is

u

.

the minute interval)

to change the value for 10~ 8

.

243

m" 8 Xyn

le« than TO
lesstnan

,

;*
is

™
considered
-^

-j

a root

.,

and

•

,

s

displayed

Her

INSTRUCTIONS
INPUT
Starting point

Minute

interval

Interval

Interval

OUTPUTS

Starting point

Root value (by pressing the

key, the next interval's root

(enter)

EXAMPLE
x + 2 =

2
x 3 - 2x

(the roots are

—

1

,1,2)

starting point =

minute

interval

interval

= 0.5

= 1CT 4

The above values are used in the calculation.
The functions are to be written into lines after 500

How
1

2.

to type

in

the example:

Go into PRO mode by operating
500B= ((X-2) *X-1)* X + 2
510

as subroutines.

RETURN

(enter)

That

the

mode change

key.

(ENTER)

is all

that has to be done.

244

is

found)

width

KEY OPERATION SEQUENCE
Step No.

Key Input

Display

(DEF)®

STARTING POINT
(ENTER

)

=

MINUTE INTERVAL-.

0.0001

(ENTEg)

INTERVAL

0.5

(ENTER)

ANSWER

=

(ENTER)

ANSWER

=

(ENTER)

ANSWER

-

(ENTER)

ANSWER

(ENTE§)

ANSWER

(ENTER

ANSWER

*

Remarks
Waiting for starting point input
Waiting for minute interval input
Waiting for interval width input
Display of roots

By repeatedly pressing the (ENTER) key, the roots
of the function are found.

)

ANSWER
11

(ENTER)

ANSWER

=

•

=

=

245

FLOWCHART
/Newton's Method calculation
subroutine
\^

300

X

= C

Function calculation

Y-B
X

A

=

+ C

(

320

500
Function calculation

D
340
Newton's Method calculation
1

F = F +

W

C = F
1

350
(Roots are displayed)

100
i

Newton's Method calculation

Q

B =

((X-2)*X-1)#X + 2

= C

C- D-A#Y/(B-Y)

1

Function calculation subroutine)

RETURN

J
246

(_

RETURN

")

|

PROGRAM
18:

V

A

MEMORY CONTENTS

LIST

V
:

INPUT 'STARTING

point=';v

minute interv
al= v ;a
3@: INPUT ' INTERVALES U
28: input

40:G=V:F=V:Z=8

A

Minute

B

fix)

C
D

58: IF Z=8 GOTO 70

E

60:G=G-14:C=G:

F

GOTO 30

78:C=G:Z=1
80:GOSUB 308
90:F=F+N:C=F
108: GOSUB 380
110: GOTO 50
120: ENB
300: X=C:

GOSUB 588
318:Y=B:X=A+C
328: GOSUB 599
330:3=C:C=I3~A*Y/CB-Y)
348: IF A3S (B-C)>=E-3
GOTO 388
350:BEEP 3: PRINT *ANSUE

R=%C
360: RETURN
508:B=<*X+2
518:RETURN

268

G

interval

V

*o
f



Z

Initial flag

Program

AVERAGE, VARIANCE AND STANDARD DEVIATION

Title:

OVERVIEW
If

the data are input, the total sum, average, variance, and standard deviation will be calculated for you.

as well as data

with weights,

is

Revision of input data,

possible.

CONTENTS
zxrfi

sum

Total

x —

Average

2/i
o

Variance

2

= 2(Xj~ X)fj

Number

of data entries (up to 50)

2/W

(when there

are

no weights fj=

1

INSTRUCTIONS
1-

At

(def)

2. (def) (~B~)
3.

The

Ca~)
is

,

select

whether or not there are any weights, then input the data.

used to find any revision positions

in

the data,

(def)

Cc)

is

used to revise the data.

total sum, average, variance, and standard deviation will be calculated with

(def)

QT)

EXAMPLE
xt

14.1

fi

8

14.2

14.3

14.4

14.5

19

23

15

10

248

(data with weights)

KEY OPERATION SEQUENCE
Step No.

Key Input

Display

(DEF)CD

NO. OF
(ENTEg)

WEIGHTS

(ENTER

X(1)

14.1

8

DATA =

)

=

1

Remarks
Waiting for

.

/NO WEIGHTS

=

2?_

number

Waiting for the selection of weights/no
weights

:

F(1) =

Center)

X(2)

F(5)«

12

14.5

(|NTE§)

13

10

(ENTER

=

)

End of the process

249

of data input

KEY OPERATION SEQUENCE
Step No.

1

Key Input

(DEF)CBD

Display

Remarks

X(1) = 14.1

2

(ENTER)

F(1) = 8

3

(ENTER]

X(2) = 14.1

(PEF)

(

when
4

(DEF)C©

X(2) =

REVISION VALUE
5

14.2

C ) is used to input the revised values
data errors are found

(ENTER)

=

?_

F(2)«19

(ENTER)

250

Revised value

is

input

KEY OPERATION SEQUENCE
Step No.

1

Key Input

(HEXTT)

Display

TOTAL SUM

= 1072.5

2

(ENTER)

MEAN VALUE

3

CENTER)

VARIANCE

CENTER)

STD. DEV. =

4
5

(ENTER)

6

Center)

Remarks
Display of total

= 14.3

= 1.432432432

sum

Display of average

IE

-02

Display of variance

Display of standard deviation

1.196842693IE-01

>

Processing finished

251

FLOWCHART
Data revision

Data input

200

210
Data display
xii)

230

©

^^"\ Y
*
/^"Data display

DIM

l^
b

\

UP-ll/

"AH

N

®

date\ Y

isplayed^^

I

f

DIM

END

)

X(P-1), F(P-1
Data revision

Data input

°

(

f

END

260

C

(

)
/Data

J

Total sum, average,
variance, standard
deviation

|

deviatic

END

display

pRevised value

Total sum, average,
variance, standard

f

)

1

J

252

input

© ©

PROGRAM
W

10:

LIST

A":

CLEAR

29: INPUT "NO.
38: INPUT

v

WAIT 8
OF DATA=*
:

;4EIGHTS=l/NO

*eights=2? v ;a
48: IF A=2 Bill X:
GOTO 78
58:IF A=l Bin X: GOTO 78
68: GOTO 38
78:F0R 1=8 TO P-i
38:B$=*X<'+ STR$ 
:
GOTO 158
148: GOTO 138
158:NEXT I: END
288:'B': i*iAIT :I=8
218:B$='X('+ STR$ 1)='F'
INPUT 'REVISION VALU
E= v ;F(I): GOTO 290
288:'GOTO 258
298::IF J=l GOTO 238
1Q 4 *tGOTO
i7i
218
388: •D':N=B:T=0:S=B: FOR
1=0 TO P-l:X=X
385: F=l: IF A=l LET F=F(
:

5

•;x

418:PRINT 'VARIANCE^ Q:
PRINT '3TB. BE ^^ v
!

l

i

=

:

«

I)

318: N=N+F:T=T+F*X:S=S+F*
X*X: NEXT I
488: WAIT :X=T/N:Q=

W = >/~(X*X-Y*Y)
K = W*SIN(X-H)
L = ACS(K/C)
M-H-90-L;IM = H-90+L

X = ACS(X/W)
510

Subroutine for finding
the

50

X— Y

coordinates

X-Y

Display of
coordinates
1

Tnput)^

Y2

I

X- FY

=

H = DEG H

c

M

600
Subroutine for

=

N

finding the

coordinates

D

G-E

Subroutine for finding
the

500

X— Y

P=

T)

A-D
Y=B-E
=

B+C*S!NM

X-Y

Q

H = X
90

0=A+C*COSM

coordinates

160
Display of
values of point

X

^N

X— Y

C

END

259

C

RETURN

)

y

PROGRAM
i8:

28:

MEMORY CONTENTS

LIST

v

A :J=6:

w

B :J=l

tf

GOTO 38

tf

30:begree
input *x8=
•;a,'yb= ';bi'R= v ;c
48:INPUT *X1= m M$ 9 n=
:

*;e
58: if j<>0 input

v

a=

"s

h:h= beg h: goto 98
68:input "x2= sf>*y2=
*!G

78:X=F-B:Y=G-E: GOSUB 5
88

38:H=X
98:X=A-B:Y=B-E: GOSUB 5
88

A

X

B

Y

V

C

R

w

L

D

x,

X

AX,

E

Y,

Y

AY

z

F

x2

G

Y2

H

V

1

188:K=U* SIN (X-H>
118:L= ACS (K/C)

J

V

128:i«I^H-98-L:N=H-98+L

K

h

L

a

138: GOSUB 688

148:PRINT USING "ittttttttttt.
tttj ¥ ;»p: ¥ ;o;p
158: M=N: GOSUB 688
168:PRINT *Q:*;05P
178: END
588:l4=f
518:X= ACS (X/U): IF Y<6
LET X=368-X
528: RETURN
688:0=A+C* COS M:P=B+C*
SIN «: RETURN

u

M

Qp

N

Qq

P

X P. X Q
yp, y Q

Q
R
S

335

T
260

6

Program

NUMBER OF DAYS CALCULATION

Title:

OVERVIEW
How many

days has

i: :::::

it

been since you were born?

ztc

answer,n9 such qu * ,tlons

'

8y

**"• a c,min

CONTENTS
[Instructions]

(5§)

QD
BASE YEAR

(

ENTER

)

MONTH
DAY
TARGET YEAR
MONTH
DAY
To end

the program, type

®

in

CZ3

in

place of the year.

[Example]

from 1976 year 10 month 5 day
to 1982 year 6

month 4 day

:

2068 days

to 1985 year

month

:

3010 days

1

1

day

261

dav '

,his

prw,m wm

-*« *•

^

°<

*»

KEY OPERATION SEQUENCE
Step No.

1

Key Input

START YEAR

(5|E)CD

2

1976

(ENTER)

MONTH

3

10

(ENTER)

DAY

4

5

(ENTER)

END YEAR-

5

1982

(ENTER)

MONTH

6

6

(ENTER)

DAY

7

4

(ENTER)

DAYS

(ENTER)

END YEAR

(ENTER)

MONTH

8
9

1985

=

month 5 day

input

Target date 1982 year 6

month 4 day

Target date 1985 year

month

input

=

=

2068.

=

=

(ENTER)

DAY-

11

1

(ENTER)

DAYS-

(ENTER)

END YEAR

(D§E)CZ3

Base date 1976 year 10

=

1

13

=

=

10

12

Remarks

Display

3010.
=

>
262

1

1

day input

FLOWCHART

20

500

510

30

520

50

L
H = R

G
I

I

w

530

70

"Z"

c
100

END

r~^
H

= F

G
l

=
==

= INT(365.25*H)

+ INT(30.6*G) +

= S
=,

V

w

120

263

|

PROGRAM
1

8:

V

A

MEMORY CONTENTS

LIST

V

v
29 input "start year=

r^montk^s^bay^;
T

INPUT "ENS YEAR-';F*

•nGNTHs^V^DAY-VU
H=R
G=S:I=T
70: GOSUB 500
88: J=I
180: H^F
110: G=V:I=W
128 GOSUB 500
58:

580
510
520
538

688
278

V

Month

of target date

C

w

Day of

target date

D

X

Number

Year

G

V
V
V
V

1

J

PRINT
USING
'BAYS= w jX
GOTO 38
•If G-3>=8 LET G=G+l:
GOTO 528
:G=G+13:H=H-1
:I= INT <365.25*H)+
INT <38.6*G)+I
:I=I- INT -386-122:
RETURN
!*Z': ENB
:

Y

F

H

X=W

150

B

E

68:

138
148 MAIT

U

A
?

{after calculation)

:

K
L

M
N

P

Q
R

Start year

S

Month

T

Day of base date

of base date

264

z

of days

Program

Title:

TYPING PRACTICE

OVERVIEW
Quick key operation

How
If

fast

and correct

you practice with

CONTENTS

is

your typing?

this

program,

it

make programming much

wil,

easier for you.

is

skiil

(such as calculation contents)

The number of characters (4 ~
6) is randomly chosen.
The character arrangement (A ~ Z)
is done randomly
The allotted time depends on the
number of characters and the grade

J

Improve your

the shortest time allotment,
while

1

is

level

the longest.

INSTRUCTIONS
After the buzzer sounds,
4 to 6 characters will be displayed
If the are all correct,
you get 10

You

points.

If

more than

half are correct,

After the allotted time

is

you

the shortest time allotment,
while

Point competition

There are

^

characters within the allotted time.

get 5 points.

over the next
Qm
6Xt n.v,M
Pr ° b,em

jS
'

'

(1, 2, 3).

3

is

are to tun* in th-

1

is

,

d,Splayed
"

the longest.

done within the same grade category.
10 problems, making the maximum score
100
is

points.

265

The -"ott-d time depends on the

grade,

which has three

leve,s

KEY OPERATION SEQUENCE

1

2

GRADE

(5EF)CD
(ENTER)

1

Remarks

Display

Key Input

Step No.

(1,2,3)

AZ

B

DC

Grade input

?

3

c©

AZ

B

DC

A

4

(X)

AZ

B

DC

AZ

YOUR -SCORE

YOUR SCORE

IS

= 80

BEST

After the 10 questions are answered, the score
displayed
If

is higher than the high score, the
displayed

your score

guidance

is

>
1

(DEF)(A)

HIGH -SCORE =80
B

2

W VS

GD
YOUR -SCORE

= 60

>
266

When you want

to play

in

the same grade

is

FLOWCHART
"2"

"A"

High score

Grade

Q

©
40

Characters arranged
according to random

110
Points are counted
depending on the number
of correct answers

numbers

\

Series of problem
characters and input
character series

]

J

After the loop has
been processed

YOUR
SSCORE

(

V

END

267

BEST

IS

PROGRAM
V

LIST

U

CLEAR
DIM B$<
Z
5>jC$(5): RANSOM
15:INPU7 v GRABE3)?
v
5L: WAIT 8
17: if 
<>1 THEN 15
13:G0T0 39
UAIT 0:P=8:
28:"A V
PAUSE y HIGH-SCORE= v
18:

:

:

:

?

X

38:F0R S=l TO 18
48:B= RNB 4+2:Y$=" v :R=
INT (B/2>

IF C
85:C$(E>= INKEY$
$= VV THEN 188
37 A$=A$+C*(E)
:

=

98: E=E+1

188: NEXT 14:0=8
118: FOR 14=8 TO 3-1:

IF B

$=C$(W) LET 0=0+1
128 NEXT 14: IF Q<=R THEN
158
138 IF Q=B LET P=P+18:
GOTO 158
148 .P=P+5
158 sNEXT S: US]:ng : BEEP

58: FOR C=8 TO B-1:C$CC>

3:

PAUSE "YQUR- SCORE

= v ;p

68:B= RHIi 2b:B$(C) =
CHR$ X LET X=P: UAIT
v
Y0UR SCO
188: PRINT
RE IS BEST
178 :ENS
:

if

475

268

MEMORY CONTENTS
A$
B

V
V

V

C

Loop counter

w

Loop counter

D

V

X

High score

E

v/

Y$

U

F

z

G

B$(5)

H

C$(5)

1

J

K
L

Grade

M
N

O
P

Score

Q
R

V
V

S

Loop counter

T
269

V
V

Program

SOFTLANDING GAME

Title:

OVERVIEW
involves landing a rocket, with only a limited

game

This

engine

used to slow

is

down

the free-falling rocket.

thrust back out into space and
If all

becomes dust around the
hits the planet

of fuel, as softly as possible.

ignition takes place too

is

The rocket

soon or too much

fuel

is

is

in free fall.

The

used, then the rocket

is

planet.

and blows up.

is burned up, the rocket
the engines while watching
to land the rocket as softly as possible by controlling

the fuel

The aim

If

amount

how much

fuel

is

burned.

CONTENTS
Gravity
If

is

set to be 5

m/(unit time)

2
.

5 units of fuel per a unit time are burnt, then gravity

is

offset.

Equations

H

H

The

V
V2

V
V

Ho

500,

initial

V

+

t

+

yat 2

+ at
2

+ 2aH

V =

-50,

F

= 200

H

H
V

height

a

gravitational acceleration

speed

t

time

V

initial

Vo
F
F

initial

height

initial

speed

initial fuel

fuel

burned

speed

in line
height, initial fuel level, and the wait time are stored

30

as data.

By changing these

values, the above variables

can be changed.

INSTRUCTIONS
1.

It is

started

by pressing (HE)

CA3

.

Press

QD ~ GD

keys to adjust the
270

amount

of fuel used to land the rocket.

KEY OPERATION SEQUENCE
Step No.
1

Key Input

QD

Remarks

*** START***

(5|f)(X)
Keys

2

Display

~

GD

designate fuel burned

in

H: 500

S:

-50

F:

200

C:

H: 452

S:

-46

F:

191

C: 9

unit time

QD

Repeat

(If

successful)

SUCCESS!!

FUEL LEFT:

(If failed)

GOOD

F = 15

BYE!!

REPLAY

(Y/N)?

Wait for input on whether you wish to play again

CYJ

(ED

Play again

>

End
271

FLOWCHART

100

Y
t

130

pressed

A

C=

F

TT^N

^Y

>d fuer^ds fuel
jft

140

C=

^^

TTn
Calculation of the
rocket's height

and speed

272

PROGRAM
-

y-

LIST

h

whiT 58: CLFA°
:s=-50:a =0:D

•

S<5)=2 BEEP 5:
PRINT
•SUCCESS!!*: GOTO
i 3

JSING

^

28=BEEP 5 : PRINT .
hi ART *#* u
30:DATA "TIME=%58,»P!
IE
1,

^=

J

200,"HEI6HT=%5@

8

?Rm

179:BEEP 3:
»g 0B
BYE!!': GOTO 190
188:WAIT 158: print
USING "IliriTO
EFT :f=»; F
19B:HAIT 50: p RINT * R£pi

*

40: RESTORE

50 -'READ

B$,W,B*,f.B*,h

60: WAIT W

SPRINT
F;

USING 's

mv

C:-5 STR*' C
.
8W.-IF F<=0 GOTO
170
9ti .-BEEP
UB$=
'

'

INKEY*

'

AY CY/N) ?*:Z$=
INKEY*
280: IF 1 GOTO 190
210: IF Z*=*Y* GOTO
10
220: END

43S

GOTO 130
110:0= VAL 3$
120: A=C
;ff-ir OF LET C=F

2:S=S+X
150: IF H>0 GOTO
78

16S:iP

(

abc

u/pwx

.^

273

MEMORY CONTENTS
V
V

V

C

Fuel burned

W

Wait time

D$

Fuel burned

X

V

A
B$

U

Y

E
F

z$

Initial fuel level, fuel left

G
H

Initial

height, height

1

J

K
L

M
N

O
P

Q
R
S

Speed

T
274

V

Program

MEMORY CHECKER

Title:

OVERVIEW
Three

with

lines

Your memory

a total of

will

18 characters

be tested by

how

will

well

be displayed on the screen for approximately 5 seconds.

you input the above

line after

it

has disappeared.

CONTENTS
The following type

of line will be displayed for approximately 5 seconds. There are 2 characters and 4

******

The 3

sets

Each

set

is

******

each

set.

******
Set 3

Set 2

1

shown above

The Computer

in

Number

Character

Set

numbers

will

are to be

memorized and then input

then analyze your answers and place you

split into

as answers.
in

one of the possible 7 categories.

2 parts of former 3 and latter 3 characters, giving a total of 6 points

275

when

all

the answers are correct.

Points

Evaluation Message

IDIOT
1

BAD

2

AVERAGE

3

OK

4

GOOD!

INTELLIGENT*

5

** GENIUS**

6

KEY OPERATION SEQUENCE
Key Input

Step No.

1

MEMORY CHECK

(dIDCaD

Title

**xxxx **xxxx **xxxx

2

Remarks

Display

Display of problem line (5 sec.)
character

*
X

3
If-

4

AB1234

.

.

.

.

.

number

ANS. = _

Waiting for the input of set

ANS. = _

Waiting for the input of set 2

1

\

(Lxampiej
I

.

TfmtfrI
^NTERJ

276

KEY OPERATION SEQUENCE
Step No.

Remarks

Display

Key Input

**xxxx

(ENTER)

**XXXX

(ENTER

Waiting for the input of set 3

ANS. = _

)

**XXXX **XXXX **xxxx

Display of the problem line

**xxxx **xxxx **xxxx

Display of the answer input

IDIOT

BAD

AVERAGE
display of category

OK
GOOD!
^INTELLIGENT*

**GENIUS**
*REPLAY
10

QQ *l,N$a8)*l

28!

,V$<3)*3,X$(3)*6,Z$<
3>*3,Y$(3)*6
FOR 1=1 TO 9:N$(I)=
STR$ is NEXT I:N*<19

38:

)

= '8*

58 FOR 1=1 TO 6
60 J= RND 26:J=J+64
78 G$(D = CHR* (J):

NEXT I
FOR 1=1 TO 3
•
90: ¥$(1)=*
108: FOR J=l TO 3:K= RND
9

Y$(I>=Y$(I)+N*:
NEXT J
L= RND 9:J=CI-l)*2+i
A$(I)=G$+G$(J+1>+

110:
128:
130'

K$CL)
140 :H$=Y$(I):A$=

RIGHT* : NEXT
I

159 :GOSUB 500
160 iFOR 1=1 TO 3
ANS.
178 INPUT "
i

"5X$
(I):X$CI)= LEFT* 

180:Z$(I>- LEFT$  LET N
=N+1
240: IF A$(I+3)=V*(I) LET

N=N+1
250: NEXT

I

260:N=N+1
270:WAIT 150: ON N GOTO
300,310,320)330,340,
350,360
IDI
300:BEEP l: PRINT •
GOTO 370
OT v
310:BEEP l: PRINT * BAD
•: GOTO 370
320:BEEP 2: PRINT * AVE
RAGE*: GOTO 370
OK
338:BEEP 2: PRINT 9
v
GOTO 378
GO
348:BEEP 3: PRINT w
v
OD! : GOTO 378
358:BEEP 4: PRINT "* INT
ELLIGENT *': GOTO 37
:

:

8

279

INPUT

378:;U$=": BEEP l:
¥
* REPLAY 5A*<4>;'
*;a$(2>;a$(5:>;•
*;a$<3>;a$<6>
510: RETURN
528::UAIT 88: BEEP i:
PRINT USING '&&&&&&'
5X$; using ;•
USING *&Ute& v ;x$<3>
525 s USING
538 RETURN
688 :END
:

:

!

,r

;

:

391

MEMORY CONTENTS
A$

U

B$

V

C$

W$

3 columns of characters

D$

X

E$

Y

F$

Z

G

G$(6)*1

H$

N$(10)*1

V

Input for

REPLAY

Characters

Number

(1

table

~
(1

6)

~

10)

Index

V$<3)*3

3

Random number

X$(3)*6

Work

(1

~

3)

K

Y$(3)*6

Work

(1

~

3)

L

Z${3)*3

3 columns before answering

1

J

Random number

generation

generation

M
N

Counter

P

Q
R
S

T
280

columns

after answering

(1

~

{1

3)

~

3)

Program

BUGHUNT

Title:

OVERVIEW
This

is

a

game

involving a

man

chasing after a bug.

CONTENTS
Y

The bug moves according to random numbers.
The man chases the bug and kills it.

OD

The man moves by

using the

9

(X)

(A)

(INKEY$isused)

keys.

8

QD
Each time the man moves
stay in the

same

Initially,

the

The bug

is

7

(Sometimes the bug

one space, so does the bug.

will

6

piace.)

man

is in

(0, 0).

4

placed at a position that was chosen at random.

3

Hints are displayed as distance.

ABS(X-a) + ABS(Y-b)

The distance is displayed by the
The initial energy level is 100. This decreases by
Each time that

a

bug

is

killed, the

1

equation.

2

with time.

energy increases by

amount is chosen randomly.)
The score is determined by how many bugs were

killed

5, 10, or 15.

when

(The

(The position of the bug

may "warp" when

the energy level

RUN

(ENTER)

1

2

3

Position of the

cornered.)

started by either pressing

1

X

reaches 0.

The program can be

^

5

position

or (5fF)
281

(X)

4

man

Position of the bug
.

6

5

(X, Y)
(a,

b)

7

8

9

(Small characters are actual values)

Concerning the display

(x,

DISTANCE

y)

Each time the

Bug

is

Remaining energy

(distance)

the display changes

caught

HIT!

HIT!

BANG!

BANG!

SCORE

t

Concerning the

•

man moves

E = e

Z

Hint

Present position
(X coordinate, Y coordinate)

•

=

Hint:

When

ENERGY

BEEP sound
the distance

is

1

the

BEEP

2

3

goes off 3 times
2

"

1

282

*

if

the distance

* When

the bug

is

is

greater than 3 no

caught, the

BEEP

BEEP

is

given.

goes off 5 times.

KEY OPERATION SEQUENCE
Step No.

1

Key Input

@F)CK)

Display

Remarks

(0,0)

DISTANCE-

8

(0,1)

DISTANCE

= 4 E - 99

6

(1,1)

DISTANCE

= 2 E = 98

8

HIT!

5 E = 100

HIT!

BANG! BANG!

SCORE

1

ENERGY

108

2R3

2

BEEPs

5

BEEPs

FLOWCHART

Score display

GAME OVER
END

/^~HIT HIT

\BANG BANG
Points and energy

Judge f rom the distance
L = 1 BEEP 3
2
3

added

2

Score displayed

1

T©

(X, Y): L: E display

284

PROGRAM

LIST
10:»A V

WAIT 2
59: PRINT *** BUGHUN
v
T GAHE **
BEEP 3
20:X=S:T=9:E=l^e:F=l^f:
T=g:S=8
38:A= RNB 9:B= RNB 9
48:L= ABS CX-A>+ ABS (Y
RAHBOfl

:

:

:

^

^

-B>
50: IF X=A ANB Y=3 GOTO

488
188: IF L=l BEEP 3
118: IF L=2 BEEP 2
120: IF L=3 BEEP 1
138:*AIT 58: PRINT
v
)

STR$ 5

E=*5

<*;
(

STR$

158:S=S+lsE=F- INT (S/2>
153: IF E<=0 THEN 580
M
IF G$=
155:G$= INKEY*
v
GOTO 130
157: BEEP l
168: IF G$=*2* LET Y=Y-1:
GOTO 218
V
V
178: IF G$= 4
LET X=X-i:
GOTO 218

78

360 GOTO 40
378 BEEP 4: PAUSE v *** M
ARP *** v : GOTO 30
408 PAUSE "KIT! KIT!*
418 BEEP 5
428 PAUSE 'BANG!
BANG!*
430 T=T+3 :C= RNB 3*5: F=F
+C
435 E=F- INT (3/2)
448 UAIT 100: PRINT v SCO
RE 9 J} 9 ENERGY *?E
458 GOTO 38
PRINT 'SCORE
500 WAIT
*GAME
s TB$ r'T>;
fc

\

258 IF XssA AMI y=B GOTO
488
260 E=F- INT (3/2)
270 IF E<=8 GOTO 588
230 R= RND 5
298 IF R=l LET B=B-l:
GOTO 348
388 IF R=2 LET A=A-l:
GOTO 348
310 IF R=3 LET A=A+l:
GOTO 348
320 IF R=4 LET B=B+l:
GOTO 348
340 IF h<8 OR A>9 GOTO 3
)



:

GOTO

158

distance^;
¥

150
228 IF Y<8 LET Y=0: GOTO
150
230 IF X>9 LET X=9: GOTO
150

v

350 IF 3<8 OR B>9 GOTO 3

uO T

240 IF Y>9 LET Y=9:

STR$ (X);"!^ STR$
y>;

G$=*6 V LET X=X+i:
218
V
V
190 IF G$= 3
LET Y=Y+l:
GOTO 218
200 GOTO 158
210 IF X<8 LET X=8: GOTO
138^ IF

78
285

:

•

"''

;

>18: ENB

MEMORY CONTENTS
A

Position of bug

X

coordinate

U

B

Position of bug

Y

coordinate

V

C

Amount

W

of energy added

X

D
E

Remaining energy

Y

F

Energy

Z

G$

level

Key read

in

H
1

J

K
L

Distance between bug and

man

M
N

P

Q
R

Size of bug

S

Time spent

T

Score

movement

286

Man
Man

position

X

coordinate

position

Y

coordinate

Program

DOUBLE ROTATION

Title:

OVERVIEW
Quickly put
This

is

a

order A, B,

in

game

order, a score

displayed.

is

The sooner the characters
It is

C

•

that arranges randomly placed characters (A

The

trick

is

~ J)

to attack from the best

in

When

alphabetical order.

the letters are arranged

in

the right

place.

are arranged, the better.

fun to race with 2 or 3 of your friends.

INSTRUCTIONS
1.

After the program
ters

2.

3.

(A ~ J)

is

is

initiated,

by pressing

(def)

QT)

,

"DOUBLE ROTATION"

is

A random

displayed.

sequence of charac-

then displayed.

The space in between the characters
number causes the characters on each

is

taken as the breakpoints

(1

~

9)

side of the breakpoint to be rotated

After the characters have been placed

in

order, the

number

of

where the numbers

moves required

is

Inputting a break

are placed.

by moving them to the

ends of the row.

far

displayed as the score. The lower the score

the better.

All
123456789
'

EXAMPLE
In

(1

),

4

(1)

is

input;

tion to (2).
stays in

its

If

1

move to each side, changing the configuranow input, the "E" moves to the far right; but "F"

"F"
is

and " "

place because

I

it

is

already

in

the far

left position,

E

F

becoming

H

E

4

3

:>

B

H

F

B

5

I

A C

A C

8

7

(

J

J

D

9

D

G

123456789

G
^

I

-^"

i

configuration

(3).
(3)

287

F

H

B

A C

J

D

G

I

E

KEY OPERATION SEQUENCE
Step No.

(DEF)®

Remarks

Display

Key Input

DOUBLE ROTATION

A~ J

CD~(3D

Random sequence

display

Numbers between

1

and 9 are selected and input

Repeated input

ABCDEFGHIJ

GAME END
YOUR SCORE

35

Does player want to play using the same
beginning random alphabets?

(HE) CI

ASame

as (def)

CaT)

in

succession

288

FLOWCHART

c^D r^

)

210

400

10

Sequence of
is

Initial

setup

letters

shifted according

to the input numbers

70

300

Random number
generated

110
Alphabet is stored
depending on

310

random numbers

Game

over
score

170

END
A

sequence of

alphabets is
displayed

INKEY$
D$

289

PROGRAM
y

LIST

WAIT 58
CLEAR
RANDOM : DIP! B$<4>
28:PAUSE "DOUBLE RG7ATI
19:

A":

:

220:B*<4>= RIGHT* (B*(2>

10-C)

:

ON*

38:B$C8>="ABCBEFGHIJ V
48:B$(1)= vw
58:A=8
68:F0R 1=1 TO 18
78: R= RN2

18

80:S=2*
85:B=S AND A
98: IF B<>8 GOTO 79
188: A=A OR S
110sB$(l)=B*(l)+ MID* (B
*<9>fR»i>: NEXT I
128:B*C2>=B*<1>
138:N=8
150:BEEP 1
170:D*=": PRINT 3*<2>:D
*= INKEY*
180:C= VAL D$
199: IF C=8 GOTO 170
210:B*<3>= LEFT* ,
C)

248: IF C=l GOTO 268

258:3*<3>= RIGHT* (B*(3)
,1)+ LEFT* ,
1)

288:B*(2)=B$(3)+3*<4)
298:N=N+1
308:IF B*(2>OB*(8) GOTO
158

318:BEEP

PAUSE

5:

V

GAHE

END*

PRINT
USING •Mttt'S'YOUR S

328:14AIT 298:

cqresn
338: END
489: V B W :
20

WAIT 50: GOTO

471
290

1

MEMORY CONTENTS
A
B

C

D$

V
V
V

U

V

w

Input key

X

E

Y

F

z

G

B$(4)

H
1

V

J

K
L

M
N

Score

P

Q
R

Random numbers

S

V

T
291

Alphabet sequences

ADDENDUM
Cat No. 26-3590

« a
use an array^as a
With the PC-3, you can

1

An

first

dimensional array.
element for a two

A*

r
I,

element will not work.
array as a second

Example:
(C (0), 5) - - OK
B(5,C(0))--NO

B

one exception.

There

is

of the

two dimensional

If

the inner array

is

it

second element
can be used as the

array.

"USING"
set by the statement
the decimal places as
^PPed.
is
becomes 0, the last
„
Placed or printed
places are set with USING ##•#
decimal
If
Example:
wi|| be dis p| ay ed
instead of 0.0
will be displayed
fA = fl01

and the number to be

d,s-

2 When

•

.,

0„.

wv vou

1 "-Id «t «*

£ rFA
Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.5
Linearized                      : Yes
Page Layout                     : TwoPageRight
Page Count                      : 289
XMP Toolkit                     : XMP Core 4.1.1
Metadata Date                   : 2013:05:22 09:46:35Z
Create Date                     : 2013:05:22 09:29:25Z
Modify Date                     : 2013:05:22 09:46:35Z
Creator Tool                    : Digitized by the Internet Archive
Producer                        : Recoded by LuraDocument PDF v2.53
Part                            : 2
Conformance                     : B
Document ID                     : uuid:uuid:81b65cd5-b91d-bc86-17f1-9e2d0db09894
Version ID                      : 2
Title                           : Radio Shack Hardware Manual: PC-3 Owners Manual (19xx)(Tandy)
Creator                         : Digitized by the Internet Archive
Keywords                        : http://archive.org/details/PC-3_Owners_Manual_19xx_Tandy
EXIF Metadata provided by EXIF.tools

Navigation menu