From fa27fe4213afe1040630292cd22c485d902d53de Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Fri, 22 May 2026 12:02:43 +0200 Subject: [PATCH] link fix tools for openwatcom --- kern_wasm.asm | 46 +++++++++++++++++++++++----------------------- tools.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 23 deletions(-) mode change 100755 => 100644 tools.c diff --git a/kern_wasm.asm b/kern_wasm.asm index 4081630..c405462 100644 --- a/kern_wasm.asm +++ b/kern_wasm.asm @@ -14,14 +14,14 @@ enterIPX dd 0 .code -public _IPXinit -public _IPXopen_socket -public _IPXclose_socket -public _IPXlisten -public _xmemmove -public _Net_Call +public IPXinit_ +public IPXopen_socket_ +public IPXclose_socket_ +public IPXlisten_ +public xmemmove_ +public Net_Call_ -_IPXinit proc far +IPXinit_ proc far push bp mov bp, sp push ds @@ -48,9 +48,9 @@ ipxinit_done: pop ds pop bp ret -_IPXinit endp +IPXinit_ endp -_xmemmove proc far +xmemmove_ proc far push bp mov bp, sp @@ -74,8 +74,8 @@ _xmemmove proc far push di pushf - lds si, fword ptr [bp+10] - les di, fword ptr [bp+6] + lds si, dword ptr [bp+10] + les di, dword ptr [bp+6] cmp di, si jl xmem_forward @@ -101,9 +101,9 @@ xmem_done: pop bp sti ret -_xmemmove endp +xmemmove_ endp -_IPXopen_socket proc far +IPXopen_socket_ proc far push bp mov bp, sp push ds @@ -138,9 +138,9 @@ ipxopen_done: pop ds pop bp ret -_IPXopen_socket endp +IPXopen_socket_ endp -_IPXclose_socket proc far +IPXclose_socket_ proc far push bp mov bp, sp push ds @@ -159,9 +159,9 @@ _IPXclose_socket proc far pop ds pop bp ret -_IPXclose_socket endp +IPXclose_socket_ endp -_IPXlisten proc far +IPXlisten_ proc far push bp mov bp, sp push ds @@ -169,7 +169,7 @@ _IPXlisten proc far push di ; int IPXlisten(ECB *ecb) - les si, fword ptr [bp+6] + les si, dword ptr [bp+6] mov bx, @data mov ds, bx mov bx, 4 @@ -181,9 +181,9 @@ _IPXlisten proc far pop bp mov ah, 0 ret -_IPXlisten endp +IPXlisten_ endp -_Net_Call proc far +Net_Call_ proc far push bp mov bp, sp @@ -200,8 +200,8 @@ _Net_Call proc far push di pushf - lds si, fword ptr [bp+8] - les di, fword ptr [bp+12] + lds si, dword ptr [bp+8] + les di, dword ptr [bp+12] int 21h popf @@ -211,6 +211,6 @@ _Net_Call proc far pop bp mov ah, 0 ret -_Net_Call endp +Net_Call_ endp end diff --git a/tools.c b/tools.c old mode 100755 new mode 100644 index 4a68ae0..ff30402 --- a/tools.c +++ b/tools.c @@ -5,6 +5,35 @@ * (C)opyright (C) 1993,1996 Martin Stover, Marburg, Germany * ****************************************************************/ + +#ifdef __WATCOMC__ +/* + * Borland C compatibility wrappers used by the historical mars-nwe DOS tools. + * Open Watcom does not provide getcurdir()/setdisk() under these Borland names. + */ +int getcurdir(int drive, char *directory) +{ + REGS regs; + SREGS sregs; + + regs.h.ah = 0x47; /* DOS: get current directory */ + regs.h.dl = (unsigned char)drive; /* 0=current, 1=A:, 2=B:, ... */ + sregs.ds = FP_SEG(directory); + regs.x.si = FP_OFF(directory); + intdosx(®s, ®s, &sregs); + return(regs.x.cflag ? -1 : 0); +} + +void setdisk(int drive) +{ + REGS regs; + + regs.h.ah = 0x0e; /* DOS: select default drive */ + regs.h.dl = (unsigned char)drive; /* 0=A:, 1=B:, ... */ + intdos(®s, ®s); +} +#endif + int key_pressed(void) { #ifdef __WATCOMC__