diff --git a/elks/tools/objtools/ecc b/elks/tools/objtools/ecc index f20a01d36..e2f04e814 100755 --- a/elks/tools/objtools/ecc +++ b/elks/tools/objtools/ecc @@ -51,8 +51,8 @@ CFLAGS="\ ASFLAGS="\ -0 \ - -O \ -j \ + -O \ -w- \ " diff --git a/libc/include/string.h b/libc/include/string.h index 11038bc94..0eac14ffb 100644 --- a/libc/include/string.h +++ b/libc/include/string.h @@ -29,6 +29,7 @@ int memcmp(const void*, const void*, size_t); void * memmove(void*, const void*, size_t); void __far *fmemset(void __far *buf, int c, size_t l); +int fmemcmp(void __far *s1, void __far *s2, size_t n); /* Watcom C only, in ASM */ /* Error messages */ char * strerror(int); diff --git a/libc/watcom/asm/fmemcmp.asm b/libc/watcom/asm/fmemcmp.asm new file mode 100644 index 000000000..8b314e89f --- /dev/null +++ b/libc/watcom/asm/fmemcmp.asm @@ -0,0 +1,46 @@ +; int fmemcmp(void __far *s1, void __far *s2, size_t n) +; returns 0 on match, otherwise nonzero +; +; 2 Jan 2025 Greg Haerr + +include mdef.inc +include struct.inc + + modstart fmemcmp + + xdefp "C",fmemcmp + defpe fmemcmp + +; s1 in DX:AX, s2 in CX:BX, n on stack + push bp + mov bp,sp + push si + push di + + mov ds,dx + mov si,ax + mov es,cx + mov di,bx +if _MODEL and _BIG_CODE + mov cx,6[bp] ; n +else + mov cx,4[bp] ; n +endif + cld + repz cmpsb + jz L1 ; equal + + mov ax,1 ; not equal, returns nonzero + pop di + pop si + pop bp + ret 2 +L1: xor ax,ax + pop di + pop si + pop bp + ret 2 + +fmemcmp endp + endmod + end