# File: p30vc_fd_vc_v01.src
#
program "%Z% MODULE: %M% RELEASE: %R%.%L% CREATED: %G% %U%"
source "/mdisw/cfl/flight/src/p30vc_fd_vc_v01.src"
descr "Loads IP queue instructions"
#=======================================================
#
#
#; FILE:    p30vc_fd_vc.ips
#; PURPOSE: Grab the prime30 velocity and prime30 continuum.  Make
#;	   second 30 second continuum and velocity.  Downlink P30C,
#;	   and FD continuum and velocity as 2x2 binned and then cropped
#;	   
#; HISTORY: 
#;       Written 27-Oct-97 by M.Morrison
#;	29-Oct-97 (MDM) - More initial work
#;	 3-Nov-97 (MDM) - Final tuneup before flight
#;			- Changed to _MOVSBLKI for P30C header save
#;			- Used page 19 for P30C
#;			- Use callback for all downlinks (because P30 stuff is 70% of
#;
#; NOTES:
#;	---- This program
#;	      Downlink from
#;		p30 velocity	page 15
#;		p30 continuum	page 19
#;		c30 velocity	page 13
#;		c30 continuum	page 5
#;	
#;		formatting in page 17
#;	---- From mk_vlc30.ips (work done at frame 5,8 and 9
#;       raw images page 0-3
#;               sa (F1-F3)      page 0
#;               sc (F2-F4)      page 1
#;               sd (F1,2,3,4)   page 2
#;               si (FC)         page 3
#;                                       continuum filtergram 1024
#;                                       velocity unscaled (1 m/se
#;                                       velocity scaled (8 m/sec)
#;               si extracted    page 17
#;               sd extracted    page 18
#;                                       linedepth                
#;                                       continuum observable     
#;               Available pages: 4, 10(half), 11, 15,   (17,18 us
#;	---- From do_std_fmt.ips
#;                                               INPUT           O
#;               velocity scaled (8 m/sec)       page 7          p
#;               linedepth                       page 6          p
#;               continuum observable            page 5          p
#;               continuum filtergram            page 19         p
#;               magnetogram                     page 17         p
#;               prime30 velocity                page 11         p
#;               prime30 continuum observable    page 11         p
#
#
#
#QPROG_P30VC_FD_VC::
#    SETREG $IPRL_CB_ADDR &QCB_REENTRY
tcblock mbipmacl 0x1F00    0x0140 0x0C20 0x1F2C 
#
#    CALLQUE  $QSR_STORE_P30V					;store/move the prime30 velocity
tcblock mbipmacl 0x1F03    0x01F8 0x1898 
#    CALLQUE  $QSR_STORE_P30C2					;store/move the prime30 continu
tcblock mbipmacl 0x1F05    0x01F8 0x1F4B 
#
#    CALLQUE  $QSR_FD_VLC30                                      ;
tcblock mbipmacl 0x1F07    0x01F8 0x1761 
#
#    BRANCHEQ R3072   6 &FRM6
tcblock mbipmacl 0x1F09    0x01AE 0x0C00 0x0006 0x1F12 
#    BRANCHEQ R3072  10 &FRM10
tcblock mbipmacl 0x1F0D    0x01AE 0x0C00 0x000A 0x1F1F 
#    END
tcblock mbipmacl 0x1F11    0x01FC 
#
#FRM6:
#    ;---- P30 Formatting and storing
#    COPYRD2D $IPRL_CROP_RAD504 $IPRL_CROP_PARAM+4 5
tcblock mbipmacl 0x1F12    0x0144 0x147D 0x146E 0x0005 
#    CALLQUE  $QSR_STD_CFMT_PVEL                                 ;
tcblock mbipmacl 0x1F16    0x01F8 0x183C 
#
#    COPYRD2D $IPRL_VVCC_P30C  $IPRL_BIN_FMT_CROP 8		;P30C format
tcblock mbipmacl 0x1F18    0x0144 0x15D1 0x15C9 0x0008 
#    CALLQUE  $QSR_BIN_CROP_COMP
tcblock mbipmacl 0x1F1C    0x01F8 0x1F72 
#    END
tcblock mbipmacl 0x1F1E    0x01FC 
#
#FRM10:
#    ;---- CAM30 Formatting and storing
#
#    COPYRD2D $IPRL_VVCC_C30C  $IPRL_BIN_FMT_CROP 8		;Cam30C forma
tcblock mbipmacl 0x1F1F    0x0144 0x15D9 0x15C9 0x0008 
#    CALLQUE  $QSR_BIN_CROP_COMP
tcblock mbipmacl 0x1F23    0x01F8 0x1F72 
#
#    COPYRD2D $IPRL_VVCC_C30V  $IPRL_BIN_FMT_CROP 6		;Cam30V forma
tcblock mbipmacl 0x1F25    0x0144 0x15E1 0x15C9 0x0006 
#    CALLQUE  $QSR_BIN_CROP
tcblock mbipmacl 0x1F29    0x01F8 0x1F61 
#
#DONE:
#    END
tcblock mbipmacl 0x1F2B    0x01FC 
#
#;----------------------- Start of callback code
#QCB_REENTRY:
#    BRANCHEQ R3072  2  &CB_DO_DL1
tcblock mbipmacl 0x1F2C    0x01AE 0x0C00 0x0002 0x1F36 
#    BRANCHEQ R3072  7  &CB_DO_DL2
tcblock mbipmacl 0x1F30    0x01AE 0x0C00 0x0007 0x1F3F 
#    GOTO &QSR_CB_DONE_ADDR
tcblock mbipmacl 0x1F34    0x0156 0x0FFF 
#
#CB_DO_DL1:
#    SETREGS  $IPRL_DL_PARAM 2 0x2800 0x6800                     ;
tcblock mbipmacl 0x1F36    0x01B2 0x11D0 0x0002 0x2800 \
                                0x6800 
#    CALLQUE  $QSR_DL_2PAGE                                      ;
tcblock mbipmacl 0x1F3B    0x01F8 0x0DA5 
#    GOTO &QSR_CB_DONE_ADDR
tcblock mbipmacl 0x1F3D    0x0156 0x0FFF 
#
#CB_DO_DL2:
#    ;---- Downlink the two observables
#    SETREGS  $IPRL_DL_PARAM 2 0x7800 0x9800                     ;
tcblock mbipmacl 0x1F3F    0x01B2 0x11D0 0x0002 0x7800 \
                                0x9800 
#    CALLQUE  $QSR_DL_2PAGE                                      ;
tcblock mbipmacl 0x1F44    0x01F8 0x0DA5 
#
#    SETREG $IPRL_CB_ADDR 0                                      ;
tcblock mbipmacl 0x1F46    0x0140 0x0C20 0x0000 
#    GOTO &QSR_CB_DONE_ADDR
tcblock mbipmacl 0x1F49    0x0156 0x0FFF 
#
#
#;===========================================================
#QSR_STORE_P30C2:	;partial copy of store_p30.ips
#
#
#    BRANCHEQ R3072  2 &FRM2 
tcblock mbipmacl 0x1F4B    0x01AE 0x0C00 0x0002 0x1F50 
#    RTNQUE
tcblock mbipmacl 0x1F4F    0x01FA 
#
#FRM2:
#    _SCALE    $IPRL_STOREC2_SCALE          ;copy from page 7 to 1
tcblock mbipmacl 0x1F50    0x81BE 0x15BB 
#    _MOVSBLKI $IPRL_STOREC2_HEADER         ;copy the header over
tcblock mbipmacl 0x1F52    0x81C8 0x15C3 
#
#    SETREG   $IPRP_HDECODE_PAGE19+5 0x2000                      ;
tcblock mbipmacl 0x1F54    0x0140 0x1113 0x2000 
#    SETREGS  $IPRP_HDECODE_PAGE19+8 2 0x100000L                 ;
tcblock mbipmacl 0x1F57    0x01B2 0x1116 0x0002 0x0000 \
                                0x0010 
#    COPYRD2D $IPRL_STR_IC30HDR+3 $IPRP_HDECODE_PAGE19+3 3       ;
tcblock mbipmacl 0x1F5C    0x0144 0x0603 0x1111 0x0003 
#
#    RTNQUE
tcblock mbipmacl 0x1F60    0x01FA 
#;===========================================================
#QSR_BIN_CROP:
#;
#;INPUT REGISTER LISTS:
#;	$IPRL_BIN_FMT_CROP - source, dest, dest#2 (sqrt comp)
#;
#    ;---- Bin the data into page 15
#    COPYRD2D $IPRL_BIN_FMT_CROP   $IPRL_BIN_PARAM 4
tcblock mbipmacl 0x1F61    0x0144 0x15C9 0x11E9 0x0004 
#    CALLQUE  $QSR_FMT_2X2BIN            
tcblock mbipmacl 0x1F65    0x01F8 0x1132 
#
#    ;---- Crop to the output page
#    COPYRD2D $IPRL_CROP_RAD504B $IPRL_CROP_PARAM+4 5		;setup 2x2 
tcblock mbipmacl 0x1F67    0x0144 0x15B6 0x146E 0x0005 
#
#    COPYRD2D $IPRL_BIN_FMT_CROP+2 $IPRL_CROP_PARAM 4
tcblock mbipmacl 0x1F6B    0x0144 0x15CB 0x146A 0x0004 
#    CALLQUE  $QSR_FMT_CROP
tcblock mbipmacl 0x1F6F    0x01F8 0x17DC 
#    RTNQUE
tcblock mbipmacl 0x1F71    0x01FA 
#
#QSR_BIN_CROP_COMP:
#    CALLQUE  $QSR_BIN_CROP
tcblock mbipmacl 0x1F72    0x01F8 0x1F61 
#
#    COPYRD2D $IPRL_BIN_FMT_CROP+4 $IPRL_SQRT_PARAM 4
tcblock mbipmacl 0x1F74    0x0144 0x15CD 0x13B5 0x0004 
#    CALLQUE  $QSR_SQRT_COMP			;NOTE - wrong DPC encoding stuff...
tcblock mbipmacl 0x1F78    0x01F8 0x12C2 
#
#    RTNQUE
tcblock mbipmacl 0x1F7A    0x01FA 
#=======================================================
#
return
#
#=======================================================
