HP | 9000 Series 300 | Porting HP BASIC/9000 Programs to HP BASIC for Windows

application
HP2
H
BASIC
2 Porting Considerations
Porting HP BASIC/9000 Programs
to HP BASIC for Windows Version 7.0
and Above
One of the hallmarks of the HP BASIC family has been the
ability to develop applications which will run on a variety
of computer platforms. HP BASIC for Windows adds the
PC platform to the RMB© (Rocky Mountain Basic©) family.
This product note describes differences between
HP BASIC/9000 (Including Series 200, 300, 400, and 700
computers) and HP BASIC for Windows. Differences in
hardware, file system, and keywords are discussed to help
you move programs to HP BASIC for Windows from other
HP BASIC platforms.
The CONFIGURE command allows you to customize
HP BASIC for Windows to more nearly match the
configuration of an HP 9000 computer. This command is
described completely in the documentation supplied with
the product.
Hardware Differences
HP BASIC for Windows compensates automatically for
many of the hardware differences that exist between
an HP BASIC/9000 and other hardware platforms.
The following sections outline many of the differences
and explain what limitations still apply.
Disk Drives
GPIB disk drives are not supported. No mass storage
device is supported across the GPIB. HP LIF disks are not
compatible with DOS disk formats and cannot be read or
written directly by HP BASIC for Windows. However,
there are LIF utilities provided with HP BASIC for
Windows for transferring files from LIF disks. These
utilities work with most PC floppy drive mechanisms.
Softkey Layout
Different keyboard layouts are used by HP BASIC/9000
and PCs. Some PC keyboards have the softkeys down the
left side of the keyboard, and some have them across the
top of the keyboard. To make up for these differences and
the lack of spatial coherence between the physical keys
and the softkey menu, HP BASIC for Windows menu
labels have been numbered to provide numerical
coherence. The label numbered “1” always corresponds to
the softkey with the 1 printed on it. The number is not
meant to be the softkey number.
To provide compatibility with programs written for the
9836 Nimitz keyboard (which starts with softkey K0), the
command KBD CMODE can be used to turn on or off
compatibility mode.
HP BASIC /WS
S300
HP BASIC /UX
S300
HP BASIC/UX
S700
HP BASIC for
Windows
A New Backspace
Under HP BASIC, the BACKSPACE key was assigned to
CHR$(255)&”B”. This function does the same thing that
the LEFT arrow key does. HP BASIC is unique in this
treatment of the BACKSPACE key. For compatibility with
the remainder of the computing community, HP BASIC
for Windows assigns a new function to the BACKSPACE
key. Pushing BACKSPACE deletes the character to the
left of the cursor. This function is named DEL LEFT and
is equivalent to the function LEFT followed by DEL CHR.
If you do not like this definition, you may be able to
redefine the key using the CONFIGURE KEY statement.
Series 300 Bit-Mapped (CRTB) Displays
If using an HP 9816, 9836, or other HP computer with
separate alpha and graphics hardware, some of the
differences you find in HP BASIC for Windows will be
the same differences you would find moving to an HP 310
or another HP computer with a fully bit-mapped
alpha/graphics display. On bit-mapped displays, the
ALPHA image is written into one or more of the graphic
planes. On HP BASIC/9000 workstations, one plane can
be separated from the others for use solely for the
ALPHA image. Or, all the planes can be merged for
shared use between ALPHA and GRAPHICS. HP BASIC
for Windows supports both separated and merged mode.
When ALPHA and GRAPHICS are merged, ALPHA text is
converted to graphic bits and written into the graphic
planes, overwriting any graphics data that might be
present. Therefore, ALPHA and GRAPHICS cannot be
dumped separately. And when the ALPHA text is scrolled,
any graphic data present will be scrolled also.
CRTB Mode is the default for Windows system drivers.
This mode gives the best HP 9000 emulation.
9836C (CRTA) Displays
The HP 9836C display is driven by CRTA Mode drivers.
A CRTA display has distinct ALPHA and GRAPHICS
images. Either the ALPHA or GRAPHICS images can be
displayed, or both can be displayed at once, overlapping
each other. The hardware for the two images is
independent. HP BASIC for Windows emulates CRTA
Mode drivers.
1
Processor
Miscellaneous Differences
The instruction sets for the Intel x86 family of processors,
Motorola 680x0 processors, and HP Precision
Architecture processors are all different. Since a CSUB
contains processor code, a CSUB cannot be moved from
HP BASIC/9000 or HP BASIC for Windows on one
processor and executed under another. The same holds
true for assembly routines called with WRITEIO 9827.
The serial interface is enhanced with XON/XOFF flow
control, and is enabled by default. If you are porting
existing programs that transfer binary data or ^S and ^Q
characters as part of the data, you should turn off
XON/XOFF flow control and turn on hardware
handshaking with the statements:
Speed
If speed is critical to your application, these suggestions
may be helpful: Buy a processor with math instructions
built-in (such as the 486, 486DX, or Pentium), or to add a
math coprocessor. Pentium systems can meet the
performance needs of most applications.
Clock
Millisecond timing resolution is not available on the
IBM PC. The PC clock runs at about 18.2 ticks a second.
Thus, all timing functions within HP BASIC for Windows
have a best resolution of about 55 milliseconds.
IEEE-488
Most computers are not sold with an integral IEEE-488
interface. Contact Hewlett-Packard for information on
supported interfaces for the PC and other platforms
running HP BASIC for Windows.
Some interfaces lack minor functionality. For example,
PC IEEE-488 interface cards that use the NEC 7210
IEEE-488 controller chip are incompatible in the
following areas:
• All READIO and WRITEIO registers are different
• Bit 0, IFC, is not supported in STATUS register 5 or the
ENABLE INTR mask.
• The REM and LOC bits of STATUS register 6 are not
supported as well as the DAV, NDAC, NRFD, and IFC bits
of STATUS register 7.
Character Set
The default character set used by the IBM PC is
different than the HP Roman-8 character set used by
HP BASIC/9000. The differences exist in characters
CHR$(128) and above. In HP BASIC for Windows, all
characters from CHR$(128) through CHR$(254) are
allowed in variable names. If running a program with
HP BASIC/9000 and HP BASIC for Windows, you should
restrict variable names to characters from CHR$(161) to
CHR$(254) and the legal characters less than CHR$(128).
Shared Resource Manager (SRM)
HP BASIC for Windows can be a classical SRM client on
an SRM server. Also, with SRM/UX servers, DOS
computers can access the files on the server using NFS.
HP BASIC for Windows is also compatible with most
industry standard networks, such as NetWare and LAN
Manager.
2
CONTROL 9,100;0
CONTROL 9,5;0
CONTROL 9,12;0
The maximum line number in HP BASIC for Windows is
4,194,304. If you plan on also running a program on an
HP BASIC/9000 series 200/300 computer, you should not
use line numbers over 32,766.
The maximum length of a line, in general, is the same as
HP BASIC/9000. However, in rare instances (such as a
program with hundreds of variable names and a program
line with little used operands and thirty or more variable
references), it is possible that a line of legal length in
HP BASIC/9000 will be considered too long in HP BASIC
for Windows. Such a line will generate an error when
entered, however, the error is extremely rare. To correct
the error, divide the statement into two statements.
ASCII Files
When entering data from files, data should be entered
into variables of the same type as those used to output it.
This general rule applies to HP BASIC for Windows as
well, and if violated can produce unexpected results.
Consider this program:
10
20
30
40
50
60
70
80
90
100
CREATE “TEMP”,1
ASSIGN @I TO “TEMP”;FORMAT ON
OUTPUT @I;”1,2”
OUTPUT @I;”3,4”
RESET @I
ENTER @I;A,B
PRINT A,B
ASSIGN @I TO *
PURGE “TEMP”
END
The program violates the matching-type rule by
outputting strings and then entering numerics. Intuitively,
you expect line 70 to print 1 and 2, which it does. When
line 10 is changed to CREATE “BDAT”, the same result is
produced. But if line 10 is changed to CREATE “ASCII”,
then HP BASIC/9000 prints 1 and 3. This discrepancy has
been corrected in HP BASIC for Windows. If you have
written programs that use ASCII files and violate the
matching-type rule, you should correct them before
running them with HP BASIC for Windows. If your
program must run with both HP BASIC/9000 and
HP BASIC for Windows, you must either adhere to the
matching-type rule, or use another file type.
File Systems
DOS (FAT) File System
A primary difference between HP BASIC/9000 and
HP BASIC for Windows is that HP BASIC/9000 does its
own file I/O, while HP BASIC for Windows has the
operating system do all file I/O. This has advantages and
disadvantages. Any hard disk, diskette, network, or device
accessible through the file system is accessible from
HP BASIC for Windows. HP LIF capabilities are not
available in MS-DOS so you cannot use HP LIF diskettes,
GPIB disks, tape drives, from HP BASIC for Windows.
The following sections describe some of the differences
between the DOS (FAT) file system and the HP
BASIC/9000 Logical Interchange Format (LIF) file
system. This discussion is not meant to be a substitute for
your DOS manual. You should read it for complete
information on the topics presented here.
A couple of warnings are in order about the way most
operating systems work. If a file is currently ASSIGNed,
the operating system buffers some data in memory to
make I/O faster. This buffering can produce unexpected
results if the same file has multiple I/O paths ASSIGNed
to it concurrently. Also, you should not remove a diskette
or turn the power off while a file is ASSIGNed.
HP BASIC/9000 and HP BASIC for Windows maintain
compatibility with LIF file types by keeping a special file
header for typed files (BDAT, LIF ASCII, and PROG files).
The extra information that must be stored for these file
types is kept in the header. The header is kept totally
hidden from BASIC programs. However, to programs
outside HP BASIC for Windows, the header will be
accessible as the first bytes of the file. Any files without
the special header are known as “ordinary files”. In a CAT
listing, the file type is blank for ordinary files or gives the
operating system.
The FAT file system, like the Shared Resource Manager
(SRM) file system, is a Hierarchical File System (HFS).
An understanding of HFS, UNIX, or SRM file systems may
aid you in understanding the FAT file system.
DOS (FAT) File Specifier
Under DOS, a file specifier has the form:
[d:] [directory path] filename[.ext]
where:
d: is the drive letter. Usually this is A: and B: for the
two diskette drives, and C: for the hard disk. Higher
drive letters, D:, E:, and so on, usually refer to RAM
(MEMORY) disks, CD-ROMs, or network drives. This
part of the file specifier corresponds to the msus of the
HP file system, but is included on the front, not the
end of the file specifier. It is optional, and if omitted,
the current (or default) drive is used.
directory path is optional. It is explained later in this
section.
In addition to HP BASIC for Windows file headers,
HP BASIC for Windows can recognize and use HP LIF
headers. This allows networked computers to directly
interchange data between HP computer systems running
HP BASIC/9000 and systems running HP BASIC for
Windows. The CONFIGURE CREATE {“HP” | “HPBW”}
statement allows the program to specify the type of file
header to use when creating a new BDAT or LIF ASCII
file.
filename is the main part of the file specifier. It may be
one to 256 characters long. These characters are not
allowed to be in a filename: .”/\[]:|<>+=;, and control
characters whose ASCII value is less than the space
character. All other characters are legal. If lowercase
letters are used in a filename they are converted to
uppercase by DOS. Thus, you cannot have a file named
“AbC” and another file named “aBC”. DOS will consider
both names to be “ABC”. Be aware that a DOS file
specifier is often referred to simply as a filename.
LIF ASCII vs. Ordinary ASCII
ext is the filename extension. The same characters that
may be used in a filename may also be used in an
extension. Certain conventions are used for filename
extensions. Most of them are arbitrary, with a few
exceptions noted below. Some conventional extensions
are
Early versions of HP BASIC/9000 did not have a file type
that matched DOS ASCII or UNIX ASCII files. Starting
with BASIC 5.0, it does have an ordinary file type that can
hold DOS ASCII or UNIX ASCII data. With HP BASIC/WS
or HP BASIC/UX, ordinary files are called “HP-UX” files.
With the Measurement Coprocessor Card, ordinary files
are called “DOS” files. No special header or other
embedded information is placed in ordinary files. An
ordinary file written with FORMAT ON is a DOS ASCII
file. An ordinary file written with FORMAT ON, EOL
CHR$(10) is a UNIX ASCII file. Use the CREATE
statement to create an ordinary file. In a CAT listing, an
ordinary file is listed with the file type blank, or gives the
name of the operating system.
Extension
.BAS
.BDT
.AS
.DAT
.TXT
.LIS
.LST
.DOC
.BAT
.COM
.EXE
Conventional Use
BASIC program
BDAT file
ASCII file
BDAT or DOS data files
Text file
Text files or compiler listings
Another common listing file extension.
A DOS ASCII file containing documentation.
DOS batch files MUST have this extension.
An executable DOS command or program.
An executable DOS command or program. DOS
commands and programs MUST have one of these
two extensions.
Note that compared to an HP file specifier, the msus is
replaced by a drive letter and moved from the back to the
3
front. Also, an extension has been added, and no
password is used or available. While DOS does not have
passwords, it does have some access capabilities (similar
to SRM access capabilities). These are discussed below.
If passwords are present they generate Error 462 - Invalid
Password.
If an HP style msus is present, it can be translated to a
DOS path if specified by the CONFIGURE MSI statement.
If no matching translation can be found, an error is
returned. The CONFIGURE MSI statement has been
added to HP BASIC for Windows to allow HP style file
specifiers to be used with a DOS file system. If DOS style
file specifiers are used, then the CONFIGURE MSI
statement is not needed.
DOS Directory Path
The DOS file system is “tree” structured, almost exactly
like the HFS and SRM file systems. The “/” character of
the HFS file system is replaced with “\” in the DOS file
system. Passwords do not exist in the DOS file system
and will cause an error if included in a directory name.
The file system is organized as a tree. Actually, it is
usually thought of as an upside-down tree. The top of the
tree is, thus, the root. (Not roots. Directory trees are
considered to have only one root, and the term trunk is
usually not used.) The tree is composed of directories and
files. Each directory may contain files and additional
directories, which act like branches down the tree.
Directory names follow the same rules as filenames with
extensions.
A directory path is the path you climb through in the
tree to get from the root of the tree to a certain directory.
It consists of the names of each directory that must be
climbed through in order to get to that certain directory,
separating the directory names with the backslash “\”
character.
DOS File Types and Access Capabilities
The DOS file system stores certain information about a
file in addition to storing information in the file. This
information consists of:
• file name
• number of bytes in the file
• modification date and time
• access capabilities: hidden, read-only, system
• location on the disk of the file contents
DOS does not store a record length or a file type. It does
have access capabilities, although they are different from
the SRM access capabilities. The access capabilities are
called “attributes” by DOS and may be changed by the
DOS ATTRIB command. They may also be changed by the
HP BASIC for Windows PROTECT command. The
meanings of the attributes are:
4
Attribute
hidden
read-only
system
Meaning
The filename is not shown in a disk catalog although
the file is there.
The file may be read but not written to or deleted
The file is a system file.
DOS Devices
HP BASIC/9000 accesses devices through interface and
device select codes. The same is true of HP BASIC for
Windows. However, DOS also allows access to devices as
if they were files. Special names are given to devices by
DOS, and when used in the place of a filename, access a
device instead of a file. These names are called DOS
Device Names and are typically: CON, AUX, COM1,
COM2, PRN, LPT1, LPT2, and NUL. Often, data
acquisition hardware for the PC comes with a DOS device
driver. To access such a data acquisition board, treat it as
you would a file and use ASSIGN, OUTPUT, and ENTER.
DOS Wildcards
The question mark “?” and the asterisk “*” have special
meaning to DOS. They are called wildcards and are
used in DOS commands like DIR and the HP BASIC for
Windows CAT command in order to select more than
one file. A filename with wildcard characters in it will be
compared with existing filenames using special rules and
all filenames that “match” will be selected. These are the
rules used to match an actual filename with wildcards:
The “?” character will match any one character in the
same position of an actual filename. For example, the
string “?AT” will match the strings “CAT”, “BAT”, “MAT”,
or any other string three letters long that has an “A” as
the second letter, and “T” as the third letter.
The “*” character will match zero or more characters
starting at that position. For example, “*” will match all
filenames. “*.BAS” will match all file names that have the
“.BAS” extension.
Keyword Differences
The following sections present, by keyword, various
implementation differences between HP BASIC for
Windows and HP BASIC/9000. Most differences are the
result of hardware differences, file system differences, or
extensions in HP BASIC for Windows. In some cases, DOS
or UNIX commands that relate to BASIC commands are
given.
Some differences exist because of enhancements
HP BASIC for Windows. Many enhancements can be
included in programs that run under both HP BASIC/9000
and HP BASIC for Windows. One approach is to hide
statements that will not parse under HP BASIC/9000 in
OUTPUT KBD statements:
OUTPUT KBD;”CONFIGURE PRT TO
701”&CHR$(255)&”E”;
Another approach is to set up a section of code that is
executed only by HP BASIC for Windows. When you GET
the program under HP BASIC/9000, the lines with HP
BASIC for Windows syntax enhancements will be
commented out and ignored by HP BASIC/9000:
10
INTEGER Hpbasic
BUFFER
20
Hpbasic=SYSTEM$\
(“VERSION:HPBW”)<>”0”
30
IF Hpbasic THEN
In HP BASIC for Windows, it is usually incorrect to access
numeric data in a buffer through the array name. ENTER
and OUTPUT should be used instead.
40
CONFIGURE PRT TO 701
50
END IF
60
END
CAT
When porting programs between HP BASIC/9000 and
HP BASIC for Windows, note the differences for the
following keywords.
HP BASIC/9000 uses wildcards as a primary filter and the
SELECT option as a secondary filter in choosing filenames to display. HP BASIC for Windows is designed to
be used with one or the other. Use wildcards or the
SELECT option, but not both.
ALLOCATE
CDIAL
Under HP BASIC for Windows, GOSUB and ALLOCATE
use the same stack. Intermixing these statements can
cause changes in available memory that are different from
HP BASIC/9000.
CDIAL is not supported.
ASSIGN
CINT
When an ASSIGN fails, the previous state of the I/O path
is not preserved. Also, the CONVERT and PARITY options
are not implemented.
CINT is an HP BASIC for Windows function that converts
a value to INTEGER.
Under Windows, if changes are made to an ASSIGNed file,
the directory entry is not updated until the file is closed.
Windows buffers reads and writes to disk. You should not
remove a diskette or turn the power off while a file is
ASSIGNed. Exchanging diskettes while a file is ASSIGNed
on the first can destroy the next diskette. Two I/O paths
ASSIGNed simultaneously to the same file can produce
slightly different results than HP BASIC/9000, depending
on the buffering Windows does.
COMMAND$
Under HP BASIC for Windows, ASSIGN includes two new
options, FORMAT LSB FIRST and FORMAT MSB FIRST,
to specify byte ordering of binary numeric data transfers.
This provides the ability to do binary transfers with any
device or computer, regardless of the byte ordering that
device uses.
CHECKREAD
CHECKREAD is not supported.
COMMAND$ is an HP BASIC for Windows function that
returns a copy of the command line.
CONFIGURE
The CONFIGURE statement is an enhancement to
HP BASIC for Windows that allows the environment to be
customized to a user’s preference, or to match the user’s
HP hardware.
CONTROL and STATUS
Depending on the hardware interface, some CONTROL
and STATUS registers may be different.
ATN2
In some instances HP BASIC for Windows can pass arrays
to and from a single register. This capability is used for
things like gain control lists in data acquisition drivers.
ATN2 is an HP BASIC for Windows function that returns
the angle to a point.
COPY
BEEP
The BEEP statement generates a tone with the PC
speaker. Both the frequency and the duration are
adjustable.
BINEQV/BINIMP
These commands are HP BASIC for Windows functions
that perform a bit by bit equivalence operation.
BLOAD/BSTORE
The functionality of the HP BLOAD, BSTORE compiled
subroutines is an integral part of the HP BASIC for
Windows language and does not require CSUBs. (See the
GLOAD and GSTORE section.)
HP BASIC for Windows does not support the copy of a
full disk to another disk. Use the operating system for full
disk copies. Under Windows you can use either the File
Manager or the DOS “DISKCOPY” or “XCOPY”
commands. The DOS XCOPY command is an extended
COPY command that, among other things, allows you to
copy entire disks when the disk sizes are not the same.
The DOS COPY command is used to copy individual files.
If wild-cards are included in the command, then several
files can be copied with a single command.
CREATE
Because Windows supports extendible files, the number
of records specified in the CREATE statement is ignored.
An invalid number does not generate an error as it will
under HP BASIC/9000. Programs that depend on errors
occurring by writing past the last specified record will not
5
function correctly, as HP BASIC for Windows will simply
extend the file as needed. Programs that depend on the
pre-allocation of the requested records should write
dummy data at the time the file is CREATEd. Under
Windows it is sufficient to write data in the last record.
ERRDS
Do not confuse a LIF ASCII file, created with CREATE
ASCII, with a DOS ASCII or UNIX ASCII file, created with
CREATE
HP BASIC for Windows error messages are usually
similar to those in HP BASIC/9000. Programs that
depend on ERRM$ returning the exact same message as
HP BASIC/9000 should be modified accordingly. In
particular, where an HP BASIC/9000 error message has
seemed less descriptive than it should be, HP BASIC for
Windows returns a more descriptive message.
Use the CONFIGURE BDAT MSB FIRST statement before
creating BDAT files that will be moved to HP BASIC/9000.
CREATE DIR
This command is exactly like the HP BASIC/9000
command of the same name. It is the equivalent of the
DOS MD command.
DEF FN
Nested I/O is not allowed under HP BASIC/9000. For
example:
10
PRINT FNX
20
END
30
DEF FNX
40
PRINT “DEBUG:START”
50
RETURN 0
60
FNEND
will produce an error under HP BASIC/9000. Nested I/O
does not return an error under HP BASIC for Windows,
but should not be used.
HP BASIC for Windows limits the depth that recursion
can occur. The depth is limited by the size of the
processor stack, not the BASIC workspace size.
DELSUB
ERRM$
ERRN
Any error number of 2000 or greater is an HP BASIC for
Windows extension to HP BASIC/9000. Not all errors
that can occur under HP BASIC/9000 can occur under
HP BASIC for Windows.
In general, and whenever possible, the error numbers
returned for errors are the same as those returned by
HP BASIC/9000. But in some instances the operating
system or environment in which HP BASIC for Windows
runs makes it impossible or impractical to return the
same number.
EXECUTE
The EXECUTE statement has been added to run
operating system commands or other programs while
HP BASIC for Windows is running.
FIX
FIX is an HP BASIC for Windows function that truncates
a value to INTEGER.
FRACT
HP BASIC for Windows allows a string variable to specify
the name of the subprogram or function to delete.
HP BASIC for Windows allows the FRACT of a complex
value, returning the fractional part of the real part of the
complex value. HP BASIC/9000 gives error 620.
DUMP DEVICE IS
FRE
By default HP BASIC for Windows uses the WIN-DUMP
driver to provide support for any printer supported by
Windows that supports bit maps. WIN-DUMP is only
supported through select code 10. There are several other
drivers for files and printer languages.
FRE is an HP BASIC for Windows function that returns
the amount of free memory.
GESCAPE
EDIT
Only HP BASIC/9000 operation selectors 1 to 6 are
supported by GESCAPE. Operation selectors greater than
29 are enhancements to HP BASIC for Windows.
EDIT SUB and EDIT FN are extensions in HP BASIC for
Windows. Several new edit functions are also included.
(See the OUTPUT KBD section.)
GET
ENABLE INTR
Depending on the hardware interface, some ENABLE
INTR mask values may be different.
ENVIRON
ENVIRON$ is an HP BASIC for Windows function that
returns information from the operating system
environment.
6
ERRDS is not supported.
HP BASIC for Windows turns lines with syntax errors into
comments by inserting “!*” instead of just “!” after the line
number. This allows FIND “!*” to quickly identify lines
needing corrections.
GLOAD and GSTORE
HP BASIC for Windows enhances GLOAD and GSTORE
with the capabilities of the HP BASIC/9000 BLOAD and
BSTORE CSUBs to load and store partial screen images
(rectangular blocks). When performing a full screen
GSTORE, HP BASIC for Windows translates the image
into the Windows .BMP format. If the resulting image
array is output to a file, any application that recognizes
the .BMP format can read, display, or modify that image.
However, when performing partial screen
GLOAD/GSTOREs, the format used is not sharable with
other applications. In either case, the images are not
compatible with those generated by HP BASIC/9000.
These subprograms can be used in place of the BLOAD
and BSTORE CSUBs for users that want to continue
calling BLOAD/BSTORE instead of switching to the new
GLOAD/GSTORE syntax:
10
SUB Bstore(INTEGER Int_array(*),W,H,OPTIONAL Rule,REAL X,Y)
20
SELECT NPAR
30
CASE 3
40
GSTORE CRT,Int_array(*),W,H
50
CASE 4
60
GSTORE CRT,Int_array(*),W,H,Rule
70
CASE 5
80
WHERE X0,Y0
90
GSTORE CRT,Int_array(*),W,H,Rule, X,Y0
100
CASE 6
110
GSTORE CRT,Int_array(*),W,H,Rule,X,Y
120
END SELECT
130
SUBEND
140
SUB Bload(INTEGER Int_array(*),W,H,OPTIONAL Rule,REAL X,Y)
150
SELECT NPAR
160
CASE 3
170
GLOAD CRT,Int_array(*),W,H
180
CASE 4
190
GLOAD CRT,Int_array(*),W,H,Rule
200
CASE 5
210
WHERE X0,Y0
220
GLOAD CRT,Int_array(*),W,H,Rule,X,Y0
230
CASE 6
240
GLOAD CRT,Int_array(*),W,H,Rule,X,Y
250
END SELECT
260
SUBEND
Note that only rule 3, replace, is currently supported.
GRAPHICS INPUT IS
Both HP BASIC/9000 and HP BASIC for Windows do an
implicit GRAPHICS INPUT IS assignment if you attempt
to use graphic input statements before an explicit
GRAPHICS INPUT IS. The difference is that HP BASIC for
Windows does the implicit GRAPHICS INPUT IS as soon
as HP BASIC for Windows is started, and HP BASIC/9000
waits until the first graphic input statement is executed.
The only known effect of this different approach is that
under HP BASIC/9000, a SYSTEM$ (“GRAPHICS INPUT
IS”) returns “0” until the first graphic statement is
executed and HP BASIC for Windows returns the correct
value anytime.
HELP
The HELP statement is an HP BASIC for Windows
statement. It provides on-line help for all language
statements. Just enter HELP followed by the keyword of
interest and HP BASIC for Windows brings up the
Reference Manual page for the requested keyword. It is
no longer necessary to get the Reference Manual when
you have a question on statement syntax or functionality.
HIL
HIL related statements are not supported.
7
IMAGE
LINK
Entering data from a string using:
LINK is not supported.
ENTER L$ USING “Y”
will always use the internal byte ordering of the
computer. For PCs and compatibles, the byte ordering is
LSB FIRST. For HP BASIC/9000, the byte ordering is MSB
FIRST. This limitation applies to ENTER and OUTPUT
with strings only. With devices, the byte ordering can be
selected in the ASSIGN statement.
INITIALIZE
HP BASIC for Windows does not support INITIALIZE.
To initialize a new LIF disk, use “INITIALIZE” on an
HP BASIC/9000. To initialize a new DOS disk, use
the “FORMAT” command under DOS. To initialize a new
HP-UX floppy disk, use the “mediainit” and “newfs”
commands under HP-UX.
RAM disks are not supported with the
INITIALIZE”:MEMORY,0” command. Many excellent RAM
disk programs are available for the PC that make the RAM
disk available to all DOS programs, including HP BASIC
for Windows. These programs can usually make RAM
disks in conventional, expanded, or extended memory.
A simple one is provided with DOS and is called
VDISK.SYS or RAMDISK.SYS.
A RAM disk is accessed like any other DOS disk by
specifying its drive letter (for example, E:).
INP and INPW
INP and INPW are HP BASIC for Windows functions for
communicating with devices having no HP BASIC for
Windows device driver.
KBD CMODE
HP BASIC/9000 and HP BASIC for Windows both use
KBD CMODE for Nimitz keyboard softkey compatibility.
The Nimitz keyboard is used on the 9836 and has ten
softkeys, the lowest of which is labeled k0. The softkey
labels are displayed at the bottom of the screen in two
rows, each row containing five labels and each label 14
characters wide.
The difference between HP BASIC/9000 and HP BASIC
for Windows implementation of KBD CMODE ON is that
HP BASIC for Windows exactly emulates the screen
format for the labels, while HP BASIC/9000 uses an
emulation that gives physical correspondence with the
ITF 4-2-4 softkey layout.
LEXICAL ORDER
Several extensions are present in the LEXICAL ORDER
statement of HP BASIC for Windows to allow user
definition of upper/lowercase rules for languages that are
not built-in. The rules can also be loaded from a file.
LINE TYPE
LINE TYPE sets the style or dash pattern and repeat
length of lines. This is, however, limited to available
Windows line types. In the LINE TYPE statement, the
repeat length is ignored by most graphic drivers.
8
LIST BIN
LIST BIN lists the name and version number of each BIN
currently in memory. (Programmable in HP BASIC for
Windows, but not in HP BASIC/9000.)
LOAD
HP BASIC/9000 PROG files and HP BASIC for Windows
PROG files are not compatible. To move programs
between the two environments, use ASCII program files
LOAD BIN
The LOAD BIN statement has been enhanced to allow
software switches to be passed to device drivers.
HP BASIC/9000 BIN files are not compatible with HP
BASIC for Windows.
LOADSUB
HP BASIC for Windows allows a string variable to specify
the name of the subprogram or function to load.
MASS STORAGE IS
The current “MASS STORAGE IS” includes not only the
device, but also the current directory. In other words, it
specifies not only which tree (device) you are in, but
where in the tree (current directory) you are. The DOS
command CD changes the current directory when not
running HP BASIC for Windows.
OUT and OUTW
OUT and OUTW are HP BASIC for Windows statements
for communicating with devices having no HP BASIC for
Windows device driver.
OUTPUT KBD
Three editor functions have been added to HP BASIC for
Windows and should not be used in programs that will be
executed with HP BASIC/9000: DEL LEFT, NEXT WORD,
and PREV WORD. Otherwise, all the two-character
function key sequences (i.e., CHR$(255)&CHR$(X) )
used by HP BASIC are compatible with HP BASIC for
Windows. If multiple statements are output in a single
OUTPUT KBD statement, they are all executed before
the next BASIC line. HP BASIC/9000 sometimes
intermixes the execution with multiple BASIC lines,
based on the presence or absence of “closure keys”.
PERMIT
PERMIT is used under UNIX to set the permissions
(mode) of a file, directory, or device. Permissions specify
who can read, write, or execute a file, and who can search
a directory. To change file attributes under DOS, use the
PROTECT statement.
PHYREC, Phyread, Phywrite
The PHYREC utilities under HP BASIC/9000 allow
physical disk sectors to be read or written. Such access
usually provides enhancements or file utilities for LIF
formatted disks. Programs using Phyread and Phywrite
most likely will not work under Windows, and in fact will
probably destroy the files on the disk involved. No
PHYREC utilities are supplied with HP BASIC.
Character
(none)
R
S
Meaning
no protection
read-only: File cannot be written or deleted.
system file: For the most part this attribute has no
meaning
H
hidden system: File will not be listed by a CAT
command.
If a character is not included, that attribute is cleared. If
the string is blank, all attributes are cleared.
PLOTTER IS
PRT
Both HP BASIC/9000 and HP BASIC for Windows do an
implicit PLOTTER IS assignment if you attempt to use
graphic statements before an explicit PLOTTER IS. The
difference is that HP BASIC for Windows does the implicit
PLOTTER IS as soon as HP BASIC for Windows is started,
and HP BASIC/9000 waits until the first graphic statement
is executed. The only known effect of the different
approaches is that under HP BASIC/9000, a SYSTEM$
(“PLOTTER IS”) returns “0” until the first graphic
statement is executed and HP BASIC for Windows returns
the correct value anytime.
Under HP Basic for Windows, PRT is set by default to
ISC 10, the default Windows printer. Therefore, PRT is
set to ISC 10 instead of 701. Programs with statements
that use PRT explicitly, such as “PRINTER IS PRT” need
not be changed if a parallel printer is used on the PC. To
change PRT back to 701, for IEEE-488 printers at
primary address 1, use the statement “CONFIGURE PRT
TO 701”. It may be convenient to include this statement
in your AUTOST file. This statement is not necessary if
you use the value 701 (or any other value) explicitly.
HP BASIC/9000 supports only “INTERNAL” and “HPGL”
graphic languages. HP BASIC for Windows supports
loadable graphic device drivers so it is not limited to these
two choices. HP BASIC for Windows also allows clip-limits
to be specified when output is directed to a device,
allowing use of plotters or printers that are incapable of
returning p-points.
PURGE
PRINT
HP BASIC for Windows has been extended to allow the
displacement of the attribute and color control characters
that normally have the values CHR$(128) to CHR$(143).
Since the PC has characters in this range that sometimes
need to be displayed, HP BASIC for Windows has the
capability of moving the range with the statement
CONTROL CRT,100;1.
PRINT LABEL and READ LABEL
PRINT LABEL and READ LABEL are used to set and
read the volume label of a disk drive. HP BASIC for
Windows does not support PRINT LABEL; you must use
the DOS “LABEL” command. To change the label of a disk
from an HP BASIC for Windows program, use the
EXECUTE “LABEL x:” command.
PROTECT
PROTECT is used to set LIF file passwords under
HP BASIC/9000 and DOS file attributes under HP BASIC
for Windows. A special form of PROTECT is used by
HP BASIC for Windows to change file attributes. The
syntax is:
PROTECT file-specifier, protect-code where protect-code
is a string containing zero or more of these characters:
PURGE is similar to a combination of the DOS DELETE
and RD or RMDIR commands. Unlike DELETE, PURGE
will only delete one file at a time, and will also delete
directories. PURGE will not delete a directory unless
there are no files in that directory. Also, DOS will allow
you to PURGE an ASSIGNed file if SHARE.EXE has not
been loaded. The actual PURGE takes place after the file
is closed.
QUIT
The QUIT command exits HP BASIC for Windows and
returns you to Windows. Any program or data in memory
is lost. You will be prompted to store any program
changes before quitting.
READIO and WRITEIO
READIO and WRITEIO access hardware registers directly,
and therefore, if the interface hardware is different than
the hardware on an HP BASIC/9000, the READIO and
WRITEIO registers will not be compatible.
RENAME
RENAME is used to change the name of a file or
directory, or to move a file from one directory to another
directory on the same disk. However, RENAME cannot
move one directory to another.
SAVE
The SAVE statement in HP BASIC for Windows can be set
to save programs in either ordinary ASCII or LIF ASCII.
This is done with the CONFIGURE SAVE ASCII
statement.
SCRATCH BIN
SCRATCH BIN is not supported for HP BASIC for
Windows binaries. You must QUIT and restart HP BASIC
for Windows to scratch all binaries.
9
SEPARATE ALPHA
SYSTEM
SEPARATE ALPHA is supported.
The SYSTEM$(“DISP LINE”) function is an HP BASIC for
Windows extension that returns the present contents of
the display line.
SET ALPHA/DISPLAY MASK
SET MASK is not supported.
SET CHR
SET CHR is not supported.
SET TIME/TIMEDATE
HP BASIC/UX keeps a BASIC time that is separate from
the actual system time. SET TIME and SET TIMEDATE,
specified without any time value, resynchronizes the two.
However, in HP BASIC for Windows, SET TIME and
SET TIMEDATE with no time value, is ignored.
SOUND
The SYSTEM$(“VERSION:HPBW”) function returns the
HP BASIC for Windows version description, for example,
“Windows Release 7.1”. This function can be useful for
programs that run on both HP BASIC/9000 and HP BASIC
for Windows systems, enabling them to determine which
system they are currently running on. This example sets a
variable according to the system running the program:
10
SUB Which_system
20
COM /Which_system
/Basic_9000
30
Basic_9000= (SYSTEM$
(“VERSION:HPBW”)=”0”)
40
SUBEND
SOUND is not supported.
STATUS
STATUS @Iopath,2 always returns a 4.
STATUS @File,3 returns the current length, not the
CREATE length. This is because files are extendible
under DOS and UNIX.
HP BASIC for Windows does not require this statement
and will return an error if an attempt is made to execute
it. The editor will allow it to be entered, and the syntax
checker will check it for correctness to allow you to
develop programs and run them under HP BASIC/9000.
HP BASIC/9000 requires this statement for two reasons:
The STATUS( ) function (as opposed to the STATUS
statement) is an addition to HP BASIC for Windows. Any
STATUS or CONTROL registers greater than 99 are also
additions.
• HP BASIC/UX keeps a time clock independent of the
UNIX time.
As in HP BASIC/9000, STATUS register 0 of interface
cards contains the card ID. Interface cards that are
available on a PC, but not on an HP BASIC/9000 are
identified with ID numbers greater than or equal to 300.
TRANSFER
STORE
HP BASIC/9000 PROG files and HP BASIC for Windows
PROG files are not compatible. To move programs
between the two environments, use ASCII program files.
STORE SYSTEM
In HP BASIC/9000 this statement stores a copy of the
operating system with all loaded BINs already linked in.
Under HP BASIC for Windows this is not possible. Use
AUTOST to load HP BASIC for Windows device drivers.
• It is possible to boot HP BASIC/WS on a computer whose
real-time clock is set to Greenwich Mean Time (GMT).
Currently TRANSFER is only supported for inbound
Serial. TRANSFER with any other device or file generates
an error.
WRITEIO
See the explanation under READIO for some differences.
Other processors cannot execute the Motorola code
accessed by WRITEIO 9827. The code must be rewritten.
XREF
HP BASIC for Windows allows a string variable to specify
the name of the subprogram or function.
SYMBOL
Summary
LORG 5 moves the symbol origin from (0,0) to (5,8).
In HP BASIC/9000 it moves the origin to (4.5,7.5).
This overview of the differences between HP BASIC for
Windows and other HP BASIC platforms should give you
a good understanding of how easily your applications will
move the this platform. If you have any further questions,
please refer to the documentation supplied with the
product or contact your local Hewlett-Packard sales
office.
SYSBOOT
HP BASIC for Windows does not support SYSBOOT,
which under HP BASIC/9000 reboots the computer. Since
HP BASIC for Windows runs as a guest of the operating
system, it is considered inappropriate to reboot the
computer. Under some operating systems, rebooting the
computer inappropriately can cause loss of data.
10
TIMEZONE
11
H
For more information about Hewlett-Packard test and
measurement products, applications, services, and for a
current sales office listing, visit our web site:
http://www.hp.com/go/tmdir
You can also contact one of the following centers and ask
for a test and measurement sales representative.
United States:
Hewlett-Packard Company
Test and Measurement Call Center
P.O. Box 4026
Englewood, Colorado 80155-4026
1 800 452 4844
Canada:
Hewlett-Packard (Canada) Ltd.
5150 Spectrum Way
Mississauga, Ontario
L4W 5G1
1 877 894 4414
Europe:
Hewlett-Packard
European Marketing Organisation
P.O. Box 999
1180 AZ Amstelveen
The Netherlands
(31 20) 547 9999
Japan:
Hewlett-Packard Japan Ltd.
Measurement Assistance Center
9-1, Takakura-Cho, Hachioji-Shi,
Tokyo 192-8510, Japan
Tel: (81) 426 56 7832
Fax: (81) 426 56 7840
Latin America:
Hewlett-Packard Company
Latin American Region Headquarters
5200 Blue Lagoon Drive
9th Floor
Miami, Florida 33126
U.S.A.
Tel: (305) 267-4245/4220
Fax: (305) 267-4288
Australia/New Zealand:
Hewlett-Packard Australia Ltd.
31-41 Joseph Street
Blackburn, Victoria 3130
Australia
Tel: 1 800 629 485 (Australia)
Tel: 0 800 738 378 (New Zealand)
Fax: (61 3) 9210 5489
Asia Pacific:
Hewlett-Packard Asia Pacific Ltd.
24/F Cityplaza One,
1111 King’s Road, Taikoo Shing
Hong Kong, SAR
Tel: (852) 2599 7818
Fax: (852) 2506 9233
RMB and Rocky Mountain Basic are
registered trademarks of the Hewlett-Packard
Company. Windows is a registered U.S.
trademark of Microsoft Corporation.
Data subject to change.
© Hewlett-Packard Company 1999
Printed in the U.S.A. 8/99
5964-6019E
12
Download PDF