dfgordon / retrocompressor

compress and expand using retro formats
Other
1 stars 0 forks source link

Teledisk v1.X LZW #1

Closed dbalsom closed 1 week ago

dbalsom commented 1 month ago

I'm glad I discovered this. I'm making a disk image library for emulators (mostly for use with my emulator MartyPC) and you have saved me a lot of work. Thank you!

Teledisk version 1.x used a variant of LZW instead of LZHUF. It might be useful to add this, as there are still some 1.x images floating around out there.

Here are some notes on the LZW parameters, but I haven't verified this myself:

  1. code length is fixed (12-bit) rather than variable, which also means a 4096-byte dictionary, any bytes above that are stored as literals converted to 12-bit

  2. codes are stored directly as 3 nibbles each, the same way 12-bit values are stored in a FAT12 fat table

  3. the dictionary is reset every time 6144 bytes of lzw codes are written

dfgordon commented 1 month ago

Ok thanks for the info, I will try to incorporate that. I recall coming across MartyPC somewhere during the research. As a side note the crate a2kit has disk image modules for TD0 and IMD among others, in case that is useful, though not necessarily designed for emulator environments.

dfgordon commented 1 week ago

An update that takes care of this has been pushed up, release should follow shortly.

dfgordon commented 1 week ago

Released 1.0.0 which should take care of it.