# File: images_v03.src
#
program "%Z% MODULE: %M% RELEASE: %R%.%L% CREATED: %G% %U%"
source "/mdisw/cfl/flight/src/images_v03_1.src"
descr "Loads IP queue instructions"
#
# DSBQUE                ; Disable Queue
tcblock mbipldin 0x0154 
#
#=======================================================
#
#
#; Call an IP program to downlink 1 image
#;
#    BRANCHEQ  R0032  3  &LBIC3
tcblock mbipcmd 0x0091 0x1F00   0x01AE 0x0020 0x0003 0x1F0D 
#    BRANCHEQ  R0032  4  &LBIC4
tcblock mbipcmd 0x0091 0x1F04   0x01AE 0x0020 0x0004 0x1F2C 
#    BRANCHEQ  R0032  5  &LBIC5
tcblock mbipcmd 0x0091 0x1F08   0x01AE 0x0020 0x0005 0x1F4B 
#    END
tcblock mbipcmd 0x0091 0x1F0C   0x01FC 
#;
#;=================================================
#;  lbic 3  (extract standard 1024x1024 filtergram
#;           from memory 0)
#;=================================================
#; Address of 1st pixel to be extracted = 252 + 1040 + 8 = 1300
#;                       
#LBIC3:
#    SETREGS  R3500  2  0  0
tcblock mbipcmd 0x0091 0x1F0D   0x01B2 0x0DAC 0x0002 0x0000 \
                                0x0000 
#    SETREGS  R3508  8 0:0x00514 7:0x00000 1024 1024 1040 R3500
tcblock mbipcmd 0x0091 0x1F12   0x01B2 0x0DB4 0x0008 0x0514 \
                                0x0000 0x0000 0x3800 0x0400 \
                                0x0400 0x0410 0x0DAC 
#;
#    SETREGS   R3576  2  0xFFFF  0xFF14
tcblock mbipcmd 0x0091 0x1F1D   0x01B2 0x0DF8 0x0002 0xFFFF \
                                0xFF14 
#    EXTRACT   R3508
tcblock mbipcmd 0x0091 0x1F22   0x017A 0x0DB4 
#    SETREGS   R3570  2  0x100000L
tcblock mbipcmd 0x0091 0x1F24   0x01B2 0x0DF2 0x0002 0x0000 \
                                0x0010 
#    GOTO      &DOHR
tcblock mbipcmd 0x0091 0x1F29   0x0156 0x1FA1 
#    END
tcblock mbipcmd 0x0091 0x1F2B   0x01FC 
#;
#;=================================================
#;  lbic 4  (extract central 256x256 area from 
#;           memory 0)
#;=================================================
#; Address of 1st pixel to be extracted 
#;        = Header(252) + Eng_line(1040) + 
#;          skip 384 rows (384 X 1040)   +
#;          BLS(8) + skip 384 columns (384)
#;        = 401044  (0x61E94)
#;
#LBIC4:
#    SETREGS  R3500  2  0  0
tcblock mbipcmd 0x0091 0x1F2C   0x01B2 0x0DAC 0x0002 0x0000 \
                                0x0000 
#    SETREGS  R3508  8 0:0x61E94 7:0x00000 256 256 1040 R3500
tcblock mbipcmd 0x0091 0x1F31   0x01B2 0x0DB4 0x0008 0x1E94 \
                                0x0006 0x0000 0x3800 0x0100 \
                                0x0100 0x0410 0x0DAC 
#;
#    SETREGS   R3576  2  0xFFFF  0xFF13
tcblock mbipcmd 0x0091 0x1F3C   0x01B2 0x0DF8 0x0002 0xFFFF \
                                0xFF13 
#    EXTRACT   R3508
tcblock mbipcmd 0x0091 0x1F41   0x017A 0x0DB4 
#    SETREGS   R3570  2  0x10000L
tcblock mbipcmd 0x0091 0x1F43   0x01B2 0x0DF2 0x0002 0x0000 \
                                0x0001 
#    GOTO      &DOHR
tcblock mbipcmd 0x0091 0x1F48   0x0156 0x1FA1 
#    END
tcblock mbipcmd 0x0091 0x1F4A   0x01FC 
#;
#;
#;=================================================
#;  lbic 5  (4x4 Sum of a single image in memory 0
#;=================================================
#; IP Program to perform 4x4 summing
#; Memory Page Usage:
#;    0  -  Raw Camera Image
#;    4  -  Extracted 1024x1024 image
#;    5  -  1024x256 rowbinned image
#;    6  -  256 x 256 lrbinned image
#;    8  -  Downlink page
#;
#;
#LBIC5:
#     SETREGS   R3500   2   0   0
tcblock mbipcmd 0x0091 0x1F4B   0x01B2 0x0DAC 0x0002 0x0000 \
                                0x0000 
#;
#;    EXTRACT R3516
#;       Source Address         0:0x00514
#;       Destination Address    4:0x00000
#;       X-Length                    1024
#;       Y-Length                    1024
#;       Row Length                  1040
#;       Global Offset Register      R3500
#;
#     SETREGS  R3516  8  0:0x00514 4:0x00000 1024 1024 1040 R3500
tcblock mbipcmd 0x0091 0x1F50   0x01B2 0x0DBC 0x0008 0x0514 \
                                0x0000 0x0000 0x2000 0x0400 \
                                0x0400 0x0410 0x0DAC 
#     EXTRACT  R3516
tcblock mbipcmd 0x0091 0x1F5B   0x017A 0x0DBC 
#;
#;
#;    ROWBIN  R3524
#;       Source Address         4:0x00000
#;       Destination Address    5:0x00000
#;       X-Length                    1024
#;       Y-Length                       4
#;       Row Length                  1024
#;       Repeat Count                 256
#;       Shift Factor                  16
#;       Scale Factor                   1
#;       Global Offset Register      R3500
#;
#     SETREGS  R3524  11  4:0x00000 5:0x00000 1024 4 1024 256 16 1
tcblock mbipcmd 0x0091 0x1F5D   0x01B2 0x0DC4 0x000B 0x0000 \
                                0x2000 0x0000 0x2800 0x0400 \
                                0x0004 0x0400 0x0100 0x0010 \
                                0x0001 0x0DAC 
#     ROWBIN   R3524
tcblock mbipcmd 0x0091 0x1F6B   0x01D4 0x0DC4 
#;
#;....................................................
#; LRBIN LIST
#;      Start Address Low        0
#;      Start Address High       0
#;      X Length                 4
#;      Repeat Count          2048
#;      Shift Count             14
#;      Scale Factor             1
#;
#;      Start Address Low     8192 
#;      Start Address High       0
#;      X Length                 4
#;      Repeat Count          2048
#;      Shift Count             14
#;      Scale Factor             1
#;
#;      Start Address Low    16384
#;      Start Address High       0
#;      X Length                 4
#;      Repeat Count          2048
#;      Shift Count             14
#;      Scale Factor             1
#;
#;      Start Address Low    24576
#;      Start Address High       0
#;      X Length                 4
#;      Repeat Count          2048
#;      Shift Count             14
#;      Scale Factor             1
#;....................................................
#;
#; Linear Rebin
#;
#;    LRBIN  R3508
#;       Source Page           5
#;       Destination Address   6:0x00000
#;       List Pointer          0
#;       List Count            4
#;       List Address         14:0x00000
#;       Global Offset Register       R2560
#;
#;     SETREGS   R3500   2   0  0
#     SETREGS   R3502   2   0x8000   0
tcblock mbipcmd 0x0091 0x1F6D   0x01B2 0x0DAE 0x0002 0x8000 \
                                0x0000 
#     SETREGS   R3508   3   0x2800   6:0x00000  
tcblock mbipcmd 0x0091 0x1F72   0x01B2 0x0DB4 0x0003 0x2800 \
                                0x0000 0x3000 
#;
#RPT:
#     SETREGS   R3511   5   0   4  14:0xFFE00  R3500
tcblock mbipcmd 0x0091 0x1F78   0x01B2 0x0DB7 0x0005 0x0000 \
                                0x0004 0xFE00 0x700F 0x0DAC 
#     LRBIN     R3508
tcblock mbipcmd 0x0091 0x1F80   0x01D0 0x0DB4 
#     ADDADR    R3500  R3502  R3504            ; New Offset
tcblock mbipcmd 0x0091 0x1F82   0x0148 0x0DAC 0x0DAE 0x0DB0 
#     COPYREG   R3504  R3500
tcblock mbipcmd 0x0091 0x1F86   0x0142 0x0DB0 0x0DAC 
#     COPYREG   R3505  R3501
tcblock mbipcmd 0x0091 0x1F89   0x0142 0x0DB1 0x0DAD 
#     BRANCHNE  R3510  0x3001   &RPT
tcblock mbipcmd 0x0091 0x1F8C   0x01B0 0x0DB6 0x3001 0x1F78 
#;
#     SETREGS   R3576  2  0xFFFF  0xFF12
tcblock mbipcmd 0x0091 0x1F90   0x01B2 0x0DF8 0x0002 0xFFFF \
                                0xFF12 
#     MOVBLK    6:0x00000  7:0x00000  0x10000L
tcblock mbipcmd 0x0091 0x1F95   0x0164 0x0000 0x3000 0x0000 \
                                0x3800 0x0000 0x0001 
#     SETREGS   R3570  2  0x10000L
tcblock mbipcmd 0x0091 0x1F9C   0x01B2 0x0DF2 0x0002 0x0000 \
                                0x0001 
#;
#;....................................................
#;
#DOHR:
#;
#    BRANCHIF  R3075  &DONE
tcblock mbipcmd 0x0091 0x1FA1   0x015A 0x0C03 0x1FF5 
#;
#    AVGTEMPS  0:0x00134 12
tcblock mbipcmd 0x0091 0x1FA4   0x0186 0x0134 0x0000 0x000C 
#    SETREGS   R3566  2  7:0x00000  
tcblock mbipcmd 0x0091 0x1FA8   0x01B2 0x0DEE 0x0002 0x0000 \
                                0x3800 
#;
#    BRANCHEQ  R33    0   &TLM0
tcblock mbipcmd 0x0091 0x1FAD   0x01AE 0x0021 0x0000 0x1FD4 
#;
#TLM1:
#    SETREGS   R3568  2  12:0x00226
tcblock mbipcmd 0x0091 0x1FB1   0x01B2 0x0DF0 0x0002 0x0226 \
                                0x6000 
#    _MOVBLKI  R3566
tcblock mbipcmd 0x0091 0x1FB6   0x8166 0x0DEE 
#;
#    SETREGS   R3572  3  0:0x00001  0x6000
tcblock mbipcmd 0x0091 0x1FB8   0x01B2 0x0DF4 0x0003 0x0001 \
                                0x0000 0x6000 
#    COPYREG   R61    R3575
tcblock mbipcmd 0x0091 0x1FBE   0x0142 0x003D 0x0DF7 
#    BRANCHIF  R61    &DLRAW1
tcblock mbipcmd 0x0091 0x1FC1   0x015A 0x003D 0x1FCC 
#    HRDINIT   R3572
tcblock mbipcmd 0x0091 0x1FC4   0x019C 0x0DF4 
#    START1HR  1    0x6000 R3570
tcblock mbipcmd 0x0091 0x1FC6   0x0174 0x0001 0x6000 0x0DF2 
#    GOTO      &DONE
tcblock mbipcmd 0x0091 0x1FCA   0x0156 0x1FF5 
#DLRAW1:
#    HRDINIT   R3572
tcblock mbipcmd 0x0091 0x1FCC   0x019C 0x0DF4 
#    START1HR   3   0x6000 R3570
tcblock mbipcmd 0x0091 0x1FCE   0x0174 0x0003 0x6000 0x0DF2 
#    GOTO      &DONE
tcblock mbipcmd 0x0091 0x1FD2   0x0156 0x1FF5 
#;
#TLM0:
#    SETREGS   R3568  2  8:0x00226
tcblock mbipcmd 0x0091 0x1FD4   0x01B2 0x0DF0 0x0002 0x0226 \
                                0x4000 
#    _MOVBLKI  R3566
tcblock mbipcmd 0x0091 0x1FD9   0x8166 0x0DEE 
#;
#    SETREGS   R3572  3  0:0x00001  0x4000
tcblock mbipcmd 0x0091 0x1FDB   0x01B2 0x0DF4 0x0003 0x0001 \
                                0x0000 0x4000 
#    COPYREG   R61    R3575
tcblock mbipcmd 0x0091 0x1FE1   0x0142 0x003D 0x0DF7 
#    BRANCHIF  R61    &DLRAW0
tcblock mbipcmd 0x0091 0x1FE4   0x015A 0x003D 0x1FEF 
#    HRDINIT   R3572
tcblock mbipcmd 0x0091 0x1FE7   0x019C 0x0DF4 
#    START1HR  1    0x4000 R3570
tcblock mbipcmd 0x0091 0x1FE9   0x0174 0x0001 0x4000 0x0DF2 
#    GOTO      &DONE
tcblock mbipcmd 0x0091 0x1FED   0x0156 0x1FF5 
#DLRAW0:
#    HRDINIT   R3572
tcblock mbipcmd 0x0091 0x1FEF   0x019C 0x0DF4 
#    START1HR   3   0x4000 R3570
tcblock mbipcmd 0x0091 0x1FF1   0x0174 0x0003 0x4000 0x0DF2 
#;
#DONE:
#    END
tcblock mbipcmd 0x0091 0x1FF5   0x01FC 
#
#;=============================================================
#=======================================================
#
# ENBQUE                ; Enable Queue
tcblock mbipldin 0x0136
#
#
return
#
#=======================================================
