Supported On | UX WS DOS IN |
Option Required | None |
Keyboard Executable | Yes |
Programmable | Yes |
In an IF ... THEN ... | Yes |
KBD returns 2, the select code of the keyboard.
STATUS KBD;Kbd_status
OUTPUT KBD;Clear$;
Supported On | UX WS DOS |
Option Required | None |
Keyboard Executable | Yes |
Programmable | Yes |
In an IF ... THEN ... | Yes |
KBD$ returns the contents of the keyboard buffer established by ON KBD.
PRINT KBD$;
Buffer$=Buffer$
&KBD$
When an ON KBD branch is in effect, all subsequent keystrokes are trapped and held in a special "keyboard" buffer. The KBD$ function returns the contents of this buffer and then clears it. A null string is returned if the buffer is empty or no ON KBD branch is active.
Non-ASCII keys are stored in the buffer as two bytes; the first has a decimal value of 255, and the second specifies the key. Pressing [CTRL] and a non-ASCII key simultaneously generates three bytes; the first two have a decimal value of 255, and the third specifies the key. See the Second Byte of Non-ASCII Key Sequences table in the "Useful Tables" section for a list of these keycodes.
The buffer can hold 256 characters. Further keystrokes are not saved and produce beeps. An overflow flag is set after the buffer is full. This flag can be checked by reading keyboard status register 5 and is cleared by reading the status register, SCRATCH A, and a [RESET] operation.
The buffer is cleared by KBD$, OFF KBD, SCRATCH, SCRATCH A, INPUT, LINPUT, ENTER 2, STOP, END, and a [RESET] operation.
Supported On | UX WS DOS |
Option Required | KBD |
Keyboard Executable | Yes |
Programmable | Yes |
In an IF ... THEN ... | Yes |
KBD CMODE enables/disables the HP 98203A/B/C keyboard compatibility mode on an ITF keyboard.
KBD CMODE ON
KBD CMODE OFF
IF Change_mode THEN KBD CMODE ON
Executing the KBD CMODE ON statement re-defines the softkeys of the ITF keyboard so they are compatible with the HP 98203A/B/C keyboard softkeys. This means that the eight function keys located at the top of the ITF keyboard, as well as the [Menu] and [System] keys, emulate function keys [k0] through [k9] of the HP 98203A/B/C Keyboard and their HP BASIC system definitions.
The following are the ITF softkey definitions before executing KBD CMODE ON:
Function\Key | Softkey\Definition |
---|---|
f1 |
f1's label |
f2 |
f2's label |
f3 |
f3's label |
f4 |
f4's label |
Menu |
|
System |
|
f5 |
f5's label |
f6 |
f6's label |
f7 |
f7's label |
f8 |
f8's label |
The following are the ITF softkey definitions after executing KBD CMODE ON:
Function\Key | Softkey\Definition |
---|---|
f1 |
k0's label |
f2 |
k1's label |
f3 |
k2's label |
f4 |
k3's label |
Menu |
k4's label |
System |
k5's label |
f5 |
k6's label |
f6 |
k7's label |
f7 |
k8's label |
f8 |
k9's label |
Executing the KBD CMODE OFF statement returns you back to the softkey key definitions of the ITF Keyboard.
The KBD CMODE statement does not affect KEY LABELS ON or OFF. What this means is the definitions of the softkeys change, but the softkey labels at the bottom of the display will not be turned on or off.
While in the Keyboard Compatibility mode, the System Function keys are accessed by using the [Extend char] key with the softkeys [f1] through [f8]. Note that using [Extend char] along with the [Menu] key turns the keylabels on and off in this mode. [Extend char] when pressed with the [User] or [System] keys exits the Keyboard Compatibility mode. Also, in the Keyboard Compatibility mode, [Shift] can be used with the eight softkeys and the [Menu] and [System] keys (as on an HP 98203A/B/C) to access keys [SHIFT]-[k0] through [SHIFT]-[k9]. When using HP BASIC/UX in X Windows, you may have problems accessing the System Function keys while in Keyboard Compatibility mode. See the window manager documentation for details.
Note that the functionality of this statement can be achieved through KBD CONTROL register 15.
For further information on HP 98203A/B/C keyboard compatibility mode, read the chapter called "Porting to Series 300" in the HP BASIC Porting and Globalization.
Supported On | UX WS DOS |
Option Required | CRTX |
Keyboard Executable | Yes |
Programmable | Yes |
In an IF ... THEN ... | Yes |
KBD LINE PEN sets the pen color to be used for the keyboard line and other associated areas of a color CRT.
KBD LINE PEN Pen_value
KBD LINE PEN 143
IF Color_blue THEN KBD LINE PEN 141
Item | Description/Default | Range Restrictions |
---|---|---|
pen value | numeric expression | see semantics |
Pen color areas of the CRT which are associated with the keyboard line are:
The set of KBD line colors is given in the table below:
Value | Result |
---|---|
< 16 | The number is evaluated MOD 8 and resulting values produce the following:
0 -- black 1 -- white 2 -- red 3 -- yellow 4 -- green 5 -- cyan 6 -- blue 7 -- magenta |
16 to 135 | Ignored |
136 | White |
137 | Red |
138 | Yellow |
139 | Green |
140 | Cyan |
141 | Blue |
142 | Magenta |
143 | Black |
144 to 255 | Ignored |
This statement has no effect on single plane monochrome displays. On gray scale (multi-plane monochrome) displays, this statement changes the display color to a different shade of gray.
For displays with bit-mapped alpha, KBD LINE PEN specifies the graphics pen to be used for subsequent alpha output. The range of values allowed with this statement are 0 through 255; these values are treated as
value MOD (2^n)
where n is the number of display planes.
KBD LINE PEN n and CONTROL CRT,17;n set the value of CRT control register 17. These statements have no effect on control registers 15 and 16 which are set using PRINT PEN and KEY LABELS PEN, respectively.
Note that the functionality of this statement can be achieved through CRT CONTROL register 17.
See EDIT, LIST , LOAD, OFF KEY, ON KEY, SCRATCH, and STORE.
Supported On | UX WS DOS |
Option Required | CRTX |
Keyboard Executable | Yes |
Programmable | Yes |
In an IF ... THEN ... | Yes |
KEY LABELS turns the on-screen softkey labels on and off.
KEY LABELS ON
KEY LABELS OFF
IF Key_labels_on THEN KEY LABELS OFF
With ITF keyboards, the default is KEY LABELS ON. (You can also turn the key labels on and off by using the [Menu] key.) The default softkey menu that appears with an ITF keyboard is the:
The times when key labels are displayed depends on the current value of CRT STATUS register 12:
Value of CRT\Register 12 | Effect on Key Labels |
---|---|
0 | Typing-aid key labels are displayed until the program is run, at which time they are turned off (until at least one ON KEY is executed). For more details on this mode, see the next table. |
1 | Typing-aid and softkey labels are not displayed at any time. |
2 | Typing-aid and softkey labels are displayed at all times. |
The default value of this register is 0 for systems using 98203 keyboards, and 2 for systems using an ITF keyboard. The default is restored at power-on and when SCRATCH A is executed.
When the value of CRT register 12 is 0, softkey labels are ON or OFF as given in the following table:
Condition | KBD Binary Not\Loaded | KBD Binary Loaded |
---|---|---|
No program running | Key labels off | Key labels on |
Program running and ON KEY is not active | Key labels off | Key labels off |
Program running and ON KEY is active | Key labels on | Key labels on |
Executing a KEY LABELS ON or KEY LABELS OFF statement does not change the current softkey definitions.
Supported On | UX WS DOS |
Option Required | CRTX |
Keyboard Executable | Yes |
Programmable | Yes |
In an IF ... THEN ... | Yes |
KEY LABELS PEN sets the pen color to be used for the softkey labels of a color CRT.
KEY LABELS PEN Pen_value
KEY LABELS PEN 143
IF Color_blue THEN KEY LABELS PEN 141
Item | Description/Default | Range Restrictions |
---|---|---|
pen value | numeric expression | (see Semantics) |
The set of key labels colors is given in the following table:
Value | Result |
---|---|
< 16 | The number is evaluated MOD 8 and resulting values produce the following:
0 -- black 1 -- white 2 -- red 3 -- yellow 4 -- green 5 -- cyan 6 -- blue 7 -- magenta |
16 to 135 | Ignored |
136 | White |
137 | Red |
138 | Yellow |
139 | Green |
140 | Cyan |
141 | Blue |
142 | Magenta |
143 | Black |
144 to 255 | Ignored |
This statement has no effect on single plane monochrome displays. On gray scale (multi-plane monochrome) displays, this statement changes the display color to a different shade of gray.
For displays with bit-mapped alpha, KEY LABELS PEN specifies the pen to be used for subsequent alpha output. The range of values allowed with this statement are 0 through 255; these values are treated as
value MOD (2^n)
where n is the number of display planes.
KEY LABELS PEN n and CONTROL CRT,16; n set the value of CRT control register 16. These statements have no effect on control registers 15 and 17 which are set using PRINT PEN and KBD LINE PEN, respectively.
Note that the functionality of this statement can be achieved through CRT CONTROL register 16.
See OFF KNOB and ON KNOB.
Supported On | UX* WS DOS* |
Option Required | None |
Keyboard Executable | Yes |
Programmable | Yes |
In an IF ... THEN ... | Yes |
KNOBX returns the net number of horizontal knob pulses counted since the last time the KNOBX counter was zeroed. Invoking the KNOBX function zeros the counter after it is read.
Position=KNOBX
IF KNOBX 0 THEN Backwards
Sampling occurs during the time interval established by the ON KNOB statement. The counter is zeroed when the KNOBX function is called and at the times specified in the Reset Table at the back of this manual. Clockwise rotation gives positive counts; counter-clockwise rotation gives negative counts. There are 120 counts for one revolution of the knob on an HP 98203A/B keyboard. HIL knobs return a greater number of counts for one revolution of the knob. If there is no active ON KNOB definition, KNOBX returns zero.
Counts are accumulated by the KNOBX function at the end of each ON KNOB sampling interval. The pulse count during each sampling interval is limited to - 127 through +128 on an HP 98203A/B keyboard. HIL pulse counts are limited to -32 768 through +32 767 per sampling period. The limits of the KNOBX function are -32 768 through +32 767.
You can use a relative pointing device, such as the HP 46060A with an HP-HIL interface, if the KBD BIN is loaded.
NOTE |
---|
KNOBX functions differently if BIN file KNB2_0 is loaded. Refer to the knob section of the "Porting to 3.0" chapter of HP BASIC Porting and Globalization for more information. |
Knob support uses the HP BASIC version 3.0 definition. KNB2_0 binary functionality is not supported.
Devices to be addressed using KNOBX must not have been opened by the X Windows server. These devices must also be connected to the local system since they cannot be accessed on a remote system. See the section "Opening Input Devices" in the chapter "System-Level Customization" found in the Using the X Window System, Version 11 manual, for details on how to prevent the X Window server from opening specified HIL devices.
Knob support uses the HP BASIC 3.0 definition. KNB2_0 binary functionality is not supported.
Supported On | UX* WS DOS* |
Option Required | None |
Keyboard Executable | Yes |
Programmable | Yes |
In an IF ... THEN ... | Yes |
KNOBY returns the net number of vertical knob pulses counted since the last time the KNOBY counter was zeroed. Invoking the KNOBY function zeros the counter after it is read.
Position=KNOBY
IF KNOBY<0 THEN Up
Sampling occurs during the time interval established by the ON KNOB statement. The counter is zeroed when the KNOBY function is called and at the times specified in the Reset Table at the back of this manual. Clockwise rotation gives positive counts; counter-clockwise rotation gives negative counts. There are 120 counts for one revolution of the knob on an HP 98203A/B keyboard. HIL knobs return a greater number of counts for one revolution of the knob. If there is no active ON KNOB definition, KNOBY returns zero.
Counts are accumulated by the KNOBY function at the end of each ON KNOB sampling interval. The pulse count during each sampling interval is limited to -127 through +128 on an HP 98203A/B keyboard. HIL pulse counts are limited to -32 768 through +32 767 per sampling period. The limits of the KNOBY function are -32 768 through +32 767.
You can use a relative pointing device, such as the HP 46060A with an HP-HIL interface, if the KBD BIN is loaded.
NOTE |
---|
KNOBY functions differently if BIN file KNB2_0 is loaded. Refer to the knob section of "Porting to 3.0" chapter of HP BASIC Porting and Globalization for more information. |
Knob support uses the HP BASIC 3.0 definition. KNB2_0 binary functionality is not supported.
Devices to be addressed using KNOBY must not have been opened by the X Windows server. These devices must also be connected to the local system since they cannot be accessed on a remote system. See the section "Opening Input Devices" in the chapter "System-Level Customization" found in the Using the X Window System, Version 11 manual, for details on how to prevent the X Window server from opening specified HIL devices.
Knob support uses the HP BASIC 3.0 definition. KNB2_0 binary functionality is not supported.