;**************************************************************************** ; CHGMOD.M68 - "Change Module" subroutine ; ; Written by: Dave Heyliger - AMUS Staff ; ; Purpose: CHANGE a MODULE NAME in user memory ; ; Usage: XCALL CHGMOD,new'name,old'name ; ; where new'name = MAP1 new'name,S,10 ; old'name = MAP1 old'name,S,10 ; ; Sample BASIC program: ; ; old'name = "BOGUS.MOD" ; new'name = "NEWMOD.MOD" ; XCALL CHGMOD,new'name,old'name ; ; !module NOT CHANGEd if either string invalid or MODULE ; !not found. ; ;**************************************************************************** OBJNAM .SBR ;final result is FNDMOD.SBR SEARCH SYS ;get the regulars SEARCH SYSSYM SEARCH TRM ;define version number VMAJOR = 1 ;original by Dave Heyliger VMINOR = 0 ; version 1.0(100) VEDIT = 100. ;define some workspace - A4 default pointer .OFINI ;a variable buffer .OFDEF BUFFER,30. ;"oversized" buffer space .OFSIZ IMPSIZ ;definitions done PHDR -1,0,PH$REE!PH$REU ;good programming! ;error checking first: CMPW @A3,#2 ;2 arguments? BNE 10$ ;nope, error CMPW 2(A3),#2 ;first argument a string? BNE 10$ ;nope, error CMPW 12.(A3),#2 ;second argument a string? JEQ 20$ ;yup, looks good ;error in input, inform the user 10$: TYPECR TYPE < where new'name is the name you would like to change> TYPECR < the module name to, and> TYPECR < old'name is the name of the MODULE.> RTN ;input looks good - let's get on with it! 20$: MOV 14.(A3),A2 ;A2 points to old'name FILNAM BUFFER(A4) ;default extension is .MOD SRCH @A4,A1,F.USR ;look only in users memory BEQ 30$ ;found it! ;didn't find the module - report no change MOV #7,D1 ;get a bell TTY ;beep! TYPECR RTN ;found the module - rename it 30$: MOV 4(A3),A2 ;point to new'name SUB #6,A1 ;point to name area FILNAM @A1,MOD ;create new name for module RTN ;and return END .