Mail Archives: djgpp/1999/10/10/13:31:20
On Thu, 7 Oct 1999, Ben Davis wrote:
> I've written a rather hyperactive game using DJGPP and Allegro, in DOS.
> Naturally it uses DPMI, which involves disk-swapping.
Paging to disk is not supposed to happen unless your program used up
all the available physical memory. How much memory do you have
installed on the machine where this happens, and how much memory do
you estimate your program needs to run?
> I would like to know if there is a way of causing all disk-swapping to
> happen before the game displays any graphics or makes any sound.
Try setting the _CRT0_FLAG_LOCK_MEMORY bit in the _crt0_startup_flags
variable (it is documented in the library reference). This will lock
all the memory your program is using and prevent paging, unless the
target machine doesn't have enough physical memory to begin with.
> If I need
> to specify all the variables which must be in physical memory, then I can do
> it.
There's a library function __dpmi_lock_linear_region which can be used
to lock an individual variable or a function, and there are two helper
functions _go32_dpmi_lock_code and _go32_dpmi_lock_data. Look them up
in the library docs.
Note that if you have lots of variables which need locking, locking
them one by one might be tedious.
- Raw text -