; Amiga Computing in conjunction with INOVAtronics and Checkmate Digital
; bring you the most powerful and easy to use Software Authoring tool 
; available on your Amiga. Please follow the instructions and you will have 
; a three disk set of CanDo 1.5 for evaluation. If you wish to have the 
; CanDo 1.5 Test Drive manual, please send a cheque for £10.00 to Checkmate
; at the address in the READMEFIRST file.

; written by Eddie Churchill c/o INOVAtronics, Inc.
;  12:51:08 01 Aug 1991
; we need the following commands (1.3 or 2.0 will do)
;  FailAt, If..Else..EndIf, Skip, Lab, Echo, Copy, Path, Cd,
;  Ask, Relabel, Install, IconX, Assign, Execute, AvailMem
;  and UnLZ

; some initial settings
failat 21

; initial startup
if exists ram:threedisks.txt
	type ram:threedisks.txt
else
	echo " "
	echo "CanDo TestDrive Unpacker..."
	echo " copyright 1991 by INOVAtronics, Inc."
	echo " !!! You will need THREE BLANK FORMATTED DISKS. !!!"
endif
ask "Press <RETURN> to continue, anything else to quit"
if warn
	echo " "
	echo "You requested to quit"
	skip error
endif

; copy needed files to ram:
echo " "
echo "First lets copy the needed files..."
echo "  copying text files to ram:"
copy from df0:TextFiles to ram: All Clone Quiet
echo "  copying support files to ram:"
copy from df0:SupportFiles to ram: All Clone Quiet
path ram: add
cd ram:

; check memory configuration
AvailMem -q 1000000
if Warn
	echo " Oops, found low memory, trying DIET mode"
	skip lowmemory
else
	echo " Hey, found lots of memory, going into HOG mode"
endif

; ***** memory hog mode
; copy needed files to ram:
echo "  copying archived files to ram:"
copy from df0:ArchivedFiles to ram: All Clone Quiet

; initial startup
if exists ram:initstartup.txt
	type ram:initstartup.txt
else
	echo " "
	echo "Please Remove the TestDrive disk from DF0:"
endif
ask "Press <RETURN> to continue, anything else to quit"
if warn
	echo " "
	echo "You requested to quit"
	skip error
endif

; now start on the cando disk
if exists ram:startcando.txt
	type ram:startcando.txt
else
	echo " "
	echo "Please Insert a Blank Formatted Floppy Disk in the DF0:"
endif
ask "Press <RETURN> to continue, anything else to quit"
if warn
	echo " "
	echo "You requested to quit"
	skip error
endif

cd df0:
if warn
	echo " "
	echo "Error: Having problems with the blank formatted disk in DF0:"
	skip error
endif

UnLZ -x x ram:CanDoDisk.lzh
if warn
	echo " "
	echo "Error: while unarchiving the CanDo disk."
	skip error
endif

cd ram:
relabel df0: CanDo
if warn
	echo " "
	echo "Error: could not rename the disk in DF0:"
	skip error
endif

install df0:
if warn
	echo " "
	echo "Error: could not install the disk in DF0:"
	skip error
endif

if exists ram:finishcando.txt
	type ram:finishcando.txt
else
	echo " "
	echo "Remove the disk 'CanDo' from DF0:"
endif
ask "Press <RETURN> to continue, anything else to quit"
if warn
	echo " "
	echo "You requested to quit"
	skip error
endif

; now start on the candoextras disk
if exists ram:startcandoextras.txt
	type ram:startcandoextras.txt
else
	echo " "
	echo "Please Insert a Blank Formatted Floppy Disk in the DF0:"
endif
ask "Press <RETURN> to continue, anything else to quit"
if warn
	echo " "
	echo "You requested to quit"
	skip error
endif

cd df0:
if warn
	echo " "
	echo "Error: Having problems with the blank formatted disk in DF0:"
	skip error
endif

UnLZ -x x ram:ExtrasDisk.lzh
if warn
	echo " "
	echo "Error: while unarchiving the CanDoExtras disk."
	skip error
endif

cd ram:
relabel df0: CanDoExtras
if warn
	echo " "
	echo "Error: could not rename the disk in DF0:"
	skip error
endif

if exists ram:finishcandoextras.txt
	type ram:finishcandoextras.txt
else
	echo " "
	echo "Remove the disk 'CanDoExtras' from DF0:"
endif
ask "Press <RETURN> to continue, anything else to quit"
if warn
	echo " "
	echo "You requested to quit"
	skip error
endif

; now start on the candomanual disk
if exists ram:startcandomanual.txt
	type ram:startcandomanual.txt
else
	echo " "
	echo "Please Insert a Blank Formatted Floppy Disk in the DF0:"
endif
ask "Press <RETURN> to continue, anything else to quit"
if warn
	echo " "
	echo "You requested to quit"
	skip error
endif

cd df0:
if warn
	echo " "
	echo "Error: Having problems with the blank formatted disk in DF0:"
	skip error
endif

UnLZ -x x ram:ManualDisk.lzh
if warn
	echo " "
	echo "Error: while unarchiving the CanDoManual disk."
	skip error
endif

cd ram:
relabel df0: CanDoManual
if warn
	echo " "
	echo "Error: could not rename the disk in DF0:"
	skip error
endif

if exists ram:finishcandomanual.txt
	type ram:finishcandomanual.txt
else
	echo " "
	echo "Remove the disk 'CanDoManual' from DF0:"
endif
ask "Press <RETURN> to continue, anything else to quit"
if warn
	echo " "
	echo "You requested to quit"
	skip error
endif
skip finished

; ***** lowmemory version of install
lab lowmemory
AvailMem -q 600000
if warn
	echo " "
	echo "There is not enough memory to unarchive."
	skip error
endif

; verify that the disk is write protected
echo " "
echo "Please Make Sure Your TestDrive Disk is WriteProtected"
ask "Press <RETURN> to continue, anything else to quit"
if warn
	echo "You requested to quit"
	skip error
endif

; alternate initial startup
if exists ram:altstartup.txt
	type ram:altstartup.txt
else
	echo " "
	echo "About to startup the unarchiving."
endif
ask "Press <RETURN> to continue, anything else to quit"
if warn
	echo " "
	echo "You requested to quit"
	skip error
endif

; copy the archive to ram, the testdrive disk should be inserted at this time
echo "copying the CanDoDisk archive to ram:"
copy df0:ArchivedFiles/CanDoDisk.LZH ram:
if warn
	echo " "
	echo "Error: error while copying CanDoDisk.lzh"
	skip error
endif

; now start on the cando disk
if exists ram:startcando.txt
	type ram:startcando.txt
else
	echo " "
	echo "Please Insert a Blank Formatted Floppy Disk in the DF0:"
endif
ask "Press <RETURN> to continue, anything else to quit"
if warn
	echo " "
	echo "You requested to quit"
	skip error
endif

cd df0:
if warn
	echo " "
	echo "Error: Having problems with the blank formatted disk in DF0:"
	skip error
endif

UnLZ -x x ram:CanDoDisk.lzh
if warn
	echo " "
	echo "Error: while unarchiving the CanDo disk."
	skip error
endif

cd ram:
relabel df0: CanDo
if warn
	echo " "
	echo "Error: could not rename the disk in DF0:"
	skip error
endif

install df0:
if warn
	echo " "
	echo "Error: could not install the disk in DF0:"
	skip error
endif

if exists ram:finishcando.txt
	type ram:finishcando.txt
else
	echo " "
	echo "Remove the disk 'CanDo' from DF0:"
endif
ask "Press <RETURN> to continue, anything else to quit"
if warn
	echo " "
	echo "You requested to quit"
	skip error
endif
	
; now delete the archive from ram:
delete ram:candodisk.lzh
if warn
	echo " "
	echo "Error: while deleting CanDoDisk.LZH"
	skip error
endif

; copy the archive to ram
echo " "
echo "Please Insert the TestDrive disk in DF0:"
ask "Press <RETURN> to continue, anything else to quit"
if warn
	echo "You requested to quit"
	skip error
endif

if not exists df0:archivedfiles
	echo " "
	echo "Error: could not find archived files on DF0:"
	skip error
endif

echo "copying the CanDoExtras archive to ram:"
copy df0:ArchivedFiles/ExtrasDisk.LZH ram:
if warn
	echo " "
	echo "Error: error while copying ExtrasDisk.lzh"
	skip error
endif

; now start on the candoextras disk
if exists ram:startcandoextras.txt
	type ram:startcandoextras.txt
else
	echo " "
	echo "Please Insert a Blank Formatted Floppy Disk in the DF0:"
endif
ask "Press <RETURN> to continue, anything else to quit"
if warn
	echo " "
	echo "You requested to quit"
	skip error
endif

cd df0:
if warn
	echo " "
	echo "Error: Having problems with the blank formatted disk in DF0:"
	skip error
endif

UnLZ -x x ram:ExtrasDisk.lzh
if warn
	echo " "
	echo "Error: while unarchiving the CanDoExtras disk."
	skip error
endif

cd ram:
relabel df0: CanDoExtras
if warn
	echo " "
	echo "Error: could not rename the disk in DF0:"
	skip error
endif

if exists ram:finishcandoextras.txt
	type ram:finishcandoextras.txt
else
	echo " "
	echo "Remove the disk 'CanDoExtras' from DF0:"
endif
ask "Press <RETURN> to continue, anything else to quit"
if warn
	echo " "
	echo "You requested to quit"
	skip error
endif
	
; now delete the archive from ram:
delete ram:extrasdisk.lzh
if warn
	echo " "
	echo "Error: while deleting ExtrasDisk.LZH"
	skip error
endif

; copy the archive to ram
echo " "
echo "Please Insert the TestDrive disk in DF0:"
ask "Press <RETURN> to continue, anything else to quit"
if warn
	echo "You requested to quit"
	skip error
endif

if not exists df0:archivedfiles
	echo " "
	echo "Error: could not find archived files on DF0:"
	skip error
endif

echo "copying the CanDoManual archive to ram:"
copy df0:ArchivedFiles/ManualDisk.LZH ram:
if warn
	echo " "
	echo "Error: error while copying ManualDisk.lzh"
	skip error
endif

; now start on the candomanual disk
if exists ram:startcandomanual.txt
	type ram:startcandomanual.txt
else
	echo " "
	echo "Please Insert a Blank Formatted Floppy Disk in the DF0:"
endif
ask "Press <RETURN> to continue, anything else to quit"
if warn
	echo " "
	echo "You requested to quit"
	skip error
endif

cd df0:
if warn
	echo " "
	echo "Error: Having problems with the blank formatted disk in DF0:"
	skip error
endif

UnLZ -x x ram:ManualDisk.lzh
if warn
	echo " "
	echo "Error: while unarchiving the CanDoManual disk."
	skip error
endif

cd ram:
relabel df0: CanDoManual
if warn
	echo " "
	echo "Error: could not rename the disk in DF0:"
	skip error
endif

if exists ram:finishcandomanual.txt
	type ram:finishcandomanual.txt
else
	echo " "
	echo "Remove the disk 'CanDoManual' from DF0:"
endif
ask "Press <RETURN> to continue, anything else to quit"
if warn
	echo " "
	echo "You requested to quit"
	skip error
endif

; now delete the archive from ram:
delete ram:extrasdisk.lzh
if warn
	echo " "
	echo "Error: while deleting ExtrasDisk.LZH"
	skip error
endif
skip finished

; ***** normal finish
lab finished
if exists ram:alldone.txt
	type ram:alldone.txt
else
	echo " "
	echo "All finished, boot with the CanDo disk and away you go."
endif
ask "Press return to finish"
if warn
endif
skip done

; ***** error handler
lab error
; what should happen here?

; ***** actual finishing line
lab done


endcli
