Saturday, 5 December 2009

Assembler 6

HANDLES:

3CH FUNCTION

Use:

To create a file if it does not exist or leave it on 0 length if it exists,
Handle.

Call registers:

AH = 3CH
CH = File attribute
DS:DX = Pointer to an ASCII specification.

Return registers:
CF = 0 and AX the assigned number to handle if there is no error, in case there is, CF will be 1 and AX will contain the error code: 3 path not found, 4 there
CF will be 1 and AX will contain the error code: 3 path not found, 4 there are no handles available to assign and 5 access denied.

This function substitutes the 16H function. The name of the file is specified on an ASCII chain, which has as a characteristic being a conventional chain of bytes ended with a 0 character.

The file created will contain the attributes defined on the CX register in the following manner:

Value Attributes
00H Normal
02H Hidden
04H System
06H Hidden and of system

The file is created with the reading and writing permissions. It is not possible to create directories using this function.


3DH FUNCTION

Use:

It opens a file and returns a handle.

Call registers:

AH = 3DH
AL = manner of access
DS:DX = Pointer to an ASCII specification

Return registers:

CF = 0 and AX = handle number if there are no errors, otherwise CF = 1 and AX = error code: 01H if the function is not valid, 02H if the file was not found, 03H if the path was not found, 04H if there are no available handles, 05H in case access is denied, and 0CH if the access code is not valid.

The returned handled is 16 bits.

The access code is specified in the following way:

BITS

7 6 5 4 3 2 1

. . . . 0 0 0 Only reading
. . . . 0 0 1 Only writing
. . . . 0 1 0 Reading/Writing
. . . x . . . RESERVED

3EH FUNCTION

Use:

Close file (handle).

Call registers:

AH = 3EH
BX = Assigned handle

Return registers:

CF = 0 if there were no mistakes, otherwise CF will be 1 and AX will contain the error code: 06H if the handle is invalid.

This function dates the file and frees the handle it was using.

3FH FUNCTION

Use:

To read a specific quantity of bytes from an open file and store them on a specific buffer.

No comments:

Post a Comment