|
|
— |
blog:pushbx:2025:1020_ldos_boot_enhancements_in_mid_october [2025-10-20 20:11:30 +0200 Oct Mon] (current) ecm created |
| ====== lDOS boot enhancements in mid October ====== |
| |
| |
| |
| **2025-10-19** |
| |
| ===== lDOS boot (non-experimental) ===== |
| |
| [[https://hg.pushbx.org/ecm/ldosboot/rev/a103d454a51d|Add a list of the error condition letters]] used by boot.asm and boot32.asm to the manual. |
| |
| |
| ===== lDOS boot (experimental) ===== |
| |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/3aacb6e9b3e0|Display the +3 for the number of bytes available before ms7_entry]] if a transfer to the error_outofmemory label is included. |
| * Optimisation: [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/ceb2413e61b8|Discard LBA packet]] by using ''add sp, [si + lpSize]'' (as this instruction only takes 2 bytes). |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/ac3cf0a4a638|Use dot-terminated error messages]]. The second error message, listing the specific error, is re-used by a ''dec si'' and ''call'' to actually display the dot, whereas the first message (the common prefix) uses the dot only as a terminator. |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/a2aefdd399b4|Zero the ah register for int 16h function 00h]] by using ''cbw'' with al containing 2Eh, the dot terminator of the error messages. |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/2aa5be7e8ee0|In the read_sector.int13_retry function pop into cx if the first attempt succeeds]], saving a byte. |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/a3db1e9597ad|In read_sector.int13_set_lpcount always set]] ''byte [si + lpCount]'' to 1 before calling int 13h function 02h or 42h. For CHS access we make sure to point si at unclaimed stack space. |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/b7f4779aedb5|Always try sector segment read if the normal read failed]], without checking for the error code 09h. |
| * Spaghettify code around ms6_continue1 [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/8b9761b9483d|once]] and [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/a087fff0504e|twice]]. |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/d3e486ea6de2|Replace cwd by xor to zero dx when loading the FAT for FAT12]]. The register use changed so that ax is no longer known to be zero (or, indeed, < 8000h) at this point. |
| * Swap operations [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/861ae75792d1|so cwd can be used to zero dx again]]. Instead of ax = 0000h this uses ax <= 0FF5h, and prepares dx before using ax to check whether the FAT load is needed at all. |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/1626164d4813|Check for two overflows]]: A build time check that payload.actual_end + maximum sector size cannot overflow FFFFh paragraphs, and a run time check that rounded up payload.actual_end plus cs doesn't overflow. (This is only possible with a large payload and/or when the Low Memory Area extends higher than usual.) |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/8900b73e1ebf|Update a comment in multi_sector_read to note that al is always <= 127]] when entered after a successful LBA sector read call. |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/fe336751aec1|Update read_sector comment on not checking for error code 09h]] to attempt the sector segment read. |
| * Fix: [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/e496cc709a29|The read_sector.dx_ax_cx_lba_to_chs return patch needs to be reset differently now]], E8h (near immediate call) rather than B8h (mov ax immediate). The patch label now includes the hexadecimal opcode value that it should be reset to. |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/43469122407f|Share .lba_done and .done code by inserting a __TEST_IMM16]] (incorrectly stated as a "test imm8" in the changeset message) to have the sector segment code skip over the ''add sp'' instruction, saving 1 byte as one fewer short jump is used. |
| * Before the read_sector call that reads a FAT sector (for FAT16 or FAT32) [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/bcf3d35f8946|use es to set bx, instead of re-reading the FAT buffer segment from the lsvFATSeg variable]]. |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/7b4f114e3a4f|Spaghettify further around ms6_continue1]]. |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/ee1f2a01fd5f|Share part of the skip next cluster/sector loop]] with the load next loop. As it says in the changeset message: "The file loop code can be re-used partially, as the lsvLoadSeg check will simply be tripped again on every iteration through what was originally the skip loop." |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/76b95f2b19c2|Put a better check for late multi-sector loader initialisation]] into the end+32 part. This removes the need for a sector size >= 512 bytes for this check. It also eliminates the end+64 part after two sectors were read. |
| * For the subtraction that calculates how many paragraphs to relocate down, do not include the subtraction twice. Rather, [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/284e011d105f|for the usual code run a compare instead, then if relocation is needed fall through into the subtraction]] previously used only for the unusual code path. Saves a short jump, 2 bytes. |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/2bcc065623bc|Set up dx:ax:bx differently before the division to calculate the amount of clusters]]. Using [[https://pushbx.org/ecm/doc/acegals.htm#xchgformov|an xchg instead of a mov with ax]] saves 1 byte. |
| * Bugfix: As of the very first revision of the multi-sector loader, reads that crossed a 64 KiB boundary didn't [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/9d5d118ba469|decrement the counter of remaining reads as needed]] when calling read_sector to carry out a read. This would break the load if the load file was fragmented and during a read not belonging to the last fragment a 64 KiB boundary was crossed by a single-sector read. |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/daae1e7f8bbb|Merge the prior bugfix]] into the most recent branch. |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/1f8655f6e47c|Keep lsvFATSector in the variable rather than using si:di to hold it]], and use ''es lodsw'' to load from the FAT (for FAT16 and FAT32). |
| * boot.asm _FAT16: [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/b05eadcfd3d0|Keep lsvFATSector in the variable]] rather than using di to hold it. |
| * boot32.asm: [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/83b76ed20c4b|Keep lsvFATSector in the variable]] rather than using si:di to hold it, and use lodsw. After studying the interface I decided to keep the FSIBOOT5 signature for this revision, although I added detection to instsect that calls it FSIBOOT revision "5a". |
| * boot32.asm: [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/bd2263bd141e|Toggle sense of Carry Flag output of check_clust]]. This is only used internally by the FSIBOOT stage so doesn't call for a new FSIBOOT revision either. |
| * boot32.asm: [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/96639fd60a1b|Introduce the _FREE_PARA_LIMIT define to limit lDOS load]] to 4 KiB. |
| * Optimisation: Now that di is no longer used to hold part of the currently loaded FAT sector, re-use it in the multi-sector loader [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/b78cc0c3d887|to replace the ldmAmount variable]]. |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/78ce4726dedb|Extract the check_end3_loaded function]], and put a stc behind the end+32 limit. |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/a5fc021e1466|Spaghettify]] and [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/b0044ccbc4d5|add a call to check_end3_loaded to skipped_all_multi]]. I [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/93dcf00ba130|closed this branch later]] as it wasn't desirable to only do this check after loading at least 1 non-terminal file fragment. |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/af891dac4139|Spaghettify once]] and [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/f5d54a56c337|twice]] and [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/4c2d964726b9|add a call to check_end3_loaded to the multi_sector_read function]]. As described in the comment, the branch after this check is only enabled upon entry to skipped_all_multi so as to avoid incorrectly branching after the FAT load that may be needed on FAT12. When skipped_all_multi is entered, all subsequent calls to multi_sector_read are known to be for the load file data, so comparing the resulting bx =%%%%> behind loaded data is then valid. |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/8aee7a80baf1|Fix building with _ADDPROGRESS and _LBA_MULTI both disabled]]. |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/112e08d9bf60|Fix building with _MULTISECTOR disabled and _ADDPROGRESS enabled]]. |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/521ecd141e6c|Display the distance encoded in the late_progress_init branch]], and check that it is <= 127. (It is, but narrowly.) |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/2dc92cb5f174|Display number of bytes in front of end+32 mark]]. |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/c97d369ebda6|Add a transfer jump to late_progress_init before end2]] if there's 3 or more bytes free there. This jump is placed directly after the multi_sector_read code so that the distance of the check_end3_loaded branch won't overflow 127 bytes (the short jump forwards distance limit). |
| * Optimise skipped_all_multi [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/f3ed9ae0ce23|by sharing the code that sets the ldmSector variable]]. |
| * testboot.asm: [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/7c270a14122b|Check method 2 list length]] (<= 32) and displacement limits (below 62 except for the -1 and -2 sentinel values). |
| * testboot.asm: [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/432536f1d080|Re-order method 2 list]] and expand it to make use of the entire range. |
| * testboot.asm: Add define _EXTENDED [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/b533e6ce3680|to fill the method 2 sector completely]], with new stack dump items SG to SR. This requires encoding the halved displacement instead of the full one, costing 2 bytes of code to decode the displacement. (Without this encoding change, some of the higher stack items would overflow the 6-bit displacement field.) |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/8681c68e5dfe|Drop obsolete patch comment on read_sector.dx_ax_cx_lba_to_chs]] (from back when the patch always had to restore B8h). |
| * Optimisation: [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/2d33f5a554eb|Calculate FAT12 byte offset in si already]], avoids having to move it there later. |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/a103d454a51d|Same doc patch]] as for ldosboot (non-experimental). |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/27fb2c6f3af6|Merge the doc patch]]. |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/37f2e055080d|Drop load_next_sect completely]], handle the entire single-sector loader logic in the loop that at first skips the already-loaded prefix. |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/bca8ea63a8b0|Drop some now unneeded branches]]. Make skipped_all_continue directly call check_end3_loaded, then continue on to loadorskip_next_sector. (If neither _MULTISECTOR nor _ADDPROGRESS are enabled, skipped_all_continue is an equate for loadorskip_next_sector.) The branches to loaded_all.2stack from the end+32 part are also dropped. |
| * Fix build with several defines: |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/752197f94f95|_MULTISECTOR=0]] |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/c57e9a984d68|_MULTISECTOR=0 _ADDPROGRESS=0]] |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/080622fb7031|_MULTISECTOR=1 _ADDPROGRESS=0]] |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/e8e31cc8d697|_MULTISECTOR=0 _ADDPROGRESS=1 _LBA_SKIP_CHECK=1]] |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/cb0551856a08|_QUERY_GEOMETRY=0 _LBA_SKIP_CHECK=1 _QUERY_PATCH=1]] |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/74eb8c6f3b52|Comment on how the skip_next_* loop is used for loading now]] too. |
| * boot.asm and boot32.asm: [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/6752f0ade6c0|Mark magic code used by instsect /4 PREFIX option]]. |
| * [[https://hg.pushbx.org/ecm/ldosboot.exp/rev/90344e32fa31|Correct a comment]], >%%%%> right shift operator has a lower precedence than + addition. |
| |
| |
| ===== lDebug and lDOS kernel ===== |
| |
| No change, just an empty changeset to rebuild with new instsect revision, for both [[https://hg.pushbx.org/ecm/ldebug/rev/3376156e5839|lDebug]] and [[https://hg.pushbx.org/ecm/msdos4/rev/28de3823a0fd|the lDOS kernel]]. |
| |
| |
| ===== instsect ===== |
| |
| * [[https://hg.pushbx.org/ecm/instsect/rev/b53ee5445a53|Introduce a third parameter to fsi_revision mmacro]] for a subrevision marker. |
| * [[https://hg.pushbx.org/ecm/instsect/rev/444c089dbb94|Add FSIBOOT revision 5a]] for updated boot32.asm loader, detected using a code snippet. |
| * [[https://hg.pushbx.org/ecm/instsect/rev/d1b12870466b|Add comment on FSIBOOT revision 5a using the same signature]] as revision 5. |
| * [[https://hg.pushbx.org/ecm/instsect/rev/984bc507e4dd|Add the /4 PREFIX option to patch lDOS boot sector loaders]] so they will load only up to segment 300h rather than 7A0h. |
| * [[https://hg.pushbx.org/ecm/instsect/rev/2d6bacb23266|Fix the help message line]] for /4 PREFIX option. |
| * [[https://hg.pushbx.org/ecm/instsect/rev/ad7fa1c93313|Update attribution year]]. |
| * fsiboot.mac: [[https://hg.pushbx.org/ecm/instsect/rev/46bb77691462|Update attribution year]]. |
| * [[https://hg.pushbx.org/ecm/instsect/rev/e067baffcc62|Update attribution year in the help message]]. |
| |
| |
| ===== amdpd ===== |
| |
| * [[https://hg.pushbx.org/ecm/amdpd/rev/d39a6ed23fa9|Pass -q and -quiet options to the dosemu2 command]] used for linking. |
| |
| |
| ===== Blog ===== |
| |
| The other day I finished [[blog:pushbx:2025:1017_looking_back_at_2017_s_iniload|a blog post reviewing the initial commit of lDOS boot's iniload]], on 2017-10-03, as well as the updates to it within the same month. |
| |
| |
| {{tag>ldosboot ldosboot.exp ldebug ldos instsect blog}} |
| |
| |
| ~~DISCUSSION~~ |
| |