; G.I.P. EXE v1.7
; MAXIS GENERAL INSTALLER PROGRAM AND SCRIPT (G.I.P.)
; COPYRIGHT (c)1995 MAXIS, INC.
; Written by Micheal Perry,Andre Snegov,Chris Weiss,Mike Gilmartin
; LAST UPDATE - 8/30/95 - Mike Perry
; THIS SCRIPT IS FOR SimIsle: Missions In THe Rainforest                                 


;SJP Test exist file stuff.
;write_success_file()
;write_sound_file()
;exit("")
;SJP Test exist file stuff End.


startup($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)
	
can_we_execute(200,60) ;memory required after GIP starts

$dir="\SimIsle"

check_video(VGA)
check_RAM(8192)
check_CPU(486)
check_for_windows()


; Find the .CFG file to see if they just want to change options

	$=find("SimIsle.CFG")
	if $#"" {goto fromharddisk}


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
fromfloppydisk:

continue("You are now approaching SimIsle, Welcome. ")


register_user()
remind_registration()
install_options()
select_install()

; Check to see the size required on the HD for full/partial installs

;$size="4000"      ; SimIsle 4000 + installation needs for partial install
; If full install, change space requirements.
$size="7000"

choose_destination()

set(y,85)

$9=strcat($drive,$dir)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This is where we'll copy the files

; Copy all files that MUST be installed here
copy ("$loadpath\MAXIS.CIM","MAXIS.CIM")
copy ("$loadpath\POSTCARD.CIM","POSTCARD.CIM")
copy ("$loadpath\INST.EXE", "INST.EXE")
copy ("$loadpath\INSTALL.BAT", "INSTALL.BAT")
copy ("$loadpath\BOOTDISK.EXE","BOOTDISK.EXE")
copy ("$loadpath\README.TXT","README.TXT")
;extract("game.pak")
extract_to_parkys_subdir(".","game.pak")
extract_to_parkys_subdir(".","game2.pak")
extract_to_parkys_subdir(".","game3.pak")
extract_to_subdir("rand_map","randmap.pak")
;extract_to_subdir("savegame","save.pak")
set(error,no) md ("savegame") set(error,yes)
     
     
     
     

;if $partial_install= "YES" {goto done_copying()}

   

; This is where we're done copying the files.
done_copying:

set(y,50)

video_priority()

if $vname = "FAILED" { setup_video() }
	
;setup_sound()
;exec("$loadpath\setsound.exe") 
set(y,85)

set(y,50)

write_config_file()
	
patch_name()

click_OK(
"                 Installation Complete!
 Please don't forget to check out the README.TXT file! 
 It contains plenty of important information and 
 troubleshooting hints. Type README at the DOS prompt
 to view it. Enjoy SimIsle !")
write_success_file()
 exit("")


fromharddisk:
	
;write_success_file()
write_sound_file()

abort_box(
"  SimIsle is already
 installed. To change the
 sound use SETSOUND.")


continue("SimIsle Settings Utility")
	
read_config_file()
	
change_settings()

;write_config_file()

	
click_OK(
" Enjoy SimIsle!")

	exit("")

maxis_installer:

$maxis="* Maxis Presents - SimIsle(TM): Missions In The Rainforest  *"
set(y,5) 
set(background,LIGHTGREEN) ; was lightgray
set(color,GREEN); was blue 
if $video=HERCMONO {set(color,BLACK)}
if $video=MCGA {set(color,BLACK)}
set(open,yes) 
set(save,no)
say ($maxis)
return ()


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Check to see if they want to auto-detect everything

install_options:

return()
set(window,$screen)
set(background,LIGHTGRAY)
set(font,normal)

$express=say("
	
    Select Install to continue.
    
	 %%%%%%%%%%%%%%%

","INSTALL")


wclose()
set(window,$screen)
     
return()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
extract_to_parkys_subdir: ;;; (subdir_name,archive_name)

	; Prevent system error when creating already existing dir
	set(error,no) md ($0) set(error,yes)
	cd ($0)
	extract ("$loadpath\$1")
	return()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
extract_to_subdir: ;;; (subdir_name,archive_name)

	; Prevent system error when creating already existing dir
	set(error,no) md ($0) set(error,yes)
	cd ($0)
	extract ("$loadpath\$1")
	cd("..")
	return()


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Are we running under Windows?

check_for_windows:

$1=""
set (ERROR, no)
$1=getenv(windir)
if ERROR {
set(ERROR,yes)
return()}
;set (ERROR, yes)
say(
" You are currently running in a Windows DOS Shell.
  SimIsle may not run or install in a Windows DOS 
 Shell. If you have problems, exit this DOS Shell, 
         exit Windows, and retry from DOS.

                     %%%%%%%","Okay" )

wclose()
return()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
click_OK:
set(background,GREEN)
set(color,BLACK)
set(save,yes)
set(open,yes)
set(font,normal)
set(x,50)
set(y,50)
set(window,$screen)

	$0="$0

"
say ($0)

set(y,80) set(open,no) set(save,no)
say ("%%%",OK)
wclose()
return()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
red_continue:
set(background,GREEN)
goto continue_merge

continue: ; message
set(background,GREEN)
continue_merge:
set(color,BLACK)
set(save,yes)
set(open,yes)
set(font,normal)
set(x,50)
set(y,50)
set(window,$screen)

	$0="$0

"

say ($0)  

set(y,80) set(open,no) set(save,no)
say ("%%%%%%%%%   %%%%%%%%",CONTINUE,Cancel)
if $=Cancel {
wclose()
exit("Install Program Canceled")
		}
wclose()  ;closes 1st window because it's last saved
return()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
yes_or_no:
set(background,GREEN)
set(color,BLACK)
set(save,yes)
set(open,yes)
set(font,normal)
set(x,50)
set(y,50)
set(window,$screen)

	$0="$0

"

	say ($0)

set(y,80) set(open,no) set(save,no)
$0=say ("%%%%   %%%",YES,NO)
wclose()
return($0)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ok_or_cancel:
set(background,GREEN)
set(color,BLACK)
set(save,yes)
set(open,yes)
set(font,normal)
set(x,50)
set(y,50)
set(window,$screen)

	$0="$0

"

say ($0)

set(y,80) set(open,no) set(save,no)
$0=say ("%%%% %%%%%%%%",OK,CANCEL)
wclose()
return($0)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
abort_box:
set(background,GREEN)
	$0="$0


"
set(open,yes) set(save,yes)
say ($0)
$w=window()
set(window,$w)
set(x,50) set(y,82)
set(open,no) set(save,no)
say ("%%%%%%%",ABORT)
wclose($w)
exit("Install Program Aborted")
return()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
register_user:

$name="Agent Commander"
$org="Agent HQ"
ru_loop:
	say (
"  Please Enter Your Full Name
    @@@@@@@@@@@@@@@@@@@@@@@ 

  Organization (If Applicable) 
    @@@@@@@@@@@@@@@@@@@@@@@

	 %%%%    %%%%%%%%%",name,org,OK,CANCEL)
if $=CANCEL {
cancel()
set(open,no) set(save,no)
goto ru_loop
	}

wclose()
	
if $name="" {
continue_or_exit("You must enter a name.")
goto ru_loop}

yes_or_no(
"  Is this correct?  

 $name
 $org")
	if $=NO {goto ru_loop}
	set(window,$screen) 
	set(y,23) set(background,LIGHTGRAY) 
	set(color,BLUE) set(save,no) set(open,yes)
	if $video=HERCMONO {set(color,BLACK)}
	if $video=MCGA {set(color,BLACK)}
	say ("Licensed to $name")
	return()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;AS,MP
choose_destination:

	set(x,50)
	set(y,50)
	set(save,yes)
	set(open,yes)
	$w=""
destination_loop:
$0=say(
" Please Enter the Drive and Directory Where
 You Want to Install the SimIsle :

Drive:       @@
Directory:   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	     %%%     %%%%%%%%",
drive, dir, OK, CANCEL)

	if $w="" {
	    $w=window()
	    set(save,no) set(open,no)
	}

	$drive=TOUPPER($drive)
	$dir=TOUPPER($dir)

	if $0=CANCEL { cancel() goto destination_loop}

	set(error,NO)
	setdrive($drive)
	if ERROR {
	    set(ERROR,YES) ; restore error alert
	    continue_or_exit ("DRIVE $drive DOESN'T EXIST.")
	    goto destination_loop
	}
	set(ERROR,YES) ; restore error alert

	$space=getspace($drive)
	if $space<$size {
continue_or_exit (
"FREE SPACE ON DRIVE $DRIVE IS $space K.
   You must have $size K free to
  complete the full installation.")




	    ;wclear($w)
	    ;set(save,no) set(open,no)
	    goto destination_loop
	}

	;; Don't allow illegal paths such as "D:\somedir"
	$=strstr($dir,":") ; result of strstr >= 0 means substring was found
	if $>"-1" {
	    continue_or_exit("':' is not allowed in directory name");
	    goto destination_loop
	}

	; Look for '\' occurence in $dir
	$=strstr($dir,"\")
	if $ # 0 { ; '\' is NOT found in $dir as very 1st char (at offset 0)
	    ; Perform appropriate actions here
	    ; example:
	    $=yes_or_no("Install to \$dir?");     
	    if $=NO {goto destination_loop}
	    $dir="\$dir"
	}

	$9=translate($loadpath,":","")
	$8=translate($drive,":","")
	if $9 = $8 { ; cannot install to the same drive
	    continue_or_exit(
"    You cannot install SimIsle to
the same drive you are installing from.");
	    goto destination_loop
	}

	set(error,NO)
	md($dir)  ; ignore system error when creating already existing dir
	if ERROR {
	    cd ($dir)
	    if NOERROR {
		set(error,YES)
		$=yes_or_no(
"Directory $dir already exists.
Do you want to install over old files?")
		if $=NO {goto destination_loop}
	    }
	}
	cd($dir)
	if ERROR {
	    set(error,YES)
	    continue_or_exit("Error creating $dir");
	    goto destination_loop
	}
	set(ERROR,YES)

	$9=strcat($drive,$dir)

	wclose($w)
	set(window,$screen)
	set(y,14) 
	set(background,LIGHTGRAY) set(color,BLUE)
	if $video=HERCMONO {set(color,BLACK)}
	if $video=MCGA {set(color,BLACK)}
	set(open,yes) set(save,no)
	say("Installing to $9")
	return()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;CW
select_install:


; If the user has selected Express Install and only has 4 megs,
; set the flag to copy everything to the HD...
; (much dialogues to tell the user WTF is going on)

if $4MEGS="YES" {$partial_install="NO"
    click_ok(
" I have detected that you have 4 megabytes of RAM
 available. SimIsle will not run on a system with
 less the 8 Meg.  
")
    return()}

;click_OK(" ")
    return()}

; Otherwise, if the user selected custom install, prompt for full/partial

	$0=say (
" Install XXX will now copy the files over.

	    %%%%%%%%%%%%%%%%%%%%
	    %%%%%%%%%%%%%%%%%%%%","INSTALL")

   if $0="FULL INSTALL"{$partial_install="NO"}
wclose()
return()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;AS
continue_or_exit: ; (message)

$0=
"$0

"
set(open,YES) 
set(save,YES) 
set(BACKGROUND,LIGHTRED) 
set(COLOR,BLACK) 
set(x,50) 
set(y,50)
say ($0) $9=window()

set(open,NO) set(save,NO) set(y,80) set(window,$9)

say ("%%%%%%%%%   %%%%%",
     CONTINUE,    EXIT)

wclose($9)
if $=EXIT {exit ("Install Program Canceled")}
return()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;MP
check_video:

if $video=$0 {return()}

continue_or_exit(
"    Your computer's video card is $video.
	SimIsle requires Super VGA.
     You still can install SimIsle,
 BUT YOU MIGHT NOT BE ABLE TO PLAY THE GAME
	    without Super VGA."
)

	return()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;MP
change_settings:
	
	set(window,$screen)
	set(background,LIGHTGRAY)

	$1=say(
"  SimIsle is  already installed.
   Please run SetSound to change yourd Sound Card.  
")

	wclose()
	set(window,$screen)
     
return()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;MP
bootdisk:
	
	set(window,$screen)
	set(background,LIGHTGRAY)

	$2="BOOTDISK.EXE"
	$3=" /i"
	$4=" /u"

	$1=yes_or_no(
" Do you want to create a 
Boot Disk?")
	if $1=NO {return()}

	$1=ok_or_cancel(
"   Please insert a blank disk
into the A: DRIVE of your computer.
  THAT DISK WILL BE FORMATTED!")
	if $1=CANCEL {return()}

	;click_OK($vdrv)        

	;if $vdrv="ve:31" {
	;$1=yes_or_no(       
;"  Would you like to include
;a universal VESA video driver
;on the Boot Disk?")
;        if $1=YES {$3 = strcat($3,$4)} }

	$2=strcat($2,$3)
	;click_OK($2)

	set(window,$screen)
	set(background,LIGHTGRAY)

	say("Creating a SimIsle  Boot Disk - Please Wait...")

	exec($2)

	wclose()

	if $=0 {click_OK(
"A Boot Disk was successfully created!
Please exit this Installer and reboot
    your computer with the new
	Boot Disk in DRIVE A:.")}

	if $=1 {red_continue(
"BOOT DISK CREATION ERROR:

A mouse driver was not found.")}

	if $=2 {red_continue(
"BOOT DISK CREATION ERROR:

You must have MS-DOS v3.3 or higher
to create a Boot Disk.")}

	if $=3 {red_continue(
"BOOT DISK CREATION ERROR:

Some of the files necessary for
Boot Disk creation were not found.")}

	if $=4 {red_continue(
"BOOT DISK CREATION ERROR:

Not enough memory available.
Please free up more conventional
memory and try again.")}

	if $=5 {red_continue(
"BOOT DISK CREATION ERROR:

A file could not be opened.")}

	if $=6 {red_continue(
"BOOT DISK CREATION ERROR:

User quit creation process.")}

	if $=7 {red_continue(
"BOOT DISK CREATION ERROR:

The Installer and Boot Disk
utility must be run from the
same directory as SimIsle.")}

	if $=8 {red_continue(
"BOOT DISK CREATION ERROR:

System call failed.")}

	if $=9 {red_continue(
"BOOT DISK CREATION ERROR:

User aborted Boot Disk creation.")}

	if $=10 {red_continue(
"BOOT DISK CREATION ERROR:

You must have a blank disk
in DRIVE A: to make a Boot Disk.")}

	if $=11 {red_continue(
"BOOT DISK CREATION ERROR:

Installer Script Error.")}


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;MP
check_RAM:

	$0="8000"
	$1=ADD($RAM,$XRAM)
	$2="384"
	$1=ADD($1,$2)
	$4MEGS="NO"
	
	if $1<$0 {continue_or_exit(
"  Your computer has $1 K of installed RAM.
 SimIsle requires at least 8 Megabytes.
    You still can install SimIsle,
  BUT YOU WILL NOT BE ABLE TO PLAY THE GAME
   until you have 8 Megs of RAM installed." )

$4MEGS="YES"}


return()
}

	$0="8597"
	
	if $1<$0 {red_continue(
" Your computer appears to have 8 Megs of RAM.
" )

bootdisk()
return()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;MP
can_we_execute:

	$9=$RAM_free
	
	if $9<$0 {
		$9=REPLACE($9,"","-")
		$9=ADD($0,$9)
		abort_box(
"  There is not enough free
 conventional memory for the
  installation to continue.
  Please free up $9 K more
 conventional memory before
	 installation.")
		}

	$9=$XMS_largest
	
	if $9<$1 {
		$9=REPLACE($9,"","-")
		$9=ADD($1,$9)
		abort_box(
"  There is not enough free
  extended memory for the
  installation to continue.
  Please free up $9 K more
   extended memory before
	 installation.")
		}
return()


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;MP
check_CPU:

	;click_OK($CPU)

	if $CPU=$0 {return()}
	if $CPU>$0 {return()}

	continue_or_exit(
"       Your computer's CPU is a $CPU.
 SimIsle requires a $0 or higher CPU.
     You still can install SimIsle,
 BUT YOU MIGHT NOT BE ABLE TO PLAY THE GAME
	  without a $0 CPU."
)

	return()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;AS
extract_files: ; (template)
	$0="$loadpath\$0"
	$filelist=find($0) 
ef_loop:
	if $filelist # "" {
	    extract("$loadpath\$filelist") 
	    $9=strlen($filelist) 
	    $filelist=rotate($filelist,$9)
	    $filelist=rotate($filelist,1)    ; end null
	    goto ef_loop
	}
	return()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;AS
insert_disk: ; (LABEL,FILENAME to verify)
	$1="$loadpath\$1"
	$=strlen($0)

	;; Extra space for narrow message
	$9=""
	if $<10 { $9="       "}


	$9="$9 Please Insert Disk $0 $9

"
	set(background,WHITE)
	set(color,BLACK)
	set(save,yes)
	set(open,yes)
	set(font,normal)
	set(x,50)
	set(y,50)
	set(window,$screen)

	say ($9)

	set(y,80) set(open,no) set(save,no)

	say ("%%%%%%%%%   %%%%%%%%",CONTINUE,CANCEL)
	if $=CANCEL {exit("Install Program Canceled")}
reinsert:
	$=find($1)
	if $="" {
	    red_continue(" WRONG  DISK  INSERTED ! ")
	    goto reinsert;
	}
	wclose()  ;closes 1st window because it's last saved

	return()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;MP
write_config_file:

	$1="[SimIsle Configuration File]^0D^0A"

	$2="[Video]^0D^0AVIDEONAME=$vname^0D^0AVIDEOCARD=$vdrv^0D^0A"

;       $3="[Sound Effects]^0D^0ASFXNAME=$ds_name^0D^0ASFXDRIVER=$ds_driver^0D^0A"
;       $3="$4+SFXADDRESS=$ds_io^0D^0ASFXIRQ=$ds_irq^0D^0A"
;       $3="$4+SFXDMA=$ds_dma^0D^0ASFXDRQ=$ds_drq^0D^0A"
;       $3=replace($3,"+","")
;       $3=replace($3,"+","")

;SJP
;       $name=translate($name," ","^1B")
;       $org=translate($org," ","^1B")
	$4="[Name]"
	
;       writetext("SimIsle.cfg","$1^0D^0A$2^0D^0A$3^0D^0A$4^0D^0A$5")
writetext("SimIsle.cfg","$1^0D^0A$2^0D^0A$4^0D^0A$name^0D^0A$org")
writetext("resource.cfg","$loadpath\res\^0D^0A0")

return()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
write_success_file:
	$1="[SimIsle Exist File]^0D^0A"

writetext("exist.cfg","$1")

return()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
write_sound_file:
	$1="[SimIsle do sound File]^0D^0A"

writetext("dosound.cfg","$1")

return()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



;MP
read_config_file:
	
	$configfile=readtext("SimIsle.cfg")
	
	$configfile=translate($configfile,"^0D","") 
	$configfile=translate($configfile,"^0A","") 
	$configfile=translate($configfile,"=","") ; change '=' to '\0'
	
	find_keyname("VIDEONAME")
	$vname=$configfile
	find_keyname("VIDEOCARD")
	$vdrv=$configfile
	
	find_keyname("SFXNAME")
	$ds_name=$configfile
	find_keyname("SFXDRIVER")
	$ds_driver=$configfile
	find_keyname("SFXADDRESS")
	$ds_io=$configfile
	find_keyname("SFXIRQ")
	$ds_irq=$configfile
	find_keyname("SFXDMA")
	$ds_dma=$configfile
	find_keyname("SFXDRQ")
	$ds_drq=$configfile

	
return()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
find_keyname:

	$configfile=shift($configfile)
	strstr($configfile,$0)
	if $ = "-1" { goto find_keyname }
	$configfile=shift($configfile)

return($configfile)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;MP
display_textfile:

	$textfile=readtext($0)

	set(window,$screen)

	; THE NEXT LINE HAS 75 INVISIBLE SPACE CHARACTERS - BE CAREFUL
	; THEY ARE NECESSARY FOR WINDOW SIZING
	$1=say(        
"                                                                         
















")
	;wclose()
	;return()

	$textfile=translate($textfile,"^0D","") 
	$textfile=translate($textfile,"^0A","") 

	$2="[EOF]"  ;End of file keyword    
	$7="[CLS]"  ;Clear Screen keyword

new_page:        
	
	wclear()
	$3="7"  ; First line of text
	$4="1"  ; Line counter (Loop Checking)
	$5="4"  ; % Spacing between lines
	$6="1"  ; Constant Increment Value = 1
	$8="22" ; Last line (max number of lines)


next_line:
	
	set(font,small)
	set(open,no) set(save,no) set(x,5) set(y,$3) 
	nowsay($textfile)
	$textfile=shift($textfile)
	$3=ADD($3,$5)
	$4=ADD($4,$6)
	strstr($textfile,$2)
	if $ = "0" { goto end_of_file }
	if $4 = $8 {
		set(font,large)
		set(x,50) set(y,95)
		nowsay("%%%%%%%%%%  %%%%%%",CONTINUE, EXIT)
		if $="EXIT" {
			wclose()
			return()
			}
		goto new_page
		}
	strstr($textfile,$7)
	if $ = "0" { 
		$textfile=shift($textfile)
		set(font,large)
		set(x,50) set(y,95)
		nowsay("%%%%%%%%%%  %%%%%%",CONTINUE, EXIT)
		if $="EXIT" {
			wclose()
			return()
			}
		goto new_page
		}
	goto next_line:


end_of_file:
	
	set(font,large)
	set(x,50) set(y,95)
	nowsay("%%%%%%",DONE)
	wclose()
	return()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;AS
nowsay:
	$=say($0,$1,$2,$3,$4,$5,$6,$7,$8,$9)
	return ($)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;AS
nowimage:
	image($0)
	return()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;AS
shift: ; $0 - value
	    $9=strlen($0)
	    $0=rotate($0,$9)
	    $0=rotate($0,1)    ; end null

	return ($0)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;AS
cancel:
	continue_or_exit("Do you want to exit now?")
	return ()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                                                                       ;
;       NEW SOUND STUFF                                                 ;
;                                                                       ;
;       REQUIRES 32-BIT PROTECTED MODE MILES DRIVERS                    ;
;       AND A PROGRAM CALLED VRF_DLL.EXE FOR MILES                      ;
;       DRIVER VERIFICATION                                             ;
;                                                                       ;
;       THESE ROUTINES ALSO ASSIGN AN ITEM TO A KEYNAME                 ;
;       CALLED "MUSICFILES" THAT SPECIFIES A BANK OF                    ;
;       MIDI FILES TO USE                                               ;
;                                                                       ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;MP
choose_music_carda:

	;set(font,small)

	$name_1=          "NO MUSIC"              $driver_1=      "*"      
	$name_2=          "PC Speaker"            $driver_2=      "A32SPKR.DLL"    
	$name_3=          "Ad Lib"                $driver_3=      "A32ADLIB.DLL"     
	$name_4=          "Ad Lib Gold"           $driver_4=     "A32ALGFM.DLL"
	$name_5=          "ARIA Sound Synth"      $driver_5=     "A32ARXM.DLL"
	$name_6=          "Ensoniq Soundscape"    $driver_6=     "A32MT32.DLL"   
	$name_7=          "MPU-401 General MIDI"  $driver_7=     "A32MT32.DLL"   
	$name_8=          "Pro Audio Spectrum"    $driver_8=      "A32PASFM.DLL"  


	$1=say (
"     Please choose a sound   
	 source for MUSIC:

 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ",

	$name_1,$name_2,$name_3,$name_4,$name_5,$name_6,$name_7,$name_8,$more)


	if $1=$name_1     {   $sc_name=$name_1      $sc_dll=$driver_1}
	if $1=$name_2     {   $sc_name=$name_2      $sc_dll=$driver_2}
	if $1=$name_3     {   $sc_name=$name_3      $sc_dll=$driver_3   $midifile="SB"}
	if $1=$name_4     {   $sc_name=$name_4      $sc_dll=$driver_4   $midifile="SB"  get_blaster()}
	if $1=$name_5     {   $sc_name=$name_5      $sc_dll=$driver_5}
	if $1=$name_6     {   $sc_name=$name_6      $sc_dll=$driver_6}
	if $1=$name_7     {   $sc_name=$name_7      $sc_dll=$driver_7}
	if $1=$name_8     {   $sc_name=$name_8      $sc_dll=$driver_8   $midifile="SB"}
	if $1=$more       {   $sc_name=$more        $sc=$more}

wclose()
return()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;MP
choose_music_cardb:

	;set(font,small)

	$name_1=          "Pro Audio Spectrum 16" $driver_1=      "A32PASOP.DLL"    
	$name_2=          "Sound Blaster"         $driver_2=      "A32SBFM.DLL"      
	$name_3=          "Sound Blaster Pro 1"   $driver_3=     "A32SP1FM.DLL"
	$name_4=          "Sound Blaster Pro 2"   $driver_4=     "A32SP2FM.DLL"
	$name_5=          "Sound Blaster 16"      $driver_5=      "A32SP2FM.DLL"  
	$name_6=          "Sound Blaster AWE32"   $driver_6=     "A32AWE32.DLL"
	$name_7=          "Sound Blaster Compatible" $driver_7=      "A32SBFM.DLL"      
	$name_8=          "Roland MT-32/LAPC-1"   $driver_8=     "A32MT32.DLL"


	$1=say (
"     Please choose a sound   
	 source for MUSIC:

 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ",

	$name_1,$name_2,$name_3,$name_4,$name_5,$name_6,$name_7,$name_8,$more)


	if $1=$name_1     {   $sc_name=$name_1      $sc_dll=$driver_1}
	if $1=$name_2     {   $sc_name=$name_2      $sc_dll=$driver_2   $midifile="SB"  get_blaster()}
	if $1=$name_3     {   $sc_name=$name_3      $sc_dll=$driver_3   $midifile="SB"  get_blaster()}
	if $1=$name_4     {   $sc_name=$name_4      $sc_dll=$driver_4   $midifile="SB"  get_blaster()}
	if $1=$name_5     {   $sc_name=$name_5      $sc_dll=$driver_5   $midifile="SB"  get_blaster()}
	if $1=$name_6     {   $sc_name=$name_6      $sc_dll=$driver_6   $midifile="SB"  get_blaster()}
	if $1=$name_7     {   $sc_name=$name_7      $sc_dll=$driver_7   $midifile="SB"  get_blaster()}
	if $1=$name_8     {   $sc_name=$name_8      $sc_dll=$driver_8   $midifile="MT"}
	if $1=$more       {   $sc_name=$more        $sc_dll=$more}
	
wclose()
return()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;MP
choose_music_cardc:

	;set(font,small)

	$name_1=          "Roland Sound Canvas"   $driver_1=      "A32MT32.DLL"   
	$name_2=          "Wave Blaster"          $driver_2=     "A32MT32S.DLL"


	$1=say (
"     Please choose a sound   
	 source for MUSIC:

 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ",

	$name_1,$name_2,$more)


	if $1=$name_1     {   $sc_name=$name_1      $sc_dll=$driver_1}
	if $1=$name_2     {   $sc_name=$name_2      $sc_dll=$driver_2  $midifile="WB" get_blaster()}
	if $1=$more       {   $sc_name=$more        $sc_dll=$more}
	
wclose()
return()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;MP
choose_sfx_carda:

	;set(font,small)

	$name_1=          "NO SOUND"              $driver_1=      "*"      
	$name_2=          "Ad Lib Gold"           $driver_2=      "A32ALGDG.DLL"  
	$name_3=          "ARIA Sound Synth"      $driver_3=      "A32ARDG.DLL"        
	$name_4=          "Ensoniq Soundscape"         $driver_4=      "A32SBDG.DLL"      
	$name_5=          "Pro Audio Spectrum"    $driver_5=      "A32PASDG.DLL"    
	$name_6=          "Pro Audio Spectrum 16"    $driver_6=      "A32PASDG.DLL"    
	$name_7=          "Sound Blaster"         $driver_7=      "A32SBDG.DLL"      
	$name_8=          "Sound Blaster Compatible" $driver_8=      "A32SBDG.DLL"

	$1=say (
"     Please choose a sound   
    source for SOUND EFFECTS:

 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ",

	$name_1,$name_2,$name_3,$name_4,$name_5,$name_6,$name_7,$name_8,$more)


	if $1=$name_1     {   $sc_name=$name_1      $sc_dll=$driver_1}
	if $1=$name_2     {   $sc_name=$name_2      $sc_dll=$driver_2}
	if $1=$name_3     {   $sc_name=$name_3      $sc_dll=$driver_3}
	if $1=$name_4     {   $sc_name=$name_4      $sc_dll=$driver_4  get_blaster()}
	if $1=$name_5     {   $sc_name=$name_5      $sc_dll=$driver_5}
	if $1=$name_6     {   $sc_name=$name_6      $sc_dll=$driver_6}
	if $1=$name_7     {   $sc_name=$name_7      $sc_dll=$driver_7  get_blaster()}
	if $1=$name_8     {   $sc_name=$name_8      $sc_dll=$driver_8  get_blaster()}
	if $1=$more       {   $sc_name=$more        $sc_dll=$more}

wclose()
return()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;MP
choose_sfx_cardb:

	;set(font,small)

	$name_1=          "Sound Blaster Pro"     $driver_1=      "A32SBPDG.DLL"  
	$name_2=          "Sound Blaster 16"      $driver_2=      "A32SBPDG.DLL"  
	$name_3=          "Sound Blaster AWE32"     $driver_3=      "A32SBPDG.DLL"  

	$1=say (
"     Please choose a sound   
    source for SOUND EFFECTS:

 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ",

	$name_1,$name_2,$name_3,$more)


	if $1=$name_1     {   $sc_name=$name_1      $sc_dll=$driver_1  get_blaster()}
	if $1=$name_2     {   $sc_name=$name_2      $sc_dll=$driver_2  get_blaster()}
	if $1=$name_3     {   $sc_name=$name_3      $sc_dll=$driver_3  get_blaster()}
	if $1=$more       {   $sc_name=$more        $sc_dll=$more}

wclose()
return()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;AS,MP
verify_dll:
	if $sc_dll="*"           {return()}
	;if $sc_dll="NO_SOUND"   {return()}
	;if $sc_dll="NO_MUSIC"   {return()}
;       if $sc_dll="A32SPKR.DLL" {return()}
;       return()
;SJPHACK        
		say("
		     Verifying hardware presence...                   ")
		set(open,no) set(save,no) set(x,50) set(y,10) 
		nowsay ($sc_name)
		exec("VRF_DLL.EXE .\SOUND\$sc_dll $s_IO $s_IRQ $s_DMA $s_DRQ")
		$ver="FAILED !"
		if $=0 {$ver="OK."}
		if ERROR { $ver="Can't verify" }
		wclear()

		set(y,50)
		$setting="CHANGE SETTINGS"
		set(y,10)
		nowsay("$sc_name VERIFICATION: $ver")
		set(y,90)
		$stat=nowsay("%%%%%%%%%%    %%%%%%%%%%%%%    %%%%%%%%%%%%%%%%%",
			   $continue,    "CHANGE CARD",       $setting)

		if $stat=$setting {
		    edit_IO_settings()
		    wclear()
		    goto verify_dll;
		}
		wclose()
		return()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;AS
edit_IO_settings: 

	set(x,50) set(y,100) 
	set(font,small) 
	set(open,yes) set(save,yes)

	$8=window()
	$9=""

settings_loop:
	set(window,$8);

$7=say(
"$sc_name
* - factory default
    IO : @@@ Hex
    IRQ: @@
    DMA: @@

   %%%%%%%%%

   %%%%%%%%%", 
s_io,s_IRQ,s_DMA,
DEFAULTS, CONTINUE)
if $9="" {$9=window()}
	if $7=DEFAULTS {
	    $s_IO="*" 
	    $s_IRQ="*" 
	    $s_DMA="*" 
	    $s_DRQ="*"
	    wclear()
	    set(open,no) set(save,no)
	    goto settings_loop;
	}

wclose($9)
return()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;MP
setup_sound:
;return()

	;Sound Effects Sound Cards
	
	$s_io="*" $s_IRQ="*" $s_DMA="*" $s_DRQ="*"

	if $express="EXPRESS INSTALL" {
;               get_blaster()
		$sc_dll = "sblaster.dig"
		$sc_name = "Sound Blaster Compatible"
;               goto setup_sound_io
		}
 return()
	$sc_dll=$more
	if $sc_dll=$more {choose_sfx_carda()}
	if $sc_dll=$more {choose_sfx_cardb()}
	if $sc_dll=$more {goto setup_sound}

	$stat=$continue
	verify_dll()
	if $stat#$continue {goto setup_sound}

	setup_sound_io:
	$ds_driver=$sc_dll
	$ds_name=$sc_name
	$ds_IO=$s_IO
	$ds_IRQ=$s_IRQ
	$ds_DMA=$s_DMA
	$ds_DRQ=$s_DRQ

	set(font,normal)

return()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

get_blaster:

	$blaster=""
	set (ERROR, no)
	$blaster=getenv(BLASTER)
	if ERROR {
		set(ERROR,yes)
		return()}
	
	set (ERROR, yes)

	$blaster=translate($blaster," ","")
	$s_io=$blaster
	$s_io=translate($s_io,"A","")
	$s_io=shift($s_io)
	$blaster=shift($blaster)
	$s_IRQ=$blaster
	$s_IRQ=translate($s_IRQ,"I","")
	$s_IRQ=shift($s_IRQ)
	$blaster=shift($blaster)
	$s_DMA=$blaster
	$s_DMA=translate($s_DMA,"D","")
	$s_DMA=shift($s_DMA)

if $s_IRQ="" {
	$blaster=getenv(BLASTER)
	$blaster=translate($blaster," ","")
	$s_io=$blaster
	$s_io=translate($s_io,"A","")
	$s_io=shift($s_io)
	$blaster=shift($blaster)
	$s_DMA=$blaster
	$s_DMA=translate($s_DMA,"D","")
	$s_DMA=shift($s_DMA)
	$blaster=shift($blaster)
	$s_IRQ=$blaster
	$s_IRQ=translate($s_IRQ,"I","")
	$s_IRQ=shift($s_IRQ)}

if $s_DMA="" {
	$blaster=getenv(BLASTER)
	$blaster=translate($blaster," ","")
	$s_io=$blaster
	$s_io=translate($s_io,"A","")
	$s_io=shift($s_io)
	$blaster=shift($blaster)
	$s_DMA=$blaster
	$s_DMA=translate($s_DMA,"D","")
	$s_DMA=shift($s_DMA)
	$blaster=shift($blaster)
	$s_IRQ=$blaster
	$s_IRQ=translate($s_IRQ,"I","")
	$s_IRQ=shift($s_IRQ)}


return()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                                                                       ;
;       NEW VIDEO SETUP STUFF                                           ;
;                                                                       ;
;       REQUIRES METAGRAPHICS VIDEO CARD COMPATIBILITY                  ;
;       AND A PROGRAM CALLED VDETECT.EXE THAT USES                      ;
;       THE METAGRAPHICS QUERY FUNCTION AND RETURNS                     ;
;       0 IF TRUE, NOT 0 IF FALSE                                       ;
;                                                                       ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;MP
setup_video:

	 
	init_video_list()       

	if $vdrvlist="!^00" {

		continue_or_exit(

"   A Super VGA video card was NOT found
	     on your computer.
	SimIsle requires Super VGA.
	 You still can install SimIsle,
 BUT YOU MIGHT NOT BE ABLE TO PLAY THE GAME
	    without Super VGA.
  SimIsle will be configured for VESA
	Super VGA compatibility.
	 

")
		$vnamelist="^00VESA Super VGA^00"
		$vdrvlist="!ve:31^00"
		goto assign_video
	}

	say(

"       Please Choose A 
	 Super VGA Card

||||||||||||||||||||||||||||||
		
     %%%%  %%%%%%%%%%%%%%"
	 
	,vnamelist,"OK","NOT IN LIST")
	
	wclose()
	if $="OK" {goto assign_video}

	init_video_list(ALL)        

	set(font,small)
	set(y,18)
	set(window,$screen)
	
	say(
	
" Please Choose A Super VGA Card
	
 |||||||||||||||||||||||||||||| 
		
	 %%%%  %%%%%%%%%%%%"
	 
	,vnamelist,"OK","DON'T KNOW")
	
	wclose()
	if $="OK" {goto assign_video}

	set(font,normal)
	set(y,50)
	set(window,$screen)
	continue_or_exit(

"   Since you are not sure about
 the video card installed in your
  computer, SimIsle will be
 configured for VESA compatibility."
)
		$vnamelist="^00VESA Super VGA^00"
		$vdrvlist="!ve:31^00"
		goto assign_video
	}

	assign_video:

	$vname=listitem($vnamelist)
	$vdrv=colistitem($vnamelist,$vdrvlist)
	$vdrv=replace($vdrv,"*","")

	wclose()
	set(y,50)

if $express="EXPRESS INSTALL"
	{click_ok("
     I have set up your Video Card as the following:
		   Card: $vname

Please run the Install Program to change this settings")}


return()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;MP
init_video_list:        

	$vname=""
	$vdrv=""
	$vnamelist=""
	$vdrvlist=""
	
	if $0="" {$vdrvlist="$vdrvlist!"}

	auto_videoe($0)
	auto_videoa($0)
	auto_videob($0)
	auto_videoc($0)
	auto_videod($0)
	
	$vnamelist="$vnamelist+"
	
	$vnamelist=translate($vnamelist,"+","^00")
	$vdrvlist=translate($vdrvlist,"+","^00")

return()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;MP
video_priority:


	$vname=""
	$vdrv=""

	$name_1=          "S3 Accelerator (S3)"         $driver_1=      "ve:31"
	$name_2=          "ATI Graphics Ultra Pro"      $driver_2=      "ai:50"    
	$name_3=          "VESA Super VGA"              $driver_3=      "ve:31"   

; SJP Hack
	$vname="$name_3"
	$vdrv="$driver_3"
	return()}
	

	if $express="EXPRESS INSTALL" {
			$vname="$name_3"
			$vdrv="$driver_3"
			return()}

	exec("vdetect.exe 16")
	if $=0          {$vname="$name_1"         
			 $vdrv="$driver_1"
			 return()}
	exec("vdetect.exe 1")
	if $=0          {$vname="$name_2"         
			 $vdrv="$driver_2"
			 return()}
	exec("vdetect.exe 22")
	if $=0          {$vname="$name_3"
			 $vdrv="$driver_3"
			 return()}

	$vname="FAILED"

return()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;MP
auto_videoa:

	
	$name_1=          "ATI VGA Wonder"                $driver_1=      "ai:30"      
	$name_2=          "ATI Graphics Ultra Pro"        $driver_2=      "ai:50"    
	$name_3=          "CHIPS 82C45x"                  $driver_3=      "ch:23"     
	$name_4=          "Compaq Advanced VGA"           $driver_4=      "cp:11"      
	$name_5=          "Diamond Speedstar"             $driver_5=      "ts:31"    
	$name_6=          "Diamond Stealth (S3)"          $driver_6=      "ve:31"   
	$name_7=          "Genoa SuperVGA 5000"           $driver_7=      "g:6"  
	$name_8=          "Genoa SuperVGA 6000"           $driver_8=      "g:8"  

	if $0=ALL {
		$vnamelist="$vnamelist+$name_1+$name_2+$name_3+$name_4+$name_5+$name_6+$name_7+$name_8"
		$vdrvlist="$vdrvlist+$driver_1+$driver_2+$driver_3+$driver_4+$driver_5+$driver_6+$driver_7+$driver_8"
		return ()
	}

	;click_OK ("Testing $name_1") 
	exec("vdetect.exe 0")
	if $=0          {$vnamelist="$vnamelist+$name_1"
			 $vdrvlist="$vdrvlist*$driver_1+"}
	;click_OK ("Testing $name_2") 
	exec("vdetect.exe 1")
	if $=0          {$vnamelist="$vnamelist+$name_2"         
			 $vdrvlist="$vdrvlist*$driver_2+"}
	;click_OK ("Testing $name_3") 
	exec("vdetect.exe 2")
	if $=0          {$vnamelist="$vnamelist+$name_3"         
			 $vdrvlist="$vdrvlist*$driver_3+"}
	;click_OK ("Testing $name_4") 
	exec("vdetect.exe 3")
	if $=0          {$vnamelist="$vnamelist+$name_4"         
			 $vdrvlist="$vdrvlist*$driver_4+"}
	;click_OK ("Testing $name_5") 
	exec("vdetect.exe 4")
	if $=0          {$vnamelist="$vnamelist+$name_5"         
			 $vdrvlist="$vdrvlist*$driver_5+"}
	;click_OK ("Testing $name_6") 
	exec("vdetect.exe 5")
	if $=0          {$vnamelist="$vnamelist+$name_6"         
			 $vdrvlist="$vdrvlist*$driver_6+"}
	;click_OK ("Testing $name_7") 
	exec("vdetect.exe 6")
	if $=0          {$vnamelist="$vnamelist+$name_7"         
			 $vdrvlist="$vdrvlist*$driver_7+"}
	;click_OK ("Testing $name_8") 
	exec("vdetect.exe 7")
	if $=0          {$vnamelist="$vnamelist+$name_8"         
			 $vdrvlist="$vdrvlist*$driver_8+"}

return()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;MP
auto_videob:


	$name_1=          "HP Ultra VGA (S3)"           $driver_1=      "ve:31"
	$name_2=          "OAK VGA"                     $driver_2=      "ok:3"    
	$name_3=          "Orchid Designer VGA"         $driver_3=      "st:31"
	$name_4=          "Orchid ProDesigner VGA"      $driver_4=      "ts:31"      
	$name_5=          "Orchid Fahrenheit 1280 (S3)" $driver_5=      "ve:31"    
	$name_6=          "Paradise VGA"                $driver_6=      "p:4"    
	$name_7=          "Quadram VGA Spectra"         $driver_7=      "q:3"   
	$name_8=          "Radius Multiview"            $driver_8=      "v7:10"  

	if $0=ALL {
		$vnamelist="$vnamelist+$name_1+$name_2+$name_3+$name_4+$name_5+$name_6+$name_7+$name_8"
		$vdrvlist="$vdrvlist+$driver_1+$driver_2+$driver_3+$driver_4+$driver_5+$driver_6+$driver_7+$driver_8"
		return ()
	}


	;click_OK ("Testing $name_1") 
	exec("vdetect.exe 8")
	if $=0          {$vnamelist="$vnamelist+$name_1"
			 $vdrvlist="$vdrvlist*$driver_1+"}
	;click_OK ("Testing $name_2") 
	exec("vdetect.exe 9")
	if $=0          {$vnamelist="$vnamelist+$name_2"         
			 $vdrvlist="$vdrvlist*$driver_2+"}
	;click_OK ("Testing $name_3") 
	exec("vdetect.exe 10")
	if $=0          {$vnamelist="$vnamelist+$name_3"         
			 $vdrvlist="$vdrvlist*$driver_3+"}
	;click_OK ("Testing $name_4") 
	exec("vdetect.exe 11")
	if $=0          {$vnamelist="$vnamelist+$name_4"         
			 $vdrvlist="$vdrvlist*$driver_4+"}
	;click_OK ("Testing $name_5") 
	exec("vdetect.exe 12")
	if $=0          {$vnamelist="$vnamelist+$name_5"         
			 $vdrvlist="$vdrvlist*$driver_5+"}
	;click_OK ("Testing $name_6") 
	exec("vdetect.exe 13")
	if $=0          {$vnamelist="$vnamelist+$name_6"         
			 $vdrvlist="$vdrvlist*$driver_6+"}
	;click_OK ("Testing $name_7") 
	exec("vdetect.exe 14")
	if $=0          {$vnamelist="$vnamelist+$name_7"         
			 $vdrvlist="$vdrvlist*$driver_7+"}
	;click_OK ("Testing $name_8") 
	exec("vdetect.exe 15")
	if $=0          {$vnamelist="$vnamelist+$name_8"         
			 $vdrvlist="$vdrvlist*$driver_8+"}

return()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;MP
auto_videoc:


	$name_1=          "S3 Incorporated (S3)"        $driver_1=      "ve:31"
	$name_2=          "STB VGA Extra/EM"            $driver_2=      "st:31"    
	$name_3=          "STB VGA EM-16 Plus"          $driver_3=      "ts:31"
	$name_4=          "Tecmar VGA/AD"               $driver_4=      "tc:4"      
	$name_5=          "Trident VGA"                 $driver_5=      "tr:3"    
	$name_6=          "Tseng 4000"                  $driver_6=      "ts:31"    
	$name_7=          "Video Seven FastWrite VGA"   $driver_7=      "v7:7"  
	$name_8=          "Video Seven VRAM VGA"        $driver_8=      "v7:7"

	if $0=ALL {
		$vnamelist="$vnamelist+$name_1+$name_2+$name_3+$name_4+$name_5+$name_6+$name_7+$name_8"
		$vdrvlist="$vdrvlist+$driver_1+$driver_2+$driver_3+$driver_4+$driver_5+$driver_6+$driver_7+$driver_8"
		return ()
	}


	;click_OK ("Testing $name_1") 
	exec("vdetect.exe 16")
	if $=0          {$vnamelist="$vnamelist+$name_1"
			 $vdrvlist="$vdrvlist*$driver_1+"}
	;click_OK ("Testing $name_2") 
	exec("vdetect.exe 17")
	if $=0          {$vnamelist="$vnamelist+$name_2"         
			 $vdrvlist="$vdrvlist*$driver_2+"}
	;click_OK ("Testing $name_3") 
	exec("vdetect.exe 18")
	if $=0          {$vnamelist="$vnamelist+$name_3"         
			 $vdrvlist="$vdrvlist*$driver_3+"}
	;click_OK ("Testing $name_4") 
	exec("vdetect.exe 19")
	if $=0          {$vnamelist="$vnamelist+$name_4"         
			 $vdrvlist="$vdrvlist*$driver_4+"}
	;click_OK ("Testing $name_5") 
	exec("vdetect.exe 20")
	if $=0          {$vnamelist="$vnamelist+$name_5"         
			 $vdrvlist="$vdrvlist*$driver_5+"}
	;click_OK ("Testing $name_6") 
	exec("vdetect.exe 21")
	if $=0          {$vnamelist="$vnamelist+$name_6"         
			 $vdrvlist="$vdrvlist*$driver_6+"}
	;click_OK ("Testing $name_7") 
	exec("vdetect.exe 23")
	if $=0          {$vnamelist="$vnamelist+$name_7"         
			 $vdrvlist="$vdrvlist*$driver_7+"}
	;click_OK ("Testing $name_8") 
	exec("vdetect.exe 24")
	if $=0          {$vnamelist="$vnamelist+$name_8"
			 $vdrvlist="$vdrvlist*$driver_8+"}

return()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;MP
auto_videod:


	$name_1=          "Video Seven VGA 1024i"        $driver_1=      "v7:7"    
	$name_2=          "Video Seven VRAM II"          $driver_2=      "v7:10"
	$name_3=          "Packard Bell (VESA)"          $driver_3=      "ve:31"

	if $0=ALL {
		$vnamelist="$vnamelist+$name_1+$name_2+$name_3"
		$vdrvlist="$vdrvlist+$driver_1+$driver_2+$driver_3+"
		return ()
	}


	;click_OK ("Testing $name_1") 
	exec("vdetect.exe 25")
	if $=0          {$vnamelist="$vnamelist+$name_1"         
			 $vdrvlist="$vdrvlist*$driver_1+"}
	;click_OK ("Testing $name_2") 
	exec("vdetect.exe 26")
	if $=0          {$vnamelist="$vnamelist+$name_2"         
			 $vdrvlist="$vdrvlist*$driver_2+"}
	;click_OK ("Testing $name_3") 
	exec("vdetect.exe 22")
	if $=0          {$vnamelist="$vnamelist+$name_3"         
			 $vdrvlist="$vdrvlist*$driver_3+"}

return()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;MP
auto_videoe:


	$name_1=          "VESA Super VGA"              $driver_1=      "ve:31"   

	if $0=ALL {
		$vnamelist="$vnamelist+$name_1"
		$vdrvlist="$vdrvlist!$driver_1"
		return ()
	}

	;click_OK ("Testing $name_1") 
	exec("vdetect.exe 22")
	if $=0          {$vnamelist="$vnamelist+$name_1"         
			 $vdrvlist="$vdrvlist*$driver_1+"}

return()


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;AS
colistitem:  ;(mainlist,colist)

	$0=translate($1,"!",$0)
	$0=listitem($0)
	return($0)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;AS
extract_to_subdir: ;;; (subdir_name,archive_name)

	; Prevent system error when creating already existing dir
	set(error,no) md ($0) set(error,yes)
	cd ($0)
	extract ("$loadpath\$1")
	cd("..")
	return()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;AS
copy_to_subdir: ;;; (subdir_name,archive_name)

	; Prevent system error when creating already existing dir
	set(error,no) md ($0) set(error,yes)
	cd ($0)
	copy ("$loadpath\$1\*.*")
	cd("..")
	return()

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


;AS
patch_name:
;SJPHACK
return();       
	$name=translate($name," ","^1B")
	$org=translate($org," ","^1B")
	$1="$name+$org"
	$1=translate($1,"+"," ")
	
	exec("patch.exe $1")
	if $=0 {
		abort_box("User Registration Failed.")
		exit("User Registration Failure")
		}

	delete("PATCH.EXE")
	return()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;AS,MP
remind_registration:
	set(y,51)
	image("$loadpath\postcard.cim")
	set(y,45) set(font,large) set (open,no) set(save,no)
	set(color,Black)
	nowsay(
" All we've got to offer is:
    FREE software,
    FREE subscriptions, and
    someone nice to talk to 
    when you're in trouble.")	set(open,yes)
	set(font,large)
	set(y,78) set(background,Green) set(color,Lightgreen)
	say("DON'T FORGET TO REGISTER TODAY !");

;; I want to try and provide trivia here, so I want the message to stay 
;; up for about 1 minute the goto the next two trivia statements. 

	return()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;AS
draw_desktop:
;       set(background,LIGHTGREEN)
;       wclear($screen)
	
	set(open,no) set(save,no)
	set(color,GREEN) set(font,large) nowsay("LOADING...")
	image("$loadpath\MAXIS.CIM")
	
	set(font,small)
	set(y,99) set(x,90)
	set(color,BLACK) nowsay("SimIsle CD-ROM 1.0")

	return()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;AS,MP
startup:
	$loadpath=$
	$CPU=$0
	$NDP=$1
	$RAM=$2
	$RAM_free=shift($2)
	$XRAM=$3
	$XMS_largest=$4
	if $XMS_largest # "" {$XMS_total=shift($4)}
	$video=$5
	$ncolor=$6
	$DOS=$8
	$screen=$9
	;
	$drive="C:"
	$continue=CONTINUE      
	$stat="S"

	draw_desktop()
	delay(1)

	maxis_installer()

	$more="MORE..."

	$express="CUSTOM INSTALL"

	$ms_IO="*" $ms_IRQ="*" $ms_DMA="*" $ms_DRQ="*"
	$ds_IO="*" $ds_IRQ="*" $ds_DMA="*" $ds_DRQ="*"

	return()
