sTURBOSAVASM .TURBOSAVCOM;4TURBOSAVDOC TURBOSAVE was originally written by D. Weinberger (c) 1985 as SAVESTAR. He wrote the assembly language source code to save lost Word Star (tm) files from memory. The proper equates for the various versions of Turbo Pascal (tm) and Word Star (tm) are given in the comments section of the line which begins with the text "BEGTEXT equ ". If you have a different version of Turbo, or wish to use this program with Word Star, just change the hex number on that line to the appropriate one. (That can be accomplished with any word processing or editting program, and the file TURBOSAV.ASM.) Next place the file TURBOSAV.ASM on a clean disk with the copy of ASM.COM and LOAD.COM which came on your CP/M disk. Place the disk in your A drive. Type the following: ASM TURBOSAV.AAZ LOAD TURBOSAV If all went well you should have a functioning copy of TURBOSAV.COM on your disk. You can rename it anything you wish. I renamed mine from SAVESTAR to TURBOSAV because I use it for saving my Turbo Pascal (tm) files. D. Weinberger states in his original source code that this file may be freely copied, modified, and given away, but not commercially or for profit. Our compliments to Mr. Weinberger from the Bergen/Rockland Kaypro User's Group. n away, but not commercially or for profit. Our compliments to Mr. Weinberger from the Bergen/Rockland Kaypro User's G***************************************************************** * * * TURBO-SAVE is an assembly language program written to * * salvage files in the event of a crash during compilation. * * It's great for those times when you forgot to save the * * program before compiling, and end up in a continuous loop. * * * * Credit Where Due: TURBO-SAVE was written entirely from * * Savestar.asm, a program written to do the same thing for * * lost WordStar files, by D. Weinberger, 1985. * * * * TURBO-SAVE was prepared by Alan Therrien for the members of * * the Bergen/Rockland KUG. It may be distributed free, but * * not for profit. * * * ***************************************************************** ; ---- EQUATES------ boot equ 0000h ;sys reboot bdos equ 0005h ;BDOS jmp spot deletef equ 19 ;delete file function makef equ 22 ;make file function writef equ 21 ;sequential write closef equ 16 ;close file function ctrlZ equ 1AH ;EOF character endfill equ 0000H ;Another filler character FFfill equ 00FFH ;Yet another filler character prnt equ 9 ;print to console function cr equ 13 ;carriage return lf equ 10 ;line feed memax equ 00ECh ;hi-bite of where BDOS begins ; -------Where text is stored in the program ------ BEGTEXT equ 8118h ;7848H for WS v 3.0, 846Dh for WS v 3.3, 802Ch for ; Turbo v 2 w/error msg, 7A74h for Turbo v 2 w/o error msg ; 7BF3h for Turbo v 3 w/o error msg, 8118h for Turbo v3 w ; error messages ; ======Program Start============================== ; ;SET UP PROGRAM AND ASSIGN THE STACK org 100h lxi sp,stack ; ;PRINT SIGN ON MSG lxi d,sinon mvi c,prnt call bdos ; ;DELETE ANY OLD COPY OF FILE "SALVAGED", precludes two files w/same name lxi d,tfcb mvi c,deletef call bdos ; ;MAKE A NEW FILE CALLED "SALVAGED" lxi d,tfcb mvi c,makef call bdos ;Enough room in the dir cpi 0FFh jz fuldir ; ;=======MAIN LOOP WRITE MEMORY TO DISK ========= lxi h,begtext ;Load HL w/loc of lost text beginning mspot: push h ;Save this pointer into text ; ;SET DMA to read next 128 of memory xchg ;DE now points into text mvi c,1Ah ;C calls set-dma function call bdos ;write a record (128 bytes) lxi d,tfcb ;DE=fcb of file to write into SALVAGED mvi c,writef ;C calls write-file function call bdos ;Was write successful cpi 0 ;A=0 if write ok jnz filled ;if disk full, jump to sub-routine ;Have we written from memory past where text is pop h ;Restore H as pointer into text mvi a,memax ;Load A with hi-bite of max mem cmp h ;compare it to where we are jz finis ;if the same, jump to end ;Check for EOF lxi d,127 ;Load DE with 127 dad d ;Add whats in DE to address in HL mov a,m ;Load A w/address in HL-last byte of recd cpi ctrlz ;Is it EOF marker jz finis ;If so, jump to end cpi endfill ;Is it 00 jz finis ;If so, jump to end cpi FFfill ;Is it 00FFh jz finis ;If so, jump to end ;We're not done inx h ;HL=HL+1, so it points to new record jmp mspot ;Loop back and do it again ; ;FINISHED READING AND WRITING SUCCESSFULLY FINIS: lxi d,donemsg ;DE=address of sign-off msg mvi c,prnt ;C calls print string function call bdos ;Continue to CLSF to close file "salvaged" ; ;CLOSE THE NEW FILE clsf: lxi d,tfcb ;DE=address of fcb mvi c,closef ;C calls close file function call bdos mvi c,boot ;re-boot to system call bdos ; ;---ERROR ROUTINES---- ; ;WRITE FAILED DUE TO DISK FULL filled: lxi d,fulldsk ;DE=address of full disk msg mvi c,prnt ;C calls print string function call bdos ; jmp clsf ;jump to close file function ; ;MAKE-FILE FAILED DUE TO DIR FULL fuldir: lxi d,fuldr ;DE=address of full dir msg mvi c,prnt call bdos ; mvi c,boot ;re-boot to system call bdos ; ;----MESSAGES----- ; ; sinon db 'TURBOSAVE By Alan R. Therrien - for Bergen/Rockland KUG',cr,lf db 'from SaveStar by D. Weinberger 1985',cr,lf,'$' donemsg db ctrlZ,cr,lf,'==> Saved your butt again. Look at file B:Salvaged' db cr,lf,'$' fulldsk db 7,'++ Disk Full. Erase a file or use new disk.' db ' Try again ++',cr,lf,'$' fuldr db 7,'++ Directory full. Erase a file or use new disk.' db ' Try again ++',cr,lf,'$' tfcb db 2,'SALVAGED ',0,0,0,0,0,0,0,0,0,0,0,0,0,0 db 0,0,0,0,0,0,0,0,0,0,0,0 ds 64 stack db 0 ; end 2,'SA1 v!k>V~VVV##  ^W TURBOSAVE By Alan R. Therrien - for Bergen/Rockland KUG from SaveStar by D. Weinberger 1985 $ ==> Saved your butt again. Look at file B:Salvaged $++ Disk Full. Erase a file or use new disk. Try again ++ $++ Directory full. Erase a file or use new disk. Try again ++ $SALVAGED om SaveStar by D. Weinberger 1985 $ ==> Saved your butt again.