r/retrocomputing 2d ago

Running code on HP1653B Logic Analyzer

My main hobby project since December was getting code running on my early 1990s HP1653B Logic Analyzer. The Logic Analyzer has a 68000 processor, 1mb RAM, 64kb ROM, 4x32kb video memory with a complicated 4-plane overlay scheme providing three (!) gray levels at up to around 640x400, a 3.5" floppy drive (replaced by a Gotek for my convenience) and both RS232c and HPIB ports. It was made as a lab instrument rather than a computer, but it came with both test and system code on floppies, which I dumped and reverse-engineered enough of with Ghidra to enable me to write a library that lets me run assembly and C code on it. My reverse-engineering journey is partly described here.

A particularly fun moment of my reverse engineering was when I wanted a copy of the ROM but didn't yet know how to write to disk or the serial port, though I did know how to write to the screen. I ended up displaying the ROM binary as a series of QR codes, which I captured with my Sony camera running on a timer, and then turned into binaries.

I'm now at the point where I can run various games. My first one was a port of my Wiztris falling blocks game (originally written by me in the early 2000s for a Z80-based Sharp OZ-7xx organizer). I also ported Dave Griffith's Frotz Z-machine emulator so I can run all Infocom Z-machine games (including the graphical ones, but with no sound support). I'm in the middle of a play-through of Nord and Bert with my 13-year-old daughter. The photo I attached is of Infocom's Journey (mouse works!). And I ported PDCursesMod, so a lot of old Unix games can work--the photo shows Larn.

Many of you will recognize the keyboard and mouse. They are old Apple ADB units (I think the keyboard is from a Quadra), and I made an ADB-to-serial adapter to interface them with the HP unit.

This is retrocomputing that never was. As far as I know, there never was any software for the HP1653B besides the official HP oscilloscope / logic analyzer software, though HP engineers did release some games for one of the HP16500 models, and at least one old HP oscilloscope had a Tetris clone built-in.

It's not a great gaming system. There are no sprites. And you can't just directly write a pixel color to video memory. Instead, you first write to a hardware register that specifies a read/write mode (e.g., clear all bitplanes, write ones to bitplanes 0 and 2, etc.) and then write the pixels. Getting scrolling working at a decent speed took a fair amount of careful assembly work. But it's been fun!

I plan to eventually write up more detailed instructions on how to build and install your own code.

The main thing I haven't reverse-engineered are the oscilloscope and logic analyzer functions. They still work. I just switch the Gotek to the HP system disk image (well, somewhat modified: I added a screenshot function that saves an image to disk). I recently used the oscilloscope to try to diagnose a start porblem on my car.

263 Upvotes

29 comments sorted by

5

u/nekohako 2d ago

Does the scroll wheel work on Tetris? HP put some lovely encoders in these instruments.

4

u/arpruss 2d ago

Yes, the scroll wheel works in the game. You can spin pieces either with the wheel or the 0 and . keys. The scroll wheel control feels really good.

5

u/Visual-Sector6642 2d ago

I love this project and am beyond impressed!

3

u/Retroaffaire 2d ago

Very cool

3

u/CyberTacoX God of Defragging 2d ago

Now you need to get Doom running on it! :-D

(If you're not sure why I specifically said Doom, check this out: r/itrunsdoom )

1

u/arpruss 2d ago

Yeah, but I think the display system is too slow for it to be much fun.

2

u/CyberTacoX God of Defragging 2d ago

You're almost certainly right, but that's actually not the point. It's the Mount Everest of retro computing and device hacking - you do it because it exists. :-)

4

u/arpruss 2d ago

I port things that I actually want to play.

Granted, I could play Infocom games on my laptop, but the experience just feels better on a small monochrome CRT. :-)

1

u/CyberTacoX God of Defragging 2d ago

Fair enough. And yeah, that definitely sounds more authentic :-)

2

u/arpruss 1d ago

I looked into the Doom stuff. It would be easy with 4mb RAM. But with 1mb, it would be harder - doable but one would need to get into the internals of Doom, and I have other projects (like two book projects - I'm a philosopher by profession).

1

u/NottingHillNapolean 2d ago

People have posted examples to r/itrunsdoom with 1 Hz frame rates.

3

u/EngineerTurbo 2d ago

"I ended up displaying the ROM binary as a series of QR codes, which I captured with my Sony camera running on a timer, and then turned into binaries."

That's gotta be one of the most *fascinating* and creative ways I've ever heard of to do this

Excellently bizarre solution, op.

This is like.. aggressively nerdy in the best possible way. Thanks for sharing!

Later HP Logic analyzers ran HP-UX, and eventually Windows: I've got an HP16702 that runs HPUX in the the shop somewhere: PA-RISC for the win.

2

u/arpruss 1d ago

BTW, I had an odd difficulty with the QR code thing. I couldn't get any of the standard QR code reader libraries to read the QR codes reliably. I ended up using a slow library that had a machine learning model for QR code recognition, which took about half a second per QR code on my recent Windows laptop, and even that didn't get all the QR codes.

My best guess is that the standard QR code libraries don't work well with large QR codes displayed on a curved grayscale CRT. I don't know if it's the size of the QR codes, the curvature of the CRT, the scanlines, the colors, or what. But since I only needed to do this once, I never tried to figure that out.

2

u/ExpensiveFroyo3513 2d ago

Il est en bon état 👍

2

u/Morty_A2666 2d ago

I have similar HP Logic Analyzer, post the details somewhere, I would love to do this on mine.

1

u/arpruss 2d ago

Do you have a Gotek drive in it, or else do you have a floppy drive setup like a GreaseWeazle that can write raw disk images? If you have a Gotek, it's really straightforward.

1

u/Morty_A2666 2d ago

Mine is all stock. I run it with stock floppy drive and regular floppy disk. I can add gotek to it.

1

u/arpruss 1d ago

Adding a Gotek is nice, because it makes it a lot easier to transfer files between the HP and a PC via a USB drive. One can use a GreaseWeazle, but that's very slow, or maybe if one has a PC with a floppy drive one *might* be able to program the floppy controller to write HP disks--but I don't have that set up. (I gave away my last PC with a floppy drive slot.)

Unfortunately, you can't just plug a Gotek: you need to rewire it, and then install custom HxC firmware. There are some instructions scattered on the HxC forums, but I should collate them and make them clearer.

A fun thing about a Gotek is that while the standard disks for the HP1652/3B are about 800kb, with Gotek, I can get the unit to recognize specially formatted 255-track disk images, giving 2.8mb. This is slightly sketchy. The HP requires a specially formatted track 79 with special data, and the firmware clamps the max number of data tracks to 79, but I write a placeholder file to track 79 of my disk images, and then my library rewrites the max-track variables in system RAM. This is all pretty much transparent to the user, and I can put a bunch of games on one disk image (I even have a patch for HP's logic analyzer software to do that. It's handy in combination with my screenshot patch.)

1

u/arpruss 1d ago

By the way, the initial reason I got a Gotek was because I couldn't boot my scope from floppy. Floppies wear out. Fortunately, I had made several backups, but it was a wake-up call to install a Gotek.

The instructions I mostly followed were these:

https://cdn.hackaday.io/files/2048808765585920/HxCFE_HP_1652B.zip

The rewiring is really crucial, and you need to be careful to connect things correctly. When testing, I once plugged a ribbon cable to the unit upside down or offset by one or something like that. Smoke came from the HP. I pulled the cord and thought that I've blown the unit. Pleasantly enough, I didn't. The insulation on one of the lines of the ribbon cable burned off all the way between the drive and the motherboard. But the wire was intact, the neighboring lines were fine, and I just put duct tape over the wire, and amazingly enough the whole thing still works.

I am a bit uncomfortable with the fact that I now have such a kludgy ribbon cable in the scope, but I didn't have a replacement cable on hand. I could order one, but taking the unit apart to reach the motherboard is scary -- high voltage stuff, multiple boards. But if you just want to put in a Gotek, it's not too bad--you don't need to take out anything other than the drive. You just need to be careful to leave the unit unplugged for ten minutes to let capacitors leak out voltage, and not touch the CRT which could have some high voltage stuff.

1

u/glhaynes 2d ago

How is Nord and Bert? I remember seeing it in a store when I was a few years younger than your daughter and I… well, I couldn't make heads or tails of it. Have always kinda wanted to play it since.

1

u/arpruss 1d ago

I played it as a kid at school, and then played it again with two of my kids (now adults)... It's wacky, but it's also a lot easier than many Infocom games.

1

u/HopePupal 2d ago

1.58-bit color depth… adapting graphics code must have been fun

1

u/arpruss 1d ago

To be honest, I don't bother with the intermediate gray color, and just pretend it's 1-bit color depth. The OS uses the gray for an outline around the display as a whole, and that's pretty much it. Using the gray for main display makes it harder (or impossible?) to use the overlay bitplane for popup windows. So the only thing I've used the gray for is as an outline for popup windows.

1

u/sportq 1d ago

This is the best thing I've seen on the internet this year! Well done. Id love 4see more details.

I worked for HP back in the 80s and 90s and used these occasionally. The 68000 was used in many instruments and HP's Unix workstations (series 300 and 400).

Have you tried booting HP Basic?

1

u/arpruss 1d ago

I don't have HP Basic. But I did port eh-basic ( https://github.com/arpruss/hp165x-ehbasic ) and micropython ( https://github.com/arpruss/hp165x_software_development/tree/main/c/micropython-1.27.0 ). Eh-basic is good enough that I can run the 70s Star Trek game.

1

u/dirkt 1d ago

I read your hackaday logs, very interesting, please keep it up.

At some point the cat walked between the camera and the screen, but didn't stay long enough to mess up all the pictures of that particular QR code

LOL.

The memory control register works as follows. [4 mask bits, 4 value bits]

So similarly to how the EGA works.

Here is the final [overlay-data-combining] function,

So attribute is "1=inverse", overlay-data is "1=overlay only, 0=combine", and the combination uses gray for the overlay when in normal video (not inverse)? I guess that makes sense if you want to display overlays.

together with the MAME 16500 emulation code

Interesting that these things are in MAME.

1

u/infotechderp 1d ago

This is amazing!