
* DATE:	7/12/91
* TIME:	22:06
* NAME:	FULL SCREEN TEST
* CODE:	AXAL
* NOTE:	MADE SO IF NTSC SCREEN FOUND COMPUTER WILL RESET
*	THANKS TO TREVOR MENSAH FOR SENDING IN THE CODE TO ACC
*	ON HOW TO CHECK THE NTSC BUG.
*	NOW INCLUDES AN OPTION FOR ME TO PARK MY HD BEFORE RESET

*---------------------------------------

	move.l	a0,parameters		save address

	move.l	$4.w,a6			execbase
	lea	dosname(pc),a1		lib to open
	jsr	-552(a6)		open it
	move.l	d0,dosbase		save it
	beq	dos_error1		quit if fail to open

	move.l	d0,a6			copy pointer
	jsr	-60(a6)			get cliout put
	move.l	d0,cliout		and store it
	beq	dos_error2		quit if not opened

	move.l	#prgheadtxt,d2		address of text
	move.l	#prgheadend,d3		length of text
	bsr	print_con		print the text

	move.l	$4.w,a6			execbase
	cmpi.b	#50,530(a6)		test for pal screen
	beq	in_pal			if 50 then quit

	move.l	parameters(pc),a0	get address of data
	cmpi.b	#"-",(a0)+		check for inst
	bne.s	no_inst			branch if nothing there
	cmpi.b	#"p",(a0)+		check for hd park
	bne.s	no_inst			branch if nothing there

	move.l	#parkhdtxt,d2		text to print
	move.l	#parkhdend,d3		length of text
	bsr	print_con		print it

	move.l	dosbase(pc),a6		dos lib
	move.l	#parkhd,d1		command to run
	move.l	#0,d2			no input from cli
	move.l	cliout,d3		cli output
	jsr	-222(a6)		execute
no_inst
	move.l	#ntscfoundtxt,d2	text to print
	move.l	#ntscfoundend,d3	length of text
	bsr	print_con		print it
	move.w	#$500,d0		how long to wait
vblankloop
	move.w	$dff006,$dff180		show colour on screen
	cmpi.b	#$ff,$dff006		text vbl
	bne.s	vblankloop		loop until done
	btst	#6,$bfe001		test left mouse button
	beq.s	no_reset		if pressed then dont reset
	dbra	d0,vblankloop		continue

* RESET CODE TAKEN FROM HARDWARE MANUAL

	move.l	$4.w,a6			execbase
	lea.l	magicresetcode(pc),a5
	jsr	-30(a6)			super visor

	cnop	0,4
magicresetcode
	lea.l	2,a0
	reset
	jmp	(a0)
no_reset
	move.l	#breaktxt,d2		text to print
	move.l	#breakend,d3		length of text
	bsr	print_con		print it
	bra	dos_error2		and quit
in_pal
	move.l	#palfoundtxt,d2		text to print
	move.l	#palfoundend,d3		length of text
	bsr	print_con		print it
dos_error2
	move.l	$4.w,a6			execbase
	move.l	dosbase,a1		point to lib
	jsr	-414(a6)		close lib
dos_error1
	moveq	#0,d0			no errors
	rts

*---------------------------------------
* Text to print in d2 - Length of text in d3

print_con
	move.l	cliout,d1		cli handler
	move.l	dosbase,a6		dos library
	jsr	-48(a6)			print text
	rts

*---------------------------------------

dosname		dc.b	"dos.library",0
		even
dosbase		dc.l	0
cliout		dc.l	0
parameters	dc.l	0
parkhd		dc.b	"SYS:SYSTEM/PARK",0
		even
prgheadtxt	dc.b	10,$9b,$20,$70,$9b,'0;33;42',$6d
		dc.b	"Test PAL V1.1:",$9b,'3;32;40',$6d
		dc.b	"  Written by AXAL of ARMALYTE.",10,10
		dc.b	$9b,'0;31;40',$6d,$9b,$20,$70,0
prgheadend	equ	*-prgheadtxt
		even
palfoundtxt	dc.b	$9b,$20,$70,$9b,'0;33;40',$6d
		dc.b	"PAL SCREEN FOUND - EVERYTHING O.K."
		dc.b	$9b,'0;31;40',$6d,$9b,$20,$70,10,10,0
palfoundend	equ	*-palfoundtxt
		even
ntscfoundtxt	dc.b	$9b,$20,$70,$9b,'0;32;41',$6d
		dc.b	"NTSC SCREEN FOUND - PRESS LEFT MOUSE "
		dc.b	"BUTTON TO STOP RESET"
		dc.b	$9b,'0;31;40',$6d,$9b,$20,$70,10,10,0
ntscfoundend	equ	*-ntscfoundtxt
		even
breaktxt	dc.b	$9b,$20,$70,$9b,'0;33;42',$6d
		dc.b	"User break!!!!!!!"
		dc.b	$9b,'0;31;40',$6d,$9b,$20,$70,10,10,0
breakend	equ	*-breaktxt
		even
parkhdtxt	dc.b	$9b,$20,$70,$9b,'0;32;41',$6d
		dc.b	"PARKING HARD-DRIVE"
		dc.b	$9b,'0;31;40',$6d,$9b,$20,$70,10,10,0
parkhdend	equ	*-parkhdtxt
		even
