将memcmp与DOS远指针一起使用

时间:2019-03-18 22:24:44

标签: c pointers dos memcmp borland-c

我有一个我在1995年编写的旧程序。它是用Borland C和DOS 6.22编写的。它使用具有不同分段数据的远模型。该程序使用EMS内存,这就是为什么指针需要很远的原因。我需要使用memcmp(a,b,c),但出现错误“警告panel.c 325:函数enterPanel中的可疑指针转换”,我怀疑这是因为我有一个远指针。我应该使用较远的memcpy版本吗? (我搜索了这样的功能,但找不到)。您可能想知道为什么我不只是编写循环,而是想使用固有功能来获得最快的速度。

这是我的代码中的一个片段:

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)

我也尝试删除(_far *)。

0 个答案:

没有答案