Commands and Statements
6-4
DEFSNG DEFDBL DEFSTR DEFINT
The DEFSNO, DEFDBL, DEFSTR, and
DEFINT
statements are used to specify
that
a given block
of
letters will designate a specific
data
type when used as the first
letter
of
variable names.
The
DEFSNO, DEFDBL, DEFSTR,
and
DEFINT
statements specify single precision floating point, double precision floating point,
string,
and
integer representation, respectively. Blocks
of
letters are specified
according to
the
syntactic
format
given below:
DEFXXX m
[-n][,m[-n]]
...
in which m represents
any
letter, A through Z, and n represents any letter B through
Z. These two letters represent the boundaries
of
a block
of
letters between m
and
n.
If
n
is
not
used, only variables beginning with letter m are specified.
The
n argument
must
follow m in alphabetic sequence; in other words, blocks may be defined as D
to
L,
or
A
to
0,
but
not
as P to A
or
Z to M.
10
DEFSTR S
20
DEFDBL D
30
DEFINT I-N
DEFUSRn
The
DEFUSRn
statement
is
used to specify the starting address
of
an
SOSO/SOS5
assembly-language, PL/M-SO,
or
Fortran-SO subroutine so they may be called by the
USR function. The argument n may be an integer from 0 to 24; if
no
argument
is
given, 0 is assumed.
Two
examples
of
DEFUSRn
statements are given below:
DEFUSR =
OFOOOH
DEFUSR7 =
1%
Because
of
the way BASIC-SO represents numbers internally, 32767
is
the largest
value for
an
integer expression. The following code can be used to specify higher
decimal values in a
DEFUSRn
statement.
10
INPUT
"ENTER
ENTRY ADDRESS
IN
DECIMAL";
A
20
IF
A>
32767
THEN A =
A-65536
30
DEFUSR11 = A
The program below shows how DEFUSR defines a subroutine. Refer
to
Appendix E
for further details
of
using DEFUSR.
10
REM This
program
asks
for
three
20
REM Integers,
passes
them
to
USR1, and
30
REM Returns
the
result.
40
DEFINT A-Z
50
DEFUSR 1 =
OEOOOH
60
PRINT
"Enter
three
numbers:"
70
INPUT A,
B,
C
80
P R IN T
"A

=

";

A;
"B

=

";

B;
"C
= " ; C
90
RESULT =
USRo/01
(A, B, C)
100
PRINT
"A+
B+C+

="

RESULT
110
END
BASIC-SO