;----------------------------------------------------------------------------
;File name:	TESTARGV.S		Revision date:	1995.07.30
;Creator:	Ulf Ronald Andersson	Creation date:	1992.11.30
;(c)1992 by:	Ulf Ronald Andersson	All rights reserved
;Released as:	FREEWARE		(NB: commercial sales forbidden!)
;----------------------------------------------------------------------------
;
	output	.GTP
;
	include	RA_APP.I
	include	RA_SIM.I
	include	RA_ARG.I
;
	start_app
;
init_app:
	start_arg
	rts
;
exec_app:
	move.l	arg_ptr(pc),a4	;a4 = arg_ptr
	move	arg_cnt(pc),d0	;d0 = arg_cnt
	move	d0,d5
	lea	arg_max_s(pc),a1
	bsr.s	convbyte
	subq	#1,d5			;prep for dbra
	clr	d3
.loop_1:
	addq	#1,d3
	lea	arg_num_s(pc),a1
	move	d3,d0
	bsr.s	convbyte
	lea	arg_s(pc),a1
	moveq	#28-1,d1
.loop_2:
	move.b	(a4)+,d0
	move.b	d0,(a1)+
	cmp.b	#' ',d0
	dbls	d1,.loop_2
	move.b	#' ',-1(a1)
	move.b	#'|',(a1)+
	subq	#1,a4
.loop_3:
	cmp.b	#' ',(a4)+
	bhi.s	.loop_3
	lea	alert_tail_s(pc),a0
.loop_4:
	move.b	(a0)+,(a1)+
	bne.s	.loop_4
	sim_aes	form_alert,#2,arg_alert_s(pc)
	tst	d5
	ble.s	main_exit
	dbra	d5,.loop_1
main_exit:
	rts
;
convbyte:
	and	#$ff,d0
	lsl	#4,d0
	lsr.b	#4,d0
	or	#'00',d0
	cmp.b	#'9',d0
	bls.s	.dig_0_ok
	add	#7,d0
.dig_0_ok:
	cmp	#'9F',d0
	bls.s	.dig_1_ok
	add	#$700,d0
.dig_1_ok:
	ror	#8,d0
	move.b	d0,(a1)
	rol	#8,d0
	move.b	d0,1(a1)
	rts
;
	make	SIM_links
;
	data
;
acc_name:	dc.b	'  Test ARGV 1.0',NUL
crlf_s:		dc.b	CR,LF,NUL
alert_tail_s:
	dc.b	'-----------------------------]'
	dc.b	'[   Yes   |  Right  |  Yeah   ]',NUL
arg_alert_s:
	dc.b	'[1]['
	dc.b	'_________ TestArgV __________|'
	dc.b	'Argument '
arg_num_s:
	dc.b		 '00 of '
arg_max_s:
	dc.b		       '00:           |'
	dc.b	'-----------------------------|'
arg_s:
	ds.b	512
	even
;
	bss
;
intin:		ds.w	30
intout:		ds.w	45
ptsin:		ds.w	30
ptsout:		ds.w	12
message:	ds.b	16
		ds.l	$100
mystack:	ds.l	4
;
;----------------------------------------------------------------------------
	End	;of file:	TESTARGV.S
