New PACKSEG Implementation For The Workshop

Started by AlexTheCat123, August 05, 2025, 07:32:47 PM

Previous topic - Next topic

AlexTheCat123

Quote from: Eschaton on February 15, 2026, 08:56:35 PMIt's also a pretty interesting algorithm: It's likely that some statistical analysis could produce a rather good 256-element compression table, given the regularity of the Pascal compiler's (relatively unsophisticated) code generation and the regularity of the 68K instruction set.

Ha, I've actually thought about doing this a couple of times! The only reason I haven't (aside from being busy with the LisaFPGA project) is because then the new packtable would be incompatible with all existing installations of LOS; you'd have to repack everything in order to use it. I know that might be a bit of a dumb objection since the kinds of people who would know how to copy over a new packtable would also know how to repack the OS files, but it just bugs me that you wouldn't be able to overwrite an existing SYSTEM.UNPACK without repacking things.

I wonder how they came up with the packtable that shipped with LOS? I'm guesing they analyzed earlier versions of the OS (or maybe the Monitor) and just threw the most commonly-occurring words in there?

Eschaton

Quote from: AlexTheCat123 on February 15, 2026, 11:05:45 PMwonder how they came up with the packtable that shipped with LOS? I'm guesing they analyzed earlier versions of the OS (or maybe the Monitor) and just threw the most commonly-occurring words in there?

They might even have looked at exactly what the Pascal compiler's code generator can output, since it's only ever really going to use a subset of instructions and addressing modes anyway.

It also doesn't seem like it'd be very difficult at all to modify the binary loader to use a packtable found inside a file to unpack any packed code inside of it. There's no code to do that currently (unpacking always passes the system packtable) but it'd just be a matter of keeping track of the object during the initial scan through the file and then passing it to UNPACKCODE instead of the system packtable.

AlexTheCat123

Quote from: Eschaton on February 26, 2026, 05:53:02 PMIt also doesn't seem like it'd be very difficult at all to modify the binary loader to use a packtable found inside a file to unpack any packed code inside of it. There's no code to do that currently (unpacking always passes the system packtable) but it'd just be a matter of keeping track of the object during the initial scan through the file and then passing it to UNPACKCODE instead of the system packtable.

I might just be imagining things, but I think that I came across something during my LOS investigations indicating that this was something that they actually did at one point in time. Not sure when they switched away in favor of the current method, but I'm pretty sure that some older releases did indeed store the packtable within the file (or at least give that as an option).

Eschaton

That wouldn't surprise me. Perhaps they originally thought that this would help enable a dual-Twiggy Lisa to actually be useful without a hard disk, or something along those lines, since they could include an optimized packtable in each tool.

It's also amusing that the linker can't link against packed objects, so Workshop replaces the packed libraries with unpacked libraries... I guess unpacking at link time, or generating linkable stub libraries, or unpacking to linkable copies, or even just unpacking in-place during installation was too much work.

AlexTheCat123

Quote from: Eschaton on Yesterday at 11:56:03 PMIt's also amusing that the linker can't link against packed objects, so Workshop replaces the packed libraries with unpacked libraries... I guess unpacking at link time, or generating linkable stub libraries, or unpacking to linkable copies, or even just unpacking in-place during installation was too much work.

Yeah, this really shocked me when I first discovered it. I spent forever trying to figure out why my packed libraries were breaking the linker, thinking that something was wrong with my PACKSEG implementation, only to discover that it's not even supposed to work with them at all!

This also means that, if you want LOS and the Workshop installed alongside each other on the same disk, you MUST install LOS first and then the Workshop. If you do them the other way around, the LOS installer will overwrite the unpacked libraries that the Workshop just laid down and replace them with packed ones. You'd think that they would've thought of this and added a check in the installer for it, but clearly not...

blusnowkitty

Quote from: AlexTheCat123 on Today at 12:29:50 AMYou'd think that they would've thought of this and added a check in the installer for it, but clearly not...

The more you read about the Office System, the more haphazard it all seems, and something of a miracle that it even came out at all...
You haven't lived until you've heard the sound of a Sony 400k drive.