Subversion Repositories SvarDOS

Rev

Rev 369 | Rev 392 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 369 Rev 388
Line 55... Line 55...
55
    mov dl, 0x0A /* LF */
55
    mov dl, 0x0A /* LF */
56
    int 0x21
56
    int 0x21
57
    FINITO:
57
    FINITO:
58
  }
58
  }
59
}
59
}
-
 
60
 
-
 
61
 
-
 
62
/* find first matching files using a FindFirst DOS call
-
 
63
 * returns 0 on success or a DOS err code on failure */
-
 
64
unsigned short findfirst(struct DTA *dta, const char *pattern, unsigned short attr) {
-
 
65
  unsigned short res = 0;
-
 
66
  _asm {
-
 
67
    /* set DTA location */
-
 
68
    mov ah, 0x1a
-
 
69
    mov dx, dta
-
 
70
    int 0x21
-
 
71
    /* */
-
 
72
    mov ah, 0x4e    /* FindFirst */
-
 
73
    mov dx, pattern
-
 
74
    mov cx, attr
-
 
75
    int 0x21        /* CF set on error + err code in AX, DTA filled with FileInfoRec on success */
-
 
76
    jnc DONE
-
 
77
    mov [res], ax
-
 
78
    DONE:
-
 
79
  }
-
 
80
  return(res);
-
 
81
}
-
 
82
 
-
 
83
 
-
 
84
/* find next matching, ie. continues an action intiated by findfirst() */
-
 
85
unsigned short findnext(struct DTA *dta) {
-
 
86
  unsigned short res = 0;
-
 
87
  _asm {
-
 
88
    mov ah, 0x4f    /* FindNext */
-
 
89
    mov dx, dta
-
 
90
    int 0x21        /* CF set on error + err code in AX, DTA filled with FileInfoRec on success */
-
 
91
    jnc DONE
-
 
92
    mov [res], ax
-
 
93
    DONE:
-
 
94
  }
-
 
95
  return(res);
-
 
96
}