CPCWiki forum

General Category => Programming => Topic started by: teopl on 18:17, 02 August 20

Title: cpctelera (sdcc) memory layout issue
Post by: teopl on 18:17, 02 August 20
Hello,

I have 2 cpctelera projects, both using cpctm_createTransparentMaskTable(g_teopl_video_masktable, 0x100, M1, 0) => so addresses [0x100, 0x200) are busy and the .bin file will start from this address (code will come later).

I have few lines of same code in both projects at the very start of the main().

Then I put Z80CODELOC=ADDRESS1 on first project and Z80CODELOC=ADDRESS2 on second project and build them.

When I look in ./obj/PROJECT1.bin and ./obj/PROJECT2.bin and search for that "same code at start of main", I see that:

- on project1 => code is on 0x100 + ADDRESS1 (that makes sense)
- on project2 => code is on 0x100 + ADDRESS2 + 0xA9 (this I don't understand - why is there 169 bytes offset here???)

Anyone has an idea? Does the number 169 mean something?

memory should be like this:

[0, ..., 0x99] => nothing
[0x100, ..., 0x199] => masktable
[0x200, ..., Z80CODELOC-1] => data buffer
[Z80CODELOC, ...] => program

Instead, on SECOND project only, programs starts 169 bytes later...

Title: Re: cpctelera (sdcc) memory layout issue
Post by: teopl on 20:32, 02 August 20
Or to make simpler question:

$ cat obj/main.rst |grep main::
   09DA                     243 _main::

$ cat cfg/build_config.mk |grep CODELOC
Z80CODELOC := 0x911


Is it OK to have these numbers different (9DA and 911) and under which conditions they can be different?
Title: Re: cpctelera (sdcc) memory layout issue
Post by: Arnaud on 20:41, 02 August 20
You have more informations in the obj/project.map file.
Title: Re: cpctelera (sdcc) memory layout issue
Post by: teopl on 21:12, 02 August 20
I will take a look.

I had a help just now, looks like that CODELOC is just that: location of the code and location of main() can be anywhere :)

I have no idea why I thought that CODELOC must be start of the program...  :picard:
Powered by SMFPacks Menu Editor Mod