comment *
..---------!-------!-------!-------------!-------------------R
..-----------------------------------------------------------!----!------------------------------------------------------------------!
.mt0
.mb2
.pl80
.fo cdira.asm page # of 1 160156 sep 84
.po0
0 *
PAGE 80,132
;----------------------------------------------------------;


PGROUP   GROUP   PROG
PROG     SEGMENT BYTE PUBLIC 'PROG'    ;macros + structures
         ASSUME  CS:PGROUP             ;go before this

GET_DIR  PROC    NEAR                  ;near from C
         PUBLIC  GET_DIR
         PUSH    BP                    ;
         MOV     BP,SP                 ;


         MOV     DX,[BP+6]             ;DS:DX to DTA dest
         PUSH    DX                    ;need addr later
         MOV     AH,1AH                ;set DTA to fcb
         INT     21H

         MOV     DX,[BP+4]             ;DS:DX to search dest
         MOV     AH,11H                ;search first dir
         INT     21H                   ;put dir into fcb
         CMP     AL,0FFH               ;@ [BP+6]
         JZ      OUT                   ;no matches

MORE:    MOV     CX,112                ;

         POP     DX                    ;previous DTA
         ADD     DX,[BP+8]             ;step DTA to next ntr
         PUSH    DX                    ;save for next time
         MOV     AH,1AH                ;and reset DTA to it
         INT     21H                   ;? efficiency ?
         MOV     DX,[BP+4]             ;next entry source
         MOV     AH,12H                ;search for next ntry
         INT     21H                   ;moves it to DTA
         CMP     AL,0FFH               ;
         JZ      OUT                   ;no matches
         add     dx,[bp+8]             ;hope it kept bp+4
         LOOP    MORE                  ;

OUT:     POP     DX                    ;clr stack
         POP     BP                    ;
         RET     6                     ;just parms; DX above

GET_DIR  ENDP                          ;close procedure



CDFREESP PROC    NEAR                  ;
         PUBLIC  CDFREESP              ;
         PUSH    BP                    ;
         MOV     BP,SP                 ;


         MOV     DL,[BP+4]             ;drive #
         XOR     AX,AX                 ;clear for safety
         MOV     AH,36H                ;get disk free space
         INT     21H                   ;DOSCALL see p D 33
         MOV     DI,[BP+6]
         MOV     [DI],BX               ;clusters avail.
         MOV     DI,[BP+8]
         MOV     [DI],DX               ;clusters on drive
         MOV     DI,[BP+10]
         MOV     [DI],CX               ;bytes per sector
         MOV     DI,[BP+12]
         MOV     [DI],AX               ;sectors/cluster


         POP     BP                    ;
         RET     10                    ;clear stack

CDFREESP ENDP                          ;close procedure
PROG     ENDS                          ;close segment
         END                           ;close assembly

