USH
I
Function I
USR[digif](expression) .
Calls a user's assembly-language subroutine identified with digit and
passes
expression to that subroutine.
The
digit you specify must correspond to the digit supplied with the
DEF USR statement for that routine.
If
digit is omitted, zero is
assumed.
This function lets you call
as
many
as
10 machine-language
subroutines, then continue execution of your BASIC program.
Subroutines must have been previously defined with DEF USR[digit]
statements.
When BASIC encounters a USR call, it transfers control to the
address defined
in
the DEF USR[digit] statement. (This address
specifies the entry point to your machine-language subroutine.)
"Machine language"
is
the low-level language used internally by your
computer. It consists of
2-80 microprocessor instructions.
Machine-language subroutines are useful for special applications
(things you can't do
in
BASIC) and for doing things very fast (like to
"white-out" the display).
Writing such routines requires familiarity with assembly-language
programming and with the
2-80 instruction set. There are books
available on this subject; check your local Radio Shack or a book
store.
Example
x =
USR5(Y)
calls the machine-language routine USR5, previously defined
in
a
DEF USR5
= address statement.
Passing arguments from BASIC to the subroutine:
Upon entry to a USR subroutine, the following register contents are
set up (for notation, see the TRSDOS reference section
in
this
manual):
A
Type of argument
in
USR[digit] reference
A
= 8 if argument
is
double-precision
A
= 4 if argument
is
single-precision
2-170