Tekil Mesaj gösterimi
Alt 06-09-2008, 15:12   #8
Constantin
ยŦยк
 
Constantin - ait Kullanıcı Resmi (Avatar)
 

rpose: To call on diverse BIOS video function

Syntax:
int 10H
This interruption has several functions, all of them control the video input/output, to access each one of them it is necessary that the function number which is required at the moment of calling the interruption is in the Ah register.

In this tutorial we will see some functions of the 10h interruption.

Common functions of the 10h interruption
02H Function, select the cursor position
09H Function, write attribute and character of the cursor
0AH Function, write a character in the cursor position
0EH Function, Alphanumeric model of the writing characters
02h Function

Use:

Moves the cursor on the computer screen using text model.

Call registers:
AH = 02H
BH = Video page where the cursor is positioned.
DH = row
DL = Column
Return Registers:

None.

The cursor position is defined by its coordinates, starting from the position 0,0 to position 79,24. This means from the left per computer screen corner to right lower computer screen. Therefore the numeric values that the DH and DL registers get in text model are: from 0 to 24 for rows and from 0 to 79 for columns.

09h Function

Use:

Shows a defined character several times on the computer screen with a defined attribute, starting with the actual cursor position.

Call registers:
AH = 09H
AL = Character to display
BH = Video page, where the character will display it;
BL = Attribute to use number of repetition.
Return registers:

None

This function displays a character on the computer screen several times, using a specified number in the CX register but without changing the cursor position on the computer screen.

0Ah Function

Use:

Displays a character in the actual cursor position.

Call registers:
AH = 0AH
AL = Character to display
BH = Video page where the character will display it
BL = Color to use (graphic mode only).
CX = number of repetitions
Return registers:

None.

The main difference between this function and the last one is that this one doesn't allow modifications on the attributes neither does it change the cursor position.

0EH Function

Use:

Displays a character on the computer screen dates the cursor position.

Call registers:
AH = 0EH
AL = Character to display
BH = Video page where the character will display it
BL = Color to use (graphic mode only).
Return registers:

None


16H interruption

We will see two functions of the 16 h interruption, these functions are called by using the AH register.

Functions of the 16h interruption
00H Function, reads a character from the keyboard.
01H Function, reads the keyboard state.
00H Function
Use:

Reads a character from the keyboard.

Call registers:
AH = 00H
Return registers:
AH = Scan code of the keyboard
AL = ASCII value of the character
When we use this interruption, the program executing is halted until a character is typed, if this is an ASCII value; it is stored in the Ah register, Else the scan code is stored in the AL register and the AH register contents the value 00h.

The proposal of the scan code is to use it with the keys without ASCII representation as [ALT][CONTROL], the function keys and so on.

01h function

Use:

Reads the keyboard state

Call registers:
AH = 01H
Return registers:

If the flag register is zero, this means, there is information on the buffer memory, else, there is no information in the buffer memory. Therefore the value of the Ah register will be the value key stored in the buffer memory.


17H Interruption

Purpose: Handles the printer input/output.

Syntax:
Int 17H
This interruption is used to write characters on the printer, sets printer and reads the printer state.

Functions of the 16h interruptions
00H Function, prints value ASCII out
01H Function, sets printer
02H Function, the printer state
00H Function

Use:

Writes a character on the printer.

Call registers:
AH = 00H
AL = Character to print.
DX = Port to use.
Return registers:
AH = Printer device state.
The port to use is in the DX register, the different values are: LPT1 = 0, LPT2 = 1, LPT3 = 2 ...

The printer device state is coded bit by bit as follows:
BIT 1/0 MEANING
---------------
0 1 The waited time is over
1 -
2 -
3 1 input/output error
4 1 Chosen printer
5 1 out-of-paper
6 1 communication recognized
7 1 The printer is ready to use
1 and 2 bits are not relevant

Most BIOS sport 3 parallel ports, although there are BIOS which sport 4 parallel ports.

01h Function

Use:

Sets parallel port.

Call registers:
AH = 01H
DX = Port to use
Return registers:
AH = Printer status
Port to use is defined in the DX register, for example: LPT=0, LPT2=1, and so on.

The state of the printer is coded bit by bit as follows:
BIT 1/0 MEANING
---------------
0 1 The waited time is over
1 -
2 -
3 1 input/output error
4 1 Chosen printer
5 1 out-of-paper
6 1 communication recognized
7 1 The printer is ready to use
1 and 2 bits are not relevant

Most BIOS sport 3 parallel ports, although there are BIOS which sport 4 parallel ports.

02h Function

Uses:

Gets the printer status.

Call registers:
AH = 01H
DX = Port to use
Return registers
AH = Printer status.
Port to use is defined in the DX register, for example: LPT=0, LPT2=1, and so on

The state of the printer is coded bit by bit as follows:
BIT 1/0 MEANING
---------------
0 1 The waited time is over
1 -
2 -
3 1 input/output error
4 1 Chosen printer
5 1 out-of-paper
6 1 communication recognized
7 1 The printer is ready to use
1 and 2 bits are not relevant

Most BIOS sport 3 parallel ports, although there are BIOS which sport 4 parallel ports.


Ways of working with files
There are two ways to work with files, the first one is by means of file control blocks or "FCB" and the second one is by means of communication channels, also known as "handles".

The first way of file handling has been used since the CPM operative system, predecessor of DOS, thus it assures certain compatibility with very old files from the CPM as well as from the 1.0 version of the DOS, besides this method allows us to have an unlimited number of open files at the same time. If you want to create a volume for the disk the only way to achieve this is by using this method.

Even after considering the advantages of the FCB, the use of the communication channels it is much simpler and it allows us a better handling of errors, besides, since it is much newer it is very probable that the files created this way maintain themselves compatible through later versions of the operative system.

For a greater facility on later explanations I will refer to the file control blocks as FCBs and to the communication channels as handles.
Constantin Ofline   Alıntı ile Cevapla