User Tools

Site Tools


blog:pushbx:2024:0512_early_mid_may_work

Differences

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

Link to this comparison view

blog:pushbx:2024:0512_early_mid_may_work [2024-05-12 20:31:02 +0200 May Sun] (current)
ecm created
Line 1: Line 1:
 +====== Early mid May work ======
 +
 +
 +**2024-05-12**
 +
 +===== wwwecm scripts =====
 +
 +[[https://hg.pushbx.org/ecm/wwwecm.scr/rev/bf110e52acad|Added msdos4 build]]. [[https://hg.pushbx.org/ecm/wwwecm.scr/rev/5bf78c7cd996|Added kernwrap as a dependency]] for edrdos and msdos4 builds.
 +
 +
 +===== MSDebug =====
 +
 +[[https://hg.pushbx.org/ecm/msdebug/rev/fa65dcc9a506|Added the function checkend]] to the assembler, [[https://hg.pushbx.org/ecm/msdebug/rev/70d66bb9b932|reject most cases]] of [[https://hg.pushbx.org/ecm/msdebug/rev/70d66bb9b932|trailing garbage after the last accepted operand]]. Some cases remain, eg ''in'', ''out'', shifts and rotates. But many cases like ''mul'', ''mov'', ''xchg'', ''push'', and ''pop'' no longer accept trailing garbage.
 +
 +Not fixed: ''mul al. 2'' assembles like ''mul byte ptr [0002]''
 +
 +
 +===== MS-DOS v4 =====
 +
 +==== MSLOAD deficiency ====
 +
 +The MSLOAD stage is now replaced by lDOS iniload/drload and drkernpl. Apart from all the advantages of the single-file load [[blog:pushbx:2024:0107_enhanced_dr-dos_single-file_load|already rehashed when I added it to Enhanced DR-DOS]], there is one more problem unique to the MS-DOS v6 compatible load protocol as it was implemented by the MS-DOS v4 MSBIO.
 +
 +This problem is that the start cluster of the MSDOS file and the data start are [[https://hg.pushbx.org/ecm/msdos4/file/2db63c0986e1/src/BIOS/MSINIT.ASM#l1382|read from the directory entry]] and [[https://hg.pushbx.org/ecm/msdos4/file/2db63c0986e1/src/BIOS/MSINIT.ASM#l406|the data start]] passed by the prior (boot sector) loader. But the drive that is accessed is either the first diskette drive or the first hard disk drive. [[https://hg.pushbx.org/ecm/msdos4/file/2db63c0986e1/src/BIOS/MSINIT.ASM#l499|Only the high bit of the load unit]] passed in DL is used to determine which.
 +
 +If the selected drive doesn't match the one that the kernel was actually loaded from then a crash is most likely.
 +
 +This is [[https://pushbx.org/ecm/doc/ldosboot.htm#protocols-drload|not shared by lDOS drload]] because drload entirely depends on the prior loader to load the entire kernel file. In the case of lDOS iniload, [[https://hg.pushbx.org/ecm/ldosboot/file/3cd51c86a302/iniload.asm#l999|there is code to read the remainder of the kernel file]] if it wasn't loaded yet but this code strictly uses the start cluster, data start, and (E)BPB passed from the prior loader so there is no possibility of confusing it for the wrong drive.
 +
 +The prior Enhanced DR-DOS dual-file load likely had less problems than MS-DOS in this regard because it used the unit number and hidden sectors to "log in" the file system of which to load the DOS. Unlike other dual-file loads, it also scanned the root directory for its DRDOS file so it could not possibly receive a wrong start cluster.
 +
 +Apart from all this, obviously the MSLOAD initial loader didn't support FAT32, LBA, or 128 or 256 Sectors per Cluster yet. lDOS iniload does support all of these, and drload doesn't need any file system access once it is entered.
 +
 +
 +==== This week's changes ====
 +
 +  * sysinit1:
 +    * [[https://hg.pushbx.org/ecm/msdos4/rev/08dff638f0b1|Use DOS size passed from drkernpl]] rather than hardcoded
 +    * [[https://hg.pushbx.org/ecm/msdos4/rev/fa34b1906d74|Make cs: override explicit]] for DOS size
 +    * [[https://hg.pushbx.org/ecm/msdos4/rev/8231543632fc|Optimise the loading of segregs]] by not using AX
 +  * Use kernwrap script to build and compress kernel
 +
 +
 +===== inicomp =====
 +
 +[[https://hg.pushbx.org/ecm/inicomp/rev/618f7fb7ddfc|Add the define MODULE]] to tell the _INILOAD_CFG file what module is being built.
 +
 +
 +===== kernwrap =====
 +
 +This is the shared script used by the lDOS forks of Enhanced DR-DOS and MS-DOS v4 now to wrap and compress the kernel. It supports lDOS iniload or drload as the outermost stage. iniload can use an image exe or second payload exe. The inicomp stage can be used as a depacker stage, combined with any one of 11 different compression methods. The checkpl stage can be used to do checksumming optionally.
 +
 +By default, 4 output files are generated, two each with drload or iniload and two each with inicomp or without. However, in the temporary subdirectories additional compressed files with different methods may be found, so that a faster method like LZSA2 or a smaller method like LZMA-lzip may be chosen by the user.
 +
 +The kernwrap script is lifted from lDebug's mak script with some additions for the version.asm and drkernpl.asm building as well as handling the drload alternatives (with .sys filename extensions).
 +
 +The qemu image building is hardened to use the correct files more reliably. This was a problem because files like command.com and autoexec.bat were found in the current working directories sometimes.
 +
 +A ''-D_TEST_PROGRAM'' switch [[https://hg.pushbx.org/ecm/kernwrap/rev/5158077b10e7|is passed to iniload.asm when building the inicomp test program]] to avoid interference from the second payload exe settings.
 +
 +Not yet done:
 +
 +  * Allow to wrap FreeDOS kernel using kernwrap, requiring fdkernpl.asm instead of drkernpl.asm
 +  * Allow building no or different exe stages than version.asm
 +  * Add more support for lCFG blocks, FreeDOS kernel CONFIG blocks, or kernel command lines
 +  * Possibly adapt kernwrap for use by lDebug or RxDOS
 +
 +
 +===== Enhanced DR-DOS =====
 +
 +  * Adapt to use kernwrap
 +  * [[https://hg.pushbx.org/ecm/edrdos/rev/729bae2f79d7|Allow to build compbios.c and compbdos.c]] for platforms without far pointers using preprocessor conditionals
 +  * Update lDOS fork [[https://hg.pushbx.org/ecm/edrdos/rev/bc8bf3c7abf1|version to 2024 May]]
 +
 +
 +===== lDebug =====
 +
 +The only change since the Book8088 BIOS bugfix and the chstool Extension for lDebug fix in scanptab was [[https://hg.pushbx.org/ecm/ldebug/rev/145dc986153b|an update to initialise AL to zero]] if the BOOT WRITE command uses [[https://fd.lod.bz/rbil/interrup/io_disk/1343.html|LBA access function 43h]] to write the sectors.
 +
 +
 +===== lDOS MBR =====
 +
 +  * [[https://hg.pushbx.org/ecm/ldosmbr/rev/10517bfc4ec4|Put aligned data (LBA packet) last]], after messages, so that the alignment is cheaper
 +  * [[https://hg.pushbx.org/ecm/ldosmbr/rev/3a0ef47e4f8b|Do not zero CX explicitly]] after ''rep movsw''
 +  * [[https://hg.pushbx.org/ecm/ldosmbr/rev/ab0f2d72b2af|Use CX as zero register]] to move exactly 512 Bytes and still save a byte
 +  * [[https://hg.pushbx.org/ecm/ldosmbr/rev/1d3a4698450b|Use a shift right instruction]] rather than test to save a byte
 +  * Use ''test al, al'' [[https://hg.pushbx.org/ecm/ldosmbr/rev/a62d47967839|to test a register for zero]] (more idiomatic)
 +  * [[https://hg.pushbx.org/ecm/ldosmbr/rev/dd717c3f54e0|Insure that the code starts with byte 33h]] (picked from [[https://repo.or.cz/syslinux.git/commit/d0f275981c9289dc4b8df64e72cd9902bf85aebe|an old syslinux commit]])
 +
 +I also [[https://github.com/FDOS/fdisk/issues/84|submitted a report to Free FDISK]] about their normal MBR, pointing out some improvements. This may yet lead to either a better program on their side or even adoption of the lDOS old MBR instead.
 +
 +
 +===== lDOS boot =====
 +
 +  * [[https://hg.pushbx.org/ecm/ldosboot/rev/68023d226166|Add defines _TEST_PROGRAM, MODULE, defaulting]], and include _INILOAD_CFG in every stage
 +  * boot32: [[https://hg.pushbx.org/ecm/ldosboot/rev/c25b1382c291|Round up file size from directory entry to paragraphs]] rather than sectors
 +  * boot32: [[https://hg.pushbx.org/ecm/ldosboot/rev/3cd51c86a302|First round down size to full paragraphs]] to check for enough file data, round it up afterwards
 +
 +
 +===== Stack Overflow: Boot loader debugging =====
 +
 +Yesterday I debugged [[https://stackoverflow.com/questions/78461195/x86-16-int-13h-does-not-read-file-correctly-from-the-disk/78464662#78464662|a boot loader submitted to stackoverflow.com]]. It turned out to have several flaws. To test it, I copied the source into an email that I sent to my self. Then in mutt I used the ''|'' (pipe) command on that mail and piped its output to a ''cat > FILE'' command to nondestructively save the contents to a file. Directly copying the text from the browser and inserting it into ConnectBot usually fails, destroying all linebreaks or worse.
 +
 +{{tag>wwwecm msdebug msdos msdos4 inicomp kernwrap edrdos ldebug ldosmbr ldosboot stackoverflow}}
 +
 +
 +~~DISCUSSION~~
  
blog/pushbx/2024/0512_early_mid_may_work.txt ยท Last modified: 2024-05-12 20:31:02 +0200 May Sun by ecm