Metadata-Version: 2.4
Name: lif80utils
Version: 0.0.4
Summary: LIF utilities for the Series 80
Author-email: Christian Grosz <boeingflieger@centerofgravity.at>
Description-Content-Type: text/markdown
License-File: LICENSE.md
Dynamic: license-file

---
gitea: none
include_toc: true
---
# lif80utils

The LIF80UTILS are command line utilities to handle LIF (Hewlett Packard Logical Interchange Format) files used by HP Series 80 computers.

For HP calculators HP-41, HP-71 and HP-75 see the [LIFUTILS](https://github.com/bug400/lifutils) project.

## Prerequisites

This software was developed and tested exclusively under Linux. Since Python is cross-platform compatibile it could theoretically run on Windows. At least the non GPIB parts.

To access a physical drive connected to a GPIB card the latest [Linux GPIB Package](https://linux-gpib.sourceforge.io/) [4.3.7](https://sourceforge.net/projects/linux-gpib/files/linux-gpib%20for%203.x.x%20and%202.6.x%20kernels/4.3.7/) with this [patch](https://sourceforge.net/p/linux-gpib/patches/16/) applied is needed.

Physical drive access has been successfully tested using two 3.5-inch floppy drives ([HP 9121D](https://www.hpmuseum.net/display_item.php?hw=288) and [HP 9123D](https://www.hpmuseum.net/display_item.php?hw=285)). However, for reasons yet to be determined, it is currently incompatible with the 5.25-inch [HP 82901M](https://www.hpmuseum.net/display_item.php?hw=287) drive.

## Installation

For the latest version please download the source code or clone the repository. Generate the distribution archives using [`build`](https://build.pypa.io/en/latest/). These archives (`.whl`,`.tar.gz` or `.zip`) can be installed by [`pip`](https://packaging.python.org/en/latest/key_projects/#pip).

```bash
cd lif80utils                                                         # Where the 'pyproject.toml' is located.
python3 -m build                                                      # Generate the distribution archives.
pip install --force-reinstall dist/lif80utils-0.0.1-py3-none-any.whl  # Install the package.
pip uninstall lif80utils                                              # Remove the package.
```
Or install the published package from PyPI.

```bash
pip install -i https://pypi.org/simple/ lif80utils
```
There are also some blackbox tests coming with the package. You can run
them with


```bash
python3 -m unittest discover tests/ -v
```

## Command reference

> [!CAUTION]  
> **Risk of Data Loss:**
> Never ever use these tools on a disk containing valuable data without verified physically write protection.
> If you must perform a write operation, **do it on a copy**.

### File Specifiers

The form of the file specifier is similar to the original.

```text
"file name[:lifpath]"
```

Only that the volume is not restricted to a _:msus_ (_.volume label_ is not supported since dots are valid characters in linux filenames and there distinction would be ambiguous).

Where _:lifpath_ is one of the following.

```text
:/dev/floppy    Linux device (Not working for now)
:directory/     Linux directory
:path_to_image  LIF image file
:Dnnn           GPIB device
```

In order of priority.

All _:lifpath_ character strings begin with a colon.

The _:lifpath_ part of the file specifier can be also set with the _--mass-storage MASS_STORAGE_ option or by setting a _MASS_STORAGE_ environment variable.

```bash
lif80cat :LIF.IMG
lif80cat --mass-storage :LIF.IMG
lif80cat -m :LIF.IMG
MASS_STORAGE=:LIF.IMG lif80cat
```

As _:lifpath_ defaults  to ":.", omitting it will resolve to a local file in the current directory. Therefore, the following file specifiers are equivalent:

```text
QUAKE.E010
./QUAKE.E010
QUAKE.E010:.
```
For LIF files hosted on a Linux filesystem, the file type must be included as a filename extension.

```text
QUAKE.E010
```

A _:msus_ string has the following form:

```text
": device type  interface select code  device address  drive number"
```

The device type is limited to _:D_ because only discs are supported and there is no external tape anyway.

The interface select code refers to the minor device number, a 'minor' of 0 corresponds to /dev/gpib0, of the GPIB controller and not to it's PAD.
See [gpib.conf -- GPIB library configuration file](https://linux-gpib.sourceforge.io/doc_html/configuration-gpib-conf.html).

The device address, an integer from 0 through 7, matches the number set on the device address switch on the mass storage unit.

The drive number, an integer from 0 through 3, specifies the drive on the master or add-on unit you wish to access.

<br>

| Program     | Description |
| ----------- | ----------- |
| [lif80cat](docs/lif80cat.md)       | Lists the file directory of a storage media. |
| [lif80copy](docs/lif80copy.md)     | Copy a named file, or all files from a directory, to destination. |
| [lif80dump](docs/lif80dump.md)     | Hex or binary dump of a storage media. |
| [lif80info](docs/lif80info.md)     | Prints information about a LIF volume. |
| [lif80init](docs/lif80init.md)     | Initialize a storage media. |
| [lif80label](docs/lif80label.md)   | Assign a volume label to a LIF volume. |
| [lif80purge](docs/lif80purge.md)   | Remove the named file from the directory. |
| [lif80rename](docs/lif80rename.md) | Rename a file. |
|  |  |
| [lif80decode](docs/lif80decode.md) | Convert a LIF file into a plain text file. |
| [lif80encode](docs/lif80encode.md) | Convert a plain text file into a LIF file. |
| [lif80renum](docs/lif80renum.md)   | Automatic line numbering of .BAS and .ASM files. |
