	opt	l-,c+,d+
	INCDIR	":INCLUDE/"

	INCLUDE	EXEC/EXEC_LIB.I
	INCLUDE	LIBRARIES/DOS_LIB.I
	INCLUDE	LIBRARIES/DOS.I
	INCLUDE	EXEC/MEMORY.I


START
	MOVE.L	#dosname,A1			;name of library
	MOVEQ	#0,D0				;dont care
	CALLEXEC	OpenLibrary		;open library
	TST.L	D0				;test for error
	BEQ	QUIT_FAST			;if error quit fast
	MOVE.L	D0,_DOSBase			;store library pointer

	CALLDOS	Output
	move.l	d0,d4
	move.l	d4,d1
	move.l	#message,d2
	move.w	#stringlen,d3
	CALLDOS	Write

test_left
	btst	#6,$bfe001
	bne	test_right
	bra	loadcheat

test_right
	btst	#$000a,$dff016
	bne	test_left
	bra	load

loadcheat
	move.l	#nameload1,d1
	CALLDOS	LoadSeg
	move.l	d0,_store

	MOVE.L	_store,d3
	move.l	#nameload1,d1
	clr.l	d2
	move.l	#$000007d0,d4
	CALLDOS	CreateProc


	move.l	_DOSBase,a1
	CALLEXEC	CloseLibrary
	rts
	
load

	MOVE.L	#NAMELOAD,D1			;name of file to open
	CALLDOS	LoadSeg				;open file
	MOVE.L	D0,_store

	MOVE.L	_store,d3
	move.l	#NAMELOAD,d1
	clr.l	d2
	move.l	#$000007d0,d4
	CALLDOS	CreateProc


QUIT_FAST
	move.l	_DOSBase,a1
	CALLEXEC	CloseLibrary
	rts

				;put file handel in d1
_DOSBase	DC.L	0

dosname DOSNAME
	EVEN
NAMELOAD	dc.b "bionic",0
	EVEN
nameload1	dc.b "bionic1",0
	EVEN
_store	DC.L	0
	EVEN
message dc.b	   'BIONIC COMMANDO TRAINER    ',10
	dc.b	'PRESS LEFT BUTTON FOR TRAINER',10
	dc.b	'PRESS RIGHT BUTTON FOR NORMAL',10
	dc.b	'THANKS TO TERRY FOR CRACKING',10
	EVEN
stringlen	equ	*-message
	EVEN



