; Program: RENAME ; Version: 3.0 ; Date: 18 May 84 ; Author: Richard Conn ; Previous Versions: 2.0 (16 Jan 83) ; Previous Versions: 1.4 (6 Jan 83), 1.3 (7 Dec 82), 1.2 (10 Nov 82) ; Previous Versions: RENAME.ASM 1.1 (26 Oct 81) ; vers equ 35 subvers equ ' ' ; ; Version 3.5 -- July 1, 1990 -- Gene Pizzetta ; Changed filename display to "oldfile to newfile" instead of the ; strange "newfile from oldfile". Added configuration byte after ; ASCII string 'SYSFILES>' to chose whether to include system files ; by default (non-zero) or exclude them by default (0). S option ; now toggles the default meaning (it's current action is shown by ; the usage screen. Now filters high bit of filenames for terminals ; that display special characters that way. At the suggestion of ; Howard Goldstein, RENAME no longer signs on with its load address ; and version number; these are displayed only on the usage screen. ; Restored Q (quit) as a valid response to an rename or erase query, ; but ^C still works. Display has been made even more compact than ; last version. Many of these changes are to make the RENAME ; interface very similar to the RCP version. Sets program error ; flag to 10 if a matching filename is not found. If an invalid ; option is given, the program error flag is set to 19 and the ; error handler is invoked. ZEX input is suspended during execution ; of RENAME. The number of files renamed (up to 255) is placed in ; ZCPR3 register 0. Now obeys ZCPR3 quiet flag, except when in ; inspect or control mode, or when a prompt is necessary. Removed ; Wheel byte protection for E and S options. ; ; Version 3.4 -- March 31, 1990 -- Gene Pizzetta ; Modified for more compact display, usually a single line for each ; file renamed. ^C aborts at any prompt. ; ; Version 3.3A -- December 30, 1987 -- Bruce Morgen ; Strip high bit from EFCB program name characters. "E" and "S" ; options require Wheel byte set; help message reflects this. ; ; Version 3.3 -- December 19, 1987 -- Bruce Morgen ; Help message now reflects actual COM file name used, PPIP-style ; dual syntax implemented (as requested by Ken Taschner). This ; required some rather tricky parsing to support the single-filespec ; syntax "afn.typ [/]c", so while I was at it I made control mode ; mandatory and automatic for single-filespec elements and eliminated ; the C option letter altogether (as Rick says: "it only makes ; sense"...). In order support this single-filespec mode when such ; an element is the last (or only) one in a RENAME command line, the ; second file-spec in the last (or only) command is tested if the ; MS-DOS syntax is detected. If that second filespec starts with a ; "/" or includes only valid option letters (and no more characters ; than the number of valid option letters) it is assumed to be an ; option specifier rather than a rename-to filespec. Following ; Howard Goldstein's (LX17 & 18) lead, filespec-to-FCB parsing calls ; the Z33 CCP if it's available. A Z80, HD64180, NSC800 or (someday?) ; Z280 CPU now is required. ; ; Version 3.2 -- August 25, 1987 -- Jay Sage ; Changed to allow a leading slash before an option to make program ; consistent with a number of other Z programs (this was supposed to ; happen, but there was a bug in the code). Put data into a DSEG. ; Made header indicate load address. ; ; Version 3.1 -- April 12, 1987 -- Jay Sage ; Took idea of Rick Charnes and implemented it as an option so that ; one does not have to have two versions of the program. The option ; is 'E'. Also updated code to ZCPR33 type-3 environment to allow ; linking RENAME for execution in high memory if desired. ; ; Version 3.0a -- April 9, 1987 -- Rick Charnes ; I have modified this source code slightly so that if you try to ; rename FILE1 to FILE2 and FILE2 already exists, the program will ; NOT ask you if you are sure you want to delete FILE2. It just ; goes ahead and deletes the darn thing and renames FILE1. I had ; an application for it, studied and little and ... it works. Be ; careful, though. This is a special use program, and NOT for ; everyday use. I found an alias in which I needed it. ; ; RENAME is used to change the name of one or more files. It permits ; ambiguous filenames and supports an Inspect mode that allows the user ; to confirm each rename before it is done. Additionally, there is a ; Control mode which allows the user to manually specify the name for ; each file as it is presented to him. ; ; SYNTAX: ; RENAME dir:afn1=afn2,dir:afn3=afn4,... [/]o ; RENAME dir:afn2 afn1,dir:afn4 afn3,... [/]o ; RENAME dir:afn,dir:afn1=afn2,,dir:afn4 afn3... [/]o ; ; The first form shows elements of the CP/M style: ; dir:newname=oldname ; The second form shows elements of the MS-DOS style: ; dir:oldname newname ; The third form adds the single-filespec: ; dir:oldname ; which automatically invokes Control mode allowing the user to rename ; files individually. ; ; OPTIONS (o) are none or more of the following: ; I -- Inspect and approve each rename ; S -- Include or exclude System files ; E -- Erase existing file without prompt ; ; EXAMPLES: ; RENAME *.MAC=*.ASM <-- rename all ASM files to MAC ; RENAME *.MAC <-- rename all MAC files to names input by user ; RENAME *.OBJ=*.COM SI <-- rename all COM files to OBJ, include system ; files, and Inspect and approve each change ; ext z33chk,z33fname,z3init,zfname,z3log,prtname ext puter2,inverror,getquiet,putreg,stopzex ext dirq,f$delete,f$rename,bbline,initfcb,bdos,moveb ext putud,getud,phlfdc,eprint,phl4hc,bout,cin,caps,crlf ext fillb,codend ; public cout ; so SYSLIB will use ours ; ; Equates ; fcb equ 5Ch ; file control block buff equ 80h ; input line buffer esize equ 16 ; size of dir entry (from SYSLIB DIRQ routine) z3env defl 0FE00h ; environment address ctrlc equ 03h ; ^C BEL equ 07h ; bell BS equ 08h ; backspace LF equ 0Ah ; linefeed CR equ 0Dh ; carriage return ; ; Type 3 header -- Code modified as suggested by Charles Irvine to function ; correctly with interrupts enabled. Program will abort with an error message ; when not loaded to the correct address (attempt to run it under CP/M or Z30). ; entry: jr start0 ; must use relative jump nop ; filler db 'Z3ENV',3 ; type-3 environment z3eadr: dw z3env ; filled in by Z33 dw entry ; intended load address ; ; Configuration . . . ; db 'SYSFILES>' ; system files configuration byte sysflg: db 0 ; 0 = exclude, non-zero = include ; start0: ld hl,0 ; point to warmboot entry ld a,(hl) ; save the byte there di ; protect against interrupts ld (hl),0c9h ; replace warmboot with a return opcode rst 0 ; call address 0, pushing RETADDR ; ..onto stack retaddr: ld (hl),a ; restore byte at 0 dec sp ; get stack pointer to point dec sp ; to the value of RETADDR pop hl ; get it into HL and restore stack ei ; we can allow interrupts again ld de,retaddr ; this is where we should be xor a ; clear carry flag push hl ; save address again sbc hl,de ; subtract -- we should have 0 now pop hl ; restore value of RETADDR jr z,start ; if addresses matched, begin real code ; ld de,notz33msg-retaddr ; offset to message add hl,de ex de,hl ; switch pointer to message into DE ld c,9 jp 0005h ; return via BDOS print string function notz33msg: db 'Not Z33+$' ; abort message if not Z33-compatible ; ; Start of program . . . ; start: ld (stack),sp ; save stack call codend ld (cmdlne),hl ; setup command line buffer ld de,100h ; buffer size add hl,de ld (ntfcb),hl ; set temp FCB add hl,de ld (dirbuf),hl ; pointer to dir buffer ld sp,hl ; new stack pointer ld hl,(ntfcb) ; set 2nd FCB ld de,40 add hl,de ld (ofcb),hl ; ld hl,(z3eadr) ; point to ZCPR3 environment call z3init ; initialize environment call putud ; save current user/disk away call stopzex ; suspend ZEX input ; ld a,(fcb+1) ; get first character of filename cp ' ' ; no file spec? jr z,usage cp '/' ; option caught? jp nz,econt ; ; Print help information ; usage: call eprint db 'RENAME Version ' db vers/10+'0','.',(vers mod 10)+'0',subvers,' (loaded at ',0 ld hl,entry call phl4hc call eprint db 'h)',CR,LF db 'Usage:',CR,LF db ' Old style: newname=oldname',CR,LF,' ',0 call prtname call eprint db ' {dir:}afn.aft=afn.aft{,{dir:}afn.aft=afn.aft{,...}} {{/}options}',CR,LF db ' New style: oldname newname',CR,LF,' ',0 call prtname call eprint db ' {dir:}afn.aft afn.aft{,{dir:}afn.aft afn.aft{,...}} {{/}options}',CR,LF db ' Interactive control mode: oldname',CR,LF,' ',0 call prtname call eprint db ' {dir:}afn.aft{,{dir:}afn.aft{,...}} {{/}options}',CR,LF db ' All three forms may be mixed within a command line.',CR,LF db 'Options:',CR,LF db ' E Erase existing files without prompting.',CR,LF db ' I Inspect mode (get user approval).',CR,LF db ' S ',0 ld a,(sysflg) or a jr nz,usage2 call eprint db 'Include',0 jr usage3 usage2: call eprint db 'Exclude',0 usage3: call eprint db ' system files.',0 db 0 ; ; Return to operating system ; exit: ld a,0 ; zero the error code erexit: call puter2 ; set program error flag ld b,a ; get error code to B cp 19 ; invalid option? call z,inverror ; (yes, call error handler) call getud ld sp,(stack) ; get old stack ret ; ; Print count of files renamed ; prcount: ld hl,(filcnt) ; get count ld b,0 ; setting ZCPR3 register 0 ld a,l ; check for none call putreg call getquiet ; even in inspect and control modes ret nz ld a,(contrl) or a call z,crlf or a ld a,l or h jr z,prno call phlfdc ; print decimal count jr prms ; prno: call eprint db 'No Files Renamed',0 ret ; prms: ld hl,(filcnt) ; 1 file renamed? ld a,h ; high zero? or a jr nz,prmult ld a,l ; low one? cp 1 jr z,prsing ; prmult: call eprint db ' Files Renamed',0 ret ; prsing: call eprint db ' File Renamed',0 ret ; ; Copy buffer into temporary buffer ; econt: ld de,(cmdlne) ; point to command line save buffer ld hl,buff+1 ; point to buffer ld b,80h ; buffer size call moveb ; copy into command line buffer ; ; Initialize option flags ; xor a ld (inspct),a ; no inspect mode ld (eraflg),a ; no erase without prompt ld (quiet),a ld a,(sysflg) ; check system file configuration byte or a jr z,xsys ld a,0C0h ; select all files ld (system),a jr xsys2 xsys: ld a,80h ; select non-system files only ld (system),a xsys2: ld hl,0 ; set file count ld (filcnt),hl ld hl,(cmdlne) ; point to buffer ; ; Skip to filename string ; sblank: ld bc,127 xor a cpir ld c,33 ld a,',' cpdr jr z,gcomma commaz: ld hl,(cmdlne) jr ncomma gcomma: push hl ld de,(cmdlne) xor a sbc hl,de pop hl jp z,usage jr c,commaz inc hl inc hl ncomma: ld de,argtbl ld a,3 ld (de),a xor a call argv jp nz,usage inc de ld a,(de) cp 3 jr z,triarg cp 2 jp nz,chkqt ld hl,(argum2) dec hl ld a,(hl) inc hl sub '=' jp z,chkqt calloq: call optq jp nz,chkqt dec hl ld (hl),a inc hl jr option triarg: ld hl,(argum3) ld a,(hl) ; ; Check for leading slash on option and skip it if so ; opt: cp '/' ; option character? jr nz,option inc hl ; skip slash ; ; Process list of options ; option: ld a,(hl) ; get byte or a ; done? jp z,chkqt inc hl ; point to next character cp ' ' ; skip over spaces jr z,option cp '/' ; obvious error, so display help jp z,usage cp 'E' ; erase old files? jr z,optera cp 'I' ; inspect? jr z,optins cp 'S' ; system files? jp nz,invopt ; ; Set system files selection ; ld a,(system) ; check default cp 80h jr z,setsys ld a,80h ; non-system only ld (system),a jr option setsys: ld a,0C0h ; set for system and non-system files ld (system),a jr option ; invopt: call eprint db ' Invalid option.',0 ld a,19 jp erexit ; optera: ld a,0FFh ; auto erase mode ld (eraflg),a jr option ; optins: ld a,0FFh ; inspect mode ld (inspct),a jr option ; ; Check quiet mode (not valid in inspect or control modes) ; chkqt: ld a,(inspct) or a jr nz,dspec call getquiet jr z,dspec ld (quiet),a ; ; Extract disk, user, and filename information ; dspec: ld hl,(cmdlne) ; point to before first byte dec hl dspec0: inc hl ; point to byte ld a,(hl) ; get byte or a ; done? jp z,usage cp ' ' ; space? jr z,dspec0 jr dspec2 ; ; Major re-entry point when file specs are separated by commas. ; HL points to first byte of next file spec ; dspec1: ld a,(quiet) or a jr nz,dspec2 ld a,(contrl) or a call z,crlf dspec2: xor a ld (contrl),a call getud ; reset user if necessary ld de,(ntfcb) ; point to FCB in DE call parsit ; extract filename to FCB, get disk and user ld (nextch),hl ; save pointer to delimiter which ended scan call z3log ; log into DU ; ; First name is now extracted -- extract possible second name ; name2: ld de,(ofcb) ; point to FCB for 2nd name ld hl,(ntfcb) ; point to first name ld b,16 ; copy 16 bytes call moveb ld hl,(nextch) ; point to character which ended parse ld a,(hl) ; get it cp '=' ; assignment? jr z,gotequ cp ' ' ; reverse assignment? jr z,gotequ ld a,0FFh ; set for control mode ld (contrl),a xor a ; ..and reset quiet flag ld (quiet),a jr rename ; gotequ: push af inc hl ; point to character after '=' or space ld de,(ofcb) ; point to temporary FCB call parsit ; extract filename into FCB, get disk and user ld (nextch),hl ; save pointer to delimiter which ended scan pop af cp '=' jr z,rename ld hl,(ofcb) ; swap pointers for MS-DOS "style" ld de,(ntfcb) ld (ofcb),de ld (ntfcb),hl ; ; Load directory and rename files ; rename: ld de,(ofcb) ; point to FCB ld hl,(dirbuf) ; point to end of code call initfcb ; init the FCB ld a,(system) ; set flags call dirq ; load DIR, select files, pack, and alphabetize ; ; Rename DIR files; HL points to first file, BC=file count ; call renfiles ; ; Check for next file spec ; ld hl,(nextch) ; get pointer ld a,(hl) ; get delim cp ',' ; another file? jr nz,rendone inc hl ; point to character after comma jp dspec1 ; continue processing ; ; Rename complete ; rendone: call prcount ; print file count and exit ld hl,(filcnt) ; get count ld a,l ; check for none or h jp nz,exit ld a,10 jp erexit ; ; Rename selected files ; renfiles: ld a,b ; check for any files loaded or c ret z jr renlp1 ; ; Print filename ; renlp: ld a,(quiet) or a jr nz,renlp1 ld a,(contrl) or a call z,crlf renlp1: push bc ; save entry count push hl ; save pointer to FCB ld hl,(ntfcb) ; copy new template into RENFCB ld de,renfcb ld b,16 call moveb pop hl ; get pointer push hl ; save pointer inc hl ; point to filename of old name inc de ; point to filename of RENFCB ld b,11 ; 11 bytes to FN and FT renlp2: ld a,(de) ; get character of new file cp '?' ; change '?' to old character jr nz,renlp3 ld a,(hl) ; get old character and 7fh ; mask old character ld (de),a ; store it away as new renlp3: inc hl ; print to next character inc de djnz renlp2 ; count down ld a,(quiet) ; check quiet mode or a jr nz,renlp5 ; don't print anything ld a,' ' call bout ld a,(contrl) ; check for control mode or a jr nz,renlp4 ; (yes, skip next) pop hl ; point to old filename push hl call prfn ; print old filename call eprint db ' to ',0 renlp4: ld hl,renfcb ; point to new filename call prfn ; print new filename renlp5: pop hl ; GET pointer ; ; Check for control mode and perform control function if flag set ; ld a,(contrl) ; get control mode flag or a ; NZ= yes jr nz,renctrl ; ; Check for inspection and inspect if set ; ld a,(inspct) ; get flag or a ; 0=no jp z,doit ; ; Prompt user for rename ; call renq ; rename question cp ctrlc ; quit? jp z,quit cp 'Q' jp z,quit cp 'Y' ; yes? jp z,doit ; ; Don't rename file ; nodo: ld a,(contrl) or a jp z,rentest call eprint db ' Not Renamed',CR,LF,0 jp rentest ; ; Print filename pointed to by HL ; prfn: inc hl ; point to filename ld b,8 ; print name call prnt ld a,'.' ; decimal call bout ld b,3 ; print type jp prnt ; ; Prompt user for rename ; renq: call eprint ; print prompt db ' Rename (Y/N/Q)? N',BS,0 call cin ; get response call caps ; capitalize cp 'Y' jr z,cout cp 'Q' ; quit? jr z,cout cp ctrlc ; quit? ret z ld a,'N' cout: jp bout ; echo ; ; Control function -- allow user to rename as he desires ; renctrl: push hl ; save pointer to file rctrl: call eprint db ' New Name (=Skip)? ',0 ld a,0FFh ; capitalize call bbline ; input line from user call crlf or a ; check for just carriage return jr nz,rctrl0 pop hl ; get pointer to file jp nodo ; proceed with next entry rctrl0: ld de,renfcb ; place into new name FCB call parsit ; just extract name ld b,11 ; check for any wild characters rctrl1: inc de ; point to next character ld a,(de) ; get it cp '?' ; can't be wild jr z,werr cp '*' ; can't be wild jr z,werr dec b ; count down jr nz,rctrl1 jr rdoit ; done -- perform rename werr: call eprint db bel,cr,lf,' No Wild Cards,',0 jr rctrl ; ; Quit RENAME program -- even if we've renamed no files, we want to exit ; quit: cp ctrlc jr nz,quit1 call eprint db '^C',0 quit1: call prcount ; print count of files renamed and exit jp exit ; ; Rename file, but get pointer first ; rdoit: pop hl ; get pointer ; ; Rename file; old name pointed to by HL, new name in RENFCB ; doit: push hl ; ; Step 1 -- Determine if new name already exists ; ld de,renfcb ; point to new name call initfcb ld c,17 ; search for first call bdos inc a ; not found? jr z,doit1 ld a,(eraflg) ; see if unprompted erasing option in effect or a jr nz,delold ; if so, skip prompt ld a,(quiet) or a jr z,skipfn call crlf ld hl,renfcb call prfn skipfn: call eprint db bel,' Exists, Delete (Y/N/Q)? N',BS,0 call cin ; get response call caps cp 'Y' jr z,cout1 cp 'Q' ; quit? call z,bout jr z,quit cp ctrlc jr z,quit ld a,'N' cout1: call bout pop hl ; prepare for abort cp 'Y' ; yes -- continue? jp nz,nodo ; not yes, so skip it ld a,(contrl) or a call nz,crlf push hl ; save pointer again delold: call initfcb ; clear FCB ld c,30 ; set file attributes to R/W if not already call bdos call initfcb call f$delete ; delete file doit1: pop hl ; HL points to old name ; ; Clear the old name's attributes in case it was R/O ; push hl ; save pointer to old name ld de,(ofcb) ; copy old name ld b,16 call moveb push de ; clear attributes ld b,11 ; 11 bytes inc de ; point to first doit2: ld a,(de) ; get character and 7Fh ; clear attribute ld (de),a ; put character inc de ; point to next djnz doit2 ; count down pop de ; now set attributes of old name call initfcb ld c,30 ; set attributes call bdos call initfcb ; ; Do the rename ; ld hl,renfcb ; point to new name ex de,hl call initfcb ; init new FCB ex de,hl ; HL points to new name, DE points to old name call f$rename ; rename file ; ; Restore the original attribute bits ; pop hl ; get pointer to old name ld de,renfcb+1 ; point to new name push hl ; save pointer to old name inc hl ; point to filename of old name ex de,hl ; HL points to new name, DE points to old name ld b,11 ; 11 bytes doit3: ld a,(de) ; get attribute bit of old name and 80h ; look only at attribute bit or (hl) ; mask in new name byte ld (hl),a ; store it away inc hl ; point to next inc de djnz doit3 ; count down ; ; Set the original attributes into the new file ; ld de,renfcb ; point to FCB call initfcb ld c,30 ; set attributes call bdos ld hl,(filcnt) ; increment file count inc hl ld (filcnt),hl pop hl ; get pointer to directory entry ; ; Point to next entry ; rentest: ld de,esize ; point to next entry add hl,de pop bc ; get count dec bc ; count down ld a,b ; check for zero or c jp nz,renlp ret ; ; Print characters pointed to by HL for B bytes ; prnt: ld a,(hl) ; get character and 07Fh ; reset high bit call bout inc hl ; point to next djnz prnt ; count down ret ; ; Check for ZCPR 3.3, branch to the appropriate parser ; parsit: call z33chk jp z,z33fname xor a jp zfname ; ; AI (allegedly intelligent) routine to check for a string ; containing legal option letters ONLY. ; optq: ld a,(hl) sub '/' ; slash is explicit option delim jr nz,noslsh ; if not slash, do character check ld (hl),a ; if slash, null it out (A = 0) dec hl ld (hl),a ; null out leading space inc hl ; adjust pointer to options inc hl ret ; return with Z flag ; noslsh: ld d,h ; copy into DE ld e,l xor a ; search for terminating null ld bc,optlen ; range for search cpir ; do short search jr z,dooptq ; found null, proceed ex de,hl ; otherwise too long for options ret ; return with NZ ; dooptq: push de dec de bloop: inc de ld a,(de) or a jr z,oqdone ; end of string, return with Z ld b,optlen ld hl,optltr lloop: cp (hl) jr z,bloop inc hl djnz lloop ; if B ticks down, a failure! dec b ; cheap NZ return ; oqdone: pop hl ret ; optltr: db 'EIS' optlst: ds 0 optlen equ optlst-optltr ; ; SYSLIB Module Name: SARGV ; Author: Richard Conn ; SYSLIB Version Number: 3.6 ; Module Version Number: 1.1 ; public argv ; ARGV is a UNIX-style ARGC/ARGV string parser. It is passed ; a null-terminated string in HL and the address of a token pointer ; table in DE as follows: ; LXI H,STRING ; LXI D,ARGV$TABLE ; MVI A,0 ; do not mark token end ; CALL ARGV ; JNZ TOKEN$OVFL ; indicates more tokens than allowed ; ... ; ARGV$TABLE: ; DB maxent ; max number of entries permitted ; DS 1 ; number of entries stored by ARGV ; DS 2 ; pointer to token 1 ; DS 2 ; pointer to token 2 ; ... ; DS 2 ; pointer to token maxent ; Tokens are delimited by spaces and tabs. ; As well as '='. ; 27 Feb 86, jww ; Completed Joe's mod. by adding "=" to "sksp:" as well as "sknsp:" ; December 19, 1987, Bruce Morgen ; On input, if A=0, the end of each token is not marked with a null. ; If A<>0, a null is placed after the last byte of each token. ; If all went well, return with A=0 and Zero Flag set. If there ; are possibly more tokens than pointers, return with A=0FFH and NZ. ; argv: push bc ; save regs push de push hl ld c,a ; save mark flag ex de,hl ld b,(hl) ; get max entry count push hl ; save address of max entry count inc hl ; point to token count inc hl ; point to first pointer ; ; On each loop, DE = address of next character in string and HL = address of ; next pointer buffer; B = number of pointer buffers remaining and C = ; mark flag (0 = no mark) ; loop: call sksp ; skip spaces and tabs in string pointed to by DE or a ; end of string? jr z,done ld (hl),e ; store low inc hl ld (hl),d ; store high inc hl dec b ; count down jr z,loop2 call sknsp ; skip until end of token or a ; done? jr z,done ld a,c ; get mark flag or a ; 0=no mark jr z,loop1 xor a ; mark with null ld (de),a ; store null inc de ; point to next character loop1: ld a,b ; check count or a jr nz,loop ; continue on loop2: call sknsp ; skip over token call sksp ; any tokens left? or a jr z,done ; none if EOL or 0ffh ; make A = 0FFH to indicate more to come done: pop hl ; get address of max token count push af ; save return flags ld a,(hl) ; get max token count sub b ; subtract counter inc hl ; point to return count ld (hl),a ; set return count pop af ; get return flag pop hl ; restore regs pop de pop bc ret ; ; Skip over space or tab characters ; sksp: ld a,(de) ; get character and 7Fh ; mask inc de ; point to next cp ' ' ; continue if space jr z,sksp cp 9 ; continue if tab jr z,sksp cp '=' jr z,sksp dec de ; point to character ret ; ; Skip over non-space and non-tab characters ; Added '=' so that A:=B: construct yields two arguments. v1.1 jww ; sknsp: ld a,(de) ; get character and 7Fh ; mask ret z ; done if null cp ' ' ret z ; done if space cp 9 ret z ; done if tab cp '=' ret z ; new delimiter inc de ; point to next jr sknsp ; ; End of ARGV inclusion ; ; Uninitialized buffers and data . . . ; DSEG ; argtbl: maxent: ds 1 ds 1 ds 2 argum2: ds 2 argum3: ds 2 inspct: ds 1 ; inspect flag (0=no, 0FFh=yes) contrl: ds 1 ; control flag (0=no, 0FFh=yes) system: ds 1 ; system flag (80h=exclude, 0C0h=include) eraflg: ds 1 ; unprompted erasure of existing file (0=no) quiet: ds 1 ; quiet flag (non-zero=quiet) nextch: ds 2 ; pointer to next character in command line filcnt: ds 2 ; count of number of files renamed renfcb: ds 40 ; FCB for renaming ofcb: ds 2 ; FCB for old filename and old file template ntfcb: ds 2 ; FCB for new file template cmdlne: ds 2 ; pointer to command line buffer dirbuf: ds 2 ; pointer to directory buffer stack: ds 2 ; old stack pointer ; end