CPCWiki forum

General Category => Programming => Topic started by: Arnaud on 18:53, 09 October 15

Title: Specify address for function and sdcc link question
Post by: Arnaud on 18:53, 09 October 15
Hello,

i'm using cpctelera to code my game and i've got a problem of memory use, when my code reach the address 0x4000 my game crashed (i guess it's because there are game data at this address).
I have got plenty of memory free above 0x8000 but i don't know how use it to store my functions.

I also see a strange behaviour with SDCC, i have note that not used function are always linked in the program and waste memory.
Is there an option to remove useless function while link operation ?

Thanks,
Arnaud.
Title: Re: Specify address for function and sdcc link question
Post by: arnoldemu on 19:12, 09 October 15
Quote from: Arnaud on 18:53, 09 October 15
Hello,

i'm using cpctelera to code my game and i've got a problem of memory use, when my code reach the address 0x4000 my game crashed (i guess it's because there are game data at this address).
I have got plenty of memory free above 0x8000 but i don't know how use it to store my functions.

I also see a strange behaviour with SDCC, i have note that not used function are always linked in the program and waste memory.
There is an "at" modifier that can be used with functions and data, but it will be hard work to maintain that because it's difficult to know the size of each function.

I think you can also use the "banked" feature. I have some test code that demonstrates that. I'll find it.


Quote from: Arnaud on 18:53, 09 October 15
Is there an option to remove useless function while link operation ?

Thanks,
Arnaud.
no.
Title: Re: Specify address for function and sdcc link question
Post by: arnoldemu on 19:33, 09 October 15
Two bits of code I was trying.

Banked sdcc functionality and named sections functionality.

You may be able to use either.

One of them allows you to define which section the code lives in and to set a location for that section.
They both appear to use a function to transfer between which maybe could be empty.

I think I have one more banked example.
Title: Re: Specify address for function and sdcc link question
Post by: Arnaud on 20:15, 09 October 15
Thanks i'll try your code.
Powered by SMFPacks Menu Editor Mod