; TITLE "SFRENAME - Syslib 4.0" NAME ('FRENAM') ;================================================================= ; The Libraries, Version 4, (C) 1989 by Alpha Systems Corp. ;----------------------------------------------------------------- ; Author : Harold F. Bower ; Derived from SFRENAME.Z80 Ver 1.1 by Richard Conn ; Date : 17 Sep 89 ; Version : 1.2 ; Module : SFRENAME ; Abstract: This module contains the routine F$RENAME which ; renames a file to another which is also passed to the ; routine. Only the FN and FT fields of the FCB are used, ; and the pointers point to the User Numbers, so full FCB's ; are not necessary. Only the first 12 bytes are required. ; Revision: ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; Module Entry Points PUBLIC F$RENAME ; From SYSLIB Get.. EXT @BDOS, FILLB .Z80 CSEG ;=============================================================== ; NAME - F$RENAME ; Entry: HL - Points to the new name (1st byte of FCB) ; DE - Points to the old file name (1st byte of FCB) ; Exit : A <> 0, Zero Flag Reset (NZ) if Ok ; A = 0, Zero Flag Set (Z) if File Not Found ; Uses : AF ; Special Requirements: None ;=============================================================== F$RENAME: PUSH HL ; Save Regs PUSH DE PUSH BC PUSH DE ; Save Old Name ptr PUSH HL ; Save New Name ptr LD HL,RENFCB ; Init the FCB XOR A ; Store Zeros LD B,36 ; 36 Bytes worth CALL FILLB POP HL ; Get ptr to New Name LD DE,RENFCB+17 ; Pt to FN part of FCB2 INC HL ; Pt to FN LD BC,11 ; 11 Bytes LDIR POP HL ; Pt to 1st FN LD DE,RENFCB+1 ; Pt to FN part of FCB1 INC HL ; Pt to FN LD BC,11 ; 11 Bytes LDIR LD DE,RENFCB ; Do the Rename LD C,23 ; Bdos Function 23 CALL @BDOS POP BC ; Restore Regs POP DE POP HL INC A ; Error? (255 --> 0) RET ; ..quit with Z for Error, NZ if Good ; Data Storage/Buffer DSEG ; Put in Data Segment RENFCB: DEFS 36 ; FCB space for Rename END