Copyright: (c)1997 R.E.Harvey, Box 5695, Glendale AZ 85312
Citation: HP 95 Util Pack (C)97 R.E. Harvey, P.O. Box 5695, Glendale AZ 85312


Contents

 Welcome

 AscTable - Pop-up table

 BigTime - Large Clock

 I95 - Information and Configuration

 SP - Spelling Checker

 DOS Programs

 Explorer's Guide

 Reference

 Using Windows Help

 Copyright


Contents - Introduction
Contents

 Welcome

 Introduction

 Getting Started

 The System Manager

 Installation

 Running System Manager Programs

 Running DOS Programs

 AscTable - Pop-up table

 BigTime - Large Clock

 I95 - Information and Configuration

 SP - Spelling Checker

 DOS Programs

 Explorer's Guide

 Reference

 Using Windows Help

 Copyright


Contents - AscTable
Contents

 Welcome

 AscTable - Pop-up table

 AscTable Quick Jump Function

 AscTable Key Assignments

 BigTime - Large Clock

 I95 - Information and Configuration

 SP - Spelling Checker

 DOS Programs

 Explorer's Guide

 Reference

 Using Windows Help

 Copyright


Contents - BigTime
Contents

 Welcome

 AscTable - Pop-up table

 BigTime - Large Clock

 Adjusting the Clock

 BigTime Key Assignments

 I95 - Information and Configuration

 SP - Spelling Checker

 DOS Programs

 Explorer's Guide

 Reference

 Using Windows Help

 Copyright


Contents - I95
Contents

 Welcome

 AscTable - Pop-up table

 BigTime - Large Clock

 I95 - Information and Configuration

 BIOS Reports

 Memory Report

 Disk Drive Report

 Keyboard Repeat Rate

 Timeout Report

 Applications Report

 Communications Port Report

 PrtSc Report

 Battery Gauge

 Keycode Function

 ASCII Table

 I95 Key Assignments

 SP - Spelling Checker

 DOS Programs

 Explorer's Guide

 Reference

 Using Windows Help

 Copyright


Contents - SP
Contents

 Welcome

 AscTable - Pop-up table

 BigTime - Large Clock

 I95 - Information and Configuration

 SP - Spelling Checker

 Your Custom Dictionary

 Stat Function

 SP Limits

 SP Key Assignments

 Capitalization Guidelines

 DOS Programs

 Explorer's Guide

 Reference

 Using Windows Help

 Copyright


Contents - DOS Programs
Contents

 Welcome

 AscTable - Pop-up table

 BigTime - Large Clock

 I95 - Information and Configuration

 SP - Spelling Checker

 DOS Programs

 95 - System configuration

 BATTERY - Check battery level

 BEEP - Four-tone sound

 BW80 - Set CGA in BW mode

 CHECK95 - See if computer is HP 95

 DIRS - Search for files

 DISKFILL - Overwrite unused disk

 DISKSIZE - Disk space information

 DISP - Enhanced ECHO replacement

 ECHO2 - Display text to StdErr

 FATTR - Set file attributes

 FCRYPT - Encrypt a file

 FTD - Set file time and date

 GETKEY - Wait for a keystroke

 INTR - Interrupt vector information

 MEM - Memory information

 NOW - Display current time

 MOUSEFIX - Reset mouse driver

 PAUSE95 - Low-power PAUSE replacement

 PCINFO - Computer configuration information

 PCX, PCXS - Display PCX graphics

 PCXINFO - Information about PCX graphic image

 PLAY - Play music

 RANDWORD - Create random passwords

 REBOOT - Reset the computer

 RENMOVE - Rename file or sub-directory

 SEROFF - Turn off serial port

 SHOWKEYS - Display keystroke information

 SIFT, SIFTHIGH, SIFTI, SIFTWS - Text filters

 SLEEP - Turn off the computer

 TEXTMODE - Return to text mode

 TMORE - Display a file; MORE replacement

 TTYPE - Display a text file; TYPE replacement

 UNCOMMON - Create a DEBUG script

 WAIT - Wait for a key or amount of time

 WAITKEY - Wait for a key

 WHEREAMI.COM - Show current path

 WINK - Large cursor TSR

 WINK.SYS - Large cursor device driver

 WORDS, WORDSI -Count words, sentences, paragraphs

 Explorer's Guide

 Reference

 Using Windows Help

 Copyright


Contents - Explorer's Guide
Contents

 Welcome

 AscTable - Pop-up table

 BigTime - Large Clock

 I95 - Information and Configuration

 SP - Spelling Checker

 DOS Programs

 Explorer's Guide

 Living With The HP 95

 Program Files

 Before Things Go Wrong

 Resetting The Computer

 Resource Management

 RAM Cards

 Power Management

 Configuring and Customizing

 HP 95 Business Card

 Introducing System Manager

 Calling Hearts&Bones and TigerFox

 Programming the HP 95

 Exploring MS-DOS

 MS-DOS Command Line

 MS-DOS Commands

 Files and Devices

 Devices and Device Drivers

 Taming the RAM Disk

 Making Room for DOS

 Redirection and Piping

 Viruses And Worms

 DOS Pronunciation Guide

 Customizing MS-DOS

 Batch: DOS' Programming Language

 Configuration Suggestions

 More Room For DOS

 TSR Programs

 CHKDSK.EXE

 DEBUG.EXE

 Creating DEBUG Scripts

 SERINT.COM

 More than You Probably Want to Know

 Reference

 Using Windows Help

 Copyright


Contents - Reference
Contents

 Welcome

 AscTable - Pop-up table

 BigTime - Large Clock

 I95 - Information and Configuration

 SP - Spelling Checker

 DOS Programs

 Explorer's Guide

 Reference

 Glossary

 Hotkey Codes

 Debug Commands

 MS-DOS Commands

 PROMPT Symbols

 File List

 Using Windows Help

 Copyright


 HP 95 Utility Pack 3.0
Copyright © 1991-1997 Richard E. Harvey, All rights reserved.

Richard E. Harvey

P. O. Box 5695

Glendale, AZ 85312 USA

Email: r_harvey@compuserve.com

Internet: http://ourworld.compuserve.com/homepages/r_harvey


Introduction

HP 95 Utility Pack

Our HP 95 is miraculous—an expandable, pocketable PC-compatible with a raft of built-in programs. After awhile, though, we all say "Now if only I could..." This software package helps us achieve some of those new tasks with our HP 95.

This special release includes the complete original HP 95 Utility Pack, plus the complete HP 95 Productivity Pack. To help you get more from these programs, this manual includes selected chapters from the book The Explorer's Guide to the HP 95. This is a one-stop resource for HP 95 software and information. This online book further improves usability.

MS-DOS 3.22 on the HP 95 is shy of some of the functions we often take for granted in other versions of MS-DOS. The Filer takes up some of the slack. Our command line utilities fill-in more of the blanks and add new features.

Everyone who frequents the personal computer world collects utility programs. As time moves on, the goodies directory grows, often with forgotten utilities. We will try to help fill the goodies directory on your HP 95, but with 8- or 16K-worth, instead of a few megabytes.

Our Productivity Pack adds System Manager compliant programs that add new functionality with the ability to switch among programs with a single keystroke.

Document Conventions

Bold capital letters, such as "ENTER" or "F1" represent keystrokes. We show keystroke combinations joined with the plus character; for instance SHIFT+F1. This means you press and hold down a SHIFT key then press the F1 key, then release both keys. The HP 95 Owner's Manual uses a minus sign instead of a plus; we've chosen the plus because it is a standard followed by much of the computer industry. The space bar key is unlabeled; we'll call it SPACE.

When we discuss character codes, we often demonstrate them in the same format used by the BASIC programming language, using the CHR$ function. We can represent "A" as the letter, the number 65 (the ASCII code equivalent), or BASIC-style as CHR$(65). Keep in mind that they all represent the same value to the computer; if you peek into computer memory and look at a byte, it might be "A" or CHR$(65), or even 41h in the hexadecimal numbering system. Each of these are valid ways to represent the same values, and depending on the context.

We show arguments entered on the command line with the program name. Remember that most DOS programs will ask for arguments if you execute them from the Filer. System Manager programs require no arguments.


Getting Started

This is Square One

If you are new to Microsoft Windows or to help files, click on this link to Using Windows Help for an overview. When you're ready, click on the Back button to return to this page.

The HP 95 stores files in multiples of 512 bytes. If a file grows to just 513 bytes, the computer will store it in 1024 bytes-worth of disk space. These utilities are mindful of that 512 byte boundary.

When possible, and when we can do it without compromising functionality, we keep programs under 512 bytes. For instance, FATTR.COM is 512 bytes, while the comparable program in MS-DOS 5.0 is about 15K, and PLAY.COM is about one-twentieth the size of BEEP.EXE from the Norton Utilities. In fact, the largest DOS program is only 4K.

Most of these DOS programs will run on other PC compatible computers. Several programs automatically adjust to the HP 95 display; TMORE.COM, for instance, displays 40 columns and 16 rows on the HP 95, but may display several times more information on your desktop PC—even 50 lines with MS-DOS version 5.0 or later. Some programs, like PLAY.COM, require hardware compatibility. Just a couple will run only on the HP 95; we will include compatibility information when we discuss each program. These programs require DOS 2.1 or later.

Of the more than forty programs in this package, I95, SP, BigTime,  95.COM, DIRSDIRS, FATTR, SIFT, TMORE and WINK.SYS are probably the most useful; they're the first programs you will likely want to try. If you are adding System Manager programs to your HP 95 and you'd like to see which keys are available, try SHOWKEYS.

Programs and Paradigms

Software falls into a few general categories; let's call them batch, filter and interactive.

•	You enter a series of commands and the batch-style program goes about its business without any further intervention; FORMAT works something like this.

•	A filter modifies the results of another process; akin to pouring the output of one program through another. Perhaps that's why DOS frequently uses terms like "Output streams." MORE—or our TMORE.COM—is a simple filter.

•	An interactive program is there for your bidding; it continues monitoring your keystrokes until you make it stop. Lotus 1-2-3 is an interactive program. System Manager programs are interactive.


The System Manager

The HP 95's built-in applications share a programming standard, called the System Manager, which is design philosophy and set of programming tools. The System Manager offers consistency, code savings, compatibility, and non-preemptive multi-tasking. Add-in programs that follow the same standards and use the same tools are called System Manager Compliant—they work just like the built-in applications.

The programs in the Productivity Pack are System Manager Compliant. This means they were designed exclusively for use with the HP 95LX, and use a unique program file format that won't run on other MS-DOS compatible computers. System Manager programs have the EXM file name extension.

It is not necessary to start System Manager programs from Filer—in fact, you can't! You tell the computer about these programs in the APNAME.LST file (discussed later), then start them by pressing a unique hotkey. You can switch between these and HP 95 built-in applications with just a keystroke. Deciding which hot keys to use is an important part of the installation process.

Our DOS programs are small and have simple, well-defined tasks. Our System Manager programs are larger and each one does more. We have to do more with fewer programs because the HP 95 only recognizes up to eight add-in programs at one time.


Installation

Before installing the programs, check the distribution disk for a file named README.TXT. This file discusses last-minute addenda and hints, additions or changes.

 Note:  It's very easy to get confused and copy the wrong file to the wrong place, overwriting and ruining the original files. Please ensure that there is a write protect tab on the 5.25-inch disk and the write protect cover is open on the 3.5-inch disk before continuing. For extra protection, please make back-up copies of the disks before installation.

You can use any computer that can read PC-formatted disks—remember, you aren't trying to run the programs on the PC, so it doesn't matter if it can run the programs. When you have decided which programs you would like to use on your HP 95, simply connect the computers with the HP 8222A Serial Interface Cable, then transfer the files using any communications program and the HP 95's Comm program.

The 95's Comm program supports Kermit and X-Modem file transfer protocols. X-Modem is faster, but it pads each file to multiples of 256 bytes; this will make the original file and the file on the 95 different sizes.

File Names

Most program names are long and descriptive, and hopefully memorable. If you find conflicts with your other programs or if you simply don't like the program names, feel free to rename any files. Please don't try to edit the program files.

Some names are always reserved by DOS; if you rename TTYPE.COM to TYPE.COM, DOS won't find it unless you always type the extension. DOS doesn't even look at the extension you enter on the command line; you could enter TTYPE.PROGRAM and it would ignore anything after the period and still run TTYPE.COM.

Selecting Program Files

We have included more than one version of some programs. It's only necessary to use one version of each program. Often when learning a program we use the larger version, since the additional help makes it easier to learn new options.

Once we're comfortable with a program, we often switch to a smaller version, which saves disk space without compromising how the program works. You may want to continue using the largest, most complete version of the spelling checker.

Memory Requirements

These utilities are designed to save disk storage space and run-time memory requirements. However they do require some additional memory available while they run. Most programs require 2-4K; a few, like DIRS, require as much as 8K. In the unlikely event that there is insufficient memory to run, the programs will simply exit, with no damage done.

System Manager programs require 2-8K  to run. The spelling checker, SP, needs as much as 80K; see individual program entries for requirements.

Installing DOS Programs

DOS programs have the COM, EXE or SYS file type extension.

Create a directory on your PC, say C:\95UTIL, and copy the program files from your distribution disks to your hard drive. If the utility disk is in drive A and your hard disk is C, you might use commands something like:

MD C:\95UTIL
COPY A:. C:\95UTIL

You can try most programs on your PC before transferring them to your HP 95. When you have decided which programs you would like to use on your 95, simply connect the computers with the HP 8222A Serial Interface Cable, then transfer the files using any PC communications program and the HP 95's Comm program.

Installing System Manager Programs

System Manager programs have the EXM file type extension.

Decide where you want the programs to be on your HP 95. It is not necessary to put System Manager programs in the root directory.

Since it doesn't matter where the programs are, and there is no reason you would want to look at the files after they're loaded, it's a good idea to copy them to a seldom-traveled path. Place the program files where they'll be out of sight and unlikely to be accidentally changed or deleted. Many users create a directory named C:\UTIL or C:\BIN for add-in programs.


Running System Manager Programs

Each program performs clearly defined tasks. BigTime handles the clock, SP works with words, and shuttles them between files and the clipboard, and I95 works just with computer configuration.

When practical, we don't use a menu. Instead, all features are available by pressing function keys. This makes programs smaller, faster, and easier to use, since there's little wading-through menus to find the function you're after, and every feature is available all the time.

Larger programs offer on-line help. Press F1 to pop-up the help screen, then press UP or DOWN to browse the text. You can move through the text a screen-full at a time by pressing PGUP or PGDN; since these are shifted keys on the HP 95, you can save a keystroke or two by pressing LEFT instead of PGUP, and RIGHT instead of PGDN. When you're done, press ESC once to return to the program.

Wherever you are, the ESC key backs-up to the previous level or quits the program. For compatibility with the HP 95's Setup program, Q will also quit most programs; occasionally programs need the Q key, so you can press CTRL+Q orALT+Q—or even CHAR+Q—to quit. When you quit the spelling checker, it will ask you if you would like to save any changes.

The HP 95's built-in applications save customizations in *.ENV files in the C:\_DAT directory. We don't—those files take a minimum of 512 bytes each, and make programs take longer to start and quit. BigTime uses the current time display format when it starts, and gives you the option of changing how it works on-the-fly. The spelling checker does use an ENV file, of sorts: it maintains your custom word list in a standard text file.

 Caution:  Don't try to run EXM programs from Filer or DOS or on your desk-bound PC. These program files are a special file type, recognized only by the HP 95.

Hotkeys and APNAME.LST

After copying the program files to your HP 95, you have to let the computer know about the applications, and what hotkey you would like to use to start the programs. We do that in a standard text file named APNAME.LST. The file must be in the _DAT directory. The complete path is:

C:\_DAT\APNAME.LST

You can edit this file with Memo. Let's see how to give BigTime its own hotkey. The program file name for BigTime is BIGTIME.EXM. If you would like to assign the program to ALT+APPT (a natural choice: it's the clock symbol key), the keycode is B300. Assuming BIGTIME.EXM is in the root directory of the C: drive, the line you would add to APNAME.LST looks like:

C:\BIGTIME.EXM,B300,BigTime

All three fields are required, and each must be separated by a comma. Here's what each field means:

Program file:	At the start of the line is the program file name, including the complete path to the program file. This field can be up to 28 characters long.

Hotkey:	This is a four-digit hexadecimal number representing the hotkey you will press to start the program.

Title:	The computer will use this title to identify the program if you run out of memory while trying to start another application. The program title can be up to 12 characters long.

 Note:  You may already have a file named C:\_DAT\APNAME.LST. The HP Spelling checker card or another commercial program may have created the file automatically for you. Or you may have created the file in order to run TigerFox or Hearts&Bones. (Hearts&Bones is a game hidden in the HP 95; if you have never heard of this program, see the Explorer's Guide for more information).

This next example assigns I95 to ALT+FILER, BigTime to ALT+APPT, the SP, the spelling checker, to ALT+MEMO, and AscTable to ALT+CALC.

C:\I95.EXM,AB00,I95
C:\BIGTIME.EXM,B300,BigTime
C:\SP.EXM,BB00,SpellCheck
C:\ASCTABLE,C300,ASCII Table

These are intuitive, easy to remember keystroke combinations, but they may already have another assignment—or perhaps you would like to use ALT+I to start I95. You can select your own keycode.

 Tip:  We've included a list of hotkey codes in this book.

The HP 95 only reads APNAME.LST when you reboot. When you're finished editing APNAME.LST, you'll have to reboot the computer. Whenever you change APNAME.LST you must reboot the computer for the changes to take effect. First close any running programs, then press CTRL+ALT+DEL to reboot your computer. If your hotkey doesn't work there are two likely causes: a typing error on any line in the file (not necessarily on the line that starts your program), or a hotkey that the computer doesn't like. Make sure that the first two digits of the hotkey are not zeroes, while the last two digits must be zeroes.

Notes about System Manager Programs

•	Before the computer can recognize add-in programs, you must create a text file, named APNAME.LST, listing program names, keycodes, and descriptions. APNAME.LST must be in the C:\_DAT directory.

•	You will have to reboot the computer first before changes to APNAME.LST will be recognized. Reboot by pressing CTRL+ALT+DEL at the same time. Be sure to save any open files and close any running applications before rebooting.

•	APNAME.LIST can list only up to 8 program names. That's why we have minimized the number of program files in this package.

•	System Manager programs have the file name extension .EXM. If it has a different extension—like .COM or .EXE—don't try to use it!

•	Program paths APNAME.LST cannot be longer than 28 characters. The hotkey is always four digits. The program title can be up to twelve characters long


Running DOS Programs

There is no blue launch-key for DOS programs! The Filer is your gateway to MS-DOS programs. Move the selector bar to the program file name then press the F4 function key (the "Run" key) to start the program. You can also run programs from the DOS command line; press MENU then select System to exit to the command line. If any programs are running, the computer will display this message:

Cannot launch file:
Other applications are open
Press ESC to continue

This means that another program besides Filer is running. Be sure to save any open files, then quit any running programs, then try Filer again. The HP 95 can only run one DOS-based program at a time. You'll always have to quit the built-in applications before running DOS programs.

When you start programs from Filer, you can only select the program file name, but if you're at the DOS command prompt, you can include a command with the file name. The program named 95.COM displays information about your computer; this example shows the help screen:

95 HELP

The program name is "95," and "HELP" is a command for the program to execute. Don't enter the program extension with the program name, it's ignored anyway, and DOS will search for COM, then EXE and finally BAT files, regardless of the extension you enter.

If you are using the HP 95's Filer, there is no way to add extra commands on the command line—there is no command line—you just move the highlight to the 95.COM entry and press F4. In that case, 95.COM will ask you for commands. 95.COM, and other programs in this package that need information from you, use a colon (":") as the command prompt; when program space permits, they also include the program name. Here is 95.COM's prompt:

95:_

The flashing cursor follows the colon. Type your command then press ENTER. Press CTRL+C (hold down the CTRL key while you press C, then release both keys) to cancel and exit the program. You can also exit programs by pressing ENTER without typing any command.

Some programs display lots of information. SIFT, for instance, can send reams of information streaming off the top of the display. You can pause the flow by pressing CTRL+S, then press any key to continue. The keyboard repeat rate can leave extra keys in the keyboard buffer, so you will have more consistent results if you press CTRL+S to pause the display, then CTRL+S again to continue.

If you like, you can run filters like SIFT without any file name; they will pause and ask you for the name of the file. The disadvantage of this method is that if you redirect the output, you will also redirect the file name you type, so you won't see the file name as you type. The programs will pause and ask you for a file name, but you won't be able to see what you are typing (what you type goes to the file instead of the display).

Some DOS commands use a DWIM (short for "Do what I mean") parser. You can enter paths in several vague ways, and commands will figure out what you mean. This is a luxury that's hard to justify (andnearly impossible to do) in a 512 byte program. If a command is entered incorrectly or a file name can't be found, some programs will exit. If a program in this package can't seem to understand a path, try expressing it in a simpler manner, then give the program another chance to figure it out.

•	When you're in DOS, the EXIT command returns you to Filer.

•	Even if you use output redirection, error messages and program information will still be sent to the LCD display.


95.COM

System configuration. HP 95 only

Suppose you want to change display contrast, disable the PRTSC key or check the back-up battery level. You could write a little program for each of those tasks, but that would take at least 512 bytes of storage for each utility. How about a single program that does those things, and more? That's the idea behind 95.COM: it does more than twenty tasks, useful for day-to-day life with your HP 95, yet it's small enough to justify its disk space if you use only a few features. A side benefit is that each function shares features—and code—for flexibility and sophistication as well as saving memory.

Enter the program name, a space, and the command. This example disables the PRTSC (print screen) key:

95 PRTSC OFF

You can also run the program without any arguments (such as from Filer). This is interactive mode, you can enter one or more commands then press ENTER. The program executes those commands then asks you for fresh commands. When you are done, press CTRL+C or press ENTER.

To see if PRTSC is active, type a question mark after the command:

95 PRTSC ?

The program also displays information about the computer. This next example displays the battery level:

95 BATTERY

Only the first two characters of command names are important (except the BOOT command, explained later). You can enter the examples as:

95 PR OFF
95 BA

Save a bit more typing by combining commands in a single call to 95.COM. Separate arguments with commas or just spaces, whichever you find readable. This example disables PRTSC then displays the battery level:

95 PRTSC OFF  BATTERY

95.COM is not very picky about how you enter commands. Several commands take Boolean (on or off) arguments. SCROLL, for instance, can be ON (non-zero) or OFF (zero), or none of the above (the question mark). You can shorten the commands by using 0 (the number zero) for OFF and 1 (the number 1, or another non-zero value) for ON. You could also use T (for TRUE) or F (for FALSE). You could type the example using a zero:

95 PRTSC 0  BATTERY

•	95.COM works like the DOS command line editor, recognizing the same editing keys. For instance, you can press the backspace key to erase characters or repeat the previous command by pressing F3.

•	Some functions are useful mainly for batch files. Most of these functions return error levels. The results of the last command you executed will return a value to DOS when 95.COM exits.

95.COM Options

Here is a summary of 95.COM features. Following this table is a discussion of each feature.

Keyword	Purpose

BATTERY	Displays main and backup battery levels.

BOOT	Reboots the computer.

CAPS	Turns Caps lock on or off.

CONTRAST	Sets LCD display contrast.

CURSOR	Sets the cursor shape.

FLUSH	Flushes the keyboard buffer.

HELP	Displays a list of options.

INSERT	Turns insert mode on or off.

KEYWAIT	Waits for the next keystroke.

MEMORY	Displays available memory.

NOW	Shows current time and date.

PORT	Plug-in card port information.

PRTSC	Enables or disables the PrtSc key.

REPEAT	Sets the keyboard repeat rate.

SCROLL	Turns scroll lock on or off.

SYSINFO	Summary of system information.

SERIAL	Enables or disable serial port.

SLEEP	Turns the computer off.

TIMEOUT	Sets display timeout interval.

VOLUME	Sets speaker volume.

WAIT	Wait for a key or time to pass.

WIRE	Set serial port to wire or infrared.

95 BATTERY

The HP 95 Setup screen shows system battery as an ambiguous battery gauge; it says nothing about the backup battery. The BATTERY function reports levels for system (the two AAs) and backup (coin-shaped) batteries, and shows results to 1/10th volt. Run this report periodically as batteries age, and you will gain some insight about when it's time to carry spare batteries.

New batteries report about 3.0 volts. When system batteries dip below 2 volts, the computer displays "Low Main Battery" each time you power-up. When the level drops to 1.8 volts, the computer shuts-down until you replace the batteries. You can't just wait for tired batteries to recover a bit then try again, because a built-in fail-safe requires the batteries to recover to 2.5 volts (very unlikely) before the computer will return to normal. This sample report shows the main battery just marginal at 2.1 volts and the backup battery at full-steam:

System battery: 2.1V, backup: 3.0V

•	The computer will display the "Low Backup Battery" message when the backup battery drops below 2.5 volts.

•	The BAT function sets error level 0 if main battery voltage is at least 2.5, error level 1 for 2.0-2.4 volts, and error level 2 if it dips below 2 volts.

•	See also BATTERY.COM

95 BEEP

Does a short, one-note beep. Use this function to test the speaker level when setting the volume.

95 BEEP

95 BOOT

Reboots the computer, much like pressing CTRL+ALT+DEL. It does not reset the RAM-disk. There is no abbreviated form of BOOT; you must spell the entire word. Anything after BOOT will be ignored.

95 BOOT

When you change system configuration, you usually have to reboot for the changes to take effect; a batch file can reboot automatically by calling this function. This feature is also available in REBOOT.COM. See Making Room for DOS for a practical use for this function.

95 CAPS ON/OFF/?

This function turns the caps lock key on or off.

95 CONTRAST 0-15/?

The contrast function sets LCD display contrast.

95 CURSOR 0-7,32/?

This function changes the cursor size. The cursor size grows from the bottom (scan line 7) of the 6x8 character cell. By setting the starting scan line, you can change the cursor shape. This example creates a block cursor:

95 CURSOR 0

Starting at line 0—the top of the character cell—creates a cursor from 0 through 7, which is a solid, flashing block on the HP 95. If you specify 6, the cursor will flash on lines 6 and 7. You can turn the cursor off by specifying an unusually large cursor setting (above 31).

•	This setting is ignored by ROM-based applications. If you would like a more permanent fix, try WINK.COM or WINK.SYS.

95 FLUSH

This function flushes (deletes) waiting keys from the keyboard buffer. The computer remembers up to the last 15 keystrokes; you can use this function to discard any waiting keystrokes so they will not be seen by later programs. The error level returned is for the oldest keystroke. This function is most often used in batch files.

95 HELP

This function displays a help screen, listing commands recognized by the program. 95.COM also recognizes /? or /H as help.

95 INSERT ON/OFF/?

Turns keyboard insert mode on or off.

95 KEYWAIT

The KEYWAIT function waits for the next keystroke. It returns the error level for the key read. ASCII codes will be returned as upper case equivalents; for instance "A" and "a" will both return 65.

95 MEMORY

Displays amount of memory available. This function returns an error level representing available memory. Less than 100K available is returned as 0, less than 200K is 1, and so forth.

95 NOW

This function displays the current time and date in the format:

4:23 pm Thu, Sep 04, 1997

95 PORT

Displays information about a plug-in card.

95 PRTSC ON/OFF/?

If you have accidentally hit the PRTSC key when the printer is off or the serial port is the printer and you are using the serial port for something else, you know about delays and panic. This function enables or disables the PRTSC key; the example turns off the PRTSC key:

95 PRTSC OFF

The SHIFT+PRTSC key combination will be ignored until you turn it back on or until you reboot. This function affects only PRTSC; you can still use your printer with other programs.

95 REPEAT 0-3,0-31

The 95 REPEAT function sets keyboard repeat rate. The two values are the amount of time to wait before repeating a key, and the delay between additional repeats, called "Typematic." The longer the repeat wait, the less likely you will be to accidentally repeat keystrokes. The longer the typematic rate, the slower keys will repeat. This example sets a half second delay before and a typematic of 10 cps:

95 REPEAT  1,12

Both arguments are required, separate them with a comma or space. These tables list the valid arguments. First the delay before keys repeat:

Argument	Delay

0	.25 second

1	.50 second

2	.75 second

3	1.0 second

The typematic—keyboard repeat—rate:

Typematic	Characters per second

0-7	30

8-11	15

12-15	10

16, 17	7.5

18, 19	6.0

20-21	5.0

22, 23	4.3

25	3.3

26	3.0

27	2.7

28	2.5

29	2.3

30	2.1

31	2.0

95 SCROLL ON/OFF/?

Turns the scroll lock key on or off.

95 SERIAL ON/OFF

Turns the serial port on or off. Disabling the serial port when it is not needed can extend battery life. SEROFF.COM also turns off the serial port.

95 SLEEP

Enters sleep mode. The display and keyboard shut-down until you tap the ON key. This feature is also available in SLEEP.COM.

95 SYSINFO

Summary of system information. For a quite different look at your 95—or another PC-compatible—try PCINFO.EXE.

95 TIMEOUT 30-3640/?

The HP 95 will time-out (turn off the display and go to sleep) after a period of inactivity, most often it's five minutes. The 95 TIMEOUT function changes this value to anything up to about one hour. Enter a delay from 15 through 3640 seconds. The example sets a two-minute timeout:

95 TIMEOUT 120

Setting 0 disables timeout. Use this with caution because batteries will quickly drain. Avoid settings below 30 seconds because the 95 will keep falling asleep in the middle of things.

Internally, the computer calculates the timeout in clock ticks, which occur about 18.2 times per second. The TIMEOUT function rounds to 18 ticks per second, so settings will be inaccurate by about one percent.

•	When you reboot, the timeout value returns to 5 minutes.

95 VOLUME 0-3

This function sets the speaker volume. Enter a value from zero through 3; you might follow the volume with the BEEP function:

95 VO 2 BE

95 WAIT 0-180

Wait for a keystroke or for a specified period of time to pass, whichever occurs first. Specify a number of ticks to wait (a tick is approximately 1/18 second). This function is available in WAIT.COM.

95 WA 36

95 WIRE ON/OFF

Sets the serial port to the wire or the infra red port.

95 WI  0


AscTable

System Manager - Character Conversion

The AscTable program pops-up a convenient ASCII/ Decimal/ Hexadecimal/ Binary conversion table. It's useful for programmers and anyone who wants to see the relationships between codes in these different number formats. It reminds us that these numbering systems are really just different ways of expressing the same values.

At about 1K, AscTable is just about the smallest useful System Manager program you'll find. It scrolls as fast as the keyboard repeat rate allows, and will change pages as fast as you can lift your finger from the key. You could replace AscTable with a text file, but the text file would be five times as large as AscTable—and you'd still have to find a way to view a file with those strange characters.

The screen layout is sixteen lines of two columns each. This emphasizes the relationships between characters, hexadecimal and binary numbering systems—hex and binary work well with groups of 16. Each line shows two characters: a low-order (value below 128) character on the left, and a high order character on the right. Characters in the second column are 128 greater than the characters on the left column. A vertical bar separates the columns:

=  61 3Dh 00111101b|¢ 189 BDh 10111101b

Each column begins with a character code, which is the symbol we see on the screen when we view memory. The second value is the decimal number. Third is the hexadecimal (or just hex) equivalent, marked with "h" as a reminder. Finally, the binary equivalent, with a "b" tacked-on to designate it as a binary number.

 Tip:  See the "Binary Survival Guide" chapter in The Explorer's Guide to the HP 95 for an explanation of hexadecimal and binary numbering systems.

AscTable Quick Jump Function

While you can page through the list, try pressing a character key to quickly jump to the associated code. For instance, pressing A moves to the "a" line, while SHIFT+A moves to the "A" line. And CTRL+A moves to the a smiling character 1. A few keys return unexpected special characters—even ENTER is represented by a musical note.

Remember that characters above 127 are shown in the second column. If you press CHAR+A, the display will move to line 6, but since CHAR-modified keys are above 127, the real character is 134, shown as "å" on the right column. Also, the list won't move beyond 127, so if you press Z, for "z", which is character 122, the information will be at the middle of the screen, not the top.

 Tip:  The ESC key quits AscTable—that's the key you might press to see character 27, the escape character. You can quickly jump to the entry for character 27 by holding down ALT while you press 2 then 7, then release ALT.

Quitting AscTable

Pressing the Q key tells AscTable to jump to the "Q" section of the table. To quit the program, press ESC or ALT+Q.

AscTable Key Assignments

Cursor keys move you up or down to view all eight full screens. Move through the list by the screen-full, or a line at a time.

Key	Purpose

ESC	Quit, return to the previous program.

ALT+Q 	Quit. Just like the ESC key.

UP	Move up one line.

DOWN	Move down one line.

PGUP	Move up one screen.

LEFT	Move up one screen.

PGDN	Move down one screen.

RIGHT	Move down one screen.

HOME	Move to the first screen.

END	Move to the final screen

<any key>	Press any character key to see the character.

 Tip:  AscTable is similar to, though much more advanced than, the ASCII function in I95. I95 does not show binary numbers or have the quick jump feature.


BATTERY.COM

Check battery level. HP 95 only

This is the BATTERY function from 95.COM. It shows the current battery level without the extra steps required by 95.COM:

BATTERY

New batteries report about 3.0 volts. When system batteries dip below 2 volts, the computer displays “Low Main Battery” each time you power-up. When the batteries drop to 1.8 volts, the computer shuts-down until you replace the batteries. You can’t just wait for tired batteries to recover a bit then try again, because a fail-safe mechanism requires the batteries to recover to 2.5 volts (very unlikely) before the computer will return to normal. This sample report shows the main battery just marginal at 2.1 volts and the backup battery at full-steam (3 volts):

System battery: 2.1V, backup: 3.0V

•	See the BATTERY function of 95.COM.

•	We've also included a very similar program named BATTERY2.COM. This version displays the battery information on two separate lines, which can be easier to read. Here is the battery report returned by BATTERY2:

System battery: 2.1V
Backup battery: 3.0V


BEEP.COM

Four-tone sound

This little program plays a short, four-note beep on your 95's speaker (reminiscent of the HP-41 calculator).

BEEP

We have included the assembly language source code for this program. If you own Microsoft MASM 6.0 or later, or Borland's TASM, you can edit BEEP.ASM to add, delete or change the sounds.

•	To play custom tunes try PLAY.COM.


BigTime

System Manager - Digital Clock

This program turns your HP 95 into the world's most expensive digital desk clock! While its job is simple, using BigTime, and trying the options, is fun. BigTime also makes it easier to adjust the computer's clock. Here's a typical BigTime display:

That's pretty much it. Most of the time, though, the bottom two lines are blank. Main battery level is in the upper-left corner; the time covers most of the display, and the date is below the time.

BigTime Settings

Each time you restart BigTime, it assumes a few standard settings:

•	Time format the same as the HP 95 Setup program.

•	Long spelling of months and days.

•	Quarter hour chime disabled.

•	Function key help lines off.

Customizing BigTime

BigTime shows the time and date in several formats. These keys customize how BigTime works:

F2	Changes time display format.

F3	Changes date display format.

F4	Turns quarter-hour chime on or off.

Cycle through the four available time formats by repeatedly pressing F2; the options are combinations of 12- or 24-hour clock with or without seconds. The F3 key cycles through the date formats: long or short spelling of days and month names. These keys work even when the function key help lines are not showing.

The chime feature beeps a single note at a quarter past the hour, two tones at half past, three at a quarter 'til, and four short tones on the hour. Press F4 to turn chime on or off. BigTime places a star near the bottom of the screen next to "*Chime" when the feature is active.

 Note:  Changing the way BigTime shows the time does not change the way other HP 95 applications work. Use the HP 95's Setup program to change the time and date display format for other programs.

Adjusting the Clock

One nice feature of BigTime is that it makes it painless to adjust the clock. Function keys adjust the time and date forward or back.

 Note:  To ensure that you don't accidentally change the clock, BigTime can only adjust the clock when the function keys are displayed. Press MENU to turn the function keys on or off.

Adjustments you make to the clock stick—it changes the system clock, not just BigTime's display. It is easy to do, but keep a few points in mind:

•	Be sure to turn on the seconds display so you can see the effect of adjusting by just a second or two.

•	24-hour format makes it easier to tell if you are setting the clock to midnight or noon. In 24-hour format, midnight is zero.

•	Function keys move the clock forward. To move the time or date backward, use SHIFT plus a function key.

Battery Level Report

BigTime also shows the battery level on the upper left corner of the display. It checks the battery once every other minute. You can force BigTime to check the battery again by pressing SPACE (the space bar key) to redraw the screen. The battery level is not necessarily actual voltages; think of it as a guideline: Above 2.5, all is well. Above 2.0, the battery is marginal. While below 2.0, and on down to 1.8, the battery is exhausted.

 Tip:  Try the large, 36-level battery gauge in the I95 program.

Please don't discard the batteries just because the 95 doesn't like them—try using them in flashlights, toys or radios until they really are exhausted, then dispose of the batteries carefully.

Power Consumption

BigTime is designed to maximize battery life. It does as little work as possible, then nods-off; you can tell that it's resting because occasionally a second will catch it off-guard, and it will quickly display the time, only to have the next second soon replace it. This effect is also evident in other programs that show the time in the upper right corner of the screen; it's more obvious with BigTime because the numbers are so large.

BigTime runs in text mode, and writes directly to the video display buffer. The obsession with speed isn't because it has a full agenda of important tasks it's performing, but because the less time it spends working, the more time the computer can spend sleeping.

Turning off seconds display will extend battery life very slightly—usually not enough to really matter. That's because when just the seconds field has changed, that's all BigTime will repaint, but when the minute rolls-over, it will repaint the hour and minute fields.

 Note:  The HP 95 will turn off the display and go to sleep when the timeout expires, regardless of what programs are running. Use the I95 application to change the timeout. When the computer is plugged-into an AC adapter, display timeout is disabled.

If you place your computer near an AM (medium wave) radio and tune the radio between stations until you hear a pulse, you can tell how much power a program uses. The longer or more frequent the pulses, the more power the program draws. BigTime makes justa short blip-sound about twice each second, while some other programs sound like a drum solo. The more complex the task, such as recalculating a spreadsheet, the busier the computer will sound.

Quitting BigTime

There are two ways to exit BigTime:

Q	Quits the program and returns to what you were doing.

ESC	Returns to the previous program without quitting.

If you have customized how the time or date is displayed, or turned on the chime feature, and you want it to stay that way the next time you start BigTime, use ESC to suspend the program. Remember, though, to release the memory used by BigTime, you must quit by pressing Q.

 Tip:  You can leave BigTime running all the time—it needs less than 1.5K of memory. It really doesn't matter, because it restarts as quickly as if you left it running.

While you must quit other HP 95 programs before running MS-DOS programs, you can run DOS programs while BigTime is suspended. Available memory will be reduced by just the memory it consumes.

BigTime Key Assignments

Key	Purpose

ESC	Return to previous application. BigTime remains suspended in time (and memory).

Q	Quit and unload program from main memory.

MENU	Toggle function key display on/off. Also F1 key.

F2	Select time display format.

F3	Select date display format.

F4	Toggle quarter-hour chime on/off.

F5	Adjust the time forward one hour.

SHIFT+F5	Adjust the time back one hour.

F6	Adjust the time forward one minute.

SHIFT+F6	Adjust the time back one minute.

F7	Adjust the time forward one second.

SHIFT+F7	Adjust the time back one second.

F8	Adjust the date forward one month.

SHIFT+F8	Adjust the date back one month.

F9	Adjust the date forward one day.

SHIFT+F9	Adjust the date back one day.

F10	Adjust the date forward one year.

SHIFT+F10	Adjust the date back one year.

SPACE	Redraw the display.


BW80.COM

Set CGA in BW mode. Not HP 95

This program does not run on the HP 95! BW80 is useful if you have a composite monochrome monitor connected to a color CGA card or a laptop computer with an LCD display that wakes-up in color mode. Most software checks the video mode, then tries to display in color—unfortunately a few colors are invisible on some displays.

BW80

BW80 can be used like the DOS command MODE BW80, but it's a bit faster and takes less disk space than MODE.COM. Place BW80.COM on your boot disk and run it from AUTOEXEC.BAT when you turn on your computer.


CHECK95.COM

See if the computer is an HP 95

This program is a batch file utility. It returns an error level value: true (1) means the computer is an HP 95, false (0) means it is not. Nothing is displayed.

CHECK95
IF ERRORLEVEL 1 ECHO This is an HP 95 Palmtop PC


DIRS.COM

Search the disk for files

DIRS, short for DIR Search, locates a file or group of files on a disk. Think of it as a variation of DIR that will also search sub-directories; this is similar to DIR/S in MS-DOS 5.0. Don't be surprised if DIRS shows you files you have never seen before; unlike DIR, it also displays directory entries for hidden and system files.

Include a partial path to restrict the search; wild cards are allowed. Limit the search, for example, to all files with the DOC extension:

DIRS C:\WORD\*.DOC

This locates and displays a list of all DOC files in the \WORD directory and sub-directories sprouting from C:\WORD (such as C:\WORD\LETTERS) but ignores your C:\DAT directory. If you don't include any path, it'll search the entire disk. Press a key to pause, or CTRL+C to cancel the search. DIRS uses a clean, simple format; names are upper case and indented, the path is lower case and left justified:

c:\word\doc\
 README   DOC    54321 Sep 10 97 8:45p

Here are some typical DIRS search patterns:

Command	Results

DIRS	Shows all files on the disk.

DIRS *.DOC	All DOC files on the disk.

DIRS \DOS\	Files in \DOS\ and directories off \DOS\.

DIRS \WORD\*.DOC	DOC files in \WORD or sub-directories.

If you organize files in groups of related sub-directories, DIRS can simplify finding and displaying lists of files. Say \123\ is your spreadsheet directory, and \123\BUDGET\, \123\PROJECT\ and \123\SALES\ sprout off that directory, use DIRS to display a list of files in those directories:

DIRS \123\*.WK?

Specify just a file name and DIRS will act like a simple file finder, something like Norton's FF.EXE (though DIRS.COM is smaller and runs faster), searching through the whole disk for matching files:

DIRS LOSTFILE.*

When DIRS is done, it displays a tally of the number of matching files found and the total of their sizes:

17 files,    176342 bytes

•	If DIRS doesn't seem to find any files, it may be because you have included spaces in your response or more information than is needed.

•	If the program has been working for a few seconds but doesn't seem to be getting anywhere, stop and try it again with a different file path.

•	If you include only a directory path, not a file name, be sure to end the line with a backslash character.


DISKFILL.EXE

Overwrite unused disk space

If you use an encryption program like FCRYPT or PGP (Pretty Good Privacy) for data security. Old versions of your files are still waiting in unused disk clusters—erasing files does not remove the data, just the directory entries. Unscrupulous people (the people you are trying to keep away from your data) can use low-level disk utilities to recover this information.

DISKFILL overwrites all unused disk space with a pattern, then it overwrites that pattern with another. It does this by writing a file to the disk twice, then deleting the file.

DISKFILL A:

You may stop the program at any time; you do not have to wait for DISKFILL to fill the whole disk if you have only recently used a few megabytes. For security it is probably best to defragment your disk, edit the sensitive information, then run DISKFILL.

For best security, avoid storing sensitive information on a hard disk. Avoid using any operating system that uses "Virtual memory" swap files, because even if you write only to a floppy disk, the in-memory data may be copied to the swap file without your knowledge.

 Caution:  Avoid using DISKFILL while running other programs in a multi-tasking operating system like Microsoft Windows. The program temporarily consumes all available disk space, which may make other programs that dynamically allocate disk space unable to run.


DISKSIZE.COM

Disk space information

For those times when you would like to how much space is available on a disk but you don't want to wait for CHKDSK and you don't need all the information PCINFO.EXE offers, try DISKSIZE. It's the disk-equivalent of MEM.COM:

DISKSIZE

Add a drive letter if you would like information about another drive:

DISKSIZE A:

DISKSIZE reports disk cluster size, space, bytes used, and remaining space. This example looks at a 512 megabyte disk partition:

      8,192 cluster size
528,171,008 total disk space
427,212,800 bytes used
100,958,208 bytes available

The cluster size determines disk storage efficiency. A cluster is the minimum storage allocated to a file. The larger the cluster, the lower the disk storage efficiency. The RAM disk on the HP 95 uses 512 byte clusters, for very efficient storage.

 Note:  See the Bytes per sector, Bytes per cluster discussion of PCINFO for more information about calculating disk space requirements.


DISP.COM

Enhanced ECHO replacement

Imagine how useful ECHO would be if it let you display any characters. That's the idea behind DISP. Whatever you enter on the line is displayed without modification... except if you use the command character "/". If a number follows the slash, DISP interprets it as a one to three digit decimal number representing a character code. The slash has several uses:

Code	Results

/000	Slash followed by 1-3 digits enters a character code.

//	Displays a slash character.

/D	Displays the current date.

/T	Displays the current time.

/	If at the end of the line, it suppresses the carriage return/line feed.

Everything is interpreted exactly, if you want to enter a number immediately following the code, make sure to use three digits for the number, adding leading zeros if necessary. The following prints CHR$(27)+"8" without the carriage return or linefeed.

DISP /0278/ > PRN

All values from 0 through 255 are allowed, though be sure that whatever device you are directing the string to can handle the characters. Here are some common codes that DISP lets you enter:

Code	Character

/7	Bell (beep).

/8	Backspace.

/10	Linefeed.

/12	Form-feed.

/13	Carriage return.

/27	Escape.

/60	< Less than symbol.

/62	> Greater than symbol.

/124	| Vertical bar.

This next example resets some printers then sounds the bell (character 7). We have used the code /64, but that's the same as character 64, the "@"

DISP /27/64/7/ > PRN

DISP also lets you enter characters that DOS uses for redirection. Here is an easy way to use < and > characters without redirection:

DISP Press /60Enter/62 to continue...

The example is displayed as:

Press <Enter> to continue...

Time and date stamps are useful for logging system activity, so the format is compact. The date is represented as "Sep 04-97" while the time is shown as "20:45:12" in a 24-hour clock. We usually use output redirection to log the time and date stamps to a file.

DISP Today is /d, at /t.

•	No extra spaces are added around text, be sure to add needed spaces

•	If you need a more elaborate time and date stamp, try the NOW command in 95.COM.


ECHO2.COM

Display text to StdErr

If results from your batch file are redirected to a file, ECHO, too is redirected. There’s no way to warn the user about disk changes or impending calamities. ECHO2 works like ECHO—except it ignores output redirection, and will always send the message to the screen.

ECHO2 Hello, world! >NUL

This example would display nothing at all with ECHO. However replacing ECHO with ECHO2 ensures that the text goes to the display.

When we redirect ECHO’s work, the message is not displayed. This is fine until we want to tell our users to change disks or give them a chance to quit before something awful might happen. We’ve included a program, called ECHO2.COM, that works like ECHO, but it ignores output redirection. This command will just about always send the message to the display:

ECHO2 Busy... Don't press Ctrl+C right now! >NUL

If you call ECHO2 without anything to display, instead of displaying something annoying like “ECHO2 ON” it will display a blank line. When it’s not important if output is redirected, use ECHO instead of ECHO2, it will often be faster because internal commands have less overhead than external commands—DOS will have to load the ECHO2.COM program file for each call. Since the HP 95 uses a RAM disk, the time to load programs is barely noticeable.


FATTR.COM

Set file attributes

Short for File Attribute, FATTR modifies file attributes. You can change files to read-only or hidden, and change them back again.

FATTR is similar to ATTRIB.EXE, furnished with many versions of DOS (though not DOS 3.22), though it does not support ATTRIB's /S switch. FATTR can also make files hidden or un-hidden (this feature was introduced in MS-DOS 5.0). Enter a file specification (with wild cards, if you like) and any of these switches:

Set	Clear	Operation

+A	-A	Set or clear the archive bit.

+H	-H	Hide or un-hide.

+R	-R	Make read-only or modifiable.

+S	-S	Mark as a system file.

If you omit these switches, FATTR displays attributes for matching files without changing any files. This example displays the attributes for all COM files in the current directory:

FATTR *.COM

You can make programs read-only, and add a bit of security to keep you from accidentally erasing files:

FATTR +R MYPROG.COM

Later, if you decide to delete a program, you can change the read-only attribute back to normal:

FATTR -R MYPROG.COM

There are a few points to keep in mind when using FATTR:

•	FATTR cannot change the status of files in ROM, such as the hidden ROMDUMMY files or the files in the HP 95's C:\_SYS directory, though it can display information about those files. If you use FATTR to try to change files in ROM, the computer will display "Write protect error writing drive C, Abort, Retry, Ignore?" Press I to ignore the file, and FATTR will move on to the next file.

•	You can hide program files and still be able to run the programs from DOS (not from Filer, it can't find them!), but you cannot delete them and they don't show up in directory listings.

•	Try setting a directory to read-only to protect files in the directory.

•	You can hide many types of files, but be sure the applications you are running can still find them! If you hide C:\123.CNF, for instance, Lotus 1-2-3 will not be able to update the file.

•	Keep in mind that FATTR works differently than FTD.COM. While FATTR will display files that match the file specification, FTD will actually change the files to the current date and time. FATTR works like DOS' ATTRIB, while FTD works like many TOUCH utilities.


FCRYPT.COM

Encrypt a file

This program encrypts or decrypts a file using a binary XOR-NOT algorithm. Encrypt or decrypt the file by calling FCRYPT again using the same password. Enter the command line something like:

FCRYPT FILENAME.TXT

If you don't specify a file name (or FCRYPT cannot find the file), the program will ask you to enter the name of a file.

Next, FCRYPT will ask you for a password. The password can be up to the length of the command line; the longer the string, the more difficult it will be to "crack" the password.

Finally, FCRYPT will ask you to enter the password again, to confirm that you typed it accurately.

So, how does FCRYPT know whether to encrypt or decrypt your file? It doesn't! Each time you run FCRYPT reverses the effect of the last program run. A short demonstration will make it easier to understand how the encryption works. The letter "A" is ASCII code 65. Say your password is "*", with a value of 42. XOR 65 with 42 and you will get 107 (which happens to be the letter "k"). Now do a NOT and you end up with 148 (the character "ö"), which is what FCRYPT will write to your file.

Next time through, you will use the "*" password again, though now your file contains "ö". When you XOR with 42, it becomes 190. Finally, when you NOT it, your original "A" is back.

Breaking the "*" code would be fairly painless. Using NOT when we're done helps a bit, but more important is a long password. As FCRYPT reads your file, it matches a different letter of the password to each character in your file; when it reaches the end of the password, it starts at the beginning again. The longer the password, the more challenging it is for the snoop to figure out what's happening.

For an added level of security, you could run FCRYPT twice, using a different (and different length) password each time through, then reverse the process to decode the file. After the second encryption pass, your file will look curiously English-like, but the words won't make sense to anyone over two years old.

•	The password is treated literally. Space characters, while invisible on the command line, are counted in the password string. Upper- and lower-case characters are treated differently, and any characters are allowed in the string. Use a variety of characters for more security.

•	Use a long, memorable password. The longer the password, the more effective the encryption.

•	The password is not included in the file—it is not saved anywhere! If you forget the password, you will not be able to restore the file!

•	The file is encrypted in place, no back-up copy is created. The file length does not change.

•	Test the program first only with back-up copies of your files.

•	The program is a "toggle." Each time you run it with the same file and the same password it changes from encrypted to un-encrypted.

•	Avoid files with long repeating series of nulls; this will repeat the password, only slightly encrypted, making it a breeze to guess the key. Avoid EXE programs, which begin with a few hundred null bytes.

•	If you are encrypting a program file (COM or EXE file extension), change the file extension to something benign and not executable. If you try to execute the program, you will surely hang the computer—with some possibility of serious repercussions.

•	Do not interrupt FCRYPT's work or your file may be damaged.

•	This is not a bullet-proof encryption scheme. This program is only reasonable protection. Like locks on doors, if somebody wants to break-in, this program cannot stop them. The only truly secure method is to not make important files available.

Just because your file is secure doesn't mean your disk drive is secure. See DISKFILL for a method for overwriting deleted files and unused disk space.

 Caution:  The file format used by FCRYPT was changed on September 22, 1991. If you have files created with the older version, you can decrypt them with FCRYPT0.COM, which is the old version of the program. Please use the current program for new files, since it will be easier for other programs written to the same design specification to read the files.


FTD.COM

Set file time and date

FTD, short for File Time and Date, modifies file time and date stamps without changing the contents of files. There is no equivalent of FTD in DOS, but it is similar to—and a bit easier to use than—touch utilities available on some bulletin boards.

Using FTD is much like using FATTR: you specify a file, with wild cards if you like, along with the new file date and time stamps. This example changes all TXT files to December 24, 1997, at 11:50 pm. Notice that the time is entered in 24-hour format, and midnight through 12:59:59 am is entered as hour 00.

FTD *.TXT 12/24/97 23:50

Note that we didn't enter any command line switches; FTD can tell file names from time and date specifications by the slash or colon or minus sign in time and date stamps. It really doesn't matter what order you enter the arguments; for instance, all of the following do the same thing:

FTD 9/4/97 8:45 *.ASM
FTD *.ASM 09-04-1997 08:45
FTD 9-4-97 *.ASM 8:45

The program is sort-of intelligent. It can tell the difference between times and dates and file names. However, if you enter more than one file name or date or time, FTD will remember only the last one (very short memory).

•	FTD will update all files to the current date if you enter only a name without a time/date stamp (FATTR just shows matching files).

•	You can enter the date without any year and FTD will assume the current year. If you specify only a time or a date, only that field will be changed.


GETKEY.COM

Wait for a keystroke

GETKEY waits for the next keystroke then returns the key code as an error level. Letters "a" through "z" are returned as upper case equivalents (65-90). Nothing is displayed.

GETKEY

•	See also PAUSE95.COM.


I95

System Manager - Information & Configuration

It's not just a diagnostic tool for computer hackers, I95, short for Info95, lets you see how your computer is configured, and helps you easily customize how your HP 95 works for you. Think of I95 as an extension to the HP 95's Setup program.

I95 displays a lot of information on a single screen; the program is designed to show as much useful information as possible, yet keep it readable and understandable.

Reports in the illustration are probably quite unlike how your computer looks. These are not average, or even likely, results.

 Note:  If a test fails, such as a problem reading the disk drive, that portion of the display will be left blank.

Much of the information presented by I95 can change at any moment. In addition, some information takes a bit of skullduggery to determine. You can switch between I95 and other programs, it only takes 5-10K to run, but quitting and restarting will minimize the burden the program places on system resources.

 Tip:  The small version of I95 includes all of the features mentioned below except online help, BIOS date and the country information tests. The larger program is about 8K, while the smaller version needs approximately 4.5K.

BIOS Reports

I95 begins with a couple of bits of information that describe your computer version. Portions of the HP 95 are customized for individual countries. The "BIOS:" information is the revision date of built-in programs in ROM. Just below the double horizontalline, you'll see the country name. The smaller version of I95 does not display these two reports.

We haven't included a function to display the MS-DOS version. This is not important since all HP 95's built so far use version 3.22. Other computers in the HP 95 family may use other versions of MS-DOS; you can check the DOS version by running Filer and selecting System from the menu. At the MS-DOS prompt type the following:

VER

When you're through, type EXIT, and then press ENTER to return to Filer.

 Tip:  With MS-DOS version 5.0 and later, the undocumented VER /R switch offers additional information about DOS. The HP 95 includes MS-DOS 3.22, while the HP 100LX has MS-DOS 5.00. MS-DOS 6.00 began shipping during April, 1993. MS-DOS 7.0 is included in Microsoft Windows 95.

Memory Report

The memory report includes total memory, and the largest block of memory available for built-in applications. I95 lists all memory values as bytes, while the HP 95's Setup program rounds memory to kilobyte boundaries (a kilobyte is 1024 bytes). Setup's "Total Memory" report usually shows the same value as our "mem" report, though ours looks larger because it's in bytes, not kilobytes.

If no other applications are running, the "free" listing will be approximately the amount of memory available for running MS-DOS applications from Filer.

The "free" amount varies, depending on which applications are running. Because Lotus 1-2-3 allocates all free memory, this value will usually be zero while Lotus is running.

You can see how much memory Lotus 1-2-3 has available. While 1-2-3 is running, switch to 1-2-3 and press MENU, then W then S (for Worksheet Status).

Disk Drive Report

This report shows total disk space, the amount already used, and the number of bytes remaining on the built-in C: RAM-disk. The values include files in Read-Only Memory (ROM).

The HP 95 stores files in units of 512 bytes. Each time you add another file, the minimum space it will use is 512 bytes. And whenever files grow beyond another 512 byte boundary, an additional 512 byte block will be allocated to the file. If, for instance you have a Memo file of 500 bytes, then add a few lines amounting to another 100 bytes, the file size shown by Filer will be 600 bytes, while the file will use 1024 bytes of disk space.

 Tip:  There are several files with the WK1 extension, such as _CARLOAN.WKI, in the root directory of the C: RAM-disk. The most common question asked about the HP 95 is: "Can I delete those files?" The answer is, unfortunately, no. But since they're in ROM, these files didn't cost any usable disk space—they just make for an untidy root directory.

Keyboard Repeat Rate

This information includes the amount of time to wait before keys begin to repeat, and how fast keys repeat. Here's a typical report:

Rept .50s/10

The first number is the delay before keys repeat; normally, and as we've shown here, this value is one half second. The second value is the number of times to repeat keystrokes—called typematic rate—per second. The default typematic rate is 10 times per second.

The typematic rate does not affect how many keys you can type in a second; you can type, well, as fast as you can type. The typematic only tells the computer how many times per second to automatically repeat a keystroke while you continue to press the key.

Keyboard Repeat Function

The 95's keyboard delay and typematic rate are adjustable. The delay can be 1-fourth, one-half , three-fourths, or one second. The larger the delay setting, the longer you will have to hold down a key before it begins to repeat. A short delay makes a responsive, though temperamental-feeling, keyboard. A long delay makes the keyboard feel unresponsive, but makes it less likely you'll accidentally repeat keystrokes.

You can set the typematic between 2 and 30 characters per second (in uneven jumps). The larger the typematic setting, the faster keys will repeat. Set the typematic too fast, though, and you'll see a screen-full of characters whenever you hold down a key.

 Note:  If you reboot your computer, the keyboard rates will return to the original, default settings.

Keyboard Repeat Keys

These functions set and test the keyboard repeat rate.

F3	Keyboard delay. This function decreases the delay before keys repeat. Use SHIFT+F3 to increase the delay.

F4	Keyboard repeat. This function key increases the typematic rate. Use SHIFT+F4 to decrease the keyboard rate.

F5	The TestKey function moves a character across the third line of the display.

Once you have set the delay and typematic rates, try them out with the TestKey function. Press and hold down the F5 function key to watch how keys repeat. Notice the time before the character begins to move, and how fast it moves—too fast, and it becomes a blur.

Instead of writing the character as fast as possible, we've added a slight delay to the TestKey function, about what you might expect from a typical application program. If you notice the character continues to repeat, even for an instant, after you liftyour finger from the F5 function key, the key is repeating faster than the computer can handle it.

 The keyboard buffer can hold up to 15 keystrokes. These keystrokes remain in the buffer until the program has a chance to read (or "pop") the keys; if you try to push more than 15 keys into the keyboard buffer, the computer will beep then discard the new keystrokes. With a few programs, setting the keyboard repeat rate too fast can cause the keyboard buffer to overflow. This will cause the computer tolose the extra keystrokes—and the program might have a fit.

 Caution:  Most programs cannot handle excessively fast key repeat rates—especially the fastest setting of 30 CPS. The HP 95 itself occasionally becomes unstable when it tries to handle repeated key presses while the keyboard buffer is already full and beeping.

Timeout Report

After about five minutes of inactivity, the HP 95 will time-out, turning off the display and going to sleep. The Timeout report shows the amount of time that will pass before the computer will nod-off.

Timeout 02:30

Timeout Function

The Timeout function allows you to customize the Timeout setting, in minutes and seconds, up to one hour. As you change the timeout, the display will show the new setting.

F6	Adjusts the timeout forward one minute. Use SHIFT+F6 to adjust the timeout back one minute.

F7	Adjusts timeout forward one second. Use SHIFT+F7 to adjust the timeout back one second.

A value of zero will disable Timeout. Use this setting with care because batteries will quickly drain.

A good compromise is a two-minute Timeout. When you reboot the computer, the Timeout will return to 5 minutes.

 Note:  The display timeout is set in increments of around 1/18 of a second; some programs, such as 95.COM assume 18 clock ticks per second. In reality, the clock ticks about 18.2 times per second. I95 handles round-off errors more accurately, and will show slightly different timeout settings than other programs.

Applications Report

Dominating the right side of the screen, the Applications Report lists programs that are running or suspended.

The report includes program names, status, and keys used to start the programs. Filer requires you to close all active System Manager programs before running MS-DOS applications; information in this report helps you spot which programs are running. It does not show programs that aren't currently running.

Here is a typical application information line:

        I95 activ ALT+I
      Setup susp. Shf+Filer
 Calculator susp. Calc
Hearts&Bone susp. ALT+H

The program names are listed first, right justified. Up to eleven characters of the program name are shown (APNAME.LST allows longer program names). In the middle of each line we have shown the program status; "susp." means you have started the application but it's not currently active. The third column lists keys you press to switch to each program.

 Note:  Only the first eight running applications are shown. The typical HP 95 application requires 20-50K of memory to run, so it's unlikely that you will have more than eight applications running at the same time.

Suspending versus Yielding Applications

There is a distinction between programs that are suspended and those that have yielded. When you switch to a different program without closing the first, the program is tagged as suspended, and the program remains in the queue; this means that when you exit another program, the HP 95 will return to the original program. However, when a program voluntarily yields, theprogram is tagged as suspended, though it is no longer in the queue

Three known programs can be either suspended or yielded: Filer, Setup, and BigTime. Once Filer or Setup have been run once, they never quit, but instead voluntarily yield (availablememory is not reduced when Filer and Setup have yielded). The I95 Applications report does not make a distinction between the two states.

It is possible to tell the difference between suspend and yield: check if the application is in the queue. Unfortunately, there is no guarantee that the location of the queue will remain constant through different revisions of the HP 95, so that feature is not currently implemented in I95.

Communications Port Report

The Comm report displays the current state of the communications port (also called "Serial Port"). The Comm symbol is at the bottom of the screen, just above the function keys.

If the Comm port is on, a star next to the F9 function key reminder appears as "¤Comm", while if the port is off, it looks like " Comm".

Comm Port Function

The I95 Comm function enables or disables the communications port. After starting Filer, switch to I95 then press F9 to disable the serial port, then quit I95 and return to Filer; each time you quit then restart Filer, you'll again have to disable the communications port.

 Tip:  Whenever you run the Filer application, the computer turns-on the serial communications (Comm) port. This is practical if you are connected to another computer to exchange files. If you are in the field, the extra battery drain is unnecessary, so try turning it off.

PrtSc Report

The PrtSc report tells you if the PRTSC key is enabled, or assigned to a do-nothing routine. The symbol is at the bottom of the screen.

If the on-screen F10 key reminder is marked "¤PrtSc" the PRTSC key is enabled; if it looks like " PrtSc" the key is disabled.

If you're adventurous, you've probably just started pressing keys to see what they do. After all, it's an HP computer, you're not going to break the 95 by pressing keys. But a few misplaced keystrokes can cause annoying side effects—like PRTSC (SHIFT+ESC on the HP 95), which immediately takes-over the serial port and tries to print the screen, regardless of if there is a printer on the other end of the serial cable.What usually happens is the computer hangs for several seconds, without any way to recover.

PrtSc Function

You can work-around the problem of accidentally pressing the PRTSC key at the wrong time by disabling the key. When PRTSC is disabled, pressing the key does nothing at all. That's the purpose of this function. The F10 function key is a toggle: If the PRTSC key is active, pressing F10 disables it; if it's disabled, F10 will turn the key back on.

This function only affects the PRTSC key. It does not turn the printer on or off for other programs.

 Note:  Don't use this function if you have installed a driver that takes over the PrtSc function. When this function disables the PRTSC key, it assigns it to a built-in do-nothing routine within the 95's ROM, but when it re-enables the function, it restores it to the default PRTSC handler, not to your custom handler, so your special driver will be ignored.

Battery Gauge

The battery gauge provided by the HP 95 Setup utility is, at best, vague. It shows at most four levels, and once you are past the middle of the gauge, it's low-battery time.

Instead of four, I95's analog gauge shows thirty-six levels; "Full" (all the way up) represents a little over three volts, while "Empty" (all the way down) means about 1.8 volts.

Marks on the line between the battery gauges show full and half-way for main and backup batteries, and lower marks represent time to pull over to the curb and look for a ride.

 Note:  The battery levels shown represent howthe computer reacts to batteries. If you connect the batteries to an external meter, you may see slightly higher levels. The 95.COM program also shows main and backup battery levels as digital values.

The battery gauge is a guideline, not an exact battery meter. Watch this gauge occasionally as a set of batteries ages, and decide for yourself just how low, low is.

 Tip:  When batteries become too weak for the HP 95, they are still at least half-charged. Find another application such as a portable radio to reclaim the rest of the energy—and minimize the burden on our landfills.

Keycode Function

The keycode function shows information about the next key you press. After you press F2, the Keycode function key, the computer will ask you to press a key. Press any key; if the key does nothing, it may not be supported by the HP 95, try another key.

Keycode Report

After you have tried the Keycode function, the second line on the screen will show something like:

320D Ctl+M

The first number is the hexadecimal keycode, in the same format used in APNAME.LST. The first two hexadecimal digits are the scan code, the third and fourth digits are the character the key returns. In the example, the scan code is 32 and the character is 0D; 0D hex is the same as 13 decimal, so this key returns the same character as pressing ENTER.

Keycode will try to identify the key. In the example above, the key was CTRL+M. If you instead press ENTER, the report will change:

1C0D Entr

Notice that the scan code has changed, but the character code is still 0D—both CTRL+M and the ENTER key return character 13.

Here are some more Keycode reports:

7700 Ctr+Home
4700 Home
IE41  A (65)

The primary use for the Keycode report is to decide which hotkey to assign a program to in the APNAME.LST file. Valid hotkeys must begin with two non-zero hex digits, and end with two zero digits. For instance, ALT+A (1E00) is allowed, while CTRL+A (1E01) is not.

 Note:  The Keycode function takes-over the keyboard; pressing a blue key shows the code of that key, it does not change to the application. Other applications will again be available after you press a key. While the keycode function is waiting for a key, the PRTSC key is disabled; it will return to normal after the keystroke.

ASCII Table

The ASCII Table function (F8 function key) pops-up a full-featured hexadecimal/ decimal/ ASCII code conversion table. In the Keycode report we said 0D hexadecimal is the same as 13 decimal; how did we know that? We looked it up in the ASCII Table. Here are a few 4-column lines from the second screen:

@  64 40h|P  80 50h|`  96 60h|p 112 70h
A  65 41h|Q  81 51h|a  97 61h|q 113 71h
B  66 42h|R  82 52h|b  98 62h|r 114 72h

Notice that the low (rightmost) hexadecimal digit at the top of each column is zero, and each subsequent column adds one to the high hex digit, while each line adds one to the low hex digit. Notice, too, the first screen (characters 0-63) is control codes, punctuation and numbers. While a typewriter has the zero key on the right, following the nine key, ASCII character "0" precedes "1"; this is so we can subtract 30h from characters "0" through "9" to turn ASCII digits to binary.

The second screen-full is primarily the letters A-Z and a-z. It clearly shows the relationship between lower- and upper-case characters. For example, "A" plus 20h is "a", while "R" plus 20h is "r". If you page-up to the first screen, you will see that 20h is the space character; in assembly language programming we often add a space to a letter to make it upper case (or sometimes AND it with NOT 20h).

 Tip:  The AscTable program is a more sophisticated pop-up number conversion program.

I95 Key Assignments

Key	Purpose

ESC	Quit. Also Q key.

F1	Display help screens.

F2	Check keycode. After you press F2, I95 will wait for you to press another key.

F3	Adjust keyboard delay. That is the time the computer waits before repeating keystrokes.

SHIFT+F3	Adjust keyboard delay down.

F4	Adjust keyboard repeat rate. That is the number of times a key will repeat per second while held down.

SHIFT+F4	Adjust keyboard repeat rate down.

F5	Test keyboard repeat rate. Hold down F5 and watch how quickly a box character moves across the screen.

F6	Adjust timeout—the number of minutes before the HP 95 will turn off the display and go to sleep—forward one minute.

SHIFT+F6	Adjust timeout back one minute.

F7	Adjust timeout forward one second.

SHIFT+F7	Adjust timeout backward one second.

F8	Displays the complete ASCII/Hexadecimal/decimal table. Press UP or DOWN to move through the list, ESC to return to I95.

F9	Toggle the communications port (serial port) on or off. A "¤" next to the function key reminder means the communications port is on.

F10	Toggle the PRTSC key on or off. A "¤" next to the F10 function key reminder means the PRTSC key is enabled.


INTR.COM

Check interrupt vector information

INTR displays a multi-column table of the segment and offset for interrupt vectors. Often this is just a curiosity, you will know when you need it.

INTR

All of the numbers the program displays are hexadecimal. The first number in each column is the interrupt number. Following are the segment, a colon, and the offset within that segment where the interrupt vector lives. An "r" following the interrupt vector means the interrupt points to a simple do-nothing instruction (an IRET instruction). Here are some typical interrupts:

00=0234:56EA
01=0070:075Cr

The second line in the example ends with "r" to signify an IRET. If you have run the PRTSC function of 95.COM to disable the PRTSC key, you will also notice an "r" next to interrupt 05. Run 95.COM again to turn PRTSC on, and the "r" will disappear.

You can also tell INTR which interrupt vectors to display. Include a hex number in the range of 0 through FF, and INTR will begin the list at that value. This example will show interrupts beginning at 97:

INTR 97

You might run INTR, then load a RAM-resident program, then run INTR again to see how the table changes. Borland SideKick 1.56, for example, hooks interrupts 08, 09, 10, 13, 16, 1C, 21, 25, 26 and 28. Usurping interrupt 08 means that SideKick snags control of your computer 18.2 times per second—whether it's active or sitting quietly in the background!

Try using INTR is to find an address of an interrupt vector, then run DEBUG and look at the code executed by the interrupt.

When installing a mouse—on your desktop PC, you might also be installing a serial port or network adapter—note how these interrupt numbers map to the IRQ hardware interrupts. This explains the mess involved installing a bus mouse, internal modem, and network card at the same time. The MS-DOS Encyclopedia (from Microsoft Press) explains these conflicting interrupts. Here is a cross-reference between interrupt and HP 95 IRQs:

IRQ	Int	IRQ Meaning	Interrupt Meaning

0	08	Timer	286 Double fault.

1	09	Keyboard	286 Segment overrun.

2	0A	Miscellaneous	EGA retrace.

3	0B	Kbd/touch panel	COM2

4	0C	UART	COM1, 286 Stack overrun.

5	0D	Infrared	Fixed disk, LPT2.

6	0E	Disk	Floppy disk.

7	0F	RTC (LPT1)	LPT1.


MEM.COM

Show memory information

MEM displays available system memory, excluding memory used as a RAM disk. It is similar to MEM.EXE, furnished with DOS 4.0 and later. Use MEM instead of CHKDSK.EXE when you just want to see memory information. Here is a typical MEM report:

  1,024 K EMS memory
    768 K EMS available
458,752 bytes main memory
 86,016 bytes used
372,736 bytes available

MEM displays main (conventional) memory and EMS memory (bank-switched, Expanded Memory Specification). If no EMS is available, the report will include only conventional memory. The HP 95LX currently supports only conventional memory—but we're prepared.

MEM returns an error level representing memory. Less than 100K available is returned as 0, less than 200K is 1, and so forth.


MOUSEFIX.COM

Reset the mouse driver

This program does a hard-reset of the mouse driver. If your mouse acts strangely with some programs, try running MOUSEFIX before starting the program. If there is no mouse driver, this program does nothing.

MOUSEFIX

If you run a program that runs in 50 line mode and supports a mouse, then switch to another that runs in 25 lines but doesn't reset the mouse driver, the mouse cursor can run off the bottom of the screen, and may generally be difficult to control. One program with this problem is Norton's Commander.


NOW.COM

Display current time and date

This program displays the current time and date. It is usually used with output redirection for logging system or program activity. Enter the command or select the program name from Filer:

NOW

The program displays the time and date in the format:

20:45:00, Sep 04-92

You can redirect the result to a file to time-stamp your work, or just show the time every now and again. Be sure to use >> to append the result to the end of the log file; if you accidentally use a single > character, it will overwrite the file.

NOW >> WORK.LOG


PAUSE95.COM

Low-power PAUSE replacement

PAUSE95 works like DOS' PAUSE command, but it's customized for the HP 95, and may extend battery life. Use it just like PAUSE:

PAUSE95

You can suppress the "Press any key to continue. . ." prompt by redirecting it to the null device:

PAUSE95 > NUL

We have included a second version, called PAUSE2.COM, just for fun.

•	To save disk space, try the WAIT function in 95.COM instead of this program. See also GETKEY.COM.


PCINFO.EXE

Computer configuration information

This program looks at your computer the same way many sophisticated application programs do (though in a bit more detail), and describes the computer in a formatted report. PCINFO is designed to run on most PC-compatibles; it runs just fine on the HP 95LX, a testament to the compatibility of the 95, but you will get more HP 95 information from 95.COM.

If some programs are acting odd, run PCINFO and note any inconsistencies between what it says and what your computer is supposed to look like. When a program or piece of hardware fails to work as it should, run PCINFO before you call your dealer. Run the program simply by entering the name at the DOS prompt:

PCINFO

Much of the information PCINFO displays is about disk drives. You can specify which disk drive to check after the program name:

PCINFO C:

If the drive you specify isn't available, or if you don't specify a disk drive letter, PCINFO displays information about the current drive. Unless otherwise listed, all values are reported in bytes. Here is a typical report from PCINFO; click on the number at beginning of a line for a description of the report.

 1  CPU family:               80286        12:15 am Thu, Sep  4 1997
 2  No Math coprocessor reported, no coprocessor available
 3  BIOS identification:        252   09/28/88; PC/AT
 4  Video type:                  80 by 25, color text
 5   Active display:            256K EGA color
 6   Current video mode:          3   80 by 25, color text
 7  Memory:                 655,360   available:             568,336
 8   Environment:               304   available:                  46
 9   EMS expanded (3.2):    786,432      48 pgs; avail:      786,432
10   XMS manager installed            Extended memory:       327,680
11  Logical drives:               5   floppy drives:               2
12  Disk drives found:     A: B: C:
13  Drive C: type:              248   fixed disk, 16-bit File Alloc.
14   Disk space:         31,827,968   available:           8,398,848
15   Bytes per sector:          512   sectors per cluster:         4
16   Bytes per cluster:       2,048   total clusters:         15,541
17  2 button mouse version:    6.10   IRQ 5; interface:       InPort
18  Serial port(s):               1
19  Printer port(s):              2; LPT1 not ready; LPT2 ready

1) CPU family, time and date

An 8088 or NEC V-20 is in the 8086 family, while the 80386SX is in the 80386 family. The time and date are on the right.

2) Math coprocessor installed

This test asks the BIOS if there is a math coprocessor (80x87) installed. It then checks for an operating coprocessor. If both tests don't agree, it is likely that the computer is configured incorrectly, and either a motherboard switch is set wrong or the computer setup program needs to be run again.

3) BIOS identification:

This reports the ID byte of the ROM BIOS and what many programs assume the byte means. If it says that your computer is a PC/XT when it is actually an 80286 machine, you might mention the anomaly to the computer manufacturer. It does not check the actual copyright notice in the ROM, since applications should not be expected to look there. If a ROM date is found (not all manufacturers include it), it's also shown.

4-6) Video type

These lines describe your video display. This is a none-too-snoopy search, a bit more than the average application program can be expected to do. When there is any doubt, PCINFO will call it a CGA card.

7) Main memory

This is the amount of conventional memory the computer tells applications to expect to find. The second value is available memory after loading DOS and any resident programs. This is similar to the CHKDSK memory report.

8) Environment, available

Whenever you use "COMSPEC=" or "PATH=", DOS stores it in a common memory-pool called the environment. If the environment is small, some programs may have trouble running. With MS-DOS 3.3 or later you can change the environment size in CONFIG.SYS; try something like:

SHELL C:\COMMAND.COM /E:384 /P

Running PCINFO from another program instead of from DOS will report available environment space inaccurately. The HP 95 will usually show zero space, though you can still dynamically allocate environment variables.

9) Expanded memory

This test looks for an EMS controller program. It doesn't snoop around if there is no expanded memory manager. The usual page size is 16K bytes, so available memory is listed as pages*16384.

10) Extended memory

This is AT memory, found only on 80286 or later processors. The 8086 can only recognize up to 1 megabyte of memory, extended memory lives beyond that 1 megabyte wall.

There are several (mostly incompatible) ways programs use extended memory. Some programs simply use the memory without leaving any indication (if you are using a program like this, available extended memory won't account for what the program uses). Other programs attempt to fool the computer into believing there is less available memory than there really is (they then take control of the hidden memory).

We now have XMS memory managers, which work something like EMS, mediating requests for extended memory and minimizing conflicts. If your computer uses an XMS memory manager (such as Microsoft's HIMEM.SYS), the report will include "XMS manager installed." The size will be decreased by the amount of memory reserved by the driver (usually 64K) and by any programs already using XMS memory.

11) Logical drives reported, Floppy drives
12) Disk drives found

DOS usually reports five "Logical drives" to programs, regardless of the number of physical drives there really are, which explains why you can't always blame programs if they need help to figure out which drives to use. "Floppy drives" is the number of floppies the computer reports.

The third value is the number of logical drives the program has found while (politely) looking around. Many people assume that if they find drive F, all drives from A through F exist. This is not always the case; you may find logical drive Z in a computer with only two or three physical drives.

13) Drive C: type

This is how DOS identifies disks to itself. The first number (248 in the example) is the media ID byte, followed by an interpretation of that byte. If it is a fixed- or RAM-disk, we will also tell you if it has 12-bit or 16-bit File Allocation Tables; A 16-bit FAT indicates the potential to use large disks.

14) Disk space

Shows, in number of bytes, the size of the disk and the amount available. If it is a new disk without anything on it, a discrepancy between these numbers means that there are hidden files or bad sectors; use CHKDSK to be sure.

15-16) Bytes per sector, Bytes per cluster

The sector is the smallest physical storage space on a disk. We multiply sector size by sectors per cluster to find bytes per cluster; in the example, it is 512*4=2048. This is important if you have many small files on the disk, since disk space is allocated by clusters, and even the smallest files occupy at least one cluster, even if they are only a few bytes long.

The HP 95 stores files in 512 byte units; about as efficient as you can get. Early versions of DOS require as much as 8K minimum per cluster, which can waste a lot of disk space. This is a good enough reason to use newer version of DOS on your desktop PC, though it will require you to reformat your hard disk. Each DOS version seems to format hard disks a bit differently, so it's usually best to reformat when you upgrade DOS—DOS 5.0 can usually be installed without reformatting your hard disk (finally!). Newer DOSes can read and write floppy disks written by older DOS versions, though low density drives often have trouble reading low density disks formatted in high density drives.

17) Mouse information

If your computer has a Microsoft-compatible mouse and you have run MOUSE.COM (or included DEVICE=MOUSE.SYS in CONFIG.SYS), this line displays information about the mouse and mouse driver. It may show odd information if your mouse isn't Microsoft compatible. The IRQ number can be helpful when diagnosing conflicts between a bus mouse and serial ports. In the example the mouse driver version is 6.10, this is the earliest version that most newer programs will support. Microsoft mouse drivers 8.2-11 are in some release. Version 8.0 was updated for the Microsoft BallPoint pointing device. Windows 95 emulates mouse version 8.3.

18) Serial port(s)

Shows how many serial ports or modems are installed. It does not differentiate between the wired and infrared ports on the HP 95.

19) Printer port(s)

Shows how many printer ports are installed. PCINFO then tests each port and tells you which are ready to print.


PCX.COM, PCXS.COM

Display PCX graphics. HP 95 Only

These programs display PCX graphics files. Used with GETKEY, WAIT and PLAY, you can create graphics demonstrations. Picture files must be 240x128 pixels, one color plane, the format as the HP 95 business card.

PCX C:\_SYS\1000.PCX

If the file is not found, no error message is displayed; the program just returns an error level. If there was an error while reading the file, the screen will be cleared.

There are two similar programs: PCX.COM and PCXS.COM. The first program, PCX, displays the graphics image and waits for a keystroke, then clears the screen and returns to text mode. The PCXS program, on the other hand, displays the picture then exits, leaving the graphics image on the screen.

•	To return to text mode, run the TEXTMODE program or display another file with PCX.


PCXINFO.COM

Information about PCX graphic image

How do you tell what kind of a PCX file it is without loading it into a file viewer? Ask PCXINFO to display information about the file:

PCXINFO *.PCX

You can use PCXINFO to ensure that graphics files are compatible with the HP 95. For HP 95 compatibility, PCX files must be 240x128 pixels, one color.


PLAY.COM

Play music. HP 95 or PC

The PLAY program plays a series of tones through the HP 95's speaker. You can specify a series of notes on the command line, redirect a file to the program, or enter notes interactively.

PLAY

The program will ask you to enter notes to play. At the "play:" prompt, enter frequency (37-5000Hz) followed by duration in 1/18th seconds (2-100). You can include one or more notes on the line. For reading ease, separate the frequency and duration by a comma, period or colon. When you're done playing, press CTRL+C, or press ENTER on a blank line.

If you like, you can enter the notes on the command line when you run the program. This example plays four notes:

PLAY 300,4 400,4 600,4 880,4

You can also use redirection to give PLAY a file to interpret. This example plays BACH.TXT, a sample file included with this package.

PLAY < BACH.TXT

If you include a command line full of data and also redirect a file (it could happen!), PLAY will play-back the command line before the file. Redirection is always required for reading a file because the command line is reserved for entering notes directly. This example plays an 880 Hz note then pauses for one half second then reads TUNES.TXT:

PLAY 880,5 0,9 < TUNES.TXT

PLAY really isn't very picky about line format. You can enter a single note per line, or stuff as much on one line as you like. Also, any character with ASCII code 47 or below (including, but not limited to: /-.,+#!) is ignored, so you can use any comfortable delimiter characters. The tune will end if PLAY finds an unrecognized delimiter, unmatched frequency and duration, or the letters A-Z.

•	The redirected file can be up to 8K long, with any number of notes on each line. PLAY needs only a space to separate notes, though you can place notes on separate lines.

•	If a simpler, four-note beep will do, you could use BEEP.COM. Or use ECHO with the bell character. Type ECHO, then a space, then press CTRL+G (the display will show "ECHO ^G").

•	If you specify a frequency below 37Hz, no sound will be emitted, but the program will pause for the specified duration.

•	PLAY.COM runs on the HP 95 and on most PC-compatible computers. It may not run on less-than-compatible computers.

•	When you've created a tune you would like to share with others, try making a COM file version. See the discussion of BEEP.ASM.


RANDWORD.COM

Create random passwords

RANDWORD displays a multi-column list of 8-character random words. Each word contains letters a-z, with common letters appearing more frequently, in a pseudo-random sequence. This program is useful for creating passwords and encryption keys that are not easily guessed. Type the program name or select RANDWORD.COM from Filer:

RANDWORD

Passwords that have personal meanings (like your mother's maiden name) are convenient and easy to remember, but they are also easy to guess. A random password—if you can remember it—adds an extra level of security.


REBOOT.COM

Reset the computer

REBOOT resets the computer, much like pressing CTRL+ALT+DEL. It does not affect the contents RAM disks. When you execute REBOOT, the computer immediately resets—no confirmation, no protection.

REBOOT

REBOOT is useful if you sometimes run the programs in ROM, but at other times want extra memory available to run DOS applications.

•	See Making Room for DOS for more information. The BOOT function is also available in 95.COM.


RENMOVE.COM

Rename a file or sub-directory

RENMOVE works like DOS' RENAME (REN) to rename a file. With DOS 3.0 or later (including 3.22 on the HP 95), RENMOVE can also rename sub-directories. Separate the old and new names with a space:

RENMOVE OLDNAME.DOC NEWNAME.DOC

RENMOVE can also move a file to another directory on the same disk drive. It simply moves the directory entry to the new directory, the file isn't changed.RENMOVE to cannot move a file to another disk drive.


SEROFF.COM

Turn off serial port. HP 95 only

This little program turns the serial port off to extend battery life.

SEROFF

•	The SEROFF function is also available in 95.COM.


SHOWKEYS.COM

Display keystroke information

This program displays scan and character codes, as well as characters, for each key you press. SHOWKEYS is useful for deciding which key assignments to use for HP 95 System Manager compliant programs. PressESC to quit.

SHOWKEYS

Press CTRL+UP and SHOWKEYS will display:

 c   8D00h, chr 000

The "c" means the CTRL key was pressed. The first two digits of the hexadecimal number are the scan code (8D), followed by the character code (00); the "h" reminds us that the number is hex. The program also displays the character code in decimal and, if appropriate, as a character. Now try SHIFT+CTRL+UP:

 cs  8400h, chr 000

The "s" means the SHIFT key was pressed, and the scan code changed to 84 hex. Since it's a special key, the character code is zero. Here are the possible combinations returned by the H key:

     2368h, chr 104 h
  s  2348h, chr 072 H
 c   2308h, chr 008
   a 2300h, chr 000
$    23BEh, chr 190 ¥

The last combination, 23BEh, came from pressing CHAR+H. Notice that the line begins with "$" to signify the CHAR key. The CHAR key is unique to the HP 95, so it won't be displayed on other computers.

Use the four-digit hexadecimal number as key assignments for HP 95 System Manager compliant programs, such as the EXMversion of TigerFox or Hearts&Bones (these are in the hidden _SYS directory on your HP 95). Most keystrokes that return zero character codes—such as ALT+H—can be used as program hotkeys. The HP 95 generally won't allow you to assign programs to keys that return characters (like CHAR+H), and it's a good idea to avoid keycodes that are already assigned to important jobs.

•	SHOWKEYS reads keystrokes through the BIOS, so input redirection and external keyboards (installed with DOS' CTTY command) are ignored.

•	You can use the hexadecimal number to assign programs to hotkeys in the APNAME.LST file. See Explorer's Guide to the HP 95 for more information about assigning programs to keys.


SIFT.COM, SIFTHIGH, SIFTI, SIFTWS
SIFT.COM, SIFTHIGH.COM, SIFTI.COM, SIFTWS.COM

Text file filters

These are filters. That is, they sift-out or modify unprintable characters from a file, and display what's left; the original file is not changed. There are four variations on this theme:

•	SIFT is useful for sending a file to the display or printer without extraneous characters scrambling the view; it ignores all unprintable characters, turns tabs (ASCII 9) into a single space, carriage returns (13) or vertical tabs (11) are turned into carriage return/line feed.

•	SIFTHIGH translates all high-order characters (those above 126) to displayable characters. Line drawing characters become "|+-" characters and foreign characters are Americanized.

•	SIFTI is the international version of SIFT; it also recognizes foreign language characters.

•	SIFTWS maps all characters above 127 to the value minus 127. This is useful for viewing files written with programs like WordStar that use these characters for special purposes.

So how do you decide which program to use? You could try each one and see which does a better job, but there are some general guidelines: If it is a program file (COM or EXE extension), you will probably get the most useful information from SIFT. If it's a WordStar file, use SIFTWS. For non-English text files, try SIFTI. SIFTHIGH is used less frequently because it returns lots of garbage characters; if you know the file has foreign language or box drawing characters that your printer can't handle, try SIFTHIGH.

SIFT is probably the most useful of these four utilities, so we will use it in the examples, though all four work exactly the same. To look at a file, simply enter the file name on the command line. For example, to look at RANDWORD.COM, use the following:

SIFT RANDWORD.COM

This will show the text from the file without any of the garbage characters. To pause the display, press CTRL+S, then any key to continue, or press CTRL+C to stop the program.

The SIFT utilities are often used with redirection. Use the "<" redirection symbol to point a file at SIFT:

SIFT < RANDWORD.COM

You can redirect in the other direction at the same time. This example takes README.TXT and redirects the sifted output to the printer:

SIFT < README.TXT > PRN

This says to DOS: "Send the contents of the file README.TXT to SIFT.COM, and send whatever SIFT returns to my printer." The original file, README.TXT, is not changed in any way. And, since SIFT does not require input redirection, you can make the above look a bit less confusing:

SIFT README.TXT > PRN

You can do the same kind of thing by sending the contents of one file through SIFT into a new file, thus removing the garbage characters. Since the ">>" redirection symbol appends to the end of a file, you can use SIFT to add several files together. Simply run SIFT again for each file, using ">>". This example uses ">" to create the file, then ">>" to append files to the end. When you are done, you will have created a forth file, OUTPUT.TXT, with the tidied-up text from the three original files.

SIFT < FILEA.TXT > OUTPUT.TXT
SIFT < FILEB.TXT >> OUTPUT.TXT
SIFT < FILEC.TXT >> OUTPUT.TXT

You can also use SIFT with piping. The piping symbol is "|". That is, if another program supports output redirection and you aren't sure that your printer can handle the characters, send it through SIFT. While RANDWORD.COM is polite and only uses printable characters, let's assume here that it isn't, and you want to send the output to the printer:

RANDWORD | SIFT > PRN

Finally, you can use SIFT without specifying a file name (such as from the HP 95 Filer). It will stop and ask you to enter the name.

•	For other ways to filter files, try TMORE.COM and TTYPE.COM.


SLEEP.COM

Put the computer to sleep. HP 95 only

SLEEP turns the computer off.

SLEEP

When you press the ON key, the computer continues from exactly where it left-off. If you were running a batch file, the next line in the file will be read. This program runs only on the HP 95.

•	The sleep function is also available in 95.COM


SP

System Manager - Spelling Checker

SP is a spelling checker, among other duties:

•	Check the spelling of a single word—it's a quick reference (or cheat sheet). SP shows a screen-full of similar words.

•	Check spelling of data in the clipboard or a file.

•	Check for repeated words.

•	Count characters, words, sentences and paragraphs.

•	Copy a file to the clipboard or copy the contents of the clipboard to a file.

SP is the only program in this package that requires menus and edit boxes. Menus work the same as other HP 95 applications. Where practical, we also offer function key alternatives to menus.

We often use SP as a quick reminder of similar words or to check a troublesome word. To use the program for a quick check, press the SP hotkey, then press the F7 function key. SP will show the "Lookup" prompt; the cursor is on the previous word you checked:

Lookup
:hewlett_

Now type your word; try, for instance, "Chart," then press ENTER. SP will then check its word list, and display a list of similar words:

SP shows a three-column list, with as many as 33 similar words, alphabetized from left to right, according to word length. The more common the word sounds, the longer the word list will be; truly unique words may result in a very short list. A few words (usually, 6-character words beginning with a common letter like S), may have more similiar words than can fit on the screen.

Even if you had accidentally typed "Chort" instead of "Chart," SP would still show a list of similar words. It works by looking-up the word as-is. If the word isn't found, it will follow English spelling rules and check for a shorter word within your original word. Regardless of whether or not SP finds your word, it will still search the list for similar sounding words.

To check the spelling of a file, load the file into the SP buffer, then copy it backto the file when you're through. It is not necessary to save the text to the same file. Checking the clipboard works the same: copy the text from the clipboard, check the spelling, then copy it back to the clipboard.

 Note:  SP requires a considerable amount of memory while running. If your HP Palmtop has only 512K of memory, you probably won't be able to run Lotus 1-2-3 and SP at the same time. If the computer complains about insufficient memory to run SP, quit larger applications then try again.

The Three Spelling Checkers

One rule of computing is that regardless of how much storage space we have, somehow we really need just a bit more. While we'd all like to have instant access to everything, it's not always practical. That's why we have included three versions of the spelling checker.

SP	Uses the complete word list. Includes technical words and online help. At over 64K, not everyone will have the necessary storage space.

SPM	Uses the medium word list. Excludes many obscure and technical words (most of which are quite long). Does not have online help. For everyday correspondence.

SPS	Uses the tiny word list. Includes only words used in day-to-day writing. Try SPS when you're strapped for disk space.

 Tip:  It is only necessary to copy one version of the spelling checker to your HP 95 LX. Be sure to keep all of the original files on the master distribution disk.

The Spelling Checker Dictionary

HP 95 System Manager programs are restricted to 64K for program code and another 64K for data. Most spelling checker programs are over 100K, plus another 130-300K for the separate dictionary. Clearly a different approach was necessary to make it fit comfortably in the HP 95.

Creating a spelling checker is a black art. After all, do we eschew colloquialisms, or do we just trash street lingo? Our spelling checker and dictionary are unique, designed exclusively for this product. The goal was to create a compact, fast, intelligent spelling engine.

While we're all erudite, literate and sophisticated, a list of just 100 unique words accounts for about 44% of our writing. As we increase the number of words in our list, the "Hit rate" does not increase proportionally—after a few thousand words, laws of diminishing returns work against us, to fill our disks with words we'll never use. At the same time, many words we do use will never make it into any disk-based word list, no matter how complete it appears to be.

The task, then, is to carefully select core words that we actually use in modern writing. Thenaugment that with professional terms and words that nobody can spell. The dictionary we're using is the result of hundreds of hours spent scouring a variety of sources:

•	Several million words from letters, online help, and other computer-based text.

•	1000 most commonly used words.

•	100 most commonly misspelled words.

•	Science, nature, geography, business, computer and technical terms.

•	The daily newspaper and Ted Turner's Cable News Network.

•	Printed and on-line reference works.

The result is a modern dictionary that knows words you may not find in much larger dictionaries. But at the same time, it probably doesn't know your name (unless you have the same name as a former U.S. President or a country—say Dr. Milhous Zaire).

Making the word list fit resulted in a few compromises. Proper nouns, medical and geology terms were reduced to make room for general terms. It knows Nikon, but it doesn't know Hernia;  if you have both, it's more likely you will write about your Nikon.

Your Custom Dictionary

Thespelling checker is as modern as possible, though some omissions are inevitable. That's why SP gives you the option to create your own custom dictionary. When the program can't find a word in its own list, it will check yours, in a file named C:\_DAT\WORDLIST.TXT.

WORDLIST.TXT is a standard text file you can edit with the 95's Memo program—you don't have to, though, SP will maintain it for you automatically. SP adds only a space between words, so it will word-wrap when you edit the file with Memo. In Memo,you can press ENTER at the end of each line, though it takes two characters instead of one (ENTER translates to a carriage return, followed by a line feed character). The file is limited to 2K (2048) bytes, and SP will ignore anything beyond 2K. Words in this list are usually quite long, so figure about 200 words as the maximum length.

SP is not case-sensitive in its word search; Conte, CONTE and conté all look the same. It is not necessary to add all capitalization variations to your word list.

If you've created your custom word list while using the smaller spelling checker, some of those words may be in the larger list. There is no harm in having two copies of the same word—the program will find the word from the main list anyway—but if the list is extensive, it may cost some disk space.

The Spelling Checker Engine

In theory, there are about 1.6 variations of each word, created by tacking-on a suffix (such as ing or est) or a prefix. In practice, the number is much greater. After all, Classify, Classification, and Classes all begin with Class. If a spelling checker understands these relationships, and maybe even knows a few spelling rules, it can step beyond limits of a word list—seeing relationships like Classiest Classwoman, or even Classist. With this flexibility, instead of 1.6, we now have several variations for each word.

In many cases, SP can tell if a word it doesn't know is correctly spelled. In effect, it's a mini-expert system that greatly extends the flexibility of the word list.

The dictionary is compressed—you can't inspect it with a file viewer, since characters are not aligned on byte-boundaries. To search for a word, the program compresses the word into the same format used in the dictionary, then uses a sophisticated pattern search just on related words. If it doesn't find the word, it follows a few hundred spelling rules to find the next shorter word, then compresses the new word and searches the word list again. This process can take several iterations for long, complex words, though it'sstill fast, at about 5000 iterations per second on an HP 95.

To create a list of similar words, SP creates a sound pattern from the original word. It then decompresses each similar word from the dictionary, and compares the sound patterns.

Stat Function

The statistics function (the F10 function key) displays information about the file you're checking. Here is a typical report:

MEMO.TXT
Bytes   24171
Chars   18726
Words    3510
Sent.     156
Paras     566

The "Chars" value is the number of non-blank characters in the buffer. Next are the number of words, sentences and paragraphs. The "Paras" report counts the number of carriage return characters, since modern editors (like the 95's Memo program) automatically word-wrap, adding a carriage return only at the end of paragraphs, instead of at the end of each line.

Note that the on-disk size will be slightly larger than the number of bytes listed. This is because the clipboard, and our in-memory copy of your file, will have a carriage return character on the end of each line, while the disk-file will have a carriage return and a linefeed.

SP Limits

SP can read text from the clipboard or a file. Here are the limits:

Source	Size	Words

Clipboard	8000	1300

Text File	40960	6000

WORDLIST.TXT	2048	250

 Note:  The clipboard cannot hold as much information as a text file. Be sure that if you copy a file to the clipboard, it fits.

SP Key Assignments

Key	Purpose

ESC	Quit.

F1	Display online help.

F2	Copy the edit buffer to the HP 95's clipboard.

F3	Clear the clipboard.

F4	Paste the contents of the clipboard into the spelling checker edit buffer.

F5	Load a file from disk into the edit buffer.

F6	Save the edit buffer to a file.

F7	Lookup a single word. Show a list of similar words.

F9	Begin or continue checking.

SHIFT+F9	Re-start checking from the beginning.

F10	Statistics. Shows word, sentence, and paragraph totals for the contents of the edit buffer.

Capitalization Guidelines

When replacing misspelled words, SP attempts to match the original capitalization. This won't always work, and the program cannot identify misapplied capitalization. As you type, keep these suggestions in mind:

•	The first word in a sentence or quotation. The first word of each line of a poem.

•	Days, weeks, months, holidays.

•	Proper names of people, nationalities, races, languages, organizations, historical events.

•	Geography. Not south, but South America.  Including mountains, lakes, rivers, and oceans.

•	Well known or formally named things. Such as ships, airplanes and the pet name for your computer. Anything used as a formal name. Including product names and trademarks.

•	Titles, but not generic use of title terms: President Lincoln, or the President,  but not a president. Titles of books, magazines, newspapers: "The Hitchhiker's Guide to the Galaxy."

•	Abbreviations and acronyms. Such as CPU.


TEXTMODE.COM

Return to text mode. HP 95 only

This program restores text mode after a graphics program (like PCXS) has left the computer in graphics mode. It clears the screen and restores the cursor to normal shape and places it in the upper-left corner of the screen. TEXTMODE is a simple replacement for MODE.COM, furnished with most versions of DOS.

TEXTMODE


TMORE.COM

Display text one screen at a time

This utility will display any file. When it reaches a screen-ful, it will display "More", asking you to press a key to continue. See the similar program TTYPE for more information.

A simpler program, MORE.COM, is often included with DOS. MORE is traditionally used as a pipe from another program; you might display a file a page at a time by piping it through MORE:

TYPE README.TXT | MORE

You can do it that way with TMORE, or just enter the name directly:

TMORE README.TXT

If you are using batch files written for other PC-compatibles, you can rename TMORE.COM to MORE.COM for compatibility. There are a few differences between this program and DOS' MORE:

•	Each version of MORE will only work with its DOS version.

•	If you execute MORE.COM without a program name it will hang until you press CTRL+C. TMORE will ask you for a file name.

•	MORE expands tabs to 8 places, but not if you redirect output.

•	The bell character (ASCII 7) makes the computer beep with MORE; TMORE ignores the bell and other undisplayable characters.

•	MORE stops when it finds an end of file marker (ASCII 26).

•	TMORE erases the "-More-" prompt; DOS' leaves it there.


TTYPE.COM

Display a text file; TYPE replacement

TTYPE is a convenient way to display files on the HP 95's 40-column screen. DOS' TYPE displays text in 80-columns, even on the HP 95. TTYPE—as well as the similar TMORE—wraps text at 39-columns on the HP 95, expands tabs with spaces, and strips-out undisplayable characters.

Unlike TYPE, TTYPE works with or without redirection:

TTYPE README.TXT
TTYPE < README.TXT

Normally tab stops are at eight character positions, but the slash switch lets you adjust tab stops to any value you like. This example displays the README.TXT formatted with 4-space tab stops:

TTYPE /4 README.TXT

•	Use TTYPE instead of TYPE to display any file without annoying garbage characters. For more specialized filters, try SIFT.

•	TTYPE always expands tabs with spaces so text lines up at even 8-character positions. You can use a slash followed by a number to change the formatting of tab stops.


UNCOMMON.COM

Create a DEBUG script

Short for UNassemble COM to MONitor, UNCOMMON translates a COM file into a script compatible with DEBUG.EXE. It also displays the file size and a checksum in hex (DEBUG does everything in hex).

The command line looks something like:

UNCOMMON COMMAND.COM > COMMAND.SCR

The program displays the script with ten bytes per line, formatted for a 40-column display; you can use output redirection, as shown above, to save the information in a file.

UNCOMMON can convert any file up to 64K, not just COM files. Remember that the output will be three times larger than the original. For instance, you could create a DEBUG script from TOPCARD.PCX.

If you transfer programs using X-Modem protocol with the HP 95's Comm program, files will be padded with end of file markers (ASCII 26) or null bytes (ASCII 0) to even 128-byte boundaries. This will make subsequent checksums and file sizes different from those listed in this book, though it will not affect how programs run—if they ran the first time, padding the end of files will not change anything.


WAIT.COM

Wait for a keystroke or amount of time

This program waits for a keystroke or for a period of time to pass. WAIT is useful when you are displaying a series of screens and want the process to continue unattended if necessary. Specify a number of ticks to pause (a tick is approximately 1/18 second). This example will pause for two seconds:

WAIT 36

The delay will be canceled if the user presses a key.

•	If you need to delay until the user presses a key, without any time-out period, use DOS' internal PAUSE command (or PAUSE95). 95.COM also contains the WAIT function.


WAITKEY.COM

Wait for a keystroke

This PAUSE replacement ignores “garbage” keystrokes, interprets turns function keys into numbers 0-9 and upper cases letters. The codes are returned as an ERRORLEVEL.

ECHO Press A,B or C
WAITKEY


WHEREAMI.COM

Display drive letter and current path

Some MS–DOS programs are inconsiderate, they’ll leave the cursor an odd size, strange display colors, or worse yet, they may leave us logged-onto a directory where we never go. WHEREAMI can help with one of these problems by displaying the current drive and path:

WHEREAMI

On the HP 95, WHEREAMI will often show these two lines.

C:
CD \_DAT

This looks just like the commands you would enter to return to where you started. You can use WHEREAMI in a batch file to create another batch file using output redirection with those two commands, then run your wandering program, then execute the batch file restoring the path.

WHEREAMI > GOHOME.BAT
ANYPROG
GOHOME

Now, when the program ANYPROG ends, the batch file will pass control to GOHOME.BAT, which will return you to where you started.


WINK.COM

Large cursor TSR

The HP 95's display is legible and sharp—under most conditions. Face it, though, the cursor is sometimes difficult to find. This Terminate and Stay Resident (TSR) program beefs-up the one- or two-scan line cursor to a large flashing block. WINK works transparently, intercepting attempts to set a skimpy-little cursor, but it will not stop programs from hiding the cursor when it could be a distraction.

Run WINK only once, whenever you boot your computer:

WINK

WINK uses a square block cursor, not quite full-size, which is quite legible on the HP 95. It's also appropriate for programs that alternate between underline and full block cursors. You can customize the beginning line of WINK's cursor to create a big block (0) or a skinny line (7), or anywhere between; this example sets a full-size cursor:

WINK 0

Some cursor utilities cause a double-blinking cursor: a flashing underline, followed by a solid block. The cursor flashes even when it's supposedly hidden. There is also a slight performance penalty because they gain control of the computer at each clock tick. Finally, ALT+Cursor key tracking works sporadically, if at all. WINK tries to transparently overcome these issues.

•	If you are using HP 95 Application Programming Interface programs, you will notice that the hotkeys no longer work after you load any TSR. If this is a problem, use WINK.SYS.

•	You cannot load WINK.COM from your CONFIG.SYS, you must instead use WINK.SYS, the device driver version.

•	In any case, you will probably find  WINK.SYS more useful than WINK.COM.


WINK.SYS

Large cursor device driver. HP 95 Only

WINK.SYS is a device driver version of WINK.COM. You don't need to run both WINK.COM and WINK.SYS. Pick whichever program you find most convenient; you'll probably prefer WINK.SYS because it's more efficient on the HP 95.

Add the following line to CONFIG.SYS, and WINK.SYS will load automatically when you boot your HP 95:

DEVICE=WINK.SYS

Like WINK.COM, you can specify the cursor starting line:

DEVICE=WINK.SYS 0

•	WINK.SYS is compatible with the HP 95 System Manager, so HP 95 add-in programs can still run with a hot key.

•	Because of HP 95 memory management, all TSR programs consume extra, hidden memory. While WINK.COM needs only about 368 bytes, the HP 95 gives it about 2K. WINK.SYS is a device driver, so it isn't susceptible to TSR memory problems. After it loads, WINK.SYS uses only 144 bytes.


WORDS.COM, WORDSI.COM

Count words, sentences, paragraphs

WORDS counts words, sentences and paragraphs in files of any length. WORDSI is the international version of WORDS, recognizing not just A-Z, but international characters; it's a bit larger, and it's also ten to fifty percent slower than WORDS. All of the following command lines are acceptable:

WORDS
WORDS README.TXT
WORDS < README.TXT

As it runs, WORDS displays the number of bytes it has read. When it's finished, the report looks something like:

 47,616 Bytes
 31,664 Characters
  7,538 Words
    557 Sentences
    351 Paragraphs

The character count includes everything but blanks. The words field shows the number of blank-delimited words. The sentence count is the number of groups of words followed by a period, exclamation mark or question mark; repeated punctuation is ignored. The paragraph tally is the total number of carriage return characters in the file. Modern text editors (like the HP 95 Memo program) do automatic word-wrap, moving words between lines as you edit. They treat a paragraph as any series of characters followed by a carriage return / line feed combination.

Remember that WORDS treats high-order characters (ASCII codes above than 127) as blanks, while WORDSI recognizes foreign language characters, which will cause inaccuracies if you use the program to read text written by programs like WordStar. To count the words in a WordStar-style file, pipe the output from SIFTWS through WORDS:

SIFTWS WS.DOC | WORDS

To count the words in a file that contains extraneous high-order characters, you could instead give WORDS the results of SIFT or SIFTHIGH, just like you do SIFTWS.

 Tip:  WORDS is optimized for best performance on 486 and later processors. It also runs well on the HP 95.


Living With The HP 95

A personal computer isn't truly personal if it's inconvenient to use. The palmtop PC redefines the personal computer: powerful, versatile, approachable and handy. There's much to be said for the right tool for the job, but the right tool, in real world, is the tool you have with you.

If you haven't spent very much time with your HP 95 yet, experiment for awhile, try things, whether you think they'll work or not. We'll meet back here later.

You won't damage the computer by pressing keys. It may beep at you, lock-up, or even erase files, but you won't hurt the computer or lose any of the permanent files or built-in applications by trying things. If you aren't confident about what you are doing, make backup copies of important files you've created, then have at it—enjoy.

Even if the computer seems to go daffy or scrambles an important file and the computer refuses to run, there are several ways to recover. We'll talk about damage prevention and solutions in Before Things Go Wrong.

The Big/Small Picture

Jaguar—that's Hewlett-Packard's internal name for our HP 95—is much more than a palmtop information manager, it's a general purpose IBM PC compatible computer. The HP 95 can do business as a calculator—or just about anything else, for that matter.

The HP 95 has a split-personality. We have the built-in the applications: a personal information manager controlled by the ROM-based System Manager. The other personality is a traditional command line-driven, IBM-PC-compatible computer.

Most computers hide only the BIOS—the lowest-level utilities that connect software with hardware—in ROM. There's a lot more power in the HP 95's megabyte of ROM: the MS-DOS operating system and the built-in applications. Built-in languages include Lotus 1-2-3 functions and macros, as well as MS-DOS' batch language and the primitive assembler in DEBUG.EXE. The distinctions between these components blur in a computer as integrated as the HP 95.

MS-DOS is not the evil twin, but a partner to the built-in applications. MS-DOS handles disk drives and data files for both environments. The long-time standard MS-DOS file structure and Lotus 1-2-3's file format means compatibility. The built-ins replace most of the drudgery of MS-DOS—we can do most common tasks with just the built-in applications, without having to run (or buy) any extra programs.

What Happens After You Press ON?

Press the ON key and the computer boots; it's as simple as that.

The term boot evolved from bootstrap-loader, a method for a computer to "Pull itself up by the bootstraps." In the early days of computing (as in the early days of aviation, though more than a half-century later), starting was an arduous, time-consuming, hit-or-miss affair. Once you got it running, you really didn't want to shut it off.

It's still an arduous task, but at least we have a starter motor: the BIOS (an acronym of Basic Input/Output System). The BIOS is permanently programmed ROM containing essential programs to support the display, keyboard and disk drive—and to self-test and boot the computer.

Every time we power-up the computer, the BIOS checks that hardware, memory and the C: RAM disk are intact, and that battery power is at least fair to middling. Then, and here's where the HP 95 differs from other DOS-machines, it returns to whatever task the computer was performing when it shut down—exactly where it left off!

This is fine if the computer was in the middle of something productive—or maybe it was idle, doing nothing at all. However, what if the computer was, ahem, indisposed, or maybe this is the first time it's been started, so nothing was ever running.

There's no way for the computer to tell if all is well. One machine language instruction looks pretty much like another; and if it does freeze, well, it's too late for it to be able to do anything about it. It's up to us to cold-start the computer should things go wrong. To straighten it out, we'll have to stop it dead in its tracks and force it to reboot; this is explained in Resetting The Computer.

Mostly though, we don't have to think about booting at all.


Program Files

MS-DOS recognizes four types of program files, represented by unique file name extensions. COM files (short for "command") and EXE (an abbreviation of "executable") are compiled programs.SYS (for "system") files are executable programs, usually called "device drivers," that are loaded from CONFIG.SYS when your computer first boots. File names ending with BAT are batch files, containing a series of commands—much like you would enter from the keyboard—in a readable, English-like language. You can list or even edit batch programs. COM, EXE and SYS programs are in a machine-readable language; list one of these files and you'll see why they call this stuff code.

Most programs in this package are in the COM file format. The EXE file format begins with a header of at least an extra 512 bytes, and because of this extra overhead, EXEs load slower than COM programs. For small programs, there isn't much useful information in the header; the HP 95 can make better use of that memory elsewhere. Writing 30 COM programs instead of 30 EXEs saves 15K of disk storage space—and nearly cuts the size of this package in half. To save memory in a program you will probably use all the time, WINK.SYS is a device driver.


Before Things Go Wrong

Short of dropping it in a lake, leaving it on the bus, or loaning it to a friend, there's not much that can go wrong with the HP 95 hardware. Still, bad things do happen to nice computers. Most computer problems are the result of software errors.

Programs do crash, but most data loss is the result of user mistakes... like accidentally deleting files. For instance, in the preparation of this book, the author lost a file on the HP 95 by trying to save the file in the Memo program, then not paying attention to the prompts. There was a two day old back-up copy, but a lot can change in two days.

Avoiding Problems

It's devastating to see a whole day's, a week's or even more, work lost to a careless keystroke or misbehaving software. If you haven't lost data yet, you will. A rule of thumb is to back-up files before you lose files. It's amazing how often we lose data just before we didn't get around to making back-up copies.

Any back-up scheme, regardless of how casual, is better than none. A separate back-up disk for each project makes it easier to update only those files that have changed since the last back-up.

You could accidentally back-up files in the wrong direction and overwrite the new files with old ones. You can minimize the damage by maintaining two back-up copies, then overwrite the oldest copy each time.

RAM disks are fast and protect data reliably, but they are not permanent storage. Check the manufacturer's recommendations for changing batteries, then err on the conservative side. Always try to make an archival copy of important files on floppy disks.

The HP 95 appears to be less susceptible to static electricity crashes than some earlier handhelds, but RAM cards are an unknown. Static crashes can happen, and they can damage computers as well as data. On days when the humidity drops and every time youtouch a door knob sparks arc from the ends of your fingers, consider leaving your HP 95 at home.

Identifying Problems

Programs beep at us all the time. The challengeis distinguishing the informational and casual warning messages from the warnings of impending doom. Here's a short crash course to help you tell when the sky really is falling.

It can be difficult to discriminate normal, albeit bizarre, behavior from trouble. Before assuming something is amiss, check for obvious keystroke combinations (like F1 for help), then take a look at the documentation. If something has gone wrong, checking out the possibilities before rebooting can save data and time. If you can't turn the computer off or on, there is something wrong; skip down to the section titled Resetting The Computer.

The only real problems are loss of data, corrupted disks, and the inability to run programs. The HP 95 maintains a checksum to ensure that the C: RAM disk is intact. Each time we turn the computer on or do a warm or cold boot, the computer verifies the disk. If the computer doesn't complain about disk problems, there probably aren't any serious problems.

Not all MS-DOS programs run well on the HP 95, but very few cause problems. For instance, Microsoft's MSD diagnostic program (designed to test computers) appears to lock-up the HP 95, but it is actually working for about fifteen seconds, apparently trying to decide what kind of new-fangled computer the 95 is. Similar programs from Norton and QuarterDeck run quickly, without problems. While MSD runs strangely, it does not harm the computer.

Damage Control

When you've decided that something is wrong, don't start banging on keys! The more keys you hit when the computer is acting out of sorts, the greater the chance there is of doing the only real damage that's possible on the HP 95: lost or damaged files on the RAM disk.

Just because you can't see anything on the screen (or you see garbage), it doesn't mean the program has crashed. The HP 95 display is 16 lines of 40 characters, and a warning may be hidden on line 25 or over on the right, beyond the edges of the display window. Try pressing ALT+Cursor keys to find and visual clues. If you can, run the program on a computer with a full-size display to check for messages. Try the normal methods to exit a program (though you're flying in the dark): ESC or CTRL+BREAK (on the HP 95 that's CTRL+BACK) will often work.

If the display is blank, the program my not have correctly identified the 95's display, and if it's writing directly to the screen (many programs do this because it's much faster than going through MS-DOS or the BIOS), it may be writing to the wrong memory location. This is a bigger problem on the HP 95 than some other computers because those memory locations may be reserved for other program data. If this happens, it's probably safest to reboot the computer to avoid the chance that a program in memory has been corrupted.

•	You can't accidentally erase programs in ROM.

•	You can accidentally trash (that's computer lingo for "corrupt") the permanent part of the C: RAM drive.

•	Computers and software can lose data through battery failure or electrical storms. Create permanent, back-up copies of important files, and make new back-ups whenever you make any significant changes.

•	In the words of Douglas Adams' Hitchhiker's Guide to The Galaxy: "Don't panic!"


Resetting The Computer

When we reset the computer, we stop what's happening then reboot. This includes the self-checks, reloading MS-DOS, and re-reading CONFIG.SYS and (if your computer uses one...) AUTOEXEC.BAT. It is not necessary to turn the computer off before rebooting.

Two Different Ways to Boot

Keystrokes	Purpose

CTRL+ALT+DEL	Also known as a "Warm boot." Resets the computer and restarts the operating system.

CTRL+SHIFT+ON	This is a "Cold boot." All data in memory will be lost. There is some possibility that files on the C: RAM disk will be damaged.

PC-compatibles are designed to be rebooted—desk bound PCs are booted at least once every day. You aren't damaging the computer by rebooting.

Rebooting the computer does not always mean something has gone wrong. Changing system configuration or loading TSRs often requires rebooting before MS-DOS will recognize the changes.

 Caution:  Before you reboot, be sure to exit from any running application programs if you can. If you don't (or can't) exit the programs, all un-saved data in the computer's main memory will be lost. If any application has a disk file open, the file may be corrupted.

The Warm Boot

You can recover from most common problems by doing a warm boot. Press CTRL+ALT+DEL to restart MS-DOS. Main memory will be cleared, but there is little chance for problems with the C: RAM disk.

All MS-DOS computers recognize the CTRL+ALT+DEL keystroke sequence to reboot. The warm boot may fail, or even do nothing at all, with severe lock-ups. Just a few programs will try to intercept the warm boot (one older word processor, for instance, interprets that keystroke combination to exit the program); for safety's sake, avoid those programs.

Cold Booting

A cold boot is rarely necessary; you can usually reset the computer with just a warm boot. If the computer won't warm boot, pressing CTRL+SHIFT+ON does a hardware reset.

On your desk bound PC, a hardware reset is the equivalent of turning off the computer then turning it back on (also known as "Hitting the big red switch"), with one exception: When it reboots, the HP 95 will ask you if you would like to reformat the C: RAM disk:

Initialize RAM Disk?  Enter Y or N:

When you reformat C:, all of your custom configuration files in C:\_DAT\ will be erased. Even if you select N to bypass reformatting C:, there is still some chance that the C: RAM disk may be corrupted, forcing the computer to reformat it anyway.

 Note:  After a cold boot, the HP 95's clock is set to 1980; you will have to reset it to the current date. Why does it return to 1980 instead of zero? When the IBM engineers designed the original PC, memory was expensive; a bit saved was a bit earned. The year a file was created is stored as an offset from 1980: 1992 is stored as 12, 1993 is 13, and so on. By assuming that it will always be later than 1980 and that the PC will only be popular for 127 years, MS-DOS' designers managed to store the month, day and year in the same space that the year alone might have required.

Use CHKDSK to resurrect disk drives.

Notes About Rebooting

•	Data will be lost if you reboot without saving and closing files. Close any open system manager applications before rebooting, this will assure you that all data has been written to the disk and all files are closed.

•	If you can, try to make backup copies of important programs before rebooting.

•	After a crash, reboot then run CHKDSK.EXE to verify that the C: RAM disk is in good shape.

•	If after all these attempts you still can't get the computer to boot, try removing the batteries (the backup battery and AC adapter, too) and letting the computer sit for a while. Then put the batteries back in the computer and try the ON key.

•	Neither warm- nor cold-boots will erase a RAM card. However, if you reset the computer while files on a RAM card are open, data loss may result.

A Few Cautions

•	Don't turn the computer off while the beeper is on—this leaves the speaker circuitry in high-power mode. If you absolutely must silence a "stuck" speaker, you can press CTRL+ALT+DEL to do a warm reboot.

•	The keyboard buffer remembers up to 15 keystrokes. With early versions of MS-DOS 3.20, overflowing the keyboard buffer (repeating keystrokes until it beeps repeatedly) could crash the computer. The HP 95 does not have this problem. Some applications will flush the keyboard buffer when you press CTRL+BREAK.

•	Try to make back-up copies of important files before trying new programs.

•	The cold boot (CTRL+SHIFT+ON) is not absolutely reliable. There is a slight chance of corrupting the RAM disk.


Resource Management

Plugging in cards adds programs and storage space, but the HP 95 is still a sealed box. The goal, then, is to stretch these finite resources.

Memory

You paid for 512K of memory. Half of it is a RAM disk, and Lotus 1-2-3 says there's 100K available. So where's the rest?

The only way to keep the whole 512K available is to not turn on the computer. Everything, even turning on the HP 95 and displaying the current time, uses memory. Just booting the computer, before you start any of the built-in applications, takes at least 100K of memory.

Because of the internal design of the HP 95, it's unlikely that main memory will be expanded much beyond 512K. Memory addresses that remain unused on other PC-compatible computers are already spoken for on the HP 95, for things like bank switching of data and programs. Expect to see EMS (Lotus, Intel and Microsoft designed this Expanded Memory Specification), which adds extra memory for Lotus 1-2-3 and several MS-DOS applications.

Application Program Memory

Main memory is a common pool. When a program or command needs more memory, it requests a block. When it no longer needs the memory, it returns it to the pool. When there's not enough memory available for an application, somebody has to get out of the pool.

The two memory categories in this table are Memory and Data Limit. The Memory category is the amount required to run the program, without concern about data files. The Data Limit column is how much additional memory the program may use to load and edit data files.

built-in Application Memory Requirements

Application	Memory	Data Limit	Practical Limit

Appointment Book	20K	47K	About 500 entries.

Clipboard	·	8K	220 lines, 1300 words.

Data Comm	20K	·	·

Hearts & Bones	9K	·	·

HP Calc	24K	·	·

Lotus 1-2-3	30K	Memory	Available memory.

Memo	15K	51K	1400 lines, 8700 words.

Phone Book	12K	49K	About 450 entries.

Tiger Fox	11K	·	·

Notice that there are no entries for Filer or Setup. These built-in applications and the System Manager reserve memory for several important functions. To avoid deadlock, there's always enough additional memory set aside so we will always have room to run Setup and Filer.

While Lotus is listed in the table as requiring only 30K, remember that much of the system overhead is for 1-2-3, regardless of if the program is running or not. In addition, Lotus will refuse to run if available memory falls below about 48K, and it will flash the "Mem" warning annunciator if memory falls below 4K while it runs.

Lotus 1-2-3 can create files as large as available memory. Always be sure there's enough disk space available to save spreadsheet files that are currently loaded into main memory.

Checking Available Memory

The Setup program shows how memory is divided between the C: RAM disk and main memory, but it does not tell us how much memory is currently available.

•	In Lotus 1-2-3, press MENU then select Worksheet Status. The amount of available memory shown will be reduced by the memory required to run 1-2-3.

•	In Filer (or at the DOS command line) run CHKDSK.EXE. The difference between total memory and bytes free will be around 98K if the System Manager is loaded, or 18.5K if you booted from plain-old DOS.

•	You can see how much disk storage space is available by switching to Filer and running the DOS program CHKDSK.EXE. It also shows currently available main memory.

•	Instead of CHKDSK, try running MEM.COM, included with this book. MEM shows only information about memory, not disk drives, and it runs a bit faster.

See Configuring Memory, for instructions about changing RAM disk size.

How Much Memory Is Enough?

It's frustrating, after sailing along with a 20K Phone Book database and a 15K Memo text file open, to have the computer refuse to load Lotus 1-2-3 because of insufficient memory. We can close an application then load 1-2-3, but if we could allocate all of our 512K RAM to main memory, it would be a cinch to run everything at the same time.

The more memory you have available, the more applications you'll be able to leave open concurrently. HP 95 memory management is a trade-off between C: RAM disk and program memory. The HP 95 ships with the C: drive configured to 254K.

The Setup program lets us vary this configuration between giving virtually all of our 512K of memory to the RAM disk, and all to main program memory. This table compares RAM disk and main memory allocation, and how the results affect Lotus 1-2-3.

C: RAM Disk Vs Main Memory

C: RAM Disk	Main RAM	Lotus 1-2-3

30K	482K	328,864

62K	450K	296,096

122K	386K	230,560

246K	266K	107,680

254K	258K	99,488

262K	250K	91,296

270K	242K	83,104

310K	202K	42,144

All of the built-in applications edit data in RAM. It's one of the great ironies of the HP 95 that data is copied to RAM for editing, then copied back to RAM disk for storage—and it's all part of the same memory. For each 10K Memo file, we need another 10K of disk storage space for the permanent copy.

Most Lotus spreadsheet files will probably never reach, let alone exceed, 100K unless you use your HP 95 for Fortune 500 accounting. Phone Book files and Memo note files are rarely larger than 10K. Other applications limit data files to under 64K each. At 200-300K, dictionaries are well within the capabilities of the HP 95, while this book, at over 700K, probably is not.

Evaluating memory requirements is a personal, trial-and-error process. The first rule is there's no such thing as enough memory.

1.	If you work with several smaller programs and small data files, increase the RAM disk partition as far as you can until the built-in applications you regularly use won't run concurrently.

2.	If you work with a few very large files or many small files, you are a candidate for a RAM card. You will probably want to reduce the C: RAM disk to 62-122K to make more room available for large files in main memory, then add at least one large RAM card to store your data files.

3.	The typical user will start with the standard memory partition, deleting or copying unneeded files to another computer as necessary. A RAM card will be indispensable for permanent data storage.

Conserving Memory

•	Use tab characters (entered with the TAB key) to indent text in Memo text files to save memory and disk storage space. A single tab character can replace as many as eight spaces; do it several times in a Memo file and the savings will quickly mount.

•	Turn off Lotus 1-2-3 Undo. While 1-2-3 is running, press MENU, then select Worksheet, Global, Default, Other, Undo, then select Enable or Disable. The Default Settings screen shows the current 1-2-3 Undo status.

•	Close unneeded applications.

Notes About Memory Management

•	Don't create spreadsheets (or any files) larger than available RAM disk space. Use a plug-in RAM card then reduce the size of the on-board RAM disk.

•	You can increase available memory by about 1056 bytes by reducing buffers in the CONFIG.SYS file.

•	If you're short on memory but still want to run Lotus 1-2-3 alongside several other applications, start Lotus first, then the other applications. Lotus will confirm that there is enough memory and load normally, then you can switch to other applications, and Lotus will share the available memory with these applications.

•	There are many powerful tools built-into the HP 95. If memory is at a premium (which, of course, it always is), consider using the built-in applications programs instead larger, non-95 programs.


RAM Cards

Plug-in RAM cards might really be a panacea. At least they offer several advantages with virtually no downside. Besides of course increasing disk storage, RAM cards free you to configure most of the main 512K as program memory and less as a RAM disk; this lets you build larger 1-2-3 spreadsheets and run memory-hogging DOS programs.

The HP 95 supports RAM cards as large as two megabytes. If you're using mainly the built-in applications, this is probably much more than you'll need. For DOS applications, the sky's the limit. When you're deciding what size RAM card to buy, remember that your needs will likely grow with your interest and understanding of your computer. Storage space requirements always grow to exceed capacity.

We currently have 128K, 512K and 1MB (megabyte) and 1.5MBcards, with 2MB cards on the way. If you add too little, you can always add another card later, perhaps dedicating a separate card for each application. That the cost per kilobyte is usually less with larger cards.

RAM Cards For Security

If you don't have another computer for permanent data storage, or your HP 95 spends most of its time away from the desktop, you'll appreciate, and soon depend on, the convenience and security of a RAM card.

Ram cards are as close to archival storage as the 95 gets. Keeping important data on cards lessens the chance of file corruption or data loss when the power fails or a program goes haywire.

All of the 512K of internal memory, regardless of if it's configured as main memory or RAM disk, is located in a contiguous block; a "runaway pointer" crash that might normally just hang the computer could also garble data on the internal RAM disk.

Notes About RAM Cards

•	The HP 95 supports RAM cards as large as 2 megabytes. Cards larger than 2MB would be a needless expense since the 95 would not recognize their extra capacity.

•	8K of memory for the HP-75C Portable Computer listed for $195; ten years later 128K for the HP 95 lists for the same price. Some predict geometric growth in density and reduction in cost; taken too literally, a bathtub-full of storage would come free with your morning newspaper. But free or not, memory is a housekeeping responsibility.

•	A one megabyte card may cost more than twice as much as 512K.

•	The larger the RAM card, the shorter the card's battery life.

•	Good housekeeping habits (discarding outdated, unneeded or duplicated files) can forestall the purchase of additional RAM cards.

•	RAM cards are more secure than HP 95 main memory and the C: drive, but they are not infallible. If you can, periodically make back-up copies of RAM cards on permanent, off-line storage (usually floppy disks).

•	Save room on the C: RAM disk by erasing files from C:\_DAT\ that are duplicated in the hidden C:\_SYS\ directory.


Power Management; Battery, life expectency
Power Management

The 95 has a strong sense of self-preservation. It goes to elaborate extremes to conserve battery power—and our data. We'd have to try really hard to lose data. The 95 checks battery level throughout the day:

•	Whenever you turn on the computer.

•	Once each minute while the computer is running.

•	Whenever you run the Setup program.

Even when you're not, the computer is busy. It's constantly checking the keyboard, serial port and watching for 5 minutes to pass so it can take a serious nap. To extend battery life, it takes a short nap, called light sleep, whenever programs check for waiting keystrokes. This means that even programs not specifically designed for the HP 95 can conserve power if they are polite and let the BIOS handle the keyboard buffer (most programs are polite that way).

Programs that sit in tight loops and check the keyboard through non-standard methods cause have higher power drain. For instance, TF.COM seems to cause higher than average battery consumption.

Judging Battery Life Expectancy

When new, the main batteries supply about 3.0 volts (two 1.5 volt batteries in series). When you press SHIFT+FILER to run Setup, the screen shows the current system battery level as a "Gas gauge," with "F" and "E" markers. Full means three volts, while empty is 1.8 volts. The battery gauge feels, at best, vague. Each notch represents a large jump, and it doesn't show back-up battery level at all. If, like me, you're used to putting in five dollars-worth and driving 'til it's pegged again, the 95's gaugewill take some vigilance.

The magic value is 2.5 volts, which is about halfway down the battery gauge. When system batteries dip below 2 volts, the computer displays "Low Main Battery" each time you power-up, until voltage rises above 2.5 volts. Batteriesdo recover a bit naturally—though it's unlikely they'll recover from 2.0 to 2.5 volts.

When the battery level falls to 1.8 volts, the computer's fail-safe mechanism kicks-in. Here's where the backup battery gets its workout, because the computer shuts down and relies on the backup battery until you replace the main batteries. Empty on the 95 means shut-down and curl up into your clamshell, and wait for new batteries.

A good rule of thumb is to start looking for batteries when you're at a half-tank.

Notes About Power Management

•	Don't use NiCad (Nickel Cadmium) batteries. Most NiCads produce 1.2 volts when fully charged, for a total of 2.4 volts. The HP 95 low-battery warning starts at 2.5 volts. Later HP Palmtop computers can use NiCad batteries.

•	Use BATTERY.COM for a more accurate check of main and back-up battery levels.

•	Power consumption increases whenever Filer is running or during any serial communications (using the Comm program or DOS' CTTY).

•	Use the AC adapter, if you can, whenever you are doing serial communications.

•	The computer will not time-out when it's plugged-into the AC adapter.

•	Don't leave impolite programs running when the computer is turned-on. These are programs that sit in a tight loop and either don't check for waiting keystrokes or check for them via non-standard methods (such as looking directly at the keyboard buffer). Unfortunately the only way to see if a program is a battery hog is to try it.

Midnight Madness

The HP 95 does housekeeping chores every night at midnight. If the computer is off, it will turn on for less than a second. If the computer is on, the running program will not respond to keystrokes for a second or so. The only time this might be an issue is when the HP 95 is being used for automated data collection. Try to time readings to skip the midnight rush.


Configuring and Customizing

In this chapter we'll talk about several files and computer settings, and note how changing these settings affects computer performance and memory efficiency.

Configuration Files

We're usually so busy making notes and calculations that we forget that the computer has needs, too. It lives for files. A few important files customize how the HP 95 works:

HP 95 Configuration Files

File Name	Purpose

C:\_DAT\APNAME.LST	List of System Manager programs and keystrokes.

C:\AUTOEXEC.BAT	Batch file, run when booting MS-DOS.

C:\CONFIG.SYS	Loads device drivers, configures environment.

C:\_DAT\TOPCARD.PCX	The Business Card graphics file.

The computer automatically creates TOPCARD.PCX. To get the most of the 95, you'll want to create custom versions of all of these files; we'll offer suggestions on how to set-up these files later in this book.

Files in the next list are created and maintained automatically by the built-in applications. These files hold program settings and data; for instance, the calculator storage registers are stored in CALC.ENV.

Application Configuration Files

File Name	Application

C:\123.CNF	Lotus 1-2-3.

C:\_DAT\APPTBK.ENV	Appt.

C:\_DAT\CALC.ENV	HP Calc.

C:\_DAT\HEARTS.CNF	Hearts & Bones (HB.EXM).

C:\_DAT\MEMO.ENV	Memo.

C:\_DAT\PHONE.ENV	Phone Book.

C:\_DAT\SETUP.ENV	Setup.

C:\_DAT\TIGERFOX.CNF	TigerFox (TF.COM & TFOX.EXM).

C:\_DAT\WATCH.ENV	Appt.

If you delete these files, the applications will lose their current settings, and will revert to the factory configuration. For instance, after you've been playing with TigerFox for awhile, you can delete TIGERFOX.CNF to reset the high score to zero.

 Caution:  Don't delete 123.CNF, it's needed by Lotus 1-2-3, and SETUP.ENV (containing global settings like the beep level) is write-protected so you can't accidentally delete it; don't try to edit or delete this file. Don't try to edit the *.ENV files with Memo. These are not text files; altering them can cause the associated applications programs to work erratically, or maybe not at all.

Most of computing is data manipulation. HP 95 built-ins recognize several file types.

Applications Data Files

File Name	Application

*.ABK	Appt program.

*.CTF	Comm program character translation.

*.DCF	Comm settings.

*.EQN	HP Calc Solver file.

*.FCF	Filer configuration.

*.LCF	Comm logon configuration script.

*.PBK	Phone Book.

*.PCF	Printer configuration.

*.PCX	Business card graphic file (Setup).

*.PIC	Lotus 1-2-3 graph file.

*.TXT	Memo text file.

*.WK1	Lotus 1-2-3 spreadsheet.

The sample 1-2-3 files in the root directory with names beginning with an underscore and the WK1 extension cannot be deleted, nor can you erase CHKDSK.EXE, COMMAND.COM or TF.COM. Since these files are in the ROM portionof the C: drive, they consume no usable disk space (though they do take directory entries, which are a perishable commodity, because the root directory can only have 100 files).

 Note:  The first time you booted your HP 95, it created the C:\_DAT\ directory and copied several files there. These files include *.DCF, SAMPLE.CTF, TOPCARD.PCX, and _1.PBK. None of these files are needed to operate the computer (and most of them aren't very interesting). You can safely delete these files to conserve disk space; if you later decide you need them, there are copies available in the hidden C:\_SYS\ directory.

Turning Down the Beeper

So your coworkers think you're playing with a Nintendo Game Boy whenever you balance your expense account in Lotus 1-2-3. That's easy to fix: turn the beeper down. You probably don't want it off completely—some warning beeps are important—just make it a bit quieter.

Changing the Speaker Volume

Select Item	What it Does

SHIFT+FILER	Enters the setup program.

System	Enters the system configuration sub-menu.

ENTER	Selects the first item (Volume).

LEFT or RIGHT	Press the left and right cursor keys until the volume is to your liking. There are four volume levels, plus silent.

ENTER	This enters the volume setting. You could press ESC instead to cancel the volume change.

Q	Quit the System menu, return to the Setup menu.

Q	Quit the Setup program.

Notes About the Beeper

•	The first time you boot your computer, the beeper was set to the factory level (a bit too loud for the office, a bit too quiet for a car on the freeway). If you change the volume with the Setup program, your preferred setting will be maintained in the file C:\_DAT\SETUP.ENV, so each time you reboot, your custom volume setting will be restored.

•	Turning off the speaker completely may conserve batteries slightly, but you may miss important warning messages.

•	You can turn off warning beeps just in Lotus 1-2-3 without affecting beeps elsewhere. The command is six levels deep in the Lotus menus, follow this procedure to keep from getting lost in the maze of menus: After starting Lotus 1-2-3, press MENU then select Worksheet, Global, Default, Other, Beep, No; then press ENTER. After you press ENTER, you will be returned to the next menu level higher (The "Printer Directory Status Update Other Autoexec Quit" menu); in this menu, select Update to change the default setting (so Lotus will start in quiet mode next time), then select Quit to return to your spreadsheet.

Configuring Memory

It is possible to partition memory and RAM disk space so there is insufficient memory to run Lotus 1-2-3. The minimum allowed by Setup is 310K for disk and 202 for main memory.

Before re-partitioning memory between main memory and the C: RAM disk, all applications besides Setup must be closed. This is to ensure that no data in memory will be lost when Setup reboots the computer after changing the memory partition.

Changing Memory Allocation

Select Item	What it Does

SHIFT+FILER	Enters the setup program.

System	Enters the system configuration sub-menu.

Memory	Enables the memory "volume" control.

LEFT or RIGHT	As you press the left and right cursor keys, the Memory volume level and the numbers in the lower left corner will change. Continue until you reach the desired setting.

ENTER	Confirms that you would like to re-partition memory.

ENTER	At the prompt, press ENTER to confirm the memory change. If you press ESC, the change will be canceled.


HP 95 Business Card

When all applications are closed-down and the HP 95 doesn't have anything else to do, it displays a graphics screen, called a Business Card, which is stored in a file named C:\_DAT\TOPCARD.PCX.

When you booted your 95 the first time, it placed a copy of the standard TOPCARD.PCX file in the C:\_DAT\ directory. You can create your own custom graphics file or save some disk space by deleting this file and using one of the two other graphic files built-into the computer. Don't worry about erasing TOPCARD.PCX, there's always a spare copy in the hidden C:\_SYS\ directory. You delete the file with the Filer program, or exit to DOS and type this command:

DEL C:\_DAT\TOPCARD.PCX

If you don't mind not seeing your name and the time on the screen, you can use the copy of TOPCARD.PCX stored in ROM in the hidden C:\_SYS\ directory. Press SHIFT+SETUP, then select Owner, Picture-File. Now type the new file and path name:

C:\_SYS\TOPCARD.PCX

The other built-in Business Card file is a thousand dollar bill with Grover Cleveland's picture (though the picture looks more like Grover from Sesame Street). The U.S. Mint has stopped printing this note; this may be the only place you'll find one. Try this hidden Picture-File:

C:\_SYS\1000.PCX

It really doesn't matter what's in the graphic file you use; if you'd like, you could copy the thousand dollar bill to the TOPCARD.PCX file name, and display the time over it (showing the time on that picture isn't very pretty, but it works). From DOS enter:

COPY \_SYS\1000.PCX \_DAT\TOPCARD.PCX

 Note: The HP 95 will display the current time and date over your graphics screen only if the file is named TOPCARD.PCX, and it must be in the C:\_DAT\ directory. If the computer can't find TOPCARD.PCX, it displays the time and date, but no graphic file.

By the way, once you've closed all applications to have a look at your Business Card, take a moment to see a short tribute to the creators of the HP 95. Press ALT+123, then release those keys, then press and release them again; the names will scroll by. If you want to see the list again, press ALT+123 one more time.

The HP 95 doesn't have a built-in paint program, but you can create Business Card files on other computers. Be sure the files are in the PCX format, monochrome, and no larger than 240 by 128 pixels (in Microsoft Paintbrush, that's the same as 2.50 by 1.33 inches). You can create PCX files from scratch, but it will often be easier to start with an existing file—even if you erase the entire image and start again. Try copying TOPCARD.PCX or 1000.PCX to your PC to use as a starting point.

PCX Files

We have included some other graphics files with this package. You can use them as the start-up card, or display them with PCX.COM.

The HP 95 can display monochrome (one bit per pixel) PCX files as large as 240 by 128 pixels (2.50 by 1.33 inches). You can create pictures from scratch with a paint program on your PC. It might be easier to start with an existing image; you may want to copy TOPCARD.PCX or 1000.PCX to your PC.

Notes About the Business Card

•	Pixels on the 95 are wider than they are tall. If you create PCX files for the 95 on a square-pixel computer (such as a PC with a VGA video card), be sure to adjust the drawings to avoid turning circles into watermelons.

•	To eliminate the picture file, run the HP 95 Setup program and delete the file name from the Owner screen. This won't delete the file from your disk.

•	The HP 95 will only show the current time and date if the Business Card file is C:\_DAT\TOPCARD.PCX. Any other file name or any other directory will suppress the running clock.


Introducing System Manager

Imagine adding new blue application keys to switch between built-in applications and other programs. Say, switch from Lotus 1-2-3 to TigerFox and back again without quitting either. Well, you can! We'll show you how to run TigerFox (and the new program Hearts&Bones), but first an introduction to the HP 95 System Manager.

The System Manager is an applications program standard that offers tools and consistency for the built-in HP 95 applications. In addition, the System Manager is extensible, making it possible to add new applications to the computer that work exactly like the built-in programs. These new applications are written to follow the same standards, called System Manager Compliance.

Benefits for the user include reduced  memory requirements, more consistent user interface, and non-preemptive multi-tasking. The one disadvantage is that programs will have to be modified, sometimes considerably, to conform to the System Manager. It's possible, as in the case of TigerFox, to create two versions of the same program: MS-DOS and System Manager.

The bulk of program development time—and the bulk of programs themselves, in fact—is taken up by the user interface. Every programmer has a better idea about your computer and your programs should work. The System Manager adds some stability so that we don't end up with a computer full of uniquely, and sometimes arbitrarily, different program designs. System Manager programs usually work in similar ways because they're written with the same tools.

Writing System Manager compliant programs is philosophically not unlike writing Microsoft Windows applications. Though without the complexity, and without the investment in learning and tools required for Windows.

Conforming to the System Manager standards doesn't constrain programmers, but instead frees them to concentrate on the important, individual, creative issues of program design. Basically, the System Manager takes care of the large, tedious, expensive part of the task, and leaves the fun to the programmer. If the HP 95 is as successful as early reports indicate, expect new, innovative, and efficient programs designed for the HP 95, not just cobbled-up from another machine.

System Manager Program Types

The HP 95 System Manager adds a couple of new program file types: EXM and XIP. You don't run these programs from MS-DOS, but from special hot keys that you designate. Just as you start Lotus 1-2-3 from the dedicated 123 hot key, you can add new programs and assign them to the key code combination of your choosing.

EXMs (there are two of 'em hiding in C:\_SYS\) are similar to the 95's built-in applications: you switch to them with a special keystroke, and you can switch to another program without exiting them. One difference, though, is they are disk-based programs; when you run them, the computer loads a second copy from disk into main memory, just like conventional MS-DOS applications programs.

XIP programs are exactly like the built-in applications. XIP is an acronym for "eXecute In Place," meaning the programs reside on a RAM disk card, and the computer can execute programs from the card—without copying them into main memory! This saves memory and speeds program loading.

The PCMCIA (the Personal Computer Memory Card International Association) is creating standards for XIP software. As this standard develops, expect to see more applications for the HP 95 available on plug-in cards.

Assigning Hot Keys

For the HP 95 to take advantage of new System Manager applications (and to even know theyexist), we need to create a text file with the program name and hot key. This file is named APNAME.LST, and it must be in the C:\_DAT\ directory. You can edit the file with the HP 95 Memo program.

The APNAME.LST file is quite simple: it's a text file with one line for each System Manager compliant program. Each line includes three items separated by commas: a fully qualified path and file name exactly as you find it in the disk directory, the hot key code (in hexadecimal), then the title of the program. Each line may be up to twenty-eight characters long. Here's the format of each line in the file:

PROGNAME.EXM,hotkey,program title

Hot key codes in APNAME.LST are four-digit hexadecimal numbers. The first two digits are the scan code—traditionally, though not always, related to the position of the key on the keyboard; for instance, ESC is the first key in the upper-left corner of the keyboard, so it's 01. The third and fourth digits are the character the key returns when pressed; most special keys have no character code, so this value is usually 00.

Say you would like to assign a program to the E key. Regardless of if it's shifted or not, the E key always returns scan code 12 (in hexadecimal). Depending on which state keys are down, the character code could be 00 (for ALT+E) or 05 (That's CTRL+E) or the hexadecimal representation of "e" or "E" or even "æ" (that's CHAR+E).

E Keystroke Combinations

Keystroke	Character	Keycode

E	e	1265

CTRL+E	♣	1205

SHIFT+E	E	1245

ALT+E	(none)	1200

CHAR+E	æ	1291

SHIFT+CHAR+E	Æ	1292

You use any key with a character code of zero for a hot key. The only key in this list with a zero character is ALT+E. So to assign a program to ALT+E, you would specify the hot key as 1200. For a System Manager program named STARWARS.EXM, the line in C:\_DAT\APNAME.LST looks like:

C:\STARWARS.EXM,1200,Star Wars

SHIFT- and CTRL-modified regular keys are already taken, so this table lists just ALT or CHAR modified key combinations.

Once you've created and saved the your key assignment list to C:\_DAT\APNAME.LST, close any open applications then press CTRL+ALT+DEL to reboot the computer.

Adding System Manager Sessions

Wouldn't it be great if your favorite program could edit two files at once instead of just one? Or maybe two people could switch-off playing TigerFox—with different game boards running at different speeds. Don't complain to the programmer, fib to the computer: tell it you have two editors or two games, when you really only have one.

System Manager compliant programs that use different data files, such at text editors, and programs that use no files at all and no shared system resources, such as many games, can frequently be assigned to more than one key at the same time. This means that you can run more than one copy of a program (called an instance) at the same time.

Each instance is invoked (loaded) separately from its own hot key, and uses its own memory. And you can switch between each copy with the hot keys. This APNAME.LST example tells the computer to load Hearts&Bones via the ALT+H keystroke, and a second copy when you press ALT+B:

C:\_SYS\HB.EXM,2300,Hearts&Bones
C:\_SYS\HB.EXM,3000,Bones&Hearts

Remember, though, that when programs exit they often create or update the same configuration file, so settings from the last one out of memory will prevail. Keep in mind also that each is a separate program, oblivious to the others' existence, so each will consume the full amount of memory required by the complete program—there is no code or data sharing.

If a program can make use of data from the clipboard, you can share information between instances by shuttling it back and forth through the clipboard.

 Notes About The System Manager

•	The APNAME.LST file must be in the C:\_DAT\ directory.

•	After you edit APNAME.LST, you must reboot the computer before the changes will take effect. First close all open applications, then reboot by pressing CTRL+ALT+DEL.

•	You can't change the name of a program file to the EXM extension and expect it to run!

•	Documentation that comes with application programs will state whether they are System Manager compliant or not.

•	If you load any TSR programs from Filer, the computer will no longer be able to recognize your custom key assignments. You should load TSRs from AUTOEXEC.BAT or, if possible, as device drivers from CONFIG.SYS.

•	Don't copy XIP programs from plug-in cards to the C: drive. Besides violating copyrights, program files can become fragmented and they will undoubtedly crash the computer when you try to run them.

Notes About Hot Keys

•	Don't assign programs to important keys. For instance, changing the MENU, or FILER key could leave you dead in the water, with no way to recover short of doing a cold boot and re-initializing the RAM disk.

•	You cannot reassign keys that return standard ASCII character codes below 128.

•	Try assigning the same program to two different hot keys. This will give you access to multiple copies of the program, and you can edit different files with each copy. Remember, though, that each copy of the program runs independently, and will require additional memory.

•	Avoid assigning programs to ALT-modified character keys. ALT+H is mnemonic and easy to remember, but it's also likely to conflict with another program (some programs use ALT+H to open a help screen). Remember that Lotus 1-2-3 uses ALT+ letter key combinations to play-back macros.

•	You can hide applications by assigning them to unlikely key combinations (who would ever think of typing CTRL plus the equals key?).


Calling Hearts&Bones and TigerFox

Everybody wiles-away idle moments with the HP 95's TigerFox game; just switch to Filer and run TF.COM. English-language HP 95s include two versions of TigerFox: the one root directory in the file named TF.COM, and a second named TFOX.EXM, hidden in the C:\_SYS\ directory.

Also in the C:\_SYS\ directory is another, more challenging game, called Hearts&Bones, in the file named HB.EXM. With these new EXM programs, thanks to the Applications Manager, we can squander time more conveniently: while other applications are running!

These programs are Applications Manager compliant. You can switch between them and any other built-in application program. You cannot run these programs, or any program with the EXM file name extension, from the DOS command line (though, of course you can run TF.COM).

Before you can run these programs from hot keys, you will first need to create a file named APNAME.LST containing the hot key assignments. The APNAME.LST file must be placed in the C:\_DAT\ directory. Say you want to assign TigerFox to the ALT+T hot key, and Hearts&Bones to ALT+H, here's what the APNAME.LST file looks like:

C:\_SYS\TFOX.EXM,1400,TigerFox
C:\_SYS\HB.EXM,2300,Hearts&Bones

After you reboot your computer, everything will look the same, but now when you press ALT+T, TigerFox will pop-up, even if you're in the middle of balancing your checkbook with Lotus 1-2-3. To make it even more cool, you can switch between TigerFox, Hearts&Bones, and any other built-in applications with the new hot keys.


Programming the HP 95

Lotus 1-2-3 is often called "The programming language for non-programmers;" when you consider Lotus macros, maybe it is a real language. HP Calc is malleable, especially in regard to the calculator's HP-Solve function. Of course, DOS' batch command language fulfills most of the technical criterion of a real programming language, but many people discount batch because of the mediocre performance and limited data and control structures.

Writing software to run on the HP 95 and other PC-compatible computers requires understanding of the underlying hardware. At this level of complexity, anyone who tells you he's an expert on PC-compatibles is most probably misinformed. The only way to grow is through conscientious ignorance: learn what not to learn, and study the rest well.

Creating useful programs is still an individual process, but competing requires tools, time, understanding, peace and passion.

The HP 95 Programming Environment

The Fiat 850 Spyder, circa 1970, was perhaps the ideal sports car: beautiful, small, nimble, fun andquirky. You could drive it flat-out without getting tickets. The HP 95 is much the same. It's fun in that you have to write efficient, elegant code (no room for bloated, inefficient languages here). It's quirky in that... well just look at it, the AC adapter is larger than the computer.

Programmers have long used the best or largest or fastest machines available when writing software and manuals—in fact some new development tools require at least an 80386 processor. The problem arises when the developer uses only high-powered, high-ticket, high-bulk machines for testing; it's up to the end user to discover that the program is a slug. The ideal place to test HP 95 code is on the HP 95. Add at least one RAM card, to quickly recover from crashes.

The HP 95 uses a V20 processor. You can think of the V20 as a real mode-only 80286. The V20 is plug-compatible with the 8088. For an investment of less than $20, the V20 not only improves the performance of your PC-XT, but it makes it possible to test code fragments on your PC.

HP 95 Development Tools

For serious development work, you will need professional languages and a powerful PC with a hard disk. Today's compilers often need over 10 megabytes of storage.

For casual work (especially when System Manager compliance is not important), DEBUG and a copy of GWBASIC that will run on the 95 (from MS-DOS 3.2 or 3.3) are good starting points. But real programmers don't use interpreted languages (at least not when anyone is watching), they want real compilers.

GWBASIC, which is furnished at no extra charge with most versions of MS-DOS before version 5.0 (but, as you've noticed, not HP's version of DOS 3.22), runs mostly successfully on the HP 95. A few keywords may be incompatible. The BEEP and SOUND keywords, for instance, can make the speaker "stick" on (if you try this, you will have to reboot the computer to turn the speaker off). Test programs carefully, and save often.

We frequently use standard MS-DOS-based programming languages for writing larger HP 95 applications. Themain considerations are efficiency, compatibility, and System Manager compliance. Bulky editors and over-sized runtime modules just won't make it in the 95 world. The HP and Lotus programmers used Microsoft C ($495 list price) and Microsoft Macro Assembler (also known as MASM, $150) to create the HP 95. The latest Microsoft C optimizing compiler often makes code as good as or better than assembly (it's more daring, it'll optimize long functions, and it never gets lazy or takes the easy way out). Your compiler's 80186 or 80286 switch will improve performance and efficiency on the HP 95.

The author used Microsoft MASM 6.0 to write the original HP 95 Utility Pack; it was a good choice because of development speed (improved macros and structures), and of course nothing makes smaller programs than assembly language. The Utility Pack is made up of about 10,000 lines of assembly language source code (commonly used code is replaced by macros, which cuts source size and minimizes errors). The Productivity Pack is much larger than the Utility Pack, yet it has fewer programs. Here's the only secret about writing in assembly language: It takes a lot of code to do anything, so the more information on the screen—as many as 50 or 60 lines—the easier it is to follow program logic.

Microsoft C and MASM are excellent tools, but they aren't designed for the HP 95. Languages and tools from other vendors have the same problem: they don't have "hooks" to the System Manager or other HP 95 features. Until HP 95 development tools and libraries are available, most products will be DOS applications adapted for the 40-column display.

When development tools that take advantage of HP 95 built-in features are available, use them. This will make your applications smaller, friendlier to use, and at the same time faster and easier to write. Instead of reinventing wheels, using System Manager calls starts from a well-known prototype (instead, reinvent hubcaps?)

As of this writing, there are no programming languages or libraries written specially for the HP 95. A Forth interpreter may be available in limited distribution.

You will also need books on MS-DOS and the Phoenix BIOS; both are available in larger book stores. MS-DOS is the most explored and best documented computer operating system ever written.

If you write straightforward programs without using undocumented hooks (BIOS calls are fine, though), keeping in mind the 40x16 display, most Microsoft C, QuickC, QuickBASIC, and Microsoft BASIC 7.1 programs, as well as Borland Turbo Pascal and C code, should run happily on the HP 95.


Exploring MS-DOS

The DOS in MS-DOS stands for Disk Operating System. Operating disk drives is what MS-DOS is all about. We communicate with DOS (that's the shorthand way of saying MS-DOS) by typing instructions on the command line. These instructions tell DOS to do things like create, copy or delete files, and to run programs.

Applications programs also depend on MS-DOS for disk management. Even when a program is running (including the HP 95 built-in applications), DOS is in the background, handling requests for files, memory and other system-wide services. MS-DOS handles the internal gubbins, leaving the interesting parts to application programs.

The MS stands for Microsoft, the author and distributor of the operating system. PC-DOS is just about the same thing, behind an IBM nameplate.

Abstract MS-DOS

The language of MS-DOS is full of words like paths, pipes, templates, streams and switches, and a collection of rather strange single-character commands. When we're done here, these symbols really will mean something:

/  +  *  .  :  ?  |  >  <  \  !  "  %

The DOS language is brief and easy to remember, but it's not English-like. Some people in the computer business take the word language too literally. They reason that if it's supposed to be a different language, it shouldn't look too much like English. Popular programming languages like C (pronounced "See") add an extra level of abstraction by representing lots of tasks by a single character; maybe we could call it low-rogrylphics (not to be confused with hieroglyphics).

For instance, in the C language the exclamation mark ("!") means not, while if you tack-on an equals sign it means not equals ("!="), and the star ("*") means different things depending on where it appears—and depending on how many stars there are (C is a four-star language). The new-age version of C, called C++ (pronounced "See plus plus"), adds even more abstraction, but missed the opportunity of straightening up the original C obscurities, and even adds more (like a new colon-colon :: keyword). Luckily, DOS isn't quite that abstract.

Stepping off the soap box... Now, since the programming community can't make it easy on themselves, there's no reason to expect them to make it easy on us users. We really shouldn't blame programmers: they don't get out very often, and a diet of pizza, cola and candy can have deleterious effects on people.

A Little Less Abstraction

Shorter commands save typing. And they are, once you've committed them tomemory, easy to read. Another coined term we'll introduce is brain-clock-cycles. Languages are symbolic representations of things and ideas. The goal of DOS' short-cuts is to make symbols recognizable quickly, and without having to pay too much attention—cutting clock cycles.

You may be tempted to skip the section on redirection and piping, one of the most abstract aspects of MS-DOS (especially if you skipped the section on binary numbers). Please don't, because while you'll probably not need it often, it's the foundation and reasoning behind many of the heuristic-machinations we go through.

Exploring MS-DOS From the 95's Filer

Filer is a wonderful place to explore DOS' file chain. It displays a sorted list, and you can look at the contents of any file by moving the hi lighted selector to the file name and pressing ENTER. The most powerful Filer command, though, is Goto (the F5 function key). Goto changes to a different directory, a disk drive, and can even view a file—with a twist: the directory or file can even be hidden.

Let's look at a corner of your 95 you may never have seen before: the hidden \_SYS\ directory on drive C:. Press the F5 key, then at the "Goto: File or directory name:" prompt, type:

\_SYS

The screen shows the directory name followed by a new list of files. You can confirm that there are about 27 files in this directory (at least, in the English language HP 95); press MENU, then select Directory Status. Filer will display information about the disk and directory:

C:\_sys
Subdirectories:           0
Files in directory:       27
Bytes in directory:       196479
Bytes remaining on disk:  122368
Volume label:

Now press ESC to return to the file list. The first file in the directory is 1000.PCX, which you will recall is the picture of a $1000 bill. Now if you press ENTER to view the file, you won't see president Cleveland, but a screen-full of smiling faces, upside-down T's, and random-ish characters. Press DOWN or UP to browse through the file; it doesn't get any more readable than this. Most of the files in this directory look just as garbled. These are binary files, containing information encoded in binary instead of ASCII text. Lotus 1-2-3 WK1 spreadsheets and program files are also binary, but you'll find text and messages here and there.

Files can also be hidden, just like the hidden C:\_SYS\ directory. The HP 95 includes several hidden files in the C:\ root directory. Press F5 again, and at the prompt type:

\ROMDUMMY.015

This large file is chock-full of the messages and prompts displayed by the HP 95's built-in applications. When you press Esc to return to the directory list, you're back in the root directory.

Notes About Filer

•	Goto also changes disk drives. You can specify both a disk drive letter and a directory at the same time.

•	Filer sorts files by name for display only. It does not sort the files on the disk.

•	While Filer can look at hidden files and directories, it doesn't include any mechanism to hide or un-hide files.

•	When you use Filer's Goto command to view a file, and specify a complete path with the file, not only will Filer show the file, but it will place you in that directory.

•	Use Filer's RENAME (F8 key) command instead of MOVE (F10) when the destination is on the same disk. MOVE copies then deletes the original, while RENAME just changes the directory entry.

•	Selecting COMMAND.COM does the same thing as MENU System, and takes the same amount of memory.

•	Filer's System command is the gateway to MS-DOS. When you use Filer's System command to go to the DOS prompt, you will be logged-onto the same directory you used in Filer.

•	Don't leave Filer running when it is not needed. The program uses battery power to constantly poll the serial port. This can noticeably reduce battery life.

•	Avoid loading TSR (Terminate and Stay Resident) programs from Filer. This reserves more memory than the programs should require and can make the computer unstable.


MS-DOS Command Line

We can follow two similar courses to reach the MS-DOS prompt from the safe harbor of Filer: Press MENU then select System, or move the selector bar to COMMAND.COM in the file list then press the F4 function key. Both methods leave the same amount of memory available for MS-DOS applications.

(Type exit to return to Filer)

Microsoft(R) MS-DOS(R)  Version 3.22
             (C)Copyright Microsoft Corp 1981-1989.

C>

Pretty austere, isn't it? While you're at the DOS prompt, none of the HP 95 built-in applications are available; pressing the 123 key does nothing at all. You will have to return to the safety of the System Manager and Filer to gain access to the built-ins. To get back to Filer in a hurry, type EXIT then press ENTER.

 Note:  Remember to close all applications except Filer when you shell-out to DOS. If an application is open, the computer will remind us—we really don't have any choice in the matter. This is just as well, since we can be assured that all data files are closed.

It's difficult to lose or corrupt data from closed files. Since all of the HP 95's built-in applications are closed when you exit to MS-DOS, there is little concern about losing data if a DOS program crashes—unless the crashed program corrupts the disk.

The MS-DOS Command Editor

The MS-DOS command line editor is a primitive contrivance. The editor remained virtually unchanged for the first ten years of DOS' existence (the command editor was finally updated it in 1991, when Microsoft introduced MS-DOS 5.0). If you find the editorbalky and unfriendly, don't worry about it, millions of other people do too.

A thriving cottage industry offers enhancements or replacements for the DOS command line. The HP 95 Filer is a typical command line replacement: easy to use, but missing a few essentials. No matter how good the command line replacements may be, sometimes you need the flexibility of the MS-DOS command line; it's worth the time you'll spend getting to know it. Even if the built-in applications do everything you want from your HP 95 today, somewhere down the road you will still need to turn to the MS-DOS command line.

 Note:  The MENU, 123 and other special keys are unique to the HP 95. Since other computers don't have these keys, software is not designed to recognize them, so programs either will ignore the keys entirely, or the keys will be mis-interpreted as something completely different (and likely not very useful).

DOS Command Template

One of the nicest features of the command line is the previous command you typed is available as a template you can use to type the next command. Many DOS users ignore the template and re-type each command; the small keyboard on the HP 95 encourages us to save keystrokes—that's the real strength of the template. Let's walk-through a few exercises using the template and the DIR command.

The DIR (short for directory) command lists information about files in a disk directory. The directory is similar to the table of contents in a book, listing chapters, and where you'll find them in the book. Every disk has a directory, the section of thedisk that contains information about files and their size and location on the disk. DOS' DIR command lets us look at the table of contents of a disk. Using it is as typing the name on the DOS command line:

DIR

If the last command line began with DIR and you'd like to see another directory listing, pressing either the F1 template key or the RIGHT (right cursor) key four times will bring-back the word and the space after it. Each time you press F1 or RIGHT, one character from the template is copied to the command line. Now, DOS will place the cursor atthe end of the line so you can add the new file specifications.

DIR *.COM

If you mis-type a character, press BACK (Backspace) or LEFT (the left cursor key) to delete the typo. Remember that the cursor is always at the end of the line, so you'll have to erase everything, backing-up to the mistake, then retype the character.

When you press ENTER, MS-DOS will show a listing of all COM program files in the current directory. If you're in the root directory of the C: drive, DIR will always show at least two COM files: COMMAND.COM and TF.COM.

Suppose we were looking for CHKDSK, which we thought was a COM program. Apparently it's not, so we'll recall the command line, up to the dot, by pressing F1 six times. Watch the display: after each key press, DOS will copy another character from the template to the command line:

DIR *.

The cursor is at the end of the line, just past the dot. Now we can type the EXE file name extension then press ENTER to see the directory entry for CHKDSK.EXE (and any other programs with the EXE file name extension).

DIR *.EXE

Keep in mind the difference between the command line and the template: the command line is where you type new commands, while the template is where the previous command is stashed. As you edit the command line, you can copy parts of the template into thenew command. Here's a summary of the template keystrokes.

DOS Template Editing Keys

Keystroke	Purpose

F1 or RIGHT	Copy one character from template to the command line.

F2	Copy the template, up to the character you specify.

F3	Copy the remainder of the template.

F4	Delete from current position to the character specified.

F6 or CTRL+Z	Places an end of file marker (character 26) in the line.

BACK or LEFT	Delete character before the cursor. Template is unchanged.

DEL	Delete a character in template at the cursor position.

INS	Insert characters at cursor position in the template.

ENTER	Accept the command line. Tells DOS to execute command.

ESC	Cancel the command line. Does not change the template.

ALT+Cursor	ALT plus any cursor key (or ALT+SHIFT and a cursor key) scrolls the HP 95 window around the full 80x25 display. ALT+ cursor key tracking is available only on the HP 95.

We'll talk about MS-DOS wild cards in a few minutes, but DIR is a prime candidate for using wild cards, so here's a preview. The F1 and F3 keys make it easy to use the previous command as a starting point for new commands. Say instead of EXE files, you want to see a listing of EXM files (those are the special HP 95 Application Manager compliant programs). Press F3 to recall the entire template:

DIR *.EXE

Now press LEFT or BACK to erase the E from the end of the line, then replace it with M. Finally, press ENTER.

Volume in drive C has no label
Directory of  C:\
File not found

What happened, we know there should be at least two EXM files? Remember, the HP 95 ROM includes System Manager versions of TigerFox and Hearts&Bones, which are in the hidden C:\_SYS\ directory. We're logged-onto the root directory of the C: drive, so we'll have to tell DOS where to look for the files.

 Note:  Unlike the HP 95 Filer program, DOS' DIR command does not sort file names in directories. Sub-directory names will not be placed at the top of the list. MS-DOS writes files to the directory in the order they are created; as files are added or deleted, the order of files in the directory will change. You might try using a utility program (such as Norton Utilities) to sort the directory, and write the sorted list back to disk, but some utilities may have a fit when they try to re-order files that are permanently burned in the HP 95's ROM.

Let's modify the command line to add the path so DOS will be able to find our missing files. First press F1 four times to recall the word DIR and the space. Now, press SHIFT+DEL (that's the equivalent of the INS key on the HP 95) to enter insert mode then add the directory to the command line:

DIR \_SYS\

When we move the cursor or recall anything from the template, the command line returns to overstrike mode. The rest of the command is still in the template, so we can press F3 to recall the remainder of the line:

DIR \_SYS\*.EXM

Now when you press ENTER, DOS will find the files in the \_SYS\ directory, and display their directory listings:

HB       EXM     6702   3-29-91   4:34p
TFOX     EXM     8315   3-18-91   1:54p

Instead of pressing F1 several times to copy the beginning of the template to the command line, this time let's try F2. This command requires an argument: the first character on the line that you don't want. DOS doesn't display the character you type, so it's time for some visualization. To copy the template up to, but excluding the file name extension, press F2 then E (the first character in the file name extension):

DIR \_SYS\*.

Now type the new extension. The on-line help files for the HP 95's built-in applications are in the \_SYS\ directory, so type the HLP extension:

DIR \_SYS\*.HLP

 Note:  The DEL key works on the template, not the command line (that's what the BACK and LEFT keys are for). Since the cursor is always at the end of the command line, there would be nothing to delete there, anyway.

Here's the last example of reusing the template. This is an outlandish way to save a few keystrokes, but follow through anyway, some of these maneuvers are quite useful. We'll look at the setup files (file names ending with ENV) in the C:\_DAT\ directory, so to recall up to the underscore in the template, we'll press F2 then S:

DIR \_

Now we'll delete the next three characters from the template by pressing DEL three times to delete three characters from the template. The display hasn't changed, but the next characters in the template are "\*.HLP". The default is over type mode, so we'll change to insert mode by pressing SHIFT+DEL (the insert mode key, again). Now type D A T:

DIR \_DAT

We still need the next backslash, star and dot from the template, so we'll press F2 followed by H to recall up to, but not including, the extension:

DIR \_DAT\*.

Now we can add the extension (ENV), then press ENTER to see the matching files:

DIR \_DAT\*.ENV

That's it, probably the most roundabout way to save a few keystrokes. In real life we would probably press F2 then D, then since the template is in overstrike mode anyway, we would just overwrite the SYS with DAT. The backslash character is a shifted keystroke on the HP 95, so we would probably press F2 again and type the remainder of the command, just as we did before.

If you aren't in the root directory, prefixing a drive letter to the file specification doesn't mean the root directory—it just means the drive, without specifying any path, which means the current path. Say you're still in the C:\_DAT\ directory, this next command would seem to show the root:

DIR C:*.COM

It actually shows the files in the current directory! This is because it's possible to be logged-onto other than the root directory of more than one drive. If you're logged-onto the A: RAM disk, the C:*.COM path will show the matching files in C:\_DAT\. To be sure you get the root directory listing, you must specify the full path name; in this case, that means just adding a backslash:

DIR C:\*.COM

These exercises show the template as a powerful, yet goofy-looking tool. It's especially useful with the small keyboard and frequently shifted keystrokes of the HP 95. We copy the template to the command line, then we use the template editing keys to (usually) make the job easier.

 Note:  If you make a typing mistake and would like to start over again, yet still re-use the original template, press ESC to erase the command line. The command line will be cleared, but the template is intact. The template is versatile, but you're working in the dark. You can also use this feature if you've forgotten what's in the template. Press F3 to recall the entire line to the display, then press ESC to cancel; the cursor will move to the next line, but DOS will leave a copy of the template on the line above.

 Note:  With most versions of MS-DOS, the template from the previous command line is usually available, even after executing large applications programs.

One feature unique to the HP 95 is the longevity of the template. The previous command line is always available, even after you reboot the computer—it just won't go away! In fact, when you first move from Filer to the DOS command line, you can press F3 to recall the previous command (which will probably be EXIT, the command you typed to return to Filer).

Almost miraculously, the HP 95 will recall the previous command line after a cold boot—even if you've re-initialized the RAM disk (though not after you've enlarged the RAM disk, and reduced conventional memory). Just about the only way to get rid of the old command (short of entering a new one, but that's too easy) is to unplug the AC adapter, remove the batteries and let the computer sit for a few minutes until it's completely forgotten its purpose in life (and the contents of all of memory, and the C: RAM disk).

Notes About The Template

•	You can use the F2 key several times while editing the same template, recalling a few characters at a time, then inserting or deleting others.

•	Another interesting use for the template F2 function is to recall just the command name without anything that follows. Since a space separates each command and whatever arguments it requires, pressing F2 then the space bar tells DOS to copy the command name from the template, up to the space character, then place the cursor on the right.

•	If you start to reuse the template then change your mind, press the ESC key. This clears just the command line; the template is still there, unchanged, so you can reuse it as if nothing had happened.

•	Relax, you can forget about the template and all those editing options; they aren't mandatory. Most of the time we just type commands as we need them, and ignore the rituals and eccentricities.


MS-DOS Commands

These commands are the language MS-DOS understands.

MS-DOS recognizes two basic types of commands: internal, built-in commands (such as CLS or EXIT, or as we've already discussed, DIR), and everything else (external commands like CHKDSK.EXE or user programs like TF.COM). External command is just another way of saying utility program. External DOS commands in program files are treated exactly like any other program. You can circumvent the confusion of what to call things by calling everything a command, or the more generic term: keyword.

If the MS-DOS command processor recognizes the keyword as an internal command, it carries out the request immediately. However if it isn't a command DOS recognizes, the command processor assumes it must be a program, so it searches the disk for a program file with that name to run.

The MS-DOS command processor recognizes three program file types for external commands: COM, EXE and BAT (short for command, executable and batch). MS-DOS searches for program file types in just that order; if you have two programs with the same name, but one has the COM file name extension and the other is an EXE, DOS will run the program with the COM extension. Say you create a batch file named TF.BAT, when you type the TF command—even if you include the BAT extension—DOS will run the version of TigerFox in the TF.COM program file anyway.

 Note:  If you have experience with HP BASIC, you're used to running programs with a CALL or RUN statement. Since everything in DOS that isn't built-in is a program we call, preceding the command with CALL is unnecessary. There is a wonderful simplicity in DOScommands; no extra quotation marks or odd-looking delimiter characters, just a shorthand language. Many DOS commands have even shorter, abbreviated forms (like typing CD instead of CHDIR).

Arguments and Switches

Arguments are options we type on the command line following the keyword. These options modify how commands and programs work. MS-DOS passes the tail-end of the command line (called the Command tail) to programs without change. Each program recognizes different options, and some programs use none at all.

Switches are a type of argument, usually beginning with a forward slash ("/"), followed by one or more other characters. Additional arguments, like file names, are simply preceded by a space. MS-DOS interprets only redirection symbols, everything else is sent unchanged to the program or command—the commands interpret these arguments.

As we've seen, the DIR command displays information about files. We can enter just the command alone on the line to see a simple directory listing:

DIR

MS-DOS will interpret this as meaning "Show me every file in the current directory." Here's a listing from the root directory of the HP 95's C: RAM disk:

 Volume in drive C has no label
 Directory of  C:\

COMMAND  COM      184   2-11-91  10:36a
CHKDSK   EXE     9680   2-11-91  10:37a
_CFLOW   WK1     4418   3-20-91   7:38a
_EXPENSE WK1    12406   3-20-91   7:38a
_STAT    WK1     5444   3-20-91   7:38a
TF       COM     8170   3-20-91   7:38a
_HOMEBUY WK1     4362   3-20-91   7:38a
_CARLOAN WK1     5232   3-20-91   7:38a
_DAT         <DIR>      4-01-91
123      CNF      376   9-04-92   2:47p
95       COM     2015 7-02-91  12:02p
AUTOEXEC BAT       71   8-10-92   1:23a
BATTERY  COM      128   3-23-92   9:29p
CONFIG   SYS       46   8-10-92   1:02a
       19 File(s)    156672 bytes free

What if we want to see only a few files, or maybe another directory? Or more likely, the listing is so long that much of it scrolls off the screen before we can find what we're looking for. We can add a command line switch or a file name, or even both.

As we said, a special switch character often differentiates command line switches from file names. By conventions set by MS-DOS, switches begin with the slash ("/"), but a few programs require a minus sign ("-") instead. For instance, the /W switch tells the DIR command to do a multi-column listing of file names without file sizes or date stamps:

DIR /W

This form of the DIR command tells MS-DOS to display a wide directory listing. On desk bound PCs, the listing is formatted for 80-columns (or as much as will fit within the display width); DOS 3.22 on our HP 95 formats the list for 40 columns:

COMMAND  COM  CHKDSK   EXE  _CFLOW   WK1
_EXPENSE WK1  _STAT    WK1  TF       COM
_HOMEBUY WK1  _CARLOAN WK1  _DAT
123      CNF  AUTOEXEC BAT  BATTERY  COM
CONFIG   SYS

Since the DIR command assumes that we want to see every file, we frequently enter the command without the *.* path specification (as we just did). This is the same as:

DIR /W *.*

If the file list is still too long for the 16-line display, DIR also recognizes the /P switch to tell it to pause at each screen-full of files. You can use several switches together, though most programs require that a space separates each switch:

DIR /W /P *.*

 Note:  Don't confuse the forward slash "/" switch character with the back slash "\" used for directory paths.

Wild Cards and Directory Symbols

Say you want to see a list of just HP 95 Memo program TXT files, or a list of only the Lotus spreadsheet files that begin with "JAN." That's the job of MS-DOS wild cards. DOS' wild card characters are place holders, representing zero or more unknown characters. When you specify files using wild cards, MS-DOS will repeat the command for each file that matches the patterns.

The two wild card characters are the question mark ("?") which represents any single character, and the star ("*") representing any number of unknown characters—or none at all. Here is a summary of the most frequently used DOS symbols and combinations:

DOS Shortcut Symbols

Symbol	Meaning

..	The previous directory up the tree.

*.*	All files in the current directory.

*.	All files without an extension.

*	Usually means *.*.

?	Any single character.

.	The current directory.

\	The root directory of the current drive.

/	Switch prefix.

-	Switch prefix (less common).

Notice that this list combines wild cards and directory shortcuts. This is because one can often be substituted for the other.

In DOS, we most frequently use wild cards with COPY, DEL and DIR commands; our examples will use DIR. DIR is always non-destructive, you can experiment with various ways to apply wild cards using DIR without the possibility of damaging or erasing files. These examples should encourage you to follow a consistent file naming strategy, which will make it easier to locate and identify files.

 Note:  You can use DIR to test wild card names before committing files to history with DEL. Try the file specification first with DIR and watch to make sure the directory listing matches only the files. When you're satisfied with the file listing, type DEL then press F3 to recall the file name from DOS' command template.

The question mark wild card represents any single character at one place in a word. DIR recognizes P?D as PAD, POD, but it could never stand PAT—it requires an exact match for every character position except where the question mark appears.

DIR P?D

The question mark is again useful when we are looking for several similarly named files, such as a series of daily reports. If you name your spreadsheet files using the date as a number beginning with the year, such as 970804.WK1 for August 4, 1997, you could use wild cards to search for just the August files:

DIR 9708??.WK1

When several characters may match, such as they might above, we often use the star ("*"), which matches zero or more characters. We could rewrite the last example as:

DIR 9708*.WK1

This says to DOS: "Show me all spreadsheet files with names beginning with 9708, and followed by any other characters." However, since the star is a place marker for any number of characters, files found could include 97080000.WK1, and even 9708.WK1—as many characters as are allowed to follow, or none.

The star is all-encompassing, every character following the star is ignored. If we're looking for files from any year, but only August, we might be tempted to specify something like:

DIR *08*.WK1

What we would get, though, is a list of all WK1 files. Keep in mind that while we can use any number of question marks, everything following a star—up to the dot for the file extension—will be ignored. The star always takes precedence over the question mark.

If the star is too flexible, try using several question marks. When a question mark is the last character in the name, it will match a single character, or none. Continuing with the same naming convention, his example will find the files from any year and any day,for a total of up to six characters, but it will also find ??08.WK1 files:

DIR ??08??.WK1

Both MS-DOS wild cards also work with file name extensions, following the same rules and inheriting the same quirks. Star will look for files with any extension, and the question mark represents any single character.

DIR *.EX?

We could say "*.*" with wild cards, a shortcut meaning any file with any extension in the current directory. So to look at all of the files in the current directory we would usually type:

DIR *.*

The shortest-cut of all is just a dot ("."). A single dot is a synonym for the current directory name, without specifying any files. DOS will fill-in the blanks, implicitly adding the "*.*" string, to interpret this shorter version just the same:

DIR .

DOS is a Disk Operating System—there are lots more disk commands like DIR. Here's a look at interesting uses for some of these commands.

Some More File Commands

Command	Notes

CD _SYS	Change to a different directory.

CD ..	Change to the next directory up in the tree.

CHDIR _SYS	Synonym for CD.

COPY a b	Copy a file from one place to another. You can specify a path only or a path and new file name for the destination.

DEL _SYS	When used with a directory name, deletes all files in the directory. With a file name, it deletes all matching files.

DEL .	Works like DEL *.*

ERASE _SYS	Synonym for DEL.

RD _SYS	Short for "Remove Directory." Deletes empty directories

REN a b	Rename a file or group of files. Cannot be used to rename directories.

 Note:  If you've used programming language like HP BASIC, DOS commands may seem strange looking. There are no strings in MS-DOS, so it isn't necessary to put file names in quotation marks. Second, there is no TO keyword in the COPY command; just type two file names separated by a space.

Two useful internal commands are TIME and DATE. The HP 95 Setup program has menu entries for setting the time and date, but many people prefer to set the time in DOS, since the format is simpler and you can leave out the seconds or add everything down tothe hundredth for absolute accuracy (or we can pretend that it's absolutely accurate). Simply type the command name at the DOS prompt:

TIME

DOS will show the current time and ask you to enter the new time:

Current time is  14:02:28.00
Enter new time:

You can type the time in 24-hour format, separating the fields as in the example. When you press ENTER, DOS will set the internal clock. If you change your mind and decide not to set the time, press CTRL+C. The DATE command works exactly the same.

 Caution:  DOS commands are so short and simple that it's just as easy to do damage as good. Be careful about COPY and DEL, especially with wild cards. Once a file is deleted or overwritten, it's gone forever.

In Filer, the Goto command makes changing to another directory or disk drive, or even viewing a file a simple fill-in-the-blanks affair. DOS is just as easy, but there are a few things to keep in mind, as we've seen. TYPE replaces the file viewer, CD changes directories, and to change to a different disk drive we just type the drive letter:

C:

 Note:  If you try to change to a bad drive letter (say, A:, when there isn't a card), Lotus 1-2-3 won't stop you. From then on, you are stuck with the bad letter and must exit from the program to straighten things up.

DWIM: Do What I Mean

DOS commands like DIR expect all sorts of vague path and file names. DOS will put up with a lot of typing abuse. The process is known as Do what I mean, or DWIM for short. If you leave out a name or a few characters, MS-DOS will still try to make sense of it. You can enter commands and path names in several strange ways, and commands—actually DOS' command processor—will figure out what you mean.

The file specification in the command above could also be written as ".\*.*" because DOS automatically fills-in the missing file name. In fact, we can take further advantage of the intelligence of DIR by not specifying anything:

DIR

DOS will assume we mean the current directory, so it will fill-in the missing star-dot-star. Two dots means the next directory out of the tree. We can see a list of all of those files with "..\*.*" or even the shortcut version, and let DOS fill-in the missing file name:

DIR ..

Internally, MS-DOS always expands file name. It converts every character to upper case, then it replaces stars with question marks until the file name fits into this template:

????????.???

After expanding the name, DOS makes the comparison by expanding disk file names into the same template. If you specify "*.TXT" MS-DOS will expand the template to:

????????.TXT

The disk file, perhaps README.TXT, is coerced into:

README??.TXT

Following the question mark wild card rule, we have a winner. These file names match. When DOS displays the file name, it replaces the question marks with spaces.

Notes About Wild Cards

•	When the question mark wild card appears at the end of a word, it can represent any single character, or no character. COMMAND?.COM will find the file COMMAND.COM. However, when the question mark is at the beginning or within a word, a character is required at that position; COM?MAND.COM would not find COMMAND.COM.

•	You can use wild cards only with file names, and to find paths, not to search wild card paths for files. For instance, DIR ?DAT will find the \_DAT\ directory, but DIR \?DAT\ will not find the files in the \_DAT\ directory (DOS will return the "Invalid directory" error).

•	You can often abbreviate "*.*" as just "." (the dot). The dot represents the current directory, and therefore every file in the current directory, while "*.*" represents any file name with any extension—which is really the same thing.

•	Programs aren't always consistent about handling of wild card characters. Many programs (such as text editors) don't allow wild cards at all.

•	Many programs accept wild cards file names; this often will tell the program to load a list of matching files. Since the wild card mechanism is built-into MS-DOS and is available to programs, most programs simply use the DOS services without change, soit's well worth the bother to familiarize yourself with how wild cards work.

•	DIR really is flexible: it will accept a file name without an extension, then assume the ".*" extension. If you want to see only files without an extension, you must add the dot after the file name. DEL, on the other hand, requires the properly specified file extension—which is actually to our advantage, adding a bit of extra security to this potentially destructive command. "DIR X*" will show all files with or without an extension, while the DEL command recognizes "X*" only with files having no extension.

•	Most programs ignore any extra non-blank characters following the three-character file extension. If a command asks for two file names (such as REN, which asks for the original and new file name) and you leave out the space between them, DOS will truncate everything beyond the three-character file extension, including the second file. Since DOS will miss the second file name, the error message it returns may not fit the crime.

The Trouble With Arguments

In its infancy in the early 80's, MS-DOS didn't recognize disk directories, or for that matter any kind of storage beyond floppy disks. The forward slash, commonly used (then and now) by other operating systems to delimit directory names, wasn't needed. So DOS programs used it for the command line switch character (even though the minus "-" was already in common use at the time). When MS-DOS matured, lo and behold the forward slash was already taken, so the backslash became the directory name delimiter.

Today, MS-DOS internal commands and utility programs follow the slash-convention. Some programs—throwbacks or programs imported from the UNIX operating system—still require the minus. To further confuse things, DOS allows the minus in file names. In attempts to appease everybody, some programs recognize both the slash and minus.

 Note:  We usually enter switches on the line before file names and path specifications. Often this is just a convenience, but many programs will ignore commands that follow file names or—worse yet—they will interpret them incorrectly and show error messages and warnings or refuse to work.

Programming utilities usually require the switches before the file specification. DOS external commandsaren't as consistent. For instance CHKDSK can accept the file name anywhere, while MIRROR, a command from MS-DOS 5.0 and later, requires the disk drive letter before any switches, otherwise the drive letter will be ignored.

When the command or program expects two file names, remember that the source file comes first, followed by the destination file.

Here are a few hints for avoiding the trouble with arguments:

Notes About Arguments

•	Many programs require a space to separate each argument. Avoid crunching-together several switches.

•	Avoid beginning file names with the minus sign. Some programs don't require spaces between arguments, so it's best to avoid the minus anywhere in file names.

•	Instead of using a minus sign to separate two-word file names, try the underscore character. On the HP 95, press SHIFT+= (the equals key) to type the underscore.

•	When in doubt, type commands with all other arguments preceding file or path names.

•	If all else fails, maybe it's in the manual.

Pausing and Canceling Commands

When directory listings go scrolling off the top of the screen, you can always execute the command again and hope you see the file you're looking for this time. As we've seen, there's another option: the /W switch, which shows a multi-column listing of just file names. There's yet another solution if the list is still too long, or if you want to see file sizes and date stamps (and for programs and commands that don't recognize the /W stitch.

Three special keystrokes give us more control over how MS-DOS commands work:

Keystroke	Purpose

CTRL+S	Suspends program display until you press another key.

CTRL+C	Cancels the program, returns to MS-DOS.

CTRL+BACK	Breaks-out-of the program, returns to MS-DOS.

When you've found the information you're looking for, you can press CTRL+C or CTRL+BACK to quit the program. If the program is displaying lots of useful information, more than will fit on the display, you can press CTRL+S to suspend it at each screen-full; the next key you press will continue the program.

 Note:  While you can follow CTRL+S with any other keystroke to continue the program, try to get in the habit of pressing CTRL+S again to continue. This will make sure that extra, unwanted keystrokes won't be sent to your program or to MS-DOS.

You can tell MS-DOS to check for the break key more often with the BREAK statement in CONFIG.SYS.

CTRL+S and CTRL+C keystrokes will only work with programs that use MS-DOS for keyboard and display services. This excludes most large, sophisticated programs. Smaller utilities—like DOS' built-in commands and utility programs such as HP 95 Utility Pack—usually will support these keystrokes.

One way to spot programs that do not support these services is by observing how the programs work. Programs that recognize unusual keystroke combinations (such as SHIFT+ENTER or CTRL+SPACEBAR) or do formatted, full-screen display, or run in graphics mode, will usually ignore the pause and break keys.

 Caution:  These keystroke services are provided by MS-DOS, not by the programs. DOS does not inform programs that they have been paused, or that they are about to be involuntarily terminated.

CTRL+C or CTRL+BACK will stop many programs in their tracks. If they are in the middle of performing important tasks (such as copying several files), those tasks will not be completed. Data will not likely be lost because MS-DOS automatically closes all open files when programs exit.

Text that you can pause or stop is often called "Stream Output." We'll talk about the stream again when we discuss redirection and piping.

Here a few things to keep in mind about stopping-up the I/O stream:

•	On desk bound PCs, pressing CTRL+NUMLOCK will pause most programs even if there is a key in the keyboard buffer. The HP 95 does not have a pause key.

•	If another key is in the keyboard buffer, pressing CTRL+S or CTRL+C won't do anything. This means if you press a key that isn't important to DOS while it's displaying text, DOS will ignore the key, but it will still be placed in the keyboard buffer. When you do press a key DOS should recognize, it won't see the key because the key will be placed in the buffer following any keys already there, and DOS only looks at the first key.

•	With most versions of MS-DOS, you can use the MORE filter with redirection to pause the display at each screen-full. MS-DOS 3.22 on the HP 95 does not include MORE, so you will have to use CTRL+S or a third-party MORE-like program (such as TMORE, included in the HP 95 Utility Pack).

•	You can also use CTRL+C to quit batch files (.BAT extension). MS-DOS will ask for confirmation, then if you press Y the program will be terminated.

•	To stop a process that's gone out of control, press CTRL+BACK  (that's the same as CTRL+BREAK on your desk bound PC).

Missing Commands

The HP 95 has very few external MS-DOS commands. FORMAT, which is an external command in most versions of DOS, is internal on the 95. External command files include CHKDSK.EXE, COMMAND.COM, DEBUG.EXE and SERINT.COM.

ROM-based MS-DOS 3.22 on the HP 95 is missing some commands, and a few  commands are different from DOS conventions. FORMAT, for example, can format only RAM cards; therefore it doesn't need any command line switches for disk size.

The most noteworthy absentees are ANSI.SYS, ATTRIB, BACKUP, COMP, DISKCOPY, EDLIN, FC, GRAPHICS, LABEL, GWBASIC, MODE, MORE, RECOVER, RESTORE, SORT, SYS and XCOPY. It's either a glaring oversight or commendable frankness. Surely the latter. The HP 95 gets along quite nicely without most of these programs.

We can be thankful that Hewlett-Packard left-out EDLIN.EXE, the primitive text editor included (and ignored by users of...) each DOS version from 1.0 through 5.0. Along with BACKUP, RECOVER and RESTORE, it's the most justifiably maligned tool in DOS' arsenal.

The SYS command, which copies the start-up files to a boot disk, is not needed by the HP 95, because the start-up files are always available in ROM. Some other utilities, like XCOPY and MODE, aren't needed because of the RAM disks or limited number of display options.


Files and Devices

Most file manipulation is done in programs—Lotus 1-2-3 creates spreadsheets, Memo edits text files, even HP Calc uses data files for Solver. MS-DOS commands create directories, make back-up copies of files, and prune the overgrown directory tree, but we rarely create files directly in DOS.

File Names

There is nothing to stop you from creating text files in the HP 95's Memo program with COM or EXE extensions. And there's no built-in protection to stop the computer from trying to run a non-program file with a program's name.

MS-DOS File Name Characters

Symbol	Meaning

A-Z	Letters.

0-9	Numbers.

_	Underscore.

^	Caret.

$	Dollar sign.

~	Tilde.

!	Exclamation point.

#	Number sign.

%	Percent sign.*

&	Ampersand.

-	Hyphen.*

{ }	Curly braces.

( )	Parentheses.*

@	At sign.*

Symbols in this list marked with "*" should be avoided at the beginning of file names because of conflicts with MS-DOS commands and programs.

In addition to the letters A-Z, you can also use the high-order characters from the HP 95's character set. These are characters with codes above 127.

 Note:  If you're familiar with HP computers like the 70- and 80-Series, you probably expect file names to begin with a letter, and included only letters and numbers in the names. Also, HP file name extensions are hard coded; the operating system protects us from giving a file the incorrect file type extension. As we've seen, file names are more flexible under MS-DOS. The HP 95 does not have any file type restrictions or protection—we are responsible to make sure that files have the correct extensions.

Notes About File Names

•	MS-DOS is not case sensitive. You can enter file names and paths in upper or lower case, or a combination. DOS will convert the names to upper case.

•	File names cannot contain spaces or other blank-like characters.

•	File names can be up to 8-characters plus an optional 3-character file name extension.

•	File name extensions are not required, but files cannot have just an extension without a file name.

•	Avoid creating file names containing the hyphen ("-") character. This can conflict with command switches.

•	File name extensions are used to group similar file types. Programs, for instance, are always BAT, COM or EXE, and each of those types represents a different program file format. Lotus 1-2-3 uses WK1, and the HP 95 Memo program prefers the TXT extension. It's a good idea to adhere to the standards. Following these conventions will make it easier to identify files later on down the road.

•	Use descriptive file names, which describe the contents of the file. This will save time later when you're searching for a long-forgotten file.

•	Use peculiar extensions and names to help protect names. People will be less likely to snoop at files named BASEBALL.CAP, CORN.COB or LETTER2.MOM.

•	MS-DOS reserves several names for devices. Do not use the following as file names: AUX, CLOCK$, COM1, COM2, COM3, COM4, CON, LPT1, LPT2, LPT3, NUL, PRN.

•	Directories follow the same naming conventions as files. Directory names are allowed to have extensions, just like files.

•	You are responsible to make sure file names and especially extensions follow MS-DOS conventions.

Identifying Program Files

MS-DOS takes it on good faith that files named COM or EXE are valid programs. Beyond checking for the EXE file header, there is nothing to identify a program from any other type of file. Nothing good can come of fooling MS-DOS into thinking a file is a program when it isn't. When you're not sure if it's a real program file, there are some ways to check.

Batch files, ending with BAT, are text files containing commands, much as we would enter them from the keyboard, in English-like form. You can list or even edit batch files with the HP 95 Memo program. All DOS commands are allowed in batch files, including a few new commands (which turn batch into a useful language) that we'll talk about later.

Both COM and EXE files are compiled programs, written in a machine-readable language (called, of course, machine language). These files are created from instructions written in programming languages, which are translated to machine language by other programs called compilers.

The COM file type is the oldest MS-DOS program file format. It's an exact image of how the program will look when DOS loads it into memory. COM files are always less than 64K of memory, which is the size of a single code segment. There is nothing in the file to identify it as a valid program to MS-DOS. It takes it on good faith that any program with the COM extension is a valid program (keep this in mind when naming text files).

 Note:  COM programs frequently begin with a JMP instruction, which is encoded as either E9 hex (a long JMP) or EB hex (a short JMP). You can look at these files with DEBUG, and check for either of these values. The codes translate to 233 and 235 decimal, which are displayed as "ù" and "ú" if you look at the files with the HP 95 Filer program. This is common practice, but it is not a rule; many COM programs do not begin with these characters.

COM program examples in this book, for instance, rarely begin with a JMP instruction. If the program doesn't begin with a JMP instruction, you may still be able to identify it. Try the DEBUG U (Unassemble) command; if it displays a series of valid instructions (not a series of DB or ??? lines), it may still be a program file.

The EXE file is more complex, it can contain multiple segments and various other information. EXE files always begin with a header of at least 512 bytes, so small utilities—especially for the HP 95—are usually written as COM programs. You can identify EXE files by looking at them with Filer: if the first two bytes are "MZ" and just about everything else is unreadable, it's probably an EXE file. The "MZ" isn't program code at all, it's the initials of Mark Zbikowski, one of the developers of MS-DOS. It's not there out of vanity (well, maybe a little bit), but to help identify the file as a valid program.

 Caution:  If the program extension is EXE but it doesn't begin with the "MZ" signature, MS-DOS won't automatically reject it as an invalid program file. Instead, it will assume that it is a COM program and DOS will try to execute the file anyway.


Devices and Device Drivers

Considering that it's manual-shift, MS-DOS has an automated way of looking at computers. The goal is device independence, so programs can run on any MS-DOS-compatible computer, regardless of how dissimilar the underlying hardware may prove to be. Device drivers are programs—usually part of the BIOS, called resident devices—that handle hardware-dependent tasks like video, keyboard and disk drives. Drivers are conduits for programs to communicate with resident devices.

DOS is an expanding universe. The original, idealized MS-DOS world had just these few devices, but it on the chance that. Millions of computers and billions in development investments later, other installable device drivers control mice (the pointing kind), touch screen panels and infrared ports. These drivers could be supplied by third-parties.

MS-DOS automatically installs several devices when you boot the computer:

MS-DOS Devices

Device	Purpose

COM1	The serial and infrared ports.

CON	The console (display and keyboard).

LPT1	Line printer, usually a parallel port. Same as COM1 on the HP 95.

NUL	The null device (everything is discarded).

PRN	The printer (usually a parallel port, though on the HP 95, the serial port).

In everyday use, we treat devices like files. If you want to print a file, you could send it to the PRN device. This will not create a file named PRN, but it instead passes the information to the device driver with that name:

COPY CONFIG.SYS PRN

The CON device represents the console, both the display and keyboard—it can both receive and send data. We call the keyboard Standard Input, or StdIn for short. The display is Standard Output, also known as StdOut. Together they are the CON device. These distinctions, and the console device driver, will seem more important and even useful in a few minutes, when we talk about redirection. Using the CON device, we can use COPY like TYPE:

COPY CONFIG.SYS CON

This sends the file to the console, and displays "1 File(s) copied" when it's done. The other side of the console is StdIn; we can create short text files from the keyboard without running any text editor:

COPY CON HELLO.TXT

Now MS-DOS will record your keystrokes in a file named HELLO.TXT. Every time you press ENTER, DOS adds another line to the file. To stop recording text, press F6 or CTRL+Z to enter the end of file character. DOS will again display "1 File(s) copied."

The NUL device is a bit bucket; whatever you throw at it is happily accepted, then just as cheerfully thrown away. Here, the file is copied to the nul device:

COPY COMMAND.COM NUL

The file is copied nowhere, but DOS will also display "1 File(s) copied" when it's done. You can eliminate that message, too, so the computer will do quite a bit of busy work, but the result will be nothing at all being done. Here's a hint about redirection: instead of the console, the message will be redirected to the null device.

COPY COMMAND.COM  NUL > NUL

Here's a trick to keep snoops from bothering your computer while you're away:

COPY CON NUL

DOS looks just fine, accepting keystrokes and displaying text with abandon. MS-DOS will display no error messages, but nothing worthwhile will happen, either. There are three ways get out of this predicament: CTRL+C, CTRL+BACK, or CTRL+Z then ENTER.

 Caution:  MS-DOS includes a few other standard devices, and some software may add new devices. Unless you're sure what the results of using these devices will be, avoid experimenting. Two MS-DOS devices to avoid are CLOCK$ and AUX.


Taming the RAM Disk

Most of our working files end-up in the C:\_DAT\ directory. Frankly, lots of files we really don't care about land in C:\_DAT\. You can clean-up some of that clutter by deleting unneeded DCF, CTF and PBK files, and even TOPCARD.PCX, that the computer created the first time you booted. You'll find spare copies in the hidden C:\_SYS\ directory. See SYSINIT.BAT for how to restore these files.

This table compares using Filer and the MS-DOS command line to perform similar tasks:

MS-DOS File Commands

Filer	DOS	If you want to

F2	COPY	Copy a file to a card.

F8	REN	Rename a file.

F3	DEL	Delete a file.

F9, F2	COPY *.*	Copy contents of a directory.

MENU D C	MD	Create a directory.

F3	RD	Delete a directory.

F8	RENMOVE	Rename a directory.

The Filer Rename (F8) function can also rename directories. There is no MS-DOS 3.22 command to rename directories; we use RENMOVE.

The HP 95 has several permanent files in the C:\ root directory. You can look at them, but you can't change or delete these files. Now say you're an old-hand at Lotus 1-2-3 and you'd like to recover the space taken by the sample WK1 files in the root directory... Well, you can't, but don't be concerned about the wasted space because while these files are part of the C: RAM disk, they are in the ROM portion of the drive. The same is true for COMMAND.COM, TF.COM, CHKDSK.EXE and all the files in the C:\_SYS\ directory.

The Filer can only recognize the first 100 files in any directory. Since DOS allocates sub-directory entries on an as-needed basis, reusing deleted directory entries, some new files may be excluded from the Filer list when it exceeds 100 files, even though alphabetically they come before the last entry that made it into the listing.

MS-DOS stores files as units of 512 bytes; 512, 1024, 1536, and so forth. Each file we create, regardless of how small, occupies at least 512 bytes of disk space. Whenever a file grows past a 512 byte boundary, 512 more bytes are allocated to the file.

Other computers and other disk types will use different file storage standards. One of DOS' strengths is its ability to hide these differences from applications programs. From the program's perspective, it doesn't matter if files take  512 bytes or 2K (acommon minimum size for hard disk drives).

Notes About Disk Taming

•	Resist the temptation to stash every program utility in the root directory and every data file in C:\_DAT\. A scheme of sub-directories will make organization nearly automatic.

•	Keep the root directory clean. The number of files we can create in root directory of all disk drives is limited, and the cleaner we keep the root directory, the easier it will be to navigate through the disk.

•	Create working directories for data and programs. Many DOS fans expect a program directory named \BIN\ or \DOS\ or \UTIL\.

•	A PATH environment variable will make it easier to hide utilities and still be able to execute the programs.

•	While sub-directories can grow as we add more files, keep them under 100 files, because Filer can only display the first 100 files in any directory.

•	Before deleting a directory, you must first delete the files in the directory.

•	Filer sorts the directory for display. DOS reuses directory entries as files are created, deleted and renamed, so files on the disk are rarely sorted, and their order in the directory listing can change.

•	MS-DOS stores files on RAM disk in multiples of 512 bytes. As files grow, the disk space they require is allocated as additional multiples of 512 bytes.

•	The HP 95 C: RAM disk allows a maximum of 100 files in the root directory.


Making Room for DOS

You can leave the cozy-confines of the Filer by pressing Menu then selecting System. When you are done, return to Filer by typing EXIT. This does not, however, give you all available memory.

You can toggle between the convenience of ROM-based applications and the freedomand efficiency of DOS. When you are done with this section you will have created two batch files and one configuration file (there are examples on disk if you want to cut down on your typing), and you will be using a program to reboot the computer.

If you start from plain-DOS, you won't have access to Lotus 1-2-3, the Filer or other built-in software, but you will have lots of extra memory for running DOS applications. Since most of DOS is in ROM, the computer needs only about 18.5K of memory—freeing about 81,800 bytes of additional memory!

Switching between ROM and DOS is not as complicated as it sounds. The two files to remember are DOS.BAT and ROM.BAT. When you run DOS.BAT from Filer, it will reset the computer in plain-DOS mode. When you want to return to the HP 95's ROM-based applications, run ROM.BAT from the DOS command line. Here are the files we will need:

File Name	Purpose

CONFIG.SYS	Installs drivers and the command shell.

AUTOEXEC.BAT	Commands to interpret after booting.

DOS.BAT	Reboots the computer at the DOS prompt.

ROM.BAT	Reboots with built-in applications.

REBOOT.COM	This program reboots the computer.

CONFIG.SYS

The trick is a file named CONFIG.SYS, which the 95 will look for in the root directory. If the file exists, the computer will execute commands in the file when it boots; otherwise it will ignore AUTOEXEC.BAT, and you will end-up back in ROM.

To force the computer to boot from DOS instead of ROM, add a "SHELL=" line to CONFIG.SYS. For the HP 95, we use the driver COMMAND as the shell, for other computers we would use COMMAND.COM; the HP 95 will use the ROM-resident command interpreter instead of loading COMMAND.COM. Here is a simple CONFIG.SYS file.

DEVICE=WINK.SYS
SHELL=COMMAND /P

The DEVICE command loads WINK.SYS, a cursor enhancer. Don't forget the /P at the end of the SHELL statement. If you do, and you accidentally type EXIT, you will exit to... nowhere!

AUTOEXEC.BAT

After CONFIG.SYS, the computer will interpret AUTOEXEC.BAT. AUTOEXEC.BAT is required when you start from DOS. Otherwise, every time you boot the computer you will have to manually set the clock. It may seem like an obscure ritual, requiring a batch file that doesn't do anything, just to keep from having to set the clock. You can make it seem a bit less odd by adding some useful commands to AUTOEXEC.BAT.

AUTOEXEC.BAT is a regular batch file, it can execute any commands or programs you like. This example sets the prompt to display the current drive and directory name and sets the PATH to include the root and _SYS directories, as well as a directory named C:\BIN, where you will likely have useful programs concealed (for instance, you might put 95.COM and ROM.BAT in the \BIN directory):

ECHO OFF
PROMPT $P$G
PATH=C:\;C:\_SYS;C:\BIN

When you boot from ROM, the computer (maybe unfortunately) does not read AUTOEXEC.BAT. All of those commands will go unnoticed (but the clock gets set anyway).

DOS.BAT

Next, you have to give your 95 a boot to the head. Actually you have to do a "Warm boot," which just stops everything and restarts the computer in a civilized state. You can do this manually by pressing CTRL+ALT+DEL, or you can use either REBOOT.COM or 95.COM to boot for you.

The example batch files show REBOOT.COM. If you are using 95.COM anyway, you can replace the calls to REBOOT to the boot function of 95.COM. This will save 512 bytes of disk space and make it less likely that you or a coworker will accidentally reboot the computer.

Here are two batch files that restart the computer with the ROM applications in charge (ROM.BAT) or with DOS in control of the computer (DOS.BAT):

ECHO OFF
ECHO DOS.BAT resets the 95 to DOS.
ECHO Press ^C to cancel
PAUSE >NUL
REN C:\CONFIG.TMP CONFIG.SYS
C:\BIN\REBOOT

ROM.BAT

The last file you will need is ROM.BAT. This program renames CONFIG.SYS to CONFIG.TMP, then reboots the computer.

ECHO OFF
ECHO ROM.BAT resets the 95 to ROM applications
ECHO Press ^C to cancel
PAUSE >NUL
REN C:\CONFIG.SYS CONFIG.TMP
C:\BIN\REBOOT

Notice that we included the complete path with REBOOT ("C:\BIN\REBOOT"). If REBOOT.COM is not in that directory, change the path to the complete name of where you will find the program. You can eliminate the PAUSE in both batch files once you are comfortable with them.

The HP 95 won't allow you to run a program from Filer if any other applications are running. If Filer lets you run the program, then you've already closed any data files. Now, if you are in Filer and want to restart at the DOS prompt, make sure all other applications are closed, then move the highlight to DOS.BAT, then press F4. The computer will restart.

Now you are at the DOS prompt... completely. If you press the blue Filer, Comm or even the 123 key, nothing will happen. Even typing EXIT leaves you at the DOS prompt (this might be a good time to show a PCX graphic file that says "Don't Panic!"). To get back to the ROM applications, type ROM; a few copyright screens will flash-by, then you will be back in ROM, safe and warm.

If you are using CONFIG.SYS when booting from ROM (to load device drivers like WINK.SYS), you can modify DOS.BAT and ROM.BAT to switch between the two versions of the file. You might name one of the files CONFIG.DOS and the other CONFIG.ROM. Then change the REN statement in DOS.BAT:

COPY C:\CONFIG.DOS C:\CONFIG.SYS

Now change the REN statement in ROM.BAT to:

COPY C:\CONFIG.ROM C:\CONFIG.SYS

When you run ROM.BAT or DOS.BAT, the timeout setting will be set to five minutes. If you prefer a different timeout, you can add a 95 TIMEOUT command to AUTOEXEC.BAT. Nothing after the REBOOT will be executed, so you will have to call 95.COM again after the computer reboots.

•	You can return to the built-in applications by typing the $SYSMGR command. See the Explorer's Guide for more information.


Redirection and Piping

 The device-independence of MS-DOS makes it easy to treat printers and files and displays as much the same thing. The handful of redirection and piping commands adds flexibility to device-independence.

Redirection is usually used with command line utilities and built-in DOS commands like TYPE and COPY.

When a utility asks DOS for input it reads from the console, which is usually the StdIn device. Output is then sent back to the output-half of the console device. The trick of redirection is separating the tasks of input and output from the console, in effect deceiving programs about where information is coming from (or going to). With really complex, convoluted redirection tricks, programs won't whether the data is coming or going. And, MS-DOS is a party to this scheme. O' what tangled webs we weave...

The command line is the line you type with a program name. StdIn (short for "Standard input") is usually a synonym for the keyboard; when a program asks you for data, it reads it from StdIn. DOS makes this distinction because the command line is a fixed number of characters, while StdIn may be any length at all. When a program uses StdIn, you can use I/O (Input / Output) redirection to have it read a file or even the output from another program instead of the keyboard.

StdOut usually means the display, too. Most of these programs display through StdOut—using the satisfyingly named "Stream output"—so that you can redirect the information to another file or even to the printer.

There are several ways to redirect the stream, and each method is represented by a symbol:

Redirection and Piping Symbols

Symbol	Operation

>	Redirects output to a file or device. If output is going to a file and the file already exists, the original file is replaced by the new file.

>>	Appends redirected output to a file or device. If the output is a file and the file already exists, the information is appended to the end of the file.

<	Use this symbol to read data from a file instead of entering it from the keyboard.

|	The piping symbol; use it to redirect output from one program to StdIn of another program. The second program is usually a filter or searching program.

These symbols are easier to remember if you visualize them as arrows. The > symbol points data at a device (usually a file). The < symbol points data to a program (usually from a file). The pipe symbol (|) can be interpreted literally: it acts as a conduit, moving information from one device to another.

DOS Console Devices

Name	Device

StdIn	The standard input device (usually the keyboard).

StdOut	The standard output device (the display).

StdErr	The standard error device (also the display).

The > Output Redirection Symbol

We often use COPY CON to create small batch files. For single-line files, we can do it even easier. The following example will create the file APNAME.LST, with a single command to assign TigerFox to a key:

ECHO C:\_SYS\TFOX.EXM,1400,TigerFox > C:\_DAT\APNAME.LST

This says to DOS: "Instead of displaying the text, create a file named APNAME.LST, and send the text there."

We often use output redirection to copy a directory listing to a file or the printer using DOS' DIR command. This example sends a directory listing to the printer:

DIR >PRN

If a program or command requires command line arguments, include them on the line before the redirection symbol:

DIR *.WK* > 123FILES.TXT

This says to DOS: "Show me all the Lotus 1-2-3 spreadsheet files, and send the list to the file named 123FILES.TXT."

Output Redirection with >

One of the most common uses for output redirection is to print a directory listing using DOS' DIR command:

DIR > PRN

For a printed listing of all directories, you can use the DIRS program:

DIRS > PRN

Sending the results to a file is much the same.

DIRS > DIRLIST.TXT

If the program takes command line arguments, include them after the program name but before the redirection symbol:

DIRS *.COM > PROGLIST.TXT

The >> Output Redirection Symbol

So far, everything we've redirected has the same potential weakness: it could overwrite the contents of an existing file. The DOS designers thought this through thoroughly, adding another symbol, >>, to append the output to an existing file. If the file doesn't exist, >> works just like > to create the file, otherwise the new information is tacked-onto the end of the file.

Using ECHO with output direction is fine for one-line files, but if we later change our mind and want to also include Hearts&Bones, we could start over, or use the append symbol (">>") to add the second line to the file:

ECHO C:\_SYS\TFOX.EXM,1400,TigerFox > C:\_DAT\APNAME.LST
ECHO C:\_SYS\HB.EXM,2300,Hearts&Bones >> C:\_DAT\APNAME.LST

The first line creates the file with the > symbol. The second line, using >> instead of the > symbol, adds another line to the end of the file. If you're distributing commercial software for the HP 95, appending an entry to the end of APNAME.LST with output redirection is a polite, easy way to make keyboard assignments.

Another use for appending output to a file is to create a log of system activity. You could add these three lines to AUTOEXEC.BAT to have the computer automatically maintain a log of the status of the computer each time you reboot:

ECHO Rebooted computer >> C:\_DAT\WORK.LOG
BATTERY >> C:\_DAT\BOOT.LOG
NOW >> C:\_DAT\BOOT.LOG

Each time you run the batch file, these commands will append three lines to the file named WORK.LOG in the C:\_DAT\ directory. The first line is text, the second and third lines are the redirected output from two programs. BATTERY.COM displays the current battery level. NOW.COM displays the current time and date. Instead of displaying the results from these two utility programs, the information is sent to the file.

Output Redirection with >>

The problem with redirecting output to a file is the original file will be overwritten by the new information. DOS is ahead of us on this one; the ">>" symbol appends the output to the end of a file. Say you want a list of just TXT and Lotus 1-2-3 files, use ">" symbol to create the file, then ">>" to append the rest of the information:

DIR *.TXT > DATALIST.TXT
DIR *.WK* >> DATALIST.TXT

The < Redirection Symbol

This symbol is often thought of as the opposite of >. It takes the contents of a file and sends it through a program. The file becomes StdIn. The input redirection symbol is easiest to visualize as similar to TYPE, butinstead of displaying the information, you are sending it to another program.

This example says to DOS "Send the contents of the file BATTERY.SCR to DEBUG.EXE:"

C:\_SYS\DEBUG < BATTERY.SCR

Input redirection works only with programs that receive input from StdIn.

Input redirection is often used to enter DEBUG script files. Instead of entering the commands directly in DEBUG, we place them in a text file, then redirect the text file to DEBUG.

The Input Redirection Symbol <

Think of input redirection as something like TYPE, but instead of displaying the information, it is typed to another program. This example says to DOS "Send the file README.TXT to SIFT:"

SIFT < README.TXT

The | Piping Redirection Symbol

Piping means to sent the output from one program (or process) to the input of another. This example runs DIRS, redirecting the output to SIFT. Then, SIFT will see the data as coming from StdIn, and will format it accordingly. Then DOS will redirect the output from SIFT to a file called DATA.LOG:

DIRS | SIFT > DATA.LOG

Piping is useful primarily with filters like DOS' MORE command, but unfortunately the HP 95 doesn't include any filters.

MS-DOS will run the first program, redirecting the output to a temporary file. After the first program ends, DOS runs the second program, and redirects the contents of the temporary file to StdIn. The second program sees the data as the contents of any stream. Finally, after the second program ends, DOS erases the temporary file.

If you could halt the process midway-through, say around the pipe symbol, then look at the directory, you would find a strangely named file. But when the programs end, that temporary file will be gone. One side effect of piping is that you must have enough disk space available for the temporary file, yet you'll never see the file.

The piping-form of redirection is most useful with filters. The HP 95 doesn't have any filters, so here's the equivalent to the input redirection example above, but re-written using a pipe:

TYPE BATTERY.SCR | C:\_SYS\DEBUG

This says to DOS: "Type the file BATTERY.SCR, but instead of sending it to the display, send it to the StdIn side of DEBUG." There will be a short delay while BATTERY.SCR is copied to the temporary file, then sent on to DEBUG.

Filters read the input stream then modify the information according to how it feels about the data, then it displays whatever is left. For instance, MORE reads and displays a screen-full of information then pauses for a keystroke, then it displays another screen-full, and so forth through the end of the file. Another utility might translate the HP 95's character set to plain-ASCII.

Say you have a program that needs a single character input, but it doesn't read the command line. You could run the program then press the key at the prompt; a bother if you use the program often, and always with the same keystrokes. Fortunately, there aren't many programs this dimwitted anymore. One that remains is a public domain hard disk head parker called SHIPDISK.EXE. This example echoes the number 1 (for the first hard disk) and pipes it through SHIPDISK:

ECHO 1 | SHIPDISK

 Caution:  Always keep in mind the difference between the output redirection and piping functions. If you accidentally redirect information to a program instead of piping it through the program, you will overwrite the program file with the output data. For instance, say you want to list a long text file and you are using a utility named MORE to split-up the file into screen-size bytes. The correct command line will look like:

TYPE MYFILE.TXT | MORE.COM

If you accidentally used the > symbol, as in:

TYPE MYFILE.TXT > MORE.COM

you would overwrite MORE.COM with the contents of MYFILE.TXT. To lessen the chance of causing any damage with this mistake, enter the program name without the file extension. Then, the worst that can happen is DOS will a create file with the same base-name as the program.

 Caution:  Be careful with piping with program that expect and accept only a limited number of options.When input is redirected and there is nothing left to read, the keyboard is inactive and the program cannot ask for information. For example, the following will send the incorrect information to the TIME command, and since TIME expects redirected input, it will ignore the keyboard:

ECHO ? | TIME

The solution is to press CTRL+BACK (the break key) when the computer gets stuck. Even CTRL+C won't work here, so that's the only solution. Many programs disable the break key; avoid using redirection with those programs if you cannot be assured that they'll get the right information sent to them.

Notes About Redirection

•	See SIFT.COM for more about I/O redirection.

•	Always redirect the output to a new file. If you accidentally use the same file name for source and output, the file will be truncated to zero length—all of the information in the file will be lost.

•	MS-DOS adds an extra level of device independence. By using the devices, programs and users can share information transparently.

•	If you have redirected the console device using the CTTY command, many utilities will receive input from the external keyboard and will display information on the external device. A useful application for this feature is running DEBUG on the 95, but use the keyboard and display from a larger computer.

•	Even if you redirect output to the NUL device, some programs will still show error messages on the DOS command line. They do this by writing directly to the display, or by using the StdErr (Standard Error) device. StdErr is rarely redirected.

•	You can use >> to append information to the end of a file at any time. If the file does not exist, DOS will create it for you.

•	Not all programs use DOS for input or output. Redirection will be ignored by programs that use the BIOS for keyboard and display, and "impolite" programs that communicate directly with the hardware.

•	Most programs in the HP 95 Utility Pack accept input from the command line, input redirection, or they will ask you for information. Utility programs usually aren't that forgiving, so you will have to determine how programs require data.

•	Don't confuse the purpose of the output redirection symbol > with the piping symbol |. If you do, you may accidentally overwrite the program with the redirected output.


Viruses And Worms

If you feel the computer is acting flaky for no apparent reason and all rational solutions have failed, there is a chance—a very slim chance—that your computer has been the brunt of a vandal.

The HP 95 is less susceptible to sabotage than most desktop computers. The operating system and most applications run from permanently programmed ROM chips (there are no hidden boot files), and the hardware is self-contained and sealed.

A virus is transferred from computer to computer by running a program. The program copies itself to the next computer or to another program. There are several kinds of viruses: worms, Trojan horses and bombs, but they all have similar goals. The purpose is to eventually inflict damage on as many computers and people as possible. A virus program can show immediate effects, or it may spread for months or years undetected before a special date or event triggers it.

Perpetrators are out to show us how clever they are—or they're simply vindictive. It really doesn't matter. The goal is to avoid them and their wares.

Small companies and major institutions have been brought to their knees by these people, but you can't let them control your life. So what do about protecting yourself? As your Mother told you: "Don't touch it if youdon't know where it's been." Here are a few more suggestions:

•	Use write protect tabs on floppy disks. Flip the write protect switches on RAM cards and 3½" disks.

•	Always know the source of a file or disk. Don't borrow or loan disks.

•	Watch program file sizes and date stamps (COM, EXE or SYS extensions). If one of these files changes, a virus may have hooked itself to the program file. Don't run the program! Start with a fresh copy, and check again often.

•	Avoid pirated and questionable public domain software. There is no such thing as a free lunch. Before downloading that "free" software from the Internet or a bulletin board, ask yourself how badly you really want it.

•	If you decide to try shareware or freeware, make sure that the archived files and disks are the originals, created by the software distributor.

•	Viruses often spread by hooking themselves onto programs everybody uses. Like MS-DOS itself, or Lotus 1-2-3. The HP 95 runs these applications from ROM, so the problem is minimized. On your desktop computer, keep an eye out for changes to COMMAND.COM.

•	If you are still worried, try fumigating your computer with a virocide program. Be aware, however, that some shareware/freeware virus detecting programs are themselves viruses.

•	People who write or pass viruses are sociopaths and vandals. Avoid their haunts.


DOS Pronunciation Guide

We usually try to pretend that computer jargon, acronyms and abbreviations are real words. This leads to confusion and accidental humor, especially if the words have counter-intuitive pronunciations.

 After saying "Con-fig-dot-sis" a dozen times on the phone, we often shorten it to "Con-fig-sis." After another dozen times, it becomes "Con-fig."

A roomful of compu-techno-nerds pronouncing punctuation quickly begins to sound like Victor Borge's stage act. Here are a few social gaffes to avoid:

•	"DOS" is pronounced with a short O, as in Moss, not Dose.

•	"EXE" is usually X-E.

•	"." is pronounced Dot, not Period. Except software revision numbers are often pronounced Period, or even not at all (version 3.2 might be called Three-point-two-two or even Three-two-two).

•	"*" is pronounced Star, not Asterisk.

•	"$" is Dollar. In the BASIC programming language, it's often called String.

•	".." is Dot-dot.

•	"*.*" is "Star-dot-star."

These are only suggestions; there are regional differences. After all, software people usually say "Data" as "Date-ah" and begin "Gig-a-byte" with a short "G" sound, while hardware people "Dat-ah" and say "Jigga-byte." Finally, the problem remains: how do you pronounce the file name DOT.DOT?


Customizing MS-DOS

We've already talked about personalizing the HP 95 by adding new System Manager programs and a custom Business Card. MS-DOS adds even more ways to adapt the computer to our needs. We'll talk about these features and writing batch files in this chapter.

Customizable MS-DOS Personality Traits

Feature	What it Does

Path	Where MS-DOS searches for program files.

Prompt	DOS' greeting on the command line prompt.

CONFIG.SYS	Loads device drivers, configures memory.

AUTOEXEC.BAT	Batch file, run when the computer boots.

MS-DOS doesn't have to be an austere, impersonal place. You can settle for Spartan simplicity, or batch files and settings that make your computer like no other. DOS is malleable, the choice is yours.

Environment Variables

The MS-DOS environment is a storage space set aside for text needed to run DOS and share information among programs. It's a succession of named cubbyholes, not unlike string variables in the BASIC programming language. The SET command creates or deletes environment variables. It also shows the current settings; at the DOS command line, type:

SET

On a freshly booted HP 95, MS-DOS will show something like:

PATH=
COMSPEC=COMMAND

Only two variables are automatically created. We'll talk about these two important settings and a third, named PATH, later in this chapter. Adding or changing variables uses the same SET:

SET h=Hello, World!

Now when we type SET, DOS will display:

PATH=
COMSPEC=
H=Hello, World!

Notice that "H" was converted to upper case, but the text stayed how we typed it. The SET command also deletes variables. To get rid of that less then helpful H variable, type the variable name with the equals sign but without any text:

SET H=

 Caution:  When creating environment variables, don't place spaces before the equals sign, because MS-DOS will preserve them in the variable names. This confusion can cause multiple, seemingly identical environment variables—not to mention confused programs. The following two statements are not equivalent:

SET ZYZZX=Nevada
SET ZYZZX =Nevada

The SET command creates or destroys environment variables. DOS does not have a method to display individual variables. We'll show how to use separate variables in batch files in The Other ECHO.

Notes About Environment Variables

•	Watch out for extra spaces in variables and names. Spaces don't show, but they can change the meaning of the variable, or even the name. This really confuses programs.

•	Many DOS programs use variables. Built-in HP 95 applications do not.

•	Environment variables follow the same naming conventions as files.

•	New environment variables are lost when you return to Filer.

•	The HP 95 environment is only 160 bytes. Conserve!

Customizing the PATH

The word "path" has two similar meanings. The path can be the current path—meaning the current directory and disk drive—which on the HP 95 is often C:\_DAT\. The second meaning is the search PATH Environment Variable. The PATH variable tells MS-DOS where to look for applications programs, and sometimes tells programs where to look for themselves.

Each directory in the PATH string is separated by a semicolon:

PATH C:\;C:\_SYS;A:\

This says to MS-DOS: "If you can't find the program in the current directory, look next in the root directory of C:, then in C:\_SYS\, and finally on the A: drive." Now, regardless of where you are, you can type the name of your favorite program and DOS will look for it.

When your programs are in the path, regardless of where you are, the computer will be able to find your programs, it isn't necessary to change to the directory containing the programs. In the struggle for organization, this one tool makes all the difference: we can keep the programs in one place—such as on a read-only RAM card—and our data files in another. This is especially powerful when it's time to back-up files, since we can simply copy everything from the data directories.

If you're using only built-in HP 95 applications, you have executable programs in the root directory and in the \_SYS\ directories of the C: drive. This path setting tells DOS to look in those two places for programs, regardless of where you are right now:

PATH C:\;C:\_SYS

You could also add an equals sign:

PATH=C:\;C:\_SYS

Or even:

SET PATH=C:\;C:\_SYS

All three forms work because the word PATH, like PATH, is both an environment variable, and a DOS internal command. The command version has one difference, however: it converts the string to upper case, the SET command preserves the case.

 Caution:  Avoid setting the path to include the A: RAM card unless you always keep a card in the port. If the card is in your pocket instead of the port and DOS can't find the program, it'll complain:

Not ready error reading drive A
Abort, Retry, Ignore?

Not a lot of choices. You can turn the computer off, insert the card, then press R. If you know the program can't be found—maybe you mistyped the file name—press A to return to the DOS prompt. Ignore isn't a choice—it's difficult to ignore the fact that there isn't a disk in the drive. Some incarnations of MS-DOS add a forth choice: Fail, which isn't any more helpful than ignoring the problem.

One scheme favored by many DOS fans is placing data files in a sub-directory off of the program file. This doesn't seem practical because it just makes for more wandering through the directory tree, but you can make it more usable by adding the next directory up (the ".." directory) to the path variable. This says, "Look in the usual places, but if you still can't find it, try in the next directory up from where I am now:"

PATH C:\;C:\_SYS;..\

Most built-in HP 95 applications do not use the path. As a rule, they expect to find help files in the hidden C:\_SYS\ directory, and data files in C:\_DAT\. Changing the path won't alter how these programs work. This doesn't mean that everything is going to pile-up in the C:\_DAT\ directory. Lotus 1-2-3 expects spreadsheet files in the C:\ root directory, but we can customize the setting to any directory we choose. Memo starts in the C:\_DAT\ directory, but we can store files anywhere.

Notes About the PATH

•	Unlike most HP 95 built-in applications, Lotus 1-2-3 lets us permanently select a default path for spreadsheet files.

•	MS-DOS looks for files first in the current directory, then in the PATH environment variable.

•	You can list several directories and disk drives in the path; separate each with a semicolon (";"). It is not necessary to place a semicolon at the end of the line.

•	Any non-existent or invalid directories or disks specified in the PATH statement are ignored. If MS-DOS can't seem to find your program files, be sure that you entered the path correctly.

Customizing the PROMPT

There you are, staring at C> trying to figure out where you are. You could type CD without an argument whenever you get lost, but there's an easier way: the computer can tell you without you asking. That's the purpose of the customizable PROMPT.

Each time DOS stops and waits for the next command it displays the drive letter and a greater than symbol; that's called the command prompt. You can customize the prompt with the (as obvious as it sounds...) PROMPT statement, which is stored in the environment in (even more obviously...) the PROMPT environment variable.

See the Prompt Symbols table. Some of these codes may seem frivolous, but each has a purpose. Some PROMPT symbols are included to avoid conflicts with redirection characters—otherwise, there would be no way to enter these characters without inadvertent piping or redirection. You can embed other characters, even spaces, in the prompt.

The default prompt is "$N$G," showing the drive letter followed by the greater than symbol. Just about the first thing a Power User does when customizing a computer is type:

PROMPT $P$G

Now, the prompt will include the complete path with the greater than symbol:

C:\_DAT>

Codes can be quite elaborate without having a noticeable effect on how fast the prompt returns after each DOS command. This long convoluted example is more useful on a deskbound computer with a color monitor and the ANSI.SYS device drive (loaded via CONFIG.SYS). It displays the current date and time in red letters on a white background in the upper right corner of the screen, displays the path at the cursor position in cyan on black, then displays the cursor in white on black:

PROMPT $E[s$E[1;54H$E[0;31;47m $t$E[3D  $d $E[36;40m$E[u$P$G$E[0;37m

You probably wouldn't want to use this convoluted prompt on the HP 95—partly because the 95 can't display red letters, though mostly because the HP 95 doesn't use the ANSI display driver—so we won't explain all of the ANSI escape sequences.

You could show the complete time stamp, with hundredths of seconds, but it takes up quite a bit of the display, and it's more distracting than useful. A better idea is to let the computer display the complete time, then use the "$H" code to erase unneeded bits of seconds, then replace it with the date or a more useful part of the prompt. Be sure to enter spaces as shown.

Useful HP 95 PROMPTs

PROMPT	Display

$N$G	C:>

$P$G	C:\_DAT>

$T$H$H$H $P$G	12:34:56 C:\_DAT>

$T$H$H$H$H$H$H $D$_$P$G	12:34 Thu 09-04-1997
C:\_DAT>

 Note:  The default prompt, "$N$G," is probably enough if you spend most of your time running built-in applications. Once you're accustomed to seeing exactly where you are just by looking at the prompt, it's hard to go back to simpler prompts.

Notes About PROMPT

•	Entering the PROMPT command without an argument restores the default (C>) prompt. This action is quite different from PATH, which shows the current path setting.

•	The customized prompt is lost when you return to Filer or reboot the computer. It is not lost when you run a program from the DOS command line.

•	The equals sign is optional when you enter a PROMPT. Either PROMPT=$P$G or PROMPT $P$G is acceptable. Under MS-DOS 2.x, the equals sign was required.

CONFIG.SYS

When the HP 95 boots, it searches first the plug-in card port, then the root directory of drive C:, for a file named CONFIG.SYS. This is a special text file containing configuration commands. By adding a few lines to CONFIG.SYS, you can customize how the HP 95 works and even save some memory. You can edit the file with the HP 95's Memo program or any other plain-ASCII text editor.

CONFIG.SYS Commands

Command	Default	Purpose

BREAK=	OFF	Turn on or off extended CTRL+C/CTRL+BREAK checking.

BUFFERS=	3	Number of temporary file buffers.

COUNTRY=	001	Internationalizes time, date and number formats.

DEVICE=	·	Installs device drivers or TSRs.

FILES=	20	Maximum number of files that can be open at one time.

LASTDRIVE=	F	Number of logical disk drives in the computer.

SHELL=	$SYSMGR	Specify the command processor shell.

STACKS=	9,128	Internal stacks used for hardware interrupts.

 Caution:  DOS isn't very forgiving about experimenting with CONFIG.SYS settings. Be careful creating or modifying CONFIG.SYS. If it's incorrectly written, you may not be able to boot the computer, and may have to re-initialize the RAM disk to recover. This is also true if you try to load a device driver (usually a file with the SYS extension) that isn't compatible with the HP 95.

CONFIG.SYS Remark Text

MS-DOS 4.0 and later add a comment feature; the keyword is REM. This means you can add lines to the file as reminders, which will be ignored when the computer boots. REM is great when you're trying various combinations of commands and constantly rebooting—you can find your way back to the previous version painlessly. DOS 3.22 doesn't have a REM command, but you can use it anyway:

REM FILES=20

When DOS comes upon the line, it displays the following message, then continues anyway:

Unrecognized command in CONFIG.SYS

 Note:  The command will be ignored, then DOS will continue to the next line in the file. As we will see when we talk about the FCBS command, this error message doesn't always mean that DOS has ignored a command.

BREAK= Command

The default is extended break checking off (BREAK=OFF), and for good reason: it adds little, and just slows down DOS utilities. The CTRL+C or CTRL+BACK (CTRL+BREAK) keystroke will terminate utility programs and DOS commands. You can also turn break checking on or off from the keyboard with the BREAK command:

BREAK OFF

Type the keyword on the DOS command line without any argument to see the current extended break setting:

BREAK

The computer will display:

BREAK is off

Normally DOS checks for these keystrokes only when writing text to the screen or waiting for a keystroke. During long-running processes, such as copying large files, CTRL+C may be missed until the deed is done. Extended break checking causes DOS to check the keyboard more often—during every internal system call. This can make it easier to cancel out of control processes, but it slows general operation of the computer slightly.

HP 95 built-in applications ignore the state of break checking, as do most sophisticated programs; there's usually little need to change the break setting.

BUFFERS= Command

MS-DOS uses buffers for temporary storage when reading or writing files. Buffers require about 528 bytes each (the size of a disk sector plus 16 bytes). The default setting is BUFFERS=3.

The HP 95 uses a RAM disk, which shows minimal (if any) benefits from buffering. Limiting DOS to a single buffer increases memory available to programs. Adding the following line to CONFIG.SYS increases memory by about 1056 bytes:

BUFFERS=1

The built-in applications store data in RAM, so there's little interaction with the RAM disk except when you save data to disk. DOS file operations will run slower with only a single buffer, but not noticeably on the HP 95, since RAM disks are by nature much faster than floppy or fixed disks.

DEVICE= Command

Device drivers add an extra level of independence from physical devices. Communicating directly with the printer hardware depends on there actually being a printer connected. If you instead have a driver, whose job it is to communicate with the printer, you could This also makes it easier for programs to run on less-than-compatible computers. Just as important, say a program tries to print when there isn't a printer, the device driver could catch the error and send the information to the serial port, the display, a file, or even to nowhere at all—the program could print without concern about whether there is a printer.

When you have the choice between a TSR and a device driver, chose the device driver; it will take less memory and will be less likely to have compatibility problems.

Device drivers don't have to be in the root directory. Since the these files are accessed only once, when the computer boots, there's no reason to keep them around cluttering the root directory. Say you're using WINK.SYS, and it's in the directory C:\BIN\, you can tell DOS to look for the file in the sub-directory:

DEVICE=C:\BIN\WINK.SYS

 Caution:  If a device is incompatible in any way with the HP 95 and stops the computer from booting or operating correctly, you may not be able to restart the computer without first reformatting the RAM disk—this will cause the loss of everything on the disk.

If you have a plug-in card, you can work-around this problem: place identical CONFIG.SYS files on the card and the C: drive, but remove the DEVICE= line from one of the files. Now if the computer crashes when you boot from the card, remove the card and boot again; if you booted from C:, insert the card and boot from A:. Once you've recovered, be sure to eliminate the offending file and DEVICE= statement. A quick-fix when you don't want to (or can't ) edit CONFIG.SYS is to rename or delete the device driver. DOS will complain about a missing device, but it will boot the computer anyway.

FCBS= Command

Older MS-DOS applications often used File Control Blocks (FCBs) instead of file handles to open files. FCBs are cumbersome and outdated, and few programmers even like to use them any more. Yet DOS maintains support for File Control Blocks—otherwise, programs from the early 80's might not run!

FCBs are (very) occasionally useful in programs, so you probably don't want to eliminate them entirely. The default setting is four file control blocks. Each FCB costs about 56 bytes, reducing the number to two could save 112 bytes—if we had a way to do it.

There is a way, though the computer complains about doing it. The FCBS= command is not documented for MS-DOS 3.22, yet the HP 95 recognizes it:

FCBS=2

When MS-DOS reads the FCBS= statement, it issues the "Unrecognized command in CONFIG.SYS" error message. But, the command still works!

 Caution:  While the FCBS feature appears to work, there is no guarantee that it will be reliable on all HP 95's. Decide for yourself if you would like to use this feature. Old-style applications that depend on FCBs to open files will be limited to two files; this is usually enough.

FILES= Command

The FILES command tells DOS the maximum number of files that may be open at one time. MS-DOS reserves about 56 bytes of memory for each open file. The default for MS-DOS 3.22 is a maximum of 20 files (with other DOS versions, the default is usually 8 files). The maximum setting allowed by MS-DOS is 255 files.

You can fudge a bit, and reduce the number of files to save memory. With FILES reduced to just 10, you can still run all built-in applications simultaneously with complete access to the online help files. This example will save about 560 bytes when you reboot your computer:

FILES=10

A more conservative setting of 12 will still save 448 bytes.

LASTDRIVE= Command

MS-DOS allows 26 drives, designated A: through Z:. A small amount of memory is reserved for each possible disk drive letter, up to a maximum determined by DOS at boot time (usually E) unless you specify another amount; the HP 95 defaults to LASTDRIVE=F.

Some MS-DOS versions will run in slightly less memory if you specify only as many drives as needed; the HP 95 appears to reserve the same amount of memory (.5K), even if you set LASTDRIVE=C.

 Note:  It is not necessary to add a colon after the drive letter.

SHELL= Command

The first time your HP 95 booted-up, the System Manager was in charge. The System Manager (also known as $SYSMGR) is the default MS-DOS shell for the HP 95. The shell program, then, is the front-end of MS-DOS; it responds to our keystrokes, displays information and runs programs.

Other MS-DOS computers use a shell named COMMAND.COM instead of the System Manager. You can make the HP 95 work like your desk-bound computer by specifying the same command interpreter:

SHELL=COMMAND /P

Now, when you reboot the computer the HP 95 will act just like a typical (boring) MS-DOS computer. You can return the built-in applications by typing the $SYSMGR command on the command line:

$SYSMGR

Loading the command processor is the final phase of booting the computer. Once MS-DOS passes control to the command processor, it is the command processor that executes AUTOEXEC.BAT The HP 95 $SYSMGR, does not look at the AUTOEXEC.BAT file.

 Caution:  The /P switch after COMMAND is vital to ensure that if the user types EXIT, the computer isn't halted. Much like MENU Q exits most HP 95 built-in applications, EXIT is the keyword used by COMMAND.COM to quit. And it will. With no command processor running the computer and no program to return to, nobody is there to respond to our keystrokes—nothing happens. Always remember the /P switch when you use the SHELL statement!

Notes About CONFIG.SYS

•	DOS will only interpret the first file of this name that it finds. This file is interpreted only when the computer boots. If you make changes to CONFIG.SYS, you will have to reboot (press CTRL+ALT+DEL at the same time) for the changes to take effect.

•	Adding the line LASTDRIVE=C does not save memory.

•	You cannot set STACKS=0,0 to save memory with DOS 3.22, while this command would be useful with DOS 4.0 or later. The HP 95 Owner's Manual states that the STACKS command is set at 9,128. Tests seem to confirm that the computer is actually using STACKS=0,0.

•	For memory conservation, consider reducing the values set with the BUFFERS, FILES, and FCBS commands.


Batch: DOS' Programming Language

It's a joy breezing through files and directories with the HP 95 Filer. But that pleasure is short lived when we pick-off a program to run by pressing F4, and the program complains about missing arguments. Batch files are a semi-elegant solution to that problem, turning mystical commands and switches into simple, intuitive, customizable keywords.

Batch files are just text files—you can edit them with Memo or any other text editor—containing MS-DOS commands just like we enter at the DOS prompt. When we run batch files, DOS replays the commands. Batch files always have the BAT file name extension. The batch language adds only a few new keywords; the next few pages talk about these commands.

Batch File Commands

Command	Purpose

ECHO	Displays text, enables or disables command echoing.

FOR	Repeats commands for a series of files.

GOTO	Go to a label. Labels begin with a colon (:).

IF	Conditional test.

PAUSE	Stop and wait for a key press.

REM	Remark.

SHIFT	Moves command line arguments left.

 Note:  Very few people learn to use FOR, IF and SHIFT. They're powerful and flexible commands, but they are usually more than we need. Please take the time to read those sections, but you probably won't use them frequently enough to worry about remembering the syntax. Besides, you can always refer back here later.

Every program and utility we add to our HP 95 adds to the power of MS-DOS—and extends the batch language. For everything we can type from the keyboard can be automated in batch files. Every convoluted command string we struggle to committo memory (or commit to a cheat sheet taped to the back of the HP 95) can be preserved in batch files.

Say you spend most of your time with the built-in HP 95 applications and only occasionally run DOS programs. You could set environment variables and suchlike with AUTOEXEC.BAT, but that would waste memory that could be put to better use creating larger 1-2-3 files. One solution is writing a batch file to set the PROMPT and PATH when you want to switch to DOS, then give the memory back when you return to Filer. This little file does just that:

ECHO OFF
PROMPT $P$G
PATH C:\;C:\_SYS
ECHO (Type EXIT to return to Filer)
COMMAND

Notice that we added C:\_SYS\ to the path. That's so DOS will be able to find DEBUG.EXE. But batch files can do much more. Say you use a program called HOG.EXE that requires environment variables and an odd start-up directory, then leaves the display a mess when it's done (this is not all that unusual). This batch file recovers from all these annoyances, demonstrating WHEREAMI.COM in the process:

Batch Command	What it Does

WHEREAMI >C:\GOHOME.BAT	Save the current directory.

SET IMAHOG=zyzzx	Allocate the environment variable.

C:	Log onto the C: drive.

CD \HOGDIR	Change to the odd directory.

HOG	Run the program.

COMMAND /c C:\GOHOME	Return to the original directory.

DEL C:\GOHOME.BAT	Delete the temporary batch file.

SET IMAHOG=	Release the environment variable.

CLS	Clean-up the display.

WHEREAMI.COM formats the current directory as a two-line batch file. In the example, WHEREAMI's output is saved in the temporary batch file named GOHOME.BAT..

 Note:  Usually we edit batch files with the HP 95 Memo program. For very short batch files, try DOS' COPY CON command. There are virtually no editing features (it's the same command line editor we always use), and if you make a mistake you'll have to start over, but for simple tasks or tests it's more than enough. This example creates a single line file with a DIR command:

COPY CON DIRW.BAT
DIR *.* /W/P

Press ENTER after each line. When you're done editing, press CTRL+Z then press ENTER to mark the end of the file. DOS will display "1 file(s) copied" to let you know the file was successfully created. Now, whenever you want to see a wide directory listing just type DIRW (or select the program file from Filer), and DOS will run the batchfile.

ECHO Command

The ECHO command has two functions in life: to enable or disable displaying commands as the batch file runs, and to display messages.

As DOS interprets each batch file command, it types each line to the display, as if somebody is inside the computer, typing from the other side of the keyboard. You can use ECHO OFF to turn off the display of each command and the redundant redundancies:

ECHO OFF

This does not stop the other ECHO command from working, it just suppresses the display of extraneous stuff. Unfortunately, each time you use ECHO OFF, MS-DOS displays that line, you can't redirect the results to the nul device (well you can, but it doesn't work).

On the long shot that you might want to turn echoing back on within a batch file, DOS offers another option:

ECHO ON

When the batch file ends, MS-DOS turns command echoing back on anyway, so the command is rarely useful. However, don't use ECHO OFF from the keyboard because the command prompt and other important information won't be displayed. You can remedy this situation by entering ECHO ON, again.

 Note:  With version 3.3 and later, MS-DOS recognizes the "@" (at sign) to mean "Don't echo this line." Many batch files printed in magazines and books begin with "@ECHO OFF", a nice little command that turns off echoing without telling us each time (alas, it's not available in MS-DOS 3.22). If a batch file from a magazine doesn't work on the HP 95, see if any lines begin with the at sign. Deleting the "@" characters should make the files run fine.

The Other ECHO

ECHO, like DISP in HP-BASIC or PRINT in Microsoft BASIC, displays messages on the screen. It can display a simple line of text:

ECHO The sky is falling!

Or, as we'll see throughout this section, it can display environment variables and command line arguments:

ECHO The command processor is: %COMSPEC%

ECHO with just a space or nothing at all will cause DOS to display:

ECHO is on

Fine, but how do you display a blank line? ECHO will ignore a period following the ECHO command; if that's all there is, DOS will display a blank line:

ECHO.

You could also use the plus, colon or quotation mark, but the accepted convention is to use a period.

 Note:  ECHO, like all DOS commands, requires a space between the command and any arguments. ECHO will ignore the first space (which is why "ECHO." works), but any additional leading spaces will be displayed. A tab character looks like several spaces on the display, but if you start with a tab instead of a space, DOS will delete the tab, then show the text left-flush.

MS-DOS recognizes ASCII character 7 as the bell—when you echo character 7 to the display, instead of displaying a character, the computer beeps. You can enter the bell character by pressing CTRL+G, which MS-DOS displays as "^G":

ECHO ^G

Every ECHO is displayed as if you were typing it, then again as it is executed. If you want your batch program to look attractive, remember to use the other ECHO—ECHO OFF—at the beginning of file.

 Note:  When we redirect ECHO's work, the message is not displayed. This is fine until we want to tell our users to change disks or give them a chance to quit before something awful might happen. We've included a program, called ECHO2.COM, that works like ECHO, but it ignores output redirection. This command will just about always send the message to the display:

ECHO2 Busy... Don't press CTRL+C right now! >NUL

ECHO2 works by displaying text through the StdErr device instead of StdOut..

If you call ECHO2 without anything to display, instead of displaying something annoying like "ECHO2 ON" it'll display a blank line. When it's not important if output is redirected, use ECHO instead of ECHO2, it will often be faster because internal commands have less overhead than external commands—DOS will have to load the ECHO2.COM program file for each call. Since the HP 95 uses a RAM disk, the time to load programs is barely noticeable.

Batch File Arguments

Like COM and EXE programs, batch programs can accept command line arguments. We access these arguments in our batch programs with replaceable parameters preceded by the percent sign. Replaceable parameters are placeholders for individual command line arguments. This example passes the first and second arguments from our batch file to DOS' REN command:

REN %1 %2

Think of the command line as a series of individual words separated by spaces. The replaceable parameter for the first word is "%1," the second is "%2," on up to "%9." DOS also provides us with "%0," which is the command used to start the program (complete with path and the file name, if you furnish them).

This example, called ECHOALL.BAT, displays the batch program name, then the first 9 arguments:

ECHO OFF
ECHO The program name is %0
ECHO %1 %2 %3 %4 %5 %6 %7 %8 %9

When there are fewer command line arguments than replaceable parameters, the extra parameters are removed, replaced on the command line by nothing.

Batch File SHIFT Command

The SHIFT command copies the value of replaceable parameter "%1" to "%0," "%2" to "%1," and so forth. If there are more than nine command line arguments, the next argument will shift into "%9." As you shift the arguments over, unused replaceable parameters are removed, until even "%1" returns nothing. After each SHIFT, "%0" will contain the previous contents of "%1." This illustration shows each replacable parameter (P1... P10) shifted one position to the left:

 Note:  The illustration on page B-21 of The HP 95LX User's Guide, Edition 1, demonstrates the results of DOS' SHIFT command inaccurately. The similar illustration above corrects the oversight.

When there are more than nine or a variable number of arguments, or the batch file is easier to write when you always refer to the same argument in a loop, try SHIFTing. This example, called ECHO1.BAT, displays one word from the command line each time through the loop:

Batch Command	What it Does

ECHO OFF	Turn off command echoing.

ECHO This program is: %0	Display the program name.

:Start	Top of loop label.

IF "%1" == "" GOTO End	Quit if no more arguments

ECHO "%1"	Display the text.

SHIFT	Shift the next argument into place.

GOTO Start	Return to the top of the loop.

:End	Label at the end of the file.

ECHO Done! %0	Say that we're done.

Execute this batch file with a command line something like:

ECHO1 hp 95 lx

As it runs, ECHO1.BAT will display:

This program is ECHO1
"hp"
"95"
"lx"
Done! 95

Instead of the program name, the last line displayed includes "95," the second to last word on the line, which was moved into "%0" with the last SHIFT command.

 Caution:  Once you've SHIFTed the arguments over, they are gone forever.

Always check that replaceable parameters exist before passing them to a program or command that needs the information. See IF, later in this section, for a method to ensure that the arguments are valid.

Batch Files And The Environment

Batch files, like real programs, need a place for their stuff: temporary path settings, program switches and flags. That place is the environment—the same environment that's used to store the path. This means that variables are handy to all programs, but at only 160 bytes, we can't store very much.

Just to make batch files harder to read, MS-DOS also uses the percent sign to represent replaceable environment variables. Where a single percent sign precedes replaceable parameters "%0" through "%9," we tack a percent on both ends of environment variables. This example displays the current path setting:

ECHO The path setting is "%PATH%"

 Caution:  You cannot use the batch file double-percent tricks from the keyboard, only batch files. MS-DOS will only expand the "%PATH%" to the current path while a batch file is running, so if you do it from the keyboard the "%PATH%" will be returned unchanged.

In a batch file, you can assign the contents of one environment variable to another:

SET TEMPPATH=%PATH%

A great use for this feature is to append something to the current path. Say your program loads from the C:\BIN\ directory and the current path is C:\;C:\_SYS\, you can set the path to your new path and the current path:

SET PATH=C:\BIN\;%PATH%

Now when you type PATH, you'll see that the original path now follows the C:\BIN\ directory. You can also add your directory to the other end of the path, in fact this is the preferred place, because many people carefully design their path—what's first will be searched first—so adding your directory in the front is just impolite.

 Caution:  One caveat: while DOS will let us create environment variables that look like replaceable parameters, batch files won't be able to read them.

Batch Command	What it Does

SET 1=Hello!	Assign the environment variable.

ECHO Arg: "%1%"	Display the environment variable.

ECHO Var: "%1"	Display the first command line argument.

SET 1=	Erase the environment variable.

When we run this batch file, DOS will display the command line argument in both ECHO statements—it never sees the "1" environment variable. Environment variables and replaceable parameters are two separate places in memory; you can't change replaceable parameters with SET, but you can copy parameters to the environment:

SET MyVar=%1

If you would like to every environment variable, type the SET command without any argument:

SET

 Note:  If your batch file creates environment variables, remember that the environment is only 160 bytes, so be sure to delete the variables when the program ends. If your program creates "X," delete is with this command:

SET X=

Batch File GOTO Command And Labels

If nothing gets in the way, batch programs run straight through from top to bottom, a line at a time. Sometimes, though, it's helpful to skip or repeat sections of the file. The GOTO command jumps around the file, from the position of the GOTO command to the program label it points to. For every GOTO, also called an unconditional branch, there's a matching label. And the label begins with a colon followed by a name of up to eight characters.

GOTO Quack

.
.
.

:Quack

After a GOTO, program execution continues on the line following the label. This example will sit in a loop until you press CTRL+C to quit the batch file:

Batch Command	What it Does

:LoopTop	Label.

ECHO Press ^C to quit	Display the message.

PAUSE	Wait for the next keystroke.

GOTO LoopTop	Return to the label.

MS-DOS searches for labels from the beginning of the file each time. If a batch program contains more than one identical label, only the first label found will be executed. The following example begins at the top of the file, but immediately jumps to thelabel named Test. The next line jumps to Label, which appears twice in the file:

Batch Command	What it Does

GOTO Test	Branch around the first label.

:Label	Will jump to this line.

ECHO Landed at the first label	This line will be executed.

GOTO End	Get out of the file.

:Test	The beginning of the test.

GOTO Label	Jump to the label named "Label."

:Label	This line will be ignored.

ECHO Landed the at second label	This line will also be ignored.

:End	The end of the file.

When you run this batch file, DOS will display "Landed at the first label" then jump to the End label at the end of the file. This is because it will start at the top of the file looking for the label. It's also partly why batch files run so slow: DOS has to read each line the batch file separately, then when it finds a label it returns to the beginning of the file and starts again.

 Note:  Most programming languages place the colon at the end of the label, while MS-DOS requires the colon at the beginning of the line. This isn't just to be contrary, but to save time. Batch programs have enough performance problems without having to look down each line for the colon. By starting the line with the colon, DOS has to look at only a single character when it's looking for labels, so label searches are relatively fast.

Batch File IF Command

The IF command adds life to batch files. Programs can test for current conditions and execute different commands while they run, all without our intervention. DOS' IF command understands three types of tests:

Variations of IF

Command	Purpose

IF string == string command	Compare two strings.

IF ERRORLEVEL value command	Test the exit code of the previous program.

IF EXIST filename command	Test if a file exists.

Any DOS command can follow the comparison. Each of these forms of IF can do negative tests using the NOT keyword. For instance, IF NOT EXIST means the test is true if a file does not exist.

IF NOT "%1" == "%PATH%" ECHO ^G

We usually compare two variables within quotation marks; that's a carry-over from high-level programming languages. All that's really necessary is a place holder—any single character appended to both strings—in case one of the arguments is empty. Say the user enters no command line at all, DOS will interpret the above as:

IF NOT "" == "%PATH%" ECHO ^G

That is an understandable (parse-able) statement. But if we leave out the quotation marks, it looks like:

IF NOT == %PATH% ECHO ^G

DOS will complain with a "Syntax error" message. Any character or characters will do, but we must use something. Here it is with a single quotation mark:

IF NOT ! == %PATH%! ECHO ^G

Tack a GOTO on the line after the test for conditional branching.  This gives programs the batch program the ability to think: to decide what to do next based on the outcome of a test. Should the user run the program without an argument, we can even offer helpful suggestions:

IF "%1" == "" GOTO Help

 Note:  The equality test is case sensitive. That means the two strings must match exactly for the test to prove true. Keep in mind that DOS stores environment variables without converting them to upper case, except the PATH, which is (usually) upper cased. Also watch for spaces; MS-DOS removes spaces from replaceable parameters, but not from environment variables.

All is not lost. We can use a quirk of DOS to convert the strings to upper case. Here's a kludge to convert command line replaceable parameters to upper case using the PATH keyword (it won't work with "SET PATH=" which just copies the string as-is).

Batch Command	What it Does

SET T=%PATH%	Save the current path setting.

PATH %1	Convert "%1" to upper case.

SET T1=%PATH%	Get the upper case string to "T1"

PATH %T%	Restore the path.

SET T=	Delete the scratch "T" variable.

IF "%T1%" == "QUACK" GOTO A	Compare the variables.

For simple comparisons that can be evaluated to labels, we can forget about the case problem—labels aren't case sensitive. For each valid option, create a matching label, and DOS will do the work for us if the argument on the command line matches a label. This example foregoes all of the overhead and kludginess of comparisons and environment variables:

GOTO %1

IF EXIST

The second form of IF actually looks at the disk drive to see if a file exists:

IF EXIST autoexec.bat GOTO End

Another variation is to check for the existence of a file name in a replaceable parameter:

IF EXIST %1 COPY %1 A:\

IF ERRORLEVEL

The ERRORLEVEL test doesn't test for errors at all! Perhaps it should be called "EXITLEVEL," because it tests the code returned to MS-DOS when programs exit. Zero (0) usually means success, and ever increasing numbers—up to 255 maximum—means bad news. The problem, though, is very few programs actually return codes that mean anything to ERRORLEVEL.

Say a program returns zero if all is well, and larger numbers as increasingly nasty things happen; if the number is at least four, something disastrous happened. A batch program can display the bad news:

IF ERRORLEVEL 4 ECHO Something is amiss

In HP BASIC, the equivalent code might look like:

IF E >= 4 THEN DISP "Something is amiss"

The ERRORLEVEL test proves true if the program returns a number that is greater than or equal to the number we're comparing. This means we need to test larger possible results first, then smaller numbers And we can'tjust check for "ERRORLEVEL 0" because every program will return at least zero. So we have to start at the largest likely exit code and work our way down (or just generalize).

This file fragment uses MEM.COM to check available memory, sending the information displayed by MEM to the bit bucket. It then decides which code to execute based on the ERRORLEVEL returned by MEM. MEM returns 3 for at least 300K memory, 2 for 200K, and so forth; if it returns zero, the computer has less than 100K of memory available.

Batch Command	What it Does

MEM > NUL	Don't display the results from MEM.

IF ERRORLEVEL 3 GOTO BigMem	If at least 300K available memory.

IF ERRORLEVEL 2 GOTO MedMem	If at least 200K available memory.

IF ERRORLEVEL 1 GOTO SmallMem	If at least 100K available memory.

IF ERRORLEVEL 0 GOTO LowMem	If not very much memory available.

 Note:  Many programs—especially small COM files—don't return a useful ERRORLEVEL. They won't necessarily return zero, even when they exit without error. As we seem toconstantly say, check the program documentation for more information. Since ERRORLEVEL is so seldom supported (even by DOS commands), its usefulness is regrettably limited.

Batch File FOR Command

The FOR command repeats a command for each matching argument. A single line in the batch file can execute a command any number of times.

You probably thought using both "%1" for replaceable parameters and "%PATH%" for environment variables was confusing. It's about to get worse. Replaceable variables for the FOR command begin with two percent signs! However, if you use FOR from the keyboard instead of a batch file, you must use only a single percent sign.

MS-DOS is very good at interpreting commands typed in all sorts of ways, but when it comes to FOR, it gets picky about syntax. The FOR command has three compulsory components: FOR, IN and DO. IN and DO aren't really parameters, but markers separating arguments:

FOR %%X IN (argument set) DO command %%X

The temporary variable named after the two percent signs is like an environment variable which exists only while the FOR command executes. The variable contains the results of the argument for each iteration.

The argument set, which is always in parentheses, is any file name or string. It can be one or more wild card file names or any text, but it's always separated by spaces.

The command is any MS-DOS command. Notice also that you can pass the variable to the command. This example displays a list of all COM and WK1 files:

FOR %%A IN (c:\*.com c:\*.wk1) DO ECHO Files: %%A

If the file named in argument set isn't a valid file, the FOR command is still executed at least once. For each iteration of the FOR loop, the next argument will be placed in "%%A," then the command will be executed. This program will execute NOW.COM six times (once for each period within the parentheses), displaying the current time and date a half dozen times:

FOR %%A IN (. . . . . .) DO NOW

The argument was ignored—we used it just as a loop counter. But even if the word isn't a file name, we can still pass it to the command:

FOR %%A IN (Twas brilig and the slithy toves) DO ECHO %%A

Many DOS commands and programs don't support wild cards. TYPE, for instance, works with only a single file. We can use FOR to repeatedly execute commands, just like wild cards. This single-line batch file, named WTYPE.BAT, takes a single wild card and TYPEs each matching file:

FOR %%A IN (%1) DO TYPE %%A

To use the batch file, type the file name followed by the wild card argument. This example shows the contents of all TXT files:

WTYPE *.TXT

 Note:  From the command line, you can use either one or two percent signs with FOR, but in batch files you must use two percents. This is because a single percent precedes a command line argument. In fact, you can save some typing by using just two percent signs, without specifying a variable name at all (FOR %% IN...) from the command line, but you must specify a variable in batch files.

Batch File PAUSE Command

We can pause a batch file to tell the user to change disks (or RAM cards), and to give them a chance to bail out before a batch file does something potentially dangerous. PAUSE is also useful to stop the program to give us a chance to read the display before reams of information go spilling off the top of the screen.PAUSE will stop and display:

Strike a key when ready . . .

If this prompt is too violent, try redirecting the prompt to the nul device and replacing it with your own message. Be sure to place the ECHO command before PAUSE, otherwise your message will be displayed after the user presses the key:

ECHO Tap a key lightly to continue . . .
PAUSE >NUL

PAUSE also gives us an additional chance to stop a batch file before it does something stupid. Press CTRL+C or CTRL+BACK while the program is paused and DOS will offer a way out of the program:

Terminate batch job (Y/N)?

The trouble with PAUSE is it doesn't tell the batch program what happened. We've included a work-around for this limit: WAITKEY.COM. WAITKEY returns an ERRORLEVEL representing the ASCII value of the keystroke. Letters are turned to upper case, function keys are turned into the numbers "0" through "9" and keys you'll probably not need are ignored (like ENTER and the cursor keys).

ECHO Tap a reasonable key... like A or M
WAITKEY
IF ERRORLEVEL 27 GOTO EscKey

The keys returned by WAITKEY are ASCII codes. For instance "A" or "a" is returned as 65, while "5" is 53.

Batch File REM Command

Like all self-respecting programming languages, DOS' batch has a remark command to insert notes or comments in your files. REM is also useful to comment-out parts of the file that are in limbo or perhaps don't work correctly.

Be sure to use ECHO OFF before any remarks, otherwise DOS will (most annoyingly) display everything.

 Note:  Since DOS ignores labels until it finds a GOTO, you can use a colon at the beginning of the line just like REM. Usually we enter a space after the colon. Both of the following will be ignored:

REM The cow is of the bovine ilk,
: One end moo, and the other end milk.

Perhaps themost important reason to begin comments with the colon instead of REM is speed. MS-DOS interprets REM and ignores lines beginning with the colon, so colon-ized comments run at least ten times faster than REM.

Colon comments have no noticeable effect on the speed of the GOTO command.

Nesting Batch Files

Batch files normally don't call other batch files. If they do, MS-DOS won't return control to the original file. This can be to our advantage, doing completely different things based on command line arguments, the existence of a file, or any number of variables. But when we do need to continue after calling another batch file, there is a way: load a second copy of the DOS command processor with the /C (short for "Call") switch, and have that program call thesecond batch file.

Say you have a batch file named FILE1.BAT and you would like to execute FILE2.BAT then continue, add the following line to FILE1.BAT:

COMMAND /C FILE2.BAT

This says to DOS: "Load the command processor then execute the command following /C, then exit and return to the previous command processor." We're not really nesting batch files, but actually nesting copies of COMMAND.COM.

Notes About Batch Files

•	Batch files are plain-text. You can edit them with any text editor, such as the HP 95 Memo program.

•	Each line must be no longer than 128 characters.

•	You can stop batch programs by pressing CTRL+C or CTRL+BACK. You may have to press the key more than once.

•	There is no "end" command for batch files. While program flow might move around the file, the only way to exit a batch file is by directing flow to the end of the file. We usually create an ":End" label at the bottom of the file, then use "GOTO End" to exit the program.

•	Release environment variables when your program ends. If you've used a variable named "X," use "SET X=" to release the variable. The environment is limited, every byte counts.

•	Watch for rampant percent signs. We use "%1" to read replaceable parameters, "%VAR%" to read environment variables, and "%%1" to mark replaceable arguments with FOR.

•	MS-DOS recognizes only the first eight characters in labels (not counting the colon). If two long labels are identical up to the first eight character, DOS will find only the first label in the file.

•	When you nest batch files (with the COMMAND /C switch) and assign environment variables, those variables will be automatically erased when the second batch file ends.

•	It's especially important to use ECHO OFF in batch files that contain REM lines, to keep DOS from displaying all your comments.

•	If you would like your batch file to beep, place the bell character (7) in an ECHO statement. You can enter the character by pressing CTRL+G.

•	You can eliminate the carriage return/line feed characters from the last line in the batch file. This will eliminate the extra line feed you often see displayed after the batch file executes.

•	If a batch file calls another batch file, control never returns to the first batch file.

•	MS-DOS versions 3.3 and later have a CALL command, which works just like the COMMAND /C switch, to call batch files. This command is not available in the HP 95's built-in MS-DOS 3.22.

•	DOS expects to see an end-of-file marker character (26, often displayed as ^Z, pronounced "Control zee") at the end of batch files. This character is optional. You can enter the character with the HP 95 Memo program by pressing CTRL+Z; Memo will display the character as "→". Since Memo can edit files beyond the end-of-file marker, you can add extra characters, such as notes, on the end of the file.

•	The batch language is extensible—every DOS program and utility we use enhances batch. Making use of the tools available to us doesn't just make batch better, it might just make us better.

AUTOEXEC.BAT

Most MS-DOS computers interpret the file named AUTOEXEC.BAT immediately after booting; this process is handled by the command processor (usually COMMAND.COM). The HP 95 boots MS-DOS 3.22 from ROM, using the System Manager command processor.

 Note:  Since it doesn't normally load COMMAND.COM, the HP 95 will normally ignore AUTOEXEC.BAT. The HP 95 will only read AUTOEXEC.BAT if the CONFIG.SYS file includes the SHELL=COMMAND /P statement.

AUTOEXEC.BAT is a text file containing commands just like you would enter from the DOS command line, and just like any other batch file, but DOS executes the commands automatically each time it boots. The only thing unique about AUTOEXEC.BAT is its name.

When you go to the DOS command line from Filer, the prompt and path settings return to the setting used when you booted the computer. You can work around this by creating an AUTOEXEC.BAT file that creates some standard environment variables then passes control to the System Manager (the built-in applications). Here's a typical AUTOEXEC.BAT file:

PATH=C:\;C:\_SYS
PROMPT $P$G
$SYSMGR

When you start from COMMAND.COM, the $SYSMGR command in AUTOEXEC.BAT passes control to the System Manager.

Notes About AUTOEXEC.BAT

•	Place commands to install TSR programs at the beginning of the file, before setting the PATH or other environment variables. This will save memory and minimize memory fragmentation.

•	MS-DOS will look for the AUTOEXEC.BAT file on the same disk that contains CONFIG.SYS. If you booted from the RAM card, AUTOEXEC.BAT is expected to be there; otherwise it is expected to be in the root directory of drive C:.

•	MS-DOS reserves only 160 bytes for environment variables.

•	If CONFIG.SYS includes the SHELL statement but there is no AUTOEXEC.BAT file, you will be prompted to set the time and date each time you reboot the computer. The computer will automatically set the clock if there is an AUTOEXEC.BAT file—regardless of if the file does anything useful (a simple ECHO statement will do).


Configuration Suggestions

Each time you shell out to DOS, any environment variables you create will be temporary, and will be discarded whenever you return to Filer. In order to create a permanent PATH, PROMPT or any other environment variable, you will have to add the SHELL=COMMAND /P statement to CONFIG.SYS, then create the environment variables, then execute $SYSMGR as the last line of AUTOEXEC.BAT. Otherwise, you will have to set these values each time you exit to DOS. Though if you do, approximately 2K will be used for the permanent copy of COMMAND.COM.

 Note:  Before creating a CONFIG.SYS file just to save a few hundred bytes of memory, keep in mind that the file will require 512 bytes of RAM disk storage space—that memory comes from the same pool as main memory. If you are booting from a RAM card, the 512 bytes spent there won't be as expensive.

For many applications, it might conserve memory to set environment variables whenever you shell to DOS. You can do this by creating a batch file with the appropriate SET commands, and COMMAND (without the /P) as the last statement.

 Caution:  These suggestions apply only to the HP 95. Many of these options will decrease available memory or operational speed for other computers.

If You Need Environment Variables

The CONFIG.SYS file conserves memory byreducing file buffers to the minimum. It loads a single device driver, then passes control to the command processor. AUTOEXEC.BAT sets a path so DOS can easily find programs, changes the prompt to show the complete path, then returns control to the built-in applications.

CONFIG.SYS

BUFFERS=1
FILES=12
DEVICE=WINK.SYS
SHELL=COMMAND /P

AUTOEXEC.BAT

PATH=C:\;C:\_SYS
PROMPT $P$G
$SYSMGR

You could also load TSR (Terminate and Stay Resident) programs from AUTOEXEC.BAT. To conserve memory, be sure to load the TSR before setting environment variables. This alternate example loads Borland's SideKick, a TSR program named SK.COM:

SK
PATH=C:\;C:\_SYS
PROMPT $P$G
$SYSMGR

 Note:  We will use Borland's SideKick as an example of terminate and stay resident (TSR) software several times throughout this book. This is not an endorsement for that product. SideKick was written long before the HP 95 was developed, and as such was not tested for compatibility with the HP 95LX.

If You Don't Need Environment Variables

This is the minimalist setup. It's most practicable if you work mostly with the built-in applications, and occasionally venture out into DOS. This CONFIG.SYS file reduces many system resources to minimal, almost skimpy, settings.

CONFIG.SYS

BUFFERS=1
FILES=8
FCBS=2

For even more savings, try setting FCBS=1.

Since there is no SHELL statement, the computer will ignore any AUTOEXEC.BAT when it boots. Even if this file exists, it will not be read.


More Room For DOS

There is life outside of Filer. But living there can be a bit cramped. Your HP 95 sprang to life with 512K of memory: 254K for the RAM disk and 258K for system memory. 258K is 264,192 bytes, yet CHKDSK reports only about 163,760 bytes available. Let's get back about 83,472 bytes of those missing100,432 bytes. That's right: MS-DOS on the HP 95 needs less than 17K of memory—most of DOS runs from ROM, regardless of how you boot it! What we need to do is get the memory back from the System Manager.

You can free the memory with just CONFIG.SYS, but for more flexibility, it takes several files. We'll explain each of these files in a few minutes.

More-Room-For-DOS Files

File Name	Purpose

CONFIG.SYS	Installs drivers and the command shell.

AUTOEXEC.BAT	Commands to interpret when computer boots.

DOS.BAT	Reboots the computer at the DOS prompt.

ROM.BAT	Reboots the computer, running built-in applications.

REBOOT.COM	This program reboots the computer.

Normally when the computer boots, it runs applications in ROM using the $SYSMGR command processor instead of COMMAND.COM. $SYSMGR uses the extra memory for shared data, the copy buffer and other information needed by the built-in applications. When you shell to DOS from Filer, you're actually running COMMAND.COM, the command processor, which in turn runs your DOS application programs.

The trick is to start the computer from COMMAND.COM instead of $SYSMGR, optimize wherever possible, and make the extra memory available to DOS.

Running plain DOS requires nothing more than adding a line to CONFIG.SYS specifying COMMAND.COM as the shell program—the command interpreter (the default command processor if you do nothing, is $SYSMGR, which runs the built-in applications). But to save a bit more memory, use the name COMMAND, without the COM extension, and a special internal command processor will take over (this won't work with other DOS machines—just the HP 95). If you're using a CONFIG.SYS file, add the following line; if you don't have a CONFIG.SYS, create one:

SHELL=COMMAND /P

Now when you reboot the computer, it will go through the usual startup gyrations, then display something like:

Copyright (c) 1991 Lotus Development Corp.
    All Rights Reserved
Copyright (c) Hewlett-Packard 1990
Copyright 1984,1985
    Phoenix Software Associates Ltd
Version A

C>echo off
C:\>_

If you start with a plain machine, you can type $SYSMGR to return to ROM-based applications.

To do things right, you will probably want several files: AUTOEXEC.BAT to make sure the date is set, DOS.BAT to boot the computer with as much memory available as possible, and ROM.BAT to return to the ROM-based applications. While you could boot by pressing CTRL+ALT+DEL, we've included a program called REBOOT.COM to do the work for you—and to make the process automatic.

The following are simple versions of DOS.BAT, ROM.BAT, and the support files.

CONFIG.SYS

BUFFERS=1
FILES=10
FCBS=2
SHELL=COMMAND /P

AUTOEXEC.BAT

ECHO OFF
PATH C:\;C:\_SYS
PROMPT $P$G

DOS.BAT

ECHO OFF
ECHO DOS.BAT resets the 95 to DOS.
ECHO Press ^C to cancel
PAUSE >NUL
REN C:\CONFIG.TMP CONFIG.SYS
REBOOT

ROM.BAT

ECHO OFF
ECHO ROM.BAT resets the 95 to ROM apps.
ECHO Press ^C to cancel
PAUSE < NUL
REN C:\CONFIG.SYS CONFIG.TMP
REBOOT

When you run ROM.BAT, it renames CONFIG.SYS to CONFIG.TMP then reboots the computer. As you'll recall, if there is no CONFIG.SYS file, the computer boots from the System Manager. DOS.BAT, on the other hand, renames CONFIG.TMP back to CONFIG.SYS then it, too, boots the computer. When CONFIG.SYS includes the SHELL statement, the shell program executes AUTOEXEC.BAT.

 Note:  These batch programs assume that REBOOT.COM is in the root directory. Since it's not a program you'll want to run by accident, you'll probably want to move it to a sub-directory; perhaps C:\BIN\ or C:\UTIL\. It's always a good idea to keep the root directory clean, and especially free of potentially dangerous programs.

Notes About Elbow Room

•	The SHELL statement in CONFIG.SYS allows you to break-out of the built-in applications, turning the HP 95 into a plain-DOS computer.

•	You can't type EXIT to return to return to the built-in applications when you boot from plain DOS. You must use the $SYSMGR command.

•	If you get "stuck" in DOS, relax! You can return to the built-in applications by typing $SYSMGR. Or you can change the name of CONFIG.SYS, then press CTRL+ALT+DEL to reboot.


TSR Programs

TSR simply means Terminate and Stay Resident. After TSR programs are loaded into memory, they disable themselves and return to DOS without releasing the memory they occupy. They sit, waiting for an event such as a key press or a character waiting at the serial port or maybe a clock tick, then they come alive, do their business, then fall dormant again until the next event. This can have several connotations from a simple keyboard patch to full-blown, pop-up applications.

Most TSR programs are of limited use to the HP 95: they frequently duplicate features built-into the computer. This is understandable, since most of the 95's built-in programs were based on a TSR program: Lotus Metro. The most beneficial TSRs are Device drivers. These programs add new features or extend the functionality of the computer. Practical TSRs include mouse drivers, Dvorak keyboard translators, and speech synthesis.

Three Ways to Load TSRs

1.	Create a CONFIG.SYS file with a SHELL statement. Load the TSRs from AUTOEXEC.BAT and add a $SYSMGR command to the file, then reboot the computer.

2.	After booting, switch to the Filer and execute the programs.

3.	Another type of TSR is the device driver; these program files are different from the conventional TSR. Device drivers (usually with the SYS file name extension) are loaded from CONFIG.SYS, using a DEVICE= line.

Comparing Device Drivers and TSRs

Device drivers are the simplest, most automatic and most memory efficient TSRs (especially when we use them with the HP 95). Since we load device drivers before the environment, built-in applications, and in fact most of DOS itself, they are, arguably, the most polite and reliable type of TSR. The only real limitation is that you cannot unload device drivers without rebooting the computer. Unfortunately, very few TSRs are available as device drivers.

We'll use WINK, a cursor enhancer program included in the HP 95 Utility Pack, in the following examples because it was written for the HP 95, and it's available as both a typical TSR (named WINK.COM) and a device driver (WINK.SYS). WINK sits quietly in the background, ensuring that the cursor is always a large, visible, blinking block (never a skinny little underline) when you want to see it, yet allowing programs to turn the cursor off when they want to.

Memory required by TSRs depends on how and when the programs are loaded as much as how large the programs really are. The device driver version of WINK requires under 200 bytes of memory, while the TSR can require from 400 bytes to over 2K, depending on how the HP 95 allocates memory for it. This table compares TSR memory requirements with HP 95 main memory partitioned into a RAM disk of 254K and System RAM at 258K:

TSR Memory Requirement Comparison

Bytes	Memory Cost	Programs

264,192	-	Total memory

163,760	100,432	Shell

163,616	100,432+144	With WINK.SYS

161,440	100,432+2,320	With WINK.COM

What's wrong with this picture? While WINK.SYS and WINK.COM have similar memory requirements after loading, loading any TSR will add extra memory for DOS data that cannot be reclaimed. WINK.COM returns what memory it can to DOS, but it cannot recover everything, and a small hole in memory (the size of allocated environment variables) will be created.

Installing TSRs

There are a couple ways to load the TSR version of WINK. The simplest way is to execute it from Filer, though that's a bit of a nuisance if you reboot often.

You can also load TSRs automatically from AUTOEXEC.BAT. This is the preferred method because less memory will be wasted and there is less likelihood of incompatibilities. You'll need a SHELL statement in CONFIG.SYS before the computer will even recognizeAUTOEXEC.BAT:

SHELL=COMMAND /P

Now, load the program from AUTOEXEC.BAT, then return to ROM-based applications by executing the $SYSMGR statement. Here's what AUTOEXEC.BAT might look like:

WINK
$SYSMGR

One way to minimize memory holes and fragmentation is to load TSRs before assigning any environment variables. A copy of the environment is created when every program runs; most TSRs have little need for the environment after they load, so they return the memory to DOS before they install themselves. This environment block exists in memory below the TSR itself, and it's usually quite small, so it will likely be left unused.

Borland's SideKick is one of the most popular TSR programs of all time. Version 1.56B (circa 1986) can run on the HP 95 with only a few hitches (and occasional crashes—this is the only program the author has found that hangs the computer). You will have to use CTRL+ALT as the hot key, not LeftSHIFT+RightSHIFT, because the HP 95 appears to have only a left shift key (internally, both shift keys are treated the same).

Usually you can unload SideKick by pressing CTRL+HOME+END; it might take a few tries to unload SideKick on the HP 95, and you'll have to also press the SHIFT key (for a total combination of CTRL+SHIFT+HOME+END).

 Note:  Loading TSRs by loading COMMAND.COM via CONFIG.SYS (the SHELL=COMMAND /P command) then adding the $SYSMGR statement to AUTOEXEC.BAT will cost at least 2K for the portion of COMMAND.COM that remains resident after loading $SYSMGR, regardless of how small the TSR program really is. The minimum COMMAND.COM will reserve is approximately 1.8K for itself.

Loading Device Drivers

Very few programs can load as a conventional TSR or device driver (they usually have the EXE file extension). Most, though, load just one way—using a separate program file if there are two versions. Device drivers load automatically when you reboot the computer, with a single line in CONFIG.SYS. The device driver version of WINK, for example, loads with this line:

DEVICE=WINK.SYS

 Note:  Most files that load device drivers end with the SYS extension. A few, however, are named BIN, and just a handful use the EXE extension (combining a DOS program and a device driver in the same file). Drivers are loaded from CONFIG.SYS.

While conventional TSRs leave wasteful memory holes, device drivers don't waste any memory at all. When the device loads, there is no environment—in fact, much of DOS hasn't been loaded, and none of the HP 95's built-in applications have run. Device drivers are, generally speaking, more sophisticated than garden-variety TSRs.

Notes About TSRs

•	Whenever you reboot your computer, you will have to reload your TSRs.

•	You can load TSR programs in AUTOEXEC.BAT, then add the $SYSMGR command at the end of the file.

•	TSRs may cut available memory so that built-in programs, even Lotus 1-2-3, may not be able to load.

•	Assign environment variables after loading TSRs. This will save memory, and will minimize memory fragmentation.


CHKDSK.EXE

Undocumented built-in HP 95 utility

The name CHKDSK is a contraction of "Check disk." This is a conservative name, it can also display available memory, list fragmented files and fix broken disks. It inspects and can correct the logical structure of your disk. CHKDSK can help keep your disk drive in order and your files safe. Select CHKDSK.EXE from Filer, or run it from the DOS command line:

CHKDSK

You can optionally include a drive letter on the command line; if you don't, or you run the program from Filer, CHKDSK will look at the current disk drive (usually C: on the HP 95). CHKDSK's report looks something like:

777216 bytes total disk space
267776 bytes in 7 hidden files
  2048 bytes in 2 directories
343552 bytes in 62 user files
163840 bytes available on disk

264192 bytes total memory
164672 bytes free

This short report tells use more than just the condition of the disk drive. Notice the 7 hidden files and one more directory than there should be. Notice also that in a computer that ostensibly has 512K of memory, CHKDSK reports 777,216 bytes of disk space plus 264,192 bytes of memory. That's about a megabyte, and it still doesn't account for some data in ROM!

Most MS-DOS bootable disks have two hidden files: MSDOS.SYS and IO.SYS (some DOS versions call these files IBMDOS.COM and IBMIO.COM); if there's a volume label, it also counts as a hidden file. But on the HP 95, built-in hidden files are quite different.DOS executes directly from ROM, so there's no need for the boot files. Still, there are seven hidden files, with the name ROMDUMMY, and extensions from 009 through 015 (ROMDUMMY.015, for example).

Correcting Disk Errors

When a program goes haywire or you reboot the computer while files are open, some data may not be written to files. CHKDSK can inspect and correct logical errors, not physical defects. The HP 95 does not have a physical disk drive. That's logical.

 Caution:  Run CHKDSK first without the /F parameter, then decide what action to take next. If CHKDSK reports no errors, there is no reason to run CHKDSK again with the /F switch—this isn't saying the disk always has a clean bill of health, just that if there are problems, they are beyond the power of CHKDSK.

CHKDSK /F

After CHKDSK corrects all disk problems within its power, you may find files in the root directory with the name FILExxxx.CHK, where xxxx represents numbers, beginning with FILE0000.CHK. These files are the lost clusters from partially saved files, most often they contain garbage. However, before deleting these files, have a look at them with Filer.

Notes About CHKDSK

•	If CHKDSK reports fragmented files on the C: disk, you can compress the disk. Since the HP 95 uses a RAM disk, file fragmentation doesn't slow disk access appreciably.

•	Since the HP 95 stores files in units of 512 bytes, files below 512 bytes cannot become fragmented.

•	Always run CHKDSK without the /F switch first. If disk errors are reported, make backup copies of important files before running it again with the /F switch.

Checking File Fragmentation

As we work, we're constantly writing and rewriting the same files, while other files come and go in an instant. MS-DOS handles this potentially wasteful process by allocating just what disk space is necessary; if a file won't fit in one contiguous block, it will extend to the next available block. As time goes on, bits of files can become scattered all over the disk. This is what isknown as fragmentation

Disk fragmentation is a concern with floppy or hard disk-based computers because it directly affects disk performance. The more disk drive heads have to move (called seek) to find pieces of files, the slower the disk drive seems to run.

The /V switch, which stands for Verbose, tells CHKDSK to display file names as it verifies the disk. This report will also list fragmented files. You can optionally specify a file name, with wild cards if you like. Here's the command line:

CHKDSK *.COM

CHKDSK lets us include wild cards, such as *.COM, or just /V, or both together, and the list will include hidden files, but the file specification cannot include hidden files (we can't use CHKDSK ROMDUMMY.* to see the hidden files). The results displayedby CHKDSK will be something like:

C:\95.COM
   Contains 2 non-contiguous blocks.
C:\SK.COM
   Contains 4 non-contiguous blocks.

Packing the C: Drive

Once CHKDSK has verified that you have several fragmented files (and you've decided that this is a problem—it probably isn't with your HP 95 RAM disk), you can pack all files to the beginning of the disk. This will leave free disk space in one contiguous block, and minimize new file fragmentation.

On your desktop PC, you might de-fragment the disk with a program like Norton Utilities or PC Tools. The HP 95 has a disk packer built-in! First delete any unnecessary files, then run CHKDSK with the /F switch to ensure the disk file chain is in good shape. Next, type EXIT to return to the ROM-based applications then press SHIFT+SETUP. Now select System then Memory. Make a note listing the current RAM disk and System RAM settings, then change the RAM disk size to the minimum setting then press ENTER. The computer will display a dialog box with the following message:

Reboot of the system needed
Press ENTER to reboot, ESC to cancel

Press Enter to reboot the computer. Now return to Setup System Memory and restore the original RAM disk size setting.

Defragmenting the C: Drive

If you have a RAM card or another PC, you can de-fragment the C: drive, making all files contiguous. First copy all important files to the other computer. Now you can delete the files from C:, or reformat the C: drive; the latter will be faster, but it will cause the computer to run SYSINIT.BAT—copying some files you may not want from C:\_SYS\ to C:\_DAT\.

You can then copy all important files back to the C: drive. To minimize re-fragmenting later, first copy files that are less likely to change—such as programs—and files that are under 512 bytes to the C: drive.


DEBUG.EXE

Undocumented built-in HP 95 utility

DEBUG is a memory browser, a simple assembler, and even a hex calculator. It has survived virtually unchanged through every version of DOS. There is a copy of DEBUG.EXE in the hidden C:\_SYS\ directory. It's surely hidden because a few commands can be dangerous, but more likely because it's only occasionally useful.

We won't explain everything about DEBUG here because if you are serious about assembly language, you will want to use a real assembler. While it's powerful, fast and efficient, make no mistake about it: DEBUG is a lousy assembler. Calculating instruction lengths for JMPs (and re-booting when you get the numbers wrong) is counter-productive.

DEBUG is useful chiefly for inspecting or patching memory locations or programs, and for converting program listings (like those in this book) into programs. Here's how to start DEBUG from the hidden directory:

C:\_SYS\DEBUG

You could also use the Filer Goto command to switch to the C:\_SYS\ directory then select DEBUG.EXE from the list of files. When DEBUG starts, the prompt changes to a minus sign followed by the flashing cursor:

-_

 Caution:  Now immediately press Q (which stands for Quit) then press ENTER to return to DOS. All of DEBUG's commands are a single character, like Q. But until you know the commands (and sometimes after), just trying things can cause serious damage!

We've included a table of DEBUG commands. Please browse this table before experimenting.

DEBUG's Dump command, abbreviated as D, is great fun. It lets us look at any location in memory, and displays the information as boring hex listings, but also as text—anything that looks even remotely like text is displayed. We can look at copyright notices,error codes, and notes in programs (not remarks, because compilers delete them when they create programs). Anything is fair game, so lets look at low memory at segment zero and offset 413 (hex):

D 0:413	; dump segment 0, offset 413

The beginning of this address looks something like:

0000:0410           0A 01 00 00 00

The example shows a screen-full of information, but the first two bytes are total memory size (byte reversed) in hex. 10A hex is 266 in decimal, so the computer has 266K of memory.

Leading zeros in memory addresses are optional, and if you use only a single number, DEBUG assumes that you're looking at another offset within the same segment. You can continue displaying from the last address by entering D without any address.

You can use DEBUG to see the current date, in decimal format. We're adding a second command on the line: L is the number of bytes to dump

D 0:4B8 L 7	; dump segment 0, offset 4B8, and 7 bytes

The L command tells DEBUG to display only seven bytes. If today is December 25, 1992, DEBUG will show something like:

0000:04B0                          19 92 12 25 21 05 00

The year is the first two bytes, followed by the month then the day. The last three values are the current time in twenty-four hour format.

You can see the BIOS release date. It's an 8-character text string at address F000:FFF5. To keep the amount of typing down, we've calculated the same address as FFFF:0005:

D FFFF:5 L 8

This time you will have to press SHIFT+ALT+RIGHT to see the text:

FFFF:0000                    30 34 2F-30 32 2F 39 31    04/02/91

Another way to limit the amount of data DEBUG will display is by specifying an ending address after the start address. This example shows the release date, just as above, but instead of specifying 8 bytes with the L command, we are specifying the ending address of the range. The starting offset plus the ending offset in hex (5+8 here) is D:

D FFFF:5 D

DEBUG's Hexadecimal Calculator

The H command performs 16-bit hexadecimal addition. This is a nice addition to the HP 95 because, as powerful as the HP Calc calculator is, it doesn't do hexadecimal math.

Type the letter H followed by a space then two hexadecimal numbers and DEBUG will display the sum of the two values and the difference between the two numbers.

H 1C 1234	; add two hexadecimal values

And the answer returned by DEBUG:

1250  EDE8

If the second number is larger than the first (as it is above) the difference is represented in two's complement notation. Here's a simple calculator batch (called H.BAT) program that passes two hex values to DEBUG. It creates a DEBUG script, passes control to the program, then deletes the script when its through:

ECHO OFF
ECHO H %1 %2 > C:\TEMP.SCR
ECHO Q >> C:\TEMP.SCR
C:\_SYS\DEBUG < C:\TEMP.SCR
DEL C:\TEMP.SCR

To use the program, exit to DOS then type the program name followed by two hex numbers:

H 1234 5678

The computer will display:

-H 1234 5678
68AC BBBC
-Q

Calculating Memory Addresses

While it's a 16-bit calculator, you can use it to figure 20-bit memory addresses. The key is tor keep in mind that the calculation is on the upper 16 bits, the lowest digit will not be changed.

Consider the address 0040:00F8, which is the location in low-memory where the key code from the last key pressed is stored. We'll start by adding the segment to the three high digits from the offset:

0 0 4 0	Start with a 16-bit segment.

  0 0 F	Add the high 3-digits from the offset.

0 0 4 F	The high word of the physical address.

In DEBUG, we enter the formula like:

H 40 F

DEBUG displays the result as:

004F  0031

The result is 004F. Now we'll shift the result over 4-bits and add the remaining digit from the offset. Ok, we'll really just tacked the remaining digit from the offset on the right. The DEBUG calculator stops at 16-bits, so we'll have to do this one by hand:

0 0 4 F 	The high-word from the calculated address.

        8	Add the remaining digit.

0 0 4 F 8	Which results in a 20-bit physical address.

Let's verify that the calculated segment and offset (004F:0008) work the same as the original address (0040:00F8). That address contains the address of the last key pressed, so when we press ENTER, the result should be 1C, the scan code for ENTER.

D 4F:8 8

If you press Enter, DEBUG will return:

32

Press F3 to recall the command line then instead of ENTER, press CTRL+M; DEBUG will respond with:

1C

There's a third way to verify the keycode: Type a character code 13 on the number pad. Hold down ALT then press the 1 then the 3 key. When you release the 3 key, DEBUG will show:

B8

Instead of M or ENTER, that's the scan code for the 3 key, the last key you pressed.

To clear this up a bit (and possibly make things murkier in the process), consider interrupt vectors. The interrupt vector table look-up table is stored at the low-end of memory, beginning at address 0000:0000. There are 256 possible interrupts, numbered0-255. Each vector consists of a two-byte segment and two byte offset.

Interrupt zero, at the beginning of the table, is invoked whenever a division by zero error occurs; most programs will change this interrupt to their own interrupt handler when they run, then restore the original when they exit.

This DEBUG command will display the first four bytes of memory (the address of interrupt vector zero):

D 0:0 3

Assuming the HP 95 will display the four bytes at the beginning of memory.

0000:0000  4E 4B 2D A3

In little endian fashion, the low byte of the offset is first, followed by the high byte of the offset, then the low and high bytes of the segment. On the HP 95, this default interrupt vector is usually A32D:4B4E; unscrambling the code in the example, that's what we have. We can use the address of the interrupt vector to see what the interrupt code looks like; this example uses the DEBUG's Unassemble command:

U A32D:4B4E

As you will see from the un-assembled code, unlike most other interrupt vectors, this one doesn't preserve registers. That's because if a program running in DOS causes a division by zero error, and it hasn't setup its own interrupt handler, DOS will takecontrol and terminate the program with an error message.

 Note:  Calculating addresses from segments and offsets is usually done in assembly language programs to allow memory operations to extend beyond 64K. After the calculation, the high 16-bits are placed in the segment register and the remainder (16 or less) will be the offset. This is often called Normalizing segments. The goal is to minimize the offset and move as much of the pointer as possible to the segment values so that pointers can be incremented farther without constantly fiddling with the segment.

Search Command

We could use the D command repeatedly to locate a special message in memory, but the Search command does that for us automatically. The search command is case sensitive; Upper and lower case characters are recognized as different characters. It may take a couple of tries before you find the text. Usually the first letter of a word is upper case and the rest is lower case, but not always. You can start the search at the second letter to make the search easier. This example will search the ROM BIOS for the word "Copyright" with just a bit of work:

S F000:0 FFFF "opyr"

DEBUG will display the address of each match. On the HP 95, it will look like:

F000:CD8A
F000:CDCD
F000:E021

The numbers returned are starting addresses, the address of the first character of matching strings. You can easily check the addresses, and see the text. We'll back-up the address by one byte to account for the missing "C" from "Copyright."

D F000:CD89	; display the copyright notice


Creating DEBUG Scripts

Working with DEBUG is error prone at the best of times; typing in long program listings is the worst of times. DEBUG's primitive line editor (the same as DOS' editor) is fine for exploring, but for larger projects, it's easier to use the 95's Memo program to create DEBUG Scripts.

A script is simply the same keystrokes you would type on the command line, but entered into a file. The obvious advantage is that you can go back and check your work, and even if DEBUG kicks it out with an error message, you can fix a line or two in the file—instead of typing every line again. There are two general forms of DEBUG scripts: assembly language listings (like CAPSON, listed below), and hex code listings (HELLO.TXT, in the next section). For shorter programs, assembly language mode is easier. With larger programs, hex codes are usually easier to enter, and they take less room on the printed page. If you want to distribute printed programs without source code, of course you'll use hex codes.

 Note:  We've included some small, deceptively simple utility programs written in assembly language. Our programs have comments on the right of many lines, following a semicolon (in Intel 808x assembly language, comments begin with a semicolon). Don't enter the comments in DEBUG, they are just for your information. When a comment says "; a blank line", press ENTER without typing any data; this will DEBUG's exit assembly mode.

When you enter these programs, keep in mind that all values are in hexadecimal. If you incorporate any of these routines in your own assembly language programs, be sure to add the assembly language hex radix specifier at the end of each number, in the format "1234H".

Here's a look at using DEBUG to enter hexadecimal data. Start DEBUG and type the following six lines:

N HELLO.TXT
E 100 48,65,6C,6C,6F,2C,20,77,6F,72,6C,64,21,0D,0A
RCX
E
W
Q

You're back in DOS with a new file named HELLO.TXT. Take a look at the file:

TYPE HELLO.TXT

It's a plain-old text file, not some string of mystical codes! The N command told DEBUG the name of the output file. The E command entered the data on the second line. RCX recalled the value from CX. Next, A entered assembly mode. The DB assembler directive means Define Byte or Data Byte, (depending on who you ask). Following on that line are a series of hexadecimal numbers. We cheated a bit.

We could have used assembly mode, and entered a quoted string and a carriage return then a linefeed character (0D,0A), marking the end of the text line.

N HELLO.TXT	; the output file name
A	; enter assembly mode
DB "Hello, world!",D,A

Now press ENTER once again to exit assembly mode (in other listings from now on, we'll show a blank line with a remark on the right). Then enter the next four lines:

RCX	; recall CX register
E	; number of bytes (in hex) to write
W	; write bytes to the file
Q	; quit DEBUG, return to DOS

Pressing ENTER on a blank line tells DEBUG to exit assembly mode. RCX recalls the contents of CX, the E is the length of the text (including the end of linecharacters). The W command says to write the information to the file. And finally, Q returns us to DOS.

Here's a quick little program that turns on the CAPS lock key and demonstrates DEBUG's assembly mode. You could call the finished program from AUTOEXEC.BAT to set your computer in upper case mode each time you boot:

N CAPSON.COM	; the program file name
A	; enter DEBUG assembly mode
XOR	AX,AX	; point data segment at low memory
MOV	DS,AX
OR	BYTE PTR [417],40	; set the caps lock bit
INT	20	; quit the program
; a blank line exits assembly mode
RCX	; recall CX register
B	; the program is B bytes long
W	; write data to the file
Q	; quit DEBUG, return to DOS

If you'd like to use CAPSON.COM, you could enter the code directly in DEBUG, or write a script file then redirect the file to DEBUG. By convention, script files have the same name as the finished program, but the SCR file name extension. The script file for CAPSON.COM is CAPSON.SCR. Once you've entered the text in the file, exit to DOS and redirect the script through DEBUG:

C:\_SYS\DEBUG < CAPSON.SCR

This says to DOS: "Send the file CAPSON.SCR through DEBUG." DEBUG will display each line as it works. When it's done, and DEBUG hasn't scolded you with errors or warnings, you'll have a file named CAPSON.COM. Once you've tested the program, you can discard CAPSON.SCR.

Notes About DEBUG

•	When you edit DEBUG scripts with the HP 95 Memo program, set word wrap to at least characters. This will keep the editor from splitting lines.

•	Press ENTER after each line. With Memo, make sure each script file line ends with the diamond-shaped end of line character.

•	When you're sure finished programs run properly you can discard script files.

•	To DEBUG, or DOS, or us, for that matter, a byte is a byte. Depending on where it is, a byte may be text or data or program code, yet it's really all the same inside.

•	All numbers used by DEBUG are hexadecimal.


SERINT.COM

Undocumented built-in HP 95 utility

This little program enables (/E switch) or disables (/D) the serial port interrupt. Disabling the serial port can conserve battery power.

C:\_SYS\SERINT

Running SERINT without any command line argument, will cause the program to display this message:

Usage: SERINT { /E | /D }


SYSINIT.BAT

Undocumented built-in HP 95 utility

This batch file copies TOPCARD.PCX, WTIME.DAT, and all files with ENV, ?BK, DCF, LCF, CTF, CCF, FCF extensions from the hidden C:\_SYS\ directory to C:\_DAT\.

C:\_SYS\SYSINIT

SYSINIT is run automatically when the computer does a cold boot, after initializing the RAM disk.

 Note:  Since there are always spare copies of seldom-needed files like MCI.DCF, even TOPCARD.PCX, in C:\_SYS\, you can delete these files from C:\_DAT\, then copy them back again with SYSINIT when you need fresh copies.


More than You Probably Want to Know

Background

These programs were written in Assembly language on a desktop PC-compatible. Programs were transferred to the HP 95 over the RS-232 interface using whatever communications program was handy; the 95 seems willing to talk with any communications program.

The original Utility Pack was the first software available for the HP 95. Later came The Productivity Pack, the result of months of development. The design goal was to create small, fast, simple, easy to use software, without compromising functionality. Simplicity is a very complex goal. Now, the two products are combined, forming one large, all-purpose Utility Pack for our palmtop PC.

Every line of program code in this product is original, written entirely in assembly language. The spelling checker engine and dictionary are new designs. No compiler runtime library or third-party add-in code were employed.

Extensive use of macros and high-level structures (available with Microsoft Macro Assembler 6.0 and later) minimized the amount of code needed, without compromising performance or program size. Still, development of the Productivity Pack took more than twice as long as the Utility Pack.

To complement the Utility Pack, we'd added the book The Explorer's Guide to the HP 95LX Palmtop PC. The Explorer's Guide offers hints and instructions for day-to-day life with your HP 95, and many more details about the HP 95.

The Utility Pack includes more than 35 small, efficient programs and utilities, including features missing from ROM-based MS-DOS 3.22—and some that are still missing from MS-DOS 6 and 7. You can use most of the utilities with your desktop PC. Adding the Productivity Pack increases the number of programs to over 40, and development time to over a year. And to top it off, we've added several useful chapters from The Explorer's Guide to the HP 95LX Palmtop PC. These three unique products are implements of instruction, designed to help you get the most from your HP 95.

In this latest release, we have recombined the software with a manual in a Windows-based help file. It may seem odd to have a help file that does not run on the Palmtop, but most users are also Windows users. A further advantage is reduced costs and online delivery.

HP 95LX Chronicles

In one corner of the HP factory in Corvallis, Oregon, no larger than a three-bedroom home, a string of industrial robots in sealed plastic ticket booths methodically assembles components on 95 motherboards. The classical music-like tempo and grace of therobots sets the pace for the rest of the assembly line. Technicians perform exacting tasks, including finishing and testing the computers. It almost looks easy.

But this isn't the birthplace of the HP 95. Most of the work on the 95, the gestation phase, happened long before it reached the factory. Engineering: that's why it looks easy.

According to the folks at HP, "LX" likely stands for Lotus Expandable, though this is of some debate. A few years ago it would have been named "HP-95 LX" instead of "HP 95LX." Because of changes in how HP's internal network handles product names, we won't see dashes in product names again—at least until HP changes software again.

The HP 95 is, to a greater degree than earlier HP handhelds, the product of a group effort. It's a bi-costal, even multi-national, computer. HP designed the "box" and much of the firmware in Corvallis, the display (though massaged for performance and quality by HP engineers) is from Sharp. Inside, the V20 microprocessor is by NEC (Nippon Electric Company), and HP and Intel created the Hopper chip—the "glue" holding the computer together.

HP customized the Phoenix BIOS. Microsoft provided the operating system, MS-DOS version 3.22. Lotus Development Corporation, of Cambridge, Massachusetts, besides the ubiquitous 1-2-3 spreadsheet, delivered most of the built-in applications. HP is also responsible for the elaborate calculator and the built-in games.

The built-in applications are a combination of new and old. Lotus 1-2-3 is, of course, a variation on the wildly successful spreadsheet program. The Filer, Phone Book, Memo and to some extent the other built-in applications are based on Lotus Metro, a well-integrated Terminate and Stay Resident (TSR) software package developed for PC-compatibles. Metro was itself based on another program: Spotlight, another TSR program that was purchased by Lotus.

As advanced as our 95 is, this isn't the only possible incarnation of the technology. It's an open system—open to reinterpretation as infra-red, touch-screen, speech-quality sound, digital to analog converters are needed.

The V20 Advantage

The Norton Utilities, version 4.5, System Information program (SI.EXE) rates the speed of the HP 95 at 2.5 times the speed of the original IBM PC (HP also unofficially rates thecomputer at 2.5). This number is often quoted, but it's a bit optimistic. In version 6.01, Norton errs in the other direction, rating the HP 95 at 1.2. The truth lies between 2.5 and 1.2; exactly where depends on your perspective.

The HP 95 easily deceives most performance benchmarks. It's a bit more efficient than its deskbound peers, while at the same time it's constantly taking short catnaps to extend battery life (which can distort some benchmarks). There's a square foot of circuity on a circuit board much less than half the footprint of the machine (if you're measuring, light travels about a foot in a nanosecond; that's a lot of nanoseconds saved).

The NEC V20 processor, operates at 5.37 MHz instead of the traditional 4.77 MHz. The V20 is an improved, more efficient, 8088-compatible processor. Most comparisons show the V20 to be 12 to 18% faster than the 8088.

Most PC compatibles' memory is DRAM, short for Dynamic RAM. Dynamic means power must be applied to RAM periodically (called refresh) to maintain memory contents. The HP 95 uses the more expensive PSRAM (Static or Pseudo-Static RAM); this eliminates the need for memory refresh to extend battery life. Eliminating memory refresh increases system performance about 8%.

A simple test by the author in compiled BASIC, comparing floating point and long integer calculations, clocks the HP 95 about 40% faster than a standard 4.77 MHz PC-XT. The only satisfactory benchmark is whether the computer can do the job in a reasonable amount of time, or are there interminable delays; the 95 passes this with flying colors.

Benchmarks aside, the increased clock speed accounts for about 13%, the efficiency of the V20 processor is good for another 12%, and SRAM adds another 8%. Other factors like tightly integrated design add a bit more—not quite 250% more, but more than enough to win the eleven-ounce, bantam weight division.

Memory (and Memories)

More famous than the MS-DOS command line is the 640K limit. That's the artificial wall the IBM designers imposed on the original IBM PC, which has survived long beyond the PC to haunt a generation of programmers.

Blame for the 640K limit is constantly (and mostly unfairly) placed on Microsoft; it's more justly placed on the times, and conservative engineers.

It made sense when the PC was being designed: RAM was expensive, and the popular CP/M (Control Program for Microcomputers) computers of the era ran just fine with only 64K. So offering ten times as much memory as current computers didn't seem restrictiveat all. After all, the original 4.77 MHz IBM PC shipped with 16K of memory—all for only $1600 (just add an audio cassette player for data storage and a home television set for the display and you're ready for serious work). It didn't seem like anybody could ever use-up 640K of memory; and certainly nobody could afford to try.

The reason main memory is limited to 640K in PC compatibles is the first ten 64K segments of the memory map are allocated to program usage (occasionally called Transient Program Area, or TPA). The memory addresses immediately following are reserved for the video memory, memory mapped plug-in devices and, at the high-end of the address space, the ROM BIOS—the shared, general purpose control programs that made the limited RAM capacity practical. Even if you can plug-in more RAM chips, the video buffers get in the way; more time and money has been invested circumventing the 640K wall than was spent developing the original PC.

The HP 95 is limited to 512K instead of 640K because memory chips only come in even sizes. The next size up after 512K is 1 megabyte, which wouldn't fit in the address scheme, and without fancy footwork would be largely be wasted.

The HP 95 works around the 512K, 640K and 1MB limits by bank switching, a method of letting multiple memory blocks share the same physical memory addresses. By enabling and disabling chips in the upper memory area, 64K blocks of program code and 16K blocks of data can be switched in and out. This scheme is used by the built-in applications, but it's extensible, allowing information on plug-in cards to also occupy physical memory addresses. We can plug in a program card and run the program in place, without loading a copy to RAM, and without wasting any of that precious Southernmost 512K.

Later Palmtops have more memory than the V20 can address, we've now seen the sum of the parts exceed the ability of individual components.

The memory map shows interrupt vector at the lowest memory addresses (which is required by Intel processors), followed by data and DOS. After the Video buffer (at segment B000), where conventional PCs have nothing to do, the HP 95 gets interesting. That's where code and data from XIP programs reside.


Glossary

Many computer terms are snagged from real-life situations. Others are acronyms, which we usually type in all-capital letters.

We won't list every computer term here; some phrases are evolving street lingo. Synonyms (read: euphemisms) for crash include break, hang and lunch; as in "Lunch the machine." An up-and-coming crash-replacement is assert. Synonyms for losing data include garbage, trash (as verbs), corrupt and lunch, again. Synonyms for bug include anomaly and feature. Serious bugs are often called "Incompletely implemented features."

Address

A location in memory. Memory addresses are usually expressed as segment and offsets, in the form SSSS:OOOO. See Segment and Offset, later in this section.

ASCII

The ASCII (American Standard Code for Information Interchange) standard character codes use an 8-bit value to represent symbols and characters. The Standard ASCII character set uses the first 128 values (0-127). The characters represented by high-order numbers (128-255) are dependent on the computer type; for IBM-PC compatibles, these are called PC-8 or code page 437 (English). The HP 95 uses code page 850 (Latin 1), which is similar for values below 155, and uses international characters.

Binary

Binary, base-2, numbers are the lowest form of life in the computer world. Binary digits are the ones and zeros, on and off states, of computer chips and peripherals.

BIOS (Basic Input Output System)

The BIOS is the pre-programmed ROM memory containing programs and utilities for booting the computer and communicating with hardware. Software calls BIOS routines for most of the hardware-dependent operations, which makes programs less dependent on quirks of individual computers.

Bit

Not very much. A contraction of binary digit, the bit is the smallest unit of storage. Usually combined into 8-bit units called bytes.

BOOT

Booting is the process of restarting the computer by "Pulling itself up by the bootstraps." The boot process tests the hardware, sets system settings, then loads the operating system (MS-DOS).

Byte

A byte is the smallest usable piece of information; often used to represent a single character like "A" or "%." A byte contains 8-bits. Numbers aren't stored as characters but as binary values usually of from one- to eight-bytes.

Command Line

The program path, name, and any arguments typed at the MS-DOS command prompt.

Command Tail

The "tail-end" of the command line. Everything following the command name.

Crash

Interaction of questionable logic (in program code or otherwise), misdirected attention, and acts of nature, which occurs just before making back-up copies of important data.

CPU (Central Processing Unit)

This is microprocessor, the "brain" of the computer. The CPU reads instructions stored in RAM and ROM in machine code (yet another language, this one is the lowest-level—although you might be on the look-out for P-Code compilers, which are even lower-level) and creates or modifies data in RAM. The IBM-PC family uses Intel 80x86, including 8088, 80286, 80386, and so forth. The HP 95 uses the NEC (Nippon Electric Company) V20 CPU, which is compatible with the 8088, with enhancements and greater performance.

DOS (Disk Operating System)

The disk operating system controls access to disk drives and files as well as high-level access to the keyboard, display, and other input/output devices. The disk operating system runs application programs, which in turn call the operating system for disk access.

Filespec

Short for File Specification, filespec refers to any valid file name. Program documentation and DOS books often use this term when any file name would be acceptable, such as "COPY filespec A:" to represent any file to be copied to the A: drive.

Hexadecimal

The numbering system used to represent groups of four binary digits. This is base-16, represented by digits 0-9, followed by the letters A-F. Hexadecimal is often abbreviated as Hex.

Keyword

All MS-DOS commands, program names and other symbolic names.

Kludge

A slightly embarrassing way to work around limitations and bugs. In the computer programming business, nothing seems to fit very well, so we patch and adapt, and hope nobody looks too closely.

MDA (Monochrome Display Adapter)

The 80 character by 25 line, text-only, monochrome display used by the original IBM-PC, and emulated by the HP 95.

Mnemonic

A word trick used to make a complex or forgettable phrase easier to remember. Mnemonic, pronouncednee-mon-ick, words are coined from abbreviations, contractions or acronyms. For instance, the term RISC (Reduced Instruction Set Computer) is descriptive, but it also denotes apprehensions felt by the original planners.

MS-DOS (Microsoft Disk Operating System)

See also DOS. Microsoft's MS-DOS operating system is the most popular piece of software ever written. Over sixty million computers run MS-DOS. The MS-DOS community is larger than France.

OFFSET

Intel-compatible CPUs represent addresses as combinations of segment and offset. The beginning of each segment is at offset zero, so the offset portion of the address is the number of bytes from the beginning of the segment. See also Segment.

Parser

Computer languages have words, grammar and rules—just like spoken languages. Parsers are computer programs that interpret commands written in these languages and translate them to commands the computer can understand. The MS-DOS command parser is COMMAND.COM; it interprets text we enter and translates it into commands DOS' language. Parsers are sometimes known as Lexical analyzers.

RAM (Random Access Memory)

This memory, the bits and bytes of main computer storage, can be read and changed. As long as the batteries are up to the job, the contents of RAM are maintained after you turn off the computer—on desk-bound computers, RAM contents are lost whenever you turn off the computer; this is known as "volatile" memory. The HP 95 contains 512K bytes of RAM, which is partitioned between main memory (for programs), and the C: RAM disk.

RAM Disk

A RAM disk emulates a floppy- or hard-disk drive. From the point of view of applications, RAM disks look like very fast disk drives. The memory is battery-backed and data is maintained intact as long as the battery is healthy.

ROM (Read Only Memory)

ROM memory is permanently pre-programmed containing programs and data that can be read, but nor reprogrammed. On the HP 95, the BIOS, operating system, all of the built-in applications, and part of the C: disk drive are on ROM chips, and cannot be accidentally (or even intentionally) altered or erased.

Segment

In order to increase the number of bytes addressable by Intel processors beyond 64K bytes, the designers added segments and offsets within that segment. Each segment of memory begins on a 16-byte boundary, and can be as large as 64K. Segments can overlap, but only on those 16-byte boundaries.

Symbol

Computerdom is no different than the real world: there are symbolic ways to express almost everything. Money and cars are expressions of wealth; family and peace are symbols of happiness. The problem is the symbols we choose, compounded by the limited number of ways computers have to express things.

System Manager

The System Manager is a system of built-in utilities and protocols for writing add-in HP 95 programs as well as controlling the built-in applications. The System Manager was designed and written by Lotus Development Corp., the creators of the 1-2-3 spreadsheet.


Hotkey Codes

Here are many of the keycodes available for assigning hotkeys to programs. If some of these numbers look strange, that's because they're in Hexadecimal notation, usually just called Hex.

Key	ALT

Q	1000

W	1100

E	1200

R	1300

T	1400

Y	1500

U	1600

I	1700

O	1800

P	1900

A	1E00

S	1F00

D	2000

F	2100

G	2200

H	2300

J	2400

K	2500

6	2600

Z	2C00

X	2D00

C	2E00

V	2F00

B	3000

N	3100

M	3200

Here are the special HP 95 keys. It's usually not a good idea to re-assign keys that have built-in programs assigned to them unless you want to replace a program.

Key	-	CTRL	ALT	SHIFT+ALT	SHIFT+CTRL

FILER	-	AE00	AB00	A700	AA00

COMM	AC00	B200	AF00	-	-

APPT	B000	B600	B300	-	-

PHONE	B400	BA00	B700	7800	-

MEMO	B800	BE00	BB00	7A00	-

LOTUS	BC00	C200	BF00	7B00	-

HP CALC	C000	C600	C300	7E00	-

MENU	-	CA00	CB00	-	-

A few additional keys are available, scattered about the keyboard. These are unusual key combinations that are unlikely to conflict with other programs. The third column describes the key.

Key	Code	Key Name

ALT+ (	8000	Left parenthesis.

ALT+ )	8100	Right parenthesis.

ALT+ ,	3300	Comma.

ALT+ @	7900	At symbol.

ALT+ =	8300	Equals symbol.

SHIFT+ALT+ =	8200	Equals symbol.

CTRL+ *	9600	Asterisk (multiply).

ALT+ *	3700	Asterisk (multiply).

CTRL+ -	8E00	Minus.

SHIFT+ALT+ -	7D00	Minus.

CTRL+ +	9000	Plus.

Shift+ALT+ +	7C00	Plus.

 Note:  Some ALT-modified keycodes may conflict with Lotus 1-2-3 macro key assignments. See the Lotus section of your HP 95 manual for instructions for creating Lotus macros.


Debug Commands

Code	Purpose

A [memory address]	Assembly language mode.

D [mem_start][mem_end]	Display (dump) memory.

E address [data]	Enter data in memory.

H n1 n2	Hexadecimal Addition.

(see text)	Load file or sectors.

N file_name	Name file.

Q	Quit.

S [mem_start][mem_end] "text"	Search for text.

U [mem_start][mem_end]	Un-assemble.

W	Write data to file.

See DEBUG.EXE.


MS-DOS Commands

This table lists just about all of the options available on teh MS-DOS command line. Optional parameters are shown in square brackets. Here are the syntax rules followed in the table

c:	Drive letter.
filespec	Any file name.
[ ]	Optional parameter.
|	Choose one of two options.

Name	Purpose

$SYSMGR	Loads the System Manager. Works only if you boot from plain DOS.

BREAK [0N | OFF]	Enables or disables break checking.

CD [dir_name]	Change to a different directory. If used without an argument, displays the current directory name.

CHDIR [dir_name]	Synonym for CD.

CHKDSK [c:][filespec]	[/F] [/V]	Verify integrity of the disk. /F can also repair disks. /V shows files.

CLS	Clears the screen, sends cursor to upper left corner.

COMMAND [/C] [program]	Load a new copy of the command processor.

COPY source destination	[/A | /B] [/V]	Copies one or several files to a new location. Can use wild cards for source if the destination is a path name. /A means ASCII, observes the end of file marker (character 26), while /B does a binary copy. /V verifies that the copy is accurate.

CTTY COM1 | CON	Change the keyboard and display to an external device.

DATE [mm-dd-yy]	Display or set the date. Use TIME to change the time.

DEL filespec	Delete one or several files.

DIR [filespec] [/W][/P]	Display a directory listing. /W for wide, /P to pause.

DISPCTL [+C|-C] [+K|-K]	±C cursor tracking. ±K ALT+cursor movement.

ECHO [ ON | OFF ]	Turns command echoing on or off, displays current status.

ECHO text	Display a text message.

ERASE	Synonym for DEL.

EXIT	Exit the command processor and return to Filer.

FOR %%a IN (set) DO cmd	Repeat a command for each item in (set). Most often used in batch files.

FORMAT A: [/E] [/P] [/Q]
[/R:ss] [/V]	Format a RAM card. /Erase all sectors, /Pseudo-floppy, more space, not PCMICA compatible. /Quiet suppress prompts. /R: number of sectors for root directory file information (16 files per sector); default is 4. An internal command on the HP 95.

GOTO label	Used in batch files to transfer control to a label. Labels begin with a colon, as in ":LABEL".

IF text == text cmd	Conditional test used in batch programs.

MD [C:]dir_name	Create a new directory.

MKDIR 	Synonym for MD.

PASSWORD [/A][/M][/D]	Create or change the startup password. /A=autolock, /M= manual lock, /D = disable password protection.

PATH [path_name]	Displays or changes the PATH environment variable.

PAUSE [>NUL]	Suspends a batch file until the user presses a key.

PROMPT [prompt_text]	Changes the command prompt.

RD dir_name	Removes a directory. There must be no files in teh directory.

REM comment	Add comments to batch files. Can also begin comments with a colon and a space, which runs faster and is easy to read.

REN old_name new_name	Rename a file or group of files.

RENAME old_name new_name	Synonym for REN.

RMDIR	Synonym for RD.

SERCTL /O | /W | /I	Turns off the serial port (/O), changes to wire (/W) or infrared port (/I).

SET	Display all environment variables.

SET var=text	Allocate or remove an environment variable.

SHIFT	Shift position of replaceable parameters left for batch files.

TIME [hh:mm:ss]	Display or set the time. See also DATE.

TYPE	Display the contents of a text file.

VER	Display the version of the MS-DOS operating system. On the HP 95 this is "MS-DOS Version 3.22."

VERIFY [ON | OFF]	Display, enable or disable verify. When enabled, MS-DOS verifies that files are written to disk correctly. The default is off. On slows the computer slightly, and adds little security.

VOL [c:]	Display the volume label. The HP 95 can only create labels when formatting disks, it does not include LABEL.COM.


PROMPT Symbols

This table lists the symbols available for creating DOS command prompts. Here is the syntax for the PROMPT command:

PROMPT $P$G

Symbol	Meaning

$$	The dollar sign.

$_	This symbol adds a carriage return and linefeed. This allows your path to extend over two or more lines.

$B	The piping character (|).

$D	Today's date, in the format "Sat 09-04-1991" or the format set with COUNTRY statement in CONFIG.SYS.

$E	The escape character, ASCII code 27.

$G	Greater than (>) symbol.

$H	Backspace. This is a destructive backspace, it erases the character under the cursor then moves the cursor to the left one position.

$L	Less than (<) symbol.

$N	The current drive letter (C:). This is much less useful than the $P command, which includes not just the drive letter, but also the complete path.

$P	The drive letter and path, in the format "C:\_DAT"

$Q	Equals sign (=).

$T	This symbol inserts the current time in the format 22:33:44.55, complete with hundredths of a second.

$V	Operating system version. With the HP 95, this symbol displays the string "MS-DOS Version 3.22"


File List

Files included with this product

We have included more than one version of a few System Manager compliant programs. For instance, there are two versions of I95; the larger version offers online help and slightly more detailed machine information. The smaller version saves about 3.5K of disk space. Here's a list of program file names:

95.COM	HP 95 system configuration.

95UTIL.HLP	This Microsoft Windows help file.

95UTIL.CNT	Windows Help contents. Not required for Windows 3.x.

ASCTABLE.EXM	Pop-up character converter.

AUTOEXEC.BAT	Sample batch file.

BATTERY.COM	Check battery level. HP 95 only.

BATTERY2.COM	Check battery level, display on two lines. HP 95 only.

BEEP.COM	Four-tone sound.

BIGTIME.EXM	Big digital clock.

BW80.COM	Set CGA monitor in BW mode.

CHECK95.COM	See if the computer is an HP 95.

CONFIG.DOS

CONFIG.ROM

CONFIG.SYS

DIRS.COM	Search the disk for files.

DISKFILL.EXE	Overwrite unused disk space.

DISKSIZE.COM	Disk space information

DISP.COM	Enhanced ECHO replacement.

DOS.BAT

ECHO2.COM	Display text through StdErr.

FATTR.COM	Set file attributes.

FCRYPT.COM	Encrypt a file.

FTD.COM	Set file time and date.

GETKEY.COM	Wait for a keystroke.

I95.EXM	System information and configuration

I95S.EXM	Smaller version of I95.EXM. No online help.

INTR.COM	Check interrupt vector information.

MARY	Sample music to play with PLAY.COM.

MEM.COM	Show memory information.

MOUSEFIX.COM	Reset the mouse driver.

NOW.COM	Display the current time and date.

PAUSE2.COM	A simple PAUSE replacement. Just for fun.

PAUSE95.COM	Low-power PAUSE replacement.

PCINFO.EXE	Computer configuration information.

PCX.COM	Display PCX graphics, wait for a keystroke, clear the screen.

PCXS.COM	Display PCX graphics, leave the picture on the screen.

PCXINFO.COM	Information about PCX graphic image.

PLAY.COM	Play music.

RANDWORD.COM	Create custom passwords.

README.TXT	If present, includes updated product information.

REBOOT.COM	Reset the computer.

RENMOVE.COM	Rename a file or sub-directory.

ROM.BAT

SEROFF.COM	Turn off HP 95 serial port

SHOWKEYS.COM	Display keystroke information.

SIFT.COM	Text file filter.

SIFTHIGH.COM	Text file filter. Translate high-order characters to displayable characters.

SIFTI.COM	Text file filter. Translate international characters.

SIFTWS.COM	Text file filter. Strip the high-bit from all characters.

SLEEP.COM	Put the HP 95 to sleep.

SP.EXM	Complete spelling checker.

SPL.EXM	Same as SP.EXM, without online help.

SPM.EXM	Medium size spelling checker.

SPS.EXM	Smallest spelling checker.

TEXTMODE.COM	Return to text mode.

TMORE.COM	Display text one screen at a time.

TTYPE.COM	Display a text file; TYPE replacement.

UNCOMMON.COM	Create a DEBUG script.

WAIT.COM	Wait for a keystroke or amount of time.

WAITKEY.COM	Wait for a keystroke.

WHEREAMI.COM	Display the current drive and directory name

WINK.COM	Large cursor TSR.

WINK.SYS	Large cursor device driver.

WORDS.COM	Count words, sentences, paragraphs.

WORDSI.COM	Count words, sentences, paragraphs. International character set.


Using Windows Help

Buttons

Wherever you are, the Contents button returns you to the main table of contents.

The Search button pops-up a list of topics listed by keyword and subject; this is the document index. You can find a subject even if you don't know the keyword name by looking for a related word. In Windows 95 and later, some items are listed in two levels; in Windows 3.1, related items are separated by commas.

Topics are listed alphabetically. The >> button takes you to the next topic in the list, and the << button moves to the previous topic. This is a convenient way to browse the help file to familiarize yourself with this product.

In Windows 3.1, the History button pops-up a separate window listing the last 40 help topics you have visited. In other versions of Windows, the History window is available from the Options menu.

The Back button returns to the previous topic you visited. The help program remembers up to 40 topics, so click the Back button one or more times if you have followed several links and want to find your way back to the original topic.

Keyboard shortcuts

Keystroke	Action

>	Move to next topic.

<	Move to previous topic.

B	Like the Back button, back-up one item in the History list.

C	Like the Contents button. Return to the table of contents.

S	Like the Search button. Open the search (index) window.

TAB	Move to the next link on the current page.

SHIFT+TAB	Move to the previous link on the current page.

ENTER	Jump to the selected link.

ESC	Close a window. In Windows 95 or later, if no other windows are open, closes the help file.

DOWN	Scroll down in the current topic.

UP	Scroll up in the current topic.

PGDN	Move down one screen-full in the current topic.

PGUP	Move up one screen-full in the current topic.

LEFT	Scroll the window left. Only works if the document is too wide to fit in the window.

RIGHT	Scroll the window right. Only works if the document is too wide to fit in the window.

The following navigational aids are available when viewing this help file:

Keystroke	Action

H	Open or switch to the History window. Press Esc to close the window and return to this help file.

SPACE	Move to next item. Same as >>.

CTRL+PGDN	Move to next item. Same as >>.

CTRL+PGUP	Move to previous item. Same as <<.

BACKSPACE	Move to previous item. Same as B.

Other help files by us follow these keyboard conventions.

Document links

Links to topics are underlined, usually displayed in green. Click on these keywords to jump to the underlined topic.

Links to pop-ups are underlined with a dotted line, usually displayed in gray or green. Click on these items to pop-up a small box containing a list of related topics or a definition. When you click the mouse outside of the pop-up window, the original topic is still on the screen.

Help Contents Window

If you are using a 32-bit help file viewer, and you do not want to use a separate, pop-up contents window, follow these steps:

•	Close this help file.

•	Rename the file 95UTIL.CNT to 95UTIL.TMP. This file contains the contents information used by Windows help. There is a separate table of contents in this help file.

•	Delete the file named 95UTIL.GID. The file will be recreated by Windows help the next time you view this help file.

•	Open this help file again.

If you change your mind later and decide to use the contents window, change the name of 95UTIL.TMP back to 95UTIL.CNT. When you next view this help file, the contents window will again work.


Copyright

Software License

These programs are copyrighted materials; treat them like a copyrighted book. Like a book, this software can be used by only one person at a time. This software is licensed for use on a single computer. Where multiple versions of a program are furnished,you are allowed to use only one version at a time. If you would like to use this software with more than one computer, you will need to purchase additional copies of this package.

Notice

All rights reserved. Reproduction or distribution of the editorial contents or programs in any manner without express written permission of the author is prohibited. While every effort has been made to assure the accuracy of the materials presented, no liability is assumed by the author. These materials are made available solely on an "as is" basis, and the user (and not the author nor any other party) shall bear costs of incidental or consequential damages in connection with or arising out of the furnishing, use or performance of these materials.

Intellectual property is a possession, much like any other property. By receipt of these materials the user agrees to abide by applicable copyright laws. Without support of copyright laws there would be little incentive to create new products. Unauthorized copying of computer software is a felony, punishable by fines of up to $250,000 and prison terms of up to five years.

Copyright © 1991-1997 Richard E. Harvey, All rights reserved.
P.O. Box 5695
Glendale, AZ, 85312  USA

Email: r_harvey@compuserve.com

Please visit our web site:

http://ourworld.compuserve.com/homepages/r_harvey

Acknowledgments

Lotus and 1-2-3 are trademarks of Lotus Development Corp. Microsoft, MASM and MS-DOS are trademarks of Microsoft Corp. IBM and PC are trademarks of International Business Machines, Inc., TrueType is a trademark of Apple Computer, Inc. (while Apple is a trademark of Apple Records), Hitchhiker's Guide to the Galaxy is probably owned by Douglas Adams. All other product names owned by these or other people are also acknowledged.