# File: nrt1p6.src
#
# Executes procedures to prepare MDI for the 1.6 hour pass.  Configure
# to run the prime sequence with the ipcntrl (babystep) IP macro.
# 
program "%Z% MODULE: %M% RELEASE: %R%.%L% CREATED: %G% %U%"
source "/mdisw/cfl/eof/src/nrt1p6.src"
descr " nrt1p6q - prepare for 1.6 hour pass"

display "Executing procedure  nrt1p6."

tcblock mbdpmod 1              	## Set 5k to engineering mode

queue on
perform mag30obs		## load mag30 obs table
queue off

# Set up Flat Field in page 10. 
# Flat field must in in LIST (8-Byte EDAC) memory. It is loaded at 0x20000
# to allow for intermediate headers to be saved at 0x00000.
tcblock mbipldin 0x118 0x5000 144                           ## Purge Page 10
#tcblock mbipldin 0x16c 0x0000 0x5002 0x0000 0x0010 0x0001  ##Pseudo Flat Field 
wait time 5
tcblock mbipldin 0x16c 0x0000 0x5800 0x0000 0x0010 0x0020   ##LF #1
wait time 5
tcblock mbipldin 0x16c 0x0000 0x6000 0x0000 0x0010 0x0050   ##MP #1
wait time 5
tcblock mbipldin 0x16c 0x0000 0x6800 0x0000 0x0010 0x0068   ##MP #2
wait time 5
tcblock mbipldin 0x16c 0x0000 0x7000 0x0000 0x0010 0x0070   ##FB #1
wait time 5
tcblock mbipldin 0x16c 0x0000 0x7800 0x0000 0x0010 0x0088   ##FB #2
wait time 5

tcblock mbipldin 0x1b2 69  2 0 0
tcblock mbipldin 0x1b2 560 2 0 0  ## R550-R551 set DPC len = 1
wait time 5

tcblock mbipldin 0x11C            ## Initialize subroutine stack

tcblock  mbipldin 0x154		  ## disable macro queue

# load ip macros macro

queue on
perform ipcntrl
perform hdr

# Set IP vectors 

tcblock mbipcmd 0x91 0 0x1F00     ## Heritage Load Replacement Programs
tcblock mbipcmd 0x91 1 0x1C00     ## IPCNTRL (Babystep)
tcblock mbipcmd 0x91 4 0x1C00
tcblock mbipcmd 0x91 5 0x1C00     ## IPCNTRL (Babystep)
tcblock mbipcmd 0x91 6 0x0E83
tcblock mbipcmd 0x91 7 0x0B00     ## HDR
tcblock mbipcmd 0x91 8 0x0B04     ## TAIL

# DEP Sequence Buffer Patches

tcblock mbdpml  0x1000 0x3EF2 0x0101   ## Patch STR60 IP Q Ptr
tcblock mbdpml  0x1000 0x3D2A 0x0404   ## Patch STR30 IP Q Ptr
tcblock mbdpml  0x1000 0x3CA6 0x0505   ## Patch ALT30 IP Q Ptr
tcblock mbdpml  0x1000 0x3C5E 0x0707   ## Patch HDR15 IP Q Ptr
tcblock mbdpml  0x1000 0x3C54 0x0005   ## Patch HDR15 IP Q Ptr
queue off
tcblock mbdpml  0x1000 0x3CB0 0x4343 0x4343

wait time 3

tcblock mbipldin 0x136			## enable macro queue

tcblock mbdpmod 3               	## Set 5k to science mode
wait time 3

tcblock mbipldin 0x134         		## Enable interrupts
wait time 3

# Run DEP sequence 
tcblock mbsqreg 247 0x7FFF          	## Use Frame List Que pointer only

display "Finished procedure nrt1p6"
return
