# File: mag30_v19.src
#
program "%Z% MODULE: %M% RELEASE: %R%.%L% CREATED: %G% %U%"
source "/mdisw/cfl/flight/src/mag30_v19.src"
descr "Loads IP queue instructions"
#=======================================================
#
#
#; File: mag30.ips
#;
#; IP program to construct a magnetogram.
#; The program assumes that the camera frames have
#; been accumulated as shown;
#;    Sa (LCP) - Page 0     Sa (RCP) - Page 1
#;    Sc (LCP) - Page 3     Sc (RCP) - Page 2
#;
#; The mag30 observation accumulates raw camera data as 
#; shown above.
#;
#; Successive Magnetograms are saved in pages 11, 15, 17, 18 and 1
#;
#; Algorithm:
#;
#;  STEP 1:
#;     7:             Make RCP Velocity
#;     8:             Make LCP Velocity
#;
#;  STEP 2:           EXTRACT a (LCP) sub-image to provide 
#;                    integral shift w.r.t. RCP Velocity image
#;
#;  STEP 3:
#;     1:             Align LCP-V
#;                    Align RCP-V
#;     2:             SUM LCP-V and RCP-V
#;                    Add result to Accumulator
#;                    If Accumulation Completed, 
#;                        Do Setup for next MAG 
#;
#;  STEP 4:           For Hi-Res apply FD Cropping
#;
#;   5 Oct 95  Dnyanesh Mathur
#;      1. Changed shift count to 13 for GEN_MAG RL.
#;      2. Cropped magnetogram before downlink.
#;
#; V0.08 - 23 Jan 96  Dnyanesh Mathur
#;      1. Corrected the High Rate DPC
#;
#; V0.09 - 31 Jan 96  Dnyanesh Mathur
#;      1. Removed the shift being applied to difference of veloci
#; V0.10 -  7 Feb 96  Dnyanesh Mathur
#;      1. Crop accumulated magnetogram prior to summing
#;      2. Clear accumulation buffer prior to start of new accumul
#;
#; V0.11 - 20 Mar 96  Dnyanesh MAthur
#;      1. Changed the sign of magnetogram.
#;      2. Modified 5k accumulation code to use copies of DEP regs
#;         9 (copied to IP register R3081) and 15 (IP register R30
#;         determine start and end of accumulation period. R9 is z
#;         first call and R15 is zero on the last.
#;
#; V0.12 - 27 Mar 96 Dnyanesh Mathur
#;      1. Removed entry point change after initialization. Initia
#;         moved to "runstr".
#; 
#; V0.14 - 10 May 96 Dnyanesh Mathur
#;      1. Changed page usage to use a new 10 exposure frame list.
#;
#; V0.15 - 24 Jul 96 Dnyanesh Mathur
#;      1. Changed K value to 3 (from 5) for single mag d/l in 160
#;                         to 4 (from 5) for summed mag d/l in 160
#;                         to 4 (from 5) for d/l in 5k.
#;
#; V0.16 - 31 Jul 96 Dnyanesh Mathur
#;      1. During Dynamics periods, set a flag to downlink accumul
#;         mag in two parts via the high rate channel.
#;
#; V0.17 - 11 Aug 96 Dnyanesh Mathur
#;      1. Changed downlink size for partial mags from 0x60000 to 
#;         The Low word of the partial mag DPC's were changed to 0
#;         respectively. 
#;
#; V0.18 - 14 Aug 96 Dnyanesh Mathur
#;      1. The STORMAG label was defined in two places. All refere
#;         translated to the 1st one. Thus the code to set flags t
#;         completed mags were never set.
#;
#; V0.19 -  3 Oct 96 Dnyanesh Mathur
#;      1. The "next" store page is not cleared until the first mi
#;         of the accumulation period. It was being cleared when t
#;         previous ALT period ended. It could thus be overwritten
#;         campaign periods thereby adding an unknown image to the
#;
#; V0.20 - 25 Mar 97 Dnyanesh Mathur
#;      1. Allow downlink of an accumulated magnetogram either via
#;         or in two parts via the 160k channel. The first option 
#;         selected by DEP R5 = 1 and the latter option by DEP R5 
#;         of direct downlink of individual mags is dropped(!). 
#;      2. Modified 5k downlink parameters to set k=5 and segment_
#;         These parameters were in effect on 10 July 1996 althoug
#;         are not reflected in the code.
#;----------------------------------------------------------------
#;
#;
#QPROG_MAG30::
#;
#;   GOTOREG   R3016
#;   CALLQUE   &INITMAG
#;   SETREG    R3016  &MAGVECT
#;
#MAGVECT:
#    BRANCHEQ  R3072  0x0008  &L_VEL
tcblock mbipmacl 0x08E0    0x01AE 0x0C00 0x0008 0x08E9 
#    BRANCHEQ  R3072  0x0009  &R_VEL
tcblock mbipmacl 0x08E4    0x01AE 0x0C00 0x0009 0x08EC 
#    END
tcblock mbipmacl 0x08E8    0x01FC 
#
#;
#;.......................................................
#;
#L_VEL:
#   _VLCTY     $IPRL_MAG_RVEL
tcblock mbipmacl 0x08E9    0x817C 0x04FD 
#    END
tcblock mbipmacl 0x08EB    0x01FC 
#;
#;.......................................................
#;
#R_VEL:
#   _VLCTY     $IPRL_MAG_LVEL
tcblock mbipmacl 0x08EC    0x817C 0x04F5 
#    HRDINIT   $IPRL_MAG_HDR
tcblock mbipmacl 0x08EE    0x019C 0x053E 
#;  
#;.......................................................
#; Align Velocities
#;
#; Integral Pixel Alignment:
#; If LCP (0,0) --> RCP (X,Y) then
#;     1. X>0, Y>0: Move  RCP (X,1024Y) to BUF (0,0)
#;     2. X>0, Y<0: Move  RCP (X,0)     to BUF (0,1024Y)
#;     3. X<0, Y>0: Move  RCP (0,1024Y) to BUF (X,0)
#;     4. X<0, Y<0: Move  RCP (0,0)     to BUF (X,1024Y)
#;
#ALIGN_VEL:
#    _EXTRACT    $IPRL_MAG_VPIXALGN        ; Effect integral pixel
tcblock mbipmacl 0x08F0    0x817A 0x0505 
#;
#    COPYREG    R98  $IPRL_MAG_XALGN_RV+5
tcblock mbipmacl 0x08F2    0x0142 0x0062 0x0512 
#    COPYREG    R99  $IPRL_MAG_YALGN_RV+5
tcblock mbipmacl 0x08F5    0x0142 0x0063 0x051A 
#    REGNEG     $IPRL_MAG_XALGN_RV+5   $IPRL_MAG_XALGN_RV+5  $IPRL
tcblock mbipmacl 0x08F8    0x4146 0x0512 0x0512 0x0522 
#    REGNEG     $IPRL_MAG_YALGN_RV+5   $IPRL_MAG_XALGN_RV+5  $IPRL
tcblock mbipmacl 0x08FC    0x4146 0x051A 0x0512 0x052A 
#
#   _XALIGN     $IPRL_MAG_XALGN_RV         ; Fractional Pixel Alig
tcblock mbipmacl 0x0900    0x81DA 0x050D 
#;
#    COPYRD2D   $IPRL_MAG_YALGN_RV     $IPRL_MAG_ALGNWRK     $#IPR
tcblock mbipmacl 0x0902    0x0144 0x0515 0x0572 0x0008 
#    YALIGN     $IPRL_MAG_ALGNWRK
tcblock mbipmacl 0x0906    0x01DC 0x0572 
#    YALIGN     $IPRL_MAG_ALGNWRK
tcblock mbipmacl 0x0908    0x01DC 0x0572 
#    YALIGN     $IPRL_MAG_ALGNWRK
tcblock mbipmacl 0x090A    0x01DC 0x0572 
#    YALIGN     $IPRL_MAG_ALGNWRK
tcblock mbipmacl 0x090C    0x01DC 0x0572 
#;
#   _XALIGN     $IPRL_MAG_XALGN_LV
tcblock mbipmacl 0x090E    0x81DA 0x051D 
#;
#    COPYRD2D   $IPRL_MAG_YALGN_LV     $IPRL_MAG_ALGNWRK     $#IPR
tcblock mbipmacl 0x0910    0x0144 0x0525 0x0572 0x0008 
#    YALIGN     $IPRL_MAG_ALGNWRK
tcblock mbipmacl 0x0914    0x01DC 0x0572 
#    YALIGN     $IPRL_MAG_ALGNWRK
tcblock mbipmacl 0x0916    0x01DC 0x0572 
#    YALIGN     $IPRL_MAG_ALGNWRK
tcblock mbipmacl 0x0918    0x01DC 0x0572 
#    YALIGN     $IPRL_MAG_ALGNWRK
tcblock mbipmacl 0x091A    0x01DC 0x0572 
#;
#;
#;.......................................................
#; Accumulate Magnetogram
#;
#PROC_MAG:
#   _SCALESUM    $IPRL_MAG_GENMAG              ; newMAG = RCP_VEL 
tcblock mbipmacl 0x091C    0x81E0 0x052D 
#;
#    BRANCHEQ    $IPRF_STR_CF       1    &MAG160KDL ; Campaign Mod
tcblock mbipmacl 0x091E    0x01AE 0x05A9 0x0001 0x0931 
#    BRANCHEQ    $IPRL_STR_STORMAG  1    &STORMAG   ; Mag Storage 
tcblock mbipmacl 0x0922    0x01AE 0x070E 0x0001 0x098C 
#    BRANCHEQ    $IPRL_STR_ACCMAG   1    &ACCMAG    ; Mag Accumula
tcblock mbipmacl 0x0926    0x01AE 0x070F 0x0001 0x094A 
#;
#    BRANCHIF    R3075              &STORMAG        ; No HR, Start
tcblock mbipmacl 0x092A    0x015A 0x0C03 0x098C 
#    BRANCHLT    R3077    2         &ACCMAG         ; MAGHR disabl
tcblock mbipmacl 0x092D    0x01B8 0x0C05 0x0002 0x094A 
#;
#; High Rate Downlink
#MAG160KDL:
#;
#    CALLQUE  &QSR_TLM_RESET
tcblock mbipmacl 0x0931    0x01F8 0x0B80 
#    BRANCHGT $IPRL_TLM_STATUS  0   &SKPDL
tcblock mbipmacl 0x0933    0x01BA 0x1FFC 0x0000 0x0949 
#;
#    COPYRD2D $IPRL_MAG_CROP  R520  8
tcblock mbipmacl 0x0937    0x0144 0x0632 0x0208 0x0008 
#    CROP     R520
tcblock mbipmacl 0x093B    0x0178 0x0208 
#
#    COPYRD2D $IPRL_MAG_HDR1 R512  6
tcblock mbipmacl 0x093D    0x0144 0x063A 0x0200 0x0006 
#    HRDINIT     R512
tcblock mbipmacl 0x0941    0x019C 0x0200 
#;   COPYREG     R71                 R518
#;   COPYREG     R72                 R519
#;   SETREGS     R518  2  0x100000L
#    START1HR    0x01  0x4000  R71   
tcblock mbipmacl 0x0943    0x0174 0x0001 0x4000 0x0047 
#    CALLQUE     &QSR_STR_CHKDL8
tcblock mbipmacl 0x0947    0x01F8 0x0B20 
#;
#SKPDL:
#    END
tcblock mbipmacl 0x0949    0x01FC 
#;
#;
#ACCMAG:
#;
#; Accumulate Magnetogram for downlink in the 5K channel. In this 
#; magnetogram is always accumulated in page 19. The cadence must 
#; be greater than ~20 minutes. The "Dynamics" mode should not be 
#; when less than 20 minutes of 160K channel time is remaining. 
#;
#    BRANCHIF    R3081                &CLR5KBF
tcblock mbipmacl 0x094A    0x015A 0x0C09 0x094F 
#    GOTO        &DO_M5K
tcblock mbipmacl 0x094D    0x0156 0x0958 
#;
#CLR5KBF:
#    FILLBLK     19:0x00000         0x120000L     0
tcblock mbipmacl 0x094F    0x016C 0x0000 0x9800 0x0000 \
                                0x0012 0x0000 
#    SETREG      $IPRL_STR_ACCMAG   1
tcblock mbipmacl 0x0955    0x0140 0x070F 0x0001 
#;   SETREG      $IPRP_MAG_5KEP     &DO_M5K
#;
#DO_M5K:
#    SETREG      $IPRL_MAG_SUMMAG+5 0x9800
tcblock mbipmacl 0x0958    0x0140 0x054D 0x9800 
#    SETREG      $IPRL_MAG_CPYMAG+1 0x9800
tcblock mbipmacl 0x095B    0x0140 0x0554 0x9800 
#   _MOVBLKI     $IPRL_MAG_CPYMAG 
tcblock mbipmacl 0x095E    0x8166 0x0553 
#   _SCALESUM    $IPRL_MAG_SUMMAG
tcblock mbipmacl 0x0960    0x81E0 0x0548 
#    BRANCHIF    R3087              &STRT5KDL
tcblock mbipmacl 0x0962    0x015A 0x0C0F 0x0966 
#    END
tcblock mbipmacl 0x0965    0x01FC 
#;
#STRT5KDL:
#    _MOVBLKI    $IPRL_MAG_CPYMAG
tcblock mbipmacl 0x0966    0x8166 0x0553 
#    COPYRD2D    $IPRL_MAG_CROP  R520 8
tcblock mbipmacl 0x0968    0x0144 0x0632 0x0208 0x0008 
#    SETREGS     R520                 3  0x3000 19:0x00226
tcblock mbipmacl 0x096C    0x01B2 0x0208 0x0003 0x3000 \
                                0x0226 0x9800 
#    CROP        R520
tcblock mbipmacl 0x0972    0x0178 0x0208 
#;
#; The Summed and Cropped magnetogram is now in Page 19. 
#; If DEP-R5 = 0, downlink it in 2 parts through 160k channel.
#; Otherwise downlink it in 5k.
#;
#    BRANCHIF    R3077                &MAG_DL_2P
tcblock mbipmacl 0x0974    0x015A 0x0C05 0x0985 
#;
#    COPYRD2D    $IPRL_MAG_5KPRM      $IPRL_MAG_LRDPRM  14
tcblock mbipmacl 0x0977    0x0144 0x0668 0x0562 0x000E 
#;   SETREGS     $IPRL_MAG_LRDPRM     9  0 0 0  300 19:0x00226 819
#;   SETREGS     $IPRL_MAG_LRDPRM+9   5  4000 0x0940 0x0FC0 0 0x00
#    COPYREG     R71  $IPRL_MAG_LRDPRM+12
tcblock mbipmacl 0x097B    0x0142 0x0047 0x056E 
#    COPYREG     R72  $IPRL_MAG_LRDPRM+13
tcblock mbipmacl 0x097E    0x0142 0x0048 0x056F 
#    SETREG      $IPRL_STR_ACCMAG     0
tcblock mbipmacl 0x0981    0x0140 0x070F 0x0000 
#    END
tcblock mbipmacl 0x0984    0x01FC 
#;
#MAG_DL_2P:
#    SETREG      $IPRL_STR_DP2MAG     2        ; Request Mag D/L i
tcblock mbipmacl 0x0985    0x0140 0x0709 0x0002 
#    SETREG      $IPRL_STR_ACCMAG     0
tcblock mbipmacl 0x0988    0x0140 0x070F 0x0000 
#    END
tcblock mbipmacl 0x098B    0x01FC 
#;
#STORMAG:
#;
#; Accumulate magnetograms for later downlink via the 160k channel
#; in VC2 mode (Delivered to GSFC). In this mode, each accumulatio
#; directed to a different page. Pages 15, 18, and 19 have been se
#; these magnetograms. 
#;
#    BRANCHEQ    $IPRL_STR_STORMAG  1         &ADDMAG
tcblock mbipmacl 0x098C    0x01AE 0x070E 0x0001 0x09CD 
#    SETREG      $IPRL_STR_STORMAG  1
tcblock mbipmacl 0x0990    0x0140 0x070E 0x0001 
#;   SETREGS     $IPRL_MAG_CLRPAG   3         0x120000L  0
#    BRANCHEQ    $IPRP_MAG_ACCPAG   0x6800    &CLRP13
tcblock mbipmacl 0x0993    0x01AE 0x05A1 0x6800 0x09A7 
#    BRANCHEQ    $IPRP_MAG_ACCPAG   0x7800    &CLRP15
tcblock mbipmacl 0x0997    0x01AE 0x05A1 0x7800 0x09AF 
#    BRANCHEQ    $IPRP_MAG_ACCPAG   0x8800    &CLRP17
tcblock mbipmacl 0x099B    0x01AE 0x05A1 0x8800 0x09B7 
#    BRANCHEQ    $IPRP_MAG_ACCPAG   0x9000    &CLRP18
tcblock mbipmacl 0x099F    0x01AE 0x05A1 0x9000 0x09BF 
#    BRANCHEQ    $IPRP_MAG_ACCPAG   0x9800    &CLRP19
tcblock mbipmacl 0x09A3    0x01AE 0x05A1 0x9800 0x09C7 
#CLRP13: 
#    FILLBLK     13:0x00000         0x120000L            0
tcblock mbipmacl 0x09A7    0x016C 0x0000 0x6800 0x0000 \
                                0x0012 0x0000 
#    GOTO        &ADDMAG
tcblock mbipmacl 0x09AD    0x0156 0x09CD 
#CLRP15:
#    FILLBLK     15:0x00000         0x120000L            0
tcblock mbipmacl 0x09AF    0x016C 0x0000 0x7800 0x0000 \
                                0x0012 0x0000 
#    GOTO        &ADDMAG
tcblock mbipmacl 0x09B5    0x0156 0x09CD 
#CLRP17:
#    FILLBLK     17:0x00000         0x120000L            0
tcblock mbipmacl 0x09B7    0x016C 0x0000 0x8800 0x0000 \
                                0x0012 0x0000 
#    GOTO        &ADDMAG
tcblock mbipmacl 0x09BD    0x0156 0x09CD 
#CLRP18:
#    FILLBLK     18:0x00000         0x120000L            0
tcblock mbipmacl 0x09BF    0x016C 0x0000 0x9000 0x0000 \
                                0x0012 0x0000 
#    GOTO        &ADDMAG
tcblock mbipmacl 0x09C5    0x0156 0x09CD 
#CLRP19:
#    FILLBLK     19:0x00000         0x120000L            0
tcblock mbipmacl 0x09C7    0x016C 0x0000 0x9800 0x0000 \
                                0x0012 0x0000 
#;
#ADDMAG:
#    COPYREG     $IPRP_MAG_ACCPAG   $IPRL_MAG_SUMMAG+5
tcblock mbipmacl 0x09CD    0x0142 0x05A1 0x054D 
#    COPYREG     $IPRP_MAG_ACCPAG   $IPRL_MAG_CPYMAG+1
tcblock mbipmacl 0x09D0    0x0142 0x05A1 0x0554 
#;
#; Crop Mag from P7 to P6, then copy it back to page 7.
#    COPYRD2D    $IPRL_MAG_CROP     R520                8      ; C
tcblock mbipmacl 0x09D3    0x0144 0x0632 0x0208 0x0008 
#    SETREGS     R520               3   0x3800   6:0x000000    ; S
tcblock mbipmacl 0x09D7    0x01B2 0x0208 0x0003 0x3800 \
                                0x0000 0x3000 
#    CROP        R520
tcblock mbipmacl 0x09DD    0x0178 0x0208 
#    MOVBLK      6:0x000000         7:0x000000   0x100000L     ; C
tcblock mbipmacl 0x09DF    0x0164 0x0000 0x3000 0x0000 \
                                0x3800 0x0000 0x0010 
#;
#   _MOVBLKI     $IPRL_MAG_CPYMAG 
tcblock mbipmacl 0x09E6    0x8166 0x0553 
#   _SCALESUM    $IPRL_MAG_SUMMAG
tcblock mbipmacl 0x09E8    0x81E0 0x0548 
#;
#    BRANCHIF    R3087              &FINSTORMAG
tcblock mbipmacl 0x09EA    0x015A 0x0C0F 0x09EE 
#    END
tcblock mbipmacl 0x09ED    0x01FC 
#;
#; Copy the header for the completed magnetogram to the accumulati
#; The header is always created at 18:0x00000. 
#; NB MOVSBLKI is used in case the header is in Page 18 itself. Ot
#;    of MOVBLK instructions cannot copy to the same page.
#;
#FINSTORMAG:
#    SETREG      $IPRL_STR_STORMAG  0
tcblock mbipmacl 0x09EE    0x0140 0x070E 0x0000 
#    COPYREG     $IPRP_MAG_ACCPAG   $IPRL_MAG_CPYHDR+3  ;Set heade
tcblock mbipmacl 0x09F1    0x0142 0x05A1 0x05A5 
#   _MOVSBLKI    $IPRL_MAG_CPYHDR                       ;Copy Head
tcblock mbipmacl 0x09F4    0x81C8 0x05A2 
#    GOTOREG     $IPRP_MAG_NEWPAG                       ;Jump to n
tcblock mbipmacl 0x09F6    0x0158 0x05A0 
#;
#PAGE1:
#    COPYREG     $IPRP_MAG_ACCPAG   $IPRL_MAG_DONE1 
tcblock mbipmacl 0x09F8    0x0142 0x05A1 0x058C 
#    SETREG      $IPRP_MAG_ACCPAG   0x6800
tcblock mbipmacl 0x09FB    0x0140 0x05A1 0x6800 
#    SETREG      $IPRP_MAG_NEWPAG   &PAGE2
tcblock mbipmacl 0x09FE    0x0140 0x05A0 0x0A02 
#    END        
tcblock mbipmacl 0x0A01    0x01FC 
#;
#PAGE2:
#    COPYREG     $IPRP_MAG_ACCPAG   $IPRL_MAG_DONE1+1 
tcblock mbipmacl 0x0A02    0x0142 0x05A1 0x058D 
#    SETREG      $IPRP_MAG_ACCPAG   0x7800
tcblock mbipmacl 0x0A05    0x0140 0x05A1 0x7800 
#    SETREG      $IPRP_MAG_NEWPAG   &PAGE3      
tcblock mbipmacl 0x0A08    0x0140 0x05A0 0x0A0C 
#    END        
tcblock mbipmacl 0x0A0B    0x01FC 
#;
#PAGE3:
#    COPYREG     $IPRP_MAG_ACCPAG   $IPRL_MAG_DONE1+2 
tcblock mbipmacl 0x0A0C    0x0142 0x05A1 0x058E 
#    SETREG      $IPRP_MAG_ACCPAG   0x8800
tcblock mbipmacl 0x0A0F    0x0140 0x05A1 0x8800 
#    SETREG      $IPRP_MAG_NEWPAG   &PAGE4
tcblock mbipmacl 0x0A12    0x0140 0x05A0 0x0A16 
#    END        
tcblock mbipmacl 0x0A15    0x01FC 
#;
#PAGE4:
#    COPYREG     $IPRP_MAG_ACCPAG   $IPRL_MAG_DONE1+3 
tcblock mbipmacl 0x0A16    0x0142 0x05A1 0x058F 
#    SETREG      $IPRP_MAG_ACCPAG   0x9000
tcblock mbipmacl 0x0A19    0x0140 0x05A1 0x9000 
#    SETREG      $IPRP_MAG_NEWPAG   &PAGE5
tcblock mbipmacl 0x0A1C    0x0140 0x05A0 0x0A20 
#    END        
tcblock mbipmacl 0x0A1F    0x01FC 
#;
#PAGE5:
#    COPYREG     $IPRP_MAG_ACCPAG   $IPRL_MAG_DONE1+4 
tcblock mbipmacl 0x0A20    0x0142 0x05A1 0x0590 
#    SETREG      $IPRP_MAG_ACCPAG   0x9800
tcblock mbipmacl 0x0A23    0x0140 0x05A1 0x9800 
#    SETREG      $IPRP_MAG_NEWPAG   &PAGE1
tcblock mbipmacl 0x0A26    0x0140 0x05A0 0x09F8 
#    END        
tcblock mbipmacl 0x0A29    0x01FC 
#;
#;.......................................................
#; Register Lists:
#;
#INITMAG::
#;
#    SETREGS  $IPRL_MAG_LVEL  8  0:0x00514  3:0x00514  7:0x00000  
tcblock mbipmacl 0x0A2A    0x01B2 0x04F5 0x0008 0x0514 \
                                0x0000 0x0514 0x1800 0x0000 \
                                0x3800 0x0004 0x007F 
#    SETREGS  $IPRL_MAG_RVEL  8  1:0x00514  2:0x00514  5:0x00000  
tcblock mbipmacl 0x0A35    0x01B2 0x04FD 0x0008 0x0514 \
                                0x0800 0x0514 0x1000 0x0000 \
                                0x2800 0x0004 0x007F 
#;
#    SETREGS  $IPRL_MAG_VPIXALGN 8 7:0x00000  6:0x00000  1024 1024
tcblock mbipmacl 0x0A40    0x01B2 0x0505 0x0008 0x0000 \
                                0x3800 0x0000 0x3000 0x0400 \
                                0x0400 0x0400 0x0045 
#;
#    SETREGS  $IPRL_MAG_XALGN_RV    8  5:0x00000  7:0x00000 1024 0
tcblock mbipmacl 0x0A4B    0x01B2 0x050D 0x0008 0x0000 \
                                0x2800 0x0000 0x3800 0x0400 \
                                0x0000 0x0400 0x0400 
#    SETREGS  $IPRL_MAG_YALGN_RV    8  7:0x00000  5:0x00000 1024 0
tcblock mbipmacl 0x0A56    0x01B2 0x0515 0x0008 0x0000 \
                                0x3800 0x0000 0x2800 0x0400 \
                                0x0000 0x0400 0x00FF 
#    SETREGS  $IPRL_MAG_XALGN_LV    8  6:0x00000  7:0x00000 1024 0
tcblock mbipmacl 0x0A61    0x01B2 0x051D 0x0008 0x0000 \
                                0x3000 0x0000 0x3800 0x0400 \
                                0x0000 0x0400 0x0400 
#    SETREGS  $IPRL_MAG_YALGN_LV    8  7:0x00000  6:0x00000 1024 0
tcblock mbipmacl 0x0A6C    0x01B2 0x0525 0x0008 0x0000 \
                                0x3800 0x0000 0x3000 0x0400 \
                                0x0000 0x0400 0x00FF 
#
#; Magnetograms are created in Page 4.
#    SETREGS  $IPRL_MAG_GENMAG      6  6:0x00000  5:0x00000  7:0x0
tcblock mbipmacl 0x0A77    0x01B2 0x052D 0x0006 0x0000 \
                                0x3000 0x0000 0x2800 0x0000 \
                                0x3800 
#    SETREGS  $IPRL_MAG_GENMAG+6    5  0x100000L  1  0xFFFF  13
tcblock mbipmacl 0x0A80    0x01B2 0x0533 0x0005 0x0000 \
                                0x0010 0x0001 0xFFFF 0x000D 
#;
#; Magnetograms are stored at an offset of 0x00226 words; The firs
#; words are reserved for header data.
#    SETREGS  $IPRL_MAG_SUMMAG      6  7:0x00000  6:0x00000  13:0x
tcblock mbipmacl 0x0A88    0x01B2 0x0548 0x0006 0x0000 \
                                0x3800 0x0000 0x3000 0x0726 \
                                0x6800 
#    SETREGS  $IPRL_MAG_SUMMAG+6    5  0x100000L  1    1     16
tcblock mbipmacl 0x0A91    0x01B2 0x054E 0x0005 0x0000 \
                                0x0010 0x0001 0x0001 0x0010 
#;
#    SETREGS  $IPRL_MAG_CPYMAG      6 13:0x00726  6:0x00000  0x100
tcblock mbipmacl 0x0A99    0x01B2 0x0553 0x0006 0x0726 \
                                0x6800 0x0000 0x3000 0x0000 \
                                0x0010 
#;
#    SETREGS  $IPRL_MAG_CROP        8  0x3800 8:0x00226 0 1010 14:
tcblock mbipmacl 0x0AA2    0x01B2 0x0632 0x0008 0x3800 \
                                0x0226 0x4000 0x0000 0x03F2 \
                                0x0000 0x7000 0x0045 
#;
#; The Magnetogram header is saved in 18:0x00000
#    SETREGS  $IPRL_MAG_HDR         4  3:0x00001  0x9000    0xe4  
tcblock mbipmacl 0x0AAD    0x01B2 0x053E 0x0004 0x0001 \
                                0x1800 0x9000 0x00E4 
#    SETREGS  $IPRL_MAG_HDR1        4 18:0x00001  0x4000    0xe3  
tcblock mbipmacl 0x0AB4    0x01B2 0x063A 0x0004 0x0001 \
                                0x9000 0x4000 0x00E3 
#    SETREGS  $IPRL_MAG_CPYHDR      6 18:0x0000  13:0x00500 0x0022
tcblock mbipmacl 0x0ABB    0x01B2 0x05A2 0x0006 0x0000 \
                                0x9000 0x0500 0x6800 0x0226 \
                                0x0000 
#;   SETREGS  $IPRL_MAG_MVDL        6  7:0x00000  8:0x00000 0x1002
#;
#; Mag 5k parameters
#    SETREGS  $IPRL_MAG_5KPRM      10  0 0 0  300 19:0x00226 8192 
tcblock mbipmacl 0x0AC4    0x01B2 0x0668 0x000A 0x0000 \
                                0x0000 0x0000 0x012C 0x0226 \
                                0x9800 0x2000 0x000E 0x0005 \
                                0x0640 
#;   SETREGS  $IPRL_MAG_5KPRM+9     5  3600 0x0941 0x0FC0 0 0x000C
#    SETREGS  $IPRL_STR_MAGDLP1     7  18:0x000001  19:0x000226  0
tcblock mbipmacl 0x0AD1    0x01B2 0x071C 0x0007 0x0001 \
                                0x9000 0x0226 0x9800 0x16A2 \
                                0x0006 0x00E4 
#;   SETREGS  $IPRL_STR_MAGDLP1+6   3  0xe4  0x4946  0x0003
#    SETREGS  $IPRL_STR_MAGDLP2     7  18:0x000001  19:0x0618C8  0
tcblock mbipmacl 0x0ADB    0x01B2 0x0726 0x0007 0x0001 \
                                0x9000 0x18C8 0x9806 0x16A2 \
                                0x0006 0x00E4 
#;   SETREGS  $IPRL_STR_MAGDLP2+6   3  0xe4  0x4946  0x0004
#;
#; Set 5K Accumulation entry point
#;   SETREG   $IPRP_MAG_5KEP   &CLR5KBF
#;
#; Set Accumulation setup address
#    SETREGS  $IPRL_MAG_DONE1       6  0  0  0  0  0  0 
tcblock mbipmacl 0x0AE5    0x01B2 0x058C 0x0006 0x0000 \
                                0x0000 0x0000 0x0000 0x0000 \
                                0x0000 
#    SETREG   $IPRP_MAG_ACCPAG   0x6800
tcblock mbipmacl 0x0AEE    0x0140 0x05A1 0x6800 
#    SETREG   $IPRP_MAG_NEWPAG   &PAGE2
tcblock mbipmacl 0x0AF1    0x0140 0x05A0 0x0A02 
#;   SETREGS  $IPRL_MAG_DL     6  0       0x6800  0       0x4000  
#
#;
#; Clear Accumulation pages
#;   FILLBLK  13:0x00000  0x120000L  0
#;   FILLBLK  15:0x00000  0x120000L  0
#;   FILLBLK  17:0x00000  0x120000L  0
#;   FILLBLK  18:0x00000  0x120000L  0
#;   FILLBLK  19:0x00000  0x120000L  0
#;
#;   RTNQUE
#    END
tcblock mbipmacl 0x0AF4    0x01FC 
#;....................................................... 
#;=======================================================
#=======================================================
#
return
#
#=======================================================
