EasyManua.ls Logo

Atari ST series - Page 105

Atari ST series
420 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
GEMDOS Device I/O and Process Control
where address is the starting address of a block of memory
allocated with Malloc(). If the memory is successfully reî™…
turned to the system, a 0 is returned in status. A negative
value in status indicates that an error occurred. If a program
fails to release one or more blocks of memory, GEMDOS will
automatically return them to the free pool when the program
terminates.
Atari documentation states that if more than 20 blocks of
memory are allocated by Malloc() at one time, the memory
management system will fail. Since some library functions
like fopen() use Malloc() to allocate blocks for their own
use, your program should use Malloc() very sparingly. If
your program needs more than one memory area allocated, it
is best to get one big block of memory and divide it up yourî™…
self, rather than requesting many small areas from Malloc().
As stated above, when a program is loaded and run, it
takes control of the entire Transient Program Area (TPA),
which consists of all of the memory from the program's Base
Page Address on up to the top of free RAM. This area inî™…
cludes the base page, which stores information about the
process, the program code, the program data, and program
variable storage areas. The composition of the TP A is deî™…
tailed in Figure 5-1 below.
Figure 5-1. Composition of the Transient Program Area
High
Nenory
U )
Lon
Menory
Stack
Heap
BSS Segment
Data Segnent
Text Segnent
Basepage+128
Connand line inage
Basepage+44
Pointer to the environnent string
Basepage+40
Reserved
Basepage+36
Pointer to parent's basepage
Basepage+32
Disk Transfer Address (DTfl)
Basepage+28
Length of BSS Segnent
Basepage+24
Address of BSS Segnent
Basepage+2B
Length of Data Segnent
Basepage+16
Address of Data Segnent
Basepage+12
Length of Text Segnent
Basepage+8
Address of Text Segnent
Basepage+4
Address of End of TPA+i
Basepage
Base Address of TPA
o End of TPA
(stack
pointer)
$Start of TPA
97

Related product manuals