home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / ZSYS / SIMTEL20 / ZCPR3 / VFILR4-2.LBR / VFCMDS7.ZZ0 / VFCMDS7.Z8°
Text File  |  2000-06-30  |  10KB  |  505 lines

  1. ;===========================================================================
  2. ;
  3. ; VFCMDS7.Z80 - Group Operations
  4. ;
  5. ;===========================================================================
  6.  
  7. ; * * *COMMAND: G
  8.  
  9. ; Group operation
  10.  
  11. group$op:
  12.     call    cprmpt
  13.     db    'Group: (A,C,D,M,A,F,Q,P,V,T,U) ',0
  14.     call    keyin        ; Get response
  15.     ld    (massop),a    ; Save command for mass$olp
  16.     ld    b,a        ; Get command in b
  17.     ld    hl,gtable    ; Pt to table
  18.     call    ctpr1        ; Process command
  19.     jp    loop        ; Resume if not found
  20.  
  21. ; Group Command Table
  22.  
  23. gtable:
  24.     db    'C'
  25.     db    0        ; (wheel)
  26.     dw    mass$copy
  27.  
  28.     db    'M'
  29.     db    0        ; (wheel)
  30.     dw    mass$move
  31.  
  32.     db    'D'
  33.     db    0        ; (wheel)
  34.     dw    mass$del
  35.  
  36.     db    'A'        ; Archive
  37.     db    0        ; (wheel)
  38.     dw    mass$arc
  39.  
  40.     db    'F'
  41.     db    0ffh        ; (safe)
  42.     dw    mass$fsize
  43.  
  44.     db    'P'
  45.     db    0        ; (wheel)
  46.     dw    mass$prt
  47.  
  48.     db    'Q'
  49.     db    0        ; (wheel)
  50.     dw    mass$usq
  51.  
  52.     db    'T'
  53.     db    0ffh        ; (safe)
  54.     dw    mass$tag
  55.  
  56.     db    'U'
  57.     db    0ffh        ; (safe)
  58.     dw    mass$untag
  59.  
  60.     db    'V'
  61.     db    0ffh        ; (safe)
  62.     dw    mass$view
  63.  
  64.     db    0        ; End of table
  65.  
  66.  
  67. ;---------------------------------------------------------------------------
  68.  
  69. ; Group File Tagging and Untagging Commands
  70.  
  71.  
  72. ; COMMAND: GT
  73.  
  74. mass$tag:
  75.     ld    b,tagch        ; Tag char
  76.     jr    masstu        ; Do work
  77.  
  78.  
  79. ; COMMAND: GU
  80.  
  81. mass$untag:
  82.     ld    b,' '        ; Untag char
  83.  
  84. ; Common Entry Point for Mass Untag/Tag: Reg B = Untag/Tag Char
  85.  
  86. masstu:
  87.     push    bc        ; Save tag char
  88.     ld    de,d$fcb    ; init this fcb to *.*
  89.     push    de        ; need it later
  90.     inc    de
  91.     ld    hl,joker    ; move the '?'s in
  92.     ld    b,11    
  93.     call     movec
  94.     pop    de        ; point to the fcb again
  95.     jp    wtagen        ; enter wildcard tag/untag with *.*
  96.  
  97.  
  98. ;---------------------------------------------------------------------------
  99.  
  100. ; File Size Group Command
  101.  
  102.  
  103. ; COMMAND: GF
  104.  
  105. mass$fsize:
  106.     call    workmsg        ; Print 'working' msg
  107.     ld    hl,0        ; Zero total
  108.     ld    (tag$tot),hl
  109.     ld    hl,(ringpos)    ; Save ring position
  110.     ld    (sringpos),hl
  111.     ld    hl,(ring)    ; Set new ring position
  112.     ld    (ringpos),hl
  113.  
  114. ; Main Loop to Compute File Sizes
  115.  
  116. mass$fs:
  117.     ld    hl,(ringend)    ; At end of ring?
  118.     ex    de,hl
  119.     ld    hl,(ringpos)
  120.     call    cmpdehl        ; Same if so
  121.     jr    z,mass$fs2
  122.     ld    de,eltsiz-1    ; Pt to tag
  123.     add    hl,de
  124.     ld    a,(hl)        ; Get tag
  125.     inc    hl        ; Pt to next file
  126.     cp    tagch        ; Tagged?
  127.     jr    nz,mass$fs1    ; Skip if not tagged
  128.  
  129. ; Compute Size of Tagged File
  130.  
  131.     push    hl        ; Save ptr to next file
  132.     call    sizer        ; Compute file size
  133.     ex    de,hl        ; Size in de
  134.     ld    hl,(tag$tot)    ; Get total
  135.     add    hl,de
  136.     ld    (tag$tot),hl    ; New total
  137.     pop    hl        ; Get ptr to next file
  138. mass$fs1:
  139.     ld    (ringpos),hl    ; Set ptr to next file
  140.     jr    mass$fs
  141.  
  142. ; File Size Accumulation Done - Print Result
  143.  
  144. mass$fs2:
  145.     ld    hl,(sringpos)    ; Restore ring position
  146.     ld    (ringpos),hl
  147.     call    fsnote        ; Print file size message
  148.     call    vprint        ; Print specific
  149.     db    'Tagged Files is ',0
  150.     ld    hl,(tag$tot)    ; Get total
  151.     jp    fsize1        ; Print size in hl and return
  152.  
  153. ;---------------------------------------------------------------------------
  154.  
  155. ; Group File Deletion
  156.  
  157.  
  158. ; COMMAND: GD
  159.  
  160. mass$del:
  161.     call    cprmpt
  162.     db    'Group Delete (Yes/No/Verify)? ',0
  163.     call    keyin        ; Get response
  164.     cp    'Y'
  165.     jr    z,md1
  166.     cp    'V'
  167.     jp    nz,loop        ; Return to position
  168. md1:
  169.     ld    (mdflg),a    ; Set flag
  170.     jp    mass$run
  171.  
  172. ;---------------------------------------------------------------------------
  173.  
  174. ; Group Archive, Copy, Squeeze, and Move
  175.  
  176.  
  177. ; COMMAND: GA - Untag any tagged files that are already archived, set aflag if
  178. ; any files remain tagged, then exit to mass copy.  Copy will set archive
  179. ; attribute on source at end of copy.
  180.  
  181. mass$arc:
  182.     ld    hl,(ringpos)
  183.     ld    (sringpos),hl
  184.     ld    hl,(curat)
  185.     ld    (scurat),hl
  186.     xor    a
  187.     ld    (aflag),a    ; Clear archive flag
  188.     ld    hl,(ring)    ; Top of ring
  189.     ld    de,-eltsiz    ; One element
  190.     add    hl,de        ; Back up
  191.     ld    (ringpos),hl    ; Start here
  192.  
  193. archive:
  194.     ld    hl,(ringpos)
  195.     ld    de,eltsiz
  196.     add    hl,de
  197.     ld    (ringpos),hl
  198.     ld    de,(ringend)
  199.     call    cmpdehl
  200.     jr    z,mass$arx
  201.  
  202. ; Untag g tagged files that are already archived
  203.  
  204.     ld    de,eltsiz-1    ; Point to tag byte
  205.     add    hl,de
  206.     ld    a,(hl)
  207.     cp    tagch
  208.     jr    nz,archive    ; If not tagged, go on to next file
  209.     dec    hl        ; Check archive byte
  210.     ld    a,80h
  211.     and    (hl)        ; High bit set on 3rd char of file type?
  212.     jr    nz,archive1    ; If so, jump (file is already archived)
  213.     ld    a,0ffh        ; Set aflag to show at least one file to copy
  214.     ld    (aflag),a
  215.     jr    archive        ; On to next file in ring
  216. archive1:            ; File is already archived
  217.     inc    hl        ; Back to tag byte
  218.     ld    (hl),stagch    ; Change tag to soft tag
  219.     jr    archive        ; On to next file in ring
  220.  
  221. mass$arx:
  222.     ld    hl,(sringpos)
  223.     ld    (ringpos),hl
  224.     ld    hl,(scurat)
  225.     ld    (curat),hl
  226.     ld    a,(aflag)
  227.     or    a
  228.     push    af
  229.     call    refresh        ; Show remaining tagged files
  230.     pop    af
  231.     jr    z,noarchive    ; Nothing to do
  232.     call    ermsg
  233.     db    'Group Archive',0
  234.     jr    mass$run
  235. noarchive:
  236.     call    ermsg
  237.     db    'All Tagged Files ARE Archived.',0
  238.     jp    loop        ; Next command
  239.  
  240.  
  241. ; COMMAND: GC
  242.  
  243. ; Copy files tagged using the 't' command.
  244.  
  245. mass$copy:
  246.     call    ermsg
  247.     db    'Group Copy',0
  248.     jr    mass$run
  249.  
  250.  
  251. ; COMMAND: GQ
  252.  
  253. ; Unsqueeze files tagged using the 't' command.
  254.  
  255. mass$usq:
  256.     call    ermsg
  257.     db    'Group usQ',0
  258.     jr    mass$run
  259.  
  260.  
  261. ; COMMAND: GM
  262.  
  263. ; Copy tagged files, then erase the source
  264.  
  265. mass$move:
  266.     call    ermsg
  267.     db    'Group Move',0
  268.     jr    mass$run
  269.  
  270.  
  271. ;---------------------------------------------------------------------------
  272.  
  273. ; Group Print and View Commands
  274.  
  275.  
  276. ; COMMAND: GP
  277.  
  278. mass$prt:
  279.     call    ermsg
  280.     db    'G
  281.     db    'Grint',0
  282.     jr    mass$run
  283.  
  284.  
  285. ; COMMAND: GV
  286.  
  287. ; View files tagged using the 't' command.
  288.  
  289. mass$view:
  290.     call    ermsg
  291.     db    'Group View',0
  292.  
  293.  
  294. ;---------------------------------------------------------------------------
  295.  
  296. ; Working Code for Group Routines
  297.  
  298. ; Main Entry Point for Mass Operation
  299. ;    On entry, MASSOP = C if copy,
  300. ;            D if delete
  301. ;            P if print
  302. ;            Q if usq,
  303. ;            V if view
  304. ;            M if Move
  305. ;            A if Archive
  306.  
  307. mass$run:
  308.     ld    hl,(ringpos)    ; Save position
  309.     ld    (sringpos),hl
  310.     ld    hl,(curat)
  311.     ld    (scurat),hl    ; Save cursor position
  312.     call    clrcur        ; Clear cursor
  313.     ld    hl,curhome
  314.     ld    (curat),hl    ; Home position
  315.     ld    hl,(ring)
  316.     ld    de,-eltsiz
  317.     add    hl,de
  318.     ld    (ringpos),hl    ; Set position
  319.  
  320. ; Set Flags for First Time Thru and Mass Operation
  321.  
  322.     xor    a        ; A=0
  323.     ld    (first$m),a    ; Set for prompt for dest with first file
  324.     dec    a        ; A=0ffh
  325.     ld    (mflag),a    ; Thisg t a mass operation
  326.     jr    mass$olp0
  327.  
  328. ; Main Mass Operation Loop
  329.  
  330. mass$olp:
  331.     call    stag        ; If tagged, soft tag and redisplay name
  332.     call    psn$next    ; Advance cursor pointer
  333.  
  334. ; Advance the ring position
  335.  
  336. mass$olp0:
  337.     ld    hl,(ringpos)
  338.     ld    de,eltsiz
  339.     add    hl,de
  340.     ld    (ringpos),hl
  341.     ex    de,hl
  342.  
  343. ; Croup Pk for Loop Completion -- DE = Current RINGPOS
  344.  
  345. mass$olp1:
  346.     ld    hl,(ringend)    ; At ring end yet?
  347.     call    cmpdehl        ; Compare present position with end
  348.     jp    z,mass$olx    ; Done
  349.     call    mass$can    ; Cancel?
  350.     jp    nz,mass$olx    ; Exit on call    cmkeypress
  351.  
  352. ; Croup Pk for Tagged File at RINGPOPO
  353.  
  354.     ld    hl,(ringpos)    ; Get position
  355.     ld    de,eltsiz-1    ; Get tag location
  356.     add    hl,de
  357.     ld    a,(hl)        ; Get tag
  358.     cp    tagch
  359.     jr        rass$olp    ; Not tagged, so skip
  360.  
  361. ; Test RINGPOS within local ring (if not, make it so and rebuild screen)
  362.  
  363.     ld    hl,(ringpos)
  364.     ex    de,hl
  365.     ld    hl,(locbeg)
  366.     call    cmpdehl        ; Set carry if HL > DE
  367.     jr    c,newscr    ; New screen if so
  368.     ld    hl,(locend)
  369.     call    cmpdehl
  370.     jr    c,mass$sel0    ; Screeng t ok
  371. newscr:
  372.     call    findscr        ; Find new
  373.  
  374. ; Crocal screen
  375.     call    rebuild        ; Rebuild it
  376.     or    a        ; Ensure no carry
  377. mass$sel0:
  378.     call    c,setcur    ; Set the cursor if not from newscr
  379.     call    dispcfn        ; Display current file name
  380.  
  381. ; Select Mass Operation
  382.  
  383. mass$sel:
  384.     ld    a,(massop)    ; Get type of mass operation
  385.     cp    'C'        ; 'c' = copy
  386.     jr    z,mass$oc    ; Do copy
  387.     cp    'P'        ; 'p' = print
  388.     jr    z,mass$op    ; Do print
  389.     cp    'Q'        ; 'q' = usqL ass$oq    ; Do unsqueeze
  390.     cp    'V'        ; 'v' = view
  391.     jr    z,mass$ov    ; Do view
  392.     cp    'M'        ; 'M' = moveL ass$om    ; Do move
  393.     cp    'A'        ; 'A' = archiveL ass$oa    ; Do archive
  394.  
  395.  
  396. ; Do Mass Delete - Current File Delete
  397.  
  398. mass$od:
  399.     call    delete        ; Delete filename at ringpos
  400.  
  401.     ld    a,(delcode)    ; Deletion done?
  402.     or    a        ; 0=noL ass$olp    ; Skip to next if not
  403.  
  404.     ld    hl,(ringpos)    ; Blank out name of deleted file in ring
  405.     ld    b,eltsiz-2    ; Exclude disk letter and tag character
  406. mass$od1:
  407.     inc    hl
  408.     ld    (hl),'.'    ; Replace filename by row of dots
  409.     djnz    mass$od1
  410.     jp    mass$olp
  411.  
  412.  
  413. ; Do Mass Move - Current File Move
  414.  
  415. mass$om:
  416.     call    copy
  417.     jr    mass$od
  418.  
  419.  
  420. ; Do Mass Copy - Current File Copy
  421.  
  422. mass$oc:
  423.     call    copy        ; Do c
  424.     o
  425.     jp    m
  426.     jp    m    ; Loop until thru ring
  427.  
  428. ; Crist
  429.  
  430.  
  431. ; Do Mass Archiveiveopy and archive current file
  432.  
  433. mass$oa:
  434.     call    copy
  435.     ld    a,(cflag)    ; Was copy successful?
  436.     or    a
  437.     jp    z,    z,p    ; If not, do not set archive bit
  438.  
  439.     ld    hl,(ringpos)
  440.     ld    de,11
  441.     add    hl,de
  442.     ld    a,128eengr    (hl)
  443.     ld    )
  444.     ld    ,a
  445.     ex    de, isd    de,s$fcb    ; Source file control block
  446.     add    hl,de        ;Snt to $ARC byte
  447.     ld    a,en)d    hl,(r
  448.     or    or    
  449.     ld    (hl),a
  450.     ld    c,attr
  451.     call    bdos        ; Set attributes
  452.     jp    jp        ; Try again
  453.  
  454.  
  455. ; Do Mass Print - Currennewle Print
  456.  
  457. mass$op:
  458.     call    lstfile        ; Do print
  459.     jp        jp    ; Loop until thru ring and astst Mass Usq
  460.     adurrent File Unsqueeze
  461.  
  462. mass$oq:
  463.     call    usq        ; Do unsqueeze
  464.     jp    mass$olp    ; Loopoopil thru ring lististMass 
  465.     pop
  466.     adu
  467.     adu File View
  468.  
  469. mass$ov:
  470.     call    view        ; Do viewviewss$o    jp    ;; L; L
  471.     jp    m
  472. l oopiu u li
  473.  
  474. mas
  475.  
  476.  
  477.  
  478. ; Exit Mass Operation Loop
  479.  
  480. mass$olx:
  481.     ld    hl,(sringpos)    ; Reset et position
  482.     ld    (ringpos),hl
  483.     call    clrcur        ; Clear topycursor
  484.     ld    hl,(scurat)    ; Reset cursor position
  485.     ld    (curat),hiewall    setcur        ; Display old d 
  486.  
  487.     ld    a,(massop)    ; Get group operation type.
  488.     cp    'D'        ; 'd' = delete
  489.     jp    z,runsh2nz,m'M'
  490.     jp    z,p    z,h2    ; Relog files, rebuild and get next command.
  491.  
  492. mar tox1:nz,m'Q'        ; UnsQueez'Q    z,at)    2    ; If unsQueeze    mass$ol; L
  493. ad files showing  setonesnd.cp    'V'        ; 'v' = li
  494.     jp    z,at)    4    ; If viewwinbuild display.
  495.     call    erclr        ; Otherwise, clear error message and anend.jp    loopfn        ; Display current file, ild a next command.
  496.  
  497.  
  498. ; Cancelring Opedo n - Croup Pk call    cmkey, Return Zero if not
  499.  
  500. mass$can:
  501.     ld    e,255
  502.     ld    c,6
  503.     call    bdoseengr    a
  504.     ret
  505.