1# double FetchDouble(void)
2# /*this function to is to fetch a double data from mem(0x07ff0 -0x07ff7)*/
3# {
4# double *doublepointer;
5# unsigned int address = 0x07FF0;
6# _asm
7# {
8# mov si,doublepointer
9# mov ax,ds:[address]
10# mov [si],ax;
11# mov ax,ds:[address+2]
12# mov [si+2],ax;
13# mov ax,ds:[address+4]
14# mov [si+4],ax;
15# mov ax,ds:[address+6]
16# mov [si+6],ax;
17# }
18# return (*doublepointer);
19# }
If I save 123456789.123456789 in the memory, the data I got is 123456789.1234357.
If I changed line 9 to:
mov ax,ds:0x07FF0
and the function works well.
I don't know the reason. Thanks for your help.
2# /*this function to is to fetch a double data from mem(0x07ff0 -0x07ff7)*/
3# {
4# double *doublepointer;
5# unsigned int address = 0x07FF0;
6# _asm
7# {
8# mov si,doublepointer
9# mov ax,ds:[address]
10# mov [si],ax;
11# mov ax,ds:[address+2]
12# mov [si+2],ax;
13# mov ax,ds:[address+4]
14# mov [si+4],ax;
15# mov ax,ds:[address+6]
16# mov [si+6],ax;
17# }
18# return (*doublepointer);
19# }
If I save 123456789.123456789 in the memory, the data I got is 123456789.1234357.
If I changed line 9 to:
mov ax,ds:0x07FF0
and the function works well.
I don't know the reason. Thanks for your help.