0

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*).

Aabbee
  • 91
  • 6
  • you'd be surprised what compilers can do nowadays with optimizations enabled. – bolov Mar 18 '19 at 22:29
  • Yea, in this case Borland C will not actually call a memcmp function. It will generate a 'rep cmpsb' instruction inline. That is what I'm looking for. If there is no way to use a far version of memcmp then I'll just code it inline myself. – Aabbee Mar 18 '19 at 22:42
  • Given that no one has answered I decided to code it using the _ASM feature of Borland C. – Aabbee Mar 19 '19 at 14:11

0 Answers0