Operating instructions

20
140 140
50
60
60
60
70
110
90
lnn
flO
YOU
\oIANT
THF~F.
L1NFS
L1~TFn
(yr:~
OP
NO)?
NO
)1
DOr,
IS
FOUND
IN
THE
FOLLOWING
LINES:
1 •
~O
50
5(1
80
10
70
DO
YOU
WANT
THESE
LINES
LISTEO
(YES
OR
NO)?
(b)
Attempt
to
search
for
CAT
Fig. 2:
SEARCH
Demonstration
PL~~~E
VEPIFY
IF
THE
COMPUTE~
TArF~
TH
I S
A~
YOU
H'TEN!"E[l.
Df'
YOlt
~"ANT
TO
C()~'T
I
NlI
F
(YES
n"
Nt')?
YFS
[\0
Yn"
\'IANT
Tn
SFAPrH
INcqnF
~Tl)'~!r,~
(YFS
M
~'n)
'?
YES
On
YOU
W~~IT
Tn
c;
F
~qCH
STP
I
Nr,c;
I)~I
LY
(YFe;
f'R
NO)?
Nn
THE
I
TE~
1
DOr,
IS
FOUND
IN
THE
FnLLnWINR
LINEc;:
Fig.
3:
Other
SEA~CH
Demonstrations
)RUN
63000
1
DOG
(a)
Search
for
equal
signs
THE
ITEM
>l
CAT
)RUN
6300(1
the search item, things go awry. The
result is a muddle, correctable in general
only by a
start
over from scratch.
Design
A few comments on the design
of
the SEARCH/CHANGE program are of·
fered here in lieu
of
remark statements
in the program itself.
First the program identifies the
search
item,
FOR
loop
lines
63040·63070. Then
it
identifies
the
change item,
if
any,
FOR
loop line 63110
and preceeding line. The search is car·
ried out by
FOR
loop lines 63130-63170.
To get the best operating speed, we
close the FOR loop
within
a single line
(line
63130)
if
no byte
of
significance is
found.
Even
so, the testing
for
up
to
three
conditions
takes time.
If
one
of
these
conditions
is
not
met, then the
following lines either pass
to
subroutine
line 63300
to
complete the item iden-
tification
test and make the item change
(if one. is entered),
or
set the
string's
search flag,
or
strart the search
of
the
next program line, whichever is in·
dicated. Line
63120 determines
that
the
search is over when line
62999 Isreached
and passes
to
output. The routine lines
63220-63290 accomplish the line
listing
feature. Note
that
the search
for
the
LIST command is backwards from the
. end of the program (we know
that
the
one we want is the last one).
Also
note
that
the line number has
to
be poked in
so
that
there should always be five
digits
following LIST.
After
use
of
the program,
the actual number
that
appears here
when line
63270
is
listed is the last
number poked in. There should be
leading zeros
if
that
number had less
than five digits. The Applesoft Inter-
preter preserves these leading zeros
whereas the
3.2
DOS
renumbring pro-
gram does not.
If
you want
to
renumber
SEARCH/CHANGE, remember
to
check
this
line and,
if
you want to, change the
62999 in line 63120.
Figure
1:
listing
of
Demonstra·
tlon Program
10
FOq
I • 1
TO
5
20
D~I~T
"ro~s
A~r
r~TS
FI~HT.
";:
~FXT
:
PRI~T
:
PRINT
30
H1PIJT
"r,IVE
Tll<
f!l''''AFP
OF
rAT
c;
";rTC:
DIlINT
40
I"PIIT "r:IVF
THE
NII",qF~
nF
DOt:
5
";nor.:
DIlINT
50
IF
CTS
• 0
ANn
nor: • 0
TH<N
FMO
60
PDINT:
PDINT
"THF
PIlORAqlF
~
IMNFQ
IN
A
CAT-nOr.
FIr.HT":
PRINT
U\iITH
It;nnG;1I
00(;$
A~n
";crc:
;"
CATe;
WNlln
!'IF"
7D
IF
ror. • 0
THEN
PPINT
"
•••••
rAT5 :
EN"
ao IF
CTC
•
(l
THFN
PDP'T "
•••••
Dn~$
:
I='''fn
00
IF
ONI'!
(1)
•
CTc;
I nor: >
.c
THF"
PPI~T
'1
•••••
rAT~
•••••
":
FNr
1 C
AT
PLEASE
VERIFY
IF
THE
COMPUTER
TAKES
THiS
AS
YOU
INTENDED.
DO
YOU
WANT
TO
CONTINUE
(YES
OR
NO)?
YES
DO
YOU
WANT
TO
SEARCH
INSIDE
STRINGS
(YES
OR
NO)?
YES
DO
YOU
WANT
TO
SEARCH
STRINGS
O~LY
(YES
OR
NO)?
NO
THE
ITEM
1 CAT
IS
FOUND
IN
THE
FOllOWING
L1"~S:
NONE.
20:56
MICRO
--
The
8502
Journal
January,
1980