Table of Contents
Mid late February work
2025-02-23
webecm
Add section on lDOS kernel.
lDebug
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 in the news-r10 section of the manual.
lDOS
- Allow the dot as a no-op command name in the kernel command line.
- Fix Ctrl-C crash due to wrong int 1Bh entry.
- Fix so sysinit messages are in SYSINITSEG. Symptom: Unknown command name error message was garbled.
- Fix to place msclock variables in DOSENTRY, and do far calls to subfunctions.
- Drop the separate ORIG19 variable, int 19h original vector is in the Interrupt Restoration Table.
- Pick from MS-DOS v5: Clear the VDISK header in the HMA in int 19h handler.
- Add int 0 to the IRT.
- Update makefiles with some new includes.
fixmem
- Support TASM arg directive for size and enter as localvars
- Add option
--includepushpopmacto include the push and pop trace listing source comments on includes even when the name ends in ".mac" - 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.
- Put the code to replace dotted labels earlier so the branch code can take advantage of it.
- Recognise call to a dword variable addressed by dotted label without brackets as an indirect far call.
- Fix: TASM arg and local variables should not be entered into the current code section.
- 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 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 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
Small test of NASM and ia16-elf-gcc interoperability with returning far pointers. Done as an exercise to prepare for SRDISK port.
FreeCOM
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.
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. Undo this because it didn't work as intended in ia16-elf-gcc.
FreeDOS kernel
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 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 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 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 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 to do most of the porting work. After that the edits included macros, equates, defines, and converting the TASM stack frame directives to use the lframe macro collection instead. 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.)
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 is used to identicalise srdxms.sys further.
STACKSIZE is added as an equate set to zero for the "small" device driver builds. The MEMORY_STR is 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 needed to be fixed. Further, a port equate 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 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 spto 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
%Fsisn't supported by ia16 gcc / libi86 - The
_segpointer type seems to not be supported eiher. This includes combining a _seg pointer and anearpointer 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 beconst 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.
