# File: mk_vel_v02.src
#
program "%Z% MODULE: %M% RELEASE: %R%.%L% CREATED: %G% %U%"
source "/mdisw/cfl/flight/src/mk_vel_v02_1.src"
descr "Loads IP queue instructions"
#
# DSBQUE                ; Disable Queue
tcblock mbipldin 0x0154 
#
#=======================================================
#
#
#; NAME:    mk_vel.ips
#; PURPOSE: Make a velocity data product and header
#; EXTRA INFO:
#;	The first parameter after the 3 pages is
#;		2 for 4 scans (60 sec velocity)
#;		3 for 2 scans (30 sec velocity)
#;		4 for 1 scan  (15 sec velocity/magnetogram) 
#; PAGES:
#;	Parameter defines the 2 input and one output page
#;	In addition, page 13 is used to temporarily make the doppergram
#;	(before the scaling is done into the final output page)
#; HISTORY: Written 14-Aug-95 by M.Morrison
#;          30-Aug-95 (MDM) - Changed the name and allowed either 
#;	   15-Jan-96 (MDM) - corrected the copy/setup of HDECODE_PARAM
#;			     (it was grabbing the low word)
#;	   15-Jan-96 (MDM) - Used _VLCTY instead of VLCTY
#;	   22-Jan-96 (MDM) - Added documentation to header
#;			   - Changed to always create the velocity to page 13
#;			     and to scale it and write into the final page
#;
#;
#QSR_MK_VEL::
#
#;------- Copy the proper velocity table
#    BRANCHEQ $IPRL_VEL_PARAM+8 1 &VEL_HR_TABLE
tcblock mbipcmd 0x0091 0x1761   0x01AE 0x1391 0x0001 0x176B 
#    COPYTAB $IPRL_TAB_VEL_FD
tcblock mbipcmd 0x0091 0x1765   0x01B4 0x11A9 
#    COPYTAB $IPRL_TAB_RECIP_FD
tcblock mbipcmd 0x0091 0x1767   0x01B4 0x119D 
#    GOTO &VEL_TABLE_DONE
tcblock mbipcmd 0x0091 0x1769   0x0156 0x1771 
#
#VEL_HR_TABLE:
#    COPYTAB $IPRL_TAB_VEL_HR
tcblock mbipcmd 0x0091 0x176B   0x01B4 0x11AF 
#    COPYTAB $IPRL_TAB_RECIP_HR
tcblock mbipcmd 0x0091 0x176D   0x01B4 0x11A3 
#    GOTO &VEL_TABLE_DONE
tcblock mbipcmd 0x0091 0x176F   0x0156 0x1771 
#
#VEL_TABLE_DONE:
#
#    COPYREG  $IPRL_VEL_PARAM+4  $IPRL_VEL_SCALE+2	;copy final des
tcblock mbipcmd 0x0091 0x1771   0x0142 0x138D 0x139A 
#    COPYREG  $IPRL_VEL_PARAM+5  $IPRL_VEL_SCALE+3	
tcblock mbipcmd 0x0091 0x1774   0x0142 0x138E 0x139B 
#    SETREGS  $IPRL_VEL_PARAM+4 2 13:0x0726		;force to use page 13
tcblock mbipcmd 0x0091 0x1777   0x01B2 0x138D 0x0002 0x0726 \
                                0x6800 
#
#;-------- Do the velocity instruction
#
#    _VLCTY $IPRL_VEL_PARAM				;make the velocity - source/destina
tcblock mbipcmd 0x0091 0x177C   0x817C 0x1389 
#							;instruction can work directly off the parameters list
#							;because there are no pieces being set elesewhere
#;-------- Scale the resulting velocity
#    COPYRD2D $IPRL_VEL_PARAM+12 $IPRL_VEL_SCALE+6 3	;copy the sca
tcblock mbipcmd 0x0091 0x177E   0x0144 0x1395 0x139E 0x0003 
#    _SCALE   $IPRL_VEL_SCALE
tcblock mbipcmd 0x0091 0x1782   0x81BE 0x1398 
#
#;-------- decode the source and destination page info
#    COPYREG  $IPRL_VEL_PARAM+1 $IPRL_HDECODE_PARAM	;copy the sour
tcblock mbipcmd 0x0091 0x1784   0x0142 0x138A 0x114A 
#    COPYREG  $IPRL_VEL_SCALE+3 $IPRL_HDECODE_PARAM+1	;copy the de
tcblock mbipcmd 0x0091 0x1787   0x0142 0x139B 0x114B 
#    CALLQUE  $QSR_DO_HDECODE				;decode the value - 
tcblock mbipcmd 0x0091 0x178A   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 mbipcmd 0x0091 0x178C   0x01AC 0x1152 0x1155 0x000A 
#    COPYREG  $IPRL_VEL_SCALE+2    $IPRL_HEAD_WORK+6	;copy the fin
tcblock mbipcmd 0x0091 0x1790   0x0142 0x139A 0x115B 
#    COPYREG  $IPRL_VEL_SCALE+3    $IPRL_HEAD_WORK+7	;copy the fin
tcblock mbipcmd 0x0091 0x1793   0x0142 0x139B 0x115C 
#    COPYRD2D $IPRL_VEL_PARAM+9    $IPRL_HEAD_WORK+3 3	;copy n/k, 
tcblock mbipcmd 0x0091 0x1796   0x0144 0x1392 0x1158 0x0003 
#    SETREG                        $IPRL_HEAD_WORK+8 0x0000 	;set 
tcblock mbipcmd 0x0091 0x179A   0x0140 0x115D 0x0000 
#    SETREG                        $IPRL_HEAD_WORK+9 0x10	;set the
tcblock mbipcmd 0x0091 0x179D   0x0140 0x115E 0x0010 
#    COPYRD2I $IPRL_HEAD_WORK      $IPRP_HDECODE_ADDR+1 10	;copy t
tcblock mbipcmd 0x0091 0x17A0   0x01AA 0x1155 0x1152 0x000A 
#
#    CALLQUE  $QSR_DO_HEADER
tcblock mbipcmd 0x0091 0x17A4   0x01F8 0x105F 
#    RTNQUE
tcblock mbipcmd 0x0091 0x17A6   0x01FA 
#=======================================================
#
# ENBQUE                ; Enable Queue
tcblock mbipldin 0x0136
#
#
return
#
#=======================================================
