#include <vstypes.h>
#include <vsrv.h>

#if 0
struct recBuf {
	s_int16 *wr;          /* Write pointer */
        s_int16 *rd;          /* Read pointer  */
        u_int16 *buf;         /* Buffer start  */
        u_int16 buffSize;     /* Buffer size   */
        u_int16 modifier;     /* modifier for buf */
	u_int16 *wrS;         /* Packet size WR   */
	u_int16 *rdS;         /* Packet size RD   */
	u_int16 *sizeBuf;     /* Packet Size buf  */
	u_int16 sizeBuffSize; /* Packet size size */
	u_int16 sizeModifier; /* Packet size mod  */
	__mem_y u_int16 *ethStart;
};
#endif

#if 0
	/*
	u_int16 GetPacketBytes(register __i2 __mem_y u_int16 *ethStart);
	*/

	.sect code,GetPacketBytes
	.export _GetPacketBytes
_GetPacketBytes:
	ldy (i2)+1, a0					// Dummy
	ldy (i2)+1, a0					// Dummy
	jr
	ldy (i2)+1, a0

	.sect code,CopyPacket
	.export _CopyPacket
	/*
	void CopyPacket(register __i2 struct rcvPkts  *rcv,
		 	register __c0 u_int16 byteCount);
	*/
_CopyPacket:
	ldx (i6)+1, null;	ldy (i2)+5, null	//i2: *wrS
	stx i0, (i6)+1;		sty i1, (i6)
	stx b0, (i6);		sty i3, (i6)

	sub c0, ones, b0;	ldx (i2)+4, i0		//i0: wrS b0: bytes +1
	asr b0, b0;   		ldx (i2)+1, i1		//i1: Smod b0: words
	add b0, ones, b0;	stx c0, (i0)*		//b0: words - 1
	ldc 32, c0
	jns $11
	ldx (i2)-5, i3					//i3: Eth i2: wrS

	add b0, c0, b0;		stx i0, (i2)-1		//b0: words + 32
	ldx (i2)-4, i1;		ldy (i3)+1, null	//i1: mod, Dummy 0
	ldx (i2), i0;		ldy (i3)+1, null	//10: wr,  Dummy 1

	loop b0, $3 - 1
	ldx (i6), b0;		ldy (i3)+1, c0

	stx c0, (i0)*;		ldy (i3)+1, c0		// !LOOP!
$3:
	stx i0, (i2);		ldy (i6)-1, i3
	jr
	ldx (i6)-1, i0;		ldy (i6), i1

$11:
	ldx (i6)-1, b0;		ldy (i6), i3
	jr
	ldx (i6)-1, i0;		ldy (i6), i1
#endif

.end
