As much as we all hate reading documentation, the sooner you do, the more time and frustration you will save not only in the long run but even in the short term. HTBasic is a powerful language with many nuances, and with power comes a certain complexity. At the same time, it is Basic! So it is easier to learn and use than other languages. But it also has at its core the original keyword syntax designed by Hewlett Packard in the 1980's (even we continue to be surprised at the ongoing need and interest in backwards code compatibility--it seems no one wants to rewrite thousands of lines of code... go figure). So some of the syntax terminology may seem dated, but the capability has been fully upgraded to the latest Windows standards. For example, the display screen is still the "CRT" (anybody remember Cathode Ray Tubes?), and folder paths are still "MSI" (MASS STORAGE IS) which both might seem cryptic, but that's why you might need to spend a little time up front learning the terminology.
What Makes HTBasic Unique
There are many computer languages that perform basic I/O from the computer's default screen, keyboard, and file system. HTBasic was designed as an instrument control, data acquisition and analysis, and graphics presentation centric tool. As such there are numerous extensions to support these activities. Since I/O involving instruments and devices is such a key emphasis of HTBasic, it is important to understand how this is accomplished.
Device Drivers and ISCs
There are many types of instruments and devices capable of data input and/or output--and many suppliers of them. HTBasic supports many of these directly through loadable device drivers, and others generically through general purpose drivers for LAN (LXI), GPIB, GPIO, USB, Serial, and Parallel interfaces. To communicate with this myriad of devices and interfaces in a uniform and consistent manner, HTBasic uses Interface Selector Codes (ISCs) and Device IDs as references in I/O statement syntax. An ISC is simply a numeric code assigned to a particular interface/device. Since some devices are more common than others, mnemonic constants have been predefined for them. For example CRT (the screen), KBD (the keyboard), and PRT (the default printer) have the preassigned values of 1, 2, and 10 respectively. Other user defined ISCs are assigned to an I/O channel at the time a particular device driver is loaded. You may note in some of the examples that devices are also "named" in addition to being assigned a numeric ISC. For example, GRAPHICS INPUT IS "KBD",KBD which might seem redundant, but the name and ISC serve different purposes. Plus, not all ISCs have predefined constant names--unless you define them.
Keyword Grammar
HTBasic also uses keyword "grammar", which means some keywords are used in combination with other keywords to create multiple meanings. Also, context may change the meaning syntactically of a program element. For example, besides being an ISC constant, KBD also has multiple other grammatical and contextual meanings such as: KBD CMODE (sets softkey style), ON KBD (captures key presses), OUTPUT KBD (outputs key-presses to the keyboard buffer), CONFIGURE KBD (defines keyboard mappings), KBD LINE PEN (sets input line color). KBD$ is also a predefined function that returns the key presses captured by ON KBD. And finally, HTBasic allows names of variables, line labels, and SUBs to overlap keyword names based on "case" and context. For example, Kbd is a legal name for those entities.
Example Programs and Keyword Help
The next best way to get started is to try out the library of example programs. And if you're curious about a certain keyword, just type HELP "keyword" from the command line.
HTBasic Setup
HTBasic is provided as a download or optionally on physical media such as a USB Flash Drive or CD-ROM to serve as backup and in some cases license control. During Setup you are prompted to enter your User Information and Serial Number. We use this information to track licensing and provide support. You should save the serial number for future reference. However, it will be stored on your system and can be queried by the command:
SYSTEM$ ("SERIAL NUMBER")
You may also need to install third party libraries if you will be connecting to their instruments using
LXI or
GPIB , or to
GPIO or other I/O cards, or to printers, plotters, or other devices (see
I/O Device Drivers for more information).
Auto Start Program
Each time HTBasic starts, it checks the current directory for an AUTOST program file. If one is found, it is automatically loaded and executed. This allows you to load any necessary device drivers, customize HTBasic using any of the programmable statements, and start any default application or menu program you desire. You can also customize startup behavior by adding command line "switches" such as the
Alternate AUTOST Switch.
Setting the Folder Path (MSI)
In the Options menu you can set the Folder Path (MASS STORAGE IS). This becomes the working directory for program and data files.
In the dialog box browse to the desired folder, or type or paste the desired path into the box.
Getting HELP
Besides accessing this HELP documentation from the Menu (or by pressing F1), you can use the HELP command to look up keywords. Just type "HELP" on the command line followed by a keyword. For example, to look up the keyword GOTO:
HELP GOTO
The help manual will be opened to that keyword.
Exiting HTBasic
Once you're in, how do you get out, gracefully? The HTBasic user’s interface provides several methods to close the program window, close all open files, shut down HTBasic, and return to Windows.
In addition to exiting with the user interface commands, HTBasic can be exited programmatically by using the QUIT and QUIT ALL statement. Using QUIT will close the program (child) window and return HTBasic to Idle Mode. Using QUIT ALL closes the program window, all open files, and shuts down HTBasic and returns to Windows. These statements can also be entered for immediate execution from the HTBasic command line.