Table of Contents

Mid November work

2023-11-19

This week I worked some on lDebug, its Extensions for lDebug, and on a few other projects.

Adding the E.

lDebug, lDOS boot, inicomp, instsect, and the pushbx.org/ecm/web/ page were all updated to render my name more completely, adding the initial for my first given name.

Web site update

The section for seekext received a few updates.

AMIS multiplexer lister (amitsrs)

The amitsrs program originates in Ralf Brown's AMIS libraries. I have updated it several times in the past. This week I fixed a few bugs:

Port to 8086 assembly and ELD

(I wrote about this port in an earlier blog post.)

I also ported amitsrs to an ELD of the same name. This was at first a very close recreation of the original, except I did allow it to operate as a residently installed ELD to begin with.

Later, I replaced the simple check for a nonempty command line tail by parsing for specific keywords to select which lines to additionally display. This allows to select the second line (multiplex number, version, private entry point) or the hotkeys display or the interrupt list display.

TSR changes

testhotk

A new TSR, testhotk, was added to test out the amitsrs hotkey list display.

BP process relocation change

All TSRs were updated to push BP before the termination call used for process relocation, and pop it afterwards. This means the method is less dependent on the termination preserving registers, though it does depend on the SS:SP being carried over correctly.

KEEPHOOK section fix

When KEEPHOOK was updated between 2023 March and 2023 May, a differing alignment directive presumably let the patch utility place the /J options table in the wrong section. It was placed at the end of the resident section, rather than in the transient section. This is now fixed.

The most obvious tell, which actually made me notice something was wrong, was that KEEPHOOK would install into the LMA even though no /JU switch was present and enough UMA space was free.

I did an audit of all other TSRs and the same error was not present in any of them.

It seems that the patch went wrong because the end of the transient section had a align 16, db 0 directive in KEEPHOOK, as opposed to the align 16 in all other TSRs.

lDebug

Path search ELD

The path.eld uses the filename extension warning and guessing as well as the path search originally added to the debugger's init and ports them to a residently installable ELD.

A later change, which affects the init's path search too, is to ignore directories found during the search.

The path.eld also gained subcommands to display, turn on, turn off, or toggle parts of its functionality. These correspond to the /PW, /PS, and /PE switches of init.

The shared source file pathshar.asm defines three different blocks of code, which are to be included at different points in the host program. This was chosen over placing the blocks into mmacros to preserve the excellent NASM listing output. Source code in mmacros is not listed this well. (Whitespace and comments are stripped off the macro expansion, while the macro definition doesn't get the binary opcodes the code assembles into.)

The WHILE buffer and swch1 variables had to be added to the debugger's data links to allow this ELD to work with minimal changes to the shared sources.

The linkinfo_data_as macro was added to make a data link with an alias name differing from the label whose value is actually linked.

Commas before executable pathname

MSDebug allows separators before the executable pathname that it accepts in its K and N commands, as well as on its command line. Compatibility in lDebug only extends to a single comma, however.

The K command already fully supported skipping a single comma, as the cmd4 dispatcher calls skipcomma before dispatching to the command function.

The N command in MSDebug-compatible mode would not include a leading comma in the command line tail it writes. This is fixed.

The init's command line tail invocation of the K command also did not skip a leading comma, which it will now do.

dosdrive.eld

This ELD now allows a SET QUIET command with the empty string as pathname after the keywords. It will silently not change the current drive then.

ldmem

The eldstrict mode was enabled for this ELD. This mode makes most relocation errors fail much more obviously, during build time.

The common string " segment: " is now shared for the MEM display.

There is a new display called SEG which lists only the segment values, and in PM selector values, of all sections. This makes for a much terser output than MEM, which is better if one wants to learn only the seg/sel value of a section.

The SEG display originally re-used the section names from MEM, but shorter aliases were added for some of them. The columns of the SEG display are long enough for the name but at least 5 columns wide.

amitsrs

This ELD was already described in an earlier section and in its own blog post.

FAT12 boot read fix

The FAT12 reader for EXT, Y, and BOOT DIR commands incorrectly detected the condition of a FAT entry that straddles the sector boundary, and thus did not load the second FAT sector required in that case. This randomly popped up during bootloaded testing of lCDebugX and the extname.eld.

extname.eld

This ELD provides filename extension warnings and guessing for the EXT and Y commands. The known extensions exactly match those that will be guessed. They are .ELD and .XLD for the EXT command, and .SLD for the Y command.

This ELD is more complicated than path.eld in that it needs to parse the pathname in the same way as the EXT and Y commands do, including the expansion of the configuration path keywords. Furthermore, if the extension being guessed doesn't match any file, and no path keyword was used, the ELD will next try to guess the extension with the ::scripts:: path prepended, also matching how these commands handle a missing file.

linfo.eld

This ELD displays some information on files and processes loaded using the L command.

The command handler will detect L commands. When detected, it displays the program load name and sets up both a command inject handler to be run when the L command returns to the cmd3 command loop, as well as a puts multi-purpose handler.

The puts handler passes along any messages, but is used to detect output from the L command. Messages about hooking the DPMI entry are allowlisted. Any other message output is assumed to indicate an error in the L command.

After a successful L command or on an LINFO PROBE command, the ELD will probe the file referenced by the N/K program load name buffer. It will display its file size, whether it is an MZ executable with header, and if so then the header size and image size. It will also display the PSP segment and memory block size.

Discard help messages in residently installed ELDs

Most ELDs come with help messages. When the ELD can also be installed residently, frequently the help message would balloon the length of the resident data block without need. This has been fixed by moving the install code behind the data section and conditionally shortening the data block when installing.

The history.eld already had some code in place to do just the same. The set.eld actually retains uninitialised buffers so long that the conditional shortening code in its install is not used. For a lot of ELDs however, this change brought an optimisation of their resident ELD data block sizes.

dosdir.eld

The dosdir ELD was changed to expand its ELD data block to the maximum permissible size for use as a sort buffer. This allows it to operate even if the auxiliary buffer is in use. If it is not in use, then whichever buffer is larger is used.

The ELD also gained the SORTDEBUG keyword which will display the buffer sizes and which one would be chosen if the ELD had been run without the debugging keyword. This handling can be excluded at build time with a _DEBUG=0 build option.

The dosdir.eld also gained the found flag byte from the bootdir.eld, which it uses so that dot and dotdot entries are not only excluded from display but also do not count as "files found" to prevent the "File not found" message from being displayed.

bootdir.eld

This ELD is a build option of dosdir.eld which will make it work (only) when bootloaded, using the debugger's FAT FS support. The auxiliary buffer can only be partially used as a sort buffer then, the first sector (for FAT16 and FAT32) or the first two sectors (for FAT12) must be reserved for use as FAT and directory sector buffers. Fortunately, the dosdir.eld change to allow use of the ELD data block translated directly.

Most of the directory scanning is re-used from list.eld, with a re-initialisation when looking for the sorted files in order. The scanning is very wasteful, particularly for the sorted files. The subdirectory in which the search occurs is re-detected for every sorted file. And the entire directory is searched until the end, also for each sorted file.

Subsequent changes were added. One is to move the setting of the found flag byte into the populate_finddata function. This serves to exclude matching dot and dotdot entries.

The final change yet is for sorted files to append a slash to the directory path name if it doesn't end in one. For instance, if a directory named "ldp" is present in the root directory, and the root directory is scanned using a command like ext bootdir.eld * sort then the sorted re-scan would scan for "ldp" which is misparsed as a partition specification without a pathname. Appending the slash, the re-scan will be for "/ldp" instead which has the expected result.

ELD strict mode reloc only disables reloc-abs warnings

The eldstrict mode utilises new NASM 2.16.02 warnings to detect undeclared relocations. Previously, the mode would disable the new errors entirely in the reloc and reloc2 mmacros. Now, they only disable the reloc-abs errors and retain the remaining reloc-rel errors. If there is need for using relative section-crossing relocations, macros to allow them can be added later. For now, this hardens the build of eldstrict-enabled ELDs.