blog:pushbx:2026:0315_early_mid_march_work_on_several_bits_and_bobs
Table of Contents
Early mid March work on several bits and bobs
2026-03-15
patchini
- Extract lib.asm from patldos assembly language port
- Move the cut function into lib.asm
- Extract msg.asm from patldos
- Re-use lib.asm in patchqry.asm
- Add option define _INCLUDEPATCHQRY for patldos.asm
- Extract messages from patchqry.asm into msg.asm
- Add sections to assembly language sources (CODE, DATA, and BSS)
- Call patchqry as a subfunction from patldos.asm (only if the QUERY keyword is used)
- Add the patchqry line to the main patldos help
Calling patchqry at the very end of the patldos main function is somewhat broken, even in the C language implementation. (The file is re-opened and if ALL or a numeric block specifier is used then patchqry gets the wrong argument.)
So the assembly language port doesn't recreate these broken interactions yet.
lDOS kernel
Allow to override the convlist.pl command used to create .tls trace listing files.
WarpLink
- Finally fix wllist: Reread the twl (read as "towel") structure that may be overwritten by .emit_ledata, to get the correct extdef index. As noted in the changeset message this just changes when the twl is reread, the need for rereading it was already apparent to us earlier. (This bug was found during identicalising the
-f bin_LINK_COMPAT and-f obj_LINK builds of lDebug.) - Increment ecm release to r21.
- Reread the twl directly after calling .emit_ledata, optimising things so that the twl isn't reread repeatedly or if it cannot have been overwritten. No change to correctness.
- During the creation of the wllist object file, reread SEGDEF records and fix their checksums. Not really needed as WarpLink never verifies these.
- Accept a variable to mak.sh to specify name of convlist.pl command to use. And display a line indicating the conversion command is being run.
tractest/convlist.pl
- Copy clquick.pl from convlist.pl
- Drop things from clquick.pl not needed for NASM and WarpLink files.
- Reduce time taken for clquick.pl to process the debugger .tls from 20s to 11s, by not expanding tabs in the first pass over listing files. This first pass is useless in clquick.pl
- Drop Ctrl-Z handling from clquick.pl
- Drop $replacebool variable that is never read.
- Reduce clquick.pl time to 2.5s by never expanding any tabs.
The same output can be achieved by either expanding tabs in .lst files before passing them to clquick.pl, or by expanding tabs on the clquick.pl output. Because NASM uses a prefix width divisible by 8 and never emits any tabs in the prefix, both options are equivalent.
- Fix the expandtabs functions in convlist.pl and traclist.pl, the intended
?:was typoed as:?which has a different meaning. Details in the changeset message. - Drop useless double while loop in expandtabs.
- Optimise convlist.pl:
- In first pass over listing files, only expand tabs if a special section at the end of the file is found.
- Only run listing type tests if type is yet unknown.
- Only check for end of listing file relevant content in second pass if not NASM type of listing.
- Share GAS temp prefix width conditions in one if
- Skip subsequent detection lines if detection already done. Needed to recreate the same output as before.
- Only expand tabs in second pass if needed (ie, the would-be prefix includes tabs). Also change some GAS conditions to allow matching unexpanded tabs. Also detect TASM prefix width only once per input listing file. (The old WarpLink build failed with the TASM change in one file, because the first comment line has a blank before the semicolon. This is considered acceptable breakage.)
- Detect TASM warning messages and do not treat them to prefix processing.
- Ignore addsection directives as well if usesection disable note received. Also match tabs as whitespace after sectioning directives.
- Match tabs as whitespace after GAS sectioning directives.
- Suppress the section switch line if current active section is the same as the one to switch to.
ident86
- Fix the same expandtabs bug as in convlist.pl
- In matchsize skip over "at" mmacro.
- Fix, do not append a displayed line to the priorlinesdeque. This would display duplicate lines if multiple consecutive dump lines were displayed with no instruction in the exact .tls line. There was an attempt to clear the deque at the point a line is displayed, but as the next line was appended at the end of the loop the current line would still be appended.
- Pick up a .tls size directive from NASM dump lines that read
xx<rep yh>in the machine code dump, where the xx is exactly two hexits and the y is a hexadecimal number. I wrote a NASM report about how the .tls size directive wasn't picked up for such lines prior to this change.
lDebug
Mostly changes to the _LINK / -f obj build.
- Avoid NASM bug (Bug 3392960) where [list -] at end of file is still active at start of file.
- Add alignment of sections for _LINK_COMPAT. These are so that -f bin sections get aligned the same way as segparts in the -f obj build: A sectalign alignment doesn't just align the total segment, it also aligns the segpart start per object module. If there's less aligned data between the segpart start and the aligned data, then this less aligned data gets the same segpart alignment.
- Move maxtypesize equate to debug.mac
- Fix to use _LINK define for a wlcalc request in uu.asm not _LINK_COMPAT
- Add the _LINK_COMPAT %include directives to -f bin debug.asm that exactly match the order of -f obj object files in the linker response file. This was a resounding success. I didn't expect that it would work so well.
- Fix the _LINK code in amis.asm to calculate device header segment, should add 10h bytes not 10h paragraphs.
- Fix in init.asm _LINK build, should add 1 paragraph not subtract it.
- Many changes to identicalise offsets for the -f bin _LINK_COMPAT and -f obj _LINK builds of DDebugX. Mostly forcing strict word size for operands, explicitly coding some near branch workarounds for conditional jumps, use wlcalc in the lastcmd_transfer_ext_entry _LINK rather than a workaround, using the longer BOOTRELOC1 code for unknown size in init.asm, and putting the 386 patch tables at the end of init.asm (forced to method 1).
- Move the dual-code non-PM _LINK_COMPAT inter-segment relocation tables to the end of the init.asm file.
- Move the SOURCEFILENAME defines into the files instead of passing them in -f obj NASM commands. As the changeset message states, this allows to use the defines for the -f bin build as well.
- Switch the sense/order of the _LINK conditional for nearcall mmacros. Prepares for the very next changeset.
- For -f bin _LINK_COMPAT with _DUALCODENEARDUAL in effect, emit duplicate thunks per SOURCEFILENAME just like the -f obj build.
- The scriptlet used to generate the SOURCEFILENAME defines, in the changeset message. This changeset is empty. Note that there is a bug in the EOL regexp: It should read
/([\r\n]+)$/but actually reads/([\r]n]+)$/ - Add extern labels needed to build CDebugX. Changeset message contains the scriptlet used to generate these directives.
- Move the struc MOVETABLEENTRY into debug.mac (for _LOADER build).
- Fix linebreaks in SOURCEFILENAME define lines. Scriptlet in changeset message. (This was needed due to the EOL regexp bug in the earlier scriptlet.)
- Identicalise some instructions that optimised to
sub ax, imms8that are strict word in _LINK build to enable wlcalc use. Either choice emits the same instruction length though. - Align after boot help using zeroes rather than NOPs. To identicalise.
- Fix to align code_size value to a paragraph boundary.
- Identicalise all of the Debug builds. Note the caveat in the changeset message on ext data size.
- Allow assembling -f obj build with _BOOTLDR=0 (One of the fixes is needed for the -f bin build too!)
- makefile changes:
- Store options into a file and rebuild all .asm files if they changed. This uses a FORCE dependency to always run the options check target. It stores the desired options into one file (in the tmp obj directory) and compares it to the prior used options. If they mismatch, the new file is copied over the old file to indicate the to be used options. The used options file is a prerequisite of all .asm files.
- Use order-only prerequisites to create directories. Reference: https://stackoverflow.com/questions/3275449/can-a-makefile-have-a-directory-as-a-target/13418059#13418059
- Rebuild amis.obj, init.obj, and msg.obj if version changed. Adds the VERSIONOPTIONS variable for version defines only.
- Hide the commands run for options and version.mac updates.
- Pass VERSIONMAC define to assembler instead of -P switch. Add manual %include directives to amis.asm, init.asm, and msg.asm files. -P didn't work if processing eg aa.asm before version.mac has been created.
- Set default BUILDOPTIONS based on the BUILDNAME variable (debug, debugx, ddebug, ddebugx, cdebug, cdebugx, or oader).
You could leave a comment if you were logged in.
blog/pushbx/2026/0315_early_mid_march_work_on_several_bits_and_bobs.txt · Last modified: by ecm
