Page 1 of 1

Question about LD65 Memory Config File(align attribute)

Posted: Thu Nov 02, 2017 4:37 pm
by georgjz
I have a question about the align attribute in my memory config:

Code: Select all

MEMORY {
    BANK00:     start=$8000, size=$8000, fill=yes;
    BANK01:     start=$f000, size=$8000, fill=yes;
}

SEGMENTS {
    CODE:       load=BANK00, align=$8000;           # bank 0 at $00:$8000
    HEADER:     load=BANK00, start=$ffc0;
    ROMINFO:    load=BANK00, start=$ffd5;
    VECTOR:     load=BANK00, start=$ffe4;
    GRAPHICS:   load=BANK01, align=$8000;           # bank 1 at $01:$8000
}
Background: I'm playing around with programming SNES game bits for fun, the code is working fine. For ease of use I decided to have one 32KB segment/bank for my code(include the reset vectors and SNES specific data) and a second 32KB bank for the graphics I use(note that both data could fit completely into one bank, I simply do this for educational reasons).

Now, when I build my program the output file is as expected 64KB in size, so I except my code to start at $0000 of the output file, and the graphics data at $8000. Yet my graphics data starts at $9000. I also get this warning from ld65:

Code: Select all

ld65: Warning: lorom128.cfg(11): The first segment in memory area `BANK01' needs fill bytes for alignment.
When I remove the second align attribute in the last line, my graphics are placed at $8000 as expected. I understand the align attribute to be a tool to make sure, that segements of a certain size won't overlap.

What am I getting wrong about align and why does it move my data to $9000 instead of $8000?

Re: Question about LD65 Memory Config File(align attribute)

Posted: Fri Nov 03, 2017 7:00 am
by leepivonka
In "MEMORY", in "BANK01", you have "start=$f000" - should this be $18000?

I think LD65 is inserting 4KBytes of padding so GRAPHICS can be aligned on a $8000 boundary.

Re: Question about LD65 Memory Config File(align attribute)

Posted: Tue Nov 07, 2017 10:58 pm
by georgjz
Sorry for my late reply. I haven't got behind it yet, since I kept working on it with my old config file. When I find more time, I'll investigate further and keep you posted.

Re: Question about LD65 Memory Config File(align attribute)

Posted: Wed Jul 04, 2018 4:19 pm
by iLavr
Hi, georgjz !

I have a question to you, but I can't find how to send a private message here.

How can I contact you?

Re: Question about LD65 Memory Config File(align attribute)

Posted: Wed Jul 04, 2018 6:07 pm
by GARTHWILSON
iLavr wrote:
but I can't find how to send a private message here.

How can I contact you?
HowToSendPM.gif

Re: Question about LD65 Memory Config File(align attribute)

Posted: Wed Jul 04, 2018 11:18 pm
by iLavr
Thanks, GARTHWILSON !

I have a habit that a "private message" button must be on top... ))))