JMP	S

;************************************************
;*****                                      *****
;*****    JOHOO!    EN FUNGERANDE LOADER    *****
;*****                                      *****
;************************************************

FILENAME:	DC.B	'LOADER.S',$00
EVEN
DEST=$60000



S:
	JSR	OPENDOS
	MOVE.L	#FILENAME,D1
	JSR	PREPARE
	MOVE.L	#DEST,D2
	MOVE.L	#FILENAME,D1
	JSR	LOADIT
RTS:	RTS


LOADIT:	MOVE.L	B48,A6
	MOVEM.L	D1-D3,-(A7)
	MOVE.L	#$3ED,D2
	JSR	-30(A6)
	MOVEM.L	(A7)+,D1-D3
	MOVE.L	D0,B44
	TST.L	D0
	BEQ	RTS
	MOVEM.L	D1-D3,-(A7)
	MOVE.L	B44,D1
	JSR	-42(A6)
	MOVEM.L	(A7)+,D1-D3
	MOVE.L	B44,D1
	JSR	-36(A6)
	RTS



PREPARE:MOVE.L	D1,-(A7)
	MOVE.L	B48,A6
	MOVE.L	#$FFFFFFFE,D2
	JSR	-84(A6)
	MOVE.L	D0,B40
	MOVE.L	B40,D1
	MOVE.L	B3C,D2
	JSR	-102(A6)
	MOVE.L	B40,D1
	JSR	-90(A6)
	MOVE.L	B3C,A2
	MOVE.L	124(A2),D3
	TST.W	D3
	BNE	PREP_0
	SWAP	D3
PREP_0:	MOVE.L	(A7)+,D1
	RTS



OPENDOS:MOVE.L	$04,A6
	MOVE.L	#DOS,A1
	JSR	-408(A6)
	MOVE.L	D0,B48
	RTS

DOS:	DC.B	'dos.library',$00



B3C:	DC.L	$60000
B40:	DC.L	$0
B44:	DC.L	$0
B48:	DC.L	$0
