User Tools

Site Tools


blog:pushbx:2025:0921_late_mid_september_work

Differences

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

Link to this comparison view

blog:pushbx:2025:0921_late_mid_september_work [2025-09-21 10:41:32 +0200 Sep Sun] (current)
ecm created
Line 1: Line 1:
 +====== Late mid September work ======
 +
 +**2025-09-20**
 +
 +===== tractest/sortmap.pl =====
 +
 +[[https://hg.pushbx.org/ecm/tractest/rev/97302bbcd089|Fix hex64bitstosigned function]].
 +
 +
 +===== lDebug =====
 +
 +[[https://hg.pushbx.org/ecm/ldebug/rev/4f02cbb2493b|Fix getfirstumcb in MS-DOS v5 device driver load]] corrupting ds.
 +
 +
 +===== uncaps =====
 +
 +Utility that just passes execution to a different program, but uncapses the entire command line. Needed [[https://github.com/dosemu2/dosemu2/discussions/2587|for using lredir in ldos.ini]] (INSTALLFIRST=, INSTALLMID=, or INSTALLLAST=) as DOS allcapses the entire configuration contents. lredir needs the exact pathname as it exists on the Linux host system.
 +
 +[[https://hg.pushbx.org/ecm/uncaps/rev/c444b6e96cb9|First commit is the actual utility]]. Second [[https://hg.pushbx.org/ecm/uncaps/rev/7adbd168e34e|adds the MS-DOS v4 license]] for completeness.
 +
 +
 +===== patchini =====
 +
 +Add to patldos, the lDOS patch program, two new lCFG items:
 +
 +  * [[https://hg.pushbx.org/ecm/patchini/rev/60bc0ed5ee55|VERBOSE]], controlling display of the intro line (default on), XMS use lines for HMA and UMA allocations (default off), and CDS resizing notes (default off).
 +  * [[https://hg.pushbx.org/ecm/patchini/rev/8a4e7a43ee64|HALTFLAG]]. Setting a halt flag makes the kernel not halt on certain conditions, only writing an error message. By default, tag crash and MCB corruption are clear (they halt) and HMCB corruption during allocation or free is set (it doesn't halt).
 +
 +
 +===== DEVLOAD =====
 +
 +  * [[https://hg.pushbx.org/ecm/devload/rev/cb58aa42c6d1|Set the request header length byte]] to 22 for the init command. Previously this was passed as a zero.
 +
 +This didn't help SRDISK find its drive letter because it expected a length of at least 23. However, MS-DOS appears to pass a length excluding the length byte itself.
 +
 +  * [[https://hg.pushbx.org/ecm/devload/rev/1b5a980c18da|Support flag in the word [RqHdr + 17h]]]. This flag indicates, if set, that the device loader should show an error message.
 +
 +With this, the length of the init request header grew to 24. SRDISK is happy with that because it is larger than 22.
 +
 +  * [[https://hg.pushbx.org/ecm/devload/rev/dceb174bc118|Fix double plural in message]] that shows how many drives were installed.
 +  * [[https://hg.pushbx.org/ecm/devload/rev/befee0abbee1|Delete an unused label]].
 +  * [[https://hg.pushbx.org/ecm/devload/rev/2547b859ef4e|Fix display of numbers]] higher than 9.
 +  * [[https://hg.pushbx.org/ecm/devload/rev/3058585ab204|Scan for a free CDS entry for every block device unit]] instead of only for the first unit. Fixes overwriting in-use CDS entries after a gap. (This was [[https://hg.pushbx.org/ecm/devload/rev/3058585ab204#l1.155|marked as a "TODO fixme"]] in the source text.)
 +  * [[https://hg.pushbx.org/ecm/devload/rev/7c20e731f09d|Do not allocate a drive]] if the device is a character device.
 +
 +SRDISK may patch its initial device header to indicate it installs as a character device, and also set the number of units in the request header to 1. It doesn't want us to actually install a drive, and lMS-DOS doesn't install one either. So make it check the flag again.
 +
 +
 +===== SRDISK =====
 +
 +  * In combined.nas [[https://hg.pushbx.org/ecm/srdisk/rev/dc38aac92ddf|make the device driver filename to include a string define]], to allow it to be changed from the NASM command line.
 +  * In makcomb.sh [[https://hg.pushbx.org/ecm/srdisk/rev/12bb851f944e|introduce the $name variable]] initialised from $1
 +  * [[https://hg.pushbx.org/ecm/srdisk/rev/388f9c987420|Create srdiskx.exe and srdiske.exe]] with only a single device driver each rather than including srdmulti.sys
 +  * Fix the expectation that [[https://hg.pushbx.org/ecm/srdisk/rev/1d3952af6760|the init request header's length should include the length byte itself]], which it apparently doesn't. (Worked around on DEVLOAD side by supporting the config error message flag after the drive byte in the request header.)
 +  * In makcomb.sh [[https://hg.pushbx.org/ecm/srdisk/rev/bc5c6abe6005|do not build getspace again]], as this is handled by the makefile
 +  * [[https://hg.pushbx.org/ecm/srdisk/rev/b9c63bcc51d3|Fix request header length off-by-one]] in srdummy.sys as well.
 +  * Fix srdummy.nas: [[https://hg.pushbx.org/ecm/srdisk/rev/0608b449118d|Drive Z: as the next drive is valid]].
 +  * In srdummy.nas [[https://hg.pushbx.org/ecm/srdisk/rev/70ff71a28162|move the cmd_init code at the very end of the driver]]. Preparation for the dynamic array use, making space to be used for it.
 +  * [[https://hg.pushbx.org/ecm/srdisk/rev/9d0f2399c2a8|Align req_ptr and pBPB]] on word boundary.
 +  * [[https://hg.pushbx.org/ecm/srdisk/rev/9b9a89946207|Use the fixed strategy and interrupt entries]] for srdummy.sys as well; using srdummy.sys from srdmulti.sys only worked somewhat accidentally. (DEVLOAD pushes the interrupt entry address before running the strategy entry.)
 +  * [[https://hg.pushbx.org/ecm/srdisk/rev/05bf79e98d20|Initialise pBPB dynamically]] instead of hardcoding the entries.
 +  * [[https://hg.pushbx.org/ecm/srdisk/rev/fe32a7a63ef3|Parse a number for srdummy.sys]] which indicates a minimum amount of unts to allocate. This allows to allocate up to 255 units, which will be dynamically allocated to pBPB.
 +  * If srdummy.sys installs 7 or fewer units, [[https://hg.pushbx.org/ecm/srdisk/rev/6324a036cdf4|stash BPB pointers array before the 1Ah/1Dh entrypoints]] in the driver. Saves a little memory.
 +  * [[https://hg.pushbx.org/ecm/srdisk/rev/7bcfc5a1e744|Add readme file for ecm updates]].
 +  * [[https://hg.pushbx.org/ecm/srdisk/rev/ef287c637597|Add /MPX= switch to the main (non-srdummy) device drivers]], to indicate a multiplex number to try first.
 +  * [[https://hg.pushbx.org/ecm/srdisk/rev/a55e05730ac7|Display the selected multiplex number]] once installed.
 +  * Fix, [[https://hg.pushbx.org/ecm/srdisk/rev/948e06bfb981|keep the multiplexer resident for appended drivers]]. Resulted in all kinds of fun crashes if a request was made to the corrupted int 2Dh handler.
 +  * Fix, in diskinit.c [[https://hg.pushbx.org/ecm/srdisk/rev/da470b4c153d|display correct memory and version strings for every appended driver]], rather than repeating the ones of the first driver. This was an oversight [[https://hg.pushbx.org/ecm/srdisk/rev/aad3efe4ba43#l7.111|in the big gcc-ia16 port changeset]], on 2025-02-23, which replaced ''%.4Fs'' format codes in printf with explicit buffers filled using _fmemcpy.
 +
 +
 +===== lDOS kernel =====
 +
 +  * Bugfix, [[https://hg.pushbx.org/ecm/msdos4/rev/6e435bc37597|always reset the ConfigMsgFlag variable after a driver returns]]. Otherwise a successfully installed driver could set this flag and it would persist until a driver that didn't stay resident would return. This bug is present in MS-DOS v5 as well.
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/08d09f20d7c0|Display verbose CDS resizing information]].
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/0afbf2ad91fd|Add VERBOSE lCFG byte]] and related kernel command line name. This corresponds to the patldos change.
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/2c50f0a3b466|Add verbose_mode checks]] for the intro line, XMS use lines, and CDS resize lines.
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/640efa781031|Hide extra verbosity of CDS extension]] (would display two CDS resize lines rather than one).
 +  * Bugfix, [[https://hg.pushbx.org/ecm/msdos4/rev/fb6704721808|count last used CDS correctly]]. Would count only used entries rather than including gaps of unused entries for the highest used index.
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/9b071e12e222|Fix display of last used drive]]. It used the count of drives in bl rather than the index of the highest used in bh.
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/645ae0c36d4c|Add EARLYLASTDRIVE= configuration directive]], runs in same pass as DEVICE= and INSTALLFIRST=
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/e03880b77e20|Search for unused CDS]] when installing block device units.
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/9bf0dd886445|Drop int3 breakpoint]] in Try_EarlyLastdrive.
 +  * Fix, [[https://hg.pushbx.org/ecm/msdos4/rev/4fd7e0f890b8|allocate a temporary FCB SFT before running INSTALLFIRST=]] (it wasn't happy about the 0000h:0000h initial value when running the process termination).
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/d26d99a45d83|Fix error handling]] as related to too many CDS entries used.
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/e264c224a208|Fix FOOSET (CDS initialisation) if a DPB chain is passed]] but one of the drives visited doesn't appear in the DPB chain.
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/f363d632376e|Support COMPAT=REINITCDS option for block device units]], overwriting CDS entries as before.
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/b65a68e6df04|Avoid error when shrinking final CDS]].
 +  * Different fix [[https://hg.pushbx.org/ecm/msdos4/rev/530e465aa61c|to not overflow the final CDS buffer]] when shrinking the CDS.
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/2c35571903c4|Fix the TAGCRASHDOS branch]] to the halt code.
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/9712627ea366|Add a bell code to the doscode messages]].
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/3c51e6ff494d|Display message and halt for MCB corruption]] (error in NextMCB).
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/21faf384e5da|Same for HMCB corruption]].
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/79540623f2e1|Introduce haltflags, halt for tag crash and MCB corruption]] (but do not halt for HMCB corruption).
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/d9ec63782225|Add HALTFLAG command line option]].
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/de6f1a9d7991|Copy ifsflink.nas from MASM file]].
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/45b84b40af85|Run fixmem.pl on ifsflink.nas]]
 +  * In dosmac.mac [[https://hg.pushbx.org/ecm/msdos4/rev/4c616c0c27f5|accept a second parameter to entry mmacro]].
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/9c24ae24a556|Delete ifsflink.asm file]] and use ifsflink.nas in IFSFUNC makefile.
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/8726ad6b5c08|Update ifsflink.nas with new needed entrypoints]].
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/b132125db5cf|Link ifsfunc with nobits (n) variants of several files]]. This ultimately cures the need for ifsflink.nas as the nobits variants don't include any links.
 +  * Add a text file [[https://hg.pushbx.org/ecm/msdos4/rev/944f45c2b212|listing the links needed by ifsfunc]]. Obtained by trying to link without the kernel files.
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/1d2fb72c950a|Fix to allow values >255 and <=65535 for HALTFLAG kernel command line name]].
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/5c87f4845203|Add mstablen.nas variant file]] to build nobits variant of mstable.nas
 +  * In ifsflink.nas [[https://hg.pushbx.org/ecm/msdos4/rev/39a0351bda59|put a resb 1 as placeholder rather than nop]].
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/d972516c3767|Do not pass /EX (exepack) switch]] for linking ifsfunc.exe, allowing to compare WarpLink and MS Link outputs.
 +  * In nobits.mac [[https://hg.pushbx.org/ecm/msdos4/rev/fbbd54b16a41|include mmacros align, alignb, istruc, at, and iend]], which could have emitted progbits data using ''times foo db 0'' where the db hidden behind times doesn't call our nobits mmacro. This helps shorten both ifsfunc.exe and share.exe
 +  * In our copy of lmacros1.mac [[https://hg.pushbx.org/ecm/msdos4/rev/9b1bd68ade60|observe the DONOBITS define and don't replace istruc, at, and iend]] if it is defined.
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/982c3bac4ffd|Build ifsfuncw.exe using WarpLink]]. Also uses mstablen.obj rather than mstable.obj
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/8113a330bbe8|No longer link in ifsflink.obj for WarpLink build]], it's not needed any longer.
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/582114a3c07a|Comparison of files]]. This is an empty changeset, just listing how the then current builds of MS Link and WarpLink ifsfunc differ.
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/e0ffc57f6840|Rename ErrMap24 to ifs_ErrMap24]], and use it in both places that need it in ifsfunc. Fixes expectation that the same table appear in DOSDATA, which it doesn't any longer as it was moved to DOSCODE.
 +
 +I used some scripting using link.txt and listvars.pl to determine which variables ifsfunc.exe links to. ErrMap24 was the only variable that had been moved to DOSCODEGROUP.
 +
 +<code>tractest$ ./listvars.pl ~/proj/msdos4.hg/hg/src/BIOS/msbio{w.map,.tls} --list-data |
 +  perl -e '
 +    my %hash = ();
 +    while (<>) {
 +      if ($ARGV =~ /\.txt/ and /^(\S+)\s+in\s+/) { $hash{uc($1)} = 1; };
 +      if (not $ARGV =~ /\.txt/ and /Label data \"(\S+)\"/ and defined $hash{uc($1)}) { print }
 +    }
 +  ' ~/proj/msdos4.hg/hg/src/CMD/IFSFUNC/link.txt -</code>
 +
 +I also verified that all the other variables match the actual positions in DOSDATA:
 +
 +<code>perl -e '
 +  my %hash = ();
 +  while (<>) {
 +    if ($ARGV =~ /\.txt/ and /^(\S+)\s+in\s+/) { $hash{uc($1)} = 1; };
 +    if (not $ARGV =~ /\.txt/ and /^[0-9A-Fa-f]{4}:([0-9A-Fa-f]{4}\s+Res\s+(\S+))/ and defined $hash{uc($2)}) { print "$1\n"; }
 +  }' ~/proj/msdos4.hg/hg/src/CMD/IFSFUNC/{link.txt,ifsfuncw.map} > linkadd1.txt
 +perl -e '
 +  my %hash = ();
 +  while (<>) {
 +    if ($ARGV =~ /\.txt/ and /^(\S+)\s+in\s+/) { $hash{uc($1)} = 1; };
 +    if (not $ARGV =~ /\.txt/ and /^[0-9A-Fa-f]{4}:([0-9A-Fa-f]{4}\s+Res\s+(\S+))/ and defined $hash{uc($2)}) { print "$1\n"; }
 +  }' ~/proj/msdos4.hg/hg/src/CMD/IFSFUNC/link.txt ~/proj/msdos4.hg/hg/src/BIOS/msbiow.map > linkadd2.txt
 +sort linkadd1.txt > linkads1.txt
 +sort linkadd2.txt > linkads2.txt
 +diff -u linkads1.txt linkads2.txt</code>
 +
 +The only different lines are ERRMAP24 and ERRMAP24END which, as mentioned, moved to DOSCODEGROUP. This difference is handled by using ifs_ErrMap24 instead.
 +
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/d5d619780dcc|Build ifsfunc.exe using WarpLink]].
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/35b8e09718d9|Add makifstl.sh script to generate ifsfunc.tls trace listing file]].
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/a56bd9a5aa7b|Delete ifsflink.nas file]] no longer used.
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/ab5555c5ffc2|Make calls to round utility for share.exe a no-op]] by passing a rounding boundary of 1.
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/5a89fa564995|Add WLEMITALIGNED section to share.exe]] so WarpLink r4 will emit the alignment after the last progbits section.
 +
 +
 +===== WarpLink =====
 +
 +  * [[https://hg.pushbx.org/ecm/warplink/rev/36ca9fa4c90e|Display date in .map file as ISO 8601 format date]], and time using a 24-hour format.
 +  * In mak.sh script [[https://hg.pushbx.org/ecm/warplink/rev/35abba1af785|include the paths for lmacros]].
 +  * In nasm.mac [[https://hg.pushbx.org/ecm/warplink/rev/2874b43d441f|do also undefine the lmacros1.mac endstruc mmacro]]. (We always include the lmacros files before the local WarpLink macro files, which include nasm.mac, so nasm.mac is included after the lmacros.)
 +  * [[https://hg.pushbx.org/ecm/warplink/rev/c3ab358fb255|Several optimisations]]. It's baffling to me how the prior developers didn't use ''rep stosw'' or ''lds'' or ''les'' in these spots. The MS-DOS v4 codebase also was missing the latter two sometimes.
 +  * [[https://hg.pushbx.org/ecm/warplink/rev/72053c9dcbba|Display header size, initialised image size, and total image size]] in the .map file. This was one of the changes I wanted to make when I set out to modify WarpLink this week. (The sortmap.pl output was unable to tell the initialised image size without parsing the executable.)
 +  * [[https://hg.pushbx.org/ecm/warplink/rev/9526f2ce1e73|Emit alignment for sections named with the prefix WLEMITALIGN]]. This was the other change I wanted to make.
 +
 +The need for this feature [[https://stackoverflow.com/questions/79255053/getting-nasm-f-obj-and-warplink-to-emit-alignment-for-an-empty-last-section|was listed in a stackoverflow question about NASM + WarpLink usage]] that I wrote back in 2024 December. It didn't actually turn out relevant for the lDOS kernel, but did eventually crop up again for share.exe and ifsfunc.exe
 +
 +I'm surprised that my patch for this, after carefully combining disparate parts and then minimal editing to get it to assemble, actually worked on the first attempt. The WarpLink data structures aren't documented well, and use of hardcoded structure offsets is widespread in the code base. I also used the write_bytes with a write length of zero to avoid pulling out all the write code from it, which seems to have simply worked as expected.
 +
 +(The map file total image size disagrees by 1 paragraph with what ecm LZEXE infoexe says. Probably a rounding problem.)
 +
 +  * [[https://hg.pushbx.org/ecm/warplink/rev/c8df94697624|Increment ecm release]] to r4 (2025 September).
 +  * [[https://hg.pushbx.org/ecm/warplink/rev/77ad8bf5157c|Several more optimisations]].
 +
 +Some things are still missing, such as checking for disk full conditions on write calls correctly. In some spots WarpLink doesn't check the returned ax from int 21h function 40h at all, in others it only checks the value is nonzero rather than equal to cx.
 +
 +
 +{{tag>sortmap.pl ldebug uncaps patchini devload srdisk ldos warplink}}
 +
 +
 +~~DISCUSSION~~
  
blog/pushbx/2025/0921_late_mid_september_work.txt ยท Last modified: 2025-09-21 10:41:32 +0200 Sep Sun by ecm