Professional Documents
Culture Documents
RAPORT
Lucrare de curs
la Structuri de Date i Algoritmi
Tema : DOS and BIOS services in C
A efectuat:
A. Culeva
A verificat:
M. Kulev
Chiinu
2015
Introduction.....................................................................
..................................
An interrupt is a signal
to the emitted by
hardware or software
indicating an event that
needs immediate
attention. An interrupt
alerts the processor to a
high-priority condition
requiring the interruption
of the current code the
processor is executing.
The processor responds
by suspending its current
activities, saving its, and
executing a called an (or
an interrupt service
routine, ISR) to deal with
the event. This
interruption is temporary,
and, after the interrupt
handler finishes, the
processor resumes normal
activities. There are two types of interrupts: hardware interrupts and
software interrupts.
Purpose of BIOS calls
BIOS interrupt calls perform hardware control or I/O functions
requested by a program, return system information to the program, or
do both. A key element of the purpose of BIOS calls is abstractionthe
BIOS calls perform generally defined functions, and the specific details
of how those functions are executed on the particular hardware of the
system are encapsulated in the BIOS and hidden from the program. So,
for example, a program that wants to read from a hard disk does not
need to know whether the hard disk is an ATA, SCSI, or SATA drive (or
in earlier days, an ESDI drive, or an MFM or RLL drive with perhaps a
Seagate ST-506 controller, perhaps one of the several Western
Digitalcontroller types, or with a different proprietary controller of
another brand). The program only needs to identify the number of the
drive it wishes to access and the address of the sector it needs to read
or write, and the BIOS will take care of translating this general request
into the specific sequence of elementary operations required to
complete the task through the particular disk controller hardware that
is connected to that drive. The program is freed from needing to know
how to control at a low level every type of hard disk (or display
adapter, or port interface, or real-time clock peripheral) that it may
need to access. This both makes programming operating systems and
applications easier and makes the programs smaller, reducing the
duplication of program code, as the functionality that is included in the
BIOS does not need to be included in every program that needs it;
relatively short calls to the BIOS are included there instead. (In
operating systems where the BIOS is not used, service calls provided
by the operating system itself generally fulfill the same function and
purpose.)
Calling BIOS service calls
Operating systems and other software communicates with the BIOS
software, in order to control the installed hardware, via software
interrupts. A software interrupt is a specific variety of the general
concept of an interrupt. An interrupt is a mechanism by which the CPU
can be directed to stop executing the main-line program and
immediately execute a special program, called an Interrupt Service
Routine (ISR), instead. Once the ISR finishes, the CPU continues with
the main program. On x86 CPUs, the ISR to call when an interrupt
occurs is found by looking it up in a table of their addresses (called
"interrupt vectors") in memory. An interrupt is invoked by its type
number, from 0 to 255; the type number is used as an index into this
table; the address found in the table is the address of the ISR that will
be run in response to the interrupt. A software interrupt is simply an
interrupt that is triggered by a software command; therefore, software
interrupts function like subroutines, with the main difference that the
program that makes a software interrupt call does not need to know
the address of the ISR, only its interrupt number. This has advantages
for modularity, compatibility, and flexibility in system configuration.
The following is a list of the standard BIOS interrupts used in a typical
BIOS.
Interrup
Address
Type
00h
01h
02h
03h
0000:0000h
0000:0004h
0000:0008h
0000:000Ch
Processor
Processor
Processor
Processor
Divide by zero
Single step
Non maskable interrupt (NMI)
Breakpoint
04h
0000:0010h
Processor
Arithmetic overflow
05h
0000:0014h
Software
Print screen
Description
06h
07h
08h
0000:0018h
0000:001Ch
0000:0020h
Processor
Processor
Hardware
Invalid op code
Coprocessor not available
System timer service routine
09h
0000:0024h
Hardware
0Ah
0000:0028h
Hardware
0Bh
0Ch
0Dh
0000:002Ch
0000:0030h
0000:0034h
Hardware
Hardware
Hardware
0Eh
0000:0038h
Hardware
0Fh
10h
11h
0000:003Ch
0000:0040h
0000:0044h
Hardware
Software
Software
12h
0000:0048H
Software
13h
14h
15h
16h
0000:004Ch
0000:0050h
0000:0054h
0000:0058h
Software
Software
Software
Software
17h
0000:005Ch
Software
18h
0000:0060h
Software
19h
0000:0064h
Software
1Ah
0000:0068h
Software
1Bh
0000:006Ch
Software
1Ch
0000:0070h
Software
1Dh
1Eh
1Fh
00000074h
0000:0078h
0000:007Ch
Software
Software
Software
20h-3Fh
0000:0080f 0000:00FCh
SOftware
40h
41h
42h
0000:0100h
0000:0104h
0000:0108h
Software
Software
Software
43h
0000:010Ch
Software
44h
45h
46h
47h
0000:0110h
0000:0114h
0000:0118h
0000:011Ch -
Software
Software
Software
Software
48h
Software
Not used
49h
0000:0124h
4Ah
0000:0128h
4Bh0000:012Ch 63h
64h
65h66h
67h
68h-6Fh 0000:01BCh
70h
0000:01c0h
Software
Software
Not used
User alarm
Software
Not used
Software
Software
Not used
Software
Software
Hardware
71h
Hardware
0000:01C4h
72h74h
0000:01C8h 0000:01D0h
Hardware
75h
0000:01D4h
Hardware
76h
0000:01D8h
Hardware
Hardware
Suspend request
Hardware
Not used
Software
Software
77h
0000:01DCh
78h0000:01E0h 79h
7Ah
78h-FFh 0000:03FCh