# File: runstr.src
#
#-------------------
# Executes procedures to construct and downlink observables(velocity, 
# line depth and continuum).
# 
# Note: 1. mkobstbl, 5ktst and strdp control files must have been executed 
#          before running this procedure
#       2. !GI9 must contain the address of entry point into strdp
#          !GI8 must contain the address of entry point in 5ktst
#
# V6 - Change Prime60 and Prime30 addresses
#	12-Dec-95 (MDM) - Commented out setting IPvector for 2,3, and 6
# Modified to v04 by CED 12/17/95
#  --removed VC flag commands (those are handled for us by the FOT
#  when they run k_mmtoidl and k_idltomm).
# 11-Jan-96 (MDM) - Replace clearing R4 campaign flag (CED had removed
#		    it on 17-Dec-95)
# 31-Jan-96 Dnyanesh Mathur
#    1. Removed all waits!!
#    2. Clear R81 (Bad HK board indicator)
# 31-Jan-96 (MDM) - Added setting of all campaign addresses since it is
#		    being removed from the sequence startup
#		  - Removed the setting of the IP vectors (into set_ipvec_str.src)
#  6-Feb-96 (MDM) - Made setting of the ALT flag the default
#
# 27 Mar 96 (DPM) - Initialize register lists for str/mag
# 28-Mar-96 (MDM) - Changed the MAG_TELEM default setting to 0 (from 1) (reg 5)
#                
#
program "%Z% MODULE: %M% RELEASE: %R%.%L% CREATED: %G% %U%"
source "/mdisw/cfl/dev/src/runstr.src"
descr "runstr - execute macros from mkstr."

display "Executing procedure  runstr."

tcblock mbipldin 0x136            ## Enable Queue
tcblock mbdpmod 3                 ## Set 5k mode
tcblock mbipldin 0x134            ## Enable interrupts

#Load IP Register Lists:

tcblock mbipldin 0x1b2 96 2 0x0000 0x2000   ## Pixel Alignment of RVel and LVel
tcblock mbipldin 0x1b2 98 2 0x0000 0x0000   ## Fractional pixel alignment

tcblock mbipldin 0x140 26  0        ## Clear SAVEMODE enable flag
tcblock mbipldin 0x140 28  1        ## Set SAVEMODE execute flag

tcblock mbipldin 0x140 81  0        ## Clear bad HK board flag 

tcblock mbipldin 0x1b2 69  2 0 0
tcblock mbipldin 0x1b2 560 2 0 0    ## R550-R551 set DPC len = 1
tcblock mbipldin 0x1b2 1378 16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
tcblock mbipldin 0x1b2 1420  6 0 0 0 0 0 0 

tcblock mbipldin 0x140 1130  1      ## Set initialization flag for REGDP
tcblock mbipldin 0x140 1134  1420
tcblock mbipldin 0x140 1135  0
tcblock mbipldin 0x140 1138  1467
tcblock mbipldin 0x140 1139  0
tcblock mbipldin 0x140 1212  0x0102 ## IPRL_STR_EP60 = 0x0102

tcblock mbipldin 0x140 1267 0x0140  ## IPRL_STR_STRT30 = &INIT30 
tcblock mbipldin 0x140 3016 0x0902  ## Set flag to do mag init
tcblock mbipldin 0x140 1348      0  ## Clear ALT repts counter
tcblock mbipldin 0x140 1349      5  ## Set ALT Repeats value
tcblock mbipldin 0x140 1377      0  ## Set 5K Magnetogram size to zero 
tcblock mbipldin 0x140 1448      0  ## Mag DL not active
tcblock mbipldin 0x140 1449      0  ## Campaign not active 
tcblock mbipldin 0x140 1466      0  ## $IPRL_STR_REGINI
tcblock mbipldin 0x140 1472      0  ## $IPRL_STR_FRMCHK
tcblock mbipldin 0x140 3104      0  ## Clear the callback addr (MDM) 16-Oct-95

tcb mbipldin 0x1b2 1656 4 1 0 0 0xD38         ## mkstr+ff13

tcblock mbipldin 0x11C              ## Initialize subroutine stack

# Initialize Error Log
tcblock mbipldin 0x1b2 464 3  0x0000  0x2011 4800
tcblock mbipldin 0x01EC  464
#
# Initialize Register Lists and data buffers
tcblock mbipldin 0x152 0x0600       ## Call QSR_STR_RLINIT 
tcblock mbipldin 0x152 0x089B       ## Call QSR_STR_DAINIT 
tcblock mbipldin 0x152 0x0A11       ## Call QSR_MAG_INITMAG

#tcblock mbsqreg  3     1            ## Set VC Flag
tcblock mbsqreg  4     0            ## Disable Campaign Flag (status flag)
tcblock mbsqreg  5     0            ## Set MagHR Flag (0=SCI5K)
tcblock mbsqreg 65     1            ## Enable ALT 
tcblock mbsqreg 66     0            ## Disable Campaign Flag
tcblock mbsqreg 67     0            ## Campaign address
tcblock mbsqreg 68     0            ## Disable New List Flag
tcblock mbsqreg 69     88           ## New list address (CAM_STD_ALT30)
tcblock mbsqreg 70     0            ## Disable II Flag
tcblock mbsqreg 71     88           ## II address (CAM_STD_ALT30)
tcblock mbsqreg 72     0            ## Disable Chain List Flag
tcblock mbsqreg 73     88	    ## Chain address (CAM_STD_ALT30)


tcblock mbdpflgs 16 0xffff 0        ## Clear IP Error count

# Run DEP sequence 
tcblock mbsqreg 247 0x7FFF          ## Use Frame List Que pointer only
tcblock mbsqstr 0

display "Finished procedure runstr"
return
