;File name:	SUBMIT.S		Revised:	1991.05.23
;Dissembled by:	URAn of Munin		Dissembled:	1991.09.20
;Program task:	Insert text into keyboard buffer
;
	include	TOS\URAn_SYS.s
	include	TOS\URAn_DOS.s
;
	text
rz:
bp	= rz-$100
;
start:
	move.l	4(sp),a6		;a6-> basepage
	xbios	Mshrink,!,(a6),#prog_end-bp
main:
	xbios	iorec,#1
	move.l	d0,a5			;a5-> kbd_iorec
	move.l	(a5),a4			;a4-> kbd_buffer
	move	#1,d6			;d6 = arg_index = 1
	clr.l	d7
	move.b	bp_arglen(a6),d7
	addq	#1,d7			;d7 = arg_limit
	cmp	(sp),d6
	bhi	L7E4
.l7a2:
	lea	bp_arglen(a6),a0
	clr.l	d0
	move.b	(a4,d6),d0		;d0 = arg_char
	move	d6,d0
	asl	#2,d0
	move.l	d0,(a4,d0)		;buffer[arg_index] = arg_char
	cmp	d7,d6
	bhs.s	L7E4
	addq	#1,d6
	bra.s	.l7a2
;
L7E4:
	clr	io_head_ix(a5)
	move	d7,io_tail_ix(a5)
	asl	#2,d7
	move.l	#CR,(a4,d7)
	gemdos	Pterm,!
;
;
prog_end:
;
;
	END	;of:	SUBMIT.S
