Using memcmp with DOS far pointers

105 Views Asked by At

I have an old program I wrote in 1995. It is written with Borland C and DOS 6.22. It uses a far model with data in different segments. The program uses EMS memory and that is why the pointers need to be far. I need to use memcmp( a, b, c) but I get an error "Warning panel.c 325: Suspicious pointer conversion in function enterPanel" and I suspect that is because I have a far pointer. Is there a far version of memcpy that I should be using? (I searched for such a function but couldn't find it). You may be wondering why I don't just code a loop but I want to use the intrinsic capability to get the most speed.

Here is a snip from my code:

ASM function
------------
                align   4               
                public  _mainMem
_mainMem        label   dword
mainMem         dd      ?               ;pointer to main memory (if no EMS)

        mov     ax,emsSegment           ;segment of EMS page frame
        mov     word ptr mainMem+2,ax
        mov     word ptr mainMem,0

C program
---------
extern unsigned short _far *mainMem;
short           watchArray[80];
unsigned int    watchAddress, watchLen;

memcmp((_far*)&mainMem[watchAddress], watchArray, watchLen)

Also I tried removing the (_far*).

0

There are 0 best solutions below