Author Topic: Specify address for function and sdcc link question  (Read 1132 times)

0 Members and 1 Guest are viewing this topic.

Offline Arnaud

  • Supporter
  • 6128 Plus
  • *
  • Posts: 691
  • Country: fr
  • Liked: 614
  • Likes Given: 1274
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.

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.336
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2280
  • Likes Given: 3478
Re: Specify address for function and sdcc link question
« Reply #1 on: 21:12, 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.


Is there an option to remove useless function while link operation ?

Thanks,
Arnaud.
no.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.336
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2280
  • Likes Given: 3478
Re: Specify address for function and sdcc link question
« Reply #2 on: 21: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.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline Arnaud

  • Supporter
  • 6128 Plus
  • *
  • Posts: 691
  • Country: fr
  • Liked: 614
  • Likes Given: 1274
Re: Specify address for function and sdcc link question
« Reply #3 on: 22:15, 09 October 15 »
Thanks i'll try your code.