home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / jsage / znode3 / z3util / for-nxt3.lbr / PERFORM.ZZ0 / PERFORM.Z80
Encoding:
Text File  |  1993-06-07  |  14.0 KB  |  659 lines

  1. ; PERFORM.Z80
  2. ; A ZCPR3 Utility to be used in concert with FOR.COM.
  3. ;
  4. ; Syntax:
  5. ;    ( FOR <args> )
  6. ;    PERFORM <command line>
  7. ;
  8. ; See the documentation for FOR.COM to review its arguments.
  9. ; The command line passed to PERFORM will be executed once for every line
  10. ; in FORFILES.SYS (which is created by FOR.COM).  The "$" character is an
  11. ; escape flag which begins two special symbols recognized by PERFORM.
  12. ; The special symbols and their meanings are:
  13. ;    $X    -- the current line from FORFILES.SYS
  14. ;    $|    -- a substitute multiple-command separator (";").
  15. ;
  16. ; Any pending commands in the multiple-command-line buffer will
  17. ; be saved when PERFORM is invoked and restored when it is completed.
  18. ;
  19. ; Author: Dreas Nielsen
  20. ; History:
  21. ;     Date     Version     Comments
  22. ;    ------    ---------    ----------
  23. ;    5/16/87      1.0        Created.  RDN.
  24. ;    6/3/87      1.1        Added call to PUTCST to allow flow control
  25. ;                processing under normal ZCPR3.
  26. ;
  27. ;
  28. VERS    EQU    11
  29. FALSE    EQU    0
  30. TRUE    EQU    NOT FALSE
  31. ;
  32. DEBUG    EQU    FALSE
  33. ;
  34. CR    EQU    0DH
  35. LF    EQU    0AH
  36. BELL    EQU    7
  37. CTRLZ    EQU    1AH
  38. EOF    EQU    1AH
  39. BDOS    EQU    5
  40. INFERR    EQU    1    ;error code for "can't open input file"
  41. OFERR    EQU    2    ;error code for "can't open output file"
  42. RDERR    EQU    3    ;error code for "can't read input file"
  43. WRTERR    EQU    4    ;error code for "can't write output file"
  44. CLZERR    EQU    5    ;error code for "can't close output file"
  45. PARMFL    EQU    '/'
  46. CMDLIN    EQU    080H
  47. SYSFCB    EQU    05CH
  48. BUFSIZ    EQU    16    ;16 128-byte sectors (2k) for I/O buffers
  49. FCBLEN    EQU    36
  50. BSZOFF    EQU    0    ;offset of buffer size indicator from I/O ctl block
  51. BADOFF    EQU    6    ;offset of buffer addr indic. from I/O ctl block start
  52. FCBOFF    EQU    8    ;offset of fcb from I/O ctl block start
  53. SYSFLG    EQU    '$'    ;Command-line escape character
  54. LINFLG    EQU    'X'    ;Escape argument for current FOR line.
  55. SUBSEP    EQU    '|'    ;Escape argument -- substitute command separator.
  56. CMDSEP    EQU    ';'    ;Real command separator.
  57. ;
  58. ;
  59. ; External Z3LIB and SYSLIB Routines
  60. ;
  61.     EXT    Z3INIT,GETSH2,SHPUSH,SHPOP,QSHELL,GETEFCB,PUTCL,PUTER2
  62.     EXT    GETCL2,RETUD,F$DELETE,PUTCST
  63.     EXT    CODEND,QPRINT,PRINT,SKSP,FXI$OPEN,FXO$OPEN
  64.     EXT    FX$GET,FX$PUT,FXI$CLOSE,FXO$CLOSE,F$RENAME
  65. ;
  66.     IF    DEBUG
  67.     EXT    PHL4HC
  68.     ENDIF
  69. ;
  70. ;
  71. ;----------------  Code  ----------------
  72. ;
  73.     db    'Z3ENV'        ;This is a ZCPR3 Utility
  74.     db    1        ;External Environment Descriptor
  75. z3eadr:
  76.     dw    00
  77. START:
  78.     ld    hl,(z3eadr)    ;pt to ZCPR3 environment
  79.     call    z3init        ;initialize the ZCPR3 Environment
  80. ;
  81. ; Save stack pointer and set a new one
  82. ;
  83.     LD    (SAVESP),SP
  84.     LD    HL,(6)        ;BDOS jump address
  85.     LD    DE,2056        ;size of ZCPR3
  86.     OR    A
  87.     SBC    HL,DE
  88.     LD    SP,HL
  89. ;
  90. ; Allocate buffers for byte-oriented file I/O, first line of file.
  91. ;
  92. SETBUFS:
  93.     CALL    CODEND
  94.     LD    (FIRSTLIN),HL
  95.     LD    DE,300H        ;For 1st line of FORFILES.SYS
  96.     ADD    HL,DE
  97.     LD    (INTLINE),HL    ;For skeleton command line.
  98.     LD    DE,200H
  99.     ADD    HL,DE
  100.     LD    (EXPLINE),HL    ;For expanded command line.
  101.     LD    DE,200H
  102.     ADD    HL,DE
  103.     LD    (INPLOC),HL
  104.     LD    B,BUFSIZ
  105.     CALL    FBINIT        ;allocate I/O ctl buffer for input
  106.     LD    (OUTPLOC),HL
  107.     CALL    FBINIT        ;allocate I/O ctl buffer for output
  108. ;
  109. ; Check for Shell Stack
  110. ;
  111.     CALL    GETSH2            ;get shell status
  112.     JR    NZ,START0        ;skip over shell init
  113.     CALL    PRINT
  114.     DB    'No Shell Stack',0
  115.     JP    EXIT
  116. ;
  117. ; See if this program was invoked as a shell
  118. ;
  119. START0:
  120.     CALL    QSHELL        ;find out from ZCPR3 environment
  121.     JP    Z,ISHELL    ;do not push onto stack if invoked as a shell
  122. ;
  123.     CALL    QPRINT
  124.     DB    'PERFORM v.',[VERS / 10]+'0','.',[VERS mod 10]+'0',CR,LF,0
  125. ;
  126. ; Store a null at end of command line.
  127.     LD    HL,CMDLIN
  128.     LD    A,(HL)
  129.     INC    HL
  130.     LD    E,A
  131.     XOR    A
  132.     LD    D,A
  133.     ADD    HL,DE
  134.     LD    (HL),A
  135. ;
  136. ; Now parse command line.
  137. ; First look for option character.  Only option is help, which is exclusive.
  138.     LD    HL,CMDLIN+1
  139.     CALL    SKSP
  140.     LD    A,(HL)
  141.     OR    A
  142.     JP    Z,HELP
  143.     CP    PARMFL
  144.     JP    Z,HELP
  145.     CP    '?'
  146.     JP    Z,HELP
  147. ;
  148. ; Set Name of Shell from External FCB if Possible or From Default if Not
  149. ;
  150. SETSHN:
  151.     CALL    SETDIR        ;set name of current directory.
  152.     CALL    GETEFCB        ;get ptr to external fcb
  153.     JR    Z,START2    ;no external FCB, so use default name
  154.     INC    HL        ;pt to program name
  155.     LD    DE,SHNAME    ;pt to string
  156.     LD    BC,8        ;8 chars
  157.     LDIR            ;copy into buffer
  158. ;
  159. ; Push Name of Shell onto Stack
  160. ;
  161. START2:
  162.     LD    HL,SHDISK    ;pt to name of shell
  163.     CALL    SHPUSH        ;push shell onto stack
  164.     JR    NZ,START3
  165. ;
  166. ; Save arguments and remaining commands from MCL buffer in PERFORM$.$$$
  167. ;
  168.     LD    HL,(OUTPLOC)
  169.     LD    DE,CTLFIL
  170.     CALL    INITNAM
  171.     LD    DE,(OUTPLOC)
  172.     CALL    FXO$OPEN
  173.     LD    HL,CMDLIN+1
  174.     CALL    SKSP
  175.     CALL    WRITLN
  176.     CALL    GETCL2
  177.     CALL    WRITLN
  178.     LD    A,EOF
  179.     CALL    FX$PUT
  180.     XOR    A        ;Truncate CL in memory
  181.     LD    (HL),A
  182.     CALL    FXO$CLOSE    ;Close PERFORM$.$$$
  183.     JR    ISHELL        ;Go init shell cmdline processing.
  184. ;
  185. ; Shell Stack Push Error
  186. ;
  187. START3:
  188.     CP    2        ;shell stack full?
  189.     JR    NZ,START4
  190. ;
  191. ; Shell Stack is Full
  192. ;
  193.     CALL    PRINT
  194.     DB    'Shell Stack Full',0
  195.     JR    EXIT
  196. ;
  197. ; Shell Stack Entry Size is too small for command line
  198. ;
  199. START4:
  200.     CALL    PRINT
  201.     DB    'Shell Stack Entry Size is too Small',0
  202. ;
  203. EXIT:    LD    HL,(SAVESP)
  204.     LD    SP,HL
  205.     RET
  206. ;
  207. ;
  208. ;----------------
  209. ; Program invoked as shell--
  210. ;
  211. ISHELL:
  212. ;
  213. ; Look for PERFORM$.$$$; open if available or pop shell if not.
  214. ;
  215.     XOR    A
  216.     CALL    PUTCST
  217.     LD    HL,(INPLOC)
  218.     LD    DE,CTLFIL
  219.     CALL    INITNAM
  220.     LD    DE,(INPLOC)
  221.     CALL    FXI$OPEN
  222.     JR    Z,SHEXIT
  223.     LD    HL,(INTLINE)
  224.     CALL    READLN
  225.     JR    NZ,SHELL1
  226.     CALL    PRINT
  227.     DB    'Temporary file empty.',CR,LF,0
  228.     JR    SHEXIT
  229. SHELL1:    CALL    FXI$CLOSE
  230. ;
  231. ; Get next line from FORFILES.SYS if it exists.
  232. ;
  233.     CALL    READNAM
  234.     JR    Z,SHEXIT
  235. ;
  236. ; Expand skeleton command line read from PERFORM$.$$$.
  237. ;
  238.     LD    HL,(INTLINE)
  239.     LD    DE,(EXPLINE)
  240. EXPAND:    LD    A,(HL)
  241.     CP    SYSFLG
  242.     JR    NZ,EXP2
  243.     CALL    SYSFIL        ;Do expansion
  244.     JR    EXPAND
  245. EXP2:    LD    (DE),A
  246.     INC    HL
  247.     INC    DE
  248.     OR    A
  249.     JR    NZ,EXPAND
  250. ;
  251. ; Now store command line in MCL buffer and exit without popping shell.
  252. ;
  253.     LD    HL,(EXPLINE)
  254.     CALL    PUTCL
  255.     JP    EXIT
  256. ;
  257. ;----------------
  258. ;
  259. ; Pop shell and restore command line.
  260. ;
  261. SHEXIT:
  262.     CALL    RESTORE
  263.     JP    EXIT
  264. ;
  265. ; Restore command line and erase temporary file.
  266. ;
  267. RESTORE:
  268.     CALL    SHPOP
  269.     LD    HL,(INPLOC)    ;Get command line from temporary file.
  270.     LD    DE,CTLFIL
  271.     CALL    INITNAM
  272.     LD    DE,(INPLOC)
  273.     CALL    FXI$OPEN
  274.     JR    NZ,RSTR1
  275.     CALL    PRINT
  276.     DB    CR,LF,'Can''t restore command line.',CR,LF,0
  277.     JR    RSTR3
  278. RSTR1:    LD    HL,(EXPLINE)
  279.     CALL    READLN
  280.     JR    Z,RSTR4
  281.     CALL    READLN
  282.     JR    Z,RSTR4
  283.     CALL    PUTCL
  284.     JR    RSTR2
  285. RSTR4:    CALL    PRINT
  286.     DB    'Temporary file empty or damaged.',CR,LF,0
  287. RSTR2:    LD    DE,(INPLOC)
  288.     CALL    FXI$CLOSE
  289.     CALL    DELINF
  290. RSTR3:    CALL    SETDIR        ;Make sure we always get back where we started
  291.     LD    HL,SHNAME-1
  292.     XOR    A
  293.     LD    (HL),A
  294.     LD    HL,SHDISK
  295.     CALL    PUTCL
  296.     LD    A,0C9H        ;RET instruction
  297.     LD    (RESTORE),A    ;So this routine is called only once.
  298.     RET
  299. ;
  300. ;----------------
  301. ;
  302. ; Print help message and exit.
  303. ;
  304. HELP:
  305.     CALL    PRINT
  306.     DB    'Performs a command line once for every item specified with FOR.COM',CR,LF
  307.     DB    'Syntax:',CR,LF
  308.     DB    '    PERFORM <cmd_line>',CR,LF
  309.     DB    'Two special symbols may be used in the command line:',CR,LF
  310.     DB    '    $X - Substitute the current "FOR" item',CR,LF
  311.     DB    '    $| - Substitute a command separator (;)',CR,LF
  312.     DB    0
  313.     JP    EXIT
  314. ;
  315. ;
  316. ;========================  SUBROUTINES  =============================
  317. ;
  318. ; Set DU of current directory at SHDISK.
  319. ;
  320. SETDIR:
  321.     CALL    RETUD        ;Shell always returns to current directory.
  322.     LD    HL,SHDISK    ;pt to shell disk
  323.     LD    A,B        ;get disk
  324.     ADD    'A'        ;convert to letter
  325.     LD    (HL),A        ;set disk letter
  326.     INC    HL        ;pt to user 10's
  327.     LD    A,C        ;get user number
  328.     LD    B,10        ;subtract 10's
  329.     LD    D,'0'        ;set char
  330. SETDIR1:
  331.     SUB    B        ;subtract
  332.     JR    C,SETDIR2
  333.     INC    D        ;increment digit
  334.     JR    SETDIR1
  335. SETDIR2:
  336.     ADD    A,B        ;get 1's
  337.     LD    (HL),D        ;set 10's digit for user
  338.     INC    HL        ;pt to 1's digit
  339.     ADD    '0'        ;compute 1's digit
  340.     LD    (HL),A        ;set 1's digit
  341.     RET
  342. ;
  343. ;----------------
  344. ;
  345. ; Read first line of FORFILES.SYS into FIRSTLIN buffer.
  346. ; If file doesn't exist or is empty, return A=0 and Z; else return A<>0 & NZ.
  347. ;
  348. READNAM:
  349. ;
  350. ; Initialize the I/O control buffers with names for R/W of FORFILES.SYS.
  351. ;
  352.     LD    HL,(INPLOC)
  353.     LD    DE,INFNAM
  354.     CALL    INITNAM
  355.     LD    HL,(OUTPLOC)
  356.     LD    DE,OFNAM
  357.     CALL    INITNAM
  358. ;
  359. ; Open the files.
  360. ;
  361.     LD    DE,(INPLOC)
  362.     CALL    FXI$OPEN
  363.     RET    Z
  364.     LD    DE,(OUTPLOC)
  365.     CALL    FXO$OPEN
  366. ;
  367. ; Read line.
  368. ;
  369.     LD    HL,(FIRSTLIN)    ;place to put characters
  370.     CALL    READLN
  371.     RET    Z
  372. ;
  373. ; Copy remainder of input file to output file.
  374. ;  First flush any remaining eoln chars from input file.
  375. COPY:    CALL    FX$GET
  376.     JR    Z,NOCHARS    ;no more chars
  377.     CP    EOF
  378.     JR    Z,NOCHARS
  379.     CALL    EOLN
  380.     JR    Z,COPY
  381. ;                ;there's a legit char in A
  382.     LD    HL,(OUTPLOC)    ;write it out
  383.     EX    DE,HL        ;swap buffer pointers
  384.     CALL    FX$PUT
  385.     JR    Z,OUTERR    ;can't write output file
  386. ;                ;now write the rest of the chars
  387. COPY1:    EX    DE,HL        ;input ptr in DE
  388.     CALL    FX$GET
  389.     JR    Z,CLOSEM    ;done
  390.     EX    DE,HL        ;output ptr in DE
  391.     CALL    FX$PUT
  392.     JR    NZ,COPY1
  393. ;
  394. OUTERR:    LD    A,WRTERR    ;do this if error in writing
  395.     CALL    PUTER2
  396.     IF    DEBUG
  397.     CALL    ERRADR
  398.     ENDIF
  399.     CALL    PRINT
  400.     DB    'Can''t write output file',CR,LF,0
  401. ;
  402. CLOSEM:    LD    DE,(INPLOC)    ;do this if any chars written to output
  403.     CALL    FXI$CLOSE
  404.     LD    DE,(OUTPLOC)
  405.     CALL    FXO$CLOSE
  406.     JR    NZ,CHGNAM    ;continue if no error
  407.     LD    A,CLZERR
  408.     CALL    PUTER2        ;if can't close output file, set flag...
  409.     IF    DEBUG
  410.     CALL    ERRADR
  411.     ENDIF
  412.     CALL    PRINT        ;...print err msg...
  413.     DB    'Can''t close output file',CR,LF,0
  414.     CALL    DELINF        ;...delete input file,
  415. GOTLIN:    XOR    A
  416.     DEC    A        ;Signal that a line has been read.
  417.     RET
  418. ;
  419. ; If no chars written to output file, close and erase the files and pop
  420. ; the shell.
  421. ;
  422. NOCHARS:
  423.     LD    DE,(INPLOC)
  424.     CALL    FXI$CLOSE
  425.     CALL    DELINF
  426.     LD    DE,(OUTPLOC)
  427.     CALL    FXO$CLOSE
  428.     LD    HL,FCBOFF
  429.     ADD    HL,DE
  430.     EX    DE,HL
  431.     CALL    F$DELETE
  432.     CALL    RESTORE
  433.     JR    GOTLIN        ;Return with OK flag.
  434. ;
  435. ; Delete input file and rename output file to infilename
  436. CHGNAM:    CALL    DELINF
  437.     PUSH    DE        ;save input fcb addr
  438.     LD    HL,(OUTPLOC)
  439.     LD    DE,FCBOFF
  440.     ADD    HL,DE
  441.     POP    DE
  442.     EX    DE,HL
  443.     CALL    F$RENAME
  444.     JR    GOTLIN        ;Return with OK flag.
  445. ;
  446. ;----------------
  447. ;
  448. ; Write line pointed to by HL to output file.  Terminating null is translated
  449. ; to CR/LF pair.
  450. ;
  451. WRITLN:
  452.     PUSH    DE
  453.     PUSH    HL
  454.     LD    DE,(OUTPLOC)
  455. WRTLN1:    LD    A,(HL)
  456.     OR    A
  457.     JR    Z,WRTLN2
  458.     CALL    FX$PUT
  459.     INC    HL
  460.     JR    WRTLN1
  461. WRTLN2:    LD    A,CR
  462.     CALL    FX$PUT
  463.     LD    A,LF
  464.     CALL    FX$PUT
  465.     POP    HL
  466.     POP    DE
  467.     RET
  468. ;
  469. ;----------------
  470. ;
  471. ; Read line from input file into buffer pointed to by HL.
  472. ; Return A=00 and Z if file empty or no more input (file will also be deleted
  473. ; in this case).
  474. ;
  475. READLN:
  476.     PUSH    HL
  477.     LD    DE,(INPLOC)
  478. RD3:    CALL    FX$GET        ;see if file empty or leading eoln chars
  479.     JR    Z,RD5        ;read error must be physical eof
  480.     CP    EOF        ;if it's the end of the file...
  481.     JR    Z,RD5        ;...quit and clean up
  482.     CP    CR
  483.     JR    Z,RD4
  484.     LD    (HL),A
  485.     INC    HL
  486. RD1:    CALL    FX$GET        ;now get rest of line
  487.     JR    Z,RD2        ;physical eof, but we've gotten at least 1 char
  488.     CP    CR
  489.     JR    Z,RD4
  490.     CP    EOF        ;...or EOF?
  491.     JR    Z,RD2        ;if so, quit
  492.     LD    (HL),A
  493.     INC    HL        ;else point to addr for next char
  494.     JR    RD1        ;and get it
  495. ;
  496. RD4:    CALL    FX$GET        ;Get 2nd EOLN char (LF).
  497. RD2:    XOR    A        ;Return with line read.
  498.     LD    (HL),A        ;terminate the line
  499.     DEC    A        ;Signal OK -- line read.
  500.     POP    HL
  501.     RET
  502. ;
  503. RD5:    CALL    FXI$CLOSE    ;Return without line read.
  504.     CALL    DELINF        ;delete the input file
  505.     XOR    A        ;signal no more input
  506.     POP    HL
  507.     LD    (HL),A
  508.     RET
  509. ;
  510. ;----------------
  511. ;
  512. ; Initialize file I/O control buffers.
  513. ; Enter with  HL = first free address in memory
  514. ;             B  = number of 128-byte sectors for the file buffer
  515. ; Return:     HL = first free address after buffer
  516. ;
  517. FBINIT:
  518.     PUSH    DE
  519.     PUSH    BC
  520.     LD    (HL),B
  521.     LD    DE,BADOFF    ;loc of buf addr in I/O ctl block
  522.     ADD    HL,DE
  523.     PUSH    HL
  524.     LD    DE,[FCBLEN + FCBOFF - BADOFF]
  525.     ADD    HL,DE
  526.     EX    DE,HL
  527.     POP    HL
  528.     LD    (HL),E
  529.     INC    HL
  530.     LD    (HL),D
  531.     EX    DE,HL        ;get buf start addr in HL
  532.     LD    DE,128        ;incr HL by buf len in bytes
  533. FBINI1:    ADD    HL,DE
  534.     DJNZ    FBINI1
  535.     POP    BC
  536.     POP    DE
  537.     RET
  538. ;
  539. ;----------------
  540. ; Move filename into fcb of I/O ctl block.  Enter with HL = I/O ctl blk addr,
  541. ; DE = addr of string to move.  Drive is set to current.
  542. INITNAM:
  543.     PUSH    BC
  544.     PUSH    DE        ;save while adding fcb offset
  545.     LD    DE,FCBOFF
  546.     ADD    HL,DE        ;point to input fcb
  547.     XOR    A        ;set current drive
  548.     LD    (HL),A
  549.     INC    HL        ;point to name field of fcb
  550.     POP    DE        ;get source addr
  551.     EX    DE,HL        ;put dest addr in DE, source in HL
  552.     LD    BC,11
  553.     LDIR
  554.     POP    BC        ;restore original contents
  555.     RET
  556. ;
  557. ;----------------
  558. ; Delete input file (file pointed to by INPLOC)
  559. DELINF:    LD    HL,(INPLOC)
  560.     LD    DE,FCBOFF
  561.     ADD    HL,DE
  562.     EX    DE,HL
  563.     CALL    F$DELETE
  564.     RET
  565. ;
  566. ;----------------
  567. ;
  568. ; Check for end of line -- CR or LF.  Return Z if true.
  569. EOLN:    CP    CR
  570.     RET    Z
  571.     CP    LF
  572.     RET
  573. ;
  574. ;----------------
  575.     IF    DEBUG
  576. ;
  577. ; Write the return address on the console
  578. ;
  579. ERRADR:    CALL    PRINT
  580.     DB    CR,LF,'Error at ',0
  581.     EX    (SP),HL
  582.     CALL    PHL4HC
  583.     EX    (SP),HL
  584.     RET
  585. ;
  586.     ENDIF
  587. ;
  588. ;----------------
  589. ;
  590. ; The following routine expands "$X" and "$|" references.
  591. ; Inputs : HL contains a pointer to the command line being interpreted;
  592. ;       DE points to the string being built.
  593. ; Outputs: HL points to the next char in the CL to interpret.
  594. ;       DE points to the next location to fill in the CL being built
  595. ; If the next character in the line is not one of the recognized flags, it
  596. ; is passed through unchanged (but the "$" will not be).
  597. ;
  598. SYSFIL:
  599.     INC    HL        ;point to next character
  600.     LD    A,(HL)        ;get character
  601.     OR    A        ;end of line?
  602.     RET    Z
  603.     CP    SUBSEP
  604.     JR    NZ,SYSFIL1
  605.     LD    A,CMDSEP
  606.     LD    (DE),A
  607.     INC    DE
  608.     INC    HL
  609.     RET
  610. SYSFIL1:
  611.     CP    LINFLG
  612.     JR    NZ,SYSFIL4
  613.     INC    HL
  614.     PUSH    HL
  615.     LD    HL,(FIRSTLIN)
  616. SYSFIL2:
  617.     LD    A,(HL)
  618.     OR    A
  619.     JR    Z,SYSFIL3
  620.     INC    HL
  621.     LD    (DE),A
  622.     INC    DE
  623.     JR    SYSFIL2
  624. SYSFIL3:
  625.     POP    HL
  626.     RET
  627. SYSFIL4:
  628.     LD    (DE),A
  629.     INC    HL
  630.     INC    DE
  631.     RET
  632. ;
  633. ;
  634. ;================[  Buffers  ]================
  635. ;
  636. SAVESP:    DS    2
  637. FIRSTLIN:
  638.     DS    2        ;Ptr to 1st line from FORFILES.SYS.
  639. INTLINE:
  640.     DS    2        ;Ptr to skeleton command line from PERFORM$.$$
  641. EXPLINE:
  642.     DS    2        ;Ptr to expanded command line.
  643. INPLOC:
  644.     DS    2        ;Ptr to file buffer for reading.
  645. OUTPLOC:
  646.     DS    2        ;Ptr to file buffer for writing.
  647. INFNAM:    DB    'FORFILESS','Y'+80H,'S'        ;file should be system
  648. OFNAM:    DB    'FORFILES'
  649. OUTTYP:    DB    '$$$'
  650. CTLFIL:    DB    'PERFORM$$','$'+80H,'$'        ;Control file.
  651. SHDISK:
  652.     db    'A'        ;disk letter
  653.     db    '00'        ;user number
  654.     db    ':;'        ;separator
  655. SHNAME:
  656.     db    'PERFORM ',0    ;name of shell to go onto stack
  657. ;
  658.     END    START
  659.