# File: runstr_v01.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
#
program "%Z% MODULE: %M% RELEASE: %R%.%L% CREATED: %G% %U%"
source "/mdisw/cfl/prepsrc/runstr.src"
descr "runstr - execute macros from mkstr."

display "Executing procedure  runstr."

tcblock mbdpmod 1                      ## Set 5k mode

# Set up Flat Field in page 10. 
# Flat field must in in LIST (8-Byte EDAC) memory. It is loaded at 0x20000
# to allow for intermediate headers to be saved at 0x00000.

tcblock mbipldin 0x118 0x5000 144                           ## Purge Page 10
wait time 5

# Set IP vectors 
tcblock  mbipldin 0x154           ## Disable Queue
 
tcblock mbipcmd 0x91 0 0x1F00     ## Heritage Load Replacement Programs
tcblock mbipcmd 0x91 1 0x0100     ## Prime60
tcblock mbipcmd 0x91 2 0x0100     ## -- NOT Used --
tcblock mbipcmd 0x91 3 0x0100     ## -- NOT Used --
tcblock mbipcmd 0x91 4 0x0134     ## Prime 30
tcblock mbipcmd 0x91 5 0x0900     ## ALT30
tcblock mbipcmd 0x91 6 0x0E83
tcblock mbipcmd 0x91 7 0x0B00     ## HDR
tcblock mbipcmd 0x91 8 0x0B07     ## TAIL

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


#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        ## Set SAVEMODE enable flag
tcblock mbipldin 0x140 28  1        ## Clear SAVEMODE execute 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 
wait time 5

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
wait time 5

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
wait time 5

tcblock mbipldin 0x11C              ## Initialize subroutine stack

# Initialize Error Log
tcblock mbipldin 0x1b2 464 3  0x0000  0x2011 4800
tcblock mbipldin 0x01EC  464

tcblock mbsqreg  3     1            ## Set VC Flag
tcblock mbsqreg  4     0            ## Set VC Flag
tcblock mbsqreg  5     1            ## Set MagHR Flag
tcblock mbsqreg 65     0            ## Disable ALT 
tcblock mbsqreg 66     0            ## Disable Campaign Flag
tcblock mbsqreg 68     0            ## Disable New List Flag
tcblock mbsqreg 70     0            ## Disable II Flag
tcblock mbsqreg 72     0            ## Disable Chain List Flag

wait time 3

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
