home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.sys.apple2      Discussion about Apple II micros      56,720 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 55,990 of 56,720   
   Oliver Schmidt to All   
   Re: In need of help understanding cc65's   
   26 Dec 22 00:55:58   
   
   From: ol.sc@web.de   
      
   Hi Colin,   
      
   > I've done some more tests, and am still under the impression that   
   > binaries produced with -Wl -D__HIMEM__=0xBF00 and -Wl   
   > -D__HIMEM__=0x9600 are exactly the same.   
   >   
   > But I've also noticed, using this test file, that the available memory   
   > is somehow automatically made known by the loader.system mechanisme ?   
      
   Your impression is correct. The __HIMEM__ setting is a pure hint telling   
   the linker what value to assume. This approach allows the linker to   
   estimate if things are are going to work at runtime.   
      
   The actual HIMEM value is always determined at load time. The linker   
   doesn't even try to relate the link time value to the load time. Therefore   
   the link time value is in no way represented in the binary.   
      
   > When ran using `BRUN RAMTEST`, _heapmemavail() tells me about 28kB,   
   > whereas when using `- RAMTEST.SYSTEM`, it tells me about 38kB.   
   >   
   > The malloc()/memset() loop then allocates and clears what is expected   
   > without crash.   
   >   
   > Do I have the correct impression?   
      
   Yes, this is a feature. If your program is small enough to load both   
   directly and via loader.system, then you can chose if you want to directly   
   return with less heap memory or quit to the ProDOS dispatcher with more   
   heap memory.   
      
   > PS - on the other hand, -Wl -D,__STACKSIZE__= produces a different   
   > binary and is clearly taken into account.   
      
   Yes, the logic goes like this:   
      
   'Heap End' = 'Runtime HIMEM' - __STACKSIZE__   
      
   Regards,   
   Oliver   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca