H X;SAVE #D9:FMSFNAME.M65AFILE NAME DECODEAX;"X; FNDCODE - DECODE A FILE NAMEX;(X; THE USER FILENAME IS POINTED TO BY$+X; ICBALZ, IT IS ON THE FORM P X WHERE P.-X; IS THE PRIMARY FILE NAME (1 TO 8 CHARS)8%X; AND X IS THE EXTENDED FILE NAMEB-X; (0 TO 3 CHARS). THE PERIOD IS OPTIONALL*X; (IF NOT PRESENT, THEN NO EXTENSION).V+X; THE DECODED FILENAME WILL BE 12 CHARS`&X; IN LENGTH. THE P FIELD WILL BE j(X; LEFT JUSTIFIED IN THE 1ST 8 BYTES.t+X; THE X FIELD WILL BE LEFT JUSTIFIED IN~(X; THE LAST 3 BYTES. BLANKS ARE USED%X; TO PAD THE FIELDS TO FULL SIZE.)X; IF THE USER SPECIFIED P OR X FILEDS.X; CONTAIN MORE THAN 8 OR 3 CHARS, THEN THE'X; EXTRA CHARS ARE IGNORED. THE '*'(X; WILD CARD CHAR WILL CAUSE THE REST&X; OF THE FIELDS TO FILLED WITH THE/X; '?' WILD CARD CHAR. ANY NON-ALPHANUMERIC#X; CHAR TERMINATES THE FILENAME.X; FNDCODE$%>;;find beginning of real name:FDCLPQ@ICBALZ71 $G:FNERR;;we only allow D: or Dn:R> : H:FDCLP(3;; POINT PAST THE COLON2X;<X; secondary entry point:F1X; Y points one byte before name to decodePX;Z FNDCNXd 3;; to real beginning of namen"Q>;; max chars in name properxX;$>;; destination indexX; :FDLPSPCL-PEXTSW;; save end of current portion here:FDMAINLOOPQ@ICBALZ7;; get a characterR> .;; start extension?H:FDNP;; noX; found a period:!(>;; at end of primary name?6H:FDPERIOD;;not exactly in right place, space fillX;3X; got a period & we have space filled if needed*X; ....time to switch over to extensionX;%3;; now we can get past the period"!Q> ;; and switch to extension,&H:FDLPSPCL;; special loop re-entry6X;@ :FDPERIODJ-D:FDSPACE;; in main name, space fill onlyT)X; otherwise, treat period as bad char^-X; ...so fall thru to discover it is 'bad'hX;r :FDNP|!R> *;; rest of this part wild?H:FDNSTAR;; no+Q> ?;; yes...fill with single wild cards$(EXTSW;; at end of this portion?#E:FDOK;; force Y off of the '*'D:FDFILL;; just fillX;2X; if here, not one of the repeating charactersX; :FDNSTARR> ?;; the wild card?F:FDOK;; yesR> 0;; a numeric?)D:FDBAD;; no...bad char...end of name&R> 9;; maybe...numeric chk againD:FDOK;; yes...'0 to '9)M>;; not numeric...change lower case&R> A;; alpha?0D:FDBAD;; nope...kablooey:$R> Z;; maybe...try alpha againDD:FDOK;; yep...A to ZNX;X%X;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;bX;l(X; if bad character, fill with spacesvX; :FDBAD)Q> ;; ensure we go all the way to end PEXTSW#(> ;; is this bad char after...)F:FDEXIT;; we already have full name?';if here, no...need to keep fillingX; :FDSPACEQ> ;; space fill H:FDFILLX;/X; if here, is legitimate filename characterX; :FDOK 3;; so bump to next charX; 'X; now, put char in FNAME, if proper*X;4 :FDFILL>$(EXTSW;; at end of this portion?H0F:FDMAINLOOP;; yes...don't put char in FNAMER)PFNAME9;; no...finally, a legit char!\2;; to next characterfX;p"H:FDMAINLOOP;; and do it againzX;-X; have now stored 11 characters in FNAME!X; :FDEXIT%QFNAME;; what is first character?R> ;; a space?F:FNERR;; yes#$CURFCB;; can never forget this:;; no...name is decodedX;X;&X; oops...no characters in filenameX; ERFNAME :FNERR !@ERROR E.FN;;filename error X;