$mod51

$nolist

$nosymbols

$include(i51ctrl.inc)

$include(i51hedr.inc)

$list

	org	codeaddr

start:	jmp	main

$include(i51misc.asm)

$include(i51strf.asm)

$include(i51rpck.asm)

$include(i51spck.asm)

$include(i51sakn.asm)

$include(i51sprm.asm)

$include(i51getv.asm)

$include(i51gpkt.asm)

$include(i51ncod.asm)

$include(i51file.asm)



main:	call	initialize



; send S with parameter table

	mov	Typ,#'S'

	call	send		; send init string

	call	getvp		; get response

;

; send F with filename

	mov	Typ,#'F'

	mov	dptr,#GDA

	clr	a

	movx	@dptr,a

	call	strcat

	db	'KERMIT.CAP',0	; default filename

	call	send		; send filename

	call	getvp		; get acknowledge

;

; send D with data

sndata:	call	getpkt

	jz	nmdata		; no more data

	mov	Typ,#'D'

	call	send

	call	getvp

	jmp	sndata		; loop

	

; no more data, send Z with no data

nmdata:	mov	Typ,#'Z'

	mov	dptr,#GDA

	clr	a

	movx	@dptr,a

	call	send		; send "no more data"

	call	getvp		; get acknowledge



; no more files, send B with no data

	mov	TYP,#'B'

	mov	dptr,#GDA

	clr	a

	movx	@dptr,a

	mov	TYP,#'B'

	call	send		; send "no more files"

	call	getvp		; get acknowledge



	jmp	sys_warm



$include(i51init.asm)

$include(i51data.asm)		; ram data

	end



	

