home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 10: Diskmags / nf_archive_10.iso / MAGS / ST_USER / 1990 / USERMY90.MSA / LISTINGS_RENAME.S < prev    next >
Text File  |  1990-03-02  |  1KB  |  48 lines

  1. ***************************************
  2. *    Rename a file              *
  3. ***************************************
  4.  
  5. * Print the old name input prompt
  6.     PEA prompt1(PC)        address of string
  7.     MOVE.W #9,-(A7)        c_conws
  8.     TRAP #1            Gem Bdos
  9.     ADDQ.L #6,A7        tidy stack up
  10.  
  11. * Input the old name of the file
  12.      PEA oldname(PC)        stack input buffer address
  13.     MOVE.W #10,-(A7)    c_conrs
  14.     TRAP #1            Gem Bdos
  15.     ADDQ.L #6,A7        tidy stack
  16.  
  17. * Print the new name input prompt
  18.     PEA prompt2(PC)        address of string
  19.     MOVE.W #9,-(A7)        c_conws
  20.     TRAP #1            Gem Bdos
  21.     ADDQ.L #6,A7        tidy stack up
  22.  
  23. * Input the new name of the file
  24.      PEA newname(PC)        stack input buffer address
  25.     MOVE.W #10,-(A7)    c_conrs
  26.     TRAP #1            Gem Bdos
  27.     ADDQ.L #6,A7        tidy stack
  28.  
  29. * Rename the file from oldname to newname
  30.     PEA newname+2(PC)    stack new filename
  31.     PEA oldname+2(PC)    stack old filename
  32.     CLR -(A7)        dummy value - 0
  33.     MOVE.W #86,-(A7)    f_rename
  34.     TRAP #1            Gem Bdos
  35.     ADDA.L #12,A7        tidy stack up
  36.  
  37. * Finished, so return to the desktop
  38.     CLR -(A7)        p_term_old
  39.     TRAP #1            Gem Bdos
  40.  
  41. prompt1    DC.B 13,10,'Enter old filename: ',0
  42. prompt2    DC.B 13,10,'Enter new filename: ',0
  43. oldname    DC.B 63,0
  44.     DS.B 64            old name stored here
  45. newname    DC.B 63,0
  46.     DS.B 64            new name stored here
  47.     EVEN
  48.