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
_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel