Saturday, 5 December 2009

Assembler 5

40H FUNCTION

Use:

To write to a device or a file.

Call registers:

AH = 40H
BX = Path of communication
CX = Quantity of bytes to write
DS:DX = Address of the beginning of the data to write

Return registers:

CF = 0 if there was no mistake

AX = Number of bytes written

CF = 1 if there was a mistake

AX = Error code

The use of this function to display information on the screen is done by giving the BX register the value of 1 which is the preassigned value to the video by the operative system MS-DOS.



KEYBOARD INFORMATION FUNCTIONS


01H FUNCTION

Use:

To read a keyboard character and to display it.

Call registers

AH = 01H

Return registers:

AL = Read character

It is very easy to read a character from the keyboard with this function, the hexadecimal code of the read character is stored in the AL register. In case it is an extended register the AL register will contain the value of 0 and it will be necessary to call on the function again to obtain the code of that character.

0AH FUNCTION

Use:

To read keyboard characters and store them on the buffer.

Call registers:

AH = 0AH
DS:DX = Area of storage address
BYTE 0 = Quantity of bytes in the area
BYTE 1 = Quantity of bytes read
from BYTE 2 till BYTE 0 + 2 = read characters

Return characters:

None.

The characters are read and stored in a predefined space on memory. The structure of this space indicate that in the first byte are indicated how many characters will be read. On the second byte the number of characters already read are stored, and from the third byte on the read characters are written.

When all the indicated characters have been stored the speaker sounds and any additional character is ignored. To end the capture of the chain it is necessary to hit [ENTER].

3FH FUNCTION

Use:

To read information from a device or file.

Call registers:

AH = 3FH
BX = Number assigned to the device
CX = Number of bytes to process
DS:DX = Address of the storage area

Return registers:

CF = 0 if there is no error and AX = number of read bytes.
CF = 1 if there is an error and AX will contain the error code.
FILE WORKING FUNCTIONS:

FCB FUNCTIONS:
0FH FUNCTION

Use:

To open an FCB file

Call registers:

AH = 0FH
DS:DX = Pointer to an FCB

Return registers:

AL = 00H if there was no problem, otherwise it returns to 0FFH

No comments:

Post a Comment