Atari ST series Technical Reference Manual page 112

Hide thumbs Also See for ST series:
Table of Contents

Advertisement

0. To pass a return code other than 0 to the calling process,
you must use the function Pterm ():
int retcode;
Pterm(retcode);
where retcode is a binary number you wish to pass to the call­
ing program. This code may be used to inform the calling
program of the results of the child process.
The last process termination function, Ptermres(), is
used for a special class of programs known as Terminate-
and-Stay-Resident programs (TSR). These programs remain
loaded in memory even after they terminate. TSR programs
can steal the vectors used by exception handlers, such as the
system timer, vertical blank interrupt, or the keyboard Alter-
nate-Help screen dump routine, to create pop-up or hot-key
applications. Ptermres() is called like this:
long keepsize;
int retcode;
Ptermres(keepsize, retcode);
where keepsize indicates the number of bytes of memory to
keep resident, starting at and including the 256-byte base­
page. The retcode value is the exit code that the program
passes back to the parent process when it terminates. Mem­
ory allocated by the program with Malloc() will not be re­
turned when the process terminates, but open files are
closed upon termination of the process.
Program 5-4 is a machine-language program that shows
how to steal the screen-dump vector at location $502, and to
install your own program, which will execute every time you
press the Alternate-Help key combination. For the sake of
simplicity, this program toggles the key-click sound on and
off. The first use will turn off the clicking noise that you hear
when you press a key, and the next use will turn it back on.
Program 5-4. TOGGLE.S
TOGGLE•S —
Pt e r m r e s Q
install a RAM-resident utility.
example toggles the key-click sound when you
press Alternate-Help.
104
CHAPTER 5
Demonstrates the use of the GEMDOS
function from machine language, to
This short
*
*
*
*
*
*
*
*

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents