Assembly Language Help (alang.hlp) (Table of Contents; Topic list)
CreateFile
 Map                                       Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
;* CreateFile - Creates file with specified attribute.
;*
;* Shows:   DOS Function - 3Ch (Create File)
;*
;* Params:  Attr - Attribute code:  0 = normal        8 = volume label
;*                                        1 = read only    16 = subdirectory
;*                                        2 = hidden              32 = archive
;*                                        4 = system
;*          Fspec - Pointer to ASCIIZ file specification
;*
;* Return:  Short integer with file handle or -1 for error
 
CreateFile PROC USES ds,
        Attr:WORD, Fspec:PBYTE
 
        LoadPtr ds, dx, Fspec           ; Point DS:DX to file spec
        mov     cx, Attr                ; CX = attribute
        mov     ah, 3Ch                 ; AH = function number
        int     21h                     ; Create file
        .IF     carry?
        mov     ax, -1                  ; Set error code
        .ENDIF
        ret
 
CreateFile ENDP
                                    -♦-