reset 1
init
if DEBUG == 0
echo The DCT2224 does not respond the reset properly. Check your BDM connection
goto end
endif

begin:
cls
/////////////////////////////////////////////
//    DCT2224
/////////////////////////////////////////////
echo 1. Backup flash and nvram
echo 2. Restore flash and nvram
echo 3. Debrick (When normal programming not working)
echo 4. Firmware Testing (PH7/8/9 and type I PH6/CR4)
echo 5. Firmware Testing (Type II PH6/CR4)
echo 6. Detect type for PH6/CR4 and non PH
echo 7. Exit
option 1 backup 2 restore 3 debrick 4 testing1 5 testing2  6 detecttype 7 end
backup:
echo backup flash
getram code
save code
echo back nvram
getram nvram
save nvram
goto continue
restore:
echo restore nvram
ldram nvram
setram nvram
cmpram nvram
if CMPRAM == 0
echo NVRAM write failed
goto continue
endif
echo restore flash
flshdct code
flashchk 400000
if FLASHSET == 0
echo flash not defined
goto continue
endif
ldram code
program code
cmpram code
goto continue
debrick:
r a7 200400
r rpc 468
echo Now you should be able to use restore method to program the box
goto continue
testing1:
getram code
firm
echo 1. Program the flash.
echo 2. Cancel.
option 1 testing11 2 continue
testing11:
flshdct code
flashchk 400000
if FLASHSET == 0
echo flash not defined
goto continue
endif
program 406000 ba000
goto continue
testing2:
getram code
flipfirm
firm
flipfirm
echo 1. Program the flash.
echo 2. Cancel.
option 1 testing21 2 continue
testing21:
flshdct code
flashchk 400000
if FLASHSET == 0
echo flash not defined
goto continue
endif
program code
goto continue
detecttype:
getram nvram
checkmb 234f09 
if MEMORY == 1
echo This is type I.
else
echo This is type II.
endif
continue:
pause
goto begin
end:
