Jump to content
IGNORED

CC65 - Segment `BSS' overflows memory area `MAIN' by 67 bytes


Recommended Posts

Planning the memory layout is a prudent measure. You can get more by fiddling with the starting address (if you go too low, your program might not be loadable from DOS, that might or might not be a way to go). Preparing your own linker.cfg file can help you to reduce stack size and get more memory, if possible, of course.

Link to comment
Share on other sites

 

This. I like cc65 but the linker config is a real pain when you're first starting to use the compiler. What linker config file are you using?

 

The linker has a steep learning curve, but it is worth the effort.

But the question is rather for Yaron Nir. I am using tailored ones that are based on plain atari.cfg.

 

When it comes to planning of the memory layout, the principal question is always the same: How much of DOS I need?

 

1. No DOS, my software can be loaded by a miniature binary loader from a disk/universal cart/tape. Then you can place code as low as 2048.

2. DOS only to load my software. Then you can use addresses 2048-... after your program is loaded. Exiting should be through cold start

3. DOS needed all the time. 2048-? must stay untouched. The question mark value depends on the size of given DOS. Could be 8192, 6144, or even 4096 for very small DOSes.

Link to comment
Share on other sites

I plan to run my software from a cartridge

Not sure I need DOS

I created several fixed memory allocations in my code so if I change my starting address I will need to align all the fixed memory accordingly otherwise code will crash

 

I will try setting the starting address to 2048 as suggested above and re align fixed memory accordingly

Link to comment
Share on other sites

I plan to run my software from a cartridge

Not sure I need DOS

I created several fixed memory allocations in my code so if I change my starting address I will need to align all the fixed memory accordingly otherwise code will crash

 

I will try setting the starting address to 2048 as suggested above and re align fixed memory accordingly

 

Running from cartridge. So you build a .ROM image in the end, or you build a .xex file that will be loaded by some special binary loader on a cartridge with software capable of loading binary load files (UnoCart etc.)?

 

You need DOS only when your program is reading or writing data to files on the disk. Well technically this can be done even without DOS by direct sector access through services provided by the Atari OS.

Edited by baktra
Link to comment
Share on other sites

By the way the way i've solved it was, i've used the default atari.cfg linker file, i've reduced stack size from 0x800 to 0x400 and it did the trick

so now problem is solved

 

Might be good, but keep in mind that stack overflow issues are ones of the most difficult to debug. OTOH, the 0x800 value is quite conservative in the first place. Still depends on your program, though. If you're using many local veriables (or even arrary there), 0x800 might even be small.

 

Look at the linker map file to find out where your memory is consumed.

 

regards,

chris

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...