Free42 — HP-42S Copan Documentation

We added a new set of instructions to Free42 to allow programmatic access to Copan coordinate files. Easting, northing, and elevation data may be retrieved from or written to Copan coordfiles.

This document is not a programming manual. Please consult the Hewlett-Packard HP-42S Owner's Manual for general instructions on programming the HP-42S.

An example program using these new instructions is listed at the end of this page.

A PDF version of this document is available here.

The Point Data Registers

A number of new registers have been added to facilitate coordinate point functions. The new registers are:

  • point coordinate file directory register
  • point number register
  • point x (easting) register
  • point y (northing) register
  • point z (elevation) register

The point coordinate file directory register is used for storing a file path to be used by the open coordinate file function. The point number register, point x register, point y register, and point z register are used for passing values to the functions as well as used by the functions to return values.

Instructions

OPENF
OpenCoordFile
- opens a Copan coordinate file for use
- before calling this function, two arguments are needed:

  • 1. load the point coordinate file directory register with the path of the subdirectory where the coordinate file resides. See the CLRD and APPD commands below.
  • 2. load the name of the coordinate file into the HP-42S alpha register. Do not include the ".pts" extension. OPENF will automatically add this
  • OPENF will build the full filename by using the contents of the coordinate file directory register, the alpha register, and the string ".pts". It will then try to open a coordinate full with this name.

To access coordinate files on handheld computer memory cards:

Palm — to use card, prepend file name with "CARD:"

Pocket PC — to use card, prepend file name with the card name, eg. "Storage Card"

CLOSF
CloseCoordFile
- closes the currently open coordinate file

READP
ReadPoint
- retrieve point x, y, z from file and place in the corresponding point x, y, z registers.
- call with point number in HP-42S x register

WRITP
WritePoint
- write point in point registers to file
- point number used is stored in the point number register
- call with the point number, point easting, point northing, and point elevation in the respective point number register, point x register, point y register, and point z register.

GETXY
GetXY
- place the value from the point x (easting) register into the HP-42S x register and place the value from the point y (northing) register into the HP-42S y register

PUTXY
PutXY
- place the value from the HP-42S x register into the point x (easting) register and place the value from the HP-42S y register into the point y (northing) register

CLRD
ClearDirectory
- clears the file directory register
- this register is used to locate the Copan coordinate file

APPD
AppendDirectory
- append a subdirectory to Copan file directory register
- populated from HP-42S alpha register
- "\" added automatically
- build up the Copan coordinate file location by calling this function
- call this function multiple times to build multi-level subdirectory location

GETZ
GetZ
- get value from point z (elevation) register and place in HP-42S x register

PUTZ
PutZ
- store HP-42S x register in point z (elevation) register

GETN
GetPointNumber
- get point number register and place in HP-42S x register

PUTN
PutPointNumber
- place HP-42S x register in point number register

CLRP
ClearPt
- set all point registers to 0

DELP
DeletePoint
- delete point from file
- call with number of point to be deleted in HP-42S x register

Example program

00 { 46-Byte Prgm }
01 CLRD              // clears the COPAN directory buffer
02 "COPAN"        // "COPAN" placed in alpha register
03 APPD              // set directory to "\COPAN"
04 "BILL"            // "BILL" placed in alpha register
05 APPD              // set directory to "\COPAN\BILL"
06 OPENF            // open file coord. file "\COPAN\BILL\BILL.PTS"
                             // "BILL" retrieved from alpha register and ".PTS" appended
07 1                     // 1 placed in x register
08 READP            // read pt 1 from file and place data in point number, x, y, z registers
09 1250
10 1350              // 1350, 1250 placed in x,y registers
11 PUTXY           // put x, y into point x, y registers
12 WRITP           // write modified point back to file
13 CLOSF           // close the coordinate file
14 .END.