Gotek with the HxC on an HP1652B

arpruss
Posts: 7
Joined: Mon Jan 05, 2026 6:02 am

Re: Gotek with the HxC on an HP1652B

Post by arpruss »

In case anybody else is interested in manipulating files on the images, I should note that the common lifutils package doesn't work with the special reserved track 79 of the HP16xx disks.

I made a few quick and dirty scripts for manipulating things.

First, I convert HFE to LIF by doing:

Code: Select all

hxcfe -finput:filename.hfe -conv:RAW_LOADER -foutput:filename.lif
I can then manipulate the filename.lif image with:

Code: Select all

python lifutils.py dir filename.lif
python lifutils.py rm filename.lif NAME_TO_DELETE
python lifutils.py get filename.lif NAME_TO_FETCH
python lifutils.py put filename.lif NAME_TO_UPLOAD
python lifutils.py pack filename.lif
The lifutils.py file is here.

Finally, I convert the lif file to xml with this script, and then to hfe:

Code: Select all

python lif2xml.py filename.lif
hxcfe -finput:filename.xml -conv:HXC_HFE -foutput:filename.xml
It would be nice if raw lif images worked with hxc, but I can't get that to work.
siredward
Posts: 21
Joined: Thu Jul 25, 2024 4:30 pm

Re: Gotek with the HxC on an HP1652B

Post by siredward »

Wow quite nice. I tried the 'dir' and 'get' options on the Python file so far. It seems to work quite well.

A typical output portion is :
0 ADAP_6808C,C120,24,19,90/02/14 02:06:00,8001534f544f
1 SNICKR_SER,C120,252,76,90/02/14 02:06:00,8001534f544f
2 WPC_CPU,C120,404,76,90/02/14 02:06:00,8001534f544f
3 WPC_J20102,C120,480,18,90/02/14 02:06:00,8001534f544f

I recognize the name of the file on the left. What are all the numbers? I see a date and a checksum perhaps.
Also how can I tell how full the disk is?

I am not clear on what the purpose of the xml file is.

Edward Cheung
arpruss
Posts: 7
Joined: Mon Jan 05, 2026 6:02 am

Re: Gotek with the HxC on an HP1652B

Post by arpruss »

1. I just managed to create a layout file for the HP165X units. With the layout file, you don't need lif2xml.py, but you can just do:

Code: Select all

hxcfe -uselayout:hp.xml -finput:NAME.LIF -conv:HXC_HFE -foutput:NAME.HFE
to turn a LIF volume into an HFE volume.

2. Here's the output of lifutils.py dir on my usual boot disk:

Code: Select all

Volume: A165X
Directory start: 2
Directory length: 18 blocks
Directory version: 0
Tracks: 80
Sides: 2
Blocks per track: 20
0 SYSTEM_,C001,20,2593,90/02/14 02:06:00,8001534f544f
1 AUTOLOAD,C301,2613,1,90/02/14 02:06:00,8001534f544f
2 SCOPE_ONLY,C120,2614,67,90/02/14 02:06:00,8001534f544f
3 ARDUINO,C120,2681,67,90/02/14 02:06:00,8001534f544f
4 TTL2,C120,2748,67,90/02/14 02:06:00,8001534f544f
5 LOW_LEVEL,C120,2815,67,90/02/14 02:06:00,8001534f544f
6 SERIAL,C120,2882,67,90/02/14 02:06:00,8001534f544f
7 SCOPE_DEF,C120,2949,67,90/02/14 02:06:00,8001534f544f
Last block 3016
For instance entry 0 is for the unit's operating system:
Filename: SYSTEM_
File type: C001
Starting block in LIF file: 20 (blocks are 256 bytes long)
File length in blocks: 2593
Date: 90/02/14 02:06:00
Miscellaneous data: 8001534f544f

3. My main reference for LIF is: https://www.finseth.com/hpdata/lif.php . Based on that infromation, the miscellaneous data indicates a password (8001) for a file marked private, the password being "SOTO" (534f544f).
siredward
Posts: 21
Joined: Thu Jul 25, 2024 4:30 pm

Re: Gotek with the HxC on an HP1652B

Post by siredward »

So looks like the XML file is a way to tell hxcfe how to prepare the .HFE file using the .LIF as input.

Thank you for your time and effort! I no longer need to use LIFUTILS.EXE as it is really old.

Edit.. I see parallels with your python script and work I did with my HP-41 calculator. Those files are also in LIF format.
That blog is here:
https://www.edcheung.com/job/hp41/hp41.html#pilbox

Edward Cheung
arpruss
Posts: 7
Joined: Mon Jan 05, 2026 6:02 am

Re: Gotek with the HxC on an HP1652B

Post by arpruss »

**UPDATE:** lifutils.py now automatically chunks and unchunks when putting and getting files.

I just noticed that the LIF files have a chunk structure. Each chunk starts with a two-byte length (big-endian), then the data follows (number of bytes equal to the length). After the last chunk is a length of FFFF.

Normally the chunks have lengths of 254, except for the last one which may be shorter.

I noticed this when trying to disassemble PVTEST_ (the system diagnostic program). I was having terrible results with Ghidra until I de-chunked the file. FYI, the actual 68000 code for PVTEST_ and SYSTEM_ begins at offset 0x2C in the de-chunked file, and at least in PVTEST_ it is loaded at 0x984500. I am hoping to be able to write my own code that runs on the unit.
arpruss
Posts: 7
Joined: Mon Jan 05, 2026 6:02 am

Re: Gotek with the HxC on an HP1652B

Post by arpruss »

I am posting a variety of things for the HP165X on: https://github.com/arpruss/hp165x_software_development

In particular, I can now run simple 68K assembly language programs on my 1653B. For instance, dumperkey shows the keycodes of all the keys.
siredward
Posts: 21
Joined: Thu Jul 25, 2024 4:30 pm

Re: Gotek with the HxC on an HP1652B

Post by siredward »

Wow truly impressive hack.

(Meant in the original sense of the word where one finds a machine’s back door and runs custom code on it).

I will explore more when I get home from travel.BTW my general 1652B blog is here:
https://www.edcheung.com/album/album15/ ... p1652b.htm

Dr Edward Cheung
arpruss
Posts: 7
Joined: Mon Jan 05, 2026 6:02 am

Re: Gotek with the HxC on an HP1652B

Post by arpruss »

You might want to see if the software.hfe from my github works on your HP1652B. If you boot it, you should get a loader letting you choose between a memory browser (DUMPER) and my falling blocks game (WIZTRIS).
Post Reply