Files
mars-dosutils/ipx.asm
Mario Fetka 98ffa17006 ncpcalls: split IPX and requester assembly glue
Split the Open Watcom assembly glue into separate IPX and NCP requester
modules.

Keep the IPX socket and far-memory helper entry points in ipx.asm and move the
INT 21h Net_Call plus Client32 requester entry points into ncpcall.asm. Split
the former kern.h declarations accordingly into ipx.h and ncpcall.h, and update
net.h and the Open Watcom build to use the new headers and object files.

This matches the current source layout where ncpcall.c owns the low-level NCP
transport helpers and ncpapi.c owns the ncpXX_YY_* protocol API wrappers.

No behavior change.
2026-05-29 12:04:16 +02:00

211 lines
4.4 KiB
NASM

;
; mars-nwe-dosutils - NetWare/DOS utility tools.
;
; Copyright (C) 2026 Mario Fetka
; Copyright (C) 1993,1996 Martin Stover, Marburg, Germany
;
; This program is free software; you can redistribute it and/or
; modify it under the terms of the GNU General Public License
; as published by the Free Software Foundation; either version 2
; of the License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, see <http://www.gnu.org/licenses/>.
; Purpose: Open Watcom WASM/MASM-syntax IPX and far-memory helper glue.
; Depends on: ipx.h declarations, netcall.c callers and net.h shared types.
;
; ipx.asm
;
; Open Watcom WASM/MASM-syntax port of the IPX and xmemmove parts of
; the old TASM IDEAL kern.asm.
; Intended for 16-bit DOS large memory model builds on Linux with Open Watcom v2.
;
; Keep doc/kern.asm as the historical TASM source and use this split file for
; the reproducible Open Watcom build.
.286
.model large
.data
enterIPX dd 0
.code
public _IPXinit
public _IPXopen_socket
public _IPXclose_socket
public _IPXlisten
public _xmemmove
_IPXinit proc far
push bp
mov bp, sp
push ds
push si
push di
mov ax, 7A00h
int 2Fh
cmp al, 0FFh
jne ipxinit_done
mov cx, @data
mov ds, cx
mov word ptr enterIPX, di
mov ax, es
mov word ptr enterIPX+2, ax
mov al, 1
ipxinit_done:
mov ah, 0
pop di
pop si
pop ds
pop bp
ret
_IPXinit endp
_xmemmove proc far
push bp
mov bp, sp
; far procedure stack layout, large model:
; [bp+0] old bp
; [bp+2] return offset
; [bp+4] return segment
; [bp+6] z offset
; [bp+8] z segment
; [bp+10] q offset
; [bp+12] q segment
; [bp+14] nmbr
cli
mov cx, [bp+14]
or cx, cx
jz xmem_done
push ds
push si
push di
pushf
lds si, dword ptr [bp+10]
les di, dword ptr [bp+6]
cmp di, si
jl xmem_forward
std
dec cx
add di, cx
add si, cx
inc cx
jmp xmem_copy
xmem_forward:
cld
xmem_copy:
rep movsb
popf
pop di
pop si
pop ds
xmem_done:
pop bp
sti
ret
_xmemmove endp
_IPXopen_socket proc far
push bp
mov bp, sp
push ds
push si
push di
; int IPXopen_socket(UI sock, int live)
mov ax, [bp+8] ; live
mov dx, [bp+6] ; sock
mov bx, @data
mov ds, bx
mov bx, 0
call dword ptr enterIPX
cmp al, 0FFh
jne ipxopen_not_already
mov ax, -1 ; socket already open
jmp ipxopen_done
ipxopen_not_already:
cmp al, 0FEh
jne ipxopen_ok
mov ax, -2 ; socket table full
jmp ipxopen_done
ipxopen_ok:
mov ax, dx
ipxopen_done:
pop di
pop si
pop ds
pop bp
ret
_IPXopen_socket endp
_IPXclose_socket proc far
push bp
mov bp, sp
push ds
push si
push di
; void IPXclose_socket(UI sock)
mov dx, [bp+6]
mov bx, @data
mov ds, bx
mov bx, 1
call dword ptr enterIPX
pop di
pop si
pop ds
pop bp
ret
_IPXclose_socket endp
_IPXlisten proc far
push bp
mov bp, sp
push ds
push si
push di
; int IPXlisten(ECB *ecb)
les si, dword ptr [bp+6]
mov bx, @data
mov ds, bx
mov bx, 4
call dword ptr enterIPX
pop di
pop si
pop ds
pop bp
mov ah, 0
ret
_IPXlisten endp
end