This commit contains a number of changes:
1. int86x gets and sets struct SREGS members ds and es
2. int86x patches itself (SMC) using a cs: segment override prefix,
as ds may no longer equal cs.
3. int86x interrupt number is %7 rather than %5
4. int86x assembly part doesn't push and pop ds, it is handled by
the compiler instead (in practice it puts a push ss \ pop ds at the
end of the function to restore the near data segment).
5. int86 is implemented by calling int86x (with ds = es = 0)
6. findfirst, int2526readwrite, fat32readwrite also changed to use
int86x because they need to set ds. This used to be implied as the
same ds that the compiler already used by default.
7. Finally, haveLBA changed to set ds to 40h.
The inline assembly constraints for gcc-ia16 are documented in
ca89332092/gcc/doc/md.texi (L2379)
Running prior to this commit, a /K switch with a name at a certain
position will write all-blanks into the boot sector loader. If that
happens, lDOS instsect will not detect a valid load file name:
C:\>sys a: /bootonly /k ldos.com
System transferred.
C:\>instsect /bo a:
Detected FAT12 FS.
Keeping original sector loader.
Sector valid, FS ID match and proper jump.
Type heuristic: "FreeDOS (FreeDOS)"
No name detected.
Unit selection code not found in sector. Keeping as is.
Part info code not found in sector. Keeping as is.
Query geometry code not found in sector. Keeping as is.
Auto LBA detection (HDD only) found in sector. Keeping as is.
Previous geometry: 2 CHS Heads, 18 CHS Sectors, 0 Hidden
Writing boot sector to sector.
C:\>
Running after this commit sets the name as desired:
C:\>sys a: /bootonly /k ldos.com
System transferred.
C:\>instsect /bo a:
Detected FAT12 FS.
Keeping original sector loader.
Sector valid, FS ID match and proper jump.
Type heuristic: "FreeDOS (FreeDOS)"
1st name: "LDOS.COM"
Unit selection code not found in sector. Keeping as is.
Part info code not found in sector. Keeping as is.
Query geometry code not found in sector. Keeping as is.
Auto LBA detection (HDD only) found in sector. Keeping as is.
Previous geometry: 2 CHS Heads, 18 CHS Sectors, 0 Hidden
Writing boot sector to sector.
C:\>
For reference, the libi86 implementation of _dos_findfirst also
sets the DTA to the user buffer rather than copying around the
resulting search record. So it is likely that Turbo C or Watcom
do it similarly to this:
3ecc416499/host-gcc/dos/dos-findfirst.c (L43)
Unfortunately the make supplied with Turbo C 2.01 doesn't like variables
being passed in on the command line, so use GNU make instead.
Note:
As 'country' is a submodule it can't do `!include "../mkfiles/generic.mak"`
as that would be outside its repository and would break the standalone build,
hence the reason its DIRSEP and CP vars are set on the outside. As its
'production' target is used by the main makefile, there's no opportunity to
hardcode those values to DOS specific ones there either.
We discovered [1] that some ROM-BIOS implementations apparently
corrupt the ah register contents upon running int 10h function
0Eh so that writing only al afterwards isn't certain to set up
the registers for another function 0Eh call.
In the talk about this I referenced an earlier problem [2] in
which it was the al register, not ah, which got corrupted. So
all in all the int 10h function 0Eh call should be expected to
clobber the entirety of ax, alongside bp. (The bp corruption is
stated in the Interrupt List [3].)
[1]: https://github.com/SvarDOS/bugz/issues/174#issuecomment-3368497819
[2]: 977023f85c
[3]: https://fd.lod.bz/rbil/interrup/video/100e.html
The problem is that ISFAT32 macro only tests for dpb->fatsize = 0, and
not also for xfatsize != 0. So the ISFAT32 macro returns a
"false positive" on uninitialized dpbs, where both fatsize and xfatsize
are zero.
This fixes https://github.com/FDOS/kernel/issues/200. However, the dpb
is not properly initialized via a media check by an INT25,26 yet.
This commit makes sure that written sectors are removed from the
block cache.
* Reject allocation call with too large requested size,
rather than allocating the remaining HMA.
* Align returned offset to paragraph boundary.
* Allow to allocate up to the very last byte of the HMA,
rather than 1 byte less.
* Pass last allocated byte to AllocateHMASpace instead
of the byte past it, which would carry for a full allocation.
apply suggested fix from SF bug 215 (https://sourceforge.net/p/freedos/bugs/215/), InDOS cleared but small chance DOS re-entered before user stack restored thus corrupting user stack
For now we still only support subfunction 3 (return drive table) and subfunction 0 (check if installed) which we say yes. This allows DOS Internals DRVINFO.EXE to correctly use internal drive table (it checks if installed and doesn't bother if not) and return corresponding information. Note: subfunction 3 is still handled in int2f.asm for now, but may be moved to cleaner (but bigger and slower) implementation in inthndlr.c