; ; SYSLIB Module Name: SRENAM ; Author: Richard Conn ; SYSLIB Version Number: 2.0 ; Module Version Number: 1.0 ; Module Entry Points: ; F$RENAME ; Module External References: ; BDOS FILLB MOVEB ; ; ; F$REN -- RENAME FILES ; THIS ROUTINE RENAMES THE OLD FILE PTED TO BY DE TO THE NEW FILE ; PTED TO BY HL; ONLY THE FN AND FT FIELDS OF THE FCB PTED TO ARE USED, ; AND THE POINTERS POINT TO THE USER NUMBERS, SO FULL FCB'S ARE NOT NECESSARY. ; ONLY THE FIRST 12 BYTES OF AN FCB ARE REQUIRED ; ; ON ENTRY, HL PTS TO NEW FILE NAME, DE PTS TO OLD FILE NAME ; ON EXIT, ZERO FLAG SET (Z) MEANS ERROR (FILE NOT FOUND) ; ; ; EXTERNALS ; EXT BDOS EXT FILLB EXT MOVEB ; ; ROUTINE ; F$RENAME:: JMP START ; ; FCB FOR RENAME ; RENFCB: DS 36 ; JUST NEED THE SPACE ; ; START OF ROUTINE ; START: PUSH H ; SAVE REGS PUSH D PUSH B PUSH D ; SAVE OLD NAME PTR PUSH H ; SAVE NEW NAME PTR LXI H,RENFCB ; INIT THE FCB XRA A ; STORE ZEROES MVI B,36 ; 36 BYTES CALL FILLB POP H ; GET PTR TO NEW NAME LXI D,RENFCB+17 ; PT TO FN PART OF FCB2 INX H ; PT TO FN MVI B,11 ; 11 BYTES CALL MOVEB POP H ; PT TO 1ST FN LXI D,RENFCB+1 ; PT TO FN PART OF FCB1 INX H ; PT TO FN MVI B,11 ; 11 BYTES CALL MOVEB LXI D,RENFCB ; DO THE RENAME MVI C,23 ; BDOS FCT 23 CALL BDOS POP B ; RESTORE REGS POP D POP H CPI 0FFH ; ERROR? JZ RENERR MVI A,0FFH ; SET NO ERROR ORA A ; SET FLAGS RET RENERR: XRA A ; SET ERROR RET END