; Send a packet with data in GDA of length L, type TYP, sequence N.

spack:	mov	dptr,#sndbuf
	mov	a,#1
	movx	@dptr,a		; MARK field
	inc	dptr
	mov	r3,dpl		; save chkl start
	mov	a,Len
	add	a,#35		; len + 3 + 32
	movx	@dptr,a		; LENgth of packet field
	inc	dptr
	mov	a,N
	tochar			; add 32
	movx	@dptr,a		; SEQuence # field
	inc	dptr
	mov	a,Typ
	movx	@dptr,a		; TYPe field
	inc	dptr
	mov	p2,#high GDA	; high data string
	mov	r0,#low GDA	; low data string
L6020:	movx	a,@r0		; get char from D
	jz	L6030
	movx	@dptr,a		; put char in sndbuf
	inc	r0
	inc	dptr
	sjmp	L6020
L6030:	clr	a		; terminate for chkl
	movx	@dptr,a		; leave room for checksum
	mov	r4,dpl		; save check pointer
	inc	dptr
	mov	a,EOL
	movx	@dptr,a		; EOL field
	inc	dptr
	clr	a
	movx	@dptr,a		; terminate string
	mov	dpl,r3
	call	chkl
	tochar			; add 32
	mov	dpl,r4		; get check pointer
	movx	@dptr,a		; insert checksum
; send it to remote
	mov	dptr,#sndbuf
	call	sys_print
	ret

