User Tools

Site Tools


blog:pushbx:2026:0119_early_mid_january_work_on_the_mcp
no way to compare when less than two revisions

Differences

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


—blog:pushbx:2026:0119_early_mid_january_work_on_the_mcp [2026-01-19 18:44:35 +0000 Jan Mon] (current) – created ecm
Line 1: Line 1:
 +====== Early mid January work on the MCP ======
 +
 +**2026-01-18**
 +
 +This week I put some work into the Master Control Program (MCP), and a new helper utility called the Codified Likeness Utility (CLU). (Both, of course, named for programs in the Tron franchise.) The MCP is stored in a file named ldosmcp.com or ldosmcpz.com which contains the lDOS kernel, a triple-mode lDebug build, the lDOS pre-boot loader, the instsect tool to install boot sector loaders, the patldos tool to patch lDOS kernel files, an Extension for lDebug library with over 60 extensions, and newly a FreeCOM build.
 +
 +CLU is in a file named clu.exe, which can be used as the file pointed to by the COMSPEC variable. It finds ldosmcp.com and replaces its own process with the MCP, with a special handshake so that the MCP will load its FreeCOM build.
 +
 +
 +===== patchini =====
 +
 +  * (Older changeset only uploaded this week.) [[https://hg.pushbx.org/ecm/patchini/rev/889ae6d5336c|Parse an initial number to select which block]] to operate on. This change only adds the parsing.
 +  * [[https://hg.pushbx.org/ecm/patchini/rev/eda1330084f4|Add the progress mode LIST]] to list all current choices of progress modes.
 +  * [[https://hg.pushbx.org/ecm/patchini/rev/0c9e03681132|Skip subsequent parsing of progress mode]] if progress mode LIST already selected.
 +  * [[https://hg.pushbx.org/ecm/patchini/rev/f2188969a397|Support the lCFGMULT00 pointer block]]. This is a block that points to other lCFG blocks. It must be placed on a 16-byte boundary within the first 8 KiB of the file. It can point to lCFG blocks much farther into the file however. If multiple blocks are found and no block specifier was given, a hint is shown. If a nonzero block specifier was given, a different hint is shown which identifies the block that is in use. (This is used only for the Master Control Program.)
 +  * When selecting first entry from an lCFGMULT00 block as default, [[https://hg.pushbx.org/ecm/patchini/rev/a581c851e391|also select its size]].
 +  * [[https://hg.pushbx.org/ecm/patchini/rev/876d21e0847d|Store the lCFG00 signature into the big table]], to prepare for different signatures.
 +  * [[https://hg.pushbx.org/ecm/patchini/rev/4d0c29bcd89f|Support MCPCFG00 blocks]], with the configurations TIMEOUT and MENUDEFAULT.
 +  * [[https://hg.pushbx.org/ecm/patchini/rev/10a2d97a88ad|Fix so a linebreak separator is only shown after any prior output]].
 +  * If LIST is given without a filename, [[https://hg.pushbx.org/ecm/patchini/rev/85c1d4308c45|don't show message]] "lCFG block does not contain any known configuration".
 +  * [[https://hg.pushbx.org/ecm/patchini/rev/72f4fc279f09|Allow to specify ALL instead of a number]] for the block selection.
 +  * [[https://hg.pushbx.org/ecm/patchini/rev/dd626f4c1eed|Allow to continue if a block isn't found]] or doesn't contain this configuration, if ALL blocks selected.
 +  * [[https://hg.pushbx.org/ecm/patchini/rev/c09940cadabe|Error out at end if ALL blocks selected]] and not a single block is found.
 +  * Insert quote marks so [[https://hg.pushbx.org/ecm/patchini/rev/1ca4ae17997d|the source file isn't accidentally matched]] as an MCPCFG00 block. (This actually happened.)
 +  * [[https://hg.pushbx.org/ecm/patchini/rev/382256bf086d|Fix warning]] about a "left shift count >= width of type" on gcc-ia16, by inserting type casts into the getu32 and getu16 functions.
 +  * patchqry.c: [[https://hg.pushbx.org/ecm/patchini/rev/1c1cd411135d|Use comparecaps function]] instead of the workaround.
 +  * patchqry.c: [[https://hg.pushbx.org/ecm/patchini/rev/4242147d8a01|Extract the function parsenumber]], to parse number as decimal, hexadecimal, or binary, with optional plus or minus sign prefix.
 +  * In the parsenumber function [[https://hg.pushbx.org/ecm/patchini/rev/ed384ddffa70|pass the second parameter as "replaceforbidden" instead]], allowing the caller to evaluate the exact condition.
 +  * patldos.c: [[https://hg.pushbx.org/ecm/patchini/rev/80662027e831|Extract function parsenumber]], pick from patchqry.c
 +  * patldos.c: [[https://hg.pushbx.org/ecm/patchini/rev/db49c9233a2f|Include patchqry.c code as a subfunction accessed by specifying the QUERY keyword]]. This is another instance of the "go everywhere, do everything" mantra: Why use two separate programs when you can put them together into one?
 +  * [[https://hg.pushbx.org/ecm/patchini/rev/7abe6d218b5e|Adjust command help for the combined patldos + patchqry program]].
 +  * [[https://hg.pushbx.org/ecm/patchini/rev/2ba0131e2063|Call patchqrymain if listing]] the individual help pages.
 +  * patchqry.c: [[https://hg.pushbx.org/ecm/patchini/rev/900489082cd7|Adjust command line help usage lines]] so they're more similar to the rest of patldos
 +  * Also [[https://hg.pushbx.org/ecm/patchini/rev/806898e89f1b|invoke patchqrymain if LIST and a filename is specified]], to list the current query patch site.
 +
 +
 +===== tractest/convlist.pl =====
 +
 +[[https://hg.pushbx.org/ecm/tractest/rev/d1067fb4a0b8|Properly process FreeCOM map and listing files]], for the FreeCOM gcc-ia16 build. In particular, this includes:
 +
 +  * The gccsections indicator line may have something trailing after the second number.
 +  * Filenames may be given as library files, where the actual file is specified in round parentheses.
 +  * To find the relevant listing file, take the filename in parens.
 +
 +As usual, the gcc-ia16 listing files generated by the FreeCOM build are not especially good, but they do save some work particularly in dumping the call destinations in plain text.
 +
 +
 +===== lDebug =====
 +
 +  * [[https://hg.pushbx.org/ecm/ldebug/rev/7b0c6ac6a972|Disable _IMAGE_EXE for the loader build]]. This need wasn't anticipated for the debugger, so the solution is a little hackish.
 +  * Fix: If kernel command line is supported but none specified, [[https://hg.pushbx.org/ecm/ldebug/rev/6dff20dd8bae|do not use a stale byte load_cmdline_first]]. This would lead to a spurious letter in the kernel command line.
 +  * Fix: [[https://hg.pushbx.org/ecm/ldebug/rev/a7a49b02428f|Enable GOTO command for loader build]]. (Was disabled because it needs to be checked for in gg, which was replaced for the loader build.)
 +  * [[https://hg.pushbx.org/ecm/ldebug/rev/c8a9cca42433|Document ELDUSE noun]] for ldmem Extension for lDebug.
 +  * [[https://hg.pushbx.org/ecm/ldebug/rev/48e80988a9ac|Update news-r10]] with the loader AMIS signature and boot command line fix. Ordinarily a loader feature wouldn't be listed in the news, but the different signature does also affect the debugger build as [[https://hg.pushbx.org/ecm/ldebug/rev/26b16c84307e|it searches for the different signature in some places]].
 +  * In the loader manual [[https://hg.pushbx.org/ecm/ldebug/rev/faddc2dcbf0b|list GOTO and IF commands]] as being the same as for the debugger.
 +  * [[https://hg.pushbx.org/ecm/ldebug/rev/a50217638923|Update some attribution years]] to 2026.
 +  * [[https://hg.pushbx.org/ecm/ldebug/rev/29c734ec3d3e|Add S MCB type 16h]] (init FCB SFT), and update attribution year to 2026.
 +
 +
 +===== FreeCOM =====
 +
 +These changes live [[https://github.com/ecm-pushbx/freecom/commits/ecm-mcp/|in the branch ecm-mcp]] ([[https://github.com/FDOS/freecom/issues/184|described in an issue]]), and are primarily intended for use in the Master Control Program.
 +
 +  * .gitignore: [[https://github.com/ecm-pushbx/freecom/commit/0bf706b39819de834ac81f5662cad887e479432d|Add .rel, .tls, .swp, and mak.sh files]].
 +  * [[https://github.com/ecm-pushbx/freecom/commit/f64c55909a5537c64091bf16e403140f6323117a|Use FREECOM_SKIP markers in the executable]] to find resources. This allows FreeCOM to find its resources within the ldosmcp.com file.
 +  * [[https://github.com/ecm-pushbx/freecom/commit/ac7b2bd8e6340b3312c85f1f6824be40b3c3814d|Create listing and relocation files for C object files]]. These are for use by convlist.pl to create a trace listing (.tls) file. The objdump invocation comes with a new ''|| true'' suffix to avoid aborting the makefile on an unknown relocation type in some file. Other than that the change is copied from [[https://github.com/FDOS/kernel/discussions/225|an earlier change to the FreeDOS kernel's SYS build]].
 +  * [[https://github.com/ecm-pushbx/freecom/commit/3fb35fad5b93999941a31ee18895282920b330ab|Use the variable FREECOMFILE to find the file from which to load resources]]. COMSPEC is no longer preferred for this. If COMSPEC is set already, it is not changed. This helps CLU so that it can set COMSPEC to point to itself (clu.exe), but have FreeCOM set FREECOMFILE to point to ldosmcp.com
 +
 +
 +===== lDOS kernel =====
 +
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/bedf3a19bc6c|Update manual descriptions]] of patldos.
 +  * In manual section config-cmdline [[https://hg.pushbx.org/ecm/msdos4/rev/213cd717c47a|list VERBOSE and HALTFLAG commands]].
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/b9348fb662dc|Update manual attribution year]].
 +  * In the comloader for its MCP build:
 +    * [[https://hg.pushbx.org/ecm/msdos4/rev/fd82098c5816|Include FreeCOM executable]]. This includes a FreeCOM skip marker that points from the end of the comloader to the end of the FreeCOM executable image.
 +    * [[https://hg.pushbx.org/ecm/msdos4/rev/26b7530c5deb|Support the CLU flag]] to fast track loading FreeCOM.
 +    * [[https://hg.pushbx.org/ecm/msdos4/rev/7413d41a41ae|Support CLU flag indication that CLU was loaded in the UMA]], relocating our process (including the relocated FreeCOM program but excluding the full comloader) into the UMA if it fits.
 +    * [[https://hg.pushbx.org/ecm/msdos4/rev/6ae97ba88469|Fix to assemble movp also if _MCP build is selected]], rather than only if _MZEXESUPPORT is enabled. In practice, both are enabled for the MCP build.
 +
 +
 +===== Master Control Program =====
 +
 +  * [[https://hg.pushbx.org/ecm/mcp/rev/20be68c28150|Include an lCFGMULT00 pointer block]] to point to other configuration blocks. Currently points to lDOS kernel, lDebug, and loader.
 +  * [[https://hg.pushbx.org/ecm/mcp/rev/147feabba953|Adjust entrypoint of the loader payload]]. This was 0:32 previously because [[https://hg.pushbx.org/ecm/ldebug/rev/7b0c6ac6a972|the loader was build with _IMAGE_EXE enabled]]. With this option disabled, the kernel entrypoint is at 0:0.
 +  * [[https://hg.pushbx.org/ecm/mcp/rev/ad1557db5440|Add a description and attribution]] to the iniloadi.asm header comment.
 +  * [[https://hg.pushbx.org/ecm/mcp/rev/b7ebd8df73e0|Add a boot menu default choice with a timeout]]. This also adds the MCPCFG00 header to configure both the timeout and the menu default choice. The MCPCFG00 block is also pointed to by the lCFGMULT00 header.
 +  * [[https://hg.pushbx.org/ecm/mcp/rev/33438e61f7dc|Extract the function getdefault1]] to get the menu default choice.
 +  * [[https://hg.pushbx.org/ecm/mcp/rev/c372e5f92b1c|Allow a kernel command line starting with CHOOSE DEFAULT]]. This acts like CHOOSE MENU if no default is configured, and selects the default without showing the menu otherwise.
 +  * [[https://hg.pushbx.org/ecm/mcp/rev/8842106ffd8b|Copy over the FreeCOM executable]] for building the MCP.
 +  * [[https://hg.pushbx.org/ecm/mcp/rev/7af29cb806b4|Add FreeCOM skip marker]] to point from the initial loader to the end of the comloader.
 +  * [[https://hg.pushbx.org/ecm/mcp/rev/68f4793a1129|Check that the FreeCOM skip marker fits]] within the first 8 KiB of the file.
 +  * CLU launcher:
 +    * [[https://hg.pushbx.org/ecm/mcp/rev/341542dde085|Initial commit]]. Implements loading the MCP (using int 21h function 4B01h) and terminating CLU's own process so that the MCP effectively replaces CLU. Runs an ldosmcp.com file that must be found in the current working directory.
 +    * [[https://hg.pushbx.org/ecm/mcp/rev/2b5b2e127078|Check for and set the CLU flag]] in MCP.
 +    * [[https://hg.pushbx.org/ecm/mcp/rev/0d08ae5c0665|Copy CLU's MCB name]] to the MCP process's MCB.
 +    * [[https://hg.pushbx.org/ecm/mcp/rev/5c0beaa8e9b8|Build clu.exe]] in the mak.sh script.
 +    * [[https://hg.pushbx.org/ecm/mcp/rev/72aa2a91e762|Search for the MCP executable]] in CLU's directory, then in the root directory of the boot drive, and then in the current working directory.
 +    * [[https://hg.pushbx.org/ecm/mcp/rev/44bcb87f6be6|Detect whether CLU is (initially) loaded into the UMA]], and indicate it in the CLU flag. This revision failed to actually detect the first UMCB, so it would use the fallback of the hardcoded value A000h as the UMA cutoff segment instead.
 +    * [[https://hg.pushbx.org/ecm/mcp/rev/a95213b478ef|Relocate the CLU process to the top of the Low Memory Area]] before loading the MCP. This reduces fragmentation if no UMA is available.
 +    * [[https://hg.pushbx.org/ecm/mcp/rev/8c3e4029ded5|Fix to actually call the UMA detection function]].
 +    * If not yet found, [[https://hg.pushbx.org/ecm/mcp/rev/42103c5a8f02|set COMSPEC variable to point to clu.exe itself]]. There's a branch of the code commented out that would delete an existing COMSPEC variable if found. I think it's nicer to allow the user to override what COMSPEC to use.
 +
 +**ETA**:
 +
 +[[https://hg.pushbx.org/ecm/mcp/rev/2147feb61036|Extract function findvar]] to find an environment variable.
 +
 +[[https://hg.pushbx.org/ecm/mcp/rev/daf27dc1f5bb|Parse a variable]], ''%CLUMCPFLAG%'', to select one of as yet 4 different flags:
 +
 +  * 1 = Override current ''%COMSPEC%'' if it is already set.
 +  * 2 = Do not relocate CLU process before running exec. (The handover from CLU to the MCP still involves a type of process relocation, so to say. Disabling this isn't supported yet, though could be done by leaving a small shim CLU process resident.)
 +  * 4 = Never set the "UMA flag" in the MCP's CLU flag.
 +  * 8 = Always set the "UMA flag" in the MCP's CLU flag. If both 4 and 8 are set, 4 takes precedence.
 +
 +{{tag>patchini tractest convlist.pl ldebug freecom ldos msdos4 mcp clu tron}}
 +
 +
 +~~DISCUSSION~~
  
blog/pushbx/2026/0119_early_mid_january_work_on_the_mcp.txt · Last modified: by ecm