Download Print this page

Radio Shack TRS-80 Model II Reference Manual page 180

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

Advertisement

Model II
TRSDOS
How to Use the Supervisor Calls
Supervisor Calls
(SVCs)
are Operating System routines available to any user
program. The routines alter certain System functions and conditions; provide
file access; perform I/O to the Keyboard, Video Display, and Printer; and
perform various computations.
All the
SVCs
leave memory above
X'2FFF'
untouched. Only those Z-80
registers used to pass parameters from the
SVC
are altered. All others are
unaffected. However, all the prime registers are used by the System; they are
not restored.
Each
SVC
is assigned a Function Code. These codes run from 0 through 127.
Only the first 96 are defined by the System; codes 96-127 are available for user
definition.
To specify a given Supervisor Call, your program refers to the
SVC's
Function
Code.
Calling Procedure
All
SVCs
are accomplished via the
RST 8
instruction.
1. Load the Function Code for the desiredsvc into the A register. Also load
any other registers which are needed by the svc, as detailed under
"Supervisor Calls."
2. Execute a
RST 8
instruction.
3. Upon return from the
SVC,
the Z flag will be set if the function was
successful. If the Z flag is not set, there was an error. The A register
contains the appropriate error code (except after certain computational
SVCs,
which use the A register to return other information).
Examples
Time-Delay
LD
BC,TIMCNT
LD
t\,
6
REiT
8
DELAY OVER-PROGRAM
L.ENG·T"H OF DELAY
FUNCTION CODE
6 -
DELAY-SVC
J"lWIP TO ENC
CON'T" I
NUE~3
HE::
I~E
Output a line to the Video Display
L.D
HL, IvlSG
tD
B,
1~)
LD
C, it.H)H
LD
1-\,9
RErr
8
,JR
NZ, (-:iOTERR
IF NO ERROR THEN PROGRAM
216
POINT TO THE MESSAGE
B=CHARACTER COUNT
C=CTRL CHAR. TO ADD AT END
CODE
9
= DISPL.AY LINE-SVC
,JUJVIP TO SVC
J"UMP IF I/O ERROR
CONT I
1\~IJEf3
HERE:

Advertisement

loading