##########################                                            ##-#
#                                                                     ##-#
# Assembled by checkpoint, v.1.6 (14-Dec-95).                         ##-#
# (EDIT THE ORIGINAL SOURCE, NOT THIS FILE!)                          ##-#
# Date-assembled: Mon Dec 18 23:02:06 EST 1995                        ##-#
# Orig-source: /mdisw/cfl/flight/src/runcomm_v01.src                  ##-#
#                                                                     ##-#
##########################                                            ##-#
# File: runcomm.src
# HISTORY:
#	Written Dec-95 by M.Morrison
#	13-Dec-95 (MDM) - Modified to ask for the campaign address to be run
#			- did a 160k file open call ('open d')
#
#
program "%Z% MODULE: %M% RELEASE: %R%.%L% CREATED: %G% %U%"
source "/mdisw/cfl/flight/src/nq_runcomm_v01.src"
descr "nq_RUNCOMM - setup to run commision campaign with PRIME00"
                                                                      ##-#
#=#=#=#=#=#=#=#=#=#=# src ln 12.  (Open Log file)                     ##-#
if !GS9 = "" then                                                     ##-#
  display "Opening logfile from nq_runcomm_v01"                       ##-#
  perf openlog                                                        ##-#
end if                                                                ##-#
write !GS9 "%s nq_runcomm_v01:" !TIME                                 ##-#
writen !GS9 "Starting..."                                             ##-#
#=#=#=#=#=#=#=#=#=#=#+ src ln 14.  Block 0  Next line is #28          ##-#
 display "Running block 0 of nq_runcomm_v01."                         ##-#
set !LI1 = getint(mktccnt)                                            ##-#
display "Executing procedure  runcomm."

tcblock mbdpmod 1                 ## Set 5k mode

# Set IP vectors 
tcblock  mbipldin 0x154           ## Disable Queue

tcblock mbipcmd 0x91 0 0x1F00     ## Heritage Load Replacement Programs
tcblock mbipcmd 0x91 1 0x0100     ## Prime60
tcblock mbipcmd 0x91 4 0x0132     ## Prime 30
tcblock mbipcmd 0x91 5 0x0900     ## ALT30
tcblock mbipcmd 0x91 6 0x0E83
tcblock mbipcmd 0x91 7 0x0B00     ## HDR
tcblock mbipcmd 0x91 8 0x0B07     ## TAIL

tcblock mbipldin 0x136            ## Enable Queue
tcblock mbdpmod 3                 ## Set 5k mode
tcblock mbipldin 0x134            ## Enable interrupts
wait time 3

tcblock mbipldin 0x11C              ## Initialize subroutine stack

tcblock mbsqreg  3     1            ## Set VC Flag
tcblock mbsqreg 65     0            ## Disable ALT 
tcblock mbsqreg 66     1            ## Enable Campaign Flag
tcblock mbsqreg 68     0            ## Disable New List Flag
tcblock mbsqreg 70     0            ## Disable II Flag
tcblock mbsqreg 72     0            ## Disable Chain List Flag

wait time 3

tcblock mbdpflgs 16 0xffff 0        ## Clear IP Error count

# Run DEP sequence 
tcblock mbsqreg 247 0x7FFF          ## Use Frame List Que pointer only
ask !LI0 "Enter the campaign address to run"
tcblock mbsqstr 0
open d

tcblock mbsqreg 67 !LI0	             ## set campaign address
#tcblock mbsqreg 67 264              ## Set Campaign address 

display "Finished procedure runcomm"
#=#=#=#=#=#=#=#=#=#=#- src ln 55.  Block 0   Cmds:23   Total:23       ##-#
wait time 8 ## Wait for hk packet                                     ##-#
set !LI3 = !LI1 + 23                                                  ##-#
if !LI3 > 255 then                                                    ##-#
 set !LI2 = !LI3 - 256                                                ##-#
else                                                                  ##-#
 set !LI2 = !LI3                                                      ##-#
end if                                                                ##-#
set !LI3 = getint(mktccnt)                                            ##-#
if !LI2 <> !LI3 then                                                  ##-#
 write !GS9 "%s nq_runcomm_v01:" !TIME                                ##-#
 writen !GS9  "CMD CT ERR in block 0. cmd ctr: %d" !LI3               ##-#
 writen !GS9  "      (Sent 23 cmds; expected cmd ctr: %d)" !LI2       ##-#
 writen !GS9  "      Halted.  (restart at line 28)"                   ##-#
 display "ERR: nq_runcomm_v01 blk 0: cmd ct <> %d. (CONT 28)" !LI3    ##-#
 halt                                                                 ##-#
 write !GS9 "%s nq_runcomm_v01:" !TIME                                ##-#
 writen !GS9  "Override.  Continuing past block 0..."                 ##-#
else                                                                  ##-#
 write !GS9 "%s nq_runcomm_v01:" !TIME                                ##-#
 writen !GS9  "Block 0 completed OK."                                 ##-#
display "Completed block 0 of nq_runcomm_v01."                        ##-#
end if                                                                ##-#
#################### END of BLOCK 0 ####################              ##-#
write !GS9 "%s nq_runcomm_v01:" !TIME                                 ##-#
writen !GS9 "Falling off the bottom."                                 ##-#
