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 Yesterday at 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).