	TITLE	tcpint

	.386p

	include	..\..\..\net\h\data.inc

_BSS	segment dword public use32 'BSS'
rps_hand	db	?
	align	4
	db	512 dup (?)
savesp	dd	?
savess	dw	?
_BSS	ends

_DATA	segment dword public use32 'DATA'
	PUBLIC	_xdmsleeping
_xdmsleeping	db	0
_DATA	ends

DGROUP	group _BSS,_DATA

	extrn	netsleep_:near
	extrn	xdmsleep_:near
	extrn	_pkshared:DWORD

_TEXT	segment	dword public use32 'CODE'
	ASSUME	cs:_TEXT, ds:DGROUP

;myds	dw	?

	align	4
	public	sleep_init_
sleep_init_	proc near
	push	eax
	push	edx

	push	ds
	mov	edx,offset tcpint
	mov	ax,cs
	mov	ds,ax
	ASSUME	ds:_TEXT
	mov	ah,0e2h
	int	21h
	pop	ds
	ASSUME	ds:DGROUP
	mov	rps_hand,al

;	mov	es,word ptr _pkshared+4
;	mov	es:rps_handle,al

	pop	edx
	pop	eax
	ret
sleep_init_	endp

	public	tcp_int_
tcp_int_ proc near
	push	eax

	mov	gs,word ptr _pkshared+4
	mov	al,rps_hand
	mov	gs:rps_handle,al

	mov	al,1
	mov	_xdmsleeping,al
	pop	eax
	ret
tcp_int_	endp

	public	tcp_noint_
tcp_noint_ proc near
	push	eax

	mov	gs,word ptr _pkshared+4
	xor	al,al
	mov	gs:rps_handle,al

	xor	al,al
	mov	_xdmsleeping,al
	pop	eax
	ret
tcp_noint_ endp

tcpint	proc far
	push	eax
	push	ds
	push	es
	push	fs
	push	gs
	mov	ds,bx
	mov	es,bx

	mov	savess,ss
	mov	savesp,esp
	mov	ss,bx
	mov	esp,offset savesp

	call	netsleep_
	call	xdmsleep_

	mov	ss,savess
	mov	esp,savesp

	pop	gs
	pop	fs
	pop	es
	pop	ds
	pop	eax
	iretd
tcpint	endp

_TEXT	ends
	end
