How to force ca65 to reserve memory at page boundary?

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
yaros
Posts: 145
Joined: Tue Aug 28, 2018 8:54 am
Location: Edmonton, Canada

How to force ca65 to reserve memory at page boundary?

Post by yaros » Fri Feb 08, 2019 6:04 pm

I have added famitone to my project, and it requires FT_BASE_ADR to be at xx00 address. As for now it just put

Code: Select all

FT_BASE_ADR = $600
And in this project I should not use too much RAM to overlap with this address, but can I actually make ca65 to reserve space at certain address without creating separate segment in the middle of the RAM?

User avatar
dougeff
Posts: 2600
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: How to force ca65 to reserve memory at page boundary?

Post by dougeff » Fri Feb 08, 2019 6:36 pm

You can shrink the segment of your RAM so it doesn't overlap.
nesdoug.com -- blog/tutorial on programming for the NES

yaros
Posts: 145
Joined: Tue Aug 28, 2018 8:54 am
Location: Edmonton, Canada

Re: How to force ca65 to reserve memory at page boundary?

Post by yaros » Fri Feb 08, 2019 7:08 pm

I can, but I will loose 256 - FT_BASE_SIZE = 116 bytes to nothing too. Seems like a waste.

tepples
Posts: 21720
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: How to force ca65 to reserve memory at page boundary?

Post by tepples » Fri Feb 08, 2019 7:12 pm

Then make another memory area at $690-$6FF or something.

User avatar
rainwarrior
Posts: 7642
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: How to force ca65 to reserve memory at page boundary?

Post by rainwarrior » Fri Feb 08, 2019 7:35 pm

yaros wrote:And in this project I should not use too much RAM to overlap with this address, but can I actually make ca65 to reserve space at certain address without creating separate segment in the middle of the RAM?
If the segment has the align attribute on it you can use the .align directive to make it pad to a power-of-two boundary:

Code: Select all

; CFG has "align=256" on the current segment
.align 256
thing: .res 55 ; this will be aligned to 256 bytes

yaros
Posts: 145
Joined: Tue Aug 28, 2018 8:54 am
Location: Edmonton, Canada

Re: How to force ca65 to reserve memory at page boundary?

Post by yaros » Sun Feb 10, 2019 2:20 pm

rainwarrior wrote:If the segment has the align attribute on it you can use the .align directive to make it pad to a power-of-two boundary
Thank you, this makes more sense to me.

Post Reply