Supported On | UX WS DOS IN |
Option Required | MAT |
Keyboard Executable | Yes |
Programmable | Yes |
In an IF ... THEN ... | Yes |
BASE returns the lower subscript bound of a dimension of an array. This value is always an INTEGER. (See also OPTION BASE.)
Lowerbound=BASE(Array,Dimension)
Upperbound(2)=BASE(A,2)+SIZE(A,2)-1
Item | Description | Range |
---|---|---|
array name | name of an array | any valid name |
dimension | numeric expression, rounded to an integer | 1 through 6; <=the RANK of the array |
See CREATE BDAT.
Supported On | UX WS DOS IN |
Option Required | None |
Keyboard Executable | Yes |
Programmable | Yes |
In an IF ... THEN ... | Yes |
BEEP generates one of 64 audible tones.
BEEP
BEEP Freq,Duration
BEEP 81.38*Tone,Seconds
Item | Description | Range |
---|---|---|
frequency | numeric expression, rounded to the nearest tone; Default=1220.7| | 81 through 5208 (see table) |
seconds | numeric expression, rounded to the nearest hundredth; Default=0.2 |
The frequency and duration of the tone are subject to the resolution of the built in tone generator. The frequency specified is rounded to the nearest frequency supported by the sound hardware. For example, any specified frequency from 40.7 to 122.08 produces a beep of 81.38 Hz. If the frequency specified is larger than 5167.63, a tone of 5208.32 is produced. If it is less than 40.69, it is considered to be a 0 and no tone is produced.
The resolution of the duration parameter is 0.01 seconds. Any duration shorter than 0.005 seconds is treated as 0. Any duration longer than 2.55 seconds is treated as 2.55 seconds.
Rounding is performed by the system to produce the number in the first column of the following table. With an HP-HIL interface, the frequency produced is the corresponding number in the second column. (Note that the frequencies generated by a computer with a 98203A/B style keyboard are slightly different than those generated by an HP-HIL keyboard/interface combination.)
Series 200 | HP-HIL | Series 200 | HP-HIL | |
---|---|---|---|---|
81.38 | 81.45 | 2685.54 | 2688.16 | |
162.76 | 162.12 | 2766.92 | 2777.77 | |
244.14 | 244.37 | 2848.30 | 2873.55 | |
325.52 | 324.25 | 2929.68 | 2976.18 | |
406.90 | 408.49 | 3011.06 | 2976.18 | |
488.28 | 496.03 | 3092.44 | 3086.41 | |
569.66 | 578.70 | 3173.82 | 3205.12 | |
651.04 | 651.03 | 3255.20 | 3205.12 | |
732.42 | 744.04 | 3336.58 | 3333.32 | |
813.80 | 833.33 | 3417.96 | 3472.21 | |
895.18 | 905.79 | 3499.34 | 3472.21 | |
976.56 | 992.06 | 3580.72 | 3623.17 | |
1057.94 | 1096.49 | 3662.10 | 3623.17 | |
1139.32 | 1157.40 | 3743.48 | 3787.86 | |
1220.70 | 1225.49 | 3824.86 | 3787.86 | |
1302.08 | 1302.08 | 3906.24 | 3968.24 | |
1383.46 | 1388.88 | 3987.62 | 3968.24 | |
1464.84 | 1461.98 | 4069.00 | 4166.65 | |
1546.22 | 1543.20 | 4150.38 | 4166.65 | |
1627.60 | 1633.98 | 4231.76 | 4166.65 | |
1708.98 | 1700.67 | 4313.14 | 4385.95 | |
1790.36 | 1773.04 | 4394.52 | 4385.95 | |
1871.74 | 1851.84 | 4475.90 | 4385.95 | |
1953.12 | 1937.98 | 4557.28 | 4629.61 | |
2034.50 | 2032.51 | 4638.66 | 4629.61 | |
2115.88 | 2136.74 | 4720.04 | 4629.61 | |
2197.26 | 2192.97 | 4801.42 | 4901.94 | |
2278.64 | 2252.24 | 4882.80 | 4901.94 | |
2360.02 | 2380.94 | 4964.18 | 4901.94 | |
2441.40 | 2450.97 | 5045.56 | 4901.94 | |
2522.78 | 2525.24 | 5126.94 | 5208.31 | |
2604.16 | 2604.16 | 5208.32 | 5208.31 |
In a few cases with an HIL interface, the frequency produced will not be the closest table entry. For example, BEEP 203.4,.5 will BEEP at 162.12 on an HIL interface even though the specified frequency is closer to 244.37 (in the HP-HIL column) because the closest Series 200 entry is 162.76.
Series 200 | HP-HIL |
---|---|
162.76 | 162.12 |
244.14 | 244.37 |
BIN is a secondary keyword for the following statements:
LIST
LOAD
SCRATCH
Supported On | UX WS DOS IN |
Option Required | None |
Keyboard Executable | Yes |
Programmable | Yes |
In an IF ... THEN ... | Yes |
BINAND returns the bit-by-bit logical AND of its arguments.
Low_4_bits=BINAND(Byte,15)
IF BINAND(Stat,3) THEN Bit_set
Item | Description | Range |
---|---|---|
argument | numeric expression, rounded to an integer | -32 768 through +32 767 |
The arguments for BINAND are represented as 16-bit two's-complement integers. Each bit in an argument is AND'ed with the corresponding bit in the other argument. The results of all the AND's are used to construct the integer which is returned.
In the following example, the statement Ctrl_word=BINAND(Ctrl_word,-9) clears bit 3 of Ctrl_word without changing any other bits.
12 = 00000000 00001100 old Ctrl_word
-9 = 11111111 11110111 mask to clear bit 3
----------------
4 = 00000000 00000100 new Ctrl_word
Supported On | UX WS DOS IN |
Option Required | None |
Keyboard Executable | Yes |
Programmable | Yes |
In an IF ... THEN ... | Yes |
BINCMP returns the value of the bit-by-bit complement of its argument.
True=BINCMP(Inverse)
PRINT X,BINCMP(X)
Item | Description | Range |
---|---|---|
argument | numeric expression, rounded to an integer | -32 768 through +32 767 |
The argument for BINCMP is represented as a 16-bit, two's-complement integer. Each bit in the representation of the argument is complemented, and the resulting integer is returned. For example, the complement of -9 equals =8:
-9 = 11111111 11110111 argument
----------------
+8 = 00000000 00001000 complement of argument
Supported On | UX WS DOS IN |
Option Required | None |
Keyboard Executable | Yes |
Programmable | Yes |
In an IF ... THEN ... | Yes |
BINEOR returns the bit-by-bit exclusive OR of its arguments.
Toggle=BINEOR(Toggle,1)
True_byte=BINEOR(Inverse_byte,255)
Item | Description | Range |
---|---|---|
argument | numeric expression, rounded to an integer | -32 768 through +32 767 |
The arguments for BINEOR are represented as 16-bit, two's-complement integers. Each bit in an argument is exclusively OR'ed with the corresponding bit in the other argument. The results of all the exclusive OR's compose the returned integer.
In the following example, the statement Ctrl_word=BINEOR(Ctrl_word,4) inverts bit 2 of Ctrl_word without changing any other bits.
12 = 00000000 00001100 old Ctrl_word
4 = 00000000 00000100 mask to invert bit 2
----------------
8 = 00000000 00001000 new Ctrl_word
Supported On | UX WS DOS IN |
Option Required | None |
Keyboard Executable | Yes |
Programmable | Yes |
In an IF ... THEN ... | Yes |
BINIOR returns the bit-by-bit inclusive OR of its arguments.
Bits_set=BINIOR(Value1,Value2)
Top_bit_on=BINIOR(All_bits,2^15)
Item | Description | Range |
---|---|---|
argument | numeric expression, rounded to an integer | -32 768 through +32 767 |
The arguments for BINIOR are represented as 16-bit, two's-complement integers. Each bit in an argument is inclusively OR'ed with the corresponding bit in the other argument. The results of all the inclusive OR's are used to construct the integer which is returned.
In the following example, the statement Ctrl_word=BINIOR(Ctrl_word,6) sets bits 1 and 2 of Ctrl_word without changing any other bits.
19 = 00000000 00010011 old Ctrl_word
6 = 00000000 00000110 mask to set bits 1 & 2
-----------------
23 = 00000000 00010111 new Ctrl_word
Supported On | UX WS DOS IN |
Option Required | None |
Keyboard Executable | Yes |
Programmable | Yes |
In an IF ... THEN ... | Yes |
BIT returns a 1 or 0 representing the value of the specified bit of its argument.
Flag=BIT(Info,0)
IF BIT(Word,Test) THEN PRINT "Bit #";Test;"is set"
Item | Description | Range |
---|---|---|
argument | numeric expression, rounded to an integer | -32 768 through +32 767 |
bit position | numeric expression, rounded to an integer | 0 through 15 |
The argument for BIT is represented as a 16-bit, two's-complement integer. Bit 0 is the least-significant bit, and bit 15 is the most-significant bit.
The following example reads the controller status register of the internal HP-IB and takes a branch to "Active" if the interface is currently the active controller.
100 STATUS 7,3;S Reg 3 = control status
110 IF BIT(S,6) THEN Active Bit 6 = active control
Supported On | UX WS DOS |
Option Required | IO |
Keyboard Executable | Yes |
Programmable | Yes |
In an IF ... THEN ... | Yes |
BREAK directs the specified serial or datacomm interface to send a break sequence.
BREAK 9
BREAK @Datacomm
Item | Description | Range |
---|---|---|
I/O path name | name assigned to an interface select code | any valid name |
interface select code | numeric expression, rounded to an integer | 8 through 31 |
mux ds | numeric expression, rounded to an integer | 1600 through 1603, factory default select code = 16, HP BASIC/UX 300/400 only |
A break sequence is a signal sent on the Data Out signal line.
On an HP 98626, 98644 Serial Interface, 98628 Datacomm Interface, or 98642 MUX Interface, a logic High of 400-ms duration followed by a logic Low of 60-ms duration is sent.
If an outbound TRANSFER is taking place through this interface, the Break is sent after the TRANSFER is finished; the Break is sent immediately if an inbound TRANSFER is taking place.
NOTE |
---|
The HP 98642 MUX Interface is supported on HP BASIC/UX 300/400 only. |
If the interface is not a serial-type interface, error 170 is reported. If an I/O path name assigned to a device selector with addressing information, error 170 is reported. If the specified interface is not present, error 163 is reported.
BUFFER is a secondary keyword for the following statements:
ASSIGN
COM
COMPLEX
DEF FN
DIM
INTEGER
REAL
SUB.
Supported On | UX DOS WS* |
Option Required | RMBUX Binary |
Keyboard Executable | Yes |
Programmable | Yes |
In an IF ... THEN ... | Yes |
BYE (and alias for QUIT) terminates HP BASIC for HP BASIC/UX andHP BASIC/DOS. The statement is accepted by the editor for HP BASIC/WS, HP BASIC/UX, and HP BASIC/DOS, but it will only execute on HP BASIC/UX and HP BASIC/DOS.
BYE
IF A$="DONE" THEN BYE
When used within a program, BYE stops the program, and then HP BASIC terminates.
When BYE is executed from the command line while a program is running, an error is given. You must first stop (or pause) the program before using the BYE command.
If a program is not running, then HP BASIC terminates immediately.
See ASSIGN.