home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / Assembly / DIREX.ASM < prev    next >
Assembly Source File  |  1979-12-31  |  23KB  |  567 lines

  1.  
  2.         TARGET EQU 0D8H
  3.         SOURCE EQU 0B0H
  4. CODE_SEG        SEGMENT
  5.         ASSUME  CS:CODE_SEG,DS:CODE_SEG,ES:CODE_SEG
  6.         ORG     100H
  7. START:  JMP     DIREX
  8.         PROMPT DB 'D=Delete P=Protect U=Unprotect C=Copy <Space>=Mark'
  9.                DB ' N=New Dir Q=Quit$'
  10.         COPY_PROMPT     DB      'Pathname to copy marked files to: $'
  11.         NEW_DIR_PROMPT  DB      'New Directory: $'
  12.         FULL_MSG        DB      '*        TARGET DISK FULL!          *$'
  13.         DEL_MSG         DB      'Delete Marked Files (Y/N)? $'
  14.         COPY_FLAG       DB      0       ;Set for Coping.
  15.         DISP_FLAG       DB      0       
  16.         FULL_FLAG       DB      0       ;Disk Full?
  17.         SOURCE_HANDLE   DW      0       ;To keep track of the Source files.
  18.         TARGET_HANDLE   DW      0       ;Ditto for targets.
  19.         SOURCE_PATH_END DW      ?       ;Where we are.
  20.         TARGET_PATH_END DW      ?       ;Where we are going to be.
  21.         BYTES_READ      DW      ?       ;For copying.
  22.         BYTES_ASKED     DW      ?       ;Also for copying.
  23.         MARKED  DB      ?               ;Is this file marked?
  24.         ATTRIB  DB      7               ;For the display.
  25.         WILDCARDS       DB      '*.*',0
  26.         CURSOR_X        DB      ?       ;Position of cursor.
  27.         CURSOR_Y        DB      ?
  28.         TEMPX           DB      ?       ;Storage for cursor positions.
  29.         TEMPY           DB      ?
  30.  
  31. DIREX   PROC    NEAR
  32.         CALL    DISPLAY                 ;Put filenames on screen.
  33.         MOV     SI,SOURCE_PATH_END
  34.         CALL    GET_FILE_NAME
  35. TOPPER: MOV     ATTRIB,70H              ;Reverse Video.
  36.         CALL    COLOR
  37. TOP:    MOV     AH,0                    ;Read typed key.
  38.         INT     16H
  39.  
  40. SPACE:  CMP     AL,20H                  ;Was typed character a space?
  41.         JNE     RIGHT                   ;No -- check right arrow.
  42.         MOV     AH,8                    ;Yes, get end character from screen.
  43.         MOV     BX,0
  44.         ADD     CURSOR_X,12
  45.         CALL    SET_CURSOR
  46.         INT     10H
  47.         CMP     AL,0FFH                 ;Marked?
  48.         JE      OPP                     ;Yes.
  49.         MOV     AL,0FFH                 ;No, mark it now.
  50.         JMP     PPO
  51. OPP:    MOV     AL,0
  52. PPO:    MOV     AH,10
  53.         MOV     CX,1
  54.         INT     10H
  55.         SUB     CURSOR_X,12             ;Move to beginning of filename.
  56.         CALL    SET_CURSOR
  57.         JMP     TOP                     ;Get next typed key.
  58.  
  59. RIGHT:  CMP     AH,4DH                  ;Was right arrow typed?
  60.         JNE     LEFT                    ;No, check left arrow.
  61.         MOV     ATTRIB,7                ;Yes, set attribute for screen.
  62.         CALL    COLOR                   ;Color out file name.
  63.         CALL    INC_CURSOR              ;Move to next file name.
  64.         MOV     ATTRIB,70H              ;Color in file name.
  65.         CALL    COLOR
  66.         JMP     TOP                     ;Read in next char.
  67.  
  68. LEFT:   CMP     AH,4BH                  ;Left arrow typed?
  69.         JNE     UP                      ;No -- check up key.
  70.         MOV     DL,CURSOR_X             ;Get ready to move back.
  71.         MOV     DH,CURSOR_Y
  72.         MOV     ATTRIB,7                ;Reset color of current file name.
  73.         CALL    COLOR                   ;Color it out.
  74.         SUB     DL,13                   ;Move back.
  75.         JNC     OK                      ;Past edge of screen?
  76.         MOV     DL,5*13                 ;Yes, wrap.
  77.         SUB     DH,1                    ; and go up one line.
  78.         JNC     OK
  79.         MOV     DL,CURSOR_X
  80.         MOV     DH,CURSOR_Y
  81. OK:     MOV     CURSOR_X,DL
  82.         MOV     CURSOR_Y,DH
  83.         CALL    SET_CURSOR              ;Set current file name in rev. video.
  84.         MOV     ATTRIB,70H
  85.         CALL    COLOR
  86.         JMP     TOP                     ;And wait for next command.
  87.  
  88. UP:     CMP     AH,48H                  ;Up arrow typed?
  89.         JNE     DOWN                    ;No -- check down arrow.
  90.         MOV     DL,CURSOR_X             ;Prepare to move down.
  91.         MOV     DH,CURSOR_Y
  92.         MOV     ATTRIB,7
  93.         CALL    COLOR                   ;Color out current file name.
  94.         SUB     DH,1
  95.         JNC     NOTTOP                  ;Can we move down?
  96.         ADD     DH,1                    ;Yes.
  97. NOTTOP: MOV     CURSOR_X,DL
  98.         MOV     CURSOR_Y,DH
  99.         CALL    SET_CURSOR              ;Get ready to color current name in.
  100.         MOV     ATTRIB,70H              ;Do it.
  101.         CALL    COLOR
  102.         JMP     TOP                     ;Get next command.
  103.  
  104. DOWN:   CMP     AH,50H                  ;Was this a down arrow typed?
  105.         JNE     LETTERS                 ;No -- check if it was a letter.
  106.         MOV     ATTRIB,7                ;Color out current file name.
  107.         CALL    COLOR
  108.         INC     CURSOR_Y
  109.         CALL    SET_CURSOR              ;Are we pointing to a 
  110.         MOV     SI,SOURCE_PATH_END      ; valid file name?
  111.         CALL    GET_FILE_NAME
  112.         CMP     BYTE PTR DS:[SI],' '
  113.         JA      GO
  114. NOGO:   DEC     CURSOR_Y                ;No, do not move down.
  115.         CALL    SET_CURSOR
  116. GO:     MOV     ATTRIB,70H              ;Yes, color in current file name.
  117.         CALL    COLOR
  118.         JMP     TOP                     ;Wait for next command.
  119.  
  120. LETTERS:CMP     AL,'Z'          ;Convert to lower case.
  121.         JL      GOL
  122.         SUB     AL,'a'-'A'
  123. GOL:    CMP     AL,'Q'          ;Are we supposed to quit?
  124.         JNE     DEL             ;No, check deleting.
  125.         JMP     OUT             ;Yes, quit.
  126. DEL:    CMP     AL,'D'          ;Delete?
  127.         JE      OKD             ;Yes, do the delete.
  128.         JMP     PRO             ;No, check protecting.
  129. OKD:    MOV     ATTRIB,7        ;To delete.
  130.         CALL    COLOR           ;Color out current file name.
  131.         MOV     CURSOR_X,0      ;Get ready to put 
  132.         MOV     CURSOR_Y,24     ; the deleting message at bottom
  133.         CALL    SET_CURSOR      ; of the screen.
  134.         MOV     AH,9
  135.         MOV     CX,80
  136.         MOV     AL,' '
  137.         MOV     BX,7
  138.         INT     10H
  139.         MOV     CURSOR_X,0
  140.         MOV     CURSOR_Y,24
  141.         CALL    SET_CURSOR
  142.         MOV     AH,9
  143.         MOV     DX,OFFSET DEL_MSG       ;Type out deleting message.
  144.         INT     21H
  145.         MOV     AH,1
  146.         INT     21H
  147.         CMP     AL,'Z'                  ;Capitalize response.
  148.         JL      CHECKY
  149.         SUB     AL,'a'-'A'
  150. CHECKY: CMP     AL,'Y'                  ;Should we delete?
  151.         JE      GODEL                   ;Yes!
  152.         CALL    DSPLAY2                 ;No, redisplay screen (wiping off
  153.         MOV     ATTRIB,70H              ; delete message.
  154.         CALL    COLOR
  155.         JMP     TOP
  156. GODEL:  MOV     CURSOR_X,0              ;Begin the delete.
  157.         MOV     CURSOR_Y,0              ;Start checking file by file.
  158.         CALL    SET_CURSOR
  159. LOOPD:  CALL    GET_MARKED_FILE         ;Get next marked file.
  160.         MOV     DX,SOURCE               ;Get full name.
  161.         MOV     AH,41H                  ;Do the delete.
  162.         INT     21H
  163.         CALL    INC_CURSOR              ;Move on to next file name.
  164.         CMP     DX,0FFH                 ;At end?
  165.         JE      FIND                    ;Yes, leave.
  166.         CMP     CX,0FFH                 ;More to delete?
  167.         JNE     LOOPD
  168. FIND:   CALL    DSPLAY2                 ;Move cursor to top left
  169.         MOV     ATTRIB,70H              ; and redisplay.
  170.         CALL    COLOR
  171.         JMP     TOP
  172. PRO:    CMP     AL,'P'                  ;Here we will protect a file.
  173.         JNE     UNPRO                   ;If not, jump to unprotect.
  174.         MOV     ATTRIB,7                ;Color out current file name if poss.
  175.         CALL    COLOR
  176.         MOV     CURSOR_X,0
  177.         MOV     CURSOR_Y,0
  178.         CALL    SET_CURSOR
  179. LOOPP:  CALL    GET_MARKED_FILE         ;Loop over files to protect.
  180.         MOV     DX,SOURCE               ;Set up full name.
  181.         MOV     AH,43H                  ;Protect the file.
  182.         MOV     AL,01
  183.         MOV     CX,1
  184.         INT     21H
  185.         CALL    INC_CURSOR              ;Move on to next one.
  186.         CMP     DX,0FFH                 ;Can we?
  187.         JE      FINP                    ;No.
  188.         CMP     CX,0FFH
  189.         JNE     LOOPP                   ;Yes.
  190. FINP:   CALL    DSPLAY2                 ;Done -- redisplay.
  191.         MOV     ATTRIB,70H              ;Move cursor to top left.
  192.         CALL    COLOR
  193.         JMP     TOP                     ;Get next command.
  194. UNPRO:  CMP     AL,'U'                  ;Are we supposed to unprotect?
  195.         JNE     COPY                    ;No, try copy.
  196.         MOV     ATTRIB,7                ;Color out current file name.
  197.         CALL    COLOR
  198.         MOV     CURSOR_X,0
  199.         MOV     CURSOR_Y,0
  200.         CALL    SET_CURSOR
  201. LOOPU:  CALL    GET_MARKED_FILE         ;Loop over files to unprotect.
  202.         MOV     DX,SOURCE
  203.         MOV     AH,43H
  204.         MOV     AL,01                   ;And unprotect them.
  205.         MOV     CX,0
  206.         INT     21H
  207.         CALL    INC_CURSOR              ;Move on to next one.
  208.         CMP     DX,0FFH                 ;Done?
  209.         JE      FINU                    ;Yes.
  210.         CMP     CX,0FFH
  211.         JNE     LOOPU                   ;No.
  212. FINU:   CALL    DSPLAY2                 ;All finished. Redisplay.
  213.         MOV     ATTRIB,70H
  214.         CALL    COLOR
  215.         JMP     TOP                     ;Wait for next command.
  216.  
  217. COPY:   CMP     AL,'C'                  ;Are we supposed to copy?
  218.         JE      GOC                     ;Yes.
  219.         JMP     NEW_DIR                 ;No -- try directory change.
  220. GOC:    MOV     FULL_FLAG,0             ;Let's copy!
  221.         MOV     ATTRIB,7                ;Color out current file name.
  222.         CALL    COLOR
  223.         MOV     CURSOR_X,0
  224.         MOV     CURSOR_Y,24
  225.         CALL    SET_CURSOR              ;Get pathname to copy marked
  226.         MOV     AH,9                    ; files to.
  227.         MOV     CX,80
  228.         MOV     AL,' '
  229.         MOV     BX,7
  230.         INT     10H
  231.         MOV     CURSOR_X,0
  232.         MOV     CURSOR_Y,24
  233.         CALL    SET_CURSOR
  234.         MOV     AH,9
  235.         MOV     DX,OFFSET COPY_PROMPT   ;Put that name in TARGET.
  236.         INT     21H
  237.         MOV     AH,0AH
  238.         MOV     BX,TARGET-2
  239.         MOV     DX,TARGET-2
  240.         MOV     BYTE PTR [BX],32        ;Add a space.
  241.         INT     21H
  242.  
  243.         MOV     SI,TARGET
  244. TRANS:  CMP     BYTE PTR [SI],13        ;Check for final slash on pathname.
  245.         JE      SLASH2
  246.         INC     SI                      ;Add it if it's missing.
  247.         JMP     TRANS
  248. SLASH2: CMP     BYTE PTR [SI-1],'\'
  249.         JE      FILER2
  250.         MOV     BYTE PTR [SI],'\'
  251.         INC     SI
  252. FILER2: MOV     TARGET_PATH_END,SI      ;All set to copy.
  253.         MOV     ATTRIB,7
  254.         CALL    COLOR                   ;Color out current file name.
  255.         MOV     CURSOR_X,0
  256.         MOV     CURSOR_Y,0
  257.         CALL    SET_CURSOR
  258. LOOPC:  MOV     COPY_FLAG,1             ;Set copy flag for GET_MARKED_FILE.
  259.         CALL    GET_MARKED_FILE         ;Find file to copy.
  260.         MOV     COPY_FLAG,0             ;Reset Copy flag.
  261.         CMP     CX,0FFH                 ;Find any?
  262.         JNE     OPEN                    ;Yes, open it.
  263.         JMP     FINC                    ;No, finished with copy.
  264. OPEN:   MOV     DX,SOURCE               ;Open the source file.
  265.         MOV     AX,3D00H
  266.         INT     21H
  267.         JC      BOTC                    ;If error, quit.
  268.         MOV     SOURCE_HANDLE,AX        ;Store source handle.
  269.         MOV     DX,TARGET               ;Create Target.
  270.         MOV     AH,3CH
  271.         MOV     CX,0
  272.         INT     21H
  273.         JC      BOTC                    ;If problem, assume disk full, quit.
  274.         MOV     TARGET_HANDLE,AX        ;Store target handle.
  275. STUFF:  MOV     DX,OFFSET DATA
  276.         MOV     CX,62*1024              ;Work in 62K chunks.
  277.         MOV     AH,3FH
  278.         MOV     BX,SOURCE_HANDLE        ;Read from source.
  279.         INT     21H
  280.         MOV     BYTES_READ,AX           ;How much did we get?
  281.         MOV     CX,AX                   ;No. bytes read.
  282.         MOV     BYTES_ASKED,CX
  283.         MOV     AH,40H                  ;Write to target.
  284.         MOV     BX,TARGET_HANDLE
  285.         MOV     DX,OFFSET DATA          ;From DATA area.
  286.         INT     21H
  287.         CMP     AX,BYTES_ASKED          ;Did we write everything?
  288.         JNE     FULL                    ;No, assume disk full.
  289.         CMP     BYTES_READ,62*1024      ;More to read?
  290.         JE      STUFF                   ;Yes.
  291.         JMP     BOTC                    ;No.
  292. FULL:   MOV     CURSOR_X,0              ;Disk is full.
  293.         MOV     CURSOR_Y,24             ;Reset display and quit.
  294.         CALL    SET_CURSOR
  295.         LEA     DX,FULL_MSG
  296.         MOV     AH,9                    ;Type out full message.
  297.         INT     21H
  298.         MOV     FULL_FLAG,1
  299.         MOV     CURSOR_X,0
  300.         MOV     CURSOR_Y,0
  301.         CALL    SET_CURSOR
  302. BOTC:   MOV     AH,3EH                  ;Done. Close all files.
  303.         MOV     BX,SOURCE_HANDLE
  304.         INT     21H                     ;Close Source.
  305.         MOV     AH,3EH
  306.         MOV     BX,TARGET_HANDLE        ;Close Target.
  307.         INT     21H
  308.         CMP     FULL_FLAG,1
  309.         JNE     NOTFULL
  310.         MOV     DX,TARGET
  311.         MOV     AH,41H
  312.         INT     21H
  313.         JMP     TOPPER                  ;Go back to beginning.
  314. NOTFULL:CALL    INC_CURSOR
  315.         CMP     DX,0FFH
  316.         JE      FINC
  317.         JMP     LOOPC                   ;Copy another file.
  318.  
  319. FINC:   CALL    DSPLAY2                 ;Done with copy.
  320.         MOV     ATTRIB,70H              ;Set cursor on.
  321.         CALL    COLOR
  322.         JMP     TOP                     ;Wait for next command.
  323.  
  324. NEW_DIR:CMP     AL,'N'                  ;Change directory?
  325.         JE      GON                     ;Yes.
  326.         JMP     TOP                     ;No -- ignore command. Wait for next.
  327. GON:    MOV     ATTRIB,7                ;Color out current file name.
  328.         CALL    COLOR
  329.         MOV     CURSOR_X,0
  330.         MOV     CURSOR_Y,24
  331.         CALL    SET_CURSOR              ;Ask for new directory.
  332.         MOV     AH,9
  333.         MOV     CX,80
  334.         MOV     AL,' '
  335.         MOV     BX,7
  336.         INT     10H
  337.         MOV     CURSOR_X,0
  338.         MOV     CURSOR_Y,24
  339.         CALL    SET_CURSOR
  340.         MOV     AH,9
  341.         MOV     DX,OFFSET NEW_DIR_PROMPT
  342.         INT     21H                     ;And now change subdirectories.
  343.         MOV     AH,0AH
  344.         MOV     BX,80H     
  345.         MOV     DX,80H     
  346.         MOV     BYTE PTR [BX],32        ;Blank out new dir message.
  347.         INT     21H
  348.         JMP     DIREX
  349.  
  350. OUT:    INT     20H                     ;Grand Exit.
  351. DIREX   ENDP
  352.  
  353. GET_MARKED_FILE PROC    NEAR            ;Find marked files from screen.
  354.                                         ;CX=FF --> no more to be found.
  355. BEGI:   MOV     AH,8
  356.         ADD     CURSOR_X,12
  357.         CALL    SET_CURSOR
  358.         MOV     BX,0                    ;Check last byte of file name on screen.
  359.         INT     10H
  360.         SUB     CURSOR_X,12
  361.         CALL    SET_CURSOR
  362.         CMP     AL,0FFH                 ;If it is FF, the file is marked.
  363.         JE      FINI
  364.         CALL    INC_CURSOR
  365.         CMP     DX,0FFH
  366.         JNE     BEGI
  367.         MOV     CX,0FFH                 ;NO MORE to be found!
  368.         JMP     OUTER
  369. FINI:   MOV     CX,0
  370.         MOV     SI,SOURCE_PATH_END
  371.         CALL    GET_FILE_NAME
  372.         CMP     COPY_FLAG,1             ;Set up SI?
  373.         JNE     OUTER
  374.         MOV     SI,TARGET_PATH_END      ;Yes for copying.
  375.         CALL    GET_FILE_NAME
  376. OUTER:  RET
  377. GET_MARKED_FILE ENDP
  378.  
  379. GET_FILE_NAME   PROC    NEAR            ;Gets file name from screen.
  380.         ;Call with DS:SI as address to put name at.
  381.         PUSH    CX
  382.         PUSH    SI
  383.         PUSH    WORD PTR CURSOR_X       ;Store cursor.
  384.         MOV     AH,8 
  385.         MOV     BX,0
  386.         MOV     CX,12                   ;12 Letters in name.
  387. LOOPB:  MOV     AH,8
  388.         INT     10H                     ;Get a letter.
  389.         INC     CURSOR_X
  390.         CALL    SET_CURSOR
  391.         MOV     DS:[SI],AL              ;Move it to DS:SI.
  392.         INC     SI                      ;Move on to next character.
  393.         LOOP    LOOPB
  394.         MOV     BYTE PTR DS:[SI],0      ;Make it ASCIIZ.
  395.         POP     WORD PTR CURSOR_X
  396.         POP     SI
  397.         CALL    SET_CURSOR              ;Reset cursor.
  398.         POP     CX
  399.         RET                             ;And return.
  400. GET_FILE_NAME   ENDP
  401.  
  402. COLOR   PROC    NEAR                    ;Set color of file name.
  403.         PUSH    CX                      ;If marked, leave rev. video.
  404.         PUSH    WORD PTR CURSOR_X       ;Save cursor.
  405.         MOV     CX,12                   ;12 characters in file name.
  406.         CMP     ATTRIB,7                ;Should we color out?
  407.         JNE     HERE                    ;No.
  408.         MOV     AH,8
  409.         ADD     CURSOR_X,12             ;Yes.
  410.         CALL    SET_CURSOR              ;Check if we should.
  411.         MOV     BX,0
  412.         INT     10H
  413.         SUB     CURSOR_X,12
  414.         CALL    SET_CURSOR
  415.         CMP     AL,0FFH                 ;Is file marked?
  416.         JE      FINE                    ;Yes, don't color out.
  417. HERE:   MOV     BX,0
  418.         MOV     AH,8            ;Change attribute character by character.
  419.         INT     10H
  420.         PUSH    CX
  421.         MOV     CX,1
  422.         MOV     BL,ATTRIB
  423.         MOV     AH,9
  424.         INT     10H
  425.         POP     CX
  426.         INC     CURSOR_X
  427.         CALL    SET_CURSOR
  428.         LOOP    HERE
  429. FINE:   POP     WORD PTR CURSOR_X       ;Restore cursor.
  430.         CALL    SET_CURSOR
  431.         POP     CX
  432.         RET
  433. COLOR   ENDP
  434.  
  435. DISPLAY PROC    NEAR                    ;Puts up main display on screen.
  436.         MOV     DI,SOURCE               ;Get source subdirectory.
  437.         MOV     SI,82H
  438.         MOV     SOURCE_PATH_END,SOURCE
  439.         MOV     BX,80H
  440.         CMP     BYTE PTR [BX],0
  441.         JE      FILER
  442. TRANS2: CMP     BYTE PTR [SI],13        ;Check for the slash at the end of it.
  443.         JE      SLASH
  444.         MOVSB
  445.         JMP     TRANS2                  ;If it's not there, add it.
  446. SLASH:  CMP     BYTE PTR [DI-1],'\'
  447.         JE      FILER
  448.         MOV     BYTE PTR [DI],'\'
  449.         INC     DI
  450. FILER:  MOV     SOURCE_PATH_END,DI      ;Get ready to find file name.
  451. DSPLAY2:MOV     CX,25                   ;Short version -- don't check source.
  452.         MOV     CURSOR_X,0
  453.         MOV     CURSOR_Y,0              ;Set cursor to top left.
  454.         CALL    SET_CURSOR
  455. WIPE:   PUSH    CX                      ;Clear the screen.
  456.         CALL    SET_CURSOR
  457.         MOV     CX,80
  458.         MOV     AH,9
  459.         MOV     BX,7
  460.         MOV     AL,0
  461.         INT     10H
  462.         POP     CX
  463.         INC     CURSOR_Y
  464.         LOOP    WIPE
  465.         MOV     CURSOR_X,6      ;Put up command line.
  466.         MOV     CURSOR_Y,24
  467.         CALL    SET_CURSOR
  468.         MOV     AH,9
  469.         MOV     DX,OFFSET PROMPT
  470.         INT     21H
  471.         MOV     CURSOR_X,0
  472.         MOV     CURSOR_Y,0
  473.         CALL    SET_CURSOR      ;Get ready to search.
  474.         MOV     AH,4EH
  475.         MOV     CX,4
  476.         MOV     DI,SOURCE_PATH_END      ;Add the *.* at the end of the path.
  477.         MOV     SI,OFFSET WILDCARDS
  478. REP     MOVSB
  479.         MOV     DX,SOURCE
  480.         INT     21H                     ;Search for first match to wildcards.
  481.         JC      ENDER                   ;If done, exit.
  482.         MOV     DX,0
  483.         MOV     AH,2
  484.         INT     10H
  485.         CALL    PRINT                   ;Print file name on screen.
  486.         MOV     CX,120                  ;Max of 120 files.
  487. LOOPER: MOV     AH,4FH
  488.         INT     21H                     ;Find next match.
  489.         JC      ENDER                   ;If no match, exit.
  490.         MOV     DISP_FLAG,0FFH          ;Set DISP_FLAG for INC_CURSOR.
  491.         CALL    INC_CURSOR
  492.         MOV     DISP_FLAG,0
  493.         CALL    PRINT
  494.         MOV     DX,OFFSET WILDCARDS
  495.         LOOP    LOOPER                  ;Look for next file name.
  496. ENDER:  MOV     CURSOR_X,0              ;Set cursor up at top left.
  497.         MOV     CURSOR_Y,0
  498.         CALL    SET_CURSOR
  499.         RET                             ;And exit.
  500. DISPLAY ENDP
  501.  
  502. INC_CURSOR      PROC    NEAR    ;Move cursor to next file.
  503.         PUSH    CX              ;Success-->DX=0.
  504.         MOV     DL,CURSOR_X
  505.         MOV     DH,CURSOR_Y
  506.         MOV     TEMPX,DL        ;Store cursor.
  507.         MOV     TEMPY,DH
  508.         ADD     DL,13           ;End of screen?
  509.         CMP     DL,75
  510.         JL      FIN
  511.         MOV     DL,0
  512.         INC     DH
  513. FIN:    MOV     CURSOR_X,DL
  514.         MOV     CURSOR_Y,DH
  515.         MOV     DX,0                    ;Return OK signal.
  516.         CALL    SET_CURSOR
  517.         CMP     DISP_FLAG,0             ;Is this a DISPLAY?
  518.         JNE     SET
  519.         MOV     SI,SOURCE_PATH_END      ;Yes, is the next character a space?
  520.         CALL    GET_FILE_NAME
  521.         CMP     BYTE PTR DS:[SI],' '
  522.         JA      SET                     ;No.
  523.         SUB     CURSOR_X,13
  524.         CMP     CURSOR_X,0
  525.         JG      LEAV
  526.         MOV     DL,TEMPX                ;If we can, update cursor.
  527.         MOV     CURSOR_X,DL             ;If not, restore it.
  528.         MOV     DH,TEMPY
  529.         MOV     CURSOR_Y,DH
  530. LEAV:   CALL    SET_CURSOR
  531.         MOV     DX,0FFH
  532. SET:    POP     CX                      ;Restore CX.
  533.         RET                             ;And exit.
  534. INC_CURSOR      ENDP
  535.  
  536. SET_CURSOR      PROC    NEAR            ;Position the cursor.
  537.         PUSH    AX
  538.         MOV     DL,CURSOR_X
  539.         MOV     DH,CURSOR_Y             ;Use INT 10H.
  540.         MOV     AH,2
  541.         INT     10H
  542.         POP     AX
  543.         RET                             ;Finish.
  544. SET_CURSOR      ENDP
  545.  
  546. PRINT   PROC    NEAR                    ;Print file names.
  547.         PUSH    CX
  548.         MOV     DX,80H+30               ;Check at CS:80H+30.
  549.         MOV     BX,DX
  550.         MOV     CX,13                   ;Search 13 chars for end of file name.
  551. LOOPA:  CMP     BYTE PTR [BX],0         ;Find end of file name.
  552.         JE      FOUND
  553.         INC     BX
  554.         LOOP    LOOPA
  555. FOUND:  MOV     BYTE PTR DS:[BX+1],'$'  ;Use string print.
  556.         MOV     AH,9                    ;Print out file name.
  557.         INT     21H
  558.         POP     CX
  559.         RET                     ;Finish.
  560. PRINT   ENDP
  561. DATA:                           ;Store data for copies starting here.
  562. CODE_SEG        ENDS
  563.         END     START
  564.  
  565.  
  566.  
  567.