linput:	mov	dptr,#rcvbuf
linp1:	push	dpl
	push	dph
	call	sys_getc
	pop	dph
	pop	dpl
	movx	@dptr,a
	inc	dptr
	cjne	a,#cr,linp1
	clr	a
	movx	@dptr,a		; string terminator
	ret
;
;=========================================
;
blkchk:	mov	b,a		; save check
	anl	a,#192
	swap	a
	rr	a
	rr	a		
	anl	a,#3		; a = a / 64
	add	a,b		; add check
	anl	a,#63
	ret
;
; compute arithmetic sum
chksum:	mov	r2,#0
	mov	r3,#0ffh
	jnb	parity,cs1
	mov	r3,#07fh
cs1:	movx	a,@dptr
	jz	cs2
	anl	a,r3
	add	a,r2
	mov	r2,a
	inc	dptr
	sjmp	cs1
cs2:	mov	a,r2
	ret
;
; calculate kermit checksum, dptr has string start
chkl:	call	chksum
	call	blkchk
	ret
;
