KEMBAR78
Creating Directory - Notes | PDF | Computer File | Filename
0% found this document useful (0 votes)
6 views3 pages

Creating Directory - Notes

Assembly Codes

Uploaded by

Diego Abad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Creating Directory - Notes

Assembly Codes

Uploaded by

Diego Abad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

INT 21h / AH= 39h - make directory.

entry: DS:DX -> ASCIZ pathname; zero terminated string, for example:

the above code creates c:\emu8086\vdrive\C\mydir directory if run by the emulator.

Return: CF clear if successful AX destroyed. CF set on error AX = error code.


Note: all directories in the given path must exist except the last one.

INT 21h / AH= 3Ah - remove directory.


Entry: DS:DX -> ASCIZ pathname of directory to be removed.
Return:
CF is clear if successful, AX destroyed CF is set on error AX = error code.
Notes: directory must be empty (there should be no files inside of it).

INT 21h / AH= 3Bh - set current directory.


Entry: DS:DX -> ASCIZ pathname to become current directory (max 64 bytes).
Return:

Carry Flag is clear if successful, AX destroyed.


Carry Flag is set on error AX = error code.
Notes: even if new directory name includes a drive letter, the default drive is not changed,
only the current directory on that drive.

INT 21h / AH= 3Ch - create or truncate file.

DS:DX -> ASCIZ filename.

returns:
CF clear if successful, AX = file handle.
CF set on error AX = error code.

INT 21h / AH= 3Dh - open existing file.

DS:DX -> ASCIZ filename.


Return:

CF clear if successful, AX = file handle.


CF set on error AX = error code.

note 1: file pointer is set to start of file.


note 2: file must exist.

INT 21h / AH= 3Eh - close file.

Entry: BX = file handle

Return:

CF clear if successful, AX destroyed.


CF set on error, AX = error code (06h).
INT 21h / AH= 3Fh - read from file.
Entry:
BX = file handle.
CX = number of bytes to read.
DS:DX -> buffer for data.

Return:

CF is clear if successful - AX = number of bytes actually read; 0 if at EOF (end of file) before call.
CF is set on error AX = error code.

Note: data is read beginning at current file position, and the file position is updated after a successful read the returned AX may be
smaller than the request in CX if a partial read occurred.

INT 21h / AH= 40h - write to file.

entry:

BX = file handle.
CX = number of bytes to write.
DS:DX -> data to write.

return:

CF clear if successful; AX = number of bytes actually written.


CF set on error; AX = error code.

note: if CX is zero, no data is written, and the file is truncated or extended to the current position data is written beginning at the
current file position, and the file position is updated after a successful write the usual cause for AX < CX on return is a full disk.

INT 21h / AH= 41h - delete file (unlink).

Entry:

DS:DX -> ASCIZ filename (no wildcards, but see notes).

return:

CF clear if successful, AX destroyed. AL is the drive of deleted file (undocumented).


CF set on error AX = error code.

Note: DOS does not erase the file's data; it merely becomes inaccessible because the FAT chain for the file is cleared deleting a file
which is currently open may lead to filesystem corruption.

INT 21h / AH= 42h - SEEK - set current file position.

Entry:
AL = origin of move: 0 - start of file. 1 - current file position. 2 - end of file.
BX = file handle.
CX:DX = offset from origin of new file position.

Return:

CF clear if successful, DX:AX = new file position in bytes from start of file.
CF set on error, AX = error code.

Notes:
for origins 1 and 2, the pointer may be positioned before the start of the file; no error is returned in that case, but subsequent attempts
to read or write the file will produce errors. If the new position is beyond the current end of file, the file will be extended by the next
write (see AH=40h).

INT 21h / AH= 47h - get current directory.

DL = drive number (00h = default, 01h = A:, etc)


DS:SI -> 64-byte buffer for ASCIZ pathname.
Return:
Carry is clear if successful
Carry is set on error, AX = error code (0Fh)

INT 21h / AH=4Ch - return control to the operating system (stop program).

INT 21h / AH= 56h - rename file / move file.


Entry:
DS:DX -> ASCIZ filename of existing file.
ES:DI -> ASCIZ new filename.
Return:

CF clear if successful.
CF set on error, AX = error code.

Note: allows move between directories on same logical drive only; open files should not be renamed!

You might also like