A
ll
and more about Sharp PC
-1
500 at http://www.PC-1500.info
10
0
REM
PRINT ANO COMPARE THE
110
REM
AR
EAS
OF
THE RECTANGLES.
1
20
PRINT
"AREA OF
RECTA
NGLE 1
";
A 1
130
PRINT
"AR
EA OF RECTANGLE 2
";
A2
140
IF
A1
> A2 THEN 1
70
150 PA I
NT
"AREA
OF
2
15
> AREA 1"
160
GOTO
180
1
70
PAINT
"AREA
OF
1 IS > AREA
2"
180
ENO
200
REM
SUBROUTINE
TO
COMPUTE AREA
210
REM
OF
RECTANGLE GIVEN
LE
NGTH
220
REM
OF
SIDES
IN
L AND W
230
A
~
L*W
2
40
RETURN
Notice
where
the
subroutine
is
loC.>too
. All su
brout
ines should
be
p
la
ced
after
t
he
final ENO
statement
of
the
ma
in program. Th
is
prevents their accident
al
u
se
by the normal
process
of
seque
nt
ia
l
execut
ion. A RETURN statement MUST terminate each
and
every s.ubroutine.
A
su
brou
tine
may include any l
egal
sta
tement
and may perform any kind
<>f
proces
si
ng
desired.
Good
BASIC
pr
ogrammers design
~hei
r
progr
ams
as
a
set
of
pic<:es.
or
"modules".
Usually a subroutine is "'sed
to
encode each
rl'~O
du
le
.
The
ma
in prog
ra
m
is
then used to control the
order in whichi the subroutines are executed. For further information on this approach refer to
one
of
the boolks on structu
red
programming listed in Appendix F.
SUMMARY OF PROGRAM MODE EDITING FEATURES
11
Program lines should
be
numbered
in intervals of,
at
l
east.
ten.
T
hi
s will allow
an
additional
li
ne
to be inserted b
et
ween any
t~vo
existir-.g
lines merely by choosing a li
ne
number \vhich li
es
in between the line numbe
rs
of
the existing I ines. For
ex~rnp
le
,
to i
ns
e
rt
a
lin
e between lines
40
and
50
give
th
e
new
li
ne
a
number
from the <et 41 through
49.
2)
To
delete""'
existi
ng
li
ne
, simply
type
its line
number
a
nd
press I
EH1ER
I .
NOT
E: Because several
pr
ogram statemeMs may
be
group
ed together
on
a
si
ngle line, great
care
must
be
exercised
when
dele
t
ing
l
in
es
.
3)
The Up Ar
row
and
Do
wn Arrow keys may
be
used
to
s
cr
oll (move
up
or
dow
n) through
the
current program a line at a time. Holdi
ng
either
Arrow
key
down
will cau
se
automatic rcpeti·
tion
of
the movement.
4)
The LIST
co
mmand
may
be
used
to
proceed
direc
tl
y
to
a given line.
The
command
LIST w
ill
display the first line
of
the first
pro
gram in memory. LIST N (w
he
re N is a n
umbe
rl, wi
ll
display line N or,
if
no line numbered N
ex
ist
s,
the first line
\•J
h
ose
numb
er
is
greater than N
is displayed,
5)
Once a
li
ne
is displayed. the L
eft
and
Ri
ght
arr
ow
keys may
be
used
to
position the cursor
anywhe
re
on
the
line. The INSert
and
OEL
et
e
funct
ions may
the
n be used
to
affect
cha
nges.
NOTE: If
clia
n
~e
s
are Made to a
li
ne
,
it
is necessary
to
press ENTER bef
ore
dis
pl
aying
th
e ne
xt
line
or
all changes wi
ll
l>e
nulli
fi
ed (not
made
l.
59
Do
not sale this PDF
!!!