# File: maghrdl_v01.src
#
program "%Z% MODULE: %M% RELEASE: %R%.%L% CREATED: %G% %U%"
source "maghrdl_v01.ips"
descr "Loads IP queue instructions"
#
# DSBQUE                ; Disable Queue
tcblock mbipldin 0x0154 
#
#=======================================================
#
#
#; Subroutine to downlink stored magnetograms
#;
#; The MAG30 routine sets a register for each page which contains 
#; completed magnetogram. This routine examines each register in t
#; copying upto 2 magnetograms in the downlink pages. 
#;
#;
#QSR_MAG_HRDL::
#    BRANCHNR  0x4000    &MAGHRDL_END                    ; DL chan
tcblock mbipcmd 0x0091 0x0C00   0x01A6 0x4000 0x0C80 
#    BRANCHNR  0x4800    &MAGHRDL_END                    ;        
tcblock mbipcmd 0x0091 0x0C03   0x01A6 0x4800 0x0C80 
#;
#    SETREG    $IPRL_MAG_DL+3    0x4000
tcblock mbipcmd 0x0091 0x0C06   0x0140 0x0595 0x4000 
#    SETREGS   R518    2         0xC0000L
tcblock mbipcmd 0x0091 0x0C09   0x01B2 0x0206 0x0002 0x0000 \
                                0x000C 
#;
#CKMAG:
#    BRANCHIF  $IPRL_MAG_DONE1   &CKMAG2
tcblock mbipcmd 0x0091 0x0C0E   0x015A 0x058C 0x0C20 
#    COPYREG   $IPRL_MAG_DONE1   $IPRL_MAG_DL+1      
tcblock mbipcmd 0x0091 0x0C11   0x0142 0x058C 0x0593 
#    SETREG    $IPRL_MAG_DONE1   0
tcblock mbipcmd 0x0091 0x0C14   0x0140 0x058C 0x0000 
#    _MOVBLKI  $IPRL_MAG_DL   
tcblock mbipcmd 0x0091 0x0C17   0x8166 0x0592 
#    ADDREGD   $IPRL_MAG_DL+3    0x0800
tcblock mbipcmd 0x0091 0x0C19   0x01BC 0x0595 0x0800 
#    BRANCHEQ  $IPRL_MAG_DL+3    0x5000   &STRTDL
tcblock mbipcmd 0x0091 0x0C1C   0x01AE 0x0595 0x5000 0x0C70 
#;
#CKMAG2:    
#    BRANCHIF  $IPRL_MAG_DONE1+1 &CKMAG3
tcblock mbipcmd 0x0091 0x0C20   0x015A 0x058D 0x0C32 
#    COPYREG   $IPRL_MAG_DONE1+1 $IPRL_MAG_DL+1      
tcblock mbipcmd 0x0091 0x0C23   0x0142 0x058D 0x0593 
#    SETREG    $IPRL_MAG_DONE1+1 0
tcblock mbipcmd 0x0091 0x0C26   0x0140 0x058D 0x0000 
#    _MOVBLKI  $IPRL_MAG_DL   
tcblock mbipcmd 0x0091 0x0C29   0x8166 0x0592 
#    ADDREGD   $IPRL_MAG_DL+3    0x0800
tcblock mbipcmd 0x0091 0x0C2B   0x01BC 0x0595 0x0800 
#    BRANCHEQ  $IPRL_MAG_DL+3    0x5000   &STRTDL
tcblock mbipcmd 0x0091 0x0C2E   0x01AE 0x0595 0x5000 0x0C70 
#;
#CKMAG3:    
#    BRANCHIF  $IPRL_MAG_DONE1+2 &CKMAG4
tcblock mbipcmd 0x0091 0x0C32   0x015A 0x058E 0x0C44 
#    COPYREG   $IPRL_MAG_DONE1+2 $IPRL_MAG_DL+1      
tcblock mbipcmd 0x0091 0x0C35   0x0142 0x058E 0x0593 
#    SETREG    $IPRL_MAG_DONE1+2 0
tcblock mbipcmd 0x0091 0x0C38   0x0140 0x058E 0x0000 
#    _MOVBLKI  $IPRL_MAG_DL   
tcblock mbipcmd 0x0091 0x0C3B   0x8166 0x0592 
#    ADDREGD   $IPRL_MAG_DL+3    0x0800
tcblock mbipcmd 0x0091 0x0C3D   0x01BC 0x0595 0x0800 
#    BRANCHEQ  $IPRL_MAG_DL+3    0x5000   &STRTDL
tcblock mbipcmd 0x0091 0x0C40   0x01AE 0x0595 0x5000 0x0C70 
#;
#CKMAG4:    
#    BRANCHIF  $IPRL_MAG_DONE1+3 &CKMAG5
tcblock mbipcmd 0x0091 0x0C44   0x015A 0x058F 0x0C56 
#    COPYREG   $IPRL_MAG_DONE1+3 $IPRL_MAG_DL+1      
tcblock mbipcmd 0x0091 0x0C47   0x0142 0x058F 0x0593 
#    SETREG    $IPRL_MAG_DONE1+3 0
tcblock mbipcmd 0x0091 0x0C4A   0x0140 0x058F 0x0000 
#    _MOVBLKI  $IPRL_MAG_DL   
tcblock mbipcmd 0x0091 0x0C4D   0x8166 0x0592 
#    ADDREGD   $IPRL_MAG_DL+3    0x0800
tcblock mbipcmd 0x0091 0x0C4F   0x01BC 0x0595 0x0800 
#    BRANCHEQ  $IPRL_MAG_DL+3    0x5000   &STRTDL
tcblock mbipcmd 0x0091 0x0C52   0x01AE 0x0595 0x5000 0x0C70 
#;
#CKMAG5:    
#    BRANCHIF  $IPRL_MAG_DONE1+4 &CK_N_DL
tcblock mbipcmd 0x0091 0x0C56   0x015A 0x0590 0x0C68 
#    COPYREG   $IPRL_MAG_DONE1+4 $IPRL_MAG_DL+1      
tcblock mbipcmd 0x0091 0x0C59   0x0142 0x0590 0x0593 
#    SETREG    $IPRL_MAG_DONE1+4 0
tcblock mbipcmd 0x0091 0x0C5C   0x0140 0x0590 0x0000 
#    _MOVBLKI  $IPRL_MAG_DL   
tcblock mbipcmd 0x0091 0x0C5F   0x8166 0x0592 
#    ADDREGD   $IPRL_MAG_DL+3    0x0800
tcblock mbipcmd 0x0091 0x0C61   0x01BC 0x0595 0x0800 
#    BRANCHEQ  $IPRL_MAG_DL+3    0x5000   &STRTDL
tcblock mbipcmd 0x0091 0x0C64   0x01AE 0x0595 0x5000 0x0C70 
#;
#CK_N_DL:
#    BRANCHGT  $IPRL_MAG_DL+3    0x4000   &STRTDL        ; No MAGs
tcblock mbipcmd 0x0091 0x0C68   0x01BA 0x0595 0x4000 0x0C70 
#    SETREG    $IPRF_MAG_HR      0                       ; Disable
tcblock mbipcmd 0x0091 0x0C6C   0x0140 0x05A8 0x0000 
#    RTNQUE
tcblock mbipcmd 0x0091 0x0C6F   0x01FA 
#;
#STRTDL:
#    BRANCHEQ  $IPRL_MAG_DL+3    0x5000   &STRTDL2
tcblock mbipcmd 0x0091 0x0C70   0x01AE 0x0595 0x5000 0x0C7A 
#    START1HR  1                 0x4000   R518
tcblock mbipcmd 0x0091 0x0C74   0x0174 0x0001 0x4000 0x0206 
#    GOTO      &MAGHRDL_END
tcblock mbipcmd 0x0091 0x0C78   0x0156 0x0C80 
#;
#STRTDL2:
#    START2HR  0x49              0x4000   0x4800  R518  R518
tcblock mbipcmd 0x0091 0x0C7A   0x019A 0x0049 0x4000 0x4800 \
                                0x0206 0x0206 
#;
#MAGHRDL_END:
#    RTNQUE
tcblock mbipcmd 0x0091 0x0C80   0x01FA 
#;----------------------------------------------------------------
#;Test Setup
#    SETREGS   $IPRL_MAG_DONE1  6  0x6800  0       0x7800  0      
tcblock mbipcmd 0x0091 0x0C81   0x01B2 0x058C 0x0006 0x6800 \
                                0x0000 0x7800 0x0000 0x0000 \
                                0x0000 
#    SETREGS   $IPRL_MAG_DL     6  0       0x6800  0       0x4000 
tcblock mbipcmd 0x0091 0x0C8A   0x01B2 0x0592 0x0006 0x0000 \
                                0x6800 0x0000 0x4000 0x0000 \
                                0x0010 
#    SETREGS   R512   6  0:0x00001  0x6800  0x00E5  0xFFFF  0xFF80
tcblock mbipcmd 0x0091 0x0C93   0x01B2 0x0200 0x0006 0x0001 \
                                0x0000 0x6800 0x00E5 0xFFFF \
                                0xFF80 
#    HRDINIT   R512
tcblock mbipcmd 0x0091 0x0C9C   0x019C 0x0200 
#    SETREGS   R512   6  0:0x00001  0x7800  0x00E5  0xFFFF  0xFF80
tcblock mbipcmd 0x0091 0x0C9E   0x01B2 0x0200 0x0006 0x0001 \
                                0x0000 0x7800 0x00E5 0xFFFF \
                                0xFF80 
#    HRDINIT   R512
tcblock mbipcmd 0x0091 0x0CA7   0x019C 0x0200 
#    CALLQUE   &QSR_MAG_HRDL
tcblock mbipcmd 0x0091 0x0CA9   0x01F8 0x0C00 
#
#    END
tcblock mbipcmd 0x0091 0x0CAB   0x01FC 
#;================================================================
#=======================================================
#
# ENBQUE                ; Enable Queue
tcblock mbipldin 0x0136
#
#
return
#
#=======================================================
