Download Print this page

Radio Shack TRS-80 PC-2 Owner's Manual page 15

Hide thumbs Also See for TRS-80 PC-2:

Advertisement

As an another example, suppose that array P$ (1, 2)
*
3
has already been properly dimensioned, that SETDEV KI
is in effect, and that the RS-232C has been properly con-
figured via SETCOM; then, INPUT% P$ (
* )
is executed.
The
data
string
received
at
the
RS-232C port is
"ABCDEFGH IJLKMN".
First, all elements in array P$ are nulled, or set to " ".
NEXT, P$ (0,0) is filled from left to right with RS-232C
input characters to its maximum length (determined by
the DIM statement which is in this case three characters).
Thus, P$ (0,0) is set to "ABC".
Next, P$ (0, 1) is filled in the same manner. P$ (0, 1)
winds up as "DEF". Then, P$ (0, 2) is filled with "GHI".
Next, progressing through the array in row-major order,
P$ (1,0) is filled with "JKL". Then, P$ (1,1) is filled,
but since input stops at "MN", P$
(1, 1)
is set equal to
"MN" and INPUT% stops.
INPUT#-8,
Input Data from the RS-232C.
INPUT #-8, "prompt"; variable
prompt is the message you want displayed.
prompt is optional; if omitted, a question
mark (?) will be displayed.
variable represents the data to the typed in.
INPUT#-8, differs from INPUT only in that it requests
data from the RS-232C instead of the keyboard. What-
ever character string is received is evaluated in precisely
the same manner as for INPUT (specifically including
evaluation of arithmetic expressions).
Use INPUT$ if
this expression evaluation is not desired.
24
The syntax of an INPUT#-8, statement takes exactly the
same form as BASIC's normal INPUT. If a quoted string
prompt is provided, as in INPUT#-8, "SEND DATA ";
X, the prompt is displayed in all cases.
For example, to input a string value from the RS-232C
port, use a command similar to the following:
100 INPUT#-8, X$
To input Y from the keyboard (where the input is equal
to 0), then input Y again from the RS-232C, use a
command sequence similar to the following:
100 INPUT "ENTER Y "; Y
110 IF Y
=
0 INPUT#-8, Y
MERGEa
Merge an ASCII Format Program
MERGEa
The files to be merged must be saved with the
A ("ASCII") option.
MERGEa is to MERGE as CLOADa is to CLOAD.
MER GEa functions only when cassette input is routed
from the RS-232C.
MERGEa functions precisely the
same as does MERGE except that the PC-2 will expect
ASCII format input from the RS-232C. This means:
Each line must start with a line number.
Each line is ended with a carriage return (ODH).
Maximum length of line is 160 characters, including
line number and the carriage return.
Leading blanks (after a carriage return and before a
line number) are ignored.
25

Advertisement

loading