When you write an exported function in assembly language, do not begin the function with the following code:
mov ax,xxxx
In this example, xxxx is any constant value.
This code at the beginning of an exported function is identical to the beginning of a library code segment that Windows has cached in extended memory. When Windows attempts to reload the code segment, it treats the constant value as if it were the address of the library's data segment and fixes up the constant value to the new address of the data segment.
To ensure that Windows does not treat your code segment as a cached library segment, simply precede the mov ax instruction with a nop instruction, as follows:
nop
mov ax,xxxx