Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
"Warning: statically allocated variables consume all ..

 
Post new topic   Reply to topic    Forum Index -> ZBasic Native Mode
Author Message
pjc30943



Joined: 02 Dec 2005
Posts: 220

Posted: 24 September 2008, 2:21 AM    Post subject: "Warning: statically allocated variables consume all .. Reply with quote

I think I've misunderstood the basics of how much system RAM is available.

As an example, accompanying the warning
Code:
"Warning: statically allocated variables consume all available RAM, see 'Option HeapSize' and 'Option RamSize'"

is

Code:
"No errors.  Target device: ZX1280n, Code: 30196 bytes, RAM: 9028 bytes, Persistent memory: 32 bytes"


How does 9k exceed 64k of external RAM if I use "Option ExtRamConfig On"? It seems perhaps there is a separate RAM required for stack use, etc. that must be internal to the device.
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR

Posted: 24 September 2008, 16:10 PM    Post subject: Re: "Warning: statically allocated variables consume al Reply with quote

pjc30943 wrote:
How does 9k exceed 64k of external RAM if I use "Option ExtRamConfig On"?
Lacking any advice to the contrary, the compiler assumes that a ZX-1280 has 8K of RAM available. The presence of Option ExtRamConfig On is not sufficient information since you might have 2K of external RAM or the full complement. The compiler has no way of knowing how much external RAM you might have.

The way to resolve this problem is to tell the compiler how much RAM you have using Option RamSize. A full complement of external RAM is expressed using the idiom shown below. Register.RamStart gives the starting address of internal RAM; subtracting that value from 64K yields the number of bytes of RAM available with an external RAM chip of 64K or more attached.

Code:
Option RamSize 65536 - Register.RamStart
Back to top
pjc30943



Joined: 02 Dec 2005
Posts: 220

Posted: 24 September 2008, 21:46 PM    Post subject: Reply with quote

Ah. That makes sense.

Based on
Quote:
http://www.zbasic.net/forum/about1043.html
I thought that what you suggested wouldn't work because of the example Mike posted in the post asking about large arrays:

Quote:
"In trying out code to respond to this question, I have found two potential problems for Don to resolve:
The following does not compile. The native mode Ramstart appears to be the same value as the ZVM when it fact it should be smaller.Code:
Code:
Option RamSize 65536 - Register.RamStart
"


But looking further down that thread I see that this was resolved and is no longer an issue...
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZBasic Native Mode Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group