Functions
7-6
HEXS
The
HEX$(X) function returns a string
of
hexadecimal digits which represents the
hexadecimal value
of
the integer argument. In BASIC-SO, integers are from -3276S
to
32767,
but
SOSO/SOS5
memory
addresses go from 0 to 65535 decimal.
HEX$
will
handle arguments in
both
ranges correctly.
HEX$
(expression)
PRINT HEX$
(-1),
HEX$
(65535)
Returns:

INP

FFFF FFFF
HEX$
(expression)
10
PRINT
"TYPE
THE NUMBER
OF
BYTES OF
SPACE"
20
PRINT "NEEDED FOR YOUR PROGRAM,
IN
DECIMAL:"
30
PRINT
40
INPUT A
50
A$
= H EX$(A)
60
PRINT
"YOU'LL
NEED
";
A$;
"BYTES"
The
INP
function returns the value
of
a byte from the
input
port
specified by the
expression.
The
expression must be
an
integer expression in the range 0-255.
INP
(expression)
50
IF
INP(A) =
12
THEN PRINT
"FORM
FEED"
60
IF
INP(A) = 7 THEN PRINT
"BELL"

INPUTS

The
INPUT$
function reads
to
a specified number
of
characters from a specified se-
quential file. In the example below you
can
type in any ten
or
more characters from
the console into sequential file #2.
The
:CI: specifies console input. Line 20 prints
the first
10
characters
of
file #2, and CLOSE concludes the reading
of
the
data.
INPUT$ treats Carriage
Return
like any other character.
INPUT$ (characters,
filenumber)
10
OPEN
"1",
#2,
":CI:"
20
PRINT
IN
PUT$ (10,2)
30
CLOSE#2
40
END
RUN
1234567890
(CR)
1234567890
BASIC-80