[D
			
	/LoadSW [P
			[A LoadFlag]	% LoadFlag = False -> Check only if Files are existing 	
				/OSSWFileName 'UPOS1100' def
				/OSTreeFileName 'OSTr1100' def	


	    		/Result #1 def
    			/MissingFile '' def
	
				/SWFile OSDir '\' add OSSWFileName add '_' add '_V' add OSSWVersion cvs add 'S' add OSSWSubVersion cvs add def 
				OSSWBetaInfo '' ne [B
					/SWFile SWFile '_' add OSSWBetaInfo add def
				] if
				/SWFile SWFile '.HX2' add def
	
	
				/TreeFile OSDir '\' add OSTreeFileName add '_' add '_V' add OSTreeVersion cvs add 'S' add OSTreeSubVersion cvs add def 
				OSTreeBetaInfo '' ne [B
					/TreeFile TreeFile '_' add OSTreeBetaInfo add def
				] if
				/TreeFile TreeFile '.HX2' add def
	
				/DefaultParFile OSDir '\' add OSTreeFileName add '_' add '_V' add OSTreeVersion cvs add 'S' add OSTreeSubVersion cvs add def
				OSTreeBetaInfo '' ne [B
					/DefaultParFile DefaultParFile '_' add OSTreeBetaInfo add def
				] if
				/DefaultParFile DefaultParFile '.Gr3' add def
				
				Result [B
					SWFile FileExist not [B
						/Result #0 def 
						/MissingFile SWFile def
					] if
				] if
				
				Result [B
					TreeFile FileExist not [B
						/Result #0 def 
						/MissingFile TreeFile def
					] if
				] if
				Result [B
					DefaultParFile FileExist not [B
						/Result #0 def 
						/MissingFile DefaultParFile def
					] if
				] if
				
					
				Result LoadFlag and [B
				
     				PackInst:StopProgram		
					500 wait
					ResetDevice
					1000 wait
     				PackInst:StopProgram		
					
     				'Erasing OS firmware sector...' log     
     				$10000 PackInst:EraseFlash		
					$30000 PackInst:EraseFlash		
					$40000 PackInst:EraseFlash		
				
					$D0000 PackInst:EraseFlash		
					$E0000 PackInst:EraseFlash		
					$F0000 PackInst:EraseFlash		


     				'Downloading OS...' log
     				SWFile dup loadobj exch PackInst:DownloadHX2File
     				'Reset Device...'log
     			
					ResetDevice
				%	8000 Wait
					15000 Wait
     				'Erasing OS parameter sector...' log     
     				$C0000 PackInst:EraseFlash		
	     			'Downloading OS parameter tree...' log    
    				TreeFile dup loadobj exch PackInst:DownloadHX2File                
     			
 					'Starting OS...' log

     				$10000 StartProgram
     				'Waiting for OS reply...' log     
     				[B
         				2000 Wait      
         				0 ReadMemory 0 eq [B 
         					'...OS started...' log
         					exitloop 
         				] if	     
     				] loop 
         			'Waiting until OS is ready...' log
					5000 wait

     				[B
     					2000 Wait
         				$A2FE ReadMemory 0 eq  [B 
         					'...OS is ready' log
         					exitloop 
         				] if	     
     				] loop
				
	     			'Downloading OS default parameters ...' log    
    				DefaultParFile dup loadobj exch PackInst:DownloadGR3File
    			
    				'Reset Device...' log
    	      		ResetDevice                                                                                            
     			
     				[B
     					3000 Wait
         				$A2FE ReadMemory 0 eq  [B 
         					'...OS is ready' log
         					exitloop 
         				] if	     
     				] loop
		                
				] if
    	[A /MissingFile /Result]
	]

]