Table of Contents
Work on LZEXE and alias Extensions for lDebug
2026-08-30
LZEXE
The changes to LZEXE were initiated because I considered that the last several instructions of the depack stub can overwrite themselves if the stack happens to be at an unfortunate location. I was able to generate test cases that do invoke this behaviour.
- Split variables for cs and ip patch locations. Prepares for the new stub trail, which will place cs and ip separately for shorter code.
- Introduce the alternative stubs with a stack trampoline. This includes the use of a stack adjust value. The last instruction on the stack trampoline is a
retf imm16which pops at least 4 bytes off the stack using its immediate operand, corresponding to the instructions of the trampoline. Using the adjust, a larger value may be written to the immediate. This allows to avoid corrupting the trampoline setup code with the stack or the space the trampoline itself is written to. - Increment ecm release to 5, except for the unlzexe.c file (which doesn't support the new stub format yet).
- Fix a comment on si:dx holding ss:sp rather than si:di.
- Fix comment on the layout of the trampoline.
- Add the STACK16NOPS define for testing the trampoline stub. This is needed to allow stackadjust as zero, so that the
retf imm16is written at the very end of the stack space. Combined with a doctored executable, this allows to generate an output file in which theretf imm16runs with ip equal to FFFDh, running into a dosemu2 bug fixed last year. - Fix the stackoverlaps function by casting to longint before multiplication that may overflow word.
- Increment stackadjust with stride 2 instead of 16. 2 is the lowest this should go lest we use an odd sp, however the choice of an even value higher than 2 is not wrong as such.
- Initial stackadjust = 2 if sp = 0, to avoid the dosemu2 bug mentioned before. Writing or reserving space for a nop isn't required because the stackadjust value (if nonzero) does reserve space already.
- Increment ecm release to 6, again except for unlzexe.c
- Add a warning for a low sp (< 128 and != 0).
- Add a /T switch to force use of a trampoline stub.
- Support LZX0 format with a trampoline stub in unlexe.c
- Increment ecm release to 6 for unlzexe.c
- Correct a comment in unlzexe.c concerning the getbit register counting bits left.
- Fix amd64 build's condition for reaching the end of the LZ09 relocation table. This should check for a word value of 0000h, but checked for 10000h which a word variable can never reach.
- Fix LZ09 relocation table edge case where the value stored in the compressed table is equal to all-ones (FFFFh), which would incorrectly be written as an MZ executable relocation with offset all-ones. To maintain portable correct behaviour, this must be adjusted, such as by incrementing the segment value and subtracting 16 from the offset value. (This same bug was present in UPACKEXE earlier (until 2025-06-26), and according to David Fifield the same error was present in some EXEPACK stubs. The LZ09 stub contained the copied EXEPACK relocation table handler with the workaround.)
- Increment ecm release to 7 (for all files).
lDebug
- Accept an all-whitespace replacement for ALT_MULTI_NONE type multi-aliases.
- Do not store the all-whitespace replacement if an ALT_MULTI_NONE type is in use.
- Fix list with \Q, uncomment a jump that needs to be included.
- Fix anonymous @@ label clash for AC type dispatch. Discontinue use of anonymous labels for skipping the handling of each type.
- Add test.py test for multi-aliases.
- Fix multi-aliases test to zero BX before reading it.
- Add multi-aliases test to dynamotests (run in 16-bit and 32-bit DPMI).
- Add an eldcomp.eld install command with an ALIAS RUN command to better test the alias Extension for lDebug.
- (The eldcomp.eld changes were listed in a blog post of their own already.)
- Fix, have eldcomp.eld hash the entire data block rather than only the date time stamp. Bug on 2024-05-22.
- In eldcomp.eld detect seconds in a date time stamp and zero them out by writing "00" to them, avoiding false positive mismatches if the XLD and ELD build have a differing seconds value.
- In eldcomp.eld, init line_in with all-zeroes then write only the meaningful part of the command. This avoids a false positive data mismatch in reserve.eld because of trailing garbage in line_in
- Rename first multi-aliases test to test_ext_alias_multi1
- Add some single-alias commands to test_ext_alias_multi3
- Add ALIAS RUN tests for instance passing or instance OOM.
- Delete two doubled buffer clear lines. These originate from copying and pasting parts of the test to add new tests, and copying both the initial and exit buffer clear just to be sure.
- Add test where DEL needs to relocate the alias pointer of an alias instance.
- Add more ALIAS LIST tests, with replacement escape codes.
- In alias.asm set the promptlen variable when echoing an alias command.
- Add ALIAS ECHO DEFAULT commands. Could share most code with the non-default ALIAS ECHO by simply passing a pointer that points the code to the echo default variable.
- Append a plus sign to prompt displayed for echoed alias command.
- Add plus sign prefix to ALIAS commands, which is replaced by a blank and passed down to the next command handler. This allows to give commands to an alias.eld instance other than the most recently installed one.
This revision was also the last revision in which alias.eld's resident ELD code section use was small enough to allow running ldmem.eld in the testcdxu lCDebugX setup. This is with LINKCALL, AFORMAT, EXTNAME, QUIT, AMISOTH, AMISCMD, and ALIAS installed residently. With this revision of alias.eld, exactly 1E70h (7792) bytes of the 16 KiB ELD code space are left, which is exactly the requirement to run a transient ldmem.eld (according to ext list ldmem.eld verbose). Of course, running ldmemoth.eld in the other lCDebugX instance is not bound by the ELD space of the debugger being debugged.
- Add two new comlevels handler functions for use by the Control-C handling in the debugger.
- Add handling for Control-C functions to alias.eld
- Add new EXIT codes used by Control-C handling to the tables in alias.eld and testcoml.eld
- Add salias and malias variant Extensions for lDebug. salias is like the old alias.eld which supports only single-aliases (albeit the internal alias buffer format has changed), whereas malias only supports multi-aliases, saving several hundred bytes of ELD code space. The impetus for this was to allow testing malias.eld in the testcdxu setup and still have enough space for running ldmem.eld, as described above.
- Add the salias.eld and malias.eld to scripts and the library ELDs.
- In malias.eld add a compatibility wrapper for the ALIAS ADD command, which treats the expansion similarly to a single-alias by translating it into a multi-alias.
- In extlib.asm place malias and salias after alias.eld rather than alphabetically.
- Manual:
- Fix a typo in eld-alias-install section.
- Add eld-alias-plus section on passing down ALIAS commands.
- Document multi-alias echo prompt and the use of an @ sign to hide alias command echo.
- Improve wording in eld-salias list of unsupported commands.
- Merge two redundant paragraphs in eld-alias-echo, the @ sign echo disable was already mentioned before.
- Delete obsolete unused msg.notyet from alias.asm
- Update eldcomlevels manual section with Control-C handling callouts. (This consists of expanded protocol comments not found anywhere in the source texts yet.)
- Update variol manual section for alias.eld use of the IOL variable.
- Fix malias.eld ALIAS RUN commands to clear the addsinglecompat flag. Running ALIAS ADD then ALIAS RUN would incorrectly treat the ALIAS RUN expansion like a single-alias compatibility expansion (eg unescaped semicolon is read as a literal rather than alias command separator).
- Add test_ext_salias test which runs the same tests as test_ext_alias but by installing salias.eld instead.
ETA:
- Add test_ext_malias test which runs malias.eld instead, with one adjustment for the differing ALIAS LIST format.
- Add test_ext_malias_multi1, almost the same tests as test_ext_alias_multi1 except for different alias buffer utilisation of the single-alias ALIAS ADD command.
- Add test_ext_malias_multi2, exactly the same tests as test_ext_alias_multi2 just using malias.eld instead.
- Add test_ext_malias_multi3, exactly the same tests as the base.
- Run alias tests only in DPMI32, not in DPMI16. The results should be the same and the debuggee segregs don't matter for testing alias Extensions for lDebug.
- List new malias and salias tests in the test reference section of the manual.
