Table of Contents
Late mid October work on Extensions for lDebug
2023-10-22
This week mainly involved more work on lDebug and its ELDs.
Changes not specific to ELDs
- Rework EXT/Y boot command architecture
- Support ::scripts:: and ::config:: keywords in EXT/Y boot commands and BOOT DIR command
- Support fallback to ::scripts:: directory in EXT/Y boot commands
- Allow commas as separators in boot and DOS EXT/Y commands, quote them with doublequotes to specify filenames with commas in them
- Add two blanks before the RH step indicator
- Drop duplicate structure definition of
DIRENTRYin macros file - Extract macros for file system and boot load structures to
iniload.mac(some of these are bootloaded lDebug internal however) - Fix build of _EXTENSIONS=1 _PM=0 debugger
- Add more
section_of_functionchecks - Bugfix, a reference to the application environment size accidentally used the device environment size (benign as these are the same size currently)
- If using an internal environment block, free the original application environment block
- Add a new buffer for RN and RM commands to avoid using the auxiliary buffer
- Add backslash (and slash) to separators in
expr.asmto support boot loaded mode partition specification as eitherhda5/orhda5\
Optimise init memory use
Today I added a change to the debugger's init. Rather than allocating enough memory for the biggest total size (24 KiB aux buffer + 8 KiB layout 3 gap + 63.9 KiB ext buffer) and relocating init high enough for all configurations initially, the init size reserved for aux buffer and ext buffer is reduced to nearly 8 KiB for each.
That means if the specified final size (the "want" size) is larger, it may be necessary to grow the debugger allocation and relocate the init a second time. This, of course, can fail if there is not enough space to grow the allocation.
This error condition is only possible if either the /A= or /X= switch is specified or layout 3 is used, though. There being a new error condition is a disadvantage, but the initial debugger allocation grew to over 200 KiB with a full aux buffer and ext segment which is not acceptable for small devices like the HP 95LX.
During development of this change I accidentally always relocated init to just behind the original init, which blew up with /A=MAX /X=MAX. In truth, this relocation target is the minimal relocation target to avoid an overlapping move. However, if it doesn't suffice then a higher target needs to be used.
ELD infrastructure
- EXT/Y command filename parse and file open functions were reworked and are now exported for use by ELDs
- Boot directory scan functions are usable by ELDs
- A single near call transfer is exposed to ELDs, allowing them to hook into first code section callbacks
- Changed interrupt call ext function to return the
esvalue in the otherwise unused returned parameter - Add code link to function closing the ext handle
- Provide
iniload.macfor boot structures - Add data link to exec block command line pointer
- Add code links with linked names differing from names used internally by the debugger (used for simple interface versioning scheme)
ELD architecture
- Update examples of code link dumping in
eldcall.mac - Define extension header, backwards-compatible to original ELD1 header (one of the reserved fields in the original header indicates where the extension header ends; zero indicates no extension header)
- Define description offset in extension header, allowing to point to an up to 128 Bytes ASCIZ description line
- Define help offset in extension header, allowing to point to an ASCIZ multi-line help
- Allow to restore global system state by hooking into the debugger command inject handler
- Add
requiredkeyword to uses of extcall that must not be changed to extcallcall - Add eldstrict mode in which every data relocation must be prefixed with a
relocorreloc2mmacro, utilising the new reloc warnings in NASM 2.16.02 to error out otherwise - Reference in header the help for all ELDs with a help
Specific ELDs
List ELD
This ELD can operate on any accessible ELD files. The files to operate on are specified by a pathname pattern. The last component of the pattern may include wildcards.
For DOS SFN search and bootloaded mode directory search, the asterisk is taken to fill the remainder of the field it occurs in. For example, "L*IST.ELD" will ignore the "IST" suffix in the name pattern and match just like "L???????.ELD". DOS LFN search may behave differently, but I do not consider this a defect in the debugger.
There are three blocks of information that the list ELD can display:
- ELD filename and description line (if any)
- ELD format magic, ELD instance name, and ELD header initial memory use indicators
- ELD help (if any)
The second block is enabled by a trailing "VERBOSE" keyword. The third block likewise by a "HELP" keyword. The first block is displayed unconditionally.
It was a lot of work to support DOS and bootloaded directory search, including an inject handler to restore global state (DOS SFN search DTA, close DOS LFN search find handle). The boot directory search underwent two major revisions of the code links exported to ELDs.
An optional code relocation is used to access the _PM=1 function intcall_ext_return_es to avoid including this function in _PM=0 builds of the debugger. The ELD checks its own code to insure the code link succeeded if it is needed.
KDISPLAY ELD
This ELD displays the current contents of the N/K command buffers that are used by the L and W commands.
CONFIG ELD
This ELD allows to show or set the config path and scripts path. These are the paths used by the EXT and Y commands to find the config path and scripts path: The config path is used by explicitly using a "::config::" prefix, and the scripts path can be used either with an explicit "::scripts::" prefix or if a single-file look up doesn't find a file for an EXT or Y command.
RN and RM command ELDs
These ELDs now default to use their own internal fnsave buffers rather than using the auxiliary buffer. Using the auxiliary buffer is still possible in the sources but disabled by a build option.
