User Tools

Site Tools


blog:pushbx:2023:0507_early_may_work_on_inicomp_ldosboot_ldebug_einsicht

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

blog:pushbx:2023:0507_early_may_work_on_inicomp_ldosboot_ldebug_einsicht [2023-05-07 16:59:50 +0200 May Sun] (current)
ecm created
Line 1: Line 1:
 +====== Early May work on inicomp, ldosboot, lDebug, Einsicht ======
 +
 +**2023-05-07**
 +
 +The last day of April and first week of May several developments happened.
 +
 +===== inicomp changes to use without iniload or MZ shim wrapper stage =====
 +
 +[[https://hg.pushbx.org/ecm/inicomp/rev/aa0974fdd6e2|The primary change in inicomp]] is the option ''_IMAGE_EXE_GET_COM_STACK'' which allows to set up a separate stack segment at the end of the process memory block. This is required for the intended functioning of the application (exe mode) entrypoint when the inicomp stage is directly loaded as a flat .COM style executable.
 +
 +With a slight modification of their device mode entrypoints this allows to compress the dual-mode Logger executable using inicomp. However, the compression ratio of the full file (compressed payload plus depacker) is worse than UPX manages. The LZMA-lzip file is actually larger than the LZSA2 file, as the LZMA depacker is larger.
 +
 +There is a problem: If the stack allocated to the application mode entrypoint is too small, the initial relocation could overlap and fail. This is unlikely, but could happen.
 +
 +There is [[https://hg.pushbx.org/ecm/inicomp/rev/41860de1db0e|another change to inicomp]], which is to drop a little code that is specific to boot loaded mode. This doesn't buy much space however.
 +
 +
 +===== ldosboot changes =====
 +
 +The only change of the sources [[https://hg.pushbx.org/ecm/ldosboot/rev/6d4e8b0db5fe|is an optimisation in fdkernpl]] to re-use part of the subsequent iteration code for the first iteration of the image relocation. This was tested using both a small (< 64 KiB) and a large image.
 +
 +[[https://hg.pushbx.org/ecm/ldosboot/rev/9c4923acc2be|The other change is an update to the documentation]] to describe [[https://pushbx.org/ecm/doc/ldosboot.htm#protocol-exemode|application mode]] and [[https://pushbx.org/ecm/doc/ldosboot.htm#protocol-devicemode|device mode]] entries. These have been used for the debugger for a long time now but weren't documented anywhere yet. This is still missing the fact that inicomp expects an auto stack for application mode, and that the subsequent stages can either pass along the auto stack (auto stack enabled) or set up their own output stack (auto stack disabled).
 +
 +
 +===== lDebug changes =====
 +
 +The first change happened last Sunday for the most part: The ''_EXPRDUALCODE'' option allows to move most code from expr.asm into the second code segment. Several scriptlets were used to automate parts of these changes. (One of these failed to process labels that ended in a question mark, at first.) Most of them are documented in the changeset messages. About 5 kB of code can be moved this way.
 +
 +As a part of this change, the ''section_of_function'' macro [[https://hg.pushbx.org/ecm/ldebug/rev/578c702ee98c|gained an optional parameter]]. This is intended to specify the base name if the label before the macro call is a local label.
 +
 +Several uses of dispatch tables or indirect calls into expr.asm code in a few other files [[https://hg.pushbx.org/ecm/ldebug/rev/3acda01b7871|were adjusted]].
 +
 +The bits of lDEBUG_CODE contents in init.asm [[https://hg.pushbx.org/ecm/ldebug/rev/a9c3bee23b10|were moved into debug.asm]] because boot.asm needs to come after all non-boot lDEBUG_CODE bits, but init.asm now needs to come after boot.asm as init.asm defines the relocation patch tables, some of which now need to include ''nearcall'' uses in boot.asm. (The init.asm definition of the tables had the foresight of using ''%unmacro'' on the call macros, so that such an error is caught at build time instead of silently ignoring the latter relocations.)
 +
 +A test from test.py [[https://hg.pushbx.org/ecm/ldebug/rev/c0c4d159b023|was fixed to work]] with the ''getinput'' optimisations. This is the first test breakage in a while, though we haven't added any tests in a while either.
 +
 +Two build options were added [[https://github.com/Baron-von-Riedesel/DOS-debug/issues/14|to address feature requests for FreeDOS Debug/X]] from the FreeDOS sourceforge bug tracker. One of those [[https://hg.pushbx.org/ecm/ldebug/rev/88377841b0b6|adds a linebreak before every R command dump]]. [[https://hg.pushbx.org/ecm/ldebug/rev/73873421b18d|The other changes the style of the symbolic flags display]] from the Debug-style state abbreviations to just "x1" or "x0", respectively "x_", where the "x" is a letter indicating which flag is meant. The latter build option is disabled by default. Both build options lead to run time options being added, which still have to be enabled at run time.
 +
 +[[https://hg.pushbx.org/ecm/ldebug/rev/f7f0129a3579|A recent change]] is to add the ''RC.ABORT'' command. This is useful in one particular case: The command-line buffer includes a Y command to run a script file, eg ''/cycfg.sld''. Then the script file wants to re-define the contents of the RC buffer -- but it cannot, because the RC buffer is still executing. The new command can be used to abort execution of the RC buffer, discarding all yet unused commands from it (if any). Then the Script for lDebug file can use ''RC.REPLACE'' to change the RC buffer contents. This use case came up during debugging of the Einsicht additions. An equivalent for the RE buffer doesn't make any sense, because the RE buffer is the highest priority input source, so if you were to abort it you wouldn't be able to chain any otherwise impossible ''RE.REPLACE'' commands. (The way to abort the RE buffer processing from within the RE buffer itself is simply ''goto :EOF''.) (Arguably there could be an RC./RE. command to both abort and replace the corresponding buffer contents.)
 +
 +The final changes are about fixing and supporting the exception areas. The fix was found during checking that the areas were initialised properly. Turned out the truncated lDEBUG_CODE section's length [[https://hg.pushbx.org/ecm/ldebug/rev/96e4044a5d73|was written in paragraphs]], when it should be written as a linear address value (in bytes).
 +
 +Another change was [[https://hg.pushbx.org/ecm/ldebug/rev/dbb33d81b02f|to fix the HH indirection access area]] to point to lDEBUG_CODE2 if the ''_EXPRDUALCODE'' option is in effect. This required adding another areas sub structure.
 +
 +However, this was not satisfying because the areas function definitions don't know how to handle cross-section relocated ''nearcall'' calls to their functions. So to "fix" the area for HH indirection, the call to ''readmem'' now indirects through a ''dualcall'' to a small relocator. (This indirection is not unlike what ''_DUALCODENEARDUAL'' does for all ''nearcall'' calls when ''_PM=0''.) [[https://hg.pushbx.org/ecm/ldebug/file/518792e417f3/source/expr.asm#l4690|The relocator gets its own area]] in the lDEBUG_CODE (first code section) areas.
 +
 +
 +
 +===== Einsicht (and Insight) changes =====
 +
 +The Einsicht changes are mostly about getting the data dump to work with the remote lDebug. The original Insight data dump will leave the dump empty. If connected, an lDebug command is sent to dump the affected area. It uses a ''LINES'' length to the D command in order to allow Insight-style dumps that wrap around from 0FFFFh to 0000h. Modification of the data, either as digits or as text, is also implemented, though this is considered naive.
 +
 +A lot of commands are sent to lDebug the way this is implemented for now. Two killer features are still missing: A new lDebug command prefix to avoid a command being entered into the lDebug command history, and Einsicht changes to suppress the prompt and output of commands sent by Einsicht. If these were added, the terminal window view of lDebug would be a lot more usable in Einsicht.
 +
 +Einsicht will also [[https://hg.pushbx.org/ecm/insight/rev/cd84bde47e3c|detect the "KEEP" prompt]] from lDebug now and reply to it automatically. A similar detection is done [[https://hg.pushbx.org/ecm/insight/rev/1f3d22e70710#l4.54|to determine when lDebug is waiting]] at a normal command prompt, rather than an assembly prompt, interactive E prompt, paging prompt, or busy writing output. The function ''einsicht_send_command'' will wait a bit for lDebug to prompt; if it doesn't then the command is not sent (and one time per Einsicht key input a beep is emited).
 +
 +[[https://hg.pushbx.org/ecm/insight/rev/9a301d3841d5|A small fix]] is to reset the ''rpos'' variable in the ''init_terminal_size'' function. This means if the first byte written to the terminal is not a blank nor linebreak, then it won't be wrongly displayed at the last prompt position when exiting the terminal window.
 +
 +[[https://hg.pushbx.org/ecm/insight/rev/61148e61fd17|The only change that also applies to Insight]] is that menues can be closed using Alt+X now.
 +
 +{{tag>inicomp ldosboot ldebug einsicht}}
 +
 +
 +~~DISCUSSION~~
  
blog/pushbx/2023/0507_early_may_work_on_inicomp_ldosboot_ldebug_einsicht.txt ยท Last modified: 2023-05-07 16:59:50 +0200 May Sun by ecm