@CHIP-RTOS C Library - BIOS API
Set the memory gap used between the loaded
int BIOS_Set_Memory_Gap ( unsigned int paragraphs );
- Size of memory gap in 16 byte (SC1x) or 256 byte (SC2x/SC1x3)
range [0 .. 2048]
- 0: Successful
-1: Failure, invalid value in paragraphs
- This function sets the size of the memory gap that will be used between
subsequently loaded DOS programs. This gap serves as a memory reserve.
Some programs compiled with Borland C 5.02 try to increase the
size of their program memory block at runtime before, for
example, opening a file with Borland C-Library function fopen.
(The programs calls int21h
This happens down inside the
C-Library fopen function and is not directly visible to the application programmer.)
This memory resize call fails if another program has been loaded after
the one making the call due to now there is no memory space
left for increasing the memory size of the first program. The program
returns from fopen with an error.
The global program variable errno is set to value 8 (not enough memory).
To prevent this error the size of a memory gap between two loaded programs can
The value is defined in terms of memory paragraphs
(1 paragraph = 16 bytes on SC1x / 256 bytes on SC2x/SC1x3).
This value can also defined in the
This strategy could fail in the cases where programs are terminated and
are started again.
It is usually not necessary to set this entry, if the application does not show
the described error. Only if a C-Library function call sets errno to 8,
should this value be defined. We recommend in that case a value of
128 paragraphs for SC1x or 8 paragraphs for SC1x3 (2048 bytes in either case).
- The BeckHeap library provides an
alternative solution to this memory problem.
- This library function invokes a RTOS software interrupt.
Refer to this RTOS API function's
for more details.
Supported since or modified in @CHIP-RTOS version
This API List
List of C Libraries
@CHIP-RTOS Main Index
End of document