Thinking about code size reminded me of being a kid in the 90s and reading through code like https://github.com/legacy-codedigger/aPLib-1.1.1/blob/84374fbf3d2be4820c835aeb06dbe82333a216f7/src/32bit/depack.asm for the first time while trying to understand all the little tricks and nuances. There are probably even better examples but the apack/aplib depacker is tight.
Also old article by
@xoofxAlexandre Mutel on Crinkler at https://code4k.blogspot.com/2010/12/crinkler-secrets-4k-intro-executable.html and the ~200 byte depacker is in https://github.com/runestubbe/Crinkler/blob/50c4d7385507d272d86c990e306278d2b96c61f0/source/Crinkler/modules/header20.asm. Additional insanity due to aliasing the executable code with PE headers to reduce file size.
If you have a fediverse account, you can quote this note from your own instance. Search https://mastodon.social/users/pervognsen/statuses/114682640834929583 on your instance and quote it. (Note that quoting is not supported in Mastodon.)
