;SwitchMode (Switch the screen mode between 50Hz and 60Hz)
;Code: Zebedee/Carnage
;$VER: SwitchMode v1.02 (17-Oct-95)

	opt	o+
	section	ModeSwitch,code_c

ProgStart
	move.l	a0,a5
	move.l	d0,d5
	moveq.l	#0,d4
	move.l	4.w,a6
	lea	DosName(pc),a1
	moveq.l	#0,d0
	jsr	-$228(a6)		;OpenLibrary(a1,d0)exec
	move.l	d0,DosBAdr
	beq.b	BadDos
	move.l	d0,a6
	jsr	-$3c(a6)		;Output()dos
	move.l	d0,Output
	beq.b	Exit
	cmp.b	#'?',(a5)
	beq.b	ShowAbout
	cmpi.b	#1,d5
	beq.b	ShowUsage
	cmp.b	#'0',1(a5)
	bne.b	ShowBadParameter
	cmp.b	#'5',(a5)
	beq.b	Switch50Hz
	cmp.b	#'6',(a5)
	beq.b	Switch60Hz
	bra.b	ShowBadParameter
Exit	move.l	4.w,a6
	move.l	DosBAdr(pc),a1
	jsr	-$19e(a6)		;CloseLibrary(a1)exec
BadDos	move.l	d4,d0
	rts

ShowBadParameter
	move.l	DosBAdr(pc),a6
	move.l	Output(pc),d1
	lea	BadParm(pc),a2
	move.l	a2,d2
	moveq.l	#26,d3
	jsr	-$30(a6)		;Write(d1/d2/d3)dos
	moveq.l	#20,d4
	bra.b	Exit

ShowUsage
	move.l	DosBAdr(pc),a6
	move.l	Output(pc),d1
	lea	Usage(pc),a2
	move.l	a2,d2
	moveq.l	#26,d3
	jsr	-$30(a6)		;Write(d1/d2/d3)dos
	moveq.l	#20,d4
	bra.b	Exit

ShowAbout
	move.l	DosBAdr(pc),a6
	move.l	Output(pc),d1
	lea	About(pc),a2
	move.l	a2,d2
	moveq.l	#91,d3
	jsr	-$30(a6)		;Write(d1/d2/d3)dos
	bra.b	Exit

Switch50Hz
	move.w	#32,$dff1dc
	bra.b	Exit

Switch60Hz
	clr.l	$dff1dc
	bra.b	Exit

Version	dc.b	'$VER: SwitchMode v1.02 (17-Oct-95)',0
DosName	dc.b	'dos.library',0
DosBAdr	dc.l	0
Output	dc.l	0
About	dc.b	$9b,'0;1;4mSwitchMode v1.02 by Zebedee ©1995 Carnage (17-Oct-95)',$9b,'0m',$a,$a
Usage	dc.b	'Usage: SwitchMode <50|60>',$a,$a
BadParm	dc.b	'SWITCHMODE: Bad parameter',$a
	end