User Tools

Site Tools


blog:pushbx:2025:0224_mid_late_february_work

Differences

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

Link to this comparison view

blog:pushbx:2025:0224_mid_late_february_work [2025-02-24 17:22:27 +0100 Feb Mon] (current)
ecm created
Line 1: Line 1:
 +====== Mid late February work ======
 +
 +**2025-02-23**
 +
 +
 +===== webecm =====
 +
 +[[https://hg.pushbx.org/ecm/webecm/rev/c49f4dc392de|Add section]] on lDOS kernel.
 +
 +
 +===== lDebug =====
 +
 +[[https://hg.pushbx.org/ecm/ldebug/rev/6c1618b63e0e|Allow to start a kernel command line with a semicolon]] after the second file specification. Doesn't always work: ''boot protocol ldos . .; append ...'' and ''boot protocol ldos . %%//%%; append ...'' are fine. ''boot protocol ldos . test\; append ...'' doesn't work as intended.
 +
 +List the errfix Extension for lDebug hooks, the no-inherit file open change, as well as the kernel command line change [[https://hg.pushbx.org/ecm/ldebug/rev/d1c1b23e6de5|in the news-r10 section]] of the manual.
 +
 +
 +===== lDOS =====
 +
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/f2c3ad844df2|Allow the dot as a no-op command name]] in the kernel command line.
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/3b25392eed7a|Fix Ctrl-C crash]] due to wrong int 1Bh entry.
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/9480fa9fb0f1|Fix so sysinit messages are in SYSINITSEG]]. Symptom: Unknown command name error message was garbled.
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/ba9a002585e5|Fix to place msclock variables in DOSENTRY]], and do far calls to subfunctions.
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/da3e97000f0f|Drop the separate ORIG19 variable]], int 19h original vector is in the Interrupt Restoration Table.
 +  * Pick from MS-DOS v5: [[https://hg.pushbx.org/ecm/msdos4/rev/47f2f4266564|Clear the VDISK header in the HMA]] in int 19h handler.
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/7dd11e5443df|Add int 0]] to the IRT.
 +  * [[https://hg.pushbx.org/ecm/msdos4/rev/e40c7dc391b7|Update makefiles]] with some new includes.
 +
 +
 +===== fixmem =====
 +
 +  * [[https://hg.pushbx.org/ecm/fixmem/rev/17123fd054fe|Support TASM arg directive]] for size and enter as localvars
 +  * Add option ''%%--includepushpopmac%%'' [[https://hg.pushbx.org/ecm/fixmem/rev/fb41caa3195f|to include the push and pop trace listing source comments on includes]] even when the name ends in ".mac"
 +  * [[https://hg.pushbx.org/ecm/fixmem/rev/7213cb5f56bf|Fix for files that end in include directives]]. This was tricky to study, but once they occurred the effects of this bug were obvious. If a file ended in an include directive, its output handle wouldn't be closed and the one of the next one wouldn't be opened properly because the "$new" variable wasn't set.
 +  * [[https://hg.pushbx.org/ecm/fixmem/rev/c4d52d2b717c|Support TASM local directive]].
 +  * [[https://hg.pushbx.org/ecm/fixmem/rev/e72295d0563d|Put the code to replace dotted labels earlier]] so the branch code can take advantage of it.
 +  * [[https://hg.pushbx.org/ecm/fixmem/rev/d92ee39baf15|Recognise call to a dword variable addressed by dotted label without brackets]] as an indirect far call.
 +  * Fix: TASM arg and local variables [[https://hg.pushbx.org/ecm/fixmem/rev/9c9ce6f3e37b|should not be entered into the current code section]].
 +  * [[https://hg.pushbx.org/ecm/fixmem/rev/99428fb5b35d|Move the dotted label handling back]], edit the new spot to do branches only. Fixes some regressions of the earlier changeset that moved it.
 +
 +
 +===== lmacros =====
 +
 +Support [[https://hg.pushbx.org/ecm/lmacros/rev/02514bc6c547|the sub keyword as the second parameter to lenter]], to make the code use a ''sub sp'' instruction rather than ''lea sp''. This has no advantage, and clobbers the flags where lea does not, but it is added to support identicalising of applications.
 +
 +
 +===== ident86 =====
 +
 +Detect [[https://hg.pushbx.org/ecm/ident86/rev/8f62e4b96259|an xchg instruction with the same register twice as operands]] as a longer nop. (In 64-bit mode an xchg with a 32-bit register is not a nop, but we don't support that at all.) This helps to identicalise to TASM, which uses ''xchg bx, bx'' for longer alignment.
 +
 +
 +===== testfptr =====
 +
 +[[https://hg.pushbx.org/ecm/testfptr/rev/024a5f17cde3|Small test of NASM and ia16-elf-gcc interoperability]] with returning far pointers. Done as an exercise to prepare for SRDISK port.
 +
 +
 +===== FreeCOM =====
 +
 +[[https://github.com/FDOS/freecom/pull/167|ecm-loadhigh PR]] to mostly fix LH on lDOS:
 +
 +  * Do not leak memory on errors.
 +  * Accept empty MCB (eg lDOS's SD MCB) in the MCB walker.
 +  * Support lDOS S MCBs of type 30h, excluded UMA
 +  * Do not record a trailing UMB region if the last excluded UMCB is empty and a Z MCB.
 +  * Check for array overflows.
 +
 +[[https://github.com/FDOS/freecom/pull/168|Set CY before calling 21.71 or 21.73 extended DOS functions]], to ensure we can detect an error correctly on the expected error return (CF unchanged, AL = 00h).
 +
 +In cswapc.c the code used an optimisation to pass the Extended Memory Move block as parameters to a varargs function in the correct order to pass along to the XMS function. [[https://github.com/FDOS/freecom/pull/172|Undo this because it didn't work as intended]] in ia16-elf-gcc.
 +
 +
 +===== FreeDOS kernel =====
 +
 +[[https://github.com/FDOS/kernel/pull/198|Fix the MS-DOS v5 compatible HMA allocation functions]] to actually be compatible.
 +
 +  * Reject allocation call that cannot be fully satisfied.
 +  * Align result to paragraph boundary.
 +  * Allow allocating including the last byte of the HMA.
 +  * Pass last allocated byte to AllocateHMASpace to avoid an overflow when allocating up to the end of the HMA.
 +  * Advance the firstAvailableBuf pointer to align it on a paragraph boundary.
 +
 +
 +===== dosemu2 =====
 +
 +Running an 21.7303 call on dosemu2 running lDOS running SRDISK [[https://github.com/dosemu2/dosemu2/discussions/2395|caused dosemu2 to return an incorrect error code]] (CF unchanged, AX = unchanged 7303h) rather than what was expected (CF unchanged, AL = 00h).
 +
 +Compiling an older build of dosemu2 I noticed that make generated a warning message reading "clock skew detected". It was [[https://github.com/dosemu2/dosemu2/issues/2405|caused by a date time stamp that didn't include a year]]. It seems to cause make to rebuild files that didn't need updating.
 +
 +
 +===== SRDISK =====
 +
 +The ReSizeable RAMDisk, a project I found [[https://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/dos/ramdisk/srdisk/srsrc209.zip|on the FreeDOS servers]]. License is GNU GPL any version. (The file headers do not specify a version of the GPL, which according to the GNU GPL v2 content means any version can be chosen.)
 +
 +It appears that v2.09 is the only free software release of SRDISK. In the 1990s there were prior releases but the sources to those are likely lost.
 +
 +The first task was to port the assembly language drivers to NASM. To facilitate this I expanded the macros used to split the code into separate files, so srdisk.inc now [[https://hg.pushbx.org/ecm/srdisk/rev/8de3be4f6c80|has all the code using conditional assembling]]. This helps both with porting to NASM and later when reading the NASM (trace) listing file.
 +
 +I used fixmem.pl [[https://hg.pushbx.org/ecm/srdisk/rev/0c89b6e4cf9a|to do most of the porting work]]. After that [[https://hg.pushbx.org/ecm/srdisk/rev/bb24402be421|the edits]] included macros, equates, defines, and converting the TASM stack frame directives to use the lframe macro collection instead. [[https://hg.pushbx.org/ecm/srdisk/rev/fbf59b7055e8|The final identicalising of srdxms.sys]] involved removing a CS: override on a variable and adding ''push cs'' to call a far function from a near caller. (The override was wrongly inserted by fixmem.pl after stripping an explicit DS: override.)
 +
 +[[https://hg.pushbx.org/ecm/srdisk/rev/990bc16532a6|The stack segment added to srdisk.mac]] silences the warning generated by WarpLink. WarpLink's /C option (Create a .COM file) doesn't work because the driver files are assembled at origin zero.
 +
 +The new keyword "sub" to lenter [[https://hg.pushbx.org/ecm/srdisk/rev/3981e01dcea0|is used to identicalise]] srdxms.sys further.
 +
 +STACKSIZE is added [[https://hg.pushbx.org/ecm/srdisk/rev/cbf0fc86c79a|as an equate set to zero]] for the "small" device driver builds. The MEMORY_STR is [[https://hg.pushbx.org/ecm/srdisk/rev/fb7c7752d432|changed from an equate to a define]] in all driver files. One case of a dotted label not caught by fixmem.pl as well as an istruc use within the definition of another structure using ''db 0'' to fill [[https://hg.pushbx.org/ecm/srdisk/rev/f8266606643b|needed to be fixed]]. Further, a port equate [[https://hg.pushbx.org/ecm/srdisk/rev/17b4a2cea73d|needed copying into another conditional assembly branch]]. After that all variants of the main driver did assemble and were identicalised.
 +
 +The xmssize.asm source text's stack segment wasn't recognised by TLINK because of the CODE class name rather than STACK. I [[https://hg.pushbx.org/ecm/srdisk/rev/76169e218865|fixed this in the original file]] to match the identicalised port to it.
 +
 +The remainder of the work was on the Makefile as well as major changes to port the srdisk.exe C sources to build with NASM and ia16-elf-gcc. I did come across some bugs during this work. A list of the bugs and other incompatibilities:
 +
 +  * The buffer xfer function had its Carry Flag corrupted by an ''add sp'' to discard parameters from the stack.
 +  * The query for a reply didn't flush stdout before waiting for a keypress.
 +  * The handle size function (rarely used) swapped the XMS v2 and XMS v3 branches.
 +  * In one case it was expected that the EMS interface returns an error code in BL. Presumably it was mixed up with XMS conventions which do use BL. Also, BX was written to an output variable even in an error case.
 +  * The min function included in max.h was the wrong way around. It swapped both the condition and the returns as compared to max, making it effectively an alias of max.
 +  * Error A7h for XMS wasn't recognised.
 +  * Some function declarations and definitions disagreed on whether functions should be static or not.
 +  * In makenewf.c some fields were regarded as words that are actually only bytes. This caused spurious reconfiguration when nothing should have changed.
 +  * In one place min was used both as a variable name and as a function name.
 +  * _fstrncmp is not defined for ia16 gcc / libi86
 +  * The far string format ''%Fs'' isn't supported by ia16 gcc / libi86
 +  * The ''_seg'' pointer type seems to not be supported eiher. This includes combining a _seg pointer and a ''near'' pointer simply by adding two variables (used heavily in env.c).
 +  * Far function pointers seem to not be supported well.
 +  * In one spot a variable was declared only with the type keyword ''const'', where it should be ''const int''.
 +  * O_BINARY and FA_DIREC, FA_LABEL are not defined.
 +  * farmalloc and farcoreleft are not defined. The former can be aliased to _fmalloc. The latter turned out to be unnecessary.
 +
 +{{tag>webecm ldebug ldos fixmem lmacros ident86 freecom fdkernel dosemu2 srdisk}}
 +
 +
 +~~DISCUSSION~~
  
blog/pushbx/2025/0224_mid_late_february_work.txt ยท Last modified: 2025-02-24 17:22:27 +0100 Feb Mon by ecm