User Tools

Site Tools


blog:pushbx:2025:1012_early_october_updates

Differences

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

Link to this comparison view

blog:pushbx:2025:1012_early_october_updates [2025-10-12 19:39:38 +0200 Oct Sun] (current)
ecm created
Line 1: Line 1:
 +====== Early October updates ======
 +
 +**2025-10-12**
 +
 +
 +===== MSDebug =====
 +
 +  * [[https://hg.pushbx.org/ecm/msdebug/rev/451e31eb4e1e|Support FAT32 sector read and write with 21.7305]] (needed on MS-DOS v7 and FreeDOS for FAT32 FS, apparently not needed on Enhanced DR-DOS).
 +  * [[https://hg.pushbx.org/ecm/msdebug/rev/5a4c7ae7935e|Lock and unlock volume for sector writes]] using int 26 or 21.7305 (needed on MS-DOS v7, no-op otherwise).
 +  * [[https://hg.pushbx.org/ecm/msdebug/rev/338a7a221ea5|Increment ecm release]] to r4.
 +  * [[https://hg.pushbx.org/ecm/msdebug/rev/9537c8265ce4|Update manual with sector access updates]], and drop it from missing features list.
 +
 +
 +===== lDOS kernel =====
 +
 +For int 21h function 5Ah [[https://hg.pushbx.org/ecm/msdos4/rev/f58f94fe5198|use the MS-DOS v5 compatible mapping of numbers to letters]]. This uses the letters A to P instead of hexadecimal digits 0 to 9 and A to F.
 +
 +
 +===== bootimg/partdisk =====
 +
 +  * [[https://hg.pushbx.org/ecm/bootimg/rev/64c55ae40a20|Display info on non-empty sections]].
 +  * [[https://hg.pushbx.org/ecm/bootimg/rev/704de9fb8694|Display section info with size in bytes]] (with SI prefixes).
 +  * [[https://hg.pushbx.org/ecm/bootimg/rev/48eba5d797f8|Shorten the section info messages]].
 +  * [[https://hg.pushbx.org/ecm/bootimg/rev/340b7e5286d4|Add _VERBOSE option]] to allow disabling section info messages.
 +  * bootimg: [[https://hg.pushbx.org/ecm/bootimg/rev/a276f68edaf4|Add options _EXTENDROOTDIRECTORY and _EXTENDDIRECTORIES]] to allow disabling the forced all-zeroes entries at the end of directories.
 +
 +
 +===== ACEGALS =====
 +
 +  * Add section [[https://hg.pushbx.org/ecm/acegals/rev/a4404c5bcbab|on using xchg where mov would do]] (to optimise code size).
 +  * Add section [[https://hg.pushbx.org/ecm/acegals/rev/8dd1bf0e7240|on reserving or discarding stack space]], listing options such as add, sub, lea, inc, dec, and push or pop.
 +
 +
 +===== lDOS boot (experimental) =====
 +
 +The recent changes to the lDOS boot loaders was kicked off by [[https://github.com/SvarDOS/bugz/issues/174|a SvarDOS report on loading their kernel]] off a 360 KiB diskette. Reportedly, using the FreeDOS-based boot sector loader took more than 28s to load the kernel. In the report, an alternative loader was presented which doesn't use the file system but rather loads the kernel from the file system reserved sectors, reducing the time spent to 6s. The speedup is primarily from reading using multi-sector calls, allowing to read up to a full track (S coordinate 1 to amount of CHS-sectors) using a single call to int 13h.
 +
 +I suggested that the lDOS initial loader could be modified to use an optional multi-sector loader, along with an lDOS boot sector loader modified to load only the first 4 KiB of the initial loader stage. As it took shape, testing indicated a speed up to 8s - not quite as fast as the reserved sectors load but a good competitor. And it is no less generic than the lDOS iniload basis, allowing to boot as an lDOS / RxDOS.3 kernel, a FreeDOS or Enhanced DR-DOS kernel, an MS-DOS v7 kernel, an IBM-DOS or MS-DOS v6 kernel, or a Multiboot v1 or Multiboot v2 kernel.
 +
 +Eventually I adapted the multi-sector loader so it can be used for any load protocol, if the sector size check indicates at least 512 bytes per sector. This is accomplished by putting a relatively small check into the single-sector load loop after it has loaded at least 2 sectors, fitting into the 64 bytes space that 2 sectors take up with the theoretical minimum sector size of 32 bytes. If the sector size is detected as 512 bytes or more, then this code knows that at least 1536 + 512 + 512 bytes have been loaded, so the multi-sector loaders (both CHS and LBA) are resident at this point.
 +
 +Some unrelated optimisations were applied, most of them related to freeing enough space for the new features. Further, a bug of expecting ah to be unchanged after an int 10h function 0Eh call [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/c0212a6a6f6a|was fixed in the boot sector loaders]]. The FAT12 loader also got an option to load FAT sectors on demand rather than loading the entire FAT, but this is ill-advised at least for 360 KiB diskettes or smaller (as these only have 1 or 2 sectors per FAT to begin with).
 +
 +Individual changes:
 +
 +  * Spaghettify initial loader [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/f0997a9a8a90|to make space for next change]].
 +  * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/31cf94e97e37|Prepare patch sites]] for multi-sector CHS loader.
 +  * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/6318b00626d3|Implement multi-sector read for FAT12 load]].
 +  * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/edfc533390c1|Implement multi-sector read for file data]].
 +  * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/534ffe4f023b|Bugfix to preserve the amount sectors]] to read on retry.
 +  * boot.asm: [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/7b640db22d36|Introduce _FREE_PARA_LIMIT to load less]] from the iniload file than there's space below 7A00h. (Without this option, up to 5A00h bytes are loaded to 2000h, corresponding to 45 sectors at 512 Bytes per sector.)
 +  * boot.asm: [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/b24b63732239|Introduce _LOADFULLFAT12 to allow loading FAT12 FAT sectors on demand]] (as mentioned this is unlikely to be of use, and it needs more code space).
 +  * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/b0e87eb03e97|Add single-sector fallback]] if multi-sector loader encounters a failure after repeated attempts. This sets a flag so all subsequent reads are done one sector at a time. It doesn't restore the context of the traditional loader however, opting to observe the new flag within the loop of the multi-sector loader.
 +  * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/4deb24cf70b7|Spaghettify for more space]] before ms7_entry.
 +  * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/3a3f770e8fda|Drop most of the .eoc code]] in the multi-sector loader loop. The file is always either too short or terminates in a bad cluster if this part is reached, so no attempt to read the remaining fragment is needed.
 +  * [[https://github.com/SvarDOS/bugz/issues/174#issuecomment-3365887427|As reported necessary]], the CHS multi-sector loader now [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/49ab4ca0e7d2|will set up a relocated DPT at 00522h]] and force the amount sectors byte in it to 36.
 +  * Optimisation [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/b7bd16bfb5e6|to set ch in the relocation loop]], as cl is already zero.
 +  * Optimisation [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/0431c6a8ab54|to return CY from check_clust if valid]], saving a few bytes. All callers adjusted to toggle the sense of the returned CF.
 +  * Optimisation [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/8b15a41913d2|to use the more compact FAT12 12-bit entry extraction]] (skip or run shl, then unconditionally run shr).
 +  * Optimisation [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/ca7cf5eb16ce|to compare lsvLoadSeg from the stack variable]] rather than load it into a register first.
 +  * Optimisation [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/e7ed19d7b7a6|to pop the old lsvFATSeg earlier and into the cx register]] instead. This allows to save two bytes immediately and simplifies the code flow protocol.
 +  * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/dee85d7aee6b|Do not load the FAT12 if entire kernel is already loaded]]. Also, pass lsvFATSeg as zero in that case. This optimises loading with FreeDOS or EDR-DOS load, or with lDOS load if the prior loader already loaded enough of the file (eg [[https://github.com/dosemu2/dosemu2/blob/4fb62292e7852a8a205a21e0e7aa370d10bd216b/src/base/misc/fatfs.c#L1859|from dosemu2]] or lDebug).
 +  * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/583eb76bed8a|Display the size of the initial loader stage]] before the payload.
 +  * Bugfix, [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/9e4f6baf75c3|clust_next clobbers bx if not loading from FAT12]]. At this point this only affected CHS load with the multi-sector loader from FAT16 or FAT32 file systems. Good thing this was caught in the experimental build.
 +  * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/b0760ac4d576|Add an LBA multi-sector loader]] before end3. The end3 label is a new invention, it is expected to live no later than at the 4 KiB offset of the file. Unlike end and end2, end3 isn't padded to fill the 4 KiB reserved space however.
 +  * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/dba6ddcfbfa3|Generate a clearer error]] if _CHS=0 and _LBA=0 at the same time.
 +  * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/0a6a34618280|Allow building with the LBA multi-sector loader]] if _CHS=0.
 +  * Fix, [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/141d363fbcf9|clear ldHasLBA flag 2]] (single sector load) even for LBA multi-loader case.
 +  * Optimise multi_sector_read.lbapatch [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/96b8a43ab41b|to drop the test imm16 instruction]], patching the entire three bytes to create a near jump instruction rather than only the one byte of the opcode.
 +  * Optimisation, [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/00a8a6245c6a|drop cs: overrides in LBA multi patcher]].
 +  * Bugfix, if loaded exactly 2048 bytes (eg from MS-DOS v7 load) [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/4af292e767e9|do not set CHS multi-sector patches if LBA is available]].
 +  * Optimisation, [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/b5736e7d7dc9|chain a jump back to multi_sector_read.]] (with trailing dot) to save a byte.
 +  * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/8b8ae7c858d9|Shuffle the code to calculate how many sectors left from current S coordinate]], and comment on it more.
 +  * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/e89dbc26a60a|Update comments on toggled check_clust return CF]].
 +  * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/855b70a0cbfb|Spaghettify to get more code space]] in first 512 bytes of file.
 +  * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/c65e94246e65|Fix _CHS=0 build again]].
 +  * Optimisation [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/61058232a956|to pop si early after the 64 KiB ISA DMA boundary check]]. Saves 2 bytes.
 +  * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/3dff6d5bd4e5|New option _ADDPROGRESS]] to display progress indicators, with code stashed before end3.
 +  * Optimisation [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/1dd60bd5470c|to use cs lodsb instead of setting ds]], saving 1 byte.
 +  * boot.asm and boot32.asm fix: [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/c0212a6a6f6a|Do not depend on ah return of int 10h function 0Eh]] (was expected to preserve the function number 0Eh). This [[https://github.com/SvarDOS/bugz/issues/174#issuecomment-3368470724|was reported to corrupt both the error letter code and the beep indicator]] on early IBM PC ROM-BIOS revisions.
 +  * Optimisation, [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/90dfe0cb29f8|store ldLoadingSeg in clust_next]]. This was done in two spots right before calling clust_next, with a change to only set it after the cluster loop (and reload it before the cluster loop rather than for every sector).
 +  * Optimisation, [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/296e7ed1c2cf|in ms7 entry use ds to address the IVT]] for restoring the DPT.
 +  * Optimisation, [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/2456e41d269c|share the restore_dpt retn with multi_sector_read]].
 +  * Optimisation [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/9367140ee54a|to load ldLoadingSeg in clust_to_first_sector]]. Rather than documenting bx as an undirected CHG, it now loads it from the variable, eliminating the load at two spots right after calling this function.
 +  * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/dfb0ed88c31c|Late initialisation of the multi-sector loader]] if initially there wasn't enough code loaded to init it. This happens after loading the FAT12 (if any) and at least 2 sector loads from the file, so it isn't preferred but can still speed up the remaining load.
 +  * Harden, [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/93e167a00c8e|allow init_memory_multi to not install]] by having the late init patch in a jump to skipped_all.multipatch rather than to skipped_all_multi. This means if the multi-sector loader is installed it is entered all the same but if not then the single-sector loader can continue to run to completion.
 +  * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/bc38292b5665|Fix the _ADDPROGRESS=1 _CHS=0 build]].
 +  * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/f9881536d945|Update attribution years]]. This was just 2024 to 2025 for iniload and boot32, but for boot it used to read only "2012".
 +
 +
 +===== tractest/convlist.pl =====
 +
 +  * [[https://hg.pushbx.org/ecm/tractest/rev/5ce7b6e9d133|Change from die to print]] for unknown section or differing group for the same section. (The group can only differ for WarpLink if the class also differs, a different group for the same section+class name is rejected by the linker.)
 +  * [[https://hg.pushbx.org/ecm/tractest/rev/1743dd5bee74|Allow .obj filename extension]] in a gas .rel (relocations) file. Used by FreeDOS SYS build. (I [[https://github.com/FDOS/kernel/discussions/225|submitted a patch to create a sys.tls trace listing file]] to the FreeDOS kernel repo discussions.)
 +
 +
 +===== lDebug =====
 +
 +  * s.asm: [[https://hg.pushbx.org/ecm/ldebug/rev/4ec153da57e1|Enable eldstrict mode]], mark all relocations.
 +  * sbranch.asm: New Extension for lDebug, [[https://hg.pushbx.org/ecm/ldebug/rev/6d9367cf5e58|an ELD which searches for direct short or near branches]] to a certain target address.
 +  * sbranch.asm: [[https://hg.pushbx.org/ecm/ldebug/rev/2c03837fa895|Also match jcxz and loop instructions]].
 +  * [[https://hg.pushbx.org/ecm/ldebug/rev/eb6fbb30a5d7|Document new sbranch ELD]].
 +  * boot.asm: [[https://hg.pushbx.org/ecm/ldebug/rev/ecbec1e71753|Cache a single FAT sector]] during yy boot read or seek. Dramatically improves the time spent on loading ELDs from the uncompressed extlib.eld library, from a physical 1440 KiB diskette. Details in the changeset message. (As for the question of when ldfFATInvalid is cleared, it is useful to look into boot.asm where query_geometry and initialise_fs are called. The only call to initialise_fs with the flag still clear is for the kernel load, in which case an 8 KiB buffer for the FAT is allocated in the LMA (below the debugger allocation). All other callers set the ldfFATInvalid flag and re-use the auxbuff for loading FAT sectors on demand.)
 +  * [[https://hg.pushbx.org/ecm/ldebug/rev/7fe0c756aaaf|Add extpak.eld _ALIGNPAGE option]] so the compressed stream is aligned on a 512-byte boundary and the filebuffer is also 512 bytes in size. This nearly halves the sector reads needed to load an ELD from the compressed extpak.eld library.
 +  * [[https://hg.pushbx.org/ecm/ldebug/rev/aa71c441ee5b|Enable _ALIGNPAGE by default]].
 +  * [[https://hg.pushbx.org/ecm/ldebug/rev/095739478a9f|Increase list.eld filebuffer]] to 512 bytes.
 +  * boot.asm: [[https://hg.pushbx.org/ecm/ldebug/rev/e702107b6a27|Add ldfDataBuffered flag to make use of a 512-byte buffer]] supplied by the caller for yy boot read. Avoids the need to reload the same data sector for subsequent reads.
 +  * extlib.asm: [[https://hg.pushbx.org/ecm/ldebug/rev/cebdac1b229b|Provide the data buffer for bootloaded operation]]. Changeset message contains some tests indicating how many sector reads different tests take.
 +  * extlib.asm: [[https://hg.pushbx.org/ecm/ldebug/rev/2d7579b50a50|Drop unused resident size labels]] (this ELD cannot be installed).
 +  * list.asm: [[https://hg.pushbx.org/ecm/ldebug/rev/26081f2d84ef|Add the data buffer for bootloaded operation]]. This is particularly useful because the list.eld build cannot affect whether the extpak.eld aligns its compressed stream.
 +
 +
 +===== ident86 =====
 +
 +  * [[https://hg.pushbx.org/ecm/ident86/rev/5e66b00788b8|Update attribution year range]] to include 2025.
 +  * [[https://hg.pushbx.org/ecm/ident86/rev/73bc07c77574|Add initial commit]] of manual.
 +  * [[https://hg.pushbx.org/ecm/ident86/rev/bc8aee940edf|Add manual overview]].
 +  * [[https://hg.pushbx.org/ecm/ident86/rev/c60af0786e18|Add manual chapter switches]].
 +
 +
 +===== wwwecm scripts =====
 +
 +[[https://hg.pushbx.org/ecm/wwwecm.scr/|Add ident86 manual to update-doc-wwwecm]]. (This implies adding that script to the web repo's update hooks, and cloning the web repo into the doc build repo, and setting up the symlinks from [[https://pushbx.org/ecm/doc/|pushbx.org/ecm/doc/]] to point to the built files.)
 +
 +
 +===== FreeDOS kernel =====
 +
 +  * [[https://github.com/FDOS/kernel/pull/222|Reset full ax after boot32.asm int 10h function 0Eh call]].
 +  * initdisk.c: [[https://github.com/FDOS/kernel/pull/224|Use ds=40h workaround for Xi8088  ROM-BIOS bug]] for int 13h function 41h
 +  * sys: [[https://github.com/FDOS/kernel/pull/226|Fix findfirst corrupting the application command line]] before the /K kernel name is read. Instead of leaving the DTA left pointing at PSP:80h and copying the result to another buffer, point the DTA at the buffer directly.
 +  * sys: [[https://github.com/FDOS/kernel/pull/226|Also use ds=40h workaround for int 13h function 41h]]. Required some more changes because the gcc build didn't include int86x to set the segregs for an interrupt call. And then the int86 calls sometimes expected the default ds to be passed to the interrupt call.
 +
 +The last two commits aren't merged yet as of the time of this writing.
 +
 +{{tag>msdebug ldos bootimg partdisk acegals ldosboot ldosboot.exp convlist.pl ldebug ident86 wwwecm.scr freedos}}
 +
 +
 +~~DISCUSSION~~
  
blog/pushbx/2025/1012_early_october_updates.txt ยท Last modified: 2025-10-12 19:39:38 +0200 Oct Sun by ecm