# File: mkstr+f_v01.src
#
program "%Z% MODULE: %M% RELEASE: %R%.%L% CREATED: %G% %U%"
source "/mdisw/cfl/flight/src/mkstr+f_v01_1.src"
descr "Loads IP queue instructions"

#========= Set Version Number ========
tcblock mbdpml 0x1000 0x8c9e 0x0f00
#=====================================

#
# DSBQUE                ; Disable Queue
tcblock mbipldin 0x0154 
#
#=======================================================
#
#
#;===================================================
#; mkstr+f
#;
#; MDI 30 second Prime Data Products Construction Program 
#;
#; This file contains modules to construct lo rate
#; data products.
#;
#; Regsiter Usage:
#;    R0081 - HR TLM board state
#;   
#; Note: Prior to invoking this program, 
#;                 i) request 5k telemetry (req sci5k), 
#;                ii) enable DEP interrupts (ENBIRPT - 0x134) and 
#;               iii) set DEP mode to 3 (mbdpmod 3).
#;---------------------------------------------------
#;
#; V1.0 -  9 Aug 95
#;      Constructed from the 60 second version (1.0).
#;
#; V1.1 - 23 Aug 95
#;      High Rate TLM handling
#;
#; V1.2 - 29 Sep 95
#;      Fix re-initialization of register lists at
#;      mode switch (Prime60 -> Prime30).
#;
#; V1.3 -  5 Oct 95
#;      1. Move List page from page 17 to page 14.
#;      2. Divide velocity data by 8 before downlinking.
#;      3. Added code to save LOI data in circular buffers.
#;
#; V1.5 -  16 Oct 95
#;      1. Implemented CALLBACK feature in Prime30
#;
#; V1.06 - 31 Oct 95
#;      1. The IP error dump register list overlapped the med-l wo
#;         register list. This caused the npix_total to be overwri
#;         and thus caused more segments to be downlinked than nec
#;         As the number of segments was initialized to 1, this re
#;         in negative segment numbers as the segment number is de
#;         after each call to LRDXFR.
#;         The med-l register list has been moved to 476-491.
#;      2. Register Initialization is controlled by a flag regiser
#;         Initialization is undertaken only if the flag is zero. 
#;         the problem of re-initialization when PRIME30 rusn for 
#;         time.
#;      3. Added a check at frame 20 to disable re-processing if a
#;         frmae 20 is recieved from the camera.
#;      4. Modified the velocity and Continuum (MKCNTNM) routines 
#;         to include header constructions and cropping. Thus Page
#;         contains the VELOCITY *data product*. Similarly, page 9
#;         the CONTINUUM data product.
#;      5. Modified LOI LRDXFR parameters for new LOI (LOI5) list.
#;      6. Modified VEL and CNTNM DPC's to reflect new CROP parame
#;
#; V1.07 -  3 Nov 95
#;      1. Changed source page for LOI-v CB and LOI-c CB data prod
#;         Now uses page 4 instead of page 1. Page 4 already had a
#;         from CNTNM instruction.
#;      2. The Velocity and Continuum data is used by 5k routines.
#;         it can not be processed into a data product until the 5
#;         is complete. Two new routines to convert Vel and Ic dat
#;         products have been created. The final product is direct
#;         page specified by IPRL_STR_VELDEST and IPRL_STR_ICDEST 
#;         These routines are called by FRM10, FRM20 and the DMPHR
#;      3. Moved temporary headers for vel and Ic data products to
#;         19:0x110000 and 19:0x110226 respectively (from 12:0x0F0
#;         12:0x0F226). This is to avoid conflicting with campaign
#;
#; V1.08 - 15 Nov 95
#;      1. Move HRDINIT register lists for VEL60, VEL30, Ic60, Ic3
#;         and CB-I to REGINI routine. These lists can then be mod
#;         without making any changes to the mkstr program.
#;      2. Move data products to offset 0x500 in the page.
#;
#; V1.09 - 21 Nov 95
#;      1. Purge pages 10, 12, 14 and 16.
#;
#; V1.10 - 29 Nov 95
#;      1. Use a single DPC code for circular buffer data products
#;         the dpc code does not reflect 30 or 60 second accumulat
#;         circular buffer data contains both types of data.
#;      2. Save accumulation period in $IPRL_STR_ACCTIM
#;      3. Set or clear 30 sec accumulation bit for med-l, loi-v a
#;         data products.
#;
#; V1.11 - 30 Nov 95
#;      1. Modified dispatch code in STR60 and STR30. The new code
#;         use register based jumps.
#;      2. Modified Register Dump and Error Dump dpc's.
#;
#; V1.12 -  1 Dec 95
#;      1. Chnaged size of MP and FB to 16k and Limb figure to 20k
#;         Corresponding changes to TWA RL's and list load instruc
#;         scitbls.src.
#;      2. Changed Flat Field Offset to 0 (from 0x20000).
#;      3. Changed List_Count parameter in RWBIN register lists fo
#;         Mag Proxy and Flux Budget.
#;
#; V1.13 - 18 Jan 96
#;      1. Check R3075 to determine VC2 status at frame 4 (not R30
#;      2. Remove SAVEMODE from FR07 processing.
#;      3. Construct Mag Proxy and Flux Budget data using 2 calls 
#;         for each. A single call generates more than 8K words of
#;         data which overflows IP internal buffer.
#;----------------------------------------------------------------
#QPROG_STR60::
#;   GOTOREG    $IPRL_STR_EP60
#;
#INIT60:
#    BRANCHNE   $IPRF_STR_REGINI   0     &SETPTR60
tcblock mbipcmd 0x0091 0x0100   0x01B0 0x05BA 0x0000 0x0108 
#    CALLQUE    &QSR_STR_RLINIT
tcblock mbipcmd 0x0091 0x0104   0x01F8 0x0600 
#    CALLQUE    &QSR_STR_DAINIT
tcblock mbipcmd 0x0091 0x0106   0x01F8 0x087D 
#;   SETREG     $IPRL_STR_EP60     &SETPTR60
#;   SETREG     $IPRL_STR_STRT60   &SETPTR60
#;
#SETPTR60:
#    SETREG     $IPRL_STR_VELXFR   $IPRL_STR_VEL60
tcblock mbipcmd 0x0091 0x0108   0x0140 0x04C6 0x04C7 
#    SETREG     $IPRL_STR_LDXFR    $IPRL_STR_LD60
tcblock mbipcmd 0x0091 0x010B   0x0140 0x04E0 0x04E1 
#    SETREG     $IPRL_STR_VHDR     $IPRL_STR_V60HDR
tcblock mbipcmd 0x0091 0x010E   0x0140 0x0650 0x05E8 
#    SETREG     $IPRL_STR_ICHDR    $IPRL_STR_IC60HDR
tcblock mbipcmd 0x0091 0x0111   0x0140 0x0656 0x05F8 
#    SETREG     $IPRL_STR_ACCTIM   60
tcblock mbipcmd 0x0091 0x0114   0x0140 0x003C 0x003C 
#;   SETREG     $IPRL_STR_EP60     &CKFRM60
#;
#CKFRM60:
#    BRANCHEQ   R3072   1  &FRM01
tcblock mbipcmd 0x0091 0x0117   0x01AE 0x0C00 0x0001 0x016A 
#    BRANCHEQ   R3072   2  &FRM02
tcblock mbipcmd 0x0091 0x011B   0x01AE 0x0C00 0x0002 0x017F 
#    BRANCHEQ   R3072   4  &FRM04
tcblock mbipcmd 0x0091 0x011F   0x01AE 0x0C00 0x0004 0x0184 
#    BRANCHEQ   R3072   5  &FRM05
tcblock mbipcmd 0x0091 0x0123   0x01AE 0x0C00 0x0005 0x0197 
#    BRANCHEQ   R3072   7  &FRM07
tcblock mbipcmd 0x0091 0x0127   0x01AE 0x0C00 0x0007 0x01A4 
#    BRANCHEQ   R3072  19  &FRM19  ; 
tcblock mbipcmd 0x0091 0x012B   0x01AE 0x0C00 0x0013 0x01AA 
#    BRANCHEQ   R3072  20  &FRM20
tcblock mbipcmd 0x0091 0x012F   0x01AE 0x0C00 0x0014 0x020D 
#
#    END
tcblock mbipcmd 0x0091 0x0133   0x01FC 
#;
#;................................................................
#;
#QPROG_STR30::
#;   GOTOREG    $IPRL_STR_EP30
#;
#INIT30:
#    BRANCHNE   $IPRF_STR_REGINI   0     &SETPTR30
tcblock mbipcmd 0x0091 0x0134   0x01B0 0x05BA 0x0000 0x013C 
#    CALLQUE    &QSR_STR_RLINIT
tcblock mbipcmd 0x0091 0x0138   0x01F8 0x0600 
#    CALLQUE    &QSR_STR_DAINIT
tcblock mbipcmd 0x0091 0x013A   0x01F8 0x087D 
#;   SETREG     $IPRL_STR_EP30     &SETPTR30
#;   SETREG     $IPRL_STR_STRT30   &SETPTR30
#;
#SETPTR30:
#    SETREG     $IPRL_STR_VELXFR   $IPRL_STR_VEL30
tcblock mbipcmd 0x0091 0x013C   0x0140 0x04C6 0x04CF 
#    SETREG     $IPRL_STR_LDXFR    $IPRL_STR_LD30
tcblock mbipcmd 0x0091 0x013F   0x0140 0x04E0 0x04EA 
#    SETREG     $IPRL_STR_VHDR     $IPRL_STR_V30HDR
tcblock mbipcmd 0x0091 0x0142   0x0140 0x0650 0x05F0 
#    SETREG     $IPRL_STR_ICHDR    $IPRL_STR_IC30HDR
tcblock mbipcmd 0x0091 0x0145   0x0140 0x0656 0x0600 
#    SETREG     $IPRL_STR_ACCTIM   30
tcblock mbipcmd 0x0091 0x0148   0x0140 0x003C 0x001E 
#;   SETREG     $IPRL_STR_EP30     &CKFRM30
#;
#CKFRM30:
#    CALLQUE    $QSR_CB_CALLBACK
tcblock mbipcmd 0x0091 0x014B   0x01F8 0x0FFA 
#;
#    BRANCHEQ   R3072   1  &FRM01
tcblock mbipcmd 0x0091 0x014D   0x01AE 0x0C00 0x0001 0x016A 
#    BRANCHEQ   R3072   2  &FRM02
tcblock mbipcmd 0x0091 0x0151   0x01AE 0x0C00 0x0002 0x017F 
#    BRANCHEQ   R3072   4  &FRM04
tcblock mbipcmd 0x0091 0x0155   0x01AE 0x0C00 0x0004 0x0184 
#    BRANCHEQ   R3072   5  &FRM05
tcblock mbipcmd 0x0091 0x0159   0x01AE 0x0C00 0x0005 0x0197 
#    BRANCHEQ   R3072   7  &FRM07
tcblock mbipcmd 0x0091 0x015D   0x01AE 0x0C00 0x0007 0x01A4 
#    BRANCHEQ   R3072   9  &FRM09   
tcblock mbipcmd 0x0091 0x0161   0x01AE 0x0C00 0x0009 0x01AA 
#    BRANCHEQ   R3072  10  &FRM10
tcblock mbipcmd 0x0091 0x0165   0x01AE 0x0C00 0x000A 0x01AF 
#
#    END
tcblock mbipcmd 0x0091 0x0169   0x01FC 
#;
#;................................................
#FRM01:
#;
#    SETREG     R159  16
tcblock mbipcmd 0x0091 0x016A   0x0140 0x009F 0x0010 
#    PURGELST   R152               ; Purge Page 12
tcblock mbipcmd 0x0091 0x016D   0x0190 0x0098 
#    SETREG     R151  16
tcblock mbipcmd 0x0091 0x016F   0x0140 0x0097 0x0010 
#    PURGELST   R144               ; Purge Page 10
tcblock mbipcmd 0x0091 0x0172   0x0190 0x0090 
#    SETREG     R143  16
tcblock mbipcmd 0x0091 0x0174   0x0140 0x008F 0x0010 
#    PURGELST   R136               ; Purge Page 14
tcblock mbipcmd 0x0091 0x0177   0x0190 0x0088 
#    SETREG     R135  16
tcblock mbipcmd 0x0091 0x0179   0x0140 0x0087 0x0010 
#    PURGETAB   R128               ; Purge Page 16
tcblock mbipcmd 0x0091 0x017C   0x0194 0x0080 
#;
#    END
tcblock mbipcmd 0x0091 0x017E   0x01FC 
#;................................................
#FRM02:
#    AVGTEMPS   3:0x00134  12
tcblock mbipcmd 0x0091 0x017F   0x0186 0x0134 0x1800 0x000C 
#    END
tcblock mbipcmd 0x0091 0x0183   0x01FC 
#;................................................
#FRM04:
#;    If HR board hang problem has been detected at frame 20, rese
#; and re-start the downlink. Reset done at this point allows all 
#; to be completed but still leave enough time to downlink the ful
#; image. Part of continuum image will however be lost.
#;    This code should execute if 
#;      in dynamics mode
#;      HR problem detected at Frame 20.
#;
#    BRANCHIF  R3075   &DONE04    ; skip if not in Dynamics (Check
tcblock mbipcmd 0x0091 0x0184   0x015A 0x0C03 0x0193 
#    BRANCHNR  0x4000  &DONE04    ; Page 8 busy-presumably sending
tcblock mbipcmd 0x0091 0x0187   0x01A6 0x4000 0x0193 
#    BRANCHEQ  R0081   0  &DONE04 ; No HR problem; downlink restar
tcblock mbipcmd 0x0091 0x018A   0x01AE 0x0051 0x0000 0x0193 
#    SAVEMODE                     ; IP Reset
tcblock mbipcmd 0x0091 0x018E   0x01E6 
#    SETREG    R0082   1          ; Set flag for Frame 5 to initia
tcblock mbipcmd 0x0091 0x018F   0x0140 0x0052 0x0001 
#    END
tcblock mbipcmd 0x0091 0x0192   0x01FC 
#DONE04:
#    SETREG    R0082   0          ; Don't initiate downlink at fra
tcblock mbipcmd 0x0091 0x0193   0x0140 0x0052 0x0000 
#    END
tcblock mbipcmd 0x0091 0x0196   0x01FC 
#;................................................
#FRM05:
#    BRANCHIF  R0082   &DONE05
tcblock mbipcmd 0x0091 0x0197   0x015A 0x0052 0x01A0 
#    START2HR  0x49  0x4000  0x4800  R518  R534
tcblock mbipcmd 0x0091 0x019A   0x019A 0x0049 0x4000 0x4800 \
                                0x0206 0x0216 
#DONE05:
#    SETREG    R0082   0
tcblock mbipcmd 0x0091 0x01A0   0x0140 0x0052 0x0000 
#    END
tcblock mbipcmd 0x0091 0x01A3   0x01FC 
#;................................................
#FRM07:
#;   SAVEMODE   
#    NOOP
tcblock mbipcmd 0x0091 0x01A4   0x01DE 
#    COPYTAB    R1116             ; Copy Vel Table
tcblock mbipcmd 0x0091 0x01A5   0x01B4 0x045C 
#    COPYTAB    R1124             ; Copy Reciprocal Table
tcblock mbipcmd 0x0091 0x01A7   0x01B4 0x0464 
#    END
tcblock mbipcmd 0x0091 0x01A9   0x01FC 
#;
#;................................................
#FRM19:
#FRM09:
#    CALLQUE    &MKVEL
tcblock mbipcmd 0x0091 0x01AA   0x01F8 0x024E 
#    CALLQUE    &MKLDPTH
tcblock mbipcmd 0x0091 0x01AC   0x01F8 0x0262 
#    END
tcblock mbipcmd 0x0091 0x01AE   0x01FC 
#;................................................
#FRM10:
#    BRANCHIF   $IPRL_STR_FRMCHK  &DO_FRM10
tcblock mbipcmd 0x0091 0x01AF   0x015A 0x05C0 0x01B5 
#    THROW      0xFBAD
tcblock mbipcmd 0x0091 0x01B2   0x01EA 0xFBAD 
#    END
tcblock mbipcmd 0x0091 0x01B4   0x01FC 
#;
#DO_FRM10:
#    SETREG     $IPRL_STR_FRMCHK  1
tcblock mbipcmd 0x0091 0x01B5   0x0140 0x05C0 0x0001 
#    LRDINIT    0
tcblock mbipcmd 0x0091 0x01B8   0x018E 0x0000 
#    MOVBLK     0:0x0002D  5:0x11491C  4L    ; Ref time -> LOI-c
tcblock mbipcmd 0x0091 0x01BA   0x0164 0x002D 0x0000 0x491C \
                                0x2811 0x0004 0x0000 
#    MOVBLK     0:0x0002D  7:0x11473C  4L    ; Ref Time -> LOI-v
tcblock mbipcmd 0x0091 0x01C1   0x0164 0x002D 0x0000 0x473C \
                                0x3811 0x0004 0x0000 
#
#    CALLQUE    &MKCNTNM
tcblock mbipcmd 0x0091 0x01C8   0x01F8 0x0269 
#;
#    BRANCHEQ   R3076    1   &SETCF  ; Cmpg Mode; Skip V+Ic D/L 
tcblock mbipcmd 0x0091 0x01CA   0x01AE 0x0C04 0x0001 0x01F3 
#    BRANCHIF   $IPRF_STR_CF &CHKALT
tcblock mbipcmd 0x0091 0x01CE   0x015A 0x05A9 0x01D6 
#    SETREG     $IPRF_STR_CF 0
tcblock mbipcmd 0x0091 0x01D1   0x0140 0x05A9 0x0000 
#    GOTO       &DO5K
tcblock mbipcmd 0x0091 0x01D4   0x0156 0x01F6 
#;
#; The state of flags is preserved for ALT repeats
#CHKALT:
#    BRANCHNE   $IPRL_STR_COUNT  0   &CHKFLG 
tcblock mbipcmd 0x0091 0x01D6   0x01B0 0x0544 0x0000 0x01E6 
#    COPYREG    $IPRL_STR_ALTRPTS    $IPRL_STR_COUNT  
tcblock mbipcmd 0x0091 0x01DA   0x0142 0x0545 0x0544 
#    ADDREGD    $IPRL_STR_COUNT      1
tcblock mbipcmd 0x0091 0x01DD   0x01BC 0x0544 0x0001 
#    COPYREG    R3075    $IPRL_STR_VC
tcblock mbipcmd 0x0091 0x01E0   0x0142 0x0C03 0x0546 
#    COPYREG    R3077    $IPRL_STR_MAGHR
tcblock mbipcmd 0x0091 0x01E3   0x0142 0x0C05 0x0547 
#;
#CHKFLG:
#    ADDREGD    $IPRL_STR_COUNT   0xFFFF
tcblock mbipcmd 0x0091 0x01E6   0x01BC 0x0544 0xFFFF 
#    BRANCHEQ   R3075    0   &DO5K   ; skip hi rate D/L if VC = 0
tcblock mbipcmd 0x0091 0x01E9   0x01AE 0x0C03 0x0000 0x01F6 
#    BRANCHEQ   R3077    1   &DO5K   ; MAG D/L in 160K
tcblock mbipcmd 0x0091 0x01ED   0x01AE 0x0C05 0x0001 0x01F6 
#;
#;   CALLQUE    &DMPHR
#    GOTO       &DO5K
tcblock mbipcmd 0x0091 0x01F1   0x0156 0x01F6 
#;
#SETCF:
#    SETREG     $IPRF_STR_CF   1
tcblock mbipcmd 0x0091 0x01F3   0x0140 0x05A9 0x0001 
#;
#DO5K:
#    CALLQUE    &STRDPS
tcblock mbipcmd 0x0091 0x01F6   0x01F8 0x028B 
#    SETREGS    $IPRL_STR_VELDEST  2 5:0x00500 
tcblock mbipcmd 0x0091 0x01F8   0x01B2 0x0640 0x0002 0x0500 \
                                0x2800 
#    CALLQUE    &MKVELDP
tcblock mbipcmd 0x0091 0x01FD   0x01F8 0x03CC 
#    SETREGS    $IPRL_STR_ICDEST   2 7:0x00500
tcblock mbipcmd 0x0091 0x01FF   0x01B2 0x0642 0x0002 0x0500 \
                                0x3800 
#    CALLQUE    &MKICDP
tcblock mbipcmd 0x0091 0x0204   0x01F8 0x0401 
#;
#    SETREG     $IPRL_CB_ADDR  0
tcblock mbipcmd 0x0091 0x0206   0x0140 0x0C20 0x0000 
#    SETREG     $IPRL_STR_FRMCHK   0
tcblock mbipcmd 0x0091 0x0209   0x0140 0x05C0 0x0000 
#
#    END
tcblock mbipcmd 0x0091 0x020C   0x01FC 
#;................................................
#FRM20:
#    BRANCHIF   $IPRL_STR_FRMCHK  &DO_FRM20
tcblock mbipcmd 0x0091 0x020D   0x015A 0x05C0 0x0216 
#    THROW      0xFBAD
tcblock mbipcmd 0x0091 0x0210   0x01EA 0xFBAD 
#    SETREG     $IPRL_STR_FRMCHK   0
tcblock mbipcmd 0x0091 0x0212   0x0140 0x05C0 0x0000 
#    END
tcblock mbipcmd 0x0091 0x0215   0x01FC 
#;
#DO_FRM20:
#    SETREG     $IPRL_STR_FRMCHK  1
tcblock mbipcmd 0x0091 0x0216   0x0140 0x05C0 0x0001 
#    LRDINIT    0
tcblock mbipcmd 0x0091 0x0219   0x018E 0x0000 
#    MOVBLK     0:0x0002D  5:0x11491C  4L    ; Ref time -> LOI-c
tcblock mbipcmd 0x0091 0x021B   0x0164 0x002D 0x0000 0x491C \
                                0x2811 0x0004 0x0000 
#    MOVBLK     0:0x0002D  7:0x11473C  4L    ; Ref Time -> LOI-v
tcblock mbipcmd 0x0091 0x0222   0x0164 0x002D 0x0000 0x473C \
                                0x3811 0x0004 0x0000 
#    CALLQUE    &MKCNTNM
tcblock mbipcmd 0x0091 0x0229   0x01F8 0x0269 
#    BRANCHIF   R3075    &DP5K           ; skip hi rate if VC = 0
tcblock mbipcmd 0x0091 0x022B   0x015A 0x0C03 0x023A 
#    BRANCHIF   $IPRF_MAG_HR    &V_I_DL  ; D/L stored mags if IPRF
tcblock mbipcmd 0x0091 0x022E   0x015A 0x05A8 0x0238 
#    CALLQUE    &QSR_MAG_HRDL
tcblock mbipcmd 0x0091 0x0231   0x01F8 0x0C00 
#    BRANCHIF   $IPRF_MAG_HR    &V_I_DL  ; If all mags done, d/l v
tcblock mbipcmd 0x0091 0x0233   0x015A 0x05A8 0x0238 
#    GOTO       &DP5K
tcblock mbipcmd 0x0091 0x0236   0x0156 0x023A 
#V_I_DL:
#    CALLQUE    &DMPHR
tcblock mbipcmd 0x0091 0x0238   0x01F8 0x0490 
#DP5K:
#    CALLQUE    &STRDPS
tcblock mbipcmd 0x0091 0x023A   0x01F8 0x028B 
#    SETREGS    $IPRL_STR_VELDEST  2 5:0x00500 
tcblock mbipcmd 0x0091 0x023C   0x01B2 0x0640 0x0002 0x0500 \
                                0x2800 
#    CALLQUE    &MKVELDP
tcblock mbipcmd 0x0091 0x0241   0x01F8 0x03CC 
#    SETREGS    $IPRL_STR_ICDEST   2 7:0x00500
tcblock mbipcmd 0x0091 0x0243   0x01B2 0x0642 0x0002 0x0500 \
                                0x3800 
#    CALLQUE    &MKICDP
tcblock mbipcmd 0x0091 0x0248   0x01F8 0x0401 
#;
#    SETREG     $IPRL_STR_FRMCHK   0
tcblock mbipcmd 0x0091 0x024A   0x0140 0x05C0 0x0000 
#    END
tcblock mbipcmd 0x0091 0x024D   0x01FC 
#;................................................
#;
#MKVEL:
#; Velocity:
#;       Source Page Sa   : Page 0, Offset 1300
#;       Source Page Sc   : Page 1, Offset 1300
#;       Destination Page : Page 5, Offset 0
#;       Shift Count      :  3  (Sum of 4 images)
#;       Block Count      :  127
#;
#;
#;   SETREGS    R800     8   0:0x00514  1:0x00514  5:0x00000  3 12
#;
#    COPYRI2D   $IPRL_STR_VELXFR  $IPRL_STR_VELWRK  $#IPRL_STR_VEL
tcblock mbipcmd 0x0091 0x024E   0x01AC 0x04C6 0x04BE 0x0008 
#    VLCTY      $IPRL_STR_VELWRK
tcblock mbipcmd 0x0091 0x0252   0x017C 0x04BE 
#;
#;   SETREGS  R512  6  1 0x0000  0x2000  0xE4  0xCFFF 0xFF3A
#    COPYRI2D $IPRL_STR_VHDR    R512  6
tcblock mbipcmd 0x0091 0x0254   0x01AC 0x0650 0x0200 0x0006 
#;   COPYRD2D $IPRL_STR_V60HDR  R512  6
#    HRDINIT  R512
tcblock mbipcmd 0x0091 0x0258   0x019C 0x0200 
#    MOVBLK   4:0x00000  19:0x110000  0x00226L       ; Save Header
tcblock mbipcmd 0x0091 0x025A   0x0164 0x0000 0x2000 0x0000 \
                                0x9811 0x0226 0x0000 
#;
#    RTNQUE
tcblock mbipcmd 0x0091 0x0261   0x01FA 
#;
#;.......................
#;
#MKLDPTH:
#;
#; Line Depth:
#;       Source Page Sa   : Page 0, Offset 1300
#;       Source Page Sc   : Page 1, Offset 1300
#;       Destination Page : Page 6, Offset 0
#;       Shift Count      :  16  
#;       Block Count      : 127 (Process data per call ~150ms)
#;       Lookup Segment   :  8  (Depends on SQRT table location)
#;
#;   SETREGS   R808 9  0:0x00514  1:0x00514  6:0x00000  16  127  8
#;
#    COPYRI2D  $IPRL_STR_LDXFR  $IPRL_STR_LDWRK  $#IPRL_STR_LDWRK
tcblock mbipcmd 0x0091 0x0262   0x01AC 0x04E0 0x04D7 0x0009 
#    LDEPTH    $IPRL_STR_LDWRK
tcblock mbipcmd 0x0091 0x0266   0x017E 0x04D7 
#;
#    RTNQUE
tcblock mbipcmd 0x0091 0x0268   0x01FA 
#;
#;.....................................................
#;      
#MKCNTNM:
#;
#; Continuum:
#;
#;
#;   SETREGS  R528  6  1 0x0000  0x2000  0xE2  0xCFFF 0xFF3B
#    COPYRI2D $IPRL_STR_ICHDR     R512  6
tcblock mbipcmd 0x0091 0x0269   0x01AC 0x0656 0x0200 0x0006 
#    HRDINIT  R512
tcblock mbipcmd 0x0091 0x026D   0x019C 0x0200 
#    MOVBLK   4:0x00000  19:0x110226  0x00226L
tcblock mbipcmd 0x0091 0x026F   0x0164 0x0000 0x2000 0x0226 \
                                0x9811 0x0226 0x0000 
#;
#; Extract 1024^2 Sd from page 2 to page 1 
#;      Source Page       : page 2, Offset 1300
#;      Destination       : Page 1, Offset 0
#;      X-Length          : 1024
#;      Y-Length          : 1024
#;      Row Length        : 1040
#;      Global Offset Reg.:   69
#;
#;   SETREGS  R811  8   2:0x00514 1:0x00000  1024  1024  1040  69
#    COPYRD2D $IPRL_STR_EXTRSD  R811  8
tcblock mbipcmd 0x0091 0x0276   0x0144 0x0618 0x032B 0x0008 
#    EXTRACT  R811
tcblock mbipcmd 0x0091 0x027A   0x017A 0x032B 
#;
#;   Extract 1024^2 Si from page 3 to page 4
#;      Source Page       : page 3, Offset 1300
#;      Destination       : Page 4, Offset 550
#;      X-Length          : 1024
#;      Y-Length          : 1024
#;      Row Length        : 1040
#;      Global Offset Reg.:   69
#;
#;   SETREGS  R819  8   1300 0x1800  4:0x00226 1024  1024  1040  6
#    COPYRD2D $IPRL_STR_EXTRSI  R811  8
tcblock mbipcmd 0x0091 0x027C   0x0144 0x0620 0x032B 0x0008 
#    EXTRACT  R811
tcblock mbipcmd 0x0091 0x0280   0x017A 0x032B 
#;
#;   Construct Continuum image in Page 7, from Sd, Si and Ld
#;     Source (Si)       : Page 4, Offset 0
#;     Source (Ld)       : Page 6, Offset 0
#;     Source (Sd)       : Page 1, Offset 0
#;     Destination       : Page 7, Offset 0
#;     Block Count       :  63 (1/2 image processed, each call < 3
#;     Cadc              : 200
#;
#;   SETREGS  R821  10  4:0x00226 6:0x00000 1:0x00000 7:0x00000 63
#    COPYRD2D $IPRL_STR_MKIC  R811 10
tcblock mbipcmd 0x0091 0x0282   0x0144 0x0628 0x032B 0x000A 
#    CNTNM    R811
tcblock mbipcmd 0x0091 0x0286   0x0182 0x032B 
#    CNTNM    R811
tcblock mbipcmd 0x0091 0x0288   0x0182 0x032B 
#;
#    RTNQUE
tcblock mbipcmd 0x0091 0x028A   0x01FA 
#;
#;.......................
#;
#STRDPS:
#;
#MKMEDL: 
#; Construct Medium-l
#;
#; This routine assumes that X and Y vectors as well as a Vector w
#; bin list for Solar radius of 3264 units has already been loaded
#; 14:0x07000. Such a bin list consists of 29 bins generating 1450
#; data. 
#;
#; Construct vector weighted binned image  
#;  Velocity Page        5
#;  Destination Address  7:0x110000
#;  List Count           0
#;  List Count           6  (*5=30; 5 bins processed on last call)
#;  VWBIN List Address   14:0x07000
#;  Global Offset Reg.   69
#;
#; Velocity  -> Bad Pixel Removed  ->  Med-l
#;    5      ->        1           ->  7:0x110000
#;
#    COPYRD2D   R3052  R1092  8
tcblock mbipcmd 0x0091 0x028B   0x0144 0x0BEC 0x0444 0x0008 
#    BADPIX     R1092
tcblock mbipcmd 0x0091 0x028F   0x01D2 0x0444 
#;
#    COPYRD2D   R1072  R832   8
tcblock mbipcmd 0x0091 0x0291   0x0144 0x0430 0x0340 0x0008 
#    VWBIN      R832
tcblock mbipcmd 0x0091 0x0295   0x019E 0x0340 
#    VWBIN      R832
tcblock mbipcmd 0x0091 0x0297   0x019E 0x0340 
#    VWBIN      R832
tcblock mbipcmd 0x0091 0x0299   0x019E 0x0340 
#    VWBIN      R832
tcblock mbipcmd 0x0091 0x029B   0x019E 0x0340 
#    VWBIN      R832
tcblock mbipcmd 0x0091 0x029D   0x019E 0x0340 
#;
#;........................
#;
#MKGP:
#;
#; Construct Golf Proxy
#; (RWBinned Line Depth - 11289 pixels)
#;
#;
#    COPYRD2D   R3040  R1100  12
tcblock mbipcmd 0x0091 0x029F   0x0144 0x0BE0 0x044C 0x000C 
#    FLATFLD    R1100
tcblock mbipcmd 0x0091 0x02A3   0x01CC 0x044C 
#;
#    COPYRD2D   R1024  R900  8
tcblock mbipcmd 0x0091 0x02A5   0x0144 0x0400 0x0384 0x0008 
#    RWBIN      R900             ; Multiple RWBIN calls to avoid 
tcblock mbipcmd 0x0091 0x02A9   0x01A0 0x0384 
#    RWBIN      R900             ;_generating more than 8192 outpu
tcblock mbipcmd 0x0091 0x02AB   0x01A0 0x0384 
#    RWBIN      R900             ;_per call.
tcblock mbipcmd 0x0091 0x02AD   0x01A0 0x0384 
#    RWBIN      R900
tcblock mbipcmd 0x0091 0x02AF   0x01A0 0x0384 
#;
#    COPYRD2D   R1032  R920  8
tcblock mbipcmd 0x0091 0x02B1   0x0144 0x0408 0x0398 0x0008 
#    RWBIN      R920
tcblock mbipcmd 0x0091 0x02B5   0x01A0 0x0398 
#    RWBIN      R920
tcblock mbipcmd 0x0091 0x02B7   0x01A0 0x0398 
#    RWBIN      R920
tcblock mbipcmd 0x0091 0x02B9   0x01A0 0x0398 
#    RWBIN      R920
tcblock mbipcmd 0x0091 0x02BB   0x01A0 0x0398 
#;
#;..........................
#;
#MKFB:
#;
#; Construct Flux Budget 
#; (RWBinned Continuum)
#;                               
#    COPYRD2D   R3060  R1080  12
tcblock mbipcmd 0x0091 0x02BD   0x0144 0x0BF4 0x0438 0x000C 
#    FLATFLD    R1080
tcblock mbipcmd 0x0091 0x02C1   0x01CC 0x0438 
#
#    COPYRD2D   R1040  R952  8
tcblock mbipcmd 0x0091 0x02C3   0x0144 0x0410 0x03B8 0x0008 
#    RWBIN      R952
tcblock mbipcmd 0x0091 0x02C7   0x01A0 0x03B8 
#    RWBIN      R952
tcblock mbipcmd 0x0091 0x02C9   0x01A0 0x03B8 
#    RWBIN      R952
tcblock mbipcmd 0x0091 0x02CB   0x01A0 0x03B8 
#    RWBIN      R952
tcblock mbipcmd 0x0091 0x02CD   0x01A0 0x03B8 
#;
#    COPYRD2D   R1048  R972  8
tcblock mbipcmd 0x0091 0x02CF   0x0144 0x0418 0x03CC 0x0008 
#    RWBIN      R972
tcblock mbipcmd 0x0091 0x02D3   0x01A0 0x03CC 
#    RWBIN      R972
tcblock mbipcmd 0x0091 0x02D5   0x01A0 0x03CC 
#    RWBIN      R972
tcblock mbipcmd 0x0091 0x02D7   0x01A0 0x03CC 
#    RWBIN      R972
tcblock mbipcmd 0x0091 0x02D9   0x01A0 0x03CC 
#;
#;
#;...........................
#;
#MKLF:
#;
#; Construct Limb Figure
#;
#; Construct 1st Limb Figure from image in page 7 into page 6 (110
#    ;SETREGS   R856    8  0x5800   6:0x110000  0  2000 14:0x03000
#;   ;SETREGS   R856    8  0x3800   6:0x110000  0  2000 14:0x03000
#;
#    COPYRD2D  R1056  R856  8
tcblock mbipcmd 0x0091 0x02DB   0x0144 0x0420 0x0358 0x0008 
#    CROP      R856
tcblock mbipcmd 0x0091 0x02DF   0x0178 0x0358 
#;   TWAVG     R864
#;
#; Construct 2nd Limb Figure from image in page 7 into page 6 (114
#    ;SETREGS   R880    8  0x5000   6:0x115000  0  2000 14:0x05000
#    ;SETREGS   R880    8  0x3800   6:0x115000  0  2000 14:0x05000
#;
#    COPYRD2D  R1064  R880  8
tcblock mbipcmd 0x0091 0x02E1   0x0144 0x0428 0x0370 0x0008 
#    CROP      R880
tcblock mbipcmd 0x0091 0x02E5   0x0178 0x0370 
#;   TWAVG     R888
#;
#;
#    ; ADDREGD    R3583    2
#    ; GOTOREG    R3583
#;
#    GOTO      &SCITLM    ; Start 5k data downlink
tcblock mbipcmd 0x0091 0x02E7   0x0156 0x02E9 
#;
#;
#;--------------------------------------------------------
#; Program to downlink data via the 5k channel
#;
#;
#SCITLM:
#;
#; Structure Mode Telemetry output program
#; --------- ---- --------- ------ -------
#;  (Uses Registers R210-R293)
#;
#; Get System Time From Page 0
#;   LRDINIT  0x1800
#    NOOP
tcblock mbipcmd 0x0091 0x02E9   0x01DE 
#    NOOP
tcblock mbipcmd 0x0091 0x02EA   0x01DE 
#    NOOP
tcblock mbipcmd 0x0091 0x02EB   0x01DE 
#    NOOP
tcblock mbipcmd 0x0091 0x02EC   0x01DE 
#    NOOP
tcblock mbipcmd 0x0091 0x02ED   0x01DE 
#;
#; Error log output (if needed)
#    COPYELOG  $IPRL_STR_ERRDMP+4                      ; R464
tcblock mbipcmd 0x0091 0x02EE   0x01EC 0x01D0 
#    BRANCHIF  $IPRL_STR_ERRDMP+6  &MAG_DL             ; R466
tcblock mbipcmd 0x0091 0x02F0   0x015A 0x01D2 0x02F5 
#    LRDXFR    $IPRL_STR_ERRDMP
tcblock mbipcmd 0x0091 0x02F3   0x0198 0x01CC 
#;
#;
#; Output Magnetogram if VC <> 0 && CmpgF == 0 && NSeg <> 0
#MAG_DL:
#    BRANCHIF  R3075                &ENDMAG            ; No 160k
tcblock mbipcmd 0x0091 0x02F5   0x015A 0x0C03 0x030F 
#    BRANCHEQ  R3076       1        &ENDMAG            ; Campaign 
tcblock mbipcmd 0x0091 0x02F8   0x01AE 0x0C04 0x0001 0x030F 
#    BRANCHIF  $IPRL_MAG_LRDPRM+3   &MED_L
tcblock mbipcmd 0x0091 0x02FC   0x015A 0x0565 0x031E 
#;
#    REGSUB    $IPRL_MAG_LRDPRM+13  $IPRL_MAG_LRDPRM+1  $IPRL_MAG_
tcblock mbipcmd 0x0091 0x02FF   0x2146 0x056F 0x0563 0x057B 
#    BRANCHGT  $IPRL_MAG_TMP     0  &DO_MAG5K
tcblock mbipcmd 0x0091 0x0303   0x01BA 0x057B 0x0000 0x0314 
#    REGSUB    $IPRL_MAG_LRDPRM+12  $IPRL_MAG_LRDPRM    $IPRL_MAG_
tcblock mbipcmd 0x0091 0x0307   0x2146 0x056E 0x0562 0x057B 
#    BRANCHGT  $IPRL_MAG_TMP     0  &DO_MAG5K
tcblock mbipcmd 0x0091 0x030B   0x01BA 0x057B 0x0000 0x0314 
#ENDMAG:
#    SETREG    $IPRL_MAG_LRDPRM+3   0                  ; No more M
tcblock mbipcmd 0x0091 0x030F   0x0140 0x0565 0x0000 
#    GOTO      &MED_L
tcblock mbipcmd 0x0091 0x0312   0x0156 0x031E 
#;
#DO_MAG5K:
#    LRDXFR    $IPRL_MAG_LRDPRM
tcblock mbipcmd 0x0091 0x0314   0x0198 0x0562 
#    LRDXFR    $IPRL_MAG_LRDPRM
tcblock mbipcmd 0x0091 0x0316   0x0198 0x0562 
#    LRDXFR    $IPRL_MAG_LRDPRM
tcblock mbipcmd 0x0091 0x0318   0x0198 0x0562 
#    LRDXFR    $IPRL_MAG_LRDPRM
tcblock mbipcmd 0x0091 0x031A   0x0198 0x0562 
#    GOTO      &MP2LRBUF
tcblock mbipcmd 0x0091 0x031C   0x0156 0x033C 
#;
#MED_L:
#;
#; Medium-l Data output
#;
#;   LRDXFR   R360
#;      NpixTotal          0
#;      NpixSeg            0
#;      Seqment            4
#;      Source             7:0x110000
#;      MaxSource          3584
#;      N                  0
#;      K                  0
#;      SegLength          3584
#;      DPID               0xBFFFFFB0L
#;      NPixImage          14336L
#;
#;   SETREGS  R360  9  0 0 0 4 7:0x110000 3584 0 0 
#;   SETREGS  R369  5 3584 0xBFFF 0xFFB0 14336 0
#    COPYRD2D $IPRL_STR_MEDL_L    $IPRL_STR_MEDL_W  14   ; Copy Me
tcblock mbipcmd 0x0091 0x031E   0x0144 0x0168 0x01DC 0x000E 
#;
#    SETREG   $IPRL_STR_DPCW      0xFF3F
tcblock mbipcmd 0x0091 0x0322   0x0140 0x05BC 0xFF3F 
#    REGAND   $IPRL_STR_MEDL_W+10 $IPRL_STR_DPCW    $IPRL_STR_DPCW
tcblock mbipcmd 0x0091 0x0325   0x0150 0x01E6 0x05BC 0x05BD 
#    BRANCHEQ $IPRL_STR_ACCTIM    60                &DOLRDM
tcblock mbipcmd 0x0091 0x0329   0x01AE 0x003C 0x003C 0x0334 
#    SETREG   $IPRL_STR_DPCW      0x0040                 ; Set 30s
tcblock mbipcmd 0x0091 0x032D   0x0140 0x05BC 0x0040 
#    REGOR    $IPRL_STR_DPCW+1    $IPRL_STR_DPCW    $IPRL_STR_MEDL
tcblock mbipcmd 0x0091 0x0330   0x2150 0x05BD 0x05BC 0x01E6 
#DOLRDM:    
#    LRDXFR   $IPRL_STR_MEDL_W
tcblock mbipcmd 0x0091 0x0334   0x0198 0x01DC 
#    LRDXFR   $IPRL_STR_MEDL_W
tcblock mbipcmd 0x0091 0x0336   0x0198 0x01DC 
#    LRDXFR   $IPRL_STR_MEDL_W
tcblock mbipcmd 0x0091 0x0338   0x0198 0x01DC 
#    LRDXFR   $IPRL_STR_MEDL_W
tcblock mbipcmd 0x0091 0x033A   0x0198 0x01DC 
#;
#; GOLF Proxy
#MP2LRBUF:
#    LRDXFR   R374
tcblock mbipcmd 0x0091 0x033C   0x0198 0x0176 
#;
#; Continuum Intensity
#;
#    LRDXFR   R388
tcblock mbipcmd 0x0091 0x033E   0x0198 0x0184 
#;
#; Limb Figure
#;
#    LRDXFR   R402
tcblock mbipcmd 0x0091 0x0340   0x0198 0x0192 
#;
#; LOI-v
#;      Source Page:          5
#;      Destination Addr.:    7:0x114740
#;      List Pointer:         0
#;      List Count:           5
#;      List Addr.:          14:0x030000
#;      Offset Reg:          69
#;
#;   SETREGS  $IPRL_STR_MKLOIV 8 0x2800 7:0x114740 0 45 14:0x03400
#    _IRBIN   $IPRL_STR_MKLOIV
tcblock mbipcmd 0x0091 0x0342   0x81A4 0x048C 
#;
#;   Register List R416-R429 is initialized by Irregular Bin load
#;   command in the control file loi3b.src
#;
#    COPYRD2D R416  $IPRL_STR_LVLRDP_W  16
tcblock mbipcmd 0x0091 0x0344   0x0144 0x01A0 0x049C 0x0010 
#    SETREG   $IPRL_STR_DPCW    0xFF3F
tcblock mbipcmd 0x0091 0x0348   0x0140 0x05BC 0xFF3F 
#    REGAND   $IPRL_STR_LVLRDP_W+10  $IPRL_STR_DPCW  $IPRL_STR_DPC
tcblock mbipcmd 0x0091 0x034B   0x0150 0x04A6 0x05BC 0x05BD 
#    BRANCHEQ $IPRL_STR_ACCTIM     60    &DOLVLRD
tcblock mbipcmd 0x0091 0x034F   0x01AE 0x003C 0x003C 0x035A 
#    SETREG   $IPRL_STR_DPCW    0x0040                 ; Set 30s D
tcblock mbipcmd 0x0091 0x0353   0x0140 0x05BC 0x0040 
#    REGOR    $IPRL_STR_DPCW+1  $IPRL_STR_DPCW  $IPRL_STR_LVLRDP_W
tcblock mbipcmd 0x0091 0x0356   0x2150 0x05BD 0x05BC 0x04A6 
#DOLVLRD:
#    LRDXFR   $IPRL_STR_LVLRDP_W
tcblock mbipcmd 0x0091 0x035A   0x0198 0x049C 
#;
#;   SETREGS  R512  6  4:0x00001  0x3000 0  0xCFFF  0xFF2E
#    COPYRD2D $IPRL_STR_CBVHDR    R512  6
tcblock mbipcmd 0x0091 0x035C   0x0144 0x065C 0x0200 0x0006 
#    HRDINIT  R512
tcblock mbipcmd 0x0091 0x0360   0x019C 0x0200 
#;
#    SETREGS  R512  6  6:0x00000  12:0x010000  0x0228L
tcblock mbipcmd 0x0091 0x0362   0x01B2 0x0200 0x0006 0x0000 \
                                0x3000 0x0000 0x6001 0x0228 \
                                0x0000 
#    DAT2LST  R512
tcblock mbipcmd 0x0091 0x036B   0x01C4 0x0200 
#    COPYCB   $IPRL_STR_LOIV2CB
tcblock mbipcmd 0x0091 0x036D   0x01CA 0x05B2 
#;
#; LOI-c
#;      Source Page:          7
#;      Destination Addr.:    5:0x114920
#;      List Pointer:         0
#;      List Count:           5
#;      List Addr.:          14:0x030000
#;      Offset Reg:          69
#;
#;
#;   SETREGS  $IPRL_STR_MKLOIC 8 0x3800 5:0x114920 0 45 14:0x03000
#    _IRBIN    $IPRL_STR_MKLOIC
tcblock mbipcmd 0x0091 0x036F   0x81A4 0x0494 
#;
#;   Register List R430-R443 is initialized by Irregular Bin load
#;   command in the control file loi3b.src
#;
#    COPYRD2D R430  $IPRL_STR_LCLRDP_W  16
tcblock mbipcmd 0x0091 0x0371   0x0144 0x01AE 0x04AC 0x0010 
#    SETREG   $IPRL_STR_DPCW    0xFF3F
tcblock mbipcmd 0x0091 0x0375   0x0140 0x05BC 0xFF3F 
#    REGAND   $IPRL_STR_LCLRDP_W+10  $IPRL_STR_DPCW  $IPRL_STR_DPC
tcblock mbipcmd 0x0091 0x0378   0x0150 0x04B6 0x05BC 0x05BD 
#    BRANCHEQ $IPRL_STR_ACCTIM     60    &DOLCLRD
tcblock mbipcmd 0x0091 0x037C   0x01AE 0x003C 0x003C 0x0387 
#    SETREG   $IPRL_STR_DPCW    0x0040                 ; Set 30s D
tcblock mbipcmd 0x0091 0x0380   0x0140 0x05BC 0x0040 
#    REGOR    $IPRL_STR_DPCW+1  $IPRL_STR_DPCW  $IPRL_STR_LCLRDP_W
tcblock mbipcmd 0x0091 0x0383   0x2150 0x05BD 0x05BC 0x04B6 
#DOLCLRD:
#    LRDXFR   $IPRL_STR_LCLRDP_W
tcblock mbipcmd 0x0091 0x0387   0x0198 0x04AC 
#;
#;   SETREGS  R512  6  4:0x00001  0x3000 0  0xCFFF  0xFF2F
#    COPYRD2D $IPRL_STR_CBIHDR    R512  6
tcblock mbipcmd 0x0091 0x0389   0x0144 0x0662 0x0200 0x0006 
#    HRDINIT  R512
tcblock mbipcmd 0x0091 0x038D   0x019C 0x0200 
#;
#    SETREGS  R512  6  6:0x00000  12:0x050000  0x0228L
tcblock mbipcmd 0x0091 0x038F   0x01B2 0x0200 0x0006 0x0000 \
                                0x3000 0x0000 0x6005 0x0228 \
                                0x0000 
#    DAT2LST  R512
tcblock mbipcmd 0x0091 0x0398   0x01C4 0x0200 
#    COPYCB   $IPRL_STR_LOIC2CB
tcblock mbipcmd 0x0091 0x039A   0x01CA 0x05AA 
#;
#; Register Block Data Product 
#;
#    CALLQUE  &REGDP
tcblock mbipcmd 0x0091 0x039C   0x01F8 0x0442 
#;
#    LRDEND
tcblock mbipcmd 0x0091 0x039E   0x0196 
#    SETIRPT  1
tcblock mbipcmd 0x0091 0x039F   0x014E 0x0001 
#;
#;................................................................
#;
#; Construct Time Weighted Averages
#;
#    TWAVG    R908               ; MP #1
tcblock mbipcmd 0x0091 0x03A1   0x01CE 0x038C 
#    TWAVG    R928               ; MP #2
tcblock mbipcmd 0x0091 0x03A3   0x01CE 0x03A0 
#;
#    TWAVG    R960               ; FB #1
tcblock mbipcmd 0x0091 0x03A5   0x01CE 0x03C0 
#    TWAVG    R980               ; FB #2
tcblock mbipcmd 0x0091 0x03A7   0x01CE 0x03D4 
#;
#    TWAVG    R864               ; LF #1
tcblock mbipcmd 0x0091 0x03A9   0x01CE 0x0360 
#    TWAVG    R888               ; LF #2
tcblock mbipcmd 0x0091 0x03AB   0x01CE 0x0378 
#;
#;................................................................
#;
#    BRANCHEQ R873  0  &PATH1
tcblock mbipcmd 0x0091 0x03AD   0x01AE 0x0369 0x0000 0x03B7 
#    BRANCHEQ R897  0  &PATH2
tcblock mbipcmd 0x0091 0x03B1   0x01AE 0x0381 0x0000 0x03BB 
#    GOTO     &DONE5K
tcblock mbipcmd 0x0091 0x03B5   0x0156 0x03CB 
#;
#PATH1:
#;   _COPYLST R216                  ; MP RWBin 1 <- New MP RWBin L
#;   _COPYLST R280                  ; FB RWBin 1 <- New FB RWBin L
#    _COPYLST R344                  ; LFCropList1 <- New LF Crop L
tcblock mbipcmd 0x0091 0x03B7   0x81C2 0x0158 
#    GOTO     &CPYLRD
tcblock mbipcmd 0x0091 0x03B9   0x0156 0x03BF 
#;
#PATH2:
#;   _COPYLST R224                  ; MP RWBin 2 <- New MP RWBin L
#;   _COPYLST R288                  ; FB RWBin 2 <- New FB RWBin L
#    _COPYLST R352                  ; LFCropList2 <- New LF Crop L
tcblock mbipcmd 0x0091 0x03BB   0x81C2 0x0160 
#    GOTO     &CPYLRD
tcblock mbipcmd 0x0091 0x03BD   0x0156 0x03BF 
#;
#CPYLRD:
#    COPYRD2D R168  R374  14
tcblock mbipcmd 0x0091 0x03BF   0x0144 0x00A8 0x0176 0x000E 
#    COPYRD2D R232  R388  14
tcblock mbipcmd 0x0091 0x03C3   0x0144 0x00E8 0x0184 0x000E 
#    COPYRD2D R296  R402  14        ; Set LRDXFR from set 1
tcblock mbipcmd 0x0091 0x03C7   0x0144 0x0128 0x0192 0x000E 
#;
#DONE5K:
#    RTNQUE
tcblock mbipcmd 0x0091 0x03CB   0x01FA 
#;
#;................................................................
#; Subroutine to make a velocity data product
#;
#MKVELDP:
#; Scale Velocity data; Source Page 5, Dest Page 4
#    SETREGS  R504  8  5:0x00000  4:0x00000  0x100000L  1  13
tcblock mbipcmd 0x0091 0x03CC   0x01B2 0x01F8 0x0008 0x0000 \
                                0x2800 0x0000 0x2000 0x0000 \
                                0x0010 0x0001 0x000D 
#    SCALE    R504
tcblock mbipcmd 0x0091 0x03D7   0x01BE 0x01F8 
#;
#;   Copy Velocity from page 4 to destination page (5 or 8)
#    SETREGS  R520  8  0x2000   5:0x00726  0  1010  14:0x00000  R6
tcblock mbipcmd 0x0091 0x03D9   0x01B2 0x0208 0x0008 0x2000 \
                                0x0726 0x2800 0x0000 0x03F2 \
                                0x0000 0x7000 0x0045 
#    COPYREG  $IPRL_STR_VELDEST    R521
tcblock mbipcmd 0x0091 0x03E4   0x0142 0x0640 0x0209 
#    ADDREGD  R521  0x0226
tcblock mbipcmd 0x0091 0x03E7   0x01BC 0x0209 0x0226 
#    COPYREG  $IPRL_STR_VELDEST+1  R522
tcblock mbipcmd 0x0091 0x03EA   0x0142 0x0641 0x020A 
#    CROP     R520
tcblock mbipcmd 0x0091 0x03ED   0x0178 0x0208 
#;
#    SETREGS  R512  6 19:0x110000  5:0x00500  550L
tcblock mbipcmd 0x0091 0x03EF   0x01B2 0x0200 0x0006 0x0000 \
                                0x9811 0x0500 0x2800 0x0226 \
                                0x0000 
#    COPYREG  $IPRL_STR_VELDEST    R514
tcblock mbipcmd 0x0091 0x03F8   0x0142 0x0640 0x0202 
#    COPYREG  $IPRL_STR_VELDEST+1  R515
tcblock mbipcmd 0x0091 0x03FB   0x0142 0x0641 0x0203 
#    MOVBLKI  R512  
tcblock mbipcmd 0x0091 0x03FE   0x0166 0x0200 
#    RTNQUE
tcblock mbipcmd 0x0091 0x0400   0x01FA 
#;
#;................................................................
#; Subroutine to make Continuum data product
#;
#MKICDP:
#;   Crop Continuum from page 7 to page 4
#    SETREGS  R536  8  0x3800  4:0x00226  0  1010  14:0x00000  R69
tcblock mbipcmd 0x0091 0x0401   0x01B2 0x0218 0x0008 0x3800 \
                                0x0226 0x2000 0x0000 0x03F2 \
                                0x0000 0x7000 0x0045 
#    CROP     R536
tcblock mbipcmd 0x0091 0x040C   0x0178 0x0218 
#;
#;   Apply Square-Root (Table @ Seg 9) scaling to the cropped imag
#    SETREGS  R544 8  4:0x00226  7:0x00726  0xC0000L  0x0000  9
tcblock mbipcmd 0x0091 0x040E   0x01B2 0x0220 0x0008 0x0226 \
                                0x2000 0x0726 0x3800 0x0000 \
                                0x000C 0x0000 0x0009 
#    COPYREG  $IPRL_STR_ICDEST    R546
tcblock mbipcmd 0x0091 0x0419   0x0142 0x0642 0x0222 
#    ADDREGD  R546  0x0226
tcblock mbipcmd 0x0091 0x041C   0x01BC 0x0222 0x0226 
#    COPYREG  $IPRL_STR_ICDEST+1  R547
tcblock mbipcmd 0x0091 0x041F   0x0142 0x0643 0x0223 
#    COPYREG  R71  R548
tcblock mbipcmd 0x0091 0x0422   0x0142 0x0047 0x0224 
#    COPYREG  R72  R549
tcblock mbipcmd 0x0091 0x0425   0x0142 0x0048 0x0225 
#    LOOKUP   R544
tcblock mbipcmd 0x0091 0x0428   0x01C0 0x0220 
#;
#; Copy Header to destination page (7 or 9)
#    SETREGS  R512  6  19:0x110226  7:0x00500  550L
tcblock mbipcmd 0x0091 0x042A   0x01B2 0x0200 0x0006 0x0226 \
                                0x9811 0x0500 0x3800 0x0226 \
                                0x0000 
#    COPYREG  $IPRL_STR_ICDEST    R514
tcblock mbipcmd 0x0091 0x0433   0x0142 0x0642 0x0202 
#    COPYREG  $IPRL_STR_ICDEST+1  R515
tcblock mbipcmd 0x0091 0x0436   0x0142 0x0643 0x0203 
#    MOVBLKI  R512  
tcblock mbipcmd 0x0091 0x0439   0x0166 0x0200 
#;
#;   Load length in R534
#    COPYREG  R71  R534
tcblock mbipcmd 0x0091 0x043B   0x0142 0x0047 0x0216 
#    COPYREG  R72  R535
tcblock mbipcmd 0x0091 0x043E   0x0142 0x0048 0x0217 
#;
#    RTNQUE
tcblock mbipcmd 0x0091 0x0441   0x01FA 
#;
#;--------------------------------------------------------------
#; Function to create data product containing IP registers.
#;
#; Register Usage:
#;   Register(s)             Usage
#;     R1130        R_init:       Initialization Flag
#;     R1131        R_r0_addr_lo: Low order Address of R0
#;     R1132-1133   R_startaddr:  Address of 1st register of D/L B
#;     R1134        R_startnum:   Start register Number 
#;     R1135-1136   R_endaddr:    Address of last regsier of D/L B
#;     R1137        R_endnum:     End register number
#;     R1138        R_diff:       = (R_movreg - R_endaddr)
#;     R1139        R_movreg:     RL for moving a block of registe
#;     R1145        R_lrdxfr:     RL to create dp entry.
#;
#;   Address
#;    7:0x113C00    dp_buf0:      CCD Temperatures
#;    7:0x113C14    dp_buf1:      Fixed Registers (R126-R159)
#;    7:0x113C36    dp_buf2:      Register Block 
#;
#;     40           Count
#;     94           max_src
#;
#;................................................................
#;
#REGDP:
#    BRANCHIF  R1130        &MKDPC
tcblock mbipcmd 0x0091 0x0442   0x015A 0x046A 0x044D 
#;
#    CALLQUE   &INITREG
tcblock mbipcmd 0x0091 0x0445   0x01F8 0x0477 
#;   
#    SETREG    R1131        0xE000
tcblock mbipcmd 0x0091 0x0447   0x0140 0x046B 0xE000 
#;
#    SETREG    R1130        0
tcblock mbipcmd 0x0091 0x044A   0x0140 0x046A 0x0000 
#;
#MKDPC:
#;
#; Copy CCD temperatures to output buffer
#    SAVERLST  R0            20          7:0x113C00
tcblock mbipcmd 0x0091 0x044D   0x014A 0x0000 0x0014 0x3C00 \
                                0x3811 
#;
#; Copy current pointer in the register block to R126
#    REGSUB    R1140         R1131       R126
tcblock mbipcmd 0x0091 0x0452   0x2146 0x0474 0x046B 0x007E 
#;
#; Save Register pointer and Memory Purge registers to o/p buffer
#    SAVERLST  R126          34          7:0x113C14
tcblock mbipcmd 0x0091 0x0456   0x014A 0x007E 0x0022 0x3C14 \
                                0x3811 
#;
#; Set destination address in MOVBLKI register list
#    SETREGS   R1142      2              7:0x113C36
tcblock mbipcmd 0x0091 0x045B   0x01B2 0x0476 0x0002 0x3C36 \
                                0x3811 
#    SETREGS   R1144      2              40L   
tcblock mbipcmd 0x0091 0x0460   0x01B2 0x0478 0x0002 0x0028 \
                                0x0000 
#
#; Copy register sub-block and setup dpc header
#    MOVBLKI   R1140
tcblock mbipcmd 0x0091 0x0465   0x0166 0x0474 
#;   SETREGS   R1146      6  0  0  0  1  7:0x113C00 
#;   SETREGS   R1152      6  94 0  0  94 0xA000  0xffb6
#;   SETREGS   R1158      2  94 0
#    COPYREG   R126       $IPRL_STR_RDUMP+11
tcblock mbipcmd 0x0091 0x0467   0x0142 0x007E 0x0485 
#;   _LRDXFR   R1146
#    _LRDXFR   $IPRL_STR_RDUMP
tcblock mbipcmd 0x0091 0x046A   0x8198 0x047A 
#;
#; Check if Register block downlink is completed
#    REGSUB    R1140      R1136   R1160
tcblock mbipcmd 0x0091 0x046C   0x2146 0x0474 0x0470 0x0488 
#    BRANCHLT  R1160        0           &DONER
tcblock mbipcmd 0x0091 0x0470   0x01B8 0x0488 0x0000 0x0476 
#    CALLQUE   &INITREG
tcblock mbipcmd 0x0091 0x0474   0x01F8 0x0477 
#DONER:
#    RTNQUE
tcblock mbipcmd 0x0091 0x0476   0x01FA 
#;
#;.......................................................
#; Initialize Registers
#;
#; Registers area is 16:0x0BE000 to 16:0x0BFFFF
#;
#; R1134, R1135 - Contains the Register Block Start Number
#; R1138, R1139 - Contains Register Block End Number 
#; R1132, R1133 - Address of Start Register Number
#; R1135, R1136 - Address of end Register Number
#; R1140, R1141 - Address of next register to be downlinked
#;
#INITREG:
#    SETREGS   R1132   2             16:0x0BE000
tcblock mbipcmd 0x0091 0x0477   0x01B2 0x046C 0x0002 0xE000 \
                                0x800B 
#    ADDADR    R1132   R1134  R1132
tcblock mbipcmd 0x0091 0x047C   0x0148 0x046C 0x046E 0x046C 
#    SETREGS   R1136     2           16:0x0BE000
tcblock mbipcmd 0x0091 0x0480   0x01B2 0x0470 0x0002 0xE000 \
                                0x800B 
#    ADDADR    R1136   R1138  R1136
tcblock mbipcmd 0x0091 0x0485   0x0148 0x0470 0x0472 0x0470 
#    COPYREG   R1132   R1140
tcblock mbipcmd 0x0091 0x0489   0x0142 0x046C 0x0474 
#    COPYREG   R1133   R1141
tcblock mbipcmd 0x0091 0x048C   0x0142 0x046D 0x0475 
#    RTNQUE
tcblock mbipcmd 0x0091 0x048F   0x01FA 
#;.......................................................
#;--------------------------------------------------------------
#;           dmpdpc.ips
#;
#; This file contains modules to downlink Med-l, MP, FB
#; and LF data. 
#;
#;   R0081  -  High Rate Board Status; 0 = OK; 1 = NOK
#;
#;-----------------------------------------------------
#;...................................................
#;
#DMPHR:
#    BRANCHIF  $IPRF_MAG_HR      &STRTHR     ; MAG downlink active
tcblock mbipcmd 0x0091 0x0490   0x015A 0x05A8 0x0494 
#    RTNQUE
tcblock mbipcmd 0x0091 0x0493   0x01FA 
#;
#STRTHR:
#    BRANCHNR  0x4000  &HLTDL8   ; Page 8 is not available
tcblock mbipcmd 0x0091 0x0494   0x01A6 0x4000 0x04F1 
#;
#VELIMG:
#    SETREGS    $IPRL_STR_VELDEST  2 8:0x00000 
tcblock mbipcmd 0x0091 0x0497   0x01B2 0x0640 0x0002 0x0000 \
                                0x4000 
#    CALLQUE    &MKVELDP
tcblock mbipcmd 0x0091 0x049C   0x01F8 0x03CC 
#;
#;   Load length in R518
#    COPYREG  R71  R518
tcblock mbipcmd 0x0091 0x049E   0x0142 0x0047 0x0206 
#    COPYREG  R72  R519
tcblock mbipcmd 0x0091 0x04A1   0x0142 0x0048 0x0207 
#;.....................................................
#;
#IcIMG:
#    BRANCHNR  0x4800  &HLTDL9  ; Page 9 is not available
tcblock mbipcmd 0x0091 0x04A4   0x01A6 0x4800 0x0516 
#;
#Ic1:
#    SETREGS   $IPRL_STR_ICDEST    2 9:0x00000 
tcblock mbipcmd 0x0091 0x04A7   0x01B2 0x0642 0x0002 0x0000 \
                                0x4800 
#    CALLQUE   &MKICDP
tcblock mbipcmd 0x0091 0x04AC   0x01F8 0x0401 
#
#;   Load length in R534
#    COPYREG  R71  R534
tcblock mbipcmd 0x0091 0x04AE   0x0142 0x0047 0x0216 
#    COPYREG  R72  R535
tcblock mbipcmd 0x0091 0x04B1   0x0142 0x0048 0x0217 
#;
#;**************************************
#;  Temporary Test Code
#    BRANCHNE  R560  17  &TSTP9
tcblock mbipcmd 0x0091 0x04B4   0x01B0 0x0230 0x0011 0x04C8 
#    SETREGS   R518  2   0xD092DL
tcblock mbipcmd 0x0091 0x04B8   0x01B2 0x0206 0x0002 0x092D \
                                0x000D 
#    SETREG    R560  0
tcblock mbipcmd 0x0091 0x04BD   0x0140 0x0230 0x0000 
#    FILLBLK   8:0x00226  0x100000L  32
tcblock mbipcmd 0x0091 0x04C0   0x016C 0x0226 0x4000 0x0000 \
                                0x0010 0x0020 
#    GOTO      &DWNLNK
tcblock mbipcmd 0x0091 0x04C6   0x0156 0x04DC 
#TSTP9:
#    BRANCHNE  R561  17  &DWNLNK
tcblock mbipcmd 0x0091 0x04C8   0x01B0 0x0231 0x0011 0x04DC 
#    SETREGS   R534  2   0xC00A9L
tcblock mbipcmd 0x0091 0x04CC   0x01B2 0x0216 0x0002 0x00A9 \
                                0x000C 
#    SETREG    R561  0
tcblock mbipcmd 0x0091 0x04D1   0x0140 0x0231 0x0000 
#    FILLBLK   9:0x00226  0x100000L  32
tcblock mbipcmd 0x0091 0x04D4   0x016C 0x0226 0x4800 0x0000 \
                                0x0010 0x0020 
#    GOTO      &DWNLNK
tcblock mbipcmd 0x0091 0x04DA   0x0156 0x04DC 
#DWNLNK:
#    NOOP
tcblock mbipcmd 0x0091 0x04DC   0x01DE 
#;*************************************
#;   Start Hi-Rate
#    START2HR  0x49  0x4000  0x4800  R518  R534
tcblock mbipcmd 0x0091 0x04DD   0x019A 0x0049 0x4000 0x4800 \
                                0x0206 0x0216 
#;
#    SETREG    R143  16
tcblock mbipcmd 0x0091 0x04E3   0x0140 0x008F 0x0010 
#    PURGELST  R136                ; Wait 160 ms
tcblock mbipcmd 0x0091 0x04E6   0x0190 0x0088 
#    BRANCHNR  0x4000  &EXIT       ; P8 should be busy
tcblock mbipcmd 0x0091 0x04E8   0x01A6 0x4000 0x053B 
#;
#    BRANCHGT  R0081   0   &SKIPHR ; BAD > 0; Skip HR
tcblock mbipcmd 0x0091 0x04EB   0x01BA 0x0051 0x0000 0x053F 
#    GOTO      &ERREXT             ; Set BAD
tcblock mbipcmd 0x0091 0x04EF   0x0156 0x0543 
#;
#;.....................................................
#;
#; Halt Page 8 downlink
#;
#HLTDL8:      
#    BRANCHGT R0081 0  &SKIPHR     ; HR NOK => Skip HR
tcblock mbipcmd 0x0091 0x04F1   0x01BA 0x0051 0x0000 0x053F 
#;
#    SETREGS  R552  6  1 0x0000  0x5800  0x00  0xCFFF 0xFF98
tcblock mbipcmd 0x0091 0x04F5   0x01B2 0x0228 0x0006 0x0001 \
                                0x0000 0x5800 0x0000 0xCFFF \
                                0xFF98 
#    HRDINIT  R552
tcblock mbipcmd 0x0091 0x04FE   0x019C 0x0228 
#    SETREGS  R558  2  0x00001L
tcblock mbipcmd 0x0091 0x0500   0x01B2 0x022E 0x0002 0x0001 \
                                0x0000 
#    START1HR 0x33  0x5800  R558   ; D/L P11 to free P8
tcblock mbipcmd 0x0091 0x0505   0x0174 0x0033 0x5800 0x022E 
#;
#    SETREG   R143  16
tcblock mbipcmd 0x0091 0x0509   0x0140 0x008F 0x0010 
#    PURGELST R136                 ; While away 82 ms
tcblock mbipcmd 0x0091 0x050C   0x0190 0x0088 
#    SETREG   R143  112
tcblock mbipcmd 0x0091 0x050E   0x0140 0x008F 0x0070 
#;
#    BRANCHNR 0x4000 &ERREXT       ; P8 still busy => HR NOK
tcblock mbipcmd 0x0091 0x0511   0x01A6 0x4000 0x0543 
#    GOTO     &VELIMG
tcblock mbipcmd 0x0091 0x0514   0x0156 0x0497 
#;
#;
#; Halt Page 9 downlink
#HLTDL9:      
#    BRANCHEQ R0081 1  &EXIT       ; HR NOK => Skip HR
tcblock mbipcmd 0x0091 0x0516   0x01AE 0x0051 0x0001 0x053B 
#;
#    SETREGS  R552  6  1 0x0000  0x5800  0x00  0xCFFF 0xFF98
tcblock mbipcmd 0x0091 0x051A   0x01B2 0x0228 0x0006 0x0001 \
                                0x0000 0x5800 0x0000 0xCFFF \
                                0xFF98 
#    HRDINIT  R552
tcblock mbipcmd 0x0091 0x0523   0x019C 0x0228 
#    SETREGS  R558  2  0x00001L
tcblock mbipcmd 0x0091 0x0525   0x01B2 0x022E 0x0002 0x0001 \
                                0x0000 
#    START1HR 0x33  0x5800  R558   ; D/L P11 to free P9
tcblock mbipcmd 0x0091 0x052A   0x0174 0x0033 0x5800 0x022E 
#;
#    SETREG   R143  16
tcblock mbipcmd 0x0091 0x052E   0x0140 0x008F 0x0010 
#    PURGELST R136                 ; While away 82 ms
tcblock mbipcmd 0x0091 0x0531   0x0190 0x0088 
#    SETREG   R143  112
tcblock mbipcmd 0x0091 0x0533   0x0140 0x008F 0x0070 
#;
#    BRANCHNR 0x4800 &ERREXT       ; P9 still busy => HR NOK
tcblock mbipcmd 0x0091 0x0536   0x01A6 0x4800 0x0543 
#    GOTO     &Ic1
tcblock mbipcmd 0x0091 0x0539   0x0156 0x04A7 
#;
#;............................................................
#;
#EXIT:
#    SETREG   R0081    0           ; Clear HR NOK Flag
tcblock mbipcmd 0x0091 0x053B   0x0140 0x0051 0x0000 
#    RTNQUE   
tcblock mbipcmd 0x0091 0x053E   0x01FA 
#;
#SKIPHR:
#    ADDREGD  R0081  0xFFFF        ; R81 <- R81 - 1
tcblock mbipcmd 0x0091 0x053F   0x01BC 0x0051 0xFFFF 
#    RTNQUE     
tcblock mbipcmd 0x0091 0x0542   0x01FA 
#;
#ERREXT:
#    SETREG    R0081   3           ; Set HR NOK flag
tcblock mbipcmd 0x0091 0x0543   0x0140 0x0051 0x0003 
#    SETREG    R0026   1           ; Set "Save_Context" Flag
tcblock mbipcmd 0x0091 0x0546   0x0140 0x001A 0x0001 
#    RTNQUE      
tcblock mbipcmd 0x0091 0x0549   0x01FA 
#;
#;============================================================
#=======================================================
#
# ENBQUE                ; Enable Queue
tcblock mbipldin 0x0136
#
#
return
#
#=======================================================
