NAME    DAVID

;    DAVID'S MS-FORTRAN Runtime DOS INTERFACE.
;
;    MACRO DEFINITIONS
SET_DTA MACRO  BUFFER
        MOV     DX,OFFSET DGROUP:BUFFER
        MOV     AH,1AH
        INT     33
        ENDM
SEARCH_FIRST MACRO  FCB
             MOV  DX,OFFSET DGROUP:FCB
             MOV  AH,11H
             INT  33
             ENDM
DISPLAY  MACRO  STRING
         MOV  DX,OFFSET DGROUP:STRING
         MOV  AH,09H
         INT  33
         ENDM
SEARCH_NEXT MACRO FCB
            MOV  DX,OFFSET DGROUP:FCB
            MOV  AH,12H
            INT  33
            ENDM
PAGE +
;
;       DGROUP, DATA   segment    class DATA
;
DATA    SEGMENT PUBLIC 'DATA'
        FCB2    DB  0,"???????????"
                DB  25 DUP(?)
        STRING  DB  14 DUP(?)
         CRLF   DB  13,10,'$'
        BUFFER  DB  128 DUP(?)
DATA    ENDS

DGROUP  GROUP   DATA
CODE    SEGMENT 'CODE'
        ASSUME  CS:CODE,DS:DGROUP,SS:DGROUP
PUBLIC  DIRFOR

;DOSFN:  Call DOS Operating System
;
DIRFOR  PROC    FAR
        POP     SI           ;get ret address
        POP     DI
        POP     BX
        POP     ES         ;ES,BX := addr of 2nd param
        MOV     AX,ES:[BX]
        MOV    DS:FCB2[0],AL          ;must be in high half
        PUSH    DI           ;save ret address
        PUSH    SI
        PUSH    BP
        SET_DTA BUFFER
   SEARCH_FIRST FCB2
        CMP     AL,0FFH
        JE      ALL_DONE
        MOV     AL,DS:BUFFER[11]
        MOV     DS:BUFFER[12],AL
        MOV     AL,DS:BUFFER[10]
        MOV     DS:BUFFER[11],AL
        MOV     AL,DS:BUFFER[9]
        MOV     DS:BUFFER[10],AL
        MOV     AL,20H
        MOV     DS:BUFFER[9],AL
        MOV     AL,"$"
        MOV     DS:BUFFER[13],AL
        DISPLAY BUFFER[1]
        DISPLAY CRLF
;
GET_IT:
    SEARCH_NEXT FCB2
        CMP     AL,0FFH
        JE      ALL_DONE
        MOV     AL,DS:BUFFER[11]
        MOV     DS:BUFFER[12],AL
        MOV     AL,DS:BUFFER[10]
        MOV     DS:BUFFER[11],AL
        MOV     AL,DS:BUFFER[9]
        MOV     DS:BUFFER[10],AL
        MOV     AL,20H
        MOV     DS:BUFFER[9],AL
        MOV     AL,"$"
        MOV     DS:BUFFER[13],AL
        DISPLAY BUFFER[1]
        DISPLAY CRLF
        JMP GET_IT
;
 ALL_DONE:
;
        DISPLAY CRLF
        POP     BP             ;restore frame pointer
        RET
DIRFOR   ENDP
 CODE    ENDS

END
