# File: ipfp1901.src
#
# This procedure patches the IP writeable control store code
# by loading the patch into DEP RAM and then writing it to the IP
#
# Patch 1	95.08.24	SDW
# Corrects error handling code in awbin to correctly call the
# error handler routine.  Generated by Russ Lindgren
#
# Assumptions:
#	IP Flight Code version 1.9.00 or higher has been loaded

program "@(#) MODULE: ipfp1901.src RELEASE: %R%.%L% CREATED: %G% %U%"
source "/mdisw/cfl/eof/src/ipfp1901.src"
descr "ipfp1901 - patches IP flight WCS code"

display "Executing procedure ipfp1901."

display "to view DEP memory dumps in winterm type: mdisci_dump ROM"
halt

# Dump unmodified sequence from memory
tcblock mbdpmd 0x2000 0x0000 0x0044

# Store current command count
wait time 10
set !LI0 = getint(mktccnt)

tcblock mbdpml 0x2000 0x0000 0x0000 0xe820 0x4200 0x0d3c 0x0000 0x2000 \
               0x00e8 0x3c42 0x000d 0xc000
tcblock mbdpml 0x2000 0x0014 0x9200 0xe820 0x8100 0x3c41 0x000d 0xe800 \
               0xc0fd 0x4862 0xcd01 0x1cc1
tcblock mbdpml 0x2000 0x0028 0x650d 0x00c0 0x10e8 0x622a 0x2a42 0x2a7f \
               0x0d1c 0x2a01
tcblock mbdpml 0x2000 0x0038 0xe800 0x3fe4 0x1c62 0xe404 0x1cff 0xe40d \
               0xe019
set !LI1 = getint(mktccnt) - !LI0
display "command count (should be 4): %d" !LI1

#tcblock mbdpml 0x2000 0x0 \
#0x0000 0xe820 0x4200 0x0d3c 0x0000 0x2000 0x00e8 0x3c42 0x000d 0xc000 \
#0x9200 0xe820 0x8100 0x3c41 0x000d 0xe800 0xc0fd 0x4862 0xcd01 0x1cc1 \
#0x650d 0x00c0 0x10e8 0x622a 0x2a42 0x2a7f 0x0d1c 0x2a01 
#tcblock mbdpml 0x2000 0x38 \
#0xe800 0x3fe4 0x1c62 0xe404 0x1cff 0xe40d 0xe019 

# Dump modified sequence from memory
tcblock mbdpmd 0x2000 0x0000 0x0044
wait time 10

# Load patch 1 to IP WCS
tcblock mbiplwcs 0x0006 0x2000 0x0000 0x0001 0x0007 0x0001 0x0007 \
                 0x0002 0x0008 0x0000 0x000D 0x0000 0x000D 0x0000 0x000D
wait time 10

set !LI0 = getint(mkipfwvr)
wait until !LI0 = 0x19

set !LI0 = getint(mkipfwpn)
wait until !LI0 = 0x01

#tcblock mbiplwcs 6 0x2000 0 1 7 1 7 2 8 0 13 0 13 0 13

display "Finished procedure ipfp1901."

return 
