EasyManuals Logo

Tandy 1000 Basic Reference Manual

Default Icon
411 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #179 background imageLoading...
Page #179 background image
Chapter
10
I
BASIC
Keywords
INKEY$
Function
INKEY$
Reads
a
character in the keyboard buffer, and returns a 0-,
1-,
or
2-
byte string. INKEY$ does not echo the character
to
the display.
0
A
0-byte (null) string indicates that no key is pressed.
0
A 1-byte string is an actual character read from the keyboard.
0
A 2-byte string indicates that the key pressed is one
of
the special
keys that has an extended code. The first byte is hex 00. See Ap-
pendices
B
and
D
for
a
complete list of extended codes.
INKEY$ is invariably put inside some sort of loop. If not, pro-
gram execution passes through the line containing INKEY$ be-
fore you can press a key.
The
[CTRLI[m!
and
IHOLD]
keys are not passed
to
INKEY$. Also
[ALT][CTRLI[],
which does
a
system reset, is not passed
to
INKEY$.
Note:
If your program contains an INKEY$ and you
press a function key, BASIC returns
1
character
of
the
key assignment at a time. For example, suppose this
statement is executed:
A$
=
INKEYF
Now suppose you press
[,
which initially has the
value LIST. The first time the statement is executed
A$ equals
L,
the second time
A$
equals
I,
and
so
on.
Keep this in mind when writing a BASIC routine
to
trap for a certain key. Your routine may not perform
as expected if you accidently press a function key.
You can assign the result
of
INKEY$
to
a string variable and
test the length
of
the string
to
determine whether a 0-,
1-,
or
2-
character string
is
returned by
INKEY$.
Example:
10 A$=INKEY$:
IF
A$=""
THEN 10
20 IF LEN(A$)>l THEN PRINT ASC(MID(A$,l,I)),
30 GOT0 10
ASC(MID$(A$,2,1)) ELSE PRINT
ASCCA$)
Ex
ample
10
A$
=
INKEYS
20 IF
A$
=
"I'
THEN 10
causes the program
to
wait
for
you
to
press a key.
177

Table of Contents

Other manuals for Tandy 1000

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Tandy 1000 and is the answer not in the manual?

Tandy 1000 Specifications

General IconGeneral
ProcessorIntel 8088
Processor Speed4.77 MHz
RAM128 KB (expandable to 640 KB)
Operating SystemMS-DOS 2.11
ManufacturerTandy Corporation
Release Year1984
StorageSingle or double 5.25" floppy disk drive (360 KB), optional hard drive
SoundTandy 3-voice sound
PortsParallel, Serial
GraphicsCGA (Color Graphics Adapter)
Graphics Modes320x200, 640x200

Related product manuals