begin:
cls
if TRAP == 1
echo You need power off on the box
goto continue
endif
/////////////////////////////////////////////
//    DCT 2500 Script
/////////////////////////////////////////////
echo 1. Backup flash and nvram
echo 2. Restore flash and nvram
echo 3. Debrick (When normal programming not working)
echo 4. Firmware Testing
echo 5. Exit
option 1 backup 2 restore 3 debrick 4 testing 5 end
backup:
detect
wait 800
if DEBUG == 1 
g
wait 800
if DEBUG == 1
echo The box might be bricked. Please use debrick method
goto continue
endif
endif 
echo backup flash
getram 90000000 400000
save 90000000 400000
echo back nvram
getram nvram
save nvram
goto continue
restore:
detect
wait 800
if DEBUG == 1 
g
wait 800
if DEBUG == 1
echo The box might be bricked. Please use debrick method
goto continue
endif
endif 
echo restore flash
flashchk 90000000
if FLASHSET == 0
echo flash not defined
goto continue
endif
ldram boot
checkmdw 90000000
if MEMORY != 1000018f
echo Your boot code does not seems to be right. This might brick the box
goto continue
endif
program 90000000 400000
wait 1000
cmpram 90000000 400000
if CMPRAM == 0
echo program failed
goto continue
endif
if TRAP == 0
echo TRAP is not on. Please try again
goto continue
endif
echo restore nvram
ldram nvram
setram nvram
cmpram nvram
restoreloop:
echo Please power off/on the box
pause
if TRAP == 1
goto restoreloop
endif
goto begin
debrick:
echo Use jumper to short J200. Then power on the box.
pause
detect
wait 800
tap c
tap a ffffffff
wait 1000
if DEBUG == 0
echo Please try again
goto continue
endif
echo Remove the jumber
pause
detect
if FLASHSET == 0
echo flash not defined
goto continue
endif
erase boot
echo Load proper boot
ldram boot
checkmdw 90000000
if MEMORY != 1000018f
echo Your boot code does not seems to be right.
goto continue
endif
sprogram boot
scmpram boot
if CMPRAM == 0
echo Please power off/on the box and try to debrick again
endif
debrickloop:
echo Power off/on the box. Then use normal restore method to program the box.
pause
if DEBUG == 1
goto debrickloop
goto begin
testing:
detect
wait 800
if DEBUG == 1 
g
wait 800
if DEBUG == 1
echo The box might be bricked. Please use debrick method
goto continue
endif
endif 
echo Firmware testing
getram plat
firm
program plat
wait 800
cmpram plat
goto restoreloop
endif
continue:
pause
goto begin
end:
