On 2/9/2024 12:13 PM, Bernd Böckmann via Freedos-devel wrote:
Hi Ralf,
On 09.02.2024 20:02, Ralf Quint via Freedos-devel wrote:
I can't see any reason as to why a data segment on a BIOS call should
be set to any random value.
For example, take this code (copied from FDISK source):
static void Reset_Drive( int drive )
{
union REGPACK r;
memset( &r, 0, sizeof( union REGPACK ) );
r.h.dl = drive;
intr( 0x13, &r );
}
The REGPACK r contains variables for the (segment) registers. In the
above, these are initialized to zero by the memset function. If you
leave this out, variable r, and so DS, ES contain random values,
because r is on the stack. The values of the structure are loaded into
the registers before intr calls the requested interrupt, and the
original values are restored before it returns. You may of course
initialize the individual structure members explicitly. For example DS
with the current value stored in the register. But, like said, the
above is like the manual recommends.
Greetings, Bernd
Thanks Bernd, will check this in a bit. The above is one reason why I
used to write my own asm routines for BIOS calls. Will test this during
my lunch break, if I can get 86box emulating this X8088book to work... ;-)
Ralf
_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel