
7-6
Section
Details of BASIC Commands
167
key on/off/stop
Syntax:
KEY
[<key expression>] (
ON
|
OFF
|
STOP
)
Description:
Statement. Enables, disables or stops the
KEY
interrupt
Remarks:
<key expression> is an integer expression returning a value in the range : [0…9]. This number
refers to the number keys on the keyboard. For instance, in the above example the interrupt
connected to the ‘5’ key on the keyboard is enabled. If the <key expression> is omitted then the
action is performed for all keys.
ON
enables (unmasks) the
KEY
interrupt. Until
KEY OFF
is executed, program execution will
automatically branch to the defined subroutine for interrupt processing when a
KEY
interrupt
occurs.
OFF
disables the interrupt. All subsequent
KEY
interrupts are ignored.
STOP
masks and enables the interrupt. All subsequent
KEY
interrupts are held until they are
unmasked by
KEY ON
.
The
KEY ON
/
OFF
/
STOP
statements can be executed only after the
ON KEY
statement has been
executed.
Examples:
> 10 ON KEY 1 GOSUB 1000
> 15 KEY ON
> 20 GOTO 20
> 1000 PRINT “YOU PRESSED A KEY”
> 1010 PRINT “THE BASIC LINE NUMBER THAT WAS INTERRUPTED BY THIS
ROUTINE IS LINE “; INTRL
> 1020 RETURN
See also:
ON KEY GOSUB
/
GOTO
left$
Syntax:
LEFT
$ (<string expression>, < numerical expression>)
Description:
Function Returns the specified number of characters starting from the leftmost position in a string
expression.
Remarks:
<string expression> is the string to be searched.
<numerical expression> is the number of characters to be returned. Valid range: [0…255].
If the number of characters to be returned is 0, a null string is returned. If the number of characters
to be returned is greater than the number of characters in the search string then the entire search
string is returned.
Examples:
> 10 A$ = LEFT$("HELLO WORLD", 5)
> 20 PRINT A$
> RUN
HELLO
See also:
MID
$,
RIGHT
$
len
Syntax:
LEN
(<string expression>)
Description:
Function Returns the number of characters in a string expression.
<string expression> is the input string to be counted.
If the string expression is empty then the number of characters returned is 0.
Remarks:
Note:
1.
Non-printing characters and blanks are included in the count.
Examples:
> 10 A = LEN(“HELLO WORLD AGAIN”)
> 20 PRINT A
> RUN
17
See also:
Summary of Contents for C200H-ASC11
Page 1: ...C200H ASC11 ASC21 ASC31 ASCII Units Operation Manual Revised June 2000...
Page 2: ...iv...
Page 4: ...vi...