# File: mk_mag_v03.src
#
program "%Z% MODULE: %M% RELEASE: %R%.%L% CREATED: %G% %U%"
source "/mdisw/cfl/prep/src/mk_mag_v03.src"
descr "Loads IP queue instructions"
#=======================================================
#
#
#; NAME:    mk_mag.ips
#; PURPOSE: Make a magnetogram data product and header
#; HISTORY: Written 15-Jan-96 by M.Morrison
#; 	 2-Oct-96 (MDM) - Added sub-pixel alignment of Y dimension
#;			  for high resoultion images
#;	 4-Oct-96 (MDM) - Modified to shift LCP instead of RCP
#;	 7-Oct-96 (MDM) - Modified to
#;				1. copy from source (page 2) to page 1 (input for YALIGN)
#;				2. copy from source (page 2) to page 17 (output for YALIGN)
#;				   (done because YALIGN does not write all of the image back
#;				3. Do align (from page 1 to 17)
#;				4. Copy from page 17 to page 2.
#;			- MODIFIED TO NOT LOOK AT **MAG_PARAM** but to used hardwired
#;
#;
#QSR_MK_MAG::
#
#    ; NOTE: **** ROUTINE DOES NOT LOOK AT MAG_PARAM for the align
#
#    BRANCHIF $IPRL_MAGCAM_DO_ALIGN &SKIP_ALIGN		;if 0, then FD an
tcblock mbipmacl 0x1286    0x015A 0x152E 0x12A1 
#
#    _MOVBLKI $IPRL_MAGCAM_MOVE1A			;copy page 2 to 1
tcblock mbipmacl 0x1289    0x8166 0x1537 
#    _MOVBLKI $IPRL_MAGCAM_MOVE1B			;copy page 2 to 17
tcblock mbipmacl 0x128B    0x8166 0x153D 
#
#    SETREG   $IPRL_MAGCAM_YALIGN   0			;reset low address word of
tcblock mbipmacl 0x128D    0x0140 0x152F 0x0000 
#    SETREG   $IPRL_MAGCAM_YALIGN+2 0			;reset low address word of
tcblock mbipmacl 0x1290    0x0140 0x1531 0x0000 
#    SETREG   $IPRL_MAGCAM_COUNTER 8
tcblock mbipmacl 0x1293    0x0140 0x1549 0x0008 
#ALIGN_LOOP:
#    YALIGN   $IPRL_MAGCAM_YALIGN			;subpixel shift the RCP 0.1 pi
tcblock mbipmacl 0x1296    0x01DC 0x152F 
#    ADDREGD  $IPRL_MAGCAM_COUNTER -1
tcblock mbipmacl 0x1298    0x01BC 0x1549 0xFFFF 
#    BRANCHNE $IPRL_MAGCAM_COUNTER 0 &ALIGN_LOOP
tcblock mbipmacl 0x129B    0x01B0 0x1549 0x0000 0x1296 
#
#    _MOVBLKI     $IPRL_MAGCAM_MOVE2			;move image back to page 2 
tcblock mbipmacl 0x129F    0x8166 0x1543 
#
#;-------- Do the magnetogram calculation
#
#SKIP_ALIGN:
#    _SCALESUM    $IPRL_MAG_PARAM			;newMAG = LCP_VEL - RCP_VEL
tcblock mbipmacl 0x12A1    0x81E0 0x1278 
#
#;-------- decode the source and destination page info
#    COPYREG  $IPRL_MAG_PARAM+1 $IPRL_HDECODE_PARAM	;copy the sour
tcblock mbipmacl 0x12A3    0x0142 0x1279 0x114A 
#    COPYREG  $IPRL_MAG_PARAM+5 $IPRL_HDECODE_PARAM+1	;copy the de
tcblock mbipmacl 0x12A6    0x0142 0x127D 0x114B 
#    CALLQUE  $QSR_DO_HDECODE				;decode the value - 
tcblock mbipmacl 0x12A9    0x01F8 0x1010 
#
#;-------- now copy the relevant info to the hrdinit slot and make
#    COPYRI2D $IPRP_HDECODE_ADDR+1 $IPRL_HEAD_WORK 10	;copy the re
tcblock mbipmacl 0x12AB    0x01AC 0x1152 0x1155 0x000A 
#    COPYRD2D $IPRL_MAG_PARAM+4    $IPRL_HEAD_WORK+6 4	;copy the f
tcblock mbipmacl 0x12AF    0x0144 0x127C 0x115B 0x0004 
#    COPYRD2D $IPRL_MAG_PARAM+11   $IPRL_HEAD_WORK+3 3	;copy n/k, 
tcblock mbipmacl 0x12B3    0x0144 0x1283 0x1158 0x0003 
#    COPYRD2I $IPRL_HEAD_WORK      $IPRP_HDECODE_ADDR+1 10	;copy t
tcblock mbipmacl 0x12B7    0x01AA 0x1155 0x1152 0x000A 
#
#    CALLQUE  $QSR_DO_HEADER
tcblock mbipmacl 0x12BB    0x01F8 0x105F 
#    RTNQUE
tcblock mbipmacl 0x12BD    0x01FA 
#
#
#
#=======================================================
#
return
#
#=======================================================
