program "%Z% MODULE: dfp100a_11.src RELEASE: %R%.%L% CREATED: %G% %U%"
source  "/mdisw/cfl/flight/src/dfp100a_11_v01.src"
descr   "dfp100a_11 - Patch to Open ISS loop in CAL mode "

#  ISS Loop Control for Cal Mode		       96.02.05rar
#						 rev 1 96.02.15
# This is code to patch the ISS Loop Restore code to keep the loop open while 
# in calibration mode.  This code checks cal1 for the lens position (18, 19) 
# and then cal2 for the lens position (126, 127).  Actual thresholds are < 30 
# for cal 1 and > 105 for cal 2.
# The following was saved to disk from DEBUG using prn2file

# 1924:9076 803E68461E    CMP     BYTE PTR [4668],1E
# 1924:907B 7C0A          JL      9087
# 1924:907D 803E694669    CMP     BYTE PTR [4669],69
# 1924:9082 7F03          JG      9087
# 1924:9084 E9E3F8        JMP     896A
# 1924:9087 C3            RET


# The following is a conversion to egse telecommands for use as a DEP patch.

tcb mbdpmd 0 0x9070 30            ## Pre Patch dump
wait time 5

tcb mbdpml 0 0x9076 0x3E80 0x4668 0x7C1E 0x800A 0x693E 
tcb mbdpml 0 0x9080 0x6946 0x037F 0xE3E9 0xC3F8

tcb mbdpmd 0 0x9070 30            ## Post Patch dump
wait time 5

# Now change a call instruction in dfc100a_c to run the patch above...
tcb mbdpmd 0 0x9820 10            ## Pre Patch Dump
wait time 5
tcb mbdpml 0 0x9824 0x4fe8 0xc3f8
tcb mbdpmd 0 0x9820 10            ## Post Patch Dump
wait time 5

# Just for completeness, a restore patch to the call in previous line...
# tcb mbdpml 0 0x9824 0x43e8 0xc3f1

# Change version to 11
tcb mbdpml 0 0x64a 0x118c
tcb mbdpml 0x1000 0x8C96 0x1110

return
