This function changes the 32-bit linear base address of the specified selector.
To Call
AX = 0007h
BX = Selector
CX:DX = 32-bit linear base address for segment
Returns
If function was successful:
Carry flag is clear.
If function was not successful:
Carry flag is set.
Programmer's Notes
The following function compiles with Watcom C/C++ version 11.0 or later, and Microsoft Visual C/C++ version 4.0 or later:
// Sets 32-bit linear base address in descriptor for selector
int dpmiSetSegmentBaseAddress(dpmiSelector sel, // selector to set base address of
unsigned long linaddr) // new base address
{
int result; // zero if int 31h succeeds
unsigned short errorCode; // error code from DPMI host
__asm {
mov bx, sel // the selector to get base address of
mov ecx, linaddr // put linear address into cx:dx
mov dx, dx
shr ecx, 16
mov eax, 0x007 // call dpmi host to do setting
int 0x31
mov errorCode, ax // save error code from DPMI, if any
sbb eax, eax // record success/failure flag
mov result, eax
}
// if the dpmi call failed, return the dpmi error code
if (result != 0)
return errorCode;
// indicate success
return 0;
}