; Utility for backing up/restoring files via the console - 8/3/08 ; "FILE" BKFILE - dumps a file to the console as encoded text ; "FILE" REFILE - restores an encoded file pasted to the console ; Requires conalt.ipl ; File format... ; ----- Begin BKFILE Output ----- ; Filename: [filename] (just a comment) ; BEGIN 2 ; END [some octal number] ; [many lines of encoded text] ; CHECK [checksum] ; [empty line] ; BYTES [bytes] (used to save file with correct size) ; ----- End BKFILE Output ----- OCTAL DEFINE BKFILE $DUP GetFile ;update DirInfo IFZ ;if file not found $DROP "File not found" $PRINT ELSE DROP DROP DirInfo 3 ADD GET ;push filesize in bytes $DUP F2AM CRLF ;copy file to alt memory "Start capture now... press Enter when ready " $PRINT $IN $DROP "----- Begin BKFILE Output -----" $PRINT CRLF "Filename: " $PRINT $PRINT CRLF 2 OVER INC 2 DIV 2 ADD ALTENC ;encode alt mem CRLF ;blank line to terminate CONALT when reloaded "BYTES " $PRINT PNUM CRLF ;print bytes "----- End BKFILE Output -----" $PRINT CRLF ENDIF END DEFINE REFILE $DUP $DROP ;make sure filename entered ZAM ;clear alt mem CONALT CRLF ;run CONALT to reload $IN $IN $DROP ;read BYTES line and discard terminate line "(ignore run message)" $PRINT CRLF $LEN 7 SUB IF<0 $DROP $DROP "Invalid byte line, save manually..." $PRINT CRLF "2 [words * 2] " $PRINT 42 PCHR "FILE" $PRINT 42 PCHR "AM2F" $PRINT ELSE 6 $LEN DEC $SLICE $VAL $DROP ;get bytes AM2F ;save file ENDIF END CONSOLE