Functions

BASIC-80

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:

FFFF FFFF

HEX$ (expression)

10 PRINT "TYPE THE NUMBER OF BYTES OF SPACE"

20PRINT "NEEDED FOR YOUR PROGRAM, IN DECIMAL:"

30PRINT

40INPUT A

50A$ = HEX$(A)

60PRINT "YOU'LLNEED "; A$; "BYTES"

INP

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)

50IF INP(A) = 12 THEN PRINT "FORM FEED"

60IF 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)

10OPEN "1", #2, ":CI:"

20PRINT IN PUT$ (10,2)

30CLOSE#2

40END

RUN

1234567890 (CR)

1234567890

7-6

Page 70
Image 70
Intel 9800758-02 manual Hexs, Inputs