; 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 19. ; ; 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 velocities. ; V0.10 - 7 Feb 96 Dnyanesh Mathur ; 1. Crop accumulated magnetogram prior to summing ; 2. Clear accumulation buffer prior to start of new accumulation. ; ; V0.11 - 20 Mar 96 Dnyanesh MAthur ; 1. Changed the sign of magnetogram. ; 2. Modified 5k accumulation code to use copies of DEP regsiters ; 9 (copied to IP register R3081) and 15 (IP register R3087) to ; determine start and end of accumulation period. R9 is zero on ; first call and R15 is zero on the last. ; ; V0.12 - 27 Mar 96 Dnyanesh Mathur ; 1. Removed entry point change after initialization. Initialization ; 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 160k, ; to 4 (from 5) for summed mag d/l in 160k and ; 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 accumulated ; 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 0x616A2. ; The Low word of the partial mag DPC's were changed to 0003 and 0004 ; respectively. ; ; V0.18 - 14 Aug 96 Dnyanesh Mathur ; 1. The STORMAG label was defined in two places. All references were ; translated to the 1st one. Thus the code to set flags to indicate ; completed mags were never set. ; ; V0.19 - 3 Oct 96 Dnyanesh Mathur ; 1. The "next" store page is not cleared until the first minute ; of the accumulation period. It was being cleared when the ; previous ALT period ended. It could thus be overwritten during ; campaign periods thereby adding an unknown image to the mag data. ; ; V0.20 - 25 Mar 97 Dnyanesh Mathur ; 1. Allow downlink of an accumulated magnetogram either via 5k channel ; or in two parts via the 160k channel. The first option will be ; selected by DEP R5 = 1 and the latter option by DEP R5 = 0. The option ; of direct downlink of individual mags is dropped(!). ; 2. Modified 5k downlink parameters to set k=5 and segment_length=1600. ; These parameters were in effect on 10 July 1996 although they ; are not reflected in the code. ;----------------------------------------------------------------------- ; ; QPROG_MAG30:: ; ; GOTOREG R3016 ; CALLQUE &INITMAG ; SETREG R3016 &MAGVECT ; MAGVECT: BRANCHEQ R3072 0x0008 &L_VEL BRANCHEQ R3072 0x0009 &R_VEL END ; ;....................................................... ; L_VEL: _VLCTY $IPRL_MAG_RVEL END ; ;....................................................... ; R_VEL: _VLCTY $IPRL_MAG_LVEL HRDINIT $IPRL_MAG_HDR ; ;....................................................... ; 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 shift by ; COPYREG R98 $IPRL_MAG_XALGN_RV+5 COPYREG R99 $IPRL_MAG_YALGN_RV+5 REGNEG $IPRL_MAG_XALGN_RV+5 $IPRL_MAG_XALGN_RV+5 $IPRL_MAG_XALGN_LV+5 REGNEG $IPRL_MAG_YALGN_RV+5 $IPRL_MAG_XALGN_RV+5 $IPRL_MAG_YALGN_LV+5 _XALIGN $IPRL_MAG_XALGN_RV ; Fractional Pixel Alignment ; COPYRD2D $IPRL_MAG_YALGN_RV $IPRL_MAG_ALGNWRK $#IPRL_MAG_ALGNWRK YALIGN $IPRL_MAG_ALGNWRK YALIGN $IPRL_MAG_ALGNWRK YALIGN $IPRL_MAG_ALGNWRK YALIGN $IPRL_MAG_ALGNWRK ; _XALIGN $IPRL_MAG_XALGN_LV ; COPYRD2D $IPRL_MAG_YALGN_LV $IPRL_MAG_ALGNWRK $#IPRL_MAG_ALGNWRK YALIGN $IPRL_MAG_ALGNWRK YALIGN $IPRL_MAG_ALGNWRK YALIGN $IPRL_MAG_ALGNWRK YALIGN $IPRL_MAG_ALGNWRK ; ; ;....................................................... ; Accumulate Magnetogram ; PROC_MAG: _SCALESUM $IPRL_MAG_GENMAG ; newMAG = RCP_VEL - LCP_VEL ; BRANCHEQ $IPRF_STR_CF 1 &MAG160KDL ; Campaign Mode BRANCHEQ $IPRL_STR_STORMAG 1 &STORMAG ; Mag Storage started BRANCHEQ $IPRL_STR_ACCMAG 1 &ACCMAG ; Mag Accumulation started ; BRANCHIF R3075 &STORMAG ; No HR, Start mag storage BRANCHLT R3077 2 &ACCMAG ; MAGHR disabled, Start mag acc. ; ; High Rate Downlink MAG160KDL: ; CALLQUE &QSR_TLM_RESET BRANCHGT $IPRL_TLM_STATUS 0 &SKPDL ; COPYRD2D $IPRL_MAG_CROP R520 8 CROP R520 COPYRD2D $IPRL_MAG_HDR1 R512 6 HRDINIT R512 ; COPYREG R71 R518 ; COPYREG R72 R519 ; SETREGS R518 2 0x100000L START1HR 0x01 0x4000 R71 CALLQUE &QSR_STR_CHKDL8 ; SKPDL: END ; ; ACCMAG: ; ; Accumulate Magnetogram for downlink in the 5K channel. In this mode the ; magnetogram is always accumulated in page 19. The cadence must therefore ; be greater than ~20 minutes. The "Dynamics" mode should not be entered ; when less than 20 minutes of 160K channel time is remaining. ; BRANCHIF R3081 &CLR5KBF GOTO &DO_M5K ; CLR5KBF: FILLBLK 19:0x00000 0x120000L 0 SETREG $IPRL_STR_ACCMAG 1 ; SETREG $IPRP_MAG_5KEP &DO_M5K ; DO_M5K: SETREG $IPRL_MAG_SUMMAG+5 0x9800 SETREG $IPRL_MAG_CPYMAG+1 0x9800 _MOVBLKI $IPRL_MAG_CPYMAG _SCALESUM $IPRL_MAG_SUMMAG BRANCHIF R3087 &STRT5KDL END ; STRT5KDL: _MOVBLKI $IPRL_MAG_CPYMAG COPYRD2D $IPRL_MAG_CROP R520 8 SETREGS R520 3 0x3000 19:0x00226 CROP R520 ; ; 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 ; COPYRD2D $IPRL_MAG_5KPRM $IPRL_MAG_LRDPRM 14 ; SETREGS $IPRL_MAG_LRDPRM 9 0 0 0 300 19:0x00226 8192 14 5 ; SETREGS $IPRL_MAG_LRDPRM+9 5 4000 0x0940 0x0FC0 0 0x000C COPYREG R71 $IPRL_MAG_LRDPRM+12 COPYREG R72 $IPRL_MAG_LRDPRM+13 SETREG $IPRL_STR_ACCMAG 0 END ; MAG_DL_2P: SETREG $IPRL_STR_DP2MAG 2 ; Request Mag D/L in Hi Rate Channel SETREG $IPRL_STR_ACCMAG 0 END ; STORMAG: ; ; Accumulate magnetograms for later downlink via the 160k channel, nominally ; in VC2 mode (Delivered to GSFC). In this mode, each accumulation is ; directed to a different page. Pages 15, 18, and 19 have been set aside for ; these magnetograms. ; BRANCHEQ $IPRL_STR_STORMAG 1 &ADDMAG SETREG $IPRL_STR_STORMAG 1 ; SETREGS $IPRL_MAG_CLRPAG 3 0x120000L 0 BRANCHEQ $IPRP_MAG_ACCPAG 0x6800 &CLRP13 BRANCHEQ $IPRP_MAG_ACCPAG 0x7800 &CLRP15 BRANCHEQ $IPRP_MAG_ACCPAG 0x8800 &CLRP17 BRANCHEQ $IPRP_MAG_ACCPAG 0x9000 &CLRP18 BRANCHEQ $IPRP_MAG_ACCPAG 0x9800 &CLRP19 CLRP13: FILLBLK 13:0x00000 0x120000L 0 GOTO &ADDMAG CLRP15: FILLBLK 15:0x00000 0x120000L 0 GOTO &ADDMAG CLRP17: FILLBLK 17:0x00000 0x120000L 0 GOTO &ADDMAG CLRP18: FILLBLK 18:0x00000 0x120000L 0 GOTO &ADDMAG CLRP19: FILLBLK 19:0x00000 0x120000L 0 ; ADDMAG: COPYREG $IPRP_MAG_ACCPAG $IPRL_MAG_SUMMAG+5 COPYREG $IPRP_MAG_ACCPAG $IPRL_MAG_CPYMAG+1 ; ; Crop Mag from P7 to P6, then copy it back to page 7. COPYRD2D $IPRL_MAG_CROP R520 8 ; Copy CROP RL SETREGS R520 3 0x3800 6:0x000000 ; Set Src, dest CROP R520 MOVBLK 6:0x000000 7:0x000000 0x100000L ; Copy back ; _MOVBLKI $IPRL_MAG_CPYMAG _SCALESUM $IPRL_MAG_SUMMAG ; BRANCHIF R3087 &FINSTORMAG END ; ; Copy the header for the completed magnetogram to the accumulation page. ; The header is always created at 18:0x00000. ; NB MOVSBLKI is used in case the header is in Page 18 itself. Other types ; of MOVBLK instructions cannot copy to the same page. ; FINSTORMAG: SETREG $IPRL_STR_STORMAG 0 COPYREG $IPRP_MAG_ACCPAG $IPRL_MAG_CPYHDR+3 ;Set header copy dest. _MOVSBLKI $IPRL_MAG_CPYHDR ;Copy Header to Acc Page GOTOREG $IPRP_MAG_NEWPAG ;Jump to next page setup ; PAGE1: COPYREG $IPRP_MAG_ACCPAG $IPRL_MAG_DONE1 SETREG $IPRP_MAG_ACCPAG 0x6800 SETREG $IPRP_MAG_NEWPAG &PAGE2 END ; PAGE2: COPYREG $IPRP_MAG_ACCPAG $IPRL_MAG_DONE1+1 SETREG $IPRP_MAG_ACCPAG 0x7800 SETREG $IPRP_MAG_NEWPAG &PAGE3 END ; PAGE3: COPYREG $IPRP_MAG_ACCPAG $IPRL_MAG_DONE1+2 SETREG $IPRP_MAG_ACCPAG 0x8800 SETREG $IPRP_MAG_NEWPAG &PAGE4 END ; PAGE4: COPYREG $IPRP_MAG_ACCPAG $IPRL_MAG_DONE1+3 SETREG $IPRP_MAG_ACCPAG 0x9000 SETREG $IPRP_MAG_NEWPAG &PAGE5 END ; PAGE5: COPYREG $IPRP_MAG_ACCPAG $IPRL_MAG_DONE1+4 SETREG $IPRP_MAG_ACCPAG 0x9800 SETREG $IPRP_MAG_NEWPAG &PAGE1 END ; ;....................................................... ; Register Lists: ; INITMAG:: ; SETREGS $IPRL_MAG_LVEL 8 0:0x00514 3:0x00514 7:0x00000 4 127 ; LCP Vel SETREGS $IPRL_MAG_RVEL 8 1:0x00514 2:0x00514 5:0x00000 4 127 ; RCP Vel ; SETREGS $IPRL_MAG_VPIXALGN 8 7:0x00000 6:0x00000 1024 1024 1024 R69 ; SETREGS $IPRL_MAG_XALGN_RV 8 5:0x00000 7:0x00000 1024 0 1024 1024 SETREGS $IPRL_MAG_YALGN_RV 8 7:0x00000 5:0x00000 1024 0 1024 255 SETREGS $IPRL_MAG_XALGN_LV 8 6:0x00000 7:0x00000 1024 0 1024 1024 SETREGS $IPRL_MAG_YALGN_LV 8 7:0x00000 6:0x00000 1024 0 1024 255 ; Magnetograms are created in Page 4. SETREGS $IPRL_MAG_GENMAG 6 6:0x00000 5:0x00000 7:0x00000 SETREGS $IPRL_MAG_GENMAG+6 5 0x100000L 1 0xFFFF 13 ; ; Magnetograms are stored at an offset of 0x00226 words; The first 0x226 ; words are reserved for header data. SETREGS $IPRL_MAG_SUMMAG 6 7:0x00000 6:0x00000 13:0x00726 SETREGS $IPRL_MAG_SUMMAG+6 5 0x100000L 1 1 16 ; SETREGS $IPRL_MAG_CPYMAG 6 13:0x00726 6:0x00000 0x100000L ; SETREGS $IPRL_MAG_CROP 8 0x3800 8:0x00226 0 1010 14:0x00000 R69 ; ; The Magnetogram header is saved in 18:0x00000 SETREGS $IPRL_MAG_HDR 4 3:0x00001 0x9000 0xe4 ;0x4946 0x0fc0 SETREGS $IPRL_MAG_HDR1 4 18:0x00001 0x4000 0xe3 ;0x4841 0x0fc0 SETREGS $IPRL_MAG_CPYHDR 6 18:0x0000 13:0x00500 0x00226L ; SETREGS $IPRL_MAG_MVDL 6 7:0x00000 8:0x00000 0x100226L ; ; Mag 5k parameters SETREGS $IPRL_MAG_5KPRM 10 0 0 0 300 19:0x00226 8192 14 5 1600 ; SETREGS $IPRL_MAG_5KPRM+9 5 3600 0x0941 0x0FC0 0 0x000C SETREGS $IPRL_STR_MAGDLP1 7 18:0x000001 19:0x000226 0x616A2L 0xe4 ; SETREGS $IPRL_STR_MAGDLP1+6 3 0xe4 0x4946 0x0003 SETREGS $IPRL_STR_MAGDLP2 7 18:0x000001 19:0x0618C8 0x616A2L 0xe4 ; 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 SETREG $IPRP_MAG_ACCPAG 0x6800 SETREG $IPRP_MAG_NEWPAG &PAGE2 ; SETREGS $IPRL_MAG_DL 6 0 0x6800 0 0x4000 0 0x000C ; ; 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 ;....................................................... ;=======================================================