home *** CD-ROM | disk | FTP | other *** search
/ Frostbyte's 1980s DOS Shareware Collection / floppyshareware.zip / floppyshareware / APOG / ASM2.ZIP / DIREX.ASM < prev    next >
Encoding:
Assembly Source File  |  1989-05-27  |  23.1 KB  |  777 lines

  1. page ,132
  2. title direx ( directory manipulator - ibm ) as of 12/05/87 - 11:30 am
  3. ;*
  4. ;*  dont forget to
  5. ;*  exe2bin ( cetc direx )
  6. ;*
  7. ;
  8. target   equ   0d8h
  9. source   equ   0b0h
  10. bya      equ   06eh                    ; brown, yelo attr
  11. gya      equ   02eh                    ; green,  "    "
  12. blya     equ   01eh                    ; blue,   "    "
  13. mbtr     equ   61*1024                 ; max bytes to read
  14. ;
  15. ;*------------------------
  16. code     segment
  17. ;*------------------------
  18. ;
  19.          assume cs:code,ds:code,es:code
  20. ;
  21.          org   256
  22. ;
  23. start:   jmp   direx
  24. ;
  25. ;*
  26. ;*   messages
  27. ;*
  28. prompt   db    '[ c=copy, d=delete, n=new dir, p=protect, '
  29.          db    'q=quit, u=unprotect, <space>=mark ]$'
  30. cpy_msg  db    'pathname to copy marked files to: $'
  31. nd_msg   db    'new pathname: $'
  32. full_msg db    '*        TARGET DISK FULL:        *$'
  33. del_msg  db    'delete marked file (y/n)? $'
  34. ;*
  35. ;*   flags
  36. ;*
  37. cpyflg   db    0                       ; set when doing copies
  38. d1_flag  db    0                       ; in DISPLAY, not DSPLAY2
  39. dspflg   db    0                       ; set when initial display done
  40. fullflg  db    0                       ; disk full flag
  41. nofilf   db    0                       ; no filename given
  42. ;*
  43. sfhndl   dw    0                       ; source file handle
  44. tfhndl   dw    0                       ; target file handle
  45. spe      dw    0b0h                    ; sors path end - put filenames here
  46. tpe      dw    0dbh                    ; tgt path end - put filenames here
  47. tstpe    dw    0                       ; test path end
  48. bytsred  dw    0                       ; bytes read for copy
  49. bytsreq  dw    0                       ; bytes requested to be read
  50. ;*
  51. bess     db    27,'[','1',';','43',';','33','m'
  52. bese     db    0
  53. ;*
  54. marked   db    0                       ; file marked ?
  55. attrib   db    7                       ; screen attr
  56. wildcard db    '*.*',0                 ;
  57. cursor_x db    0                       ; cursor column position ( dl )
  58. cursor_y db    0                       ; cursor row position    ( dh )
  59. tempx    db    0                       ; tem storage for x pos
  60. tempy    db    0                       ; tem storage for y pos
  61. filename db    10 dup (0)              ; store given filename here
  62. ;*
  63. ;*   start of direx
  64. ;*
  65. direx    proc  near
  66.          call  brown                   ; set initial color
  67.          call  display                 ; display dir
  68.          mov   si,spe                  ; light up first filename
  69.          call  gfn
  70. topper:  mov   attrib,bya              ; set brown, yelo
  71.          call  color
  72. top:     mov   ah,0                    ; read a char w/o echo
  73.          int   16h
  74. ;*
  75. ;*  check for space ( mark )
  76. ;*
  77. space:   cmp   al,20h                  ; space ? ( mark )
  78.          jne   right
  79.          mov   ah,8                    ; read a char  fct
  80.          mov   bx,0                    ;
  81.          add   cursor_x,12             ; position to col after name
  82.          call  setcrsr
  83.          int   10h                     ; read it
  84.          cmp   al,0ffh                 ; marked already ?
  85.          je    rtu                     ; if so, unmark
  86. ;*
  87. ;*   request to mark
  88. ;*
  89.          sub   cursor_x,12             ; -12 col to name begin
  90.          call  setcrsr
  91.          mov   attrib,blya             ; set marked color
  92.          call  color
  93.          add   cursor_x,12             ; +12 col to name end
  94.          call  setcrsr
  95. ;
  96.          mov   al,0ffh                 ; mark !
  97.          jmp   cwac                    ; goto common write a char
  98. ;*
  99. ;*   request to unmark
  100. ;*
  101. rtu:     mov   al,0                    ; unmark !
  102. ;*
  103. ;*  common write a char
  104. ;*
  105. cwac:
  106.          mov   ah,10                   ; write a char fct
  107.          mov   cx,1                    ; 1 char
  108.          int   10h
  109.          sub   cursor_x,12             ; -12 col to name begin
  110.          call  setcrsr
  111.          jmp   top
  112. ;*
  113. ;*  check for cursor right
  114. ;*
  115. right:   cmp   ah,4dh                  ; cursor right ?
  116.          jne   left                    ; if not, try left
  117.          mov   attrib,bya              ; unlite  name
  118.          call  color
  119.          call  incrsr                  ; next name
  120.          mov   attrib,gya              ; lite it
  121.          call  color
  122.          jmp   top
  123. ;*
  124. ;*  check for cursor left
  125. ;*
  126. left:    cmp   ah,4bh                  ; cursor left ?
  127.          jne   up                      ; if not, try up
  128.          mov   dl,cursor_x             ; save col
  129.          mov   dh,cursor_y             ; save row
  130.          mov   attrib,bya              ; unlite name
  131.          call  color
  132.          sub   dl,13                   ; -13 col
  133.          jnc   ok                      ; if no carry, ok
  134.          mov   dl,5*13                 ; if so, make col = 65
  135.          sub   dh,1                    ; -1 row
  136.          jnc   ok                      ; if no carry, ok
  137.          mov   dl,cursor_x             ; if so, do not
  138.          mov   dh,cursor_y             ; change marked file
  139. ok:      mov   cursor_x,dl             ; load new col
  140.          mov   cursor_y,dh             ; and row
  141.          call  setcrsr
  142.          mov   attrib,gya              ; lite it
  143.          call  color
  144.          jmp   top
  145. ;*
  146. ;*  check for cursor up
  147. ;*
  148. up:      cmp   ah,48h                  ; cursor up ?
  149.          jne   down                    ; if not, try down
  150.          mov   dl,cursor_x             ; save col
  151.          mov   dh,cursor_y             ; and row
  152.          mov   attrib,bya              ; unlite name
  153.          call  color
  154.          sub   dh,1                    ; -1 row
  155.          jnc   nottop                  ; if no carry, ok
  156.          add   dh,1                    ; +1 row
  157. nottop:  mov   cursor_x,dl             ; set new col
  158.          mov   cursor_y,dh             ; and row
  159.          call  setcrsr
  160.          mov   attrib,gya              ; lite it
  161.          call  color
  162.          jmp   top
  163. ;*
  164. ;*  check for cursor down
  165. ;*
  166. down:    cmp   ah,50h                  ; cursor down ?
  167.          jne   letters                 ; if not, try letters
  168.          mov   attrib,bya              ; unlite name
  169.          call  color
  170.          inc   cursor_y                ; inc row
  171.          call  setcrsr
  172.          mov   si,spe                  ; set index at end
  173.          call  gfn                     ; get file name
  174.          cmp   byte ptr ds:[si],' '    ; is there a name here
  175.          ja    go                      ; if so, carry on
  176. nogo:    dec   cursor_y                ; else, decr row
  177.          call  setcrsr
  178. go:      mov   attrib,gya              ; lite it
  179.          call  color
  180.          jmp   top
  181. ;*
  182. ;* check for letters ( q, d, p, u, c, n )
  183. ;*
  184. letters: cmp   al,'a'                  ; test for lower case a
  185.          jnl   gol                     ; if EQ/GT, carry on
  186.          add   al,32                   ; else, convert to lower case
  187. ;*
  188. ;*   check for quit
  189. ;*
  190. gol:     cmp   al,'q'                  ; quit ?
  191.          jne   del                     ; if not, try delete
  192. ;*
  193. ;*   clear all 25 rows
  194. ;*
  195.          mov   cx,25
  196.          mov   cursor_x,0              ; col = 0
  197.          mov   cursor_y,0              ; row = 0
  198.          call  setcrsr
  199. wipe2:   push  cx
  200.          call  setcrsr
  201.          mov   cx,80
  202.          mov   ah,9
  203.          mov   bl,bya
  204.          mov   bh,0
  205.          mov   al,0
  206.          int   10h
  207.          pop   cx
  208.          inc   cursor_x                ; incr col
  209.          loop  wipe2
  210. ;
  211.          mov   cursor_x,0              ; col = 0
  212.          mov   cursor_y,0              ; row = 0
  213.          call  setcrsr
  214.          jmp   out
  215. ;*
  216. ;*   check for delete
  217. ;*
  218. del:     cmp   al,'d'                  ; delete ?
  219.          je    okd                     ; if so, do delete process
  220.          jmp   pro                     ; else, test protect
  221. ;
  222. okd:     mov   attrib,bya              ; unlite name
  223.          call  color
  224.          mov   cursor_x,0              ; col = 0
  225.          mov   cursor_y,24             ; row = 24
  226.          call  setcrsr
  227. ; clear bottom row
  228.          mov   ah,9
  229.          mov   cx,80
  230.          mov   al,' '
  231.          mov   bl,bya
  232.          mov   bh,0
  233.          int   10h
  234.          mov   cursor_x,0              ; col = 0
  235.          mov   cursor_y,24             ; row = 24
  236.          call  setcrsr
  237. ; send msg
  238.          mov   ah,9
  239.          mov   dx, offset del_msg
  240.          int   21h
  241. ; request reply
  242.          mov   ah,1
  243.          int   21h
  244. ; test reply
  245.          cmp   al,'a'                  ; test for lower case a
  246.          jnl   checky                  ; if EQ/GT, carry on
  247.          add   al,32                   ; else, convert to lower case
  248. ;
  249. checky:  cmp   al,'y'                  ; yes ?
  250.          je    godel                   ; if so, go delete
  251.          call  dsplay2
  252.          mov   attrib,gya              ; lite it
  253.          call  color
  254.          jmp   top
  255. ;
  256. godel:   mov   cursor_x,0              ; col = 0
  257.          mov   cursor_y,0              ; row = 0
  258.          call  setcrsr
  259. ;
  260. loopd:   call  gmf                     ; get marked file
  261.          mov   dx,source               ; point to source string
  262.          mov   ah,41h                  ; delete
  263.          int   21h
  264.          call  incrsr                  ; move to next file
  265.          cmp   dx,0ffh                 ; is there one ?
  266.          je    find
  267.          cmp   cx,0ffh                 ; ?
  268.          jne   loopd
  269. find:    call  dsplay2
  270.          mov   attrib,gya              ; lite it
  271.          call  color
  272.          jmp   top
  273. ;*
  274. ;*   check for protect
  275. ;*
  276. pro:     cmp   al,'p'                  ; protect ?
  277.          jne   unpro                   ; if not, test unprotect
  278.          mov   attrib,bya              ; unlite name
  279.          call  color
  280.          mov   cursor_x,0              ; col = 0
  281.          mov   cursor_y,0              ; row = 0
  282.          call  setcrsr
  283. ;
  284. ; protect loop
  285. ;
  286. loopp:   call  gmf
  287.          mov   dx,source
  288.          mov   ah,43h
  289.          mov   al,01
  290.          mov   cx,1
  291.          int   21h
  292.          call  incrsr
  293.          cmp   dx,0ffh
  294.          je    finp
  295.          cmp   cx,0ffh
  296.          jne   loopp
  297. finp:    call  dsplay2
  298.          mov   attrib,gya              ; lite it
  299.          call  color
  300.          jmp   top
  301. ;*
  302. ;*   check for unprotect
  303. ;*
  304. unpro:   cmp   al,'u'                  ; unprotect ?
  305.          jne   copy                    ; if not, test copy
  306.          mov   attrib,bya              ; unlite name
  307.          call  color
  308.          mov   cursor_x,0              ; col = 0
  309.          mov   cursor_y,0              ; row = 0
  310.          call  setcrsr
  311. ;
  312. ; unprotect loop
  313. ;
  314. loopu:   call  gmf
  315.          mov   dx,source
  316.          mov   ah,43h
  317.          mov   al,01
  318.          mov   cx,0
  319.          int   21h
  320.          call  incrsr
  321.          cmp   dx,0ffh
  322.          je    finu
  323.          cmp   cx,0ffh
  324.          jne   loopu
  325. finu:    call  dsplay2
  326.          mov   attrib,gya              ; lite it
  327.          call  color
  328.          jmp   top
  329. ;*
  330. ;*   check for copy
  331. ;*
  332. copy:    cmp   al,'c'                  ; copy ?
  333.          je    goc                     ; if so, do copy process
  334.          jmp   new_dir                 ; else, test new directory
  335. ;
  336. goc:     mov   fullflg,0
  337.          mov   attrib,bya              ; unlite name
  338.          call  color
  339.          mov   cursor_x,0              ; col = 0
  340.          mov   cursor_y,24             ; row = 24
  341.          call  setcrsr
  342. ; clear bottom line
  343.          mov   ah,9
  344.          mov   cx,80
  345.          mov   al,' '
  346.          mov   bl,bya
  347.          mov   bh,0
  348.          int   10h
  349.          mov   cursor_x,0              ; col = 0
  350.          mov   cursor_y,24             ; row = 24
  351.          call  setcrsr
  352. ; send msg
  353.          mov   ah,9
  354.          mov   dx, offset cpy_msg
  355.          int   21h
  356. ; buffered keyboard input
  357.          mov   ah,10
  358.          mov   bx,target-2
  359.          mov   dx,target-2
  360.          mov   byte ptr [bx],32        ; max 32 byte input
  361.          int   21h
  362. ;
  363.          mov   si,target
  364. trans:   cmp   byte ptr [si],13        ; C R ?
  365.          je    slash2
  366.          inc   si                      ; next byte
  367.          jmp   trans                   ; keep lookin'
  368. ;
  369. slash2:  cmp   byte ptr [si-1],'\'     ; CR - 1 slash ?
  370.          je    filer2                  ; if so, carry on
  371.          mov   byte ptr [si],'\'       ; else, move \ on top of CR
  372.          inc   si                      ; past it
  373. ;
  374. filer2:  mov   tpe,si
  375.          mov   attrib,bya              ; unlite it
  376.          call  color
  377.          mov   cursor_x,0              ; col = 0
  378.          mov   cursor_y,0              ; row = 0
  379.          call  setcrsr
  380. loopc:   mov   cpyflg,1
  381.          call  gmf
  382.          mov   cpyflg,0
  383.          cmp   cx,0ffh
  384.          jne   open
  385.          jmp   finc
  386. open:    mov   dx,source
  387.          mov   ax,3d00h
  388.          int   21h
  389.          jc    botc
  390.          mov   sfhndl,ax
  391.          mov   dx,target
  392.          mov   ah,3ch
  393.          mov   cx,0
  394.          int   21h
  395.          jc    botc
  396.          mov   tfhndl,ax
  397. stuff:   mov   dx,offset data
  398.          mov   cx,mbtr
  399.          mov   ah,3fh
  400.          mov   bx,sfhndl
  401.          int   21h
  402.          mov   bytsred,ax
  403.          mov   cx,ax
  404.          mov   bytsreq,cx
  405.          mov   ah,40h
  406.          mov   bx,tfhndl
  407.          mov   dx,offset data
  408.          int   21h
  409.          cmp   ax,bytsreq
  410.          jne   full
  411.          cmp   bytsred,mbtr
  412.          je    stuff
  413.          jmp   botc
  414. full:
  415.          mov   cursor_x,0              ; col = 0
  416.          mov   cursor_y,24             ; row = 24
  417.          call  setcrsr
  418.          mov   ah,9
  419.          mov   dx, offset full_msg
  420.          int   21h
  421.          mov   fullflg,1
  422.          mov   cursor_x,0              ; col = 0
  423.          mov   cursor_y,0              ; row = 0
  424.          call  setcrsr
  425. botc:
  426.          mov   ah,3eh
  427.          mov   bx,sfhndl
  428.          int   21h
  429.          mov   ah,3eh
  430.          mov   bx,tfhndl
  431.          int   21h
  432.          cmp   fullflg,1
  433.          jne   notfull
  434.          mov   dx,target
  435.          mov   ah,41h
  436.          int   21h
  437.          jmp   topper
  438. notfull: call  incrsr
  439.          cmp   dx,0ffh
  440.          je    finc
  441.          jmp   loopc
  442. finc:    call  dsplay2
  443.          mov   attrib,gya              ; lite it
  444.          call  color
  445.          jmp   top
  446. ;*
  447. ;*   check for new directory
  448. ;*
  449. new_dir: cmp   al,'n'                  ; new directory ?
  450.          je    gon                     ; if so, do new directory process
  451.          jmp   top                     ; else, invalid code, get another
  452. ;
  453. gon:     mov   attrib,bya              ; unlite name
  454.          call  color
  455.          mov   cursor_x,0              ; col = 0
  456.          mov   cursor_y,24             ; row = 24
  457.          call  setcrsr
  458. ; clear msg line
  459.          mov   ah,9
  460.          mov   cx,80
  461.          mov   al,' '
  462.          mov   bl,bya
  463.          mov   bh,0
  464.          int   10h
  465.          mov   cursor_x,0              ; col = 0
  466.          mov   cursor_y,24             ; row = 24
  467.          call  setcrsr
  468.          mov   ah,9
  469.          mov   dx, offset nd_msg
  470.          int   21h
  471. ; buffered keyboard input
  472.          mov   ah,10
  473.          mov   bx,80h
  474.          mov   dx,80h
  475.          mov   byte ptr [bx],32
  476.          int   21h
  477.          jmp   direx
  478. out:
  479.          call  brown
  480.          int   20h
  481. direx    endp
  482. ;*
  483. ;*   get marked file
  484. ;*
  485. gmf      proc  near
  486. ; cx=ff= no more to be found
  487. begi:    mov   ah,8
  488.          add   cursor_x,12             ; +12 col to name end
  489.          call  setcrsr
  490.          mov   bx,0
  491.          int   10h
  492.          sub   cursor_x,12             ; -12 col to name begin
  493.          call  setcrsr
  494.          cmp   al,0ffh                 ; marked file ?
  495.          je    fini
  496.          call  incrsr
  497.          cmp   dx,0ffh
  498.          jne   begi
  499.          mov   cx,0ffh
  500.          jmp   outer
  501. fini:    mov   cx,0
  502.          mov   si,spe
  503.          call  gfn
  504.          cmp   cpyflg,1
  505.          jne   outer
  506.          mov   si,tpe
  507.          call  gfn
  508. outer:   ret
  509. gmf      endp
  510. ;*
  511. ;*   get file name
  512. ;*
  513. gfn      proc  near
  514. ; call with ds:si as address to put filename in
  515.          push  cx
  516.          push  si
  517.          push  word ptr cursor_x       ; save col position
  518.          mov   ah,8
  519.          mov   bx,0
  520.          mov   cx,12
  521. loopb:   mov   ah,8
  522.          int   10h
  523.          inc   cursor_x                ; incr col
  524.          call  setcrsr
  525.          mov   ds:[si],al
  526.          inc   si
  527.          loop  loopb
  528.          mov   byte ptr ds:[si],0
  529.          pop   word ptr cursor_x       ; restore col position
  530.          pop   si
  531.          call  setcrsr
  532.          pop   cx
  533.          ret
  534. gfn      endp
  535. ;*
  536. ;*  lites / unlites file names
  537. ;*  if file is marked, will not unlite
  538. ;*
  539. color    proc  near
  540.          push  cx
  541.          push  word ptr cursor_x       ; save col position
  542.          mov   cx,12
  543.          cmp   attrib,bya              ; are we unliting ?
  544.          je    ulc                     ; if so, carry on
  545.          cmp   attrib,gya              ; are we liting ?
  546.          jne   sabl                    ; if not, set all bytes
  547. ;*
  548. ;*  unlite character
  549. ;*
  550. ulc:
  551.          mov   ah,8                    ; read a char
  552.          add   cursor_x,12             ; +12 col to end of name
  553.          call  setcrsr
  554.          mov   bx,0
  555.          int   10h
  556.          sub   cursor_x,12             ; -12 col to name begin
  557.          call  setcrsr
  558.          cmp   al,0ffh                 ; was char marked ?
  559.          je    fine                    ; if so, leave
  560. ;*
  561. ;*  set all bytes loop
  562. ;*
  563. sabl:
  564.          mov   bx,0                    ; read a char
  565.          mov   ah,8
  566.          int   10h
  567.          push  cx
  568.          mov   cx,1                    ; 1 char
  569.          mov   bl,attrib               ; attrib
  570.          mov   ah,9                    ; write
  571.          int   10h
  572.          pop   cx
  573.          inc   cursor_x                ; +1 col to next letter
  574.          call  setcrsr
  575.          loop  sabl
  576. ;
  577. fine:    pop   word ptr cursor_x       ; restore col position
  578.          call  setcrsr
  579.          pop   cx
  580.          ret
  581. color    endp
  582. ;
  583. display  proc  near
  584.          mov   di,source
  585.          mov   d1_flag,1
  586.          mov   si,82h
  587.          mov   spe,source
  588.          mov   bx,80h
  589.          cmp   byte ptr [bx],0
  590.          je    dsplay2
  591. trans2:  cmp   byte ptr [si],13
  592.          je    put0
  593.          movsb
  594.          cmp   byte ptr [si-1],'\'
  595.          je    stor
  596.          cmp   byte ptr [si-1],':'
  597.          jne   trans2
  598. stor:    mov   spe,di
  599. ;
  600.          push  si
  601.          push  di
  602.          lea   di,filename
  603.          mov   cx,10
  604.          mov   al,0
  605.          rep   stosb
  606.          lea   di,filename
  607.          mov   cx,9
  608. oneby:   cmp   byte ptr [si],13
  609.          jne   move
  610.          mov   byte ptr [di],0
  611.          jmp   short fin0
  612. move:    movsb
  613.          loop  oneby
  614. fin0:    pop   di
  615.          pop   si
  616.          jmp   trans2
  617. put0:    mov   byte ptr [di],0
  618.          mov   tstpe,di
  619.          mov   nofilf,0
  620.          jmp   chkfil
  621. ;
  622. dsplay2: mov   d1_flag,0
  623.          cmp   filename,0
  624.          jne   chkfil
  625.          mov   nofilf,1
  626. chkfil:  mov   cx,25
  627.          mov   cursor_x,0              ; col = 0
  628.          mov   cursor_y,0              ; row = 0
  629.          call  setcrsr
  630. wipe:    push  cx
  631.          call  setcrsr
  632.          mov   cx,80
  633.          mov   ah,9
  634.          mov   bl,bya
  635.          mov   bh,0
  636.          mov   al,0
  637.          int   10h
  638.          pop   cx
  639.          inc   cursor_y                ; incr row
  640.          loop  wipe
  641.          mov   cursor_x,0              ; col = 0
  642.          mov   cursor_y,24             ; row = 24
  643.          call  setcrsr
  644.          mov   ah,9
  645.          mov   dx,offset prompt
  646.          int   21h
  647.          mov   cursor_x,0              ; col = 0
  648.          mov   cursor_y,0              ; row = 0
  649.          call  setcrsr
  650.          mov   di,tstpe
  651.          cmp   nofilf,1
  652.          je    tslash
  653.          cmp   byte ptr [di-1],'\'
  654.          je    nofile
  655.          cmp   d1_flag,1
  656.          je    puta
  657.          cmp   filename,0
  658.          je    puta
  659.          mov   cx,10
  660.          mov   si,offset filename
  661.          mov   di,spe
  662.          rep   movsb
  663. puta:    mov   ah,4eh
  664.          mov   dx,source
  665.          int   21h
  666.          jnc   match1
  667. nofile:  mov   filename,0
  668. tslash:  cmp   tstpe,0
  669.          jne   slash
  670.          mov   spe,source
  671.          mov   di,spe
  672.          jmp   putw
  673. slash:   mov   di,tstpe
  674.          mov   spe,di
  675.          cmp   byte ptr [di-1],'\'
  676.          je    putw
  677.          mov   byte ptr [di],'\'
  678.          inc   di
  679.          inc   spe
  680. putw:    mov   cx,4
  681.          mov   si,offset wildcard
  682.          rep   movsb
  683. src:     mov   ah,4eh
  684.          mov   dx,source
  685.          int   21h
  686.          jc    ender
  687. match1:  mov   dx,0
  688.          mov   ah,2
  689.          int   10h
  690.          call  print
  691.          mov   cx,120
  692. looper:  mov   ah,4fh
  693.          int   21h
  694.          jc    ender
  695.          mov   dspflg,0ffh             ; set DISPLAY flag
  696.          call  incrsr
  697.          mov   dspflg,0
  698.          call  print
  699.          mov   dx,offset source
  700.          loop  looper
  701. ender:
  702.          mov   cursor_x,0              ; col = 0
  703.          mov   cursor_y,0              ; row = 0
  704.          call  setcrsr
  705.          ret
  706. display  endp
  707. ;*
  708. ;* move hilite to next name on screen
  709. ;*
  710. incrsr   proc  near
  711.          push  cx
  712.          mov   dl,cursor_x             ; save  col
  713.          mov   dh,cursor_y             ; and row
  714.          mov   tempx,dl                ; in temp
  715.          mov   tempy,dh                ; storage
  716.          add   dl,13                   ; next name
  717.          cmp   dl,75                   ; end of screen
  718.          jl    fin                     ; if LT, carry on
  719.          mov   dl,0                    ; if EQ/GT, set col = 0
  720.          inc   dh                      ; and incr row
  721. fin:     mov   cursor_x,dl             ; restore col
  722.          mov   cursor_y,dh             ; and row
  723.          mov   dx,0                    ; set return 0
  724.          call  setcrsr
  725.          cmp   dspflg,0                ; is DISPLAY clear ?
  726.          jne   set                     ; no, dont check for file name
  727.          mov   si,spe
  728.          call  gfn
  729.          cmp   byte ptr ds:[si],' '    ; file name ?
  730.          ja    set                     ; if yes, carry on
  731.          sub   cursor_x,13             ; -13 col to last name
  732.          cmp   cursor_x,0              ; col 0 ?
  733.          jg    leav                    ; if GT, exit
  734.          mov   dl,tempx                ; restore temp
  735.          mov   cursor_x,dl             ; col
  736.          mov   dh,tempy                ; and
  737.          mov   cursor_y,dh             ; row
  738. leav:    call  setcrsr
  739.          mov   dx,0ffh
  740. set:     pop   cx
  741.          ret
  742. incrsr   endp
  743. ;
  744. setcrsr  proc  near
  745.          push  ax
  746.          mov   dl,cursor_x             ; set row
  747.          mov   dh,cursor_y             ; set column
  748.          mov   ah,2                    ; position cursor
  749.          int   10h
  750.          pop   ax
  751.          ret
  752. setcrsr  endp
  753. ;
  754. print    proc  near
  755.          push  cx
  756.          mov   dx,80h+30               ; point to name
  757.          mov   bx,dx
  758.          mov   cx,13
  759. loopa:   cmp   byte ptr [bx],0         ; zero ?
  760.          je    found                   ; if so, end of file name found
  761.          inc   bx
  762.          loop  loopa
  763. found:   mov   byte ptr ds:[bx+1],'$'  ; substitute $ for zero
  764.          mov   ah,9                    ; print to $
  765.          int   21h
  766.          pop   cx
  767.          ret
  768. print    endp
  769. ;
  770.          include brown.prc
  771. ;
  772. data:
  773. ;
  774. code     ends
  775. ;
  776.          end   start
  777.