/*
 * INSTALL.DAT
 *
 * Project: Monte Carlo
 * Version: 1.3
 *
 * This INSTALL.DAT was automatically generated by DDB
 */

@DefineProject
	@Name = "Monte Carlo"
	@Version = "1.3"
	
	@Subdir = "\\mcarlo"
	@OutDrive = C
@EndProject


/*
Options:
	1-4 Install, uninstall, configure, exit
	11-12 Full/custom installation
	21-22 DOS, Windows installation
	31-37 Windows apps to install
	38 Regular drivers - only used for configuration
	40 Copy in midimap.cfg?
	50 Delete whole mcarlo directory?
	60 Reboot after installation?
	70 Test hardware settings?         

    101-106 Main sound card settings menu
    111, 121, 131, 141, 151 for each of the main sound card settings

	201-203    Sound Blaster settings menu
	211, 221, 231  for each of the SB settings
    
    300 CD-ROM attached/not attached
    301-303 CD-ROM Mitsumi settings menu options
    311-314 CD-ROM type selection
    321-324 CD-ROM port address
    331-334 CD-ROM IRQ address
    341-344 CD-ROM DMA address
*/

@DefineVars
	@Dir @EnteredWinDir
	@Drive @EnteredWinDrive
	@Qstring @MainPort
	@Qstring @MainIRQ
	@Qstring @MainDMA
	@Qstring @MIDIPort
	@Qstring @MIDIIRQ
	@Integer @DosInstall
	@Integer @WindowsInstall
	@Qstring @cdtype =""
	@Qstring @cdport =""
	@Qstring @cdIRQ ="DISABLED"
	@Qstring @cddma ="DISABLED"
	@Qstring @blasterport =""
	@Qstring @blasterirq =""
	@Qstring @blasterdma =""
	@Qstring @TrySetting = ""

	
	//Monte Carlo Title box (one of the flashier parts of this install) 
	@Qstring @box1 ="ΙΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝ»"
	@Qstring @box2 ="Ί                                             Ί"
	@Qstring @box3 ="ΘΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΝΌ"
	@Qstring @logo1 ="            Turtle Beach Systems            "
	@Qstring @logo2 ="  Installation Program for the Monte Carlo  "
	@Integer @colformat = 15
	@Integer @rowformat = 0
	@Integer @boxcolor1 =126
	@Integer @boxcolor2 =116

	// File set sizes (all in KB)
	@Integer @DOSSize = 439
	@Integer @RegDrivSize = 199
	@Integer @SierraSize = 441
	@Integer @WaveSESize = 1692
	@Integer @MicroWaveSize = 709
	@Integer @StratosSize = 1534
	@Integer @VSynthSize = 3144
	@Integer @SwitchSize = 60
	@Integer @MousePlayerSize = 89
	@Integer @MidiMapSize = 56
	@Integer @TBMixerSize = 246
	@Integer @TotalSize = 0
	@Integer @TotalSizeBytes = 0
	@Integer @bVSynth = @false
	
	@Qstring @SysIni = "C:\\WINDOWS\\SYSTEM.INI"
	@Qstring @BootLine = ""
	@Qstring @DrvPath
	@Qstring @MCarloIni = ""
	
	@Integer @WSS = 1
	@Integer @SB = 2
	@Integer @MIDI = 3
	
	@Qstring @ActionStr = ""
    @Integer @Row = 1
    @Integer @Col = 1
    @Qstring @TempMIDIPort
    @Qstring @RunLine = ""
    @Qstring @GroupFilePath = ""

@EndVars





@ClearOption(60)  // reboot option

// ****************************************
// Welcome screen
// ****************************************
@movecstr(@rowformat,@colformat,@boxcolor1,"@box1")
@movecstr(@rowformat+1,@colformat,@boxcolor1,"@box2")
@movecstr(@rowformat+2,@colformat,@boxcolor1,"@box2")
@movecstr(@rowformat+3,@colformat,@boxcolor1,"@box3")
@movecstr(@rowformat+1,@colformat+1,@boxcolor2,"@logo1")
@movecstr(@rowformat+2,@colformat+1,@boxcolor2,"@logo2")
@Display





	      Welcome to the installation program for Monte Carlo 

      
		    
			This program allows you to:
		
	- Install Monte Carlo for DOS or Windows.
	      
	- Uninstall - delete all files and undo changes made to system files. 
      
	- Configure Monte Carlo for DOS or Windows.


					@Pause
@EndDisplay

@FlushOptions()


// ******************************************
// Main menu
// ******************************************
@ClearOption(1)
@ClearOption(2)
@ClearOption(3)
@ClearOption(4)
@GetOption
	@movecstr(@rowformat,@colformat,@boxcolor1,"@box1")
	@movecstr(@rowformat+1,@colformat,@boxcolor1,"@box2")
	@movecstr(@rowformat+2,@colformat,@boxcolor1,"@box2")
	@movecstr(@rowformat+3,@colformat,@boxcolor1,"@box3")
	@movecstr(@rowformat+1,@colformat+1,@boxcolor2,"@logo1")
	@movecstr(@rowformat+2,@colformat+1,@boxcolor2,"@logo2")

	@LocalWindow(10,40)
    @Option 1 = "Install"
    @Option 2 = "Uninstall"
    @Option 3 = "Configure"
    @Option 4 = "Exit"
    
	
	
	@movecstr(14, 5, 23, "Install:")
		@movecstr(15, 7, 23, "Copies all MC files to your hard drive, configures hardware settings")
	@movecstr(17, 5, 23, "Uninstall:")
		@movecstr(18, 7, 23, "Deletes all MC files, deletes lines from system files")
	@movecstr(20, 5, 23, "Configure:")
		@movecstr(21, 7, 23, "Configures hardware settings")

    //@movecstr(20,5,31," Do you want to do an installation, uninstallation, or configure card settings?")
@EndOption

@if (4[=@option)
	@exit
@endif

@if(1[=@option)
	@ActionStr = "Installation"
@elseif(3[=@option)
	@ActionStr = "Configuration"
@elseif(2[=@option)
	@ActionStr = "Uninstallation"
@endif
		  


// ******************************************
// Select DOS or Windows installation so we know whether to ask for Windows directory
// ******************************************
BEGIN_INSTALLATION_SELECTIONS:

//@if (2[!@option)  // if not uninstall 


	@SetOption(21)
	@SetOption(22)
	@GetOption
		@Checkbox
	    
		@movecstr(0, 27, 30, "@ActionStr options")
		
	    @movecstr(2, 5, 27, "Up and down arrow keys - highlight the option you wish to change")
	    @movecstr(3, 5, 27, "Space bar - alternate selecting or deselecting the option")
	    @movecstr(5, 5, 27, "Enter - accept the options as shown")
	    
	    
		@LocalWindow(10,40)
		@Option 21 = "DOS @ActionStr"
		@Option 22 = "Windows @ActionStr"
	
		@movecstr(14, 5, 23, "DOS @ActionStr:")
		@if (1[=@option)
			@movecstr(16, 7, 23, "Copies all DOS applications to your hard drive")
		@endif
		@movecstr(15, 7, 23, "Configures hardware settings for DOS games and other DOS apps.")
		@movecstr(18, 5, 23, "Windows @ActionStr:")
		@if (1[=@option)
			@movecstr(20, 7, 23, "Copies Windows applications to your hard drive")
		@endif
		@movecstr(19, 7, 23, "Configures hardware settings for Monte Carlo under Windows")
	
	@EndOption
	
	@if (21[=@option)
		@DOSInstall = @true
	@else
		@DOSInstall = @false
	@endif
	@if (22[=@option)
		@WindowsInstall = @true
	@else
		@WindowsInstall = @false
	@endif
//@endif  // not uninstall        



/*
///++++++++++++++++++++++
//@if (2[!@option)  // if not uninstall 
	@SetOption(70)
	@SetOption(40)
	@ClearOption(300)
	@GetOption
		@Checkbox
	    
		@movecstr(1, 27, 30, "@ActionStr options")
		
	    @movecstr(3, 5, 27, "Up and down arrow keys - highlight the option you wish to change")
	    @movecstr(4, 5, 27, "Space bar - alternate selecting or deselecting the option")
	    @movecstr(6, 5, 27, "Enter - accept the options as shown")


		@movecstr(20, 5, 23, "Test - choosing this option could cause computer to lock-up")
			@movecstr(17, 5, 23, "Default MIDI - Monte Carlo for Windows default MIDI")
			//@movecstr(18, 5, 23, "CD-ROM - select if a CD-ROM is attached to your Monte Carlo")           
		@Option 70 = "Test selected hardware settings"
			@Option 40 = "Set Windows default MIDI to Monte Carlo"
			@Option 300 = "CD-ROM drive attachment"
		@LocalWindow(10,40)
*/

/*          
		@LocalWindow(10,40)
		@Option 70 = "Test selected hardware settings"
	    
		@if (@WindowsInstall)
			@Option 40 = "Set Windows default MIDI to Monte Carlo"
		@endif  

		@if (@DOSInstall)
			@Option 300 = "CD-ROM drive attachment"
		@endif  
	
		
		//@movecstr(14, 5, 23, "Test - choosing this option could cause computer to lock-up")

		@if (@WindowsInstall)
			@movecstr(17, 5, 23, "Default MIDI - Monte Carlo for Windows default MIDI")
		@endif
*/
/*
		@if (@DOSInstall)
			@movecstr(18, 5, 23, "CD-ROM - select if a CD-ROM is attached to your Monte Carlo")             
			//@movecstr(18, 5, 23, "CD-ROM")                
		@endif
		
	
	@EndOption
//@endif        
//++++++++++++++++++++++++++
*/



// ***********************************************
// Get output disk drive and directory
// ***********************************************
@GetOutDrive
	@Cls
    @suppress(0,17)
	@movecstr(0, 27, 30, "@ActionStr drive")
	@movecstr(4, 15, 27, "Please specify disk drive for @Name files")

	@LocalWindow(10, 37)

@EndOutDrive


@if(2[=@option)
	@if ( (@exists("@OutDrive:\\mcuninst.ini") == @TRUE) )
		@subdir = @GetProfString("@OutDrive:\\mcuninst.ini", "install", "InstallSubdir")
	@endif
@endif          
	


@GetSubdir
	@Cls
	@movecstr(0, 27, 30, "@ActionStr directory")
	@movecstr(4, 16, 27, "Please specify directory for @Name files")


	//@Prompt = "Which subdirectory ([Enter] = @Subdir) ?"
	@LocalWindow(10, 50)
@EndSubdir



// ***********************************************
// Get Windows disk drive and directory
// ***********************************************

GETWINDOWSDIR:

@if (@WindowsInstall == @true)

	@EnteredWinDir = "\\windows"
	
	@GetOutDrive @EnteredWinDrive
		@Cls
	    @suppress(0,17)
		@movecstr(0, 23, 30, "@ActionStr - Windows drive")
		@movecstr(4, 17, 27, "On which disk drive is Windows located?")
		
		@LocalWindow(10, 37)
	
	@EndOutDrive
		
	@GetSubDir @EnteredWinDir       
		@Cls
		@movecstr(0, 21, 30, "@ActionStr - Windows directory")
		@movecstr(4, 19, 27, "In which directory is Windows located?")
	
		@Prompt = "What is your windows directory?"
		@LocalWindow(12, 50)
	@EndSubDir
	  
	@if (@exists("@EnteredWinDrive:@EnteredWinDir\\win.com") != @TRUE)
		@Display
			
			No win.com in that directory.
			
					
					
					@Pause
		@EndDisplay
		@goto GETWINDOWSDIR      
	@Endif  // win.com exists
	@if (@exists("@EnteredWinDrive:@EnteredWinDir\\system.ini") != @TRUE)
		@Display
			No system.ini in that directory.
			
			@Pause
		@EndDisplay
		@goto GETWINDOWSDIR      
	@Endif  // system.ini exists
	@SysIni = "@EnteredWinDrive:@EnteredWinDir\\system.ini"
@Endif  // windows installation       


AFTERGETWINDOWSDIRECTORY:


@if (3[=@option && @WindowsInstall &&  // configuring and V-Synth files exists
	(@exists("@OutDrive:@SubDir\\drv\\softnote.drv") == @true)) 
	@ClearOption(37)
	@ClearOption(38)
	@GetOption
		@movecstr(0, 27, 30, "V-Synth drivers?")
	    @movecstr(3, 7, 27, "Do you wish to configure for V-Synth or regular drivers?")
		@LocalWindow(10, 40)
		@Option 38 = "Regular drivers"
		@Option 37 = "V-Synth drivers"
	@EndOption        
@endif
	
@if (37[=@option)
	@bVsynth = @TRUE
@else
	@bVsynth = @FALSE
@endif


// if user chose to install, don't jump anywhere
@if (2[=@option)
	@goto SHOW_ALL
@elseif (3[=@option)
	@goto START_CONFIGURE
@endif                  


// **********************************************
// File selection
// **********************************************

@if (@WindowsInstall == @true)
	// Full/Custom
	@ClearOption(11)
	@ClearOption(12)
	@GetOption
		@movecstr(0, 21, 30, "Full or custom installation of files")

		@movecstr(3, 5, 27, "Do you wish to automatically install all files, or pick and choose?")
		
		@LocalWindow(10, 40)
		@Option 11 = "Full installation"
		@Option 12 = "Custom installation"              
	
		@movecstr(13, 5, 23, "Full installation")
		@movecstr(14, 7, 23, "Automatically installs all DOS and Windows apps (without VSynth)")
		@movecstr(16, 5, 23, "Custom installation")
		@movecstr(17, 7, 23, "Select which Windows apps you wish to install")
		@movecstr(19, 5, 23, "Tip: Select Custom installation and then V-Synth")
		@movecstr(20, 5, 23, "if synthesizer quality is a priority for you")
	@EndOption
	
	// if full installation
	@if (11[=@option)
		// Set all Windows apps on
		@SetOption(31)
		@SetOption(32)
		@SetOption(33)
		@SetOption(34)
		@SetOption(35)
		@SetOption(36)
		@ClearOption(37)
	@else
		// Windows apps selection
		// Set all Windows apps on except for v-synth
		@SetOption(31)
		@SetOption(32)
		@SetOption(33)
		@SetOption(34)
		@SetOption(35)
		@SetOption(36)
		@ClearOption(37)
		@GetOption
			@CheckBox
			@movecstr(0, 27, 30, "Windows applications")
    
		    @movecstr(2, 5, 27, "Up and down arrow keys - highlight the option you wish to change")
		    @movecstr(3, 5, 27, "Space bar - alternate selecting or deselecting the option")
		    @movecstr(5, 5, 27, "Enter - accept the options as shown")
			
			@LocalWindow(13, 38)
			
			@Option 31 = "TB Mixer"
			@Option 32 = "Wave SE"
			@Option 33 = "MicroWave"
			@Option 34 = "Mouse Player"
			@Option 35 = "Stratos"
			@Option 36 = "Sierra Audio Rack"
			@Option 37 = "V-synth"
			@movecstr(19, 14, 23, "Choose which Windows applications to install")
			@movecstr(21, 5, 23, "Tip: Select V-Synth if synthesizer quality is a priority for you")
		@EndOption
	@endif   


@endif  // Windows install


@if (!@WindowsInstall)
	// Set all Windows apps off just in case
	@ClearOption(31)
	@ClearOption(32)
	@ClearOption(33)
	@ClearOption(34)
	@ClearOption(35)
	@ClearOption(36)
	@ClearOption(37)
@endif  


@if (@WindowsInstall && 37[=@option)
	@bVSynth = @true
@else
	@bVSynth = @false
@endif          



// **********************************************
// Check space on drive
// **********************************************
CHECK_SPACE_ON_DRIVE:

// Figure out total disk space needed
@TotalSize = 0

@if (@DOSInstall == @true)
	@TotalSize = (@TotalSize + @DOSSize)
@endif
@if (@WindowsInstall == @true)
	@TotalSize = (@TotalSize + @RegDrivSize)
	@if (36[=@option)
		@TotalSize = (@TotalSize + @SierraSize)
	@endif
	@if (32[=@option)
		@TotalSize = (@TotalSize + @WaveSESize)
	@endif
	@if (33[=@option)
		@TotalSize = (@TotalSize + @MicroWaveSize)
	@endif
	@if (35[=@option)
		@TotalSize = (@TotalSize + @StratosSize)
	@endif
	@if (37[=@option)
		@TotalSize = (@TotalSize + @VSynthSize)
		@TotalSize = (@TotalSize + @SwitchSize)
	@endif
	@if (34[=@option)
		@TotalSize = (@TotalSize + @MousePlayerSize)
	@endif
	@if (31[=@option)
		@TotalSize = (@TotalSize + @TBMixerSize)
	@endif
	@TotalSize = (@TotalSize + @MidiMapSize)
@endif  

@TotalSizeBytes = (@TotalSize * 1024)


@if (@DiskFree(@OutDrive) < @TotalSize)
	@Display
		Not enough disk space on drive @OutDrive.
		Press ESC to exit and delete files, or hit enter to select a different drive
		@Pause
		@goto BEGIN_INSTALLATION_SELECTIONS 
	@EndDisplay
@endif           


// ******************************************
// Configuration start
// ******************************************
START_CONFIGURE:

@if (!@DOSInstall)
	@goto END_OF_CD_ROM_CONFIG  // skip past CD-ROM configuration
@endif  

// ******************************************
// CD-ROM configuration
// ******************************************
@ClearOption(300)
@GetOption
	@CheckBox
	@movecstr(0, 25, 30, "CD-ROM drive attachment")
    @movecstr(3, 5, 27, "Space bar - alternate selecting or deselecting the option")
    @movecstr(5, 5, 27, "Enter - accept the option as shown")
    @movecstr(8, 18, 31, "Is a CD-ROM attached to your Monte Carlo?")
	@LocalWindow(12,37)
	@Option 300 = "CD-ROM?"
	//@Option 300 = "Is a CD-ROM attached to your Monte Carlo?"
@EndOption

@if (300[!@option) // no CD-ROM attached
	@cdtype="DISABLED" 
	@cdport="DISABLED"
	@cddma="DISABLED"
	@cdIRQ="DISABLED"
	@goto END_OF_CD_ROM_CONFIG
@endif

// otherwise configure the CD-ROM

@ClearOption(311)
@ClearOption(312)
@ClearOption(313)
@ClearOption(314)
@GetOption
	@movecstr(0, 27, 30, "Attachment CD-ROM types")
    @movecstr(3, 7, 27, "Choose the CD-ROM type you have attached to the Monte Carlo")
	@LocalWindow(10, 40)
	@Option 311 = "SONY31A"
	@Option 312 = "PANASONIC"
	@Option 313 = "MITSUMI"
	@Option 314 = "ATAPI-IDE"
@EndOption        

@if(311[=@option)               // Sony
	@cdtype="SONY31A"           
	@cdIRQ="DISABLED"
	@cddma="DISABLED"
@elseif(312[=@option)           // Panasonic
	@cdtype="PANASONIC"         
	@cdIRQ="DISABLED"
	@cddma="DISABLED"
@elseif(313[=@option)           // Mitsumi
	@cdtype="MITSUMI"           
@elseif(314[=@option)           // IDE Drive
	@cdtype="IDE_SEC"
	@cdport="DISABLED"                      // prevents error message from coming up
@endif

// Since we have to specify port and irq for Mitsumi, we won't get port address here.
@if ("@cdtype" != "IDE_SEC" && "@cdtype" != "MITSUMI")
	@GetOption
		@movecstr(0, 27, 30, "Attachment CD-ROM port")
	@movecstr(3, 2, 27, "What I/O address should be used for the attached @cdtype CD-ROM drive?")
		@LocalWindow(10,40)
		@Option 321 = "320"

		@if ("@cdtype" != "PANASONIC")
		  @Option 322 = "330"
		@endif

		@Option 323 = "340"

		@if ("@cdtype" != "PANASONIC")
		  @Option 324 = "360"
		@endif

		@if ("@cdtype" != "PANASONIC")
			@movecstr(21,6,28,"Notice: Using address 330 will disable the External Midi Port.")
		@endif
	@EndOption

	@if(321[=@option)
		@cdport="320"
	@elseif(322[=@option)
		@cdport="330"
	@elseif(323[=@option)
		@cdport="340"
	@elseif(324[=@option)
		@cdport="360"
	@endif
@endif          


@if("@cdtype" != "MITSUMI")
	@goto END_OF_MITSUMI_SETTINGS
@endif  
	
	  
// initialize the CD-ROM settings.
@cdport = "320"
@cdIRQ = "3"
@cdDMA = "3"
	
MAIN_CDROM_SETTINGS_MENU:
@ClearOption(301)
@ClearOption(302)
@ClearOption(303)
@ClearOption(304)
	
@GetOption
	@movecstr(0, 27, 30, "Mitsumi CD-ROM settings")
    @movecstr(2, 5, 27, "Up and down arrow keys - highlight the setting you wish to change")
    @movecstr(4, 5, 27, "Enter - change the highlighted setting")
    @movecstr(5, 5, 27, "Hit enter again to come back to this menu with the changed setting.")
    @LocalWindow(10,40)

	@Option 301 = "Continue with settings as shown"
	@Option 302 = "Mitsumi Port Address...@cdport"
	@Option 303 = "Mitsumi IRQ............@cdIRQ"
	@Option 304 = "Mitsumi DMA............@cdDMA"
@EndOption      
	
@if(301[=@option) // user wants to continue with present settings
    @goto END_OF_MITSUMI_SETTINGS
@elseif(302[=@option)  // CD-ROM Port address
	@goto CDROM_PORT_SETTING
@elseif(303[=@option)  // CD-ROM IRQ
	@goto CDROM_IRQ_SETTING
@elseif(304[=@option)  // CD-ROM DMA
	@goto CDROM_DMA_SETTING
@endif



CDROM_PORT_SETTING:
@ClearOption(321)
@ClearOption(322)
@ClearOption(323)
@ClearOption(324)
@GetOption
	@movecstr(0, 27, 30, "Mitsumi CD-ROM Port Address")
	@Option 321 = "320"
	@Option 322 = "330"
	@Option 323 = "340"
	@Option 324 = "360"
    @LocalWindow(10,40)
@EndOption
@if(321[=@option)
	@cdport = "320"
@elseif (322[=@option)
	@cdport = "330"
@elseif (323[=@option)
	@cdport = "340"
@elseif (324[=@option)
	@cdport = "350"
@else //default
	@cdport = "320" 
@endif                  
@goto MAIN_CDROM_SETTINGS_MENU

CDROM_IRQ_SETTING:
@ClearOption(331)
@ClearOption(332)
@ClearOption(333)
@ClearOption(334)
@GetOption
	@movecstr(0, 27, 30, "Mitsumi CD-ROM IRQ")
	@Option 331 = "3"
	@Option 332 = "5"
	@Option 333 = "9"
	@Option 334 = "11"
    @LocalWindow(10,40)
@EndOption              
@if(331[=@option)
	@cdIRQ = "3"
@elseif (332[=@option)
	@cdIRQ = "5"
@elseif (333[=@option)
	@cdIRQ = "9"
@elseif (334[=@option)
	@cdIRQ = "11"
@else //default
	@cdIRQ = "3"    
@endif                  
@goto MAIN_CDROM_SETTINGS_MENU
		
		
CDROM_DMA_SETTING:
@ClearOption(341)
@ClearOption(342)
@GetOption
	@movecstr(0, 27, 30, "Mitsumi CD-ROM DMA")
	@Option 341 = "3"
	@Option 342 = "1"
    @LocalWindow(10,40)
@EndOption
@if(341[=@option)
	@cdDMA = "3"
@elseif (342[=@option)
	@cdDMA = "1"
@else //default
	@cdDMA = "3"    
@endif                  

@goto MAIN_CDROM_SETTINGS_MENU

END_OF_MITSUMI_SETTINGS:


END_OF_CD_ROM_CONFIG:




@SetOption(70)
@GetOption
	@movecstr(2, 5, 31, "                                                ")
	@movecstr(4, 7, 31, "                                    ")
	@movecstr(6, 7, 31, "                                    ")
	@CheckBox
	@movecstr(0, 27, 30, "Hardware testing")
	@movecstr(3, 5, 27, "Space bar - alternate selecting or deselecting the option")
	@movecstr(5, 5, 27, "Enter - accept the option as shown")
    @movecstr(8, 12, 31, "Do you want selected hardware settings to be tested?")
	@Option 70 = "Test hardware?"
	@LocalWindow(12,37)  // was 40
	@movecstr(19, 5, 23, "Testing the hardware settings could lock up your machine") 
@EndOption





// ******************************************
// Sound card configuration (main settings)
// ******************************************

// set defaults
@MainPort = "530"
@if ("@cdIRQ" != "7")
	@MainIRQ = "7"
@else
	@MainIRQ = "10"
@endif          

@if ("@cdDMA" != "1")
	@MainDMA = "1"
@else   
	@MainDMA = "0"
@endif  
	

@MIDIPort = "330"
@MIDIIRQ = "9"
/*
@if ("@cdPort" != "330")
	@MIDIPort = "330"
@else
	@MIDIPort = "300"
@endif  
		
@if ("@cdIRQ" != "9")
	@MIDIIRQ = "9"
@else
	@MIDIIRQ = "5"
@endif
*/              

MAIN_SETTINGS_MENU:
@ClearOption(101)
@ClearOption(102)
@ClearOption(103)
@ClearOption(104)
@ClearOption(105)
@ClearOption(106)

@GetOption
	@movecstr(0, 21, 30, "Monte Carlo primary hardware settings")
    @movecstr(2, 5, 27, "Up and down arrow keys - highlight the setting you wish to change")
    @movecstr(4, 5, 27, "Enter - change the highlighted setting")
    @movecstr(5, 5, 27, "Hit enter again to come back to this menu with the changed setting.")
    @LocalWindow(12,40)
	
	@Option 101 = "Continue with settings as shown"
	@Option 102 = "Digital Audio Port Address...@MainPort"
	@Option 103 = "Digital Audio IRQ............@MainIRQ"
	@Option 104 = "Digital Audio DMA............@MainDMA"
	@Option 105 = "MIDI Port Address............@MIDIPort"
	@Option 106 = "MIDI IRQ.....................@MIDIIRQ"
	@movecstr(18, 8, 23, "Note: MIDI Port Address and MIDI IRQ are used to set up the MIDI")
	@movecstr(19, 8, 23, "      interface used for external keyboard or daughter card")
	//@movecstr(18, 4, 23, "MIDI - MPU-401 interface used for external keyboard or daughtercard")
@EndOption



@if(101[=@option) // user wants to continue with present settings
    // first check to see if the settings work and default IRQ not the same as CD-ROM IRQ 
    @goto END_OF_MAIN_SETTINGS
		
@elseif(102[=@option)  // Main Port
	@goto MAIN_PORT_SETTING
@elseif(103[=@option)  // Main IRQ
	@goto MAIN_IRQ_SETTING
@elseif(104[=@option)  // Main DMA
	@goto MAIN_DMA_SETTING
@elseif(105[=@option)  // MIDI Port
	@goto MIDI_PORT_SETTING
@elseif(106[=@option)  // MIDI IRQ
	@goto MIDI_IRQ_SETTING
@endif


MAIN_PORT_SETTING: 
	@ClearOption(111)
	@ClearOption(112)
	@ClearOption(113)
	@ClearOption(114)
	@GetOption
		@movecstr(0, 32, 30, "Primary Port I/O")
		@LocalWindow(10,40)
		@Option 111 = "530 (default)"
		@Option 112 = "604"
		@Option 113 = "e80"
		@Option 114 = "f40"
	@EndOption
	@if(111[=@option)
		@TrySetting = "530"
	@elseif (112[=@option)
		@TrySetting = "604"
	@elseif (113[=@option)
		@TrySetting = "e80"
	@elseif (114[=@option)
		@TrySetting = "f40"
	@else //default
		@TrySetting = "530"     
	@endif                  
	
	/*
	This block of code will be placed after ever selection (Port, DMA, IRQ)
	
	// Now check this port address
	@if (@CheckPortIO("@TrySetting", @WSS) == TRUE)
		@MainPort = "@TrySetting"
	@else
		@Display
			Port address @TrySetting failed.
			@pause
		@EndDisplay     
		@goto MAIN_PORT_SETTING  ????
	@endif  
	*/
	@MainPort = "@TrySetting"
	@goto MAIN_SETTINGS_MENU

MAIN_IRQ_SETTING:

	@ClearOption(121)
	@ClearOption(122)
	@ClearOption(123)
	@ClearOption(124)
	
	@GetOption
		@movecstr(0, 34, 30, "Primary IRQ")
		@LocalWindow(10,40)
		@if (("@cdIRQ" != "7") && ("@MidiIRQ" != "7")) 
			@Option 121 = "7 (default)" 
		@endif
		@if (("@cdIRQ" != "9") && ("@MidiIRQ" != "9")) 
			@Option 122 = "9" 
		@endif
		@if (("@cdIRQ" != "10") && ("@MidiIRQ" != "10")) 
			@Option 123 = "10" 
		@endif
		@if (("@cdIRQ" != "11") && ("@MidiIRQ" != "11")) 
			@Option 124 = "11" 
		@endif
	@EndOption              

	
	@if(121[=@option)
		@TrySetting = "7"
	@elseif (122[=@option)
		@TrySetting = "9"
	@elseif (123[=@option)
		@TrySetting = "10"
	@elseif (124[=@option)
		@TrySetting = "11"
	@else //default
		@TrySetting = "7"
	@endif
    
	// now assign @MainIRQ to @TrySetting if it succeeds hardware test
	@MainIRQ = "@TrySetting"
	@goto MAIN_SETTINGS_MENU
					

MAIN_DMA_SETTING:
	@ClearOption(131)
	@ClearOption(132)
	@ClearOption(133)
	@ClearOption(134)
	@GetOption
		@movecstr(0, 34, 30, "Primary DMA")
		@LocalWindow(10,40)
		@if ("@cdDMA" != "1") 
			@Option 132 = "1 (default)" 
		@endif
		@if ("@cdDMA" != "0") 
			@Option 131 = "0" 
		@endif
		@if ("@cdDMA" != "2") 
			@Option 133 = "3" 
		@endif
	@EndOption
	@if(131[=@option)
		@TrySetting = "0"
	@elseif (132[=@option)
		@TrySetting = "1"
	@elseif (133[=@option)
		@TrySetting = "3"
	@else //default
		@TrySetting = "1"
	@endif                  
	
	// now assign @MainDMA to @TrySetting if it succeeds hardware test
	@MainDMA = "@TrySetting"
	@goto MAIN_SETTINGS_MENU

MIDI_PORT_SETTING:
	@ClearOption(141)
	@ClearOption(142)
	@ClearOption(143)
	@ClearOption(144)
	@GetOption
		@movecstr(0, 32, 30, "MIDI Port I/O")
		@LocalWindow(10,40)
		@if ("@cdport" != "330") 
			@Option 145 = "330 (default)" 
		@endif
		@if ("@cdport" != "300") 
			@Option 142 = "300" @endif
		@if ("@cdport" != "310") 
			@Option 143 = "310" 
		@endif
		@if ("@cdport" != "320") 
			@Option 144 = "320" 
		@endif
		@Option 141 = "disabled"
	@EndOption
	@if(141[=@option)
		@MIDIPort = "disabled"
		@MIDIIRQ = "disabled"
	@elseif(142[=@option)
		@MIDIPort = "300"
	@elseif (143[=@option)
		@MIDIPort = "310"
	@elseif (144[=@option)
		@MIDIPort = "320"
	@elseif (145[=@option)
		@MIDIPort = "330"
	@else //default
		@MIDIPort = "disabled"
	@endif                  
	@goto MAIN_SETTINGS_MENU

MIDI_IRQ_SETTING:
	@ClearOption(151)
	@ClearOption(152)
	@ClearOption(153)
	@ClearOption(154)
	@GetOption
		@movecstr(0, 35, 30, "MIDI IRQ")
		@LocalWindow(10,40)
		@if ("@cdIRQ" != "9"  && "@MainIRQ" != "9") 
			@Option 154 = "9 (default)" 
		@endif
		@if ("@cdIRQ" != "5"  && "@MainIRQ" != "5") 
			@Option 152 = "5" 
		@endif
		@if ("@cdIRQ" != "7"  && "@MainIRQ" != "7") 
			@Option 153 = "7" 
		@endif
		@if ("@cdIRQ" != "10" && "@MainIRQ" != "10") 
			@Option 155 = "10" 
		@endif
		@Option 151 = "disabled" 
	@EndOption
	@if(151[=@option)
		@MIDIIRQ = "disabled"
		@MIDIPort = "disabled"
	@elseif(152[=@option)
		@MIDIIRQ = "5"
	@elseif (153[=@option)
		@MIDIIRQ = "7"
	@elseif (154[=@option)
		@MIDIIRQ = "9"
	@elseif (155[=@option)
		@MIDIIRQ = "10"
	@else //default
		@MIDIIRQ = "disabled"
	@endif                  
	@goto MAIN_SETTINGS_MENU



@display
	Now to go back to main_settings_menu!
	@pause
@enddisplay     


//@goto MAIN_SETTINGS_MENU


END_OF_MAIN_SETTINGS:
	
	

	@if ("@MIDIPort" == "disabled" || "@MIDIIRQ" == "disabled")
		@MIDIPort = "disabled"
		@MIDIIRQ = "disabled"
	@endif  


@if (70[=@option)
	@Row = 2

	@Display
	@cls
	Now hardware will be tested for availability. If there is a hardware 
	conflict, your computer may lock up. If the installation does not 
	continue within a minute or less, please reset your machine and
	begin the install again, choosing different settings.
					
					
					
					@pause
				@cls 
	@EndDisplay
		
    @movecstr(@Row, 5, 31, "Testing availability of chosen hardware settings")
    
	
	@Row = (@Row + 2)
    @movecstr(@Row, 7, 31, "Checking Primary Port Address: @MainPort")
	// Now check the hardware, going back to menu if anything fails
	@if ((@CheckPortIO(@WSS, "@MainPort")) != 0)
		@Display
			
			
			










		Port address @MainPort failed. Try a different setting.
			
			
			
					@pause
		@EndDisplay     
		@goto MAIN_SETTINGS_MENU

	//@elseif (@true)       
	@endif
	
	@Row = (@Row + 1)
    @movecstr(@Row, 7, 31, "Checking Primary IRQ: @MainIRQ")
	@if (@CheckIRQ(@WSS, "@MainPort", "@MainIRQ", "@MainDMA") != 0)     
		@Display
			
			
			










		Primary IRQ @MainIRQ failed. Try a different setting.
			
			
			
					@pause
		@EndDisplay     
		@goto MAIN_SETTINGS_MENU
	@endif

	@Row = (@Row + 1)
    @movecstr(@Row, 7, 31, "Checking Primary DMA: @MainDMA")
	@if (@CheckDMA(@WSS, "@MainPort", "@MainIRQ", "@MainDMA") != 0)     
		@Display
			
			
			










		Primary DMA @MainDMA failed. Try a different setting.
			
			
			
					@pause
		@EndDisplay     
		@goto MAIN_SETTINGS_MENU
	@endif

	@Row = (@Row + 1)
    @movecstr(@Row, 7, 31, "Checking MIDI Port: @MIDIPort")
	@if (@CheckPortIO(@MIDI, "@MIDIPort") != 0) 
		@Display
			
			
			










		MIDI Port @MIDIPort failed. Try a different setting.
			
			
			
					@pause
		@EndDisplay     
		@goto MAIN_SETTINGS_MENU
	@endif
	
	@Row = (@Row + 1)
    @movecstr(@Row, 7, 31, "Checking MIDI IRQ: @MIDIIRQ")
	@if (@CheckIRQ(@MIDI, "@MIDIPort", "@MIDIIRQ", "") != 0)     
		@Display
			
			
			










		MIDI IRQ @MIDIIRQ failed. Try a different setting.
			
			
			
					@pause
		@EndDisplay     
		@goto MAIN_SETTINGS_MENU
	@endif  

@endif

/*
	@display
		
		
		
		
		
		
		
		@pause
	@enddisplay     
*/

		







@if (!@DosInstall)
	@goto END_OF_BLASTER_SETTINGS
@endif          

// ******************************************
// Sound Blaster Configuration
// ******************************************
@BlasterPort = "220"

@if ("@cdIRQ" != "7" && "@MIDIIRQ" != "7")
	@BlasterIRQ = "7"
@elseif ("@cdIRQ" != "5" && "@MIDIIRQ" != "5")
	@BlasterIRQ = "5"
@else
	@BlasterIRQ = "10"
@endif                  

@if ("@cdDMA" != "1")
	@BlasterDMA = "1"
@else 
	@BlasterDMA = "0"
@endif          

BLASTER_SETTINGS_MENU:
@ClearOption(201)
@ClearOption(202)
@ClearOption(203)
@ClearOption(204)

@GetOption
	@cls
	@movecstr(0, 24, 30, "Monte Carlo blaster settings")
    @movecstr(2, 5, 27, "Up and down arrow keys - highlight the setting you wish to change")
    @movecstr(4, 5, 27, "Enter - change the highlighted setting")
    @movecstr(5, 5, 27, "Hit enter again to come back to this menu with the changed setting.")
    @LocalWindow(12,40)
	@Option 201 = "Continue with settings as shown"
	@Option 202 = "Port Address...@BlasterPort"
	@Option 203 = "IRQ............@BlasterIRQ"
	@Option 204 = "DMA............@BlasterDMA"
	@movecstr(20, 3, 23, "Sound Blaster hardware settings are necessary for most DOS games")
	//@movecstr(20, 7, 23, "Tip: Identical IRQ/DMA settings can be used ")
	//@movecstr(21, 7, 23, "for blaster settings and primary hardware settings")
@EndOption



@if(201[=@option) // user wants to continue with present settings
    // first check to see if the settings work and default IRQ not the same as CD-ROM IRQ 
    @goto END_OF_BLASTER_SETTINGS
		
@elseif(202[=@option)  // Blaster Port
	@goto BLASTER_PORT_SETTING
@elseif(203[=@option)  // Blaster IRQ
	@goto BLASTER_IRQ_SETTING
@elseif(204[=@option)  // Blaster DMA
	@goto BLASTER_DMA_SETTING
@endif




BLASTER_PORT_SETTING:
	@ClearOption(211)
	@ClearOption(212)
	@GetOption
		@movecstr(0, 28, 30, "Sound Blaster Port I/O")
		@LocalWindow(10,40)
		@Option 211 = "220 (default)"
		@Option 212 = "240"
	@EndOption
	@if(211[=@option)
		@TrySetting = "220"
	@elseif (212[=@option)
		@TrySetting = "240"
	@else //default
		@TrySetting = "220"     
	@endif                  
	
	/*
	This block of code will be placed after ever selection (Port, DMA, IRQ)
	
	// Now check this port address
	@if (@CheckIO("@TrySetting") == TRUE)
		@BlasterPort = "@TrySetting"
	@else
		@Display
			Port address @TrySetting failed.
			@pause
		@EndDisplay     
	@endif  
	*/
	@BlasterPort = "@TrySetting"
	@goto BLASTER_SETTINGS_MENU


BLASTER_IRQ_SETTING:
	@ClearOption(221)
	@ClearOption(222)
	@ClearOption(223)
	@GetOption
		@movecstr(0, 31, 30, "Sound Blaster IRQ")
		@LocalWindow(10,40)
		@if ("@cdIRQ" != "7" && "@MidiIRQ" != "7") @Option 222 = "7 (default)" @endif
		@if ("@cdIRQ" != "5" && "@MidiIRQ" != "5") @Option 221 = "5" @endif
		@if ("@cdIRQ" != "10" & "@MidiIRQ" != "10") @Option 223 = "10" @endif
	@EndOption              
	@if(221[=@option)
		@TrySetting = "5"
	@elseif (222[=@option)
		@TrySetting = "7"
	@elseif (223[=@option)
		@TrySetting = "10"
	@else //default
		@TrySetting = "7"
	@endif                  
	
	// now assign @BlasterIRQ to @TrySetting if it succeeds hardware test
	@BlasterIRQ = "@TrySetting"
	@goto BLASTER_SETTINGS_MENU



BLASTER_DMA_SETTING:
	@ClearOption(231)
	@ClearOption(232)
	@ClearOption(233)
	@ClearOption(234)
	@GetOption
		@movecstr(0, 31, 30, "Sound Blaster DMA")
		@LocalWindow(10,40)
		@if ("@cdDMA" != "1") @Option 232 = "1 (default)" @endif
		@if ("@cdDMA" != "0") @Option 231 = "0" @endif
		@if ("@cdDMA" != "3") @Option 233 = "3" @endif
	@EndOption
	@if(231[=@option)
		@TrySetting = "0"
	@elseif (232[=@option)
		@TrySetting = "1"
	@elseif (233[=@option)
		@TrySetting = "3"
	@else //default
		@TrySetting = "1"
	@endif                  
	
	// now assign @BlasterDMA to @TrySetting if it succeeds hardware test
	@BlasterDMA = "@TrySetting"

	@goto BLASTER_SETTINGS_MENU



END_OF_BLASTER_SETTINGS:


@if (70[=@option)
	// Now check the hardware, going back to menu if anything fails


	@Row = 2
		
	@Display
	@cls
	Now hardware will be tested for availability. If there is a hardware 
	conflict, your computer may lock up. If the installation does not 
	continue within a minute or less, please reset your machine and
	begin the install again, choosing different settings.
					
					
					
					@pause
				@cls 
	@EndDisplay
    
    @movecstr(@Row, 5, 31, "Testing availability of chosen hardware settings")
	
	@Row = (@Row + 2)
    @movecstr(@Row, 7, 31, "Checking Blaster Port Address: @BlasterPort")
	@if ((@CheckPortIO(@SB, "@BlasterPort")) != 0)
		@Display



		










		
		
		Port address @BlasterPort failed. Try a different setting.



					@pause
		@EndDisplay     
		@goto BLASTER_SETTINGS_MENU
	@endif  

	@Row = (@Row + 1)
    @movecstr(@Row, 7, 31, "Checking Blaster IRQ: @BlasterIRQ")
	@if ("@BlasterIRQ" == "5") 
		@TempMIDIPort = ""
		@if (@CheckPortIO(@MIDI, "330") == 0)
			@TempMIDIPort = "330"
		@elseif (@CheckPortIO(@MIDI, "320") == 0)        
			@TempMIDIPort = "320"
		@elseif (@CheckPortIO(@MIDI, "310") == 0)        
			@TempMIDIPort = "310"
		@elseif (@CheckPortIO(@MIDI, "300") == 0)        
			@TempMIDIPort = "300"
		@else
			@Display
				@cls
				
				
				Could not determine whether IRQ 5 will work
				
				
				
					@pause
			@EndDisplay
		@endif
		
		@if ("@TempMIDIPort" != "")
			@if (@CheckIRQ(@MIDI, "@TempMIDIPort", "5", "") != 0)     
				@Display
					
					
		
		
		










		Blaster IRQ @BlasterIRQ failed. Try a different setting.
		
					
					
					@pause
				@EndDisplay     
				@goto BLASTER_SETTINGS_MENU
			@endif
		@endif
	
	@elseif (@CheckIRQ(@WSS, "@BlasterPort", "@BlasterIRQ", "@BlasterDMA") != 0)    
		@Display
			
			
		
		
		











		Blaster IRQ @BlasterIRQ failed. Try a different setting.

			
			
					@pause
		@EndDisplay     
		@goto BLASTER_SETTINGS_MENU
	@endif
		
	@Row = (@Row + 1)
    @movecstr(@Row, 7, 31, "Checking Blaster DMA: @BlasterDMA")
	@if (@CheckDMA(@WSS, "@BlasterPort", "@BlasterIRQ", "@BlasterDMA") != 0)    
		@Display
			
			
			
		
		
		










		Blaster DMA @BlasterDMA failed. Try a different setting.
			
			
			
					@pause
		@EndDisplay     
		@goto BLASTER_SETTINGS_MENU
    @endif

@endif

/*
	@display
		
		
		
		
		
		
		@pause
	@enddisplay     
*/





@if (@WindowsInstall == @true)
// Default MIDI device
	@SetOption(40)
	@GetOption
	@movecstr(2, 5, 31, "                                                ")
	@movecstr(4, 7, 31, "                                    ")
	@movecstr(6, 7, 31, "                                    ")
		@CheckBox
		@movecstr(0, 25, 30, "Windows default MIDI")
		@movecstr(3, 5, 27, "Space bar - alternate selecting or deselecting the option")
		@movecstr(5, 5, 27, "Enter - accept the option as shown")
		@LocalWindow(12,37)  // was 40
	@movecstr(8, 5, 31, "Would you like Monte Carlo to be the Windows default MIDI device?")
		@Option 40 = "Monte Carlo MIDI?"
	@EndOption
@endif


/*
@ClearOption(60)
@GetOption
	@CheckBox
	@movecstr(0, 25, 30, "Automatic reboot after install")
    @movecstr(3, 5, 27, "Space bar - alternate selecting or deselecting the option")
    @movecstr(5, 5, 27, "Enter - accept the option as shown")
	@LocalWindow(10,40)
	@Option 60 = "Do you want machine to automatically reboot at the end of install?"
@EndOption
*/


// *************************************************
// Show all settings; give user a chance to change them
// *************************************************

SHOW_ALL:

@Display
	@cls
@EndDisplay
	
@movecstr(0, 5, 30, "You have chosen a(n) @ActionStr")

//@if (2[!@option)
	@movecstr(0, 41, 30, "for environment(s): ")
	
	@if (@DosInstall)
		@movecstr(0, 61, 30, "DOS")
		@if (@WindowsInstall)
			@movecstr(0, 65, 30, "and Windows")
		@endif  
	@elseif (@WindowsInstall)
		@movecstr(0, 61, 30, "Windows")
	@endif
	
//@endif  


@movecstr(2, 5, 31, "Application directory used: @OutDrive:@subdir")
@if (@WindowsInstall == @true)
	@movecstr(3, 5, 31, "Windows directory used: @EnteredWinDrive:@EnteredWinDir")
@endif  
@if (@WindowsInstall && 2[!@option) 
	@if (@bVSynth)
		@movecstr(4, 5, 31, "Using V-Synth drivers")
	@else
		@movecstr(4, 5, 31, "Using regular drivers (no V-Synth)")
	@endif
@endif

@if (1[=@option && @WindowsInstall)
	@movecstr(6, 5, 27, "Here are the Windows applications to be installed:")

	@if (31[=@option) 
		@movecstr(7, 7, 31, "TB Mixer") 
	@endif
	@if (32[=@option) 
		@movecstr(8, 7, 31, "Wave SE") 
	@endif
	@if (33[=@option) 
		@movecstr(9, 7, 31, "MicroWave") 
	@endif
	@if (34[=@option) 
		@movecstr(7, 30, 31, "Mouse Player") 
	@endif
	@if (35[=@option) 
		@movecstr(8, 30, 31, "Stratos") 
	@endif
	@if (36[=@option) 
		@movecstr(9, 30, 31, "Sierra Audio Rack") 
	@endif

@endif

@if (1[=@option)
	@movecstr(11, 5, 31, "Disk space needed for this install: @TotalSizeBytes bytes")
	@movecstr(12, 5, 31, "Free disk space on @OutDrive: @DiskFree(@OutDrive) bytes")        
@endif


@if (2[!@option)
	@movecstr(14, 5, 27, "Primary hardware settings:")
	@movecstr(15, 5, 31, "Port: @MainPort")
	@movecstr(16, 5, 31, "IRQ: @MainIRQ")
	@movecstr(17, 5, 31, "DMA: @MainDMA")
	@movecstr(18, 5, 31, "MIDI Port: @MIDIPort")
	@movecstr(19, 5, 31, "MIDI IRQ: @MIDIIRQ")

	@if (@DOSInstall)
		@movecstr(14, 33, 27, "Blaster settings:")
		@movecstr(15, 33, 31, "Port: @BlasterPort")
		@movecstr(16, 33, 31, "IRQ: @BlasterIRQ")
		@movecstr(17, 33, 31, "DMA: @BlasterDMA")
	@endif

	@if (300[=@option)
		@movecstr(14, 58, 27, "CD-ROM attached:")
		@movecstr(15, 58, 31, "Type: @cdtype")
		@movecstr(16, 58, 31, "Port: @cdport")
		@movecstr(17, 58, 31, "IRQ: @cdirq")
		@movecstr(18, 58, 31, "DMA: @cddma")
	@else 
		@movecstr(16, 58, 27, "No CD-ROM attached")
	@endif

@endif
	
@Display




















	@pause
@EndDisplay


@if(2[=@option)
	@goto UNINSTALL
@endif          


@Row = 1
@Display
	@Cls
@EndDisplay

@movecstr(@Row, 1, 30, "Please wait while changes are made to system startup files")


@Row = (@Row + 3)
@movecstr(@Row, 1, 31, "Backing up config.sys, autoexec.bat, and system.ini to .bak files")



// Backup autoexec.bat / config.sys / system.ini
@copy("@BootDrive:\\config.sys", "@BootDrive:\\config.bak")
@copy("@BootDrive:\\autoexec.bat", "@BootDrive:\\autoexec.bak")
@copy("@EnteredWinDrive:@EnteredWinDir\\system.ini", 
	"@EnteredWinDrive:@EnteredWinDir\\system.bak")

/*
@Display
	After backup up files!
	@pause
@EndDisplay     
*/

@if (@DosInstall)

	@Row = (@Row + 2)
	@movecstr(@Row, 1, 31, "Creating mcacdos.ini file for DOS settings")


	// *************************************************
	// Write mcacdos.ini
	// *************************************************

	@mkdir("@OutDrive:@subdir\\dosapps")
	@write("@OutDrive:@subdir\\dosapps\\MCACDOS.INI","wt","[MAD16]\n")
	@write(,,"MODE=SB\n")
	@write(,,"GAME_PORT=ENABLED\n")
	@write(,,"CDROM_MODEL=@cdtype \n")
	@write(,,"CDROM_BASE=@cdport \n")
	@write(,,"CDROM_IRQ=@cdIRQ \n")
	@write(,,"CDROM_DRQ=@cdDMA \n")

	@if ("@MidiPort" != "disabled")
		@write(,,"MIDI=ENABLED\n")
	@else
		@write(,,"MIDI=DISABLED\n")     
    @endif
    
	@write(,,"OPL=3\n")
	@write(,,"POWER=ON\n")
	@write(,,"FREQUENCY_MAP=NORMAL\n")
	
	@if ("@MidiPort" == "disabled")
		@write(,,"MIDI_IRQ=9\n")
		@write(,,"MIDI_PORT=330\n")
	@else           
		@write(,,"MIDI_IRQ=@MidiIRQ\n")
		@write(,,"MIDI_PORT=@MidiPort\n")
	@endif  
	
	@write(,,"\n")
	
	// write to the Mixer section
	@write(,,"[MIXER]\n")
	@write(,,"CD=Aux1,CD/Line\n")
	@write(,,"FM=Aux2,FM\n")
	@write(,,"Linein=Line,Line\n")
	@write(,,"\n")
	
	// write to the Sound Blaster pro section
	@write(,,"[SBPRO]\n")
	@write(,,"PORT=@blasterport \n")
	@write(,,"IRQ=@blasterirq \n")
	@write(,,"DRQ=@blasterDMA \n")
	@write(,,"\n")
	@write(,,"InputSelection=MIC\n\n")
	@write(,,"; Line input gain. 0 to 65535=0 to 22.5 db gain in 16 1.5dB steps.\n")
	@write(,,"lLineVolume=32767\nrLineVolume=32767\n\n")
	@write(,,"; Mic input gain. 0 to 65535=0 to 22.5 db gain in 16 1.5dB steps.\n")
	@write(,,"lMicVolume=32767\nrMicVolume=32767\n\n")
	@write(,,"; MicBoost indicates if 20db additional boost is added when the mic input is selected.\n")
	@write(,,"MicBoost=OFF\n\n")
	@write(,,"; Aux input gain. 0 to 65535=0 to 22.5 db gain in 16 1.5dB steps.\n")
	@write(,,"lAuxInVolume=32767\nrAuxInVolume=32767\n\n")
	@write(,,"; Loop back input gain. 0 to 65535=0 to 22.5 db gain in 16 1.5dB steps.\n")
	@write(,,"lLoopBackInputVolume=32767\nrLoopBackInputVolume=32767\n\n")
	@write(,,"; Monitor attenuation. 0 - 65535=full to no attenuation in 64 1.5 dB steps.\n")
	@write(,,"MonitorVolume=32767\n")
	@write(,,"MonitorMute=ON\n\n")
	@write(,,"; CS4231 output atten setting. 0 - 65535=full to no attenuation in 64 1.5 dB steps.\n")
	@write(,,"lMasterVolume=43252\nrMasterVolume=43252\nMasterMute=off\n\n")
	@write(,,"; Aux Volume setting 0 - 65535. No gain to full gain in 32 1.5 dB steps.\n")
	@write(,,"lAuxVolume=43252\nrAuxVolume=43252\nAuxMute=OFF\n\n")
	@write(,,"; Aux2 volume setting 0 - 65535. No gain to full gain in 32 1.5 dB steps.\n")
	@write(,,"lAux2Volume=43252\nrAux2Volume=43252\nAux2Mute=OFF\n\n")
	@write(,,"; Line Mix volume setting 0 - 65535. No gain to full gain in 32 1.5 dB steps.\n")
	@write(,,"lLineMixVolume=43252\nrLineMixVolume=43252\nLineMixMute=OFF\n\n")
	@write(,,"; Mono Mix volume setting 0 - 65535. full to no attenuation in 16 3dB steps.\n")
	@write(,,"MonoVolume=32767\nMonoMute=ON\nMonoOutMute=ON\n\n")
	@write(,,"; The default dither state.  This may be over-ridden at some record formats.\n")
	@write(,,"Dither=OFF\n")
	@write(,,"\n")
	
	// Windows sound system section
	
	@write(,,"[WSS]\n\n")
	@write(,,"PORT=@MainPort\n")
	
	@write(,,"IRQ=@MainIRQ\n")
	@write(,,"PDRQ=@MainDMA\n")
	@write(,,"CDRQ=@MainDMA\n")
	@write(,,"ISS=0\n\n")
	
	@write(,,"InputSelection=MIC\n\n")
	@write(,,"; Line input gain. 0 to 65535=0 to 22.5 db gain in 16 1.5dB steps.\n")
	@write(,,"lLineVolume=32767\nrLineVolume=32767\n\n")
	@write(,,"; Mic input gain. 0 to 65535=0 to 22.5 db gain in 16 1.5dB steps.\n")
	@write(,,"lMicVolume=32767\nrMicVolume=32767\n\n")
	@write(,,"; MicBoost indicates if 20db additional boost is added when the mic input is selected.\n")
	@write(,,"MicBoost=OFF\n\n")
	@write(,,"; Aux input gain. 0 to 65535=0 to 22.5 db gain in 16 1.5dB steps.\n")
	@write(,,"lAuxInVolume=32767\nrAuxInVolume=32767\n\n")
	@write(,,"; Loop back input gain. 0 to 65535=0 to 22.5 db gain in 16 1.5dB steps.\n")
	@write(,,"lLoopBackInputVolume=32767\nrLoopBackInputVolume=32767\n\n")
	@write(,,"; Monitor attenuation. 0 - 65535=full to no attenuation in 64 1.5 dB steps.\n")
	@write(,,"MonitorVolume=32767\n")
	@write(,,"MonitorMute=ON\n\n")
	@write(,,"; CS4231 output atten setting. 0 - 65535=full to no attenuation in 64 1.5 dB steps.\n")
	@write(,,"lMasterVolume=43252\nrMasterVolume=43252\nMasterMute=off\n\n")
	@write(,,"; Aux Volume setting 0 - 65535. No gain to full gain in 32 1.5 dB steps.\n")
	@write(,,"lAuxVolume=43252\nrAuxVolume=43252\nAuxMute=OFF\n\n")
	@write(,,"; Aux2 volume setting 0 - 65535. No gain to full gain in 32 1.5 dB steps.\n")
	@write(,,"lAux2Volume=43252\nrAux2Volume=43252\nAux2Mute=OFF\n\n")
	@write(,,"; Line Mix volume setting 0 - 65535. No gain to full gain in 32 1.5 dB steps.\n")
	@write(,,"lLineMixVolume=43252\nrLineMixVolume=43252\nLineMixMute=OFF\n\n")
	@write(,,"; Mono Mix volume setting 0 - 65535. full to no attenuation in 16 3dB steps.\n")
	@write(,,"MonoVolume=32767\nMonoMute=ON\nMonoOutMute=ON\n\n")
	@write(,,"; The default dither state.  This may be over-ridden at some record formats.\n")
	@write(,,"Dither=OFF\n")




	// *************************************************
	// Put SET BLASTER and Hot key mixer into autoexec.bat
	// *************************************************

	// Line must be removed first because it will get added a second time if install doesn't
	//  find an exact match
	//@removeline("@bootdrive:\\autoexec.bat", "", "mchkmix", "", "REM")

	@setautoexec
		@overwrite
		@path="@OutDrive:@subdir\\DOSAPPS"
		@setreplace("blaster","a@blasterport i@blasterirq d@blasterdma t2")
		//@verbatim="@OutDrive:@subdir\\dosapps\\mchkmix"
	@endautoexec

@endif  // @DosInstall is TRUE



@if(3[=@option)
	@goto AFTER_DEFINE_DISKS
@endif  


// *************************************************
// Define the disk set
// *************************************************
@DefineDisk
	@Label = "Disk #1"
    @BeginLib dos.red
		// DOS files
		@F SOUNDTST.WAV @S 33692 @O DOSAPPS\*.* @option 21
		@F MCHKMIX.COM @S 5036 @O DOSAPPS\*.* @option 21
		//@F MCSBMIX.COM @S 8513 @O DOSAPPS\*.* @option 21   Got rid of this by Ted Wood's request
		@F MCACMIX.EXE @S 32871 @O DOSAPPS\*.* @option 21
		@F MCDIAG.EXE @S 65158 @O DOSAPPS\*.* @option 21
		@F MCMODE.EXE @S 41568 @O DOSAPPS\*.* @option 21
		@F MCSETUP.EXE @S 241534 @O DOSAPPS\*.* @option 21
		@F PLAYCD.EXE @S 10507 @O DOSAPPS\*.* @option 21
		@F CUREG.KEY @S 51 @O DOSAPPS\*.* @option 21
	@EndLib 


	@if(@WindowsInstall == @true)
	    @BeginLib regdriv.red
			// driver/386 files for regular driver
			@F MCARLO.DRV @O DRV\*.*
			@F MPU401.DRV @O DRV\*.*             
			@F OPL3.DRV @O DRV\*.*                
			@F VSNDSYS.386 @O DRV\*.*
			@F MCARLO.INI @O @EnteredWinDrive:@EnteredWinDir\*.*
		@EndLib 
	
	    @BeginLib sierra.red    
		// Sierra files
			@F SIERRA.DLL @S 45824 @O WINAPPS\*.* @option 36
			@F SIERRA.EXE @S 380064 @O WINAPPS\*.* @option 36
			@F SIERRAMM.DLL @S 4704 @O WINAPPS\*.* @option 36
			@F SIERRA.HLP @S 10752 @O WINAPPS\*.* @option 36
	    @EndLib
	
		@BeginLib wavese.red
		// WaveSE stuff
			@F VIEWS.DAT @S 1560 @O WINAPPS\*.* @option 32
			@F WAVEEQ.DAT @S 1760 @O WINAPPS\*.* @option 32
			@F BWCC.DLL @S 152304 @O WINAPPS\*.* @option 32
			@F KNBCTRL.DLL @S 27584 @O WINAPPS\*.* @option 32
			@F SLDCTRL.DLL @S 28768 @O WINAPPS\*.* @option 32
			@F WAVEMME.DLL @S 246784 @O WINAPPS\*.* @option 32
			@F WAVFRONT.DLL @S 38400 @O WINAPPS\*.* @option 32
			@F TBCD.EXE @S 67328 @O WINAPPS\*.* @option 32
			@F TBCD.HLP @S 16919 @O WINAPPS\*.* @option 32
			@F WAVE.EXE @S 784128 @O WINAPPS\*.* @option 32
			@F WAVEFONT.FON @S 4768 @O WINAPPS\*.* @option 32
			@F EFFECTS.WRI @S 2176 @O WINAPPS\*.* @option 32
			@F WAVESE.WRI @S 17536 @O WINAPPS\*.* @option 32
			@F DONE.WAV @S 10283 @O WINAPPS\*.* @option 32
			@F WAVEHELP.HLP @S 91093 @O WINAPPS\*.* @option 32
			@F WFGATE.DLL @O @EnteredWinDrive:@EnteredWinDir\*.* @option 32
			@F WFSYSEX.DLL @O @EnteredWinDrive:@EnteredWinDir\*.* @option 32
		@EndLib 
	
	    @BeginLib winsetup.red    
		// Sierra files
			@F WINSETUP.EXE @O WINAPPS\*.* @option 22
	    @EndLib
	
		@File readme.wri
		@File qa.wri
	@endif

@EndDisk        

@if(@WindowsInstall == @true)
	@DefineDisk
		@Label = "Disk #2"
		@BeginLib midimap.red
			@File MIDIMAP.STD @O @EnteredWinDrive:@EnteredWinDir\*.*
			@File MIDIMAP.VST @O @EnteredWinDrive:@EnteredWinDir\*.*
		@EndLib
	
		@BeginLib mousplay.red  
			// Mouse Player files
			@F MOUSPLAY.EXE @S 75104 @O WINAPPS\*.* @option 34
			@F MOUSPLAY.HLP @S 13636 @O WINAPPS\*.* @option 34
			@F MOUSPLAY.INI @O WINAPPS\*.* @option 34
		@EndLib 
	
		@BeginLib stratos.red   
			// Stratos stuff
			@File bach.cmp @Size 51781 @O WINAPPS\*.* @option 35
			@F JESUJOY.CMP @S 42145 @O WINAPPS\*.* @option 35
			@F MOZART.CMP @S 44812 @O WINAPPS\*.* @option 35
			@F WILLTELL.CMP @S 86551 @O WINAPPS\*.* @option 35
			@F W3_MEM.DLL @S 3104 @O WINAPPS\*.* @option 35
			@F W3_MULTI.DLL @S 23552 @O WINAPPS\*.* @option 35
			@F W3DLL.DLL @S 95792 @O WINAPPS\*.* @option 35
			@F W3FONT.DLL @S 29696 @O WINAPPS\*.* @option 35
			@F W3HLPPRN.DLL @S 4352 @O WINAPPS\*.* @option 35
			@F W3PALETT.DLL @S 78576 @O WINAPPS\*.* @option 35
			@F COMPOSE3.EXE @S 334928 @O WINAPPS\*.* @option 35
			@F JUKEBOX3.EXE @S 36672 @O WINAPPS\*.* @option 35
			@F TAPEDEK3.EXE @S 103536 @O WINAPPS\*.* @option 35
			@F STRATOS.HLP @S 346750 @O WINAPPS\*.* @option 35
			@F BUMBLE.TDK @S 18522 @O WINAPPS\*.* @option 35
			@F EINKLEIN.TDK @S 18158 @O WINAPPS\*.* @option 35
			@F MINUETG.TDK @S 7262 @O WINAPPS\*.* @option 35
			@F POMP.TDK @S 13206 @O WINAPPS\*.* @option 35
			@F PRELUDE2.TDK @S 20726 @O WINAPPS\*.* @option 35
			@F REJOUIS.TDK @S 79274 @O WINAPPS\*.* @option 35
			@F RUSSIAN.TDK @S 16550 @O WINAPPS\*.* @option 35
			@F W3TTF.TTF @S 48012 @O WINAPPS\*.* @option 35
			@F W3TTFB.TTF @S 26332 @O WINAPPS\*.* @option 35
			@F STRATOS.INI @O @EnteredWinDrive:@EnteredWinDir\*.* @option 35
		@EndLib 
	
		@BeginLib switch.red    
			// the mighty switcher
			@F SWITCH.EXE @S 60384 @O WINAPPS\*.*
			@F RESTART.DLL @O WINAPPS\*.*
		@EndLib 
	
		@BeginLib vsynth.red    
			//driver/386 files for vsynth driver             
			@F SOFTNOTE.INI @O @EnteredWinDrive:@EnteredWinDir\*.* @option 37
			@F DEMO.MID @O DRV\*.* @option 37           
			@F SMALL.BNK @O DRV\*.* @option 37              
			@F SOFTNOTE.HLP @O DRV\*.* @option 37              
			@F SOFTNOTE.386 @O DRV\*.* @option 37               
			@F SOFTNOTE.DRV @O DRV\*.* @option 37            
			@F SERVER.DLL @O DRV\*.* @option 37
			@F VSND16D.386 @O DRV\*.* @option 37
			@F MAD16C.DRV @O DRV\*.* @option 37
			@F OPL3.DRV @O DRV\*.* @option 37
			@F MPU401.DRV @O DRV\*.* @option 37
		@EndLib
		
			
	@EndDisk

	@DefineDisk
		@Label = "Disk #3"
	
		@BeginLib tbmixer.red   
			// TBMixer files
			@F TBMIXER.EXE @S 124784 @O WINAPPS\*.* @option 31
			@F SLDCTRL2.DLL @S 77696 @O WINAPPS\*.* @option 31
			@F MSMIXMGR.DLL @O @EnteredWinDrive:@EnteredWinDir\system\*.* @option 31
		@EndLib 
		
		@BeginLib mcrowave.red
			// MicroWave stuff
			@F MICROWAV.EXE @S 285184 @O WINAPPS\*.* @option 33
			@F MWAVEMME.DLL @S 129792 @O WINAPPS\*.* @option 33
			@F MICROWAV.HLP @S 29624 @O WINAPPS\*.* @option 33
			@F WAVEFONT.FON @O WINAPPS\*.* @option 33
			@F BWCC.DLL @O WINAPPS\*.* @option 33
			
			@File OLECLI.DLL @Out @EnteredWinDrive:@EnteredWinDir\system\*.* @option 33
			@File OLESVR.DLL @Out @EnteredWinDrive:@EnteredWinDir\system\*.* @option 33
		@EndLib 
	
		@BeginLib large.001
			@File large.bnk @Out DRV\large.bnk @option 37
		@EndLib 
	
		@BeginLib large.002
			@File large.bnk @AppendTo DRV\large.bnk  @option 37
		@EndLib  
	
	@EndDisk

	@DefineDisk
		@Label = "Disk #4"
	
		@BeginLib large.002
			@File large.bnk @AppendTo DRV\large.bnk  @option 37
		@EndLib  
	@EndDisk
@endif


AFTER_DEFINE_DISKS:

//        Please wait while changes are made to your system.ini...

/*
@Display
	Please wait while changes are made to your system.ini...
@enddisplay
*/

// **********************************************
// All Windows ini file changes happen here
// **********************************************
@if (@WindowsInstall)
	/*
	New functions:
		@WriteProfString()
		@GetProfString()
		@ReplaceProfString()
	*/      
	
	@DrvPath = "@OutDrive:@subdir\\drv"

/*
	@Display
		drv path!
		@DrvPath
	@EndDisplay     
*/

	@Col = 0
	@Row = (@Row + 2)
	@movecstr(@Row, 1, 31, "Writing Monte Carlo settings to system.ini")

	@Col = (@Col + 1)
	@movecstr((@Row+1), @Col, 31, ".")
	
	@WriteProfString("@SysIni", "sndsys.drv", "IOAddress", "@MainPort")     
	@WriteProfString("@SysIni", "sndsys.drv", "Interrupt", "@MainIRQ")      
	@WriteProfString("@SysIni", "sndsys.drv", "DMAADC", "@MainDMA") 
	@WriteProfString("@SysIni", "sndsys.drv", "DMADAC", "@MainDMA")
	@if (@bVSynth)
		@WriteProfString("@SysIni", "mad16c.drv", "IOAddress", "@MainPort")     
		@WriteProfString("@SysIni", "mad16c.drv", "Interrupt", "@MainIRQ")      
		@WriteProfString("@SysIni", "mad16c.drv", "DMAADC", "@MainDMA") 
		@WriteProfString("@SysIni", "mad16c.drv", "DMADAC", "@MainDMA")
	@endif          

	@Col = (@Col + 1)
	@movecstr((@Row+1), @Col, 31, ".")


    @if ("@MIDIPort" != "disabled")
		@WriteProfString("@SysIni", "mpu401.drv", "int", "@MidiIRQ")
		@WriteProfString("@SysIni", "mpu401.drv", "port", "@MidiPort")
	@else
		// make sure whole section is gone
		@removeline("@SysIni", "mpu401.drv", "", "", ";")
	@endif
		
	@WriteProfString("@SysIni", "opl3.drv", "int", "0")
	@WriteProfString("@SysIni", "opl3.drv", "portFM", "388")

	@Col = (@Col + 1)
	@movecstr((@Row+1), @Col, 31, ".")


	@if (!@bVSynth)
		@ReplaceProfString("@SysIni", "386Enh", "device", "vsndsys.386", "@DrvPath\\vsndsys.386")
		@ReplaceProfString("@SysIni", "386Enh", "device", "softnote.386", "")
		@ReplaceProfString("@SysIni", "386Enh", "softsnth", "yes", "")
		@ReplaceProfString("@SysIni", "386Enh", "device", "vsnd16d.386", "")
	@else
		@ReplaceProfString("@SysIni", "386Enh", "device", "vsndsys.386", "")
		@ReplaceProfString("@SysIni", "386Enh", "device", "vsnd16d.386", "@DrvPath\\vsnd16d.386")
	@endif

	@Col = (@Col + 1)
	@movecstr((@Row+1), @Col, 31, ".")

	
	@WriteProfString("@SysIni", "sndsys.drv", "Duplex", "Half")
	@WriteProfString("@SysIni", "sndsys.drv", "SingleModeDMA", "1")
	@WriteProfString("@SysIni", "sndsys.drv", "DMABufferSize", "36")
	@WriteProfString("@SysIni", "sndsys.drv", "OldMSDosGameCompatibility", "1")

	@Col = (@Col + 1)
	@movecstr((@Row+1), @Col, 31, ".")

	@WriteProfString("@SysIni", "sndsys.drv", "WatchMSDosExec", "1")
	@WriteProfString("@SysIni", "sndsys.drv", "BlasterSupport", "OTI929")
	@WriteProfString("@SysIni", "sndsys.drv", "Msft Hardware", "1")
	@WriteProfString("@SysIni", "sndsys.drv", "Msft Support", "1")

	@Col = (@Col + 1)
	@movecstr((@Row+1), @Col, 31, ".")

	@WriteProfString("@SysIni", "sndsys.drv", "AutoSelect", "1")
	@WriteProfString("@SysIni", "sndsys.drv", "Midi Play", "1")
	@WriteProfString("@SysIni", "sndsys.drv", "EnableAutoAcquireOPL3", "1")
	@WriteProfString("@SysIni", "sndsys.drv", "DMA 0", "1")

	@Col = (@Col + 1)
	@movecstr((@Row+1), @Col, 31, ".")

	@WriteProfString("@SysIni", "sndsys.drv", "DMA 1", "1")
	@WriteProfString("@SysIni", "sndsys.drv", "DMA 3", "1")
	@WriteProfString("@SysIni", "sndsys.drv", "Default DMA", "1")
	@WriteProfString("@SysIni", "sndsys.drv", "I/O 530", "1")

	@Col = (@Col + 1)
	@movecstr((@Row+1), @Col, 31, ".")

	@WriteProfString("@SysIni", "sndsys.drv", "I/O 604", "1")
	@WriteProfString("@SysIni", "sndsys.drv", "I/O E80", "1")
	@WriteProfString("@SysIni", "sndsys.drv", "I/O F40", "1")
	@WriteProfString("@SysIni", "sndsys.drv", "Default I/O", "530")

	@Col = (@Col + 1)
	@movecstr((@Row+1), @Col, 31, ".")

	@WriteProfString("@SysIni", "sndsys.drv", "IRQ 7", "1")
	@WriteProfString("@SysIni", "sndsys.drv", "IRQ 9", "1")
	@WriteProfString("@SysIni", "sndsys.drv", "IRQ 10", "1")
	@WriteProfString("@SysIni", "sndsys.drv", "IRQ 11", "1")

	@Col = (@Col + 1)
	@movecstr((@Row+1), @Col, 31, ".")

	@WriteProfString("@SysIni", "sndsys.drv", "Default IRQ", "7")
	@WriteProfString("@SysIni", "sndsys.drv", "FMMixer", "Aux2")
	@WriteProfString("@SysIni", "sndsys.drv", "CDMixer", "Aux1")
	@WriteProfString("@SysIni", "sndsys.drv", "LineMixer", " ")
	@WriteProfString("@SysIni", "opl3.drv", "portFM", "388")
	@if (@bVSynth)
		@WriteProfString("@SysIni", "mad16c.drv", "Mute", "No")
		@WriteProfString("@SysIni", "mad16c.drv", "LeftMasterVol", "65535")
		@WriteProfString("@SysIni", "mad16c.drv", "RightMasterVol", "65535")
		@WriteProfString("@SysIni", "mad16c.drv", "LeftLineInVol", "32767")

		@Col = (@Col + 1)
		@movecstr((@Row+1), @Col, 31, ".")

		@WriteProfString("@SysIni", "mad16c.drv", "RightLineInVol", "32767")
		@WriteProfString("@SysIni", "mad16c.drv", "LeftDACVol", "32767")
		@WriteProfString("@SysIni", "mad16c.drv", "RightDACVol", "32767")
		@WriteProfString("@SysIni", "mad16c.drv", "LeftWaveADCMicVol", "32767")

		@Col = (@Col + 1)
		@movecstr((@Row+1), @Col, 31, ".")

		@WriteProfString("@SysIni", "mad16c.drv", "RightWaveADCMicVol", "0")
		@WriteProfString("@SysIni", "mad16c.drv", "LeftWaveADCLineVol", "32767")
		@WriteProfString("@SysIni", "mad16c.drv", "RightWaveADCLineVol", "32767")
		@WriteProfString("@SysIni", "mad16c.drv", "WaveADCSource", "MIC")

		@Col = (@Col + 1)
		@movecstr((@Row+1), @Col, 31, ".")

		@WriteProfString("@SysIni", "mad16c.drv", "LeftVoiceADCMicVol", "32767")
		@WriteProfString("@SysIni", "mad16c.drv", "RightVoiceADCMicVol", "0")
		@WriteProfString("@SysIni", "mad16c.drv", "LeftVoiceADCLineVol", "32767")
		@WriteProfString("@SysIni", "mad16c.drv", "RightVoiceADCLineVol", "32767")
		@WriteProfString("@SysIni", "mad16c.drv", "VoiceADCSource", "MIC")

		@Col = (@Col + 1)
		@movecstr((@Row+1), @Col, 31, ".")

		@WriteProfString("@SysIni", "mad16c.drv", "LeftSynthVol", "32767")
		@WriteProfString("@SysIni", "mad16c.drv", "RightSynthVol", "32767")
		@WriteProfString("@SysIni", "mad16c.drv", "SingleModeDMA", "Yes")
		@WriteProfString("@SysIni", "mad16c.drv", "DMABufferSize", "32")
	@endif  

	@if (@bVSynth)
		@ReplaceProfString("@SysIni", "386Enh", "device", "softnote.386", "@DrvPath\\softnote.386")
		@WriteProfString("@SysIni", "386Enh", "softsnth", "yes")
	@endif



	@Col = (@Col + 1)
	@movecstr((@Row+1), @Col, 31, ".")

/*
	@removeline("@SysIni", "drivers", "WAVE", "mcarlo.drv", ";")
	@removeline("@SysIni", "drivers", "WAVE", "mad16c.drv", ";")
	
	@removeline("@SysIni", "drivers", "MIDI", "mad16c.drv", ";")
	@removeline("@SysIni", "drivers", "MIDI", "mpu401.drv", ";")
	@removeline("@SysIni", "drivers", "MIDI", "opl3.drv", ";")
	@removeline("@SysIni", "drivers", "MIDI", "softnote.drv", ";")
	
	@removeline("@SysIni", "drivers", "AUX", "mad16c.drv", ";")
	@removeline("@SysIni", "drivers", "AUX", "mcarlo.drv", ";")
	
	@removeline("@SysIni", "drivers", "MIXER", "mad16c.drv", ";")
	@removeline("@SysIni", "drivers", "MIXER", "mcarlo.drv", ";")
*/
	
	@RemoveDriver("@SysIni", "WAVE", "@DrvPath\\mcarlo.drv")
	@RemoveDriver("@SysIni", "WAVE", "@DrvPath\\mad16c.drv")
	
	@RemoveDriver("@SysIni", "MIDI", "@DrvPath\\opl3.drv")
	@RemoveDriver("@SysIni", "MIDI", "@DrvPath\\mpu401.drv")
	@RemoveDriver("@SysIni", "MIDI", "@DrvPath\\mad16c.drv")
	@RemoveDriver("@SysIni", "MIDI", "@DrvPath\\softnote.drv")
	
	@RemoveDriver("@SysIni", "AUX", "@DrvPath\\mcarlo.drv")
	@RemoveDriver("@SysIni", "AUX", "@DrvPath\\mad16c.drv")
	
	@RemoveDriver("@SysIni", "MIXER", "@DrvPath\\mcarlo.drv")
	@RemoveDriver("@SysIni", "MIXER", "@DrvPath\\mad16c.drv")

	
	
	
	@Col = (@Col + 1)
	@movecstr((@Row+1), @Col, 31, ".")

	@if (!@bVSynth)
		/*
		@removeline("@SysIni", "drivers", "MIDI", "mad16c.drv", ";")
		@removeline("@SysIni", "drivers", "WAVE", "mad16c.drv", ";")
		@removeline("@SysIni", "drivers", "AUX", "mad16c.drv", ";")
		@removeline("@SysIni", "drivers", "MIXER", "mad16c.drv", ";")
		@removeline("@SysIni", "drivers", "MIDI", "mpu401.drv", ";")
		*/
		
		@if (!(("@MIDIPort" == "disabled") || ("@MIDIPort" == "DISABLED")) )
			@EstablishDriver("@SysIni", "MIDI", "@DrvPath\\mpu401.drv")
		@endif	 
		@EstablishDriver("@SysIni", "MIDI", "@DrvPath\\opl3.drv")
		@EstablishDriver("@SysIni", "WAVE", "@DrvPath\\mcarlo.drv")
		@EstablishDriver("@SysIni", "AUX", "@DrvPath\\mcarlo.drv")
		@EstablishDriver("@SysIni", "MIXER", "@DrvPath\\mcarlo.drv")
			  
	@else
		/*
		@removeline("@SysIni", "drivers", "MIDI", "mpu401.drv", ";")
		@removeline("@SysIni", "drivers", "MIDI", "opl3.drv", ";")
		@removeline("@SysIni", "drivers", "WAVE", "mcarlo.drv", ";")
		@removeline("@SysIni", "drivers", "AUX", "mcarlo.drv", ";")
		@removeline("@SysIni", "drivers", "MIXER", "mcarlo.drv", ";")
		*/
		
		@EstablishDriver("@SysIni", "MIDI", "@DrvPath\\softnote.drv") 
		@EstablishDriver("@SysIni", "MIDI", "@DrvPath\\mad16c.drv")
		@EstablishDriver("@SysIni", "WAVE", "@DrvPath\\mad16c.drv")
		@EstablishDriver("@SysIni", "AUX", "@DrvPath\\mad16c.drv")
		@EstablishDriver("@SysIni", "MIXER", "@DrvPath\\mad16c.drv")
		@if (!(("@MIDIPort" == "disabled") || ("@MIDIPort" == "DISABLED")) )
			@EstablishDriver("@SysIni", "MIDI", "@DrvPath\\mpu401.drv")
		@endif	
	@endif;  // not vsynth  


	/*
	@if ("@MIDIPort" == "disabled")
		@removeline("@SysIni", "drivers", "MIDI", "mpu401.drv", ";")
	@endif  
    */

	@Col = (@Col + 1)
	@movecstr((@Row+1), @Col, 31, ".")

		
	// set up msmixmgr.dll in system.ini
	@BootLine = @GetProfString("@SysIni", "boot", "drivers")
	
	@if ((@StrFind("@BootLine", "msmixmgr.dll") == -1) && 
		(@StrFind("@BootLine", "MSMIXMGR.DLL") == -1))
		@WriteProfString("@SysIni", "boot", "drivers", "@BootLine msmixmgr.dll")
	@endif          
			
				
	@Col = (@Col + 1)
	@movecstr((@Row+1), @Col, 31, ".")

		
    
	    
@endif  // this is windows install




@goto BEGIN_FINISH_BLOCK



// ******************************************
// Uninstall routine
// ******************************************
UNINSTALL:
	@if (!(@WindowsInstall || @DOSInstall))  // if neither was chosen, ensure that nothing is done
		goto ENDOFFILE
	@endif
			
	
	/*
	@ClearOption(50)
	@GetOption
		@CheckBox
		@Option 50 = "Are you sure you wish to delete @OutDrive:@subdir directory?"
	@EndOption
	*/
	
	@Row = 0
    @Col = 0;
	

	@chdrive(@OutDrive)
	@chdir("\\")

@if (@WindowsInstall && @DOSInstall)  // delete all files
	@if (@System("deltree @OutDrive:@SubDir /y") == -1)
		@Display
	Could not load command processor! Probably not enough memory.
			@pause
		@EndDisplay       
	@EndIf
@elseif (@WindowsInstall)  // delete Windows files only
	// if dos files do not exist, deltree whole mcarlo dir.
	// We're making the assumption here that if mcmode.exe is not at this location, they
	//  never installed for DOS and have no mcarlo lines in their autoexec.bat/config.sys
    @if (@exists("@OutDrive:@SubDir\\dosapps\\mcmode.exe") != @TRUE)
		@if (@System("deltree @OutDrive:@SubDir /y") == -1)
			@Display
		Could not load command processor! Probably not enough memory.
				@pause
			@EndDisplay
		@endif	       
    @else  // just delete Windows components, not whole mcarlo dir.
		@if (@System("deltree @OutDrive:@SubDir\\winapps /y") == -1)
			@Display
		Could not load command processor! Probably not enough memory.
				@pause
			@EndDisplay       
		@else  // the first deltree was successful
			@System("deltree @OutDrive:@SubDir\\drv /y")
			@Delete("@OutDrive:@SubDir\\readme.wri")
			@Delete("@OutDrive:@SubDir\\qa.wri")
		@EndIf
    @endif
	
	
@elseif (@DOSInstall)  // delete DOS files only
	// if windows files do not exist, deltree whole mcarlo dir.
	// We're making the assumption here that if these three files are not at this location,
	//  they never installed for Windows, and there are no mcarlo lines in system.ini
	@if ( (@exists("@OutDrive:@SubDir\\winapps\\tbmixer.exe") != @true)
		&& (@exists("@OutDrive:@SubDir\\drv\\mcarlo.drv") != @true)
		&& (@exists("@OutDrive:@SubDir\\readme.wri") != @true) )
		@if (@System("deltree @OutDrive:@SubDir /y") == -1)
			@Display
		Could not load command processor! Probably not enough memory.
				@pause
			@EndDisplay
		@endif         
		
    @else  // just delete dosapps dir, not whole mcarlo dir.
		@if (@System("deltree @OutDrive:@SubDir\\dosapps /y") == -1)
			@Display
		Could not load command processor! Probably not enough memory.
				@pause
			@EndDisplay
		@endif         
    @endif

@endif

	  


@if(@WindowsInstall)
	@DrvPath = "@OutDrive:@subdir\\drv"
	// first let's delete the Monte Carlo group
	@RunLine = @GetProfString("@EnteredWinDrive:@EnteredWinDir\\win.ini", "windows", "run")
	
	@if ( (@StrFind("@RunLine", "winsetup.exe") != -1)
		|| (@StrFind("@RunLine", "WINSETUP.EXE") != -1) )
	      
		@ReplaceProfString("@EnteredWinDrive:@EnteredWinDir\\win.ini", "windows", "run", "winsetup.exe", " ")
	@else
		@GroupFilePath = @GetProfString("@EnteredWinDrive:@EnteredWinDir\\mcarlo.ini", "GrpInfo", "GroupFilePath") 
		@if (@exists("@GroupFilePath") == @TRUE)
		    @Delete("@GroupFilePath")
		    @removeline("@EnteredWinDrive:@EnteredWinDir\\progman.ini", "Groups", "", "c:\\windows\\montecar.grp", ";")
		@endif
    @endif
    
    
	@Row = (@Row + 2)
	@movecstr(@Row, 1, 31, "Deleting ini files from @EnteredWinDir directory")
	@Delete("@EnteredWinDrive:@EnteredWinDir\\stratos.ini")
	@Delete("@EnteredWinDrive:@EnteredWinDir\\softnote.ini")
	@Delete("@EnteredWinDrive:@EnteredWinDir\\mcarlo.ini")
	@Delete("@EnteredWinDrive:@EnteredWinDir\\midimap.vst")
	@Delete("@EnteredWinDrive:@EnteredWinDir\\stratos.std")

	
	@Row = (@Row + 2)
	@movecstr(@Row, 1, 31, "Deleting lines from system.ini")

    
	@Col = (@Col + 1)
	@movecstr((@Row+1), @Col, 31, ".")
    
	
	
	@RemoveDriver("@SysIni", "WAVE", "@DrvPath\\mcarlo.drv")
	@RemoveDriver("@SysIni", "AUX", "@DrvPath\\mcarlo.drv")
	@RemoveDriver("@SysIni", "MIXER", "@DrvPath\\mcarlo.drv")
	@RemoveDriver("@SysIni", "MIDI", "@DrvPath\\opl3.drv")
	@RemoveDriver("@SysIni", "MIDI", "@DrvPath\\mpu401.drv")
	
/*	
	@removeline("@SysIni", "", "wave", "mcarlo.drv", ";")

	@removeline("@SysIni", "", "aux", "mcarlo.drv", ";")
	@removeline("@SysIni", "", "mixer", "mcarlo.drv", ";")
	
	@removeline("@SysIni", "", "midi", "opl3.drv", ";")
	
	@removeline("@SysIni", "", "midi", "mpu401.drv", ";")
*/
    
	@Col = (@Col + 1)
	@movecstr((@Row+1), @Col, 31, ".")
    
	
	@RemoveDriver("@SysIni", "WAVE", "@DrvPath\\mad16c.drv")
	@RemoveDriver("@SysIni", "AUX", "@DrvPath\\mad16c.drv")
	@RemoveDriver("@SysIni", "MIXER", "@DrvPath\\mad16c.drv")
	@RemoveDriver("@SysIni", "MIDI", "@DrvPath\\mad16c.drv")
	@RemoveDriver("@SysIni", "MIDI", "@DrvPath\\softnote.drv")
	
/*
	@removeline("@SysIni", "", "wave", "mad16c.drv", ";")
	@removeline("@SysIni", "", "aux", "mad16c.drv", ";")
	@removeline("@SysIni", "", "mixer", "mad16c.drv", ";")
	@removeline("@SysIni", "", "midi", "mad16c.drv", ";")
*/
    
	@Col = (@Col + 1)
	@movecstr((@Row+1), @Col, 31, ".")
    
	
	@removeline("@SysIni", "", "midi", "softnote.drv", ";")
	
	@removeline("@SysIni", "", "device", "vsnd16d.386", ";")
	@removeline("@SysIni", "", "device", "softnote.386", ";")
	@removeline("@SysIni", "", "device", "vsndsys.386", ";")
	@removeline("@SysIni", "", "softsnth", "yes", ";")
	
	
    
	@Col = (@Col + 1)
	@movecstr((@Row+1), @Col, 31, ".")
    
	
	
	
	@removeline("@SysIni", "sndsys.drv", "", "", ";")
	@removeline("@SysIni", "mpu401.drv", "", "", ";")
	@removeline("@SysIni", "opl3.drv", "", "", ";")
	@removeline("@SysIni", "mad16c.drv", "", "", ";")
@endif
	
@if(@DOSInstall)
	@Row = (@Row + 2)
	@movecstr(@Row, 1, 31, "Deleting files from autoexec.bat and config.sys")
	//@removeline("@bootdrive:\\autoexec.bat", "", "mchkmix", "", "REM")
	@removeline("@bootdrive:\\config.sys", "", "device", "mcmode", "REM")
	
	@removepath("@bootdrive:\\autoexec.bat", "path", "@SubDir", "rem")
    
	@Col = (@Col + 1)
	@movecstr((@Row+1), @Col, 31, ".")
@endif    

	@Delete("@OutDrive:\\mcuninst.ini")
	
	@Display
		@Cls
  
  Uninstallation completed successfully.
				  
				  
				  @Pause
	@EndDisplay     



@goto ENDOFFILE



BEGIN_FINISH_BLOCK:

@Display
	@Cls
@EndDisplay


@McarloIni = "@EnteredWinDrive:@EnteredWinDir\\mcarlo.ini"


@Finish
	// make all system.ini/autoexec.bat/config.sys changes that could not be made above
	
	//Please wait while further changes are made.
	
	@if(@DOSInstall == @true)
		@if(@putmcmode1st("@bootdrive:\\config.sys", "device=@outdrive:@subdir\\dosapps\\mcmode.exe")) @endif
	@endif
	
	@if (@WindowsInstall == @TRUE)
	
		@if ("@MIDIPort" != "disabled" && "@MIDIPort" != "DISABLED")
			@if(@WriteProfString("@McarloIni", "Install", "MPU401", "yes")) @endif  // used by switcher
		@else
			@if(@WriteProfString("@McarloIni", "Install", "MPU401", "no")) @endif
		@endif           
		
		@if(1[=@option)  // we are installing.
			
			
			// Set up Windows program group and items
		    
		    // write changes into mcarlo.ini
			@if (31[=@option)  // TB Mixer
				@if(@WriteProfString("@McarloIni", "ProgramItems", "TBMixer", 
					"@OutDrive:@subdir\\winapps\\tbmixer.exe")) @endif   
			@else
				@if(@WriteProfString("@McarloIni", "ProgramItems", "TBMixer", "0") @endif
			@endif  
			
			@if (32[=@option)  // Wave SE
				@if(@WriteProfString("@McarloIni", "ProgramItems", "WaveSE", 
					"@OutDrive:@subdir\\winapps\\wave.exe")) @endif   
				@if(@WriteProfString("@McarloIni", "ProgramItems", "WaveWrite", 
					"write @OutDrive:@subdir\\winapps\\wavese.wri")) @endif   
				@if(@WriteProfString("@McarloIni", "ProgramItems", "WaveEffects", 
					"write @OutDrive:@subdir\\winapps\\effects.wri")) @endif   
				@if(@WriteProfString("@McarloIni", "ProgramItems", "TBCD", 
					"@OutDrive:@subdir\\winapps\\tbcd.exe")) @endif   
			@else
				@if(@WriteProfString("@McarloIni", "ProgramItems", "WaveSE", "0")) @endif
				@if(@WriteProfString("@McarloIni", "ProgramItems", "WaveWrite", "0")) @endif
				@if(@WriteProfString("@McarloIni", "ProgramItems", "WaveEffects", "0")) @endif
				@if(@WriteProfString("@McarloIni", "ProgramItems", "TBCD", "0")) @endif
			@endif  
			
			@if (33[=@option)  // MicroWave
				@if(@WriteProfString("@McarloIni", "ProgramItems", "MicroWave", 
					"@OutDrive:@subdir\\winapps\\microwav.exe")) @endif   
			@else
				@if(@WriteProfString("@McarloIni", "ProgramItems", "MicroWave", "0")) @endif
			@endif  
			
			@if (34[=@option)  // Mouse Player
				@if(@WriteProfString("@McarloIni", "ProgramItems", "MousPlay", 
					"@OutDrive:@subdir\\winapps\\mousplay.exe")) @endif   
			@else
				@if(@WriteProfString("@McarloIni", "ProgramItems", "MousPlay", "0")) @endif
			@endif  
			
			@if (35[=@option)  // Stratos
				@if(@WriteProfString("@McarloIni", "ProgramItems", "Manuscript", 
					"@OutDrive:@subdir\\winapps\\compose3.exe")) @endif   
				@if(@WriteProfString("@McarloIni", "ProgramItems", "Jukebox", 
					"@OutDrive:@subdir\\winapps\\jukebox3.exe")) @endif   
				@if(@WriteProfString("@McarloIni", "ProgramItems", "Sequencer", 
					"@OutDrive:@subdir\\winapps\\tapedek3.exe")) @endif   
			@else
				@if(@WriteProfString("@McarloIni", "ProgramItems", "Manuscript", "0")) @endif
				@if(@WriteProfString("@McarloIni", "ProgramItems", "Jukebox", "0")) @endif
				@if(@WriteProfString("@McarloIni", "ProgramItems", "Sequencer", "0")) @endif
			@endif  
			
			@if (36[=@option)  // Sierra
				@if(@WriteProfString("@McarloIni", "ProgramItems", "Sierra", 
					"@OutDrive:@subdir\\winapps\\sierra.exe")) @endif   
			@else
				@if(@WriteProfString("@McarloIni", "ProgramItems", "Sierra", "0")) @endif
			@endif  
			
			@if (37[=@option)  // Vsynth
				@if(@WriteProfString("@McarloIni", "ProgramItems", "VDemo", 
					"mplayer @OutDrive:@subdir\\drv\\demo.mid")) @endif   
				@if(@WriteProfString("@McarloIni", "ProgramItems", "VHelp", 
					"@OutDrive:@subdir\\drv\\softnote.hlp")) @endif   
			@else
				@if(@WriteProfString("@McarloIni", "ProgramItems", "VDemo", "0")) @endif
				@if(@WriteProfString("@McarloIni", "ProgramItems", "VHelp", "0")) @endif
			@endif  
		
			@if(@WriteProfString("@McarloIni", "ProgramItems", "ReleaseNotes", 
				"write @OutDrive:@subdir\\readme.wri")) @endif   
				
			@if(@WriteProfString("@McarloIni", "ProgramItems", "QA", 
				"write @OutDrive:@subdir\\qa.wri")) @endif   
			
			@if (@exists("@OutDrive:@subdir\\drv\\large.bnk") == @TRUE)
				@if(@WriteProfString("@McarloIni", "ProgramItems", "Switch", 
					"@OutDrive:@subdir\\winapps\\switch.exe")) @endif
			@endif             
			
			// We want Program groups and items to be set up the next time Windows is run
		    @if(@WriteProfString("@EnteredWinDrive:@EnteredWinDir\\win.ini", "windows", "run", 
			"@OutDrive:@subdir\\winapps\\winsetup.exe")) @endif   
		
		@endif
	
	
		// Write lines to stratos.ini
	
		//@Row = (@Row + 2)
		//@movecstr(@Row, 1, 31, "Writing lines to stratos.ini")
			
		@if (!@bVSynth)
			// for standard drivers
			@if(@WriteProfString("@EnteredWinDrive:@EnteredWinDir\\STRATOS.INI", "Stratos", 
				"MIDI Input", "OPTi MAD16 MIDI Input Port")) @endif
			@if(@WriteProfString("@EnteredWinDrive:@EnteredWinDir\\STRATOS.INI", "Stratos", 
				"MIDI Output", "Yamaha OPL3 Synth")) @endif
		@else
			// for vsynth drivers.
			@if(@WriteProfString("@EnteredWinDrive:@EnteredWinDir\\STRATOS.INI", "Stratos", 
				"MIDI Input", "OPTi MAD16 MIDI Input Port")) @endif
			@if(@WriteProfString("@EnteredWinDrive:@EnteredWinDir\\STRATOS.INI", "Stratos", 
				"MIDI Output", "V-Synth")) @endif
		@endif
		
		
		
		// Write line to softnote.ini!
		//@Row = (@Row + 2)
		//@movecstr(@Row, 1, 31, "Writing lines to softnote.ini")
		@if(@WriteProfString("@EnteredWinDrive:@EnteredWinDir\\softnote.ini", 
			"SoftNotesEnable", "Monolith", "@OutDrive:@subdir\\drv\\small.bnk")) @endif   
		@if(@WriteProfString("@EnteredWinDrive:@EnteredWinDir\\softnote.ini", 
			"SoftNotesEnable", "HelpFile", "@OutDrive:@subdir\\drv\\softnote.hlp")) @endif
		
	
		@if(@WriteProfString("@EnteredWinDrive:@EnteredWinDir\\mcarlo.ini",
			"install", "InstallPath", "@OutDrive:@subdir")) @endif
			

		
		// the following is for uninstall; it will know what to put for default uninstall directory
		@write("@OutDrive:\\mcuninst.ini","wt","[dummy section]\n")

		@if(@WriteProfString("@OutDrive:\\mcuninst.ini", "install", "InstallDrive", "@OutDrive")) @endif
	
		@if(@WriteProfString("@OutDrive:\\mcuninst.ini", "install", "InstallSubdir", "@subdir")) @endif
	
		
		
		
		// copy correct midimapper in!
		@if (40[=@option)       
			@if (@bVSynth)
				@copy("@EnteredWinDrive:@EnteredWinDir\\midimap.vst", 
					"@EnteredWinDrive:@EnteredWinDir\\system\\midimap.cfg")     
		    @else
				@copy("@EnteredWinDrive:@EnteredWinDir\\midimap.std", 
					"@EnteredWinDrive:@EnteredWinDir\\system\\midimap.cfg")
			@endif
		@endif                              
	
	@endif   // Windows Install


    //Installation is completed!.
    
    //Please remove diskettes and hit any key to reboot.
	
	//@if(60[=@option)
		//@Reboot("Rebooting your machine.", 0)
		@Reboot("Your installation is finished. Please remove all diskettes and press any key to reboot your machine.", 0)
	//@endif          
	
	
	
	@ChDrive @OutDrive
	@ChDir "@SubDir"

	//@Reboot("Rebooting your machine.", 0)

	Installation of @Name is now finished.

@EndFinish

ENDOFFILE:

/* end-of-file */

//@WriteProfString("@SysIni", "boot", "AfterThe", "FinishBlock")
