;*; Updated on 26-Mar-87 at 3:24 PM by Tom Faust; edit time: 0:08:40
VEDIT = 0
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
;*                                                                         *
;*  Copyright (c) 1987 by Software Designs, PO Box 9227, Spokane WA 99209  *
;*      (509) 326 2480.  Written by Tom Faust.  All rights reserved.       *
;*                                                                         *
;*      This program may be freely used for non-commercial purposes        *
;*      by AMUS members.                                                   *
;*                                                                         *
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
;
;   Pgm Name:   RENSYS.LIT
;
;   Pgm Desc:   Rename a module in system memory.
;
;   Author:     Tom Faust
;
;   Version:    1.0
;
;   Hash Total:
;
;
; Patch Log
;  Ver  Sub        Date    Who  Description of Change
; ------------  ---------  ---  ---------------------------------------------
;  1.0          12 Dec 83  TGF  New.
;               26 Mar 87  TGF  Cleaned up for AMUS.
;

       SEARCH  SYS
       SEARCH  SYSSYM

BASE:   PHDR    -1,0,PH$REE!PH$REU

START:  LIN
       BNE     5$
       TYPECR  <Usage: RENSYS new-filespec = old-filespec>
       JMP     EXIT

5$:     SUB     #14,SP                  ; get some workspace
       FILNAM  6(SP)                   ; read TO module name
       BYP
       CMPB    (A2)+,#'=               ; bypass = sign, must exist!
       BEQ     10$
       TYPECR  <?Specification error>
       JMP     EXIT

10$:    BYP
       FILNAM  @SP                     ; read FROM module name
       SRCH    @SP,A5                  ; find FROM module name
       BNE     20$
       USRBAS  A4
       CMP     A4,A5                   ; system memory only
       BHI     30$
20$:    TYPECR  <?File not found>
       BR      EXIT
30$:    ADD     #6,SP                   ; index new name
       SUB     #6,A5                   ; index module name
       POP     (A5)+                   ; rename module
       POPW    (A5)+
       TYPECR  <1 Module renamed.>

EXIT:   TYPECR  <Copyright (c) 1983,1987 by Software Designs>
       EXIT

       END