Chapter
1
SYSTEM
CALLS
MS-DOS interrupt and function calls provide a convenient way
to
perform certain primitive functions and make it easier for you
to
write machine-independent programs. This chapter describes
how and when these routines can be called and the process per-
formed by each.
Calling and Returning
You invoke the system calls from Macro Assembler by moving re-
quired data into registers and issuing an interrupt. As some
of
the calls destroy registers, you may have
to
save the register
contents before using a system call.
The system calls are also invoked from any high-level language
that has modules capable of linking with assembly language
modules.
Control is returned
to
MS-DOS in 4 ways:
0
Issue Function Call 4CH:
MUV
AH,4CH
INT
21H
This is the preferred method.
Issue Interrupt 20H:
INT 20H
This method simulates system call OOH.
Prefix):
Jump to location
0
(the beginning of the Program Segment
JMP
0
As
location 0 of the Program Segment Prefix contains an INT
20H instruction, this technique is
1
step removed from tech-
nique
2.
0
Issue Function Call OOH:
MOV
AH,00H
INT 21H
This transfers control
to
location 0 in the Program Segment
Prefix.
9