Download Print this page

Radio Shack TRS-80 Model II Reference Manual page 240

Disk operating system
Hide thumbs Also See for TRS-80 Model II:

Advertisement

Model II TRSDOS
Sample Programming
The following code shows typical repetitive uses of
PARSER
to break up a
parameter list.
If D=0FFH then no separator
at end of buffer.
So go to error routine
Else, then do next routine.
ROUTINE-------------------------
Must save status registers
and any other registers
ltJ
ill b
~!
C
ha rl g
~!
d .
A,C
A
NZ,
P{~I:<!3E
A,0FFH
D
LD
OR
JF~
LD
CP
;-------------PREPARE FOR PARSING LOOP-----------------------
LD
C,MAXLEN
C
=
Maximum length to parse
LD
E,
°
For' initi<:l.l ':i'.:l.ll to NXTFLD
LD
HL,BUFFER
(HL) = string to parse
;-------------PARSE LOOP-------------------------------------
PARSE
CALL
NXTFLD
Routine to call PARSER
CALL
HANDLR
Routine to handle new field
JR
NZ,NXTRTN
Go to next routine if
parsed ended on terminator
Else get new max length
I ::' , it:;::
i~
r'
0
?
If not, then continue
,JI~
Z d::fH<
<JR
NXTRTN
;-------------FIELD-HANDLING
HANDLR PUSH
AF
Processing code goes here ...
LD
A, ..:,,6
m;.'T
8
Rf.::T
;-------------PROGRAM
NXTRTN EQU
$
RE',!"
;-------------CALL TO
NXTFLD LD
D,0
ADD
HL,DE
LD
DE: , I...,<\B
POP
I\F
Restore AF (and other
registers saved at entry)
PARSER---------------------------------
Z\~r'o
rfl~:.b
of
1.)[:
(HL) = where to start parse
(DE) = List address block
If DE=0 then no lists used.
Function Codf:!
CONTINUES HERE------------------------
276

Advertisement

loading