22 December 1990
Modified for Netscape by Björn Gahm
The information contained here is from a variety of sources: HP-71B Internal Design Specifications, ROM analysis and other posted information.
Nothing is perfect. Double check these notes if you plan to use the information that they contain.
Send comments and questions to:
Derek S. Nickel
15 Maple Lane
Walnut Creek, CA 94595-1718
Most of the examples list the internal representation as:
12345 6789 ABC DEF0This corresponds to a memory dump ('48 style) of:
xxxxx: 543219876CBA0FEDor a HEX dump (VAX/VMS style) of:
DE F0 AB C6 78 91 23 45 E#.x.... xxxxx
One thing that all of these data types have in common is a five nibbles header. This header identifies the data type of the data that follows the header. This header is called a prolog.
Prolog Object Name Type #
------ -------------- ------
02911 System Binary 20
02933 Real Number 0
02955 Long Real 21
02977 Complex Number 1
0299D Long Complex 22
029BF Character 24
029E8 Array 3,4
02A0A Linked Array 23
02A2C String 2
02A4E Binary Integer 10
02A74 List 5
02A96 Directory 15
02AB8 Algebraic 9
02ADA Unit 13
02AFC Tagged 12
02B1E Graphic 11
02B40 Library 16
02B62 Backup 17
02B88 Library Data 26
02D9D Program 8
02DCC Code 25
02E48 Global Name 6
02E6D Local Name 7
02E92 XLIB Name 14
Type # Prolog Object Name
------ ------ --------------
0 02933 Real Number
1 02977 Complex Number
2 02A2C String
3 029E8 Real Array
4 029E8 Complex Array
5 02A74 List
6 02E48 Global Name
7 02E6D Local Name
8 02D9D Program
9 02AB8 Algebraic
10 02A4E Binary Integer
11 02B1E Graphic
12 02AFC Tagged
13 02ADA Unit
14 02E92 XLIB Name
15 02A96 Directory
16 02B40 Library
17 02B62 Backup
18 none Command
19 none Function
20 02911 System Binary
21 02955 Long Real
22 0299D Long Complex
23 02A0A Linked Array
24 029BF Character
25 02DCC Code
26 02B88 Library Data
27 other Unknown prolog
Commands and Functions can be expressed as either their address or as XLIB Names. For example, DUP is normallay represented by the address 1FB87, but it can also be represented by XLIB 2 269 (02E9E 002 10D).
Also, if a operation requires more that one argument, then each argument will be represented as a digit in the System Binary that is used for argument type checking. For example, the System Binary number
Both kinds have several things in common:
15-form BCD numbers are the basis for Long Real and Long Complex data types.
Examples in this document use the HP mneumonics.
Create a System Binary with a decimal value of 48.
02911 00030
"1192003000C53E" ASC\-> returns <30h>
- or -
48 #18CEAh SYSEVAL returns <30h>
In normal calculator operations:
But the '48 uses other types of arrays internally. For example, message tables are "Array of String".
Create the expression 'A-2'.
"CFA20301424343392000021098765432107141" ASC\-> returns
The pixels for each row run for left to right and the bits for those pixels run from least significant bit to most significant bit. Note that each row of pixels is padded to an even number of nibbles. For example: a normal 131 X 64 Graphic requires 34 nibbles (136 bits) per row for a total of 2176 nibbles (not counting the overhead of 20 nibbles).
The hash table and link table are very large Binary Integers. The message table is an Array of String.
Example:
Unthread part of the stop watch library. The LOAD command loads a memory dump file into port 1 (at address 80000). The notation [...] is the unthreader's way of hiding lengthly data (more than five nibbles). Comments that start with a "!" are generated ny the unthreader, those that start with a ";" are from the comment files.
What's in 'MHpar' (MINEHUNT parameter) (EQ Library required)?
MINEHUNT STO MHpar \->ASC returns:
"88B205C900C010047A20E1B20...
which translates to Library Data 268/0, contents:
02E92 10C 000
If you have the EQ Library:
If you don't:
One nibble iTypes:
iType Objects
------ -----------------------------------------------------
<0h> Any
<1h> Real Number
<2h> Complex Number
<3h> String
<4h> Array
<5h> List
<6h> Global Name
<7h> Local Name
<8h> Program
<9h> Algebraic
<Ah> Symbolic (Algebraic or Global Name)
<Bh> Binary Integer
<Ch> Graphic
<Dh> Tagged
<Eh> Unit
Two nibble iTypes (starts with F):
iType Objects
------ -----------------------------------------------------
<Fh> XLIB Name
<1Fh> System Binary
<2Fh> Directory
<3Fh> Long Real
<4Fh> Long Complex
<5Fh> Linked Array
<6Fh> Character
<7Fh> Code
<8Fh> Library
<9Fh> Backup
<AFh> Library Data
<BFh> ?? prolog <02BAAh>
<CFh> ?? prolog <02BCCh>
<DFh> ?? prolog <02BEEh>
<EFh> ?? prolog <02C10h>
<FFh> ?? <191BEh>
Atomic Data Types
Atomic data types are listed after each field description, in parenthesis. Note that some atomic data types are more atomic than others.
**** ASCIC ****
ASCII counted character strings are represented by length and data fields. ASCII counted character strings are the basis for Global Name, Local Name and Tagged data types, as well as components in other objects.
N 2 1 0
+-------------+--------+
| String Data | Length |
+-------------+--------+
Length 2
where N = Length/2 + 1.
**** ASCII ****
ASCII character strings are represented as a sequence of bytes (ASCII characters). The length of the ASCII character string is specified elsewhere. ASCII character strings are called ASCII in the field descriptions. ASCII character strings are the basis for String data types.
N 0
+-------------+
| String Data |
+-------------+
Length
**** ASCIX ****
Extended ASCII counted character strings are represented by length and data fields. If the length is zero, only a single length field is present. If the length is non-zero, then there are two identical length fields, one before and one after the string data. Extended ASCII counted character strings are the used in Directory, Library and Backup data types.
N N-1 N-2 2 1 0
+--------+-------------+--------+
| Length | String Data | Length |
+--------+-------------+--------+
2 Length 2
where N = Length/2 + 2.
Or, if length is zero:
1 0
+----+
| 00 |
+----+
2
**** BCDx ****
BCD numbers (binary coded decimal) are represented by a mantissa, sign and exponent fields. These are two kinds of BCD numbers in the HP48SX, 12-form and 15-form BCD numbers, called BCD12 and BCD15 in the field descriptions.
12-form BCD numbers are the basis for Real Number, Complex Number, Real Array and Complex Array data types.
BCD12:
15 14 3 2 0
+--+------------------------+------+
|S | msd.. Mantissa ..lsd | Exp |
+--+------------------------+------+
1 12 3
BCD15:
21 20 5 4 0
+--+------------------------------+----------+
|S | msd... Mantissa ...lsd | Exp |
+--+------------------------------+----------+
**** BINx ****
Binary integers are represented by a data field. Binary integers are called BINx in the field descriptions (where x = the number of nibbles that the number occupies). Binary integers are the basis for Binary Integers and System Binary data types.
N 0
+-------------+
| Binary Data |
+-------------+
x
where N = x - 1.
**** CHAR ****
ASCII characters are represented by a one byte (two nibble) data field. ASCII characters are called CHAR in the field descriptions. ASCII characters are the basis for the Character data type.
1 0
+-----------+
| Character |
+-----------+
2
**** CODE ****
Machine code is represented as a sequence of nibbles that is the machine code. Machine code is called CODE in the field descriptions. Machine code is the basis for the Code data type.
System Binary (02911)
<prolog><data>
<prolog> = 02911 (BIN5)
<data> = five nibble binary integer (BIN5)
There are several tables of System Binary numbers:
addr HEX description
------ ------- --------------------------------------------
03F8B <2933h> Real Number prolog
03F95 <2977h> Complex Number prolog
03F9F <2A74h> List prolog
03FA9 <2911h> Global Name prolog
03FB3 <2D9Dh> Program prolog
03FBD <2AB8h> Algebraic prolog
03FC7 <2A96h> Directory prolog
03FD1 <2E6Dh> Local Name prolog
03FDB <2955h> Long Real prolog
03FE5 <2ADAh> Unit prolog
addr HEX DEC
------ ------ ------
03FEF <0h> <0d>
03FF9 <1h> <1d>
04003 <2h> <2d>
0400D <3h> <3d>
04017 <4h> <4d>
04021 <5h> <5d>
0402B <6h> <6d>
04035 <7h> <7d>
0403F <8h> <8d>
04049 <9h> <9d>
04053 <Ah> <10d>
0405D <Bh> <11d>
04067 <Ch> <12d>
04071 <Dh> <13d>
04073 <Eh> <14d>
04085 <Fh> <15d>
0408F <10h> <16d>
04099 <11h> <17d>
040A3 <12h> <18d>
040AD <13h> <19d>
040B7 <14h> <20d>
040C1 <15h> <21d>
040CB <16h> <22d>
040D5 <17h> <23d>
040DF <18h> <24d>
040E9 <19h> <25d>
040F3 <1Ah> <26d>
040FD <1Bh> <27d>
04107 <1Ch> <28d>
04111 <1Dh> <29d>
0411B <1Eh> <30d>
04125 <1Fh> <31d>
0412F <20h> <32d>
04139 <21h> <33d>
04143 <22h> <34d>
0414D <23h> <35d>
04157 <24h> <36d>
04161 <25h> <37d>
0416B <26h> <38d>
04175 <27h> <39d>
0417F <28h> <40d>
04189 <29h> <41d>
04193 <2Ah> <42d>
0419D <2Bh> <43d>
There are several routines to convert between System Binary and other data types. No error checking is performed by these routines.
addr name description
------ ------ ---------------------------------------------
18CEA R\->SB Real Number to System Binary
18DBF SB\->R System Binary to Real Number
Example:
Real Number (02933)
<prolog><data>
<prolog> = 02933 (BIN5)
<data> = 12-form BCD number (
1.61863398875
Long Real (02955)
<prolog><data>
<prolog> = 02955 (BIN5)
<data> = 15-form BCD number (
Complex Number (02977)
<prolog><real-part><imaginary-part>
<prolog> = 02977 (BIN5)
<real-part> = 12-form BCD number (BCD12)
Long Complex (0299D)
<prolog><real-part><imaginary-part>
<prolog> = 0299D (BIN5)
<real-part> = 15-form BCD number (BCD15)
Character (029BF)
<prolog><data>
<prolog> = 029BF (BIN5)
<data> = ASCII coded character (
Array (029E8)
<prolog><size><item-prolog><#dims><dim-1>...<dim-n><item-1>...
<item-m>
<prolog> = 029EB (BIN5)
<size> = number of nibbles remaining (BIN5)
<item-prolog> = prolog for array elements (BIN5)
<#dims> = number of array dimensions (BIN5)
<dim-i> = i-th dimension (BIN5)
<item-j> = j-th item (ANY)
n = <#dims>
m = <dim-1> * <dim-2> * ... * <dim-n>
The items in the array are stored in Row Major order (all of the first rows elements are group together, followed by the second row, and so forth.)
Some assumtions are made about various fields with normal operations:
This applies to the Matrix Editor, GET and so forth.
Linked Array (02A0A)
<prolog><size><???>
<prolog> = 02A0A (BIN5)
<size> = number of nibbles remaining (BIN5)
<???> = undetermined...
String (02A2C) =DOCSTR
<prolog><size><data>
<prolog> = 02A2C (BIN5)
<size> = number of nibbles remaining (BIN5)
<data> = (<size>-5)/2 byte character string (
Binary Integer (02A4E) =DOHSTR =DOHXS
<prolog><size><data>
<prolog> = 02A4E (BIN5)
<size> = number of nibbles remaining (BIN5)
<data> = binary integer (BINx, where x = <size> - 5)
Most Binary Integers have a data size of 16 nibbles or 64 bits (<size> = 21). But some have a smaller data size. For example, the BYTES command returns a Binary Integer (the checksum) with a data size of 4 nibbles or 16 bits (<size> = 9), whereas the Hash Table in a Library looks like a very large Binary Integer.
List (02A74) =DOLIST
<prolog><object-1>...<object-n><end-marker>
<prolog> = 02A74 (BIN5)
<object-i> = i-th object (ANY)
<end-marker> = 0312B (BIN5) =SEMI
Directory (02A96)
<prolog><attachments><offset-1><end-dir>
<name-n><object-n><offset-n>...
<name-2><object-2><offset-2>
<name-1><object-1>
<prolog> = 02A96 (BIN5)
<attachments> = see comments (BIN3)
<end-dir> = 00000; end of directory marker (backwards scanned).
This is in the position that <offset-n+1> would have (BIN5)
<offset-i> = offset from the beginning of the i'th offset field
to the beginning of the i'th object's name. (BIN5)
<name-i> = the name of the i-th object (
Algebraic (02AB8)
<prolog> ... <end-marker>
<prolog> = 02AB8 (BIN5)
The "..." part is a sequence of objects and operations.
<end-marker> = 0312B (BIN5)
Example:
02AB8 Algebraic
02E48 01 41 'A' (Global Name)
2A2DE 2 (address in ROM)
1AD09 -
0312B End Marker
"8BA2084E201014ED2A209DA1B21303637" \-> returns:
'A-2'
Unit (02ADA)
<prolog><numeric-data><unit-1>...<unit-n><operation-1>...
<operation-n><end-marker>
<prolog> = 02ADA (BIN5)
<numeric-data> = the base data, if not Real Number, then will
be displayed as UNKNOWN (ANY)
<unit-i> = unit component (normally String or Real Number) (ANY)
<operation-j> = unit arithmetic indicator. These indicators
point to null lists { }, but are interpreted by the OS as
simple unit operations (* / and so forth) (BIN5)
<end-marker> = 0312B (BIN5)
Tagged (02AFC)
<prolog><name><object>
<prolog> = 02AFC (BIN5)
<name> = the tag (
02AFC 03 41 42 43 02933 0123456789012000
ABC: 1.23456789012
Graphic (02B1E)
<prolog><size><#rows><#columns><data>
<prolog> = 02B1E (BIN5)
<size> = number of nibbles remaining (BIN5)
<#rows> = number of pixel rows (BIN5)
<#columns> = number of pixel columns (BIN5)
<data> = graphic data, <size>-15 nibbles (BINx)
Each pixel in the Graphic is represented by a bit in <data>. The pixels are grouped first by row and then by column.
X = <#columns> - 1
Y = <#rows> - 1
0 X
+-------------------------+
0 | |
| |
| Display |
| |
Y | |
+-------------------------+
M = <#rows> - 1
N = 2*CEIL(<#columns>/8) - 1
N' = unpadded row size
??? = padding
N N' 0
+---+-->>--------------------+
|???| | Row 0
+---+--<<--------------------+
|???| | Row 1
+---+-->>--------------------+
: :
+---+-->>--------------------+
|???| | Row M
+---+--<<--------------------+
Library (02B40)
<prolog><size><library-name><library-number><hash-table-offset>
<message-table-offset><link-table-offset><config-offset>
<bulk-of-library><checksum>
<prolog> = 02B40 (BIN5)
<size> = number of nibbles remaining (BIN5)
<library-name> = Extended ASCII counted character string (BIN3)
<hash-table-offset> = offset to hash table (BIN5)
<message-table-offset> = offset to message table (BIN5)
<link-table-offset> = offset to link table (BIN5)
<config-offset> = offset to configuration code (BIN5)
<bulk-of-library> : <hash-table>, <message-table>, <link-table>,
<config-code> and the rest (in any order)
<checksum> = internal library checksum (BIN4)
<hash-table> : <ht-prolog><ht-size><offset-1>...<offset-16>
<nt-size><nt-entry-1>...<nt-entry-n><nt-offset-1>...
<nt-offset-n>
<ht-prolog> = 02A4E (Binary Integer) (BIN5)
<ht-size> = size of hash table without the prolog (BIN5)
<offset-i> = offset into the name table for the first command
with an i-character name (BIN5)
<nt-size> = size in nibbles of the name table (BIN5)
<nt-entry-j> : <command-name><xlib-number>
<command-name> = ASCII counted character string (BIN3)
<nt-offset-k> = offset to <nt-entry-j> for XLIB command k (BIN5)
This offset is backward pointing.
<message-table> = Array of String. Each array element is a
message.
<link-table> : <lt-prolog><lt-size><lt-entry-1>...<lt-entry-n>
<lt-prolog> = 02A4E (BIN5)
<lt-size> = size of link table without the prolog (BIN5)
Library (cont)
<lt-entry-i> = offset to i-th command in this library (BIN5)
<config-code> = RPL subprogram that performs configuration
commands
Comments:
Voyager> load sw-a
Voyager> ut 80000
80000: 02B40 ! Library
80005: 01608 ! 5640 nibbles (next RPL at 8160D)
8000A: [...] ! Library name: "SW-A"
80016: 300 ! Library number 768
80019: 00014 ! Hash table at 8002D
8001E: 001F2 ! Message table at 80210
80023: 00107 ! Link table at 8012A
80028: 01543 ! Configuration code at 8156B
8002D: 02A4E ! Hash Table
80032: 000F8 ! 248 nibbles (next at 8012A)
80037: 00000 ! 1 none
8003C: 00000 ! 2 none
80041: 00000 ! 3 none
80046: 00046 ! 4 at 8008C
8004B: 00000 ! 5 none
80050: 00000 ! 6 none
80055: 00085 ! 7 at 800DA
8005A: 00093 ! 8 at 800ED
8005F: 00000 ! 9 none
80064: 00000 ! 10 none
80069: 00000 ! 11 none
8006E: 00000 ! 12 none
80073: 00000 ! 13 none
80078: 00000 ! 14 none
8007D: 00000 ! 15 none
80082: 00000 ! 16 none
80087: 0007B ! 123 nibbles (next at 80102)
8008C: [...] ! DOSW (XLIB 768 0)
80099: [...] ! PALL (XLIB 768 5)
800A6: [...] ! PSP+ (XLIB 768 4)
800B3: [...] ! VALL (XLIB 768 3)
800C0: [...] ! VSP+ (XLIB 768 1)
800CD: [...] ! VSP- (XLIB 768 2)
800DA: [...] ! RESETSW (XLIB 768 7)
800ED: [...] ! RCLSPLIT (XLIB 768 6)
80102: 00076 ! name for XLIB 768 0 at 8008C
80107: 00047 ! name for XLIB 768 1 at 800C0
8010C: 0003F ! name for XLIB 768 2 at 800CD
80111: 0005E ! name for XLIB 768 3 at 800B3
80116: 00070 ! name for XLIB 768 4 at 800A6
8011B: 00082 ! name for XLIB 768 5 at 80099
80120: 00033 ! name for XLIB 768 6 at 800ED
80125: 0004B ! name for XLIB 768 7 at 800DA
80210: 029E8 ! Array
80215: 0007F ! 127 nibbles
8021A: 02A2C ! ...of String
8021F: 00001 ! 1 dimensional
80224: 00003 ! Dim-1 = 3
. . . . . . ! 3 total elements
80229: [...] ! "Invalid SWDAT"
80248: [...] ! "Invalid Split#"
80269: [...] ! "Invalid Environment"
8012A: 02A4E ! Link Table
8012F: 000E1 ! 225 nibbles (next at 80210)
80134: 00167 ! XLIB 768 0 at 8029B
80139: 00183 ! XLIB 768 1 at 802BC
8013E: 001A4 ! XLIB 768 2 at 802E2
80143: 001C5 ! XLIB 768 3 at 80308
80148: 001E1 ! XLIB 768 4 at 80329
8014D: 00202 ! XLIB 768 5 at 8034F
80152: 0021E ! XLIB 768 6 at 80370
80157: 0023F ! XLIB 768 7 at 80396
8015C: 00254 ! XLIB 768 8 at 803B0
80161: 002DE ! XLIB 768 9 at 8043F
80166: 00303 ! XLIB 768 10 at 80469
8016B: 00328 ! XLIB 768 11 at 80493
80170: 0037D ! XLIB 768 12 at 804ED
80175: 0044F ! XLIB 768 13 at 805C4
8017A: 004E7 ! XLIB 768 14 at 80661
8017F: 00500 ! XLIB 768 15 at 8067F
80184: 00514 ! XLIB 768 16 at 80698
80189: 005BC ! XLIB 768 17 at 80745
8018E: 005E1 ! XLIB 768 18 at 8076F
80193: 00605 ! XLIB 768 19 at 80798
80198: 0069D ! XLIB 768 20 at 80835
8019D: 006CD ! XLIB 768 21 at 8086A
801A2: 0072A ! XLIB 768 22 at 808CC
801A7: 00753 ! XLIB 768 23 at 808FA
801AC: 00792 ! XLIB 768 24 at 8093E
801B1: 00819 ! XLIB 768 25 at 809CA
801B6: 00832 ! XLIB 768 26 at 809E8
801BB: 008B1 ! XLIB 768 27 at 80A6C
801C0: 008DA ! XLIB 768 28 at 80A9A
801C5: 00E8C ! XLIB 768 29 at 81051
801CA: 00F55 ! XLIB 768 30 at 8111F
801CF: 00F95 ! XLIB 768 31 at 81164
801D4: 00FBC ! XLIB 768 32 at 81190
801D9: 00FE7 ! XLIB 768 33 at 811C0
801DE: 010AC ! XLIB 768 34 at 8128A
801E3: 0111D ! XLIB 768 35 at 81300
801E8: 0113A ! XLIB 768 36 at 81322
801ED: 01155 ! XLIB 768 37 at 81342
801F2: 0116A ! XLIB 768 38 at 8135C
801F7: 011EE ! XLIB 768 39 at 813E5
801FC: 0136F ! XLIB 768 40 at 8156B
80201: 01383 ! XLIB 768 41 at 81584
80206: 01396 ! XLIB 768 42 at 8159C
8020B: 013A9 ! XLIB 768 43 at 815B4
8156B: 02D9D ! Program
81570: [...] ! <300h>
8157A: 07709 ; Internal ATTACH to HOME directory (1:System Binary)
8157F: 0312B ! End Marker
Backup (02B62)
<prolog><size><name><data>
<prolog> = 02B62 (BIN5)
<size> = number of nibbles remaining (BIN5)
<name> = the name of the backup (
Library Data (02B88)
<prolog><size><ident><data-1>...<data-n><end-marker>
<prolog> = 02B88 (BIN5)
<size> =r><object-number>
<library-number> = library number (BIN3)
<object-number> = object number (library specific) (BIN2)
<data-i> = the 'hidden' library data (ANY)
<end-marker> = 0312B (BIN5)
Example:
...B21300040"
{ Graphic 131 x 64
<1h> <1h> <1h>
"20000001000100000...
}
Program (02D9D)
<prolog> ... <end-marker>
<prolog> = 02D9D (BIN5)
The "..." part is a sequence of objects.
<end-marker> = 0312B (BIN5)
Examples:
02D9D Program
2361E \<<
1FBBD SWAP
1FBD8 DROP
23639 \>>
0312B End Marker
"D9D29E1632DBBE18DDF193632B21306A65" ASC\-> returns
\<< SWAP DROP \>>
02D9D Program
18A8D Verify DEPTH >= 2
60F9B drop level two object
0312B End Marker
"D9D20D8A81B9F06B2130D01D" ASC\-> returns
External External
Code (02DCC)
<prolog><size><machine-code>
<prolog> = 02DCC (BIN5)
<size> = number of nibbles remaining (BIN5)
<machine-code> = machine code (<size>-5 nibbles) (CODE)
Global Name (02E48)
<prolog><name>
<prolog> = 02E48 (BIN5)
<name> = ASCII counted character string (
Local Name (02E6D)
<prolog><name>
<prolog> = 02E6D (BIN5)
<name> = ASCII counted character string (
Executing EVAL at this point will generate an 'EVAL Error:
Undefined Local Name'.
XLIB Name (02E92)
<prolog><library-number><object-number>
<prolog> = 02E92 (BIN5)
<library-number> = library number (BIN3)
<object-number> = object number with library (BIN3)
Example:
The XLIB name for the EQ Library's MINEHUNT is XLIB 268 0
"29E20C01000FEA7" ASC\-> returns MINEHUNT
"29E20C01000FEA7" ASC\-> returns XLIB 268 0