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 / CPM / ZCPR33 / S-Z / VFILER43.LBR / VFCMDS7.LZB / VFCMDS7.LIB
Text File  |  2000-06-30  |  10KB  |  508 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 any 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    'Group Print',0
  281.     jr    mass$run
  282.  
  283.  
  284. ; COMMAND: GV
  285.  
  286. ; View files tagged using the 't' command.
  287.  
  288. mass$view:
  289.     call    ermsg
  290.     db    'Group View',0
  291.  
  292.  
  293. ;---------------------------------------------------------------------------
  294.  
  295. ; Working Code for Group Routines
  296.  
  297. ; Main Entry Point for Mass Operation
  298. ;    On entry, MASSOP = C if copy,
  299. ;            D if delete
  300. ;            P if print
  301. ;            Q if usq,
  302. ;            V if view
  303. ;            M if Move
  304. ;            A if Archive
  305.  
  306. mass$run:
  307.     ld    hl,(ringpos)    ; Save position
  308.     ld    (sringpos),hl
  309.     ld    hl,(curat)
  310.     ld    (scurat),hl    ; Save cursor position
  311.     call    clrcur        ; Clear cursor
  312.     ld    hl,curhome
  313.     ld    (curat),hl    ; Home position
  314.     ld    hl,(ring)
  315.     ld    de,-eltsiz
  316.     add    hl,de
  317.     ld    (ringpos),hl    ; Set position
  318.  
  319. ; Set Flags for First Time Thru and Mass Operation
  320.  
  321.     xor    a        ; A=0
  322.     ld    (first$m),a    ; Set for prompt for dest with first file
  323.     dec    a        ; A=0ffh
  324.     ld    (mflag),a    ; This is a mass operation
  325.     jr    mass$olp0
  326.  
  327. ; Main Mass Operation Loop
  328.  
  329. mass$olp:
  330.     call    stag        ; If tagged, soft tag and redisplay name
  331.     call    psn$next    ; Advance cursor pointer
  332.  
  333. ; Advance the ring position
  334.  
  335. mass$olp0:
  336.     ld    hl,(ringpos)
  337.     ld    de,eltsiz
  338.     add    hl,de
  339.     ld    (ringpos),hl
  340.     ex    de,hl
  341.  
  342. ; Check for Loop Completion -- DE = Current RINGPOS
  343.  
  344. mass$olp1:
  345.     ld    hl,(ringend)    ; At ring end yet?
  346.     call    cmpdehl        ; Compare present position with end
  347.     jp    z,mass$olx    ; Done
  348.     call    mass$can    ; Cancel?
  349.     jp    nz,mass$olx    ; Exit on any keypress
  350.  
  351. ; Check for Tagged File at RINGPOS
  352.  
  353.     ld    hl,(ringpos)    ; Get position
  354.     ld    de,eltsiz-1    ; Get tag location
  355.     add    hl,de
  356.     ld    a,(hl)        ; Get tag
  357.     cp    tagch
  358.     jr    nz,mass$olp    ; Not tagged, so skip
  359.  
  360. ; Test RINGPOS within local ring (if not, make it so and rebuild screen)
  361.  
  362.     ld    hl,(ringpos)
  363.     ex    de,hl
  364.     ld    hl,(locbeg)
  365.     call    cmpdehl        ; Set carry if HL > DE
  366.     jr    c,newscr    ; New screen if so
  367.     ld    hl,(locend)
  368.     call    cmpdehl
  369.     jr    c,mass$sel0    ; Screen is ok
  370. newscr:
  371.     call    findscr        ; Find new local screen
  372.     call    rebuild        ; Rebuild it
  373.     or    a        ; Ensure no carry
  374. mass$sel0:
  375.     call    c,setcur    ; Set the cursor if not from newscr
  376.     call    dispcfn        ; Display current file name
  377.  
  378. ; Select Mass Operation
  379.  
  380. mass$sel:
  381.     ld    a,(massop)    ; Get type of mass operation
  382.     cp    'C'        ; 'c' = copy
  383.     jr    z,mass$oc    ; Do copy
  384.     cp    'P'        ; 'p' = print
  385.     jr    z,mass$op    ; Do print
  386.     cp    'Q'        ; 'q' = usq
  387.     jr    z,mass$oq    ; Do unsqueeze
  388.     cp    'V'        ; 'v' = view
  389.     jr    z,mass$ov    ; Do view
  390.     cp    'M'        ; 'M' = move
  391.     jr    z,mass$om    ; Do move
  392.     cp    'A'        ; 'A' = archive
  393.     jr    z,mass$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=no
  403.     jr    z,mass$olp    ; Skip to next if not
  404.  
  405.     ld    hl,(ringpos)    ; Blank out name of deleted file in ring
  406.     ld    b,eltsiz-2    ; Exclude disk letter and tag character
  407. mass$od1:
  408.     inc    hl
  409.     ld    (hl),'.'    ; Replace filename by row of dots
  410.     djnz    mass$od1
  411.     jr    mass$olp
  412.  
  413.  
  414. ; Do Mass Move - Current File Move
  415.  
  416. mass$om:
  417.     call    copy
  418.     jr    mass$od
  419.  
  420.  
  421. ; Do Mass Copy - Current File Copy
  422.  
  423. mass$oc:
  424.     call    copy        ; Do copy
  425.     jp    mass$olp    ; Loop until thru ring list
  426.  
  427.  
  428. ; Do Mass Archive - Copy and archive current file
  429.  
  430. mass$oa:
  431.     call    copy
  432.     ld    a,(cflag)    ; Was copy successful?
  433.     or    a
  434.     jp    z,mass$olp    ; If not, do not set archive bit
  435.  
  436.     ld    hl,(ringpos)
  437.     ld    de,11
  438.     add    hl,de
  439.     ld    a,128
  440.     or    (hl)
  441.     ld    (hl),a
  442.     ex    de,hl
  443.     ld    de,s$fcb    ; Source file control block
  444.     add    hl,de        ; Point to $ARC byte
  445.     ld    a,128
  446.     or    (hl)
  447.     ld    (hl),a
  448.     ld    c,attr
  449.     call    bdos        ; Set attributes
  450.     jp    mass$olp    ; Try again
  451.  
  452.  
  453. ; Do Mass Print - Current File Print
  454.  
  455. mass$op:
  456.     call    lstfile        ; Do print
  457.     jp    mass$olp    ; Loop until thru ring list
  458.  
  459.  
  460. ; Do Mass Usq - Current File Unsqueeze
  461.  
  462. mass$oq:
  463.     call    usq        ; Do unsqueeze
  464.     jp    mass$olp    ; Loop until thru ring list
  465.  
  466.  
  467. ; Do Mass View - Current File View
  468.  
  469. mass$ov:
  470.     call    view        ; Do view
  471.     jp    mass$olp    ; Loop until thru ring list
  472.  
  473.  
  474.  
  475. ; Exit Mass Operation Loop
  476.  
  477. mass$olx:
  478.     ld    hl,(sringpos)    ; Reset ring position
  479.     ld    (ringpos),hl
  480.     call    clrcur        ; Clear this cursor
  481.     ld    hl,(scurat)    ; Reset cursor position
  482.     ld    (curat),hl
  483.     call    setcur        ; Display old cursor
  484.  
  485.     ld    a,(massop)    ; Get group operation type.
  486.     cp    'D'        ; 'd' = delete
  487.     jp    z,runsh2
  488.     cp    'M'
  489.     jp    z,runsh2    ; Relog files, rebuild and get next command.
  490.  
  491. mass$olx1:
  492.     cp    'Q'        ; UnsQueeze
  493.     jp    z,runsh2    ; If unsQueeze, reload files showing new ones.
  494.     cp    'V'        ; 'v' = view
  495.     jp    z,runsh4    ; If view, rebuild display.
  496.     call    erclr        ; Otherwise, clear error message line.
  497.     jp    loopfn        ; Display current file, get next command.
  498.  
  499.  
  500. ; Cancel Mass Operation - Check any key, Return Zero if not
  501.  
  502. mass$can:
  503.     ld    e,255
  504.     ld    c,6
  505.     call    bdos
  506.     or    a
  507.     ret
  508.