From: Ullrich von Bassewitz (uz_at_musoftware.de)
Date: 2003-10-28 10:39:28
On Mon, Oct 27, 2003 at 01:35:20PM -0800, Shawn Jefferson wrote: > This might be slightly off topic, but I noticed that in _heap.s we are > subtracting the size of the stack. Since the stack is by default on > the Atari platform put at MEMTOP, if I move my BSS segment, is not > _heap.s wasting some memory that otherwise could be used? The heap > grows downward toward the program, right? On the Atari, the stack is initialized to MEMTOP. Later, module constructors may decrease this value if additional space is needed for other purposes. Last, the heap module subtracts the proposed size of the heap (as specified in the linker config) from the stack pointer and uses this value as the upper limit for the heap (the stack pointer itself is not changed by the heap routines). So, as far as I can tell, nothing is wasted if you move your BSS segment. For special setups, with larger changes to the segment setup, you can add memory blocks to the heap using _heapadd (pointer_to_block, size_of_block); If for example, your program needs to be loaded at $4000 to make room for some sort of graphics buffer, but this setup wastes the range $800-$1FFF, you can use it as dynamic memory by adding _heapadd ((void*)0x800, 0x1800); somewhere in your program. It is not as good as using it for code/data directly, but at an easy way to make at least some use of it. Regards Uz -- Ullrich von Bassewitz uz_at_musoftware.de ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo_at_musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.
This archive was generated by hypermail 2.1.3 : 2003-10-28 10:40:41 CET