;$VER: Picasso II System Software Update Installer for the Picasso II 2.1Au ©1994
;********************************************************************************
;
; Update System Software Install Script for Picasso II for Expert Services (USA)
;  by: Robert Reiswig for/of Expert Services   ---> Date: January 10, 1994
;  Thanks to BE {what a ??} and SB (thanks for the Syquest, 4 testing 6 vers of OS)
;*********************************************************************************


;*******************************************************************
; Variable Set-up and do some system checking
;
;
;*******************************************************************

(set Pdisk1 "Picasso_D1:")
(set Pdisk2 "Picasso_D2:")
(set cpu (database "cpu"))
(set vblank (database "vblank"))
(set graphmem (database "graphics-mem"))
(set totmem (database "total-mem"))
(set osver (/ (getversion "LIBS:version.library") 65536))
(set tempdir "RAM:TestDisk")
(set IP "Install_Picasso:")
(set @default-dest "SYS:")
(set Update "PicassoUpdate:")
(set PVersion "2.0")
(set #LastDisk        "Picasso_D2:")
(set #FirstDisk       "Picasso_D1:")
(set #proceed   "Proceed")
(set #skip      "Skip")


( if (= osver 37) ( (set workbench "Workbench2.0:") (set extras "Extras2.0:") )
( if (= osver 38) ( (set workbench "Workbench2.1:") (set extras "Extras2.1:") )
( if (= osver 39) ( (set workbench "Workbench3.0:") (set extras "Extras3.0:") )
( if (= osver 40) ( (set workbench "Workbench3.1:") (set extras "Extras3.1:") )
( if (= osver 41) ( (set workbench "Workbench4.0:") (set extras "Extras4.0:") )
)))))


(set #change-startup-sequence
(cat "To boot with a " #Picasso "-Screen running OS version 2.0, 2.04, 2.05, it is "
     "necessary to manipulate your \"S:Startup-sequence\". O.K. to do "
     "it now?\nThis line will be added:\n\nrun >NIL: DEVS:Monitors/Picasso"
     "\n\n(If you are running a Virus Checker the watches the Startup-Sequence"
     " it may tell you that the Startup-Seqnece is being changed, this is normal.)"
))

(set #change-startup-sequence-help
(cat "Normaly, running OS version 2.0, 2.04, 2.05, the monitor files were startet "
     "before \"iprefs\" is started. Under OS 2.0x, the monitor files are "
     "only text files. But the " #Picasso " monitor file is a program (and "
     "that is O.K. under OS 2.1, 3.0, 3.x ...). That's the reason, why we "
     "have to start the file in a different way. But this must be done "
     "before \"iprefs\" comes up. There is no other way than inserting "
     "an additional line right after \"BindDrivers\" in the "
     "\"Startup-sequence\". The additional line will be\n\n"
     "    run >NIL: sys:WBStartup/Picasso\n\n"
))




;*******************************************************************
;  Make sure this system has everything if not tell to stop
;
;
;*******************************************************************

(if (< osver 37)
	(abort "You must use Kickstart 2.0 or higher to use the Picasso II")
)



(complete 5)

(welcome)

(complete 10)

(user 1)

(set #missing ("\nThere seems to be a problem with the Picasso II System Software. A piece of software is missing from you 'System' drive or partition.\n\n  You should 'Abort Install' and re-install with the new Picasso II Installer program.\n(Contact Expert Service if you don't have it yet.)\n\n  Do you wish to continue with the System software update for the Picasso II graphics card?"))

(if (< (exists "SYS:Expansion/Village.library") 1) (message (cat #missing "\n\n** SYS:Expansion/Village.library is missing. **")))
(if (< (exists "SYS:Libs/vilintuisup.library") 1)  (message (cat #missing "\n\n** SYS:Libs/vilintuisup.library is missing. **")))
(if (< (exists "SYS:WBStartup/ChangeScreen") 1)    (message (cat #missing "\n\n** SYS:WBStartup/ChangeScreen is missing. **")))
(if (< (exists "SYS:Devs/Monitors/Picasso") 1)     (message (cat #missing "\n\n** SYS:Devs/Monitors/Picasso is missing.**")))





;*******************************************************************
;  System Info & Installer Info  BBS NUMBER
;
;
;*******************************************************************


(complete 20)

(set things
    (askoptions
        (help "For help on any Picasso II products contact\n"
              "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
              "Expert Services\n7559 Mall Road\nFlorence, KY 40142 U.S.A.\n"
	      "TEL: 606-371-9690\nFAX: 606-282-5942\nBBS: 606-282-5943")
        (prompt "This is the Offical release of the Picasso II System software by EXPERT SERVICES. This is version 2.0.  The following are the offical release versions:\n\nvillage.library 2.53\nvilintuisup.library 2.7\nChangeScreen 1.45\nPICASSO firmware v1.43 (Monitor File)\n"
                " ")
        (choices " Update the Picasso II System Software")
        (default %00000000000000000000000000111111)
    )
)

(complete 30)


(if (= vblank "60") ((set blank "NTSC")) ((set blank "PAL")))
(set fastmem (- totmem graphmem))

(message "Basic System Check, This Machine Has\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
	 " \"" workbench "\" Version of OS\n\n"
	 " \"" cpu "\" Processor\n\n "
	 " \"" blank "\" Machine\n\n"
         " \"" graphmem  "\" Total Free Chip Memory\n\n"
	 " \"" fastmem  "\" Total Free Fast Memory\n\n  \"" totmem "\" Total Free Memory\n\n")





;*******************************************************************
;  Village.Library
;
;
;*******************************************************************


(complete 40)


(set vernum1 (getversion "SYS:Expansion/Village.library"))
(set ver1 (/ vernum1 65536))
(set rev1 (- vernum1 (* ver1 65536) ) )


(set vernum2 (getversion "Files/Village.library"))
(set ver2 (/ vernum2 65536))
(set rev2 (- vernum2 (* ver2 65536) ) )

(set pick 0)

(set pick (askchoice
		(choices "No, Don't update"  "Yes, Only if newer" "Yes, No matter what")
		(prompt ("'Village.library' is in SYS:Expansion\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nVersion Currently Installed   : %ld.%ld\n\nVersion From Update Disk/File : %ld.%ld\n\nDo you wish to install Version %ld.%ld of the 'Village.library' From Update Disk/File\n" ver1 rev1 ver2 rev2 ver2 rev2))
		(help "For help on any Picasso II products contact\n"
              "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
              "Expert Services\n7559 Mall Road\nFlorence, KY 40142 U.S.A.\n"
	      "TEL: 606-371-9690\nFAX: 606-282-5942\nBBS: 606-282-5943")
              (default 1)
	  )
)

(working)
(set x1 (getsum "Files/Village.library"))
(set x2 (getsum "SYS:Expansion/Village.library"))



(run "type >RAM:ExpertServices SYS:Expansion/village.library.info opt h")
(set runstring (cat (tackon #FirstDisk "c/search") " RAM:ExpertServices "))


(set runstring1 (cat runstring "\"R=64\""))   (if (= (run runstring1) 0) (set MonitorIS 64))
(set runstring1 (cat runstring "\"R=57\""))   (if (= (run runstring1) 0) (set MonitorIS 57))
(set runstring1 (cat runstring "\"R=48\""))   (if (= (run runstring1) 0) (set MonitorIS 48))
(set runstring1 (cat runstring "\"R=38\""))   (if (= (run runstring1) 0) (set MonitorIS 38))
(set runstring1 (cat runstring "\"R=35\""))   (if (= (run runstring1) 0) (set MonitorIS 35))
(set runstring1 (cat runstring "\"R=15\""))   (if (= (run runstring1) 0) (set MonitorIS 15))
(set runstring1 (cat runstring "\"CUSTOM\"")) (if (= (run runstring1) 0) (set MonitorIS 99))


( if (= MonitorIS 15)	( (set def 0) )
( if (= MonitorIS 31)	( (set def 1) )
( if (= MonitorIS 35)	( (set def 2) )
( if (= MonitorIS 38)	( (set def 3) )
( if (= MonitorIS 48)	( (set def 4) )
( if (= MonitorIS 57)	( (set def 5) )
( if (= MonitorIS 64)	( (set def 6) )
( if (= MonitorIS 99)	( (set def 7) )
))))))))



(if (= MonitorIS 99)
        (set MonitorIS2 "Custom")
        (set MonitorIS2 (cat MonitorIS "kHz"))
)


(set #ask-scanrate
(cat "Your maximum scan rate is currently set at " MonitorIS2
     ".\n Do you want to change it?\n\nIf you don't know what the maximum scanning rate is or you don't know anything about "
     "scan rates, please choose 31kHz!\n\nIf you have a 1084 or Equivalent hooked up to the Picasso II you must choose 15kHz."
))

(set #ask-scanrate-help
(cat "The horizontal scan rate is the number of lines a monitor can display "
     "in a second. 14\" monitors can often handle a maximum of "
     "38 kHz (newer ones sometimes 50 kHz), monitors with 16 or 17 inch tubes "
     "can often handle 57 kHz or (newer ones) even 64 kHz.\n\n"

     "Please BE AWARE:\n\n"
     "If you choose a higher scan rate than your monitor can handle, you will "
     "most certainly DESTROY your monitor!!! READ YOUR MONITOR MANUAL!!"
))






(if (= pick 1)
   (
    	(copylib
        	(prompt "Copying 'Village.library' to SYS:Expansion")
		(source "Files/Village.library")
        	(dest "SYS:Expansion")
        	(confirm)
        	(infos)
     	)


	(set vernum3 (getversion "SYS:Expansion/Village.library"))
	(set ver3 (/ vernum3 65536))
	(set rev3 (- vernum3 (* ver3 65536) ) )



	(if (<> vernum1 vernum3)
	     (

		(set scan (askchoice (choices "15 kHz" "31 kHz" "35 kHz" "38 kHz"
		                              "48 kHz" "57 kHz" "64 kHz" "Custom"
		     	  	     )
			  (prompt #ask-scanrate)
	                  (help   #ask-scanrate-help)
          		  (default def)
		     	  )
		)


		( if (= scan 0)	( (set scan1 "15kHz") )
		( if (= scan 1)	( (set scan1 "31kHz") )
		( if (= scan 2)	( (set scan1 "35kHz") )
		( if (= scan 3)	( (set scan1 "38kHz") )
		( if (= scan 4)	( (set scan1 "48kHz") )
		( if (= scan 5)	( (set scan1 "57kHz") )
		( if (= scan 6)	( (set scan1 "64kHz") )
		( if (= scan 7)	( (set scan1 "CUSTOM") )
		))))))))

		(tooltype (prompt "Click ok to change the Scan Rate for you monitor")
			  (help   "No help Available here.")
			  (settooltype "MONITOR" scan1)
			  (dest "SYS:Expansion/village.library")
		)
	     )
	)
   )
)



(if (= pick 2)
    (
	(copyfiles
        	(prompt "Copying 'Village.library' to SYS:Expansion")
		(source "Files/Village.library")
        	(dest "SYS:Expansion")
        	(confirm)
        	(infos)
   	)


	(set scan (askchoice (choices "15 kHz" "31 kHz" "35 kHz" "38 kHz"
		                              "48 kHz" "57 kHz" "64 kHz" "Custom"
		     	  	     )
			  (prompt #ask-scanrate)
	                  (help   #ask-scanrate-help)
          		  (default def)
		     	  )
		)


		( if (= scan 0)	( (set scan1 "15kHz") )
		( if (= scan 1)	( (set scan1 "31kHz") )
		( if (= scan 2)	( (set scan1 "35kHz") )
		( if (= scan 3)	( (set scan1 "38kHz") )
		( if (= scan 4)	( (set scan1 "48kHz") )
		( if (= scan 5)	( (set scan1 "57kHz") )
		( if (= scan 6)	( (set scan1 "64kHz") )
		( if (= scan 7)	( (set scan1 "CUSTOM") )
		))))))))

		(tooltype (prompt "Click ok to change the Scan Rate for you monitor")
			  (help   "No help Available here.")
			  (settooltype "MONITOR" scan1)
			  (dest "SYS:Expansion/village.library")
	)
    )
)



(complete 50)

;*******************************************************************
;  vilintuisup.library
;
;
;*******************************************************************


(set vernum1 (getversion "SYS:Libs/vilintuisup.library"))
(set ver1 (/ vernum1 65536))
(set rev1 (- vernum1 (* ver1 65536) ) )


(set vernum2 (getversion "Files/vilintuisup.library"))
(set ver2 (/ vernum2 65536))
(set rev2 (- vernum2 (* ver2 65536) ) )



(set pick 0)

(set pick (askchoice
		(choices "No, Don't update"  "Yes, Only if newer" "Yes, No matter what")
		(prompt ("'vilintuisup.library' is in Libs:\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nVersion Currently Installed   : %ld.%ld\n\nVersion From Update Disk/File : %ld.%ld\n\nDo you wish to install Version %ld.%ld of the 'vilintuisup.library' From Update Disk/File\n" ver1 rev1 ver2 rev2 ver2 rev2))
		(help "For help on any Picasso II products contact\n"
              "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
              "Expert Services\n7559 Mall Road\nFlorence, KY 40142 U.S.A.\n"
	      "TEL: 606-371-9690\nFAX: 606-282-5942\nBBS: 606-282-5943")
              (default 1)
	  )
)



(if (= pick 1)

    	(copylib
        	(prompt "Copying 'vilintuisup.library' to Libs:")
		(source "Files/vilintuisup.library")
        	(dest "SYS:Libs")
        	(confirm)
        	(infos)
     	)

)


(if (= pick 2)

    	(copyfiles
        	(prompt "Copying 'vilintuisup.library' to Libs:")
		(source "Files/vilintuisup.library")
        	(dest "SYS:Libs")
        	(confirm)
        	(infos)
     	)

)


;*******************************************************************
;  Plug for Screen Blanker and Warranty
;
;
;*******************************************************************
(complete 65)

(message "\nIf you have not sent in your registration card by now, this would be a good time to do so. When you do, you will get your Free copy of TV Paint Junior, a 24-Bit paint program.\n (If you did not receive it with your Picasso II.)\n\nMake sure you send your card in today!\n\nAre you are looking for a screen blanker that works 100% with you Picasso II?  Expert Services has one for you! If you would like information on 'CANVAS' give us a call at (606) 371-9690 !")
(message "Things to do:\n\n1) Call about upgrading to TVPaint Sr., a powerful 24 bit paint program.\n\n 2) Call about 1 MEG memory upgrade, we highly recommend certain memory types and can provide information and pricing."
         "\n\n3) Call about the Picasso II T-Shirt offer, a stylish 100% cotton T displaying the Picasso II Logo and the RTG definition for only $14.95.")




;*******************************************************************
;  ChangeScreen
;
;
;*******************************************************************

(complete 75)


;(set vernum (getversion "SYS:WBStartup/ChangeScreen"))
;(set ver (/ vernum 65536))
;(set rev (- vernum (* ver 65536) ) )


;(set vernum1 (getversion "Files/ChangeScreen"))
;(set ver1 (/ vernum1 65536))
;(set rev1 (- vernum1 (* ver1 65536) ) )

(working)
(set x1 (getsum "Files/ChangeScreen"))
(set x2 (getsum "SYS:WBStartup/ChangeScreen"))

(if (<> x2 x1)
     (

	(set pick (askchoice
			(choices "No" "Yes")
			(prompt ("'ChangeScreen' is in SYS:WBStartup\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n You have a different version of 'ChangeScreen' installed on your system [SYS:].\n\n Do you wish to install Version 1.45 of 'ChangeScreen' From Update Disk/File\n"))
			(help "For help on any Picasso II products contact\n"
		              "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
	              "Expert Services\n7559 Mall Road\nFlorence, KY 40142 U.S.A.\n"
		      "TEL: 606-371-9690\nFAX: 606-282-5942\nBBS: 606-282-5943")
	              (default 1)
	          )
	)

	(if (= pick 1)

    		(copyfiles
        		(prompt "Copying 'ChangeScreen' to SYS:WBStartup")
			(source "Files/ChangeScreen")
        		(dest "SYS:WBStartup")
        		(confirm)
	        	(infos)
     		)

	)
     )


     (message "'ChangeScreen' is in SYS:WBStartup\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nYou appear to have version 1.45 of 'ChangeScreen' installed on your system [SYS:].\n\nNothing to do here.\n")
)
;*******************************************************************
;  New English Changescreen AMIGAGUIDE
;
;*******************************************************************


(set Guide (askchoice (choices "Yes Install Changescreen.guide" "Don't Install Changescreen.guide")
			  (prompt  "Update Picasso comes with an English version of \"Changescreen.guide\". Do you wish to install this?")
	                  (help    "Do you wish to install an English version of Changescreen.guide?")
          		  (default 0)
		     	  )
)


(if (= Guide 0)

	(copyfiles (prompt (cat "Copying Changescreen.guide"))
	           (source  "Files/Changescreen.guide")
	           (infos)
	           (dest (askdir (prompt "Where do you wish to install \"Changescreen.guide\"? (There should be a directory in your Picasso drawer called \"Guide\", just select it. If not, just pick a directory where you wish to put it.)")
			 (help   "Where do you wish to install Changescreen.guide?")
			 (default "Work:PicassoII/Guide")
		         )
                   )
	           (optional) ; don't break if error
	)
)


;*******************************************************************
;  Picasso Monitor File
;
;
;*******************************************************************

(complete 90)


;(set vernum3 (getversion "SYS:Devs/Monitors/Picasso"))
;(set ver3 (/ vernum3 65536))
;(set rev3 (- vernum3 (* ver3 65536) ) )


;(set vernum4 (getversion "Files/Picasso"))
;(set ver4 (/ vernum4 65536))
;(set rev4 (- vernum4 (* ver4 65536) ) )




(if (< (exists "DEVS:Monitors") 2)
   (makedir "DEVS:Monitors" (infos))
)



(if (= osver 37)
 (
  (set runstring (cat (tackon #FirstDisk "c/search")
	         (cat " Sys:S/Startup-sequence " "/Picasso")
	         )
  )


  (if (= (run runstring) 5)
      (
	 (if (= (askbool (prompt  #change-startup-sequence)
	        (help    #change-startup-sequence-help)
		(default 1)
		(choices #proceed #skip)
	        )
             )

         )
         (   (set runstring (cat (tackon #FirstDisk "c/edit")
			    " S:Startup-Sequence WITH="
			    (tackon "Files/edit_input")
		            )
             )
             (run runstring)
         )
      )

;** It's there
      (
	 (if (= (askbool (prompt  "The Startup-sequence has previously been altered by the Picasso II installer. It may have old commands in it, therefor it may need to be cleaned up. Is it ok to do so? "
                                  " If ok, this line will be added:\n\nrun >NIL: DEVS:Monitors/Picasso\n\n(If you are running a Virus Checker the watches the Startup-Sequence"
                                  " it may tell you that the Startup-Seqnece is being changed, this is normal.)")
	        (help    #change-startup-sequence-help)
		(default 1)
		(choices #proceed #skip)
	        )
             )

          (

	   (set runstring (cat (tackon #FirstDisk "c/search")
	                  (cat " Sys:S/Startup-sequence " "/Picasso")
	                  )
           )

	   (while (<> (run runstring) 5)
         	  (   (set runstring (cat (tackon #FirstDisk "c/edit")
			      " S:Startup-Sequence WITH="
			      (tackon "Files/delete_input")
		              )
                       )
                      (run runstring)
                      (set runstring (cat (tackon #FirstDisk "c/search")
	              (cat " Sys:S/Startup-sequence " "/Picasso")
	                             )
                      )
		  )

	   )

           (   (set runstring (cat (tackon #FirstDisk "c/edit")
			    " S:Startup-Sequence WITH="
			    (tackon "Files/edit_input")
		            )
               )
               (run runstring)
           )

	  )


      )

     )
  )
 )
)


(working)
(set x1 (getsum "Files/Picasso"))
(if (exists "SYS:Devs/Monitors/Picasso")
 (set x2 (getsum "SYS:Devs/Monitors/Picasso"))
)



(if (<> x2 x1)
     (

	(set pick (askchoice
			(choices "No" "Yes")
			(prompt ("'Picasso' is in SYS:Devs/Monitors\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n You have a different version of 'Picasso' (Monitor File) installed on your system [SYS:].\n\n Do you wish to install Version 1.43 of 'Picasso' (Monitor File) From Update Disk/File\n"))
			(help "For help on any Picasso II products contact\n"
		              "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
	              "Expert Services\n7559 Mall Road\nFlorence, KY 40142 U.S.A.\n"
		      "TEL: 606-371-9690\nFAX: 606-282-5942\nBBS: 606-282-5943")
	              (default 1)
	          )
	)

	(if (= pick 1)

    		(copyfiles
        		(prompt "Copying 'Picasso' to SYS:Devs/Monitors")
			(source "Files/Picasso")
        		(dest "SYS:Devs/Monitors")
        		(confirm)
	        	(infos)
     		)

	)
     )


     (message "'Picasso' (Monitor File) is in SYS:Devs/Monitors\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nYou appear to have version 1.43 of 'Picasso' (Monitor File) installed on your system [SYS:].\n\nNothing to do here.\n")
)



(if (exists "SYS:WBStartup/Picasso")
 (delete "SYS:WBStartup/Picasso")
)

(if (exists "SYS:WBStartup/Picasso.info")
 (delete "SYS:WBStartup/Picasso.info")
)


;*******************************************************************
;  The end
;  "We must be smarter than the paper we write on" -D @ DPS
;*******************************************************************
(complete 95)

(set scan (askchoice (prompt  "Expert Service is continually building a database of monitors that are compatiable with the Picasso II."
			      " If you would like your monitor to be added to the database please fill out the following and send to"
		              " Expert Services by US Mail, E-Mail, BBS or Fax. (The Database will be in AmigaGuide format on the BBS.)\n"
			      " (The Form is called 'MonitorForm' in Files.)")
                     (choices "YES, Print the Monitor Form" "NO, Don't Print")
		     (help   "Do you want the Monitor for to be printed")
          	     (default 0)
	  )
)


( if (= scan 0)
	(
	   (run "copy Files/MonitorForm to PRT:")
        )
)






(complete 99)

(message "Update Complete\n~~~~~~~~~~~~~~~~~~~~~~~\nWe would like to thank you again for your purchase of the Picasso II RTG Graphics Card.  Keep an eye open for new and exciting things for your Picasso II.\n\nAlso look for other exciting produtcs from Expert Services comming soon for your Commodore Amiga.\n\nExpert Services\n7559 Mall Road\nFlorence, KY 40142 U.S.A.\nTEL: 606-371-9690   FAX: 606-282-5942\nBBS: 606-282-5943")


(complete 100)

(set scan (askchoice (choices "Reboot Now to use New System Software" "Return back to Operating System")
			 (prompt "\nIn order to take advantage of the new Picasso II system software you will need to reboot the system.\n\n")
	                 (help   "Reboot to take advantage of the new Software!")
          		 (default 0)
	  )
)


( if (= scan 0)
	(
	   (run "Files/Reboot")
        )
)


(exit)

