Owner's manual

Allegro DOS Owner’s Manual 121
For applications that do not take advantage of the Allegro power
API, the BIOS Automatic Power Manager can greatly extend
operating time and should be used when possible. In our experience,
it works quite well with most applications. However, because the
BIOS can only guess what the processor is doing, in some cases it
may shut activities down when it should not and vice versa. If the
program is misbehaving with Power Manager enabled, try disabling
it. If the problem disappears, then there may be a confl ict with your
program and the Power Manager. If you encounter a situation where
you cannot use the Power Manager, the next best thing for power
savings is to set the performance level to the lowest possible setting
in which the program still functions properly.
If you are writing an application for Allegro, we strongly encourage
designing power management into your program. Any time the
processor is waiting for input, you may want to put it to sleep. The
most common case where this technique is used is while waiting for
a keystroke. See the Allegro Getch() example for a means to shut the
processor down while waiting for a keystroke. A rule of thumb is
whenever the processor may be waiting for 50 milliseconds or more
for input it should be put to sleep.
Another case where power management can be used is when
an application temporarily needs to perform some high speed
processing of data. The Allegro_CpuBusy() function can be used to
override the Power Manager and put the processor into high speed
mode while the processing is taking place. The Allegro_CpuDone()
function is used to restore settings when processing is completed.
Power management for DOS operation can be controlled by the
user from the System Setup program (refer to Chapter 4, MS-DOS
Operating System, System Setup Program for more details). It can be
controlled programmatically through the Extended BIOS Functions
(later in this chapter) as illustrated by the examples on the following
pages written in C and Assembly language. Note that these examples
are for DOS operation only.