Tandy 1000 Basic Reference Manual page 357

Hide thumbs Also See for 1000:
Table of Contents

Advertisement

Chapter 11 I Technical Information
Exiting the Subroutine
The called routine must execute a RET
number
statement to ad-
just the stack to the start of the calling sequence. The value of
number
is 2 times the number of parameters in the parameter
list.
CALLS Statement
The CALLS statement is the same as CALL except the argu-
ments are passed as segmented addresses. CALLS should be
used to access MS-FORTRAN routines.
Because MS-FORTRAN routines need to know the segment
value for each argument passed, the segment is pushed first, fol-
lowed by the offset. CALLS pushes 4 bytes for each argument;
therefore, the number in the RET statement (RETn) must be
4
times the number of arguments.
USR Function
When the USR statement is executed, the operating system loads
the CS (code segment) register with the value specified in the
last DEF SEG statement. If you are accessing a subroutine
within BASIC's work area and no DEF SEG is required, the CS
register is loaded with the address of BASIC's work area. This
address is shifted left 4 bits; which is the same as multiplying it
by 16 decimal (10 hexadecimal). Then the offset of the subrou-
tine is added to the segment address.
Example
17100
+
0020
=
17120
This is the absolute address of the first instruction in the
subroutine.
355

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents