Mariano DM Posted December 18, 2022 Share Posted December 18, 2022 (edited) Hello. I'm not seem able to make my symbol get aligned properly (array for font): I modified the segment and memory in cfg (copy form atari-xex.cfg) MEMORY { ZP: file = "", define = yes, start = $0082, size = $007E; # "system check" load chunk SYSCHKCHNK: file = %O, start = $2E00, size = $0300; FONT_RAM: file = "", define = yes, start = $2000, size = $1000; # "main program" load chunk MAIN: file = %O, define = yes, start = %S, size = $BC20 - __STACKSIZE__ - __RESERVED_MEMORY__ - %S; } ... SEGMENTS { ZEROPAGE: load = ZP, type = zp; ... DATA: load = MAIN, type = rw; FONT: load = FONT_RAM, type = ro, align=$100, define=yes; INIT: load = MAIN, type = rw, optional = yes; } An I'm using pragma to refer the segment: #pragma data-name (push,"FONT") #include "font.h" #pragma data-name (pop) in font.h extern unsigned char GAME_FONT[]; however I have a non-aligned address for the pointer: _GAME_FONT 00541A RLA See the full map and cfg file in the attachments What am I missing here ? I've been following the documentation and examples in thread: Also I found this great presentation form @Bill Kendrick thx !cc65-20150921.pdf taco.map tacobot.cfg Edited December 18, 2022 by Mariano DM duplicate link Quote Link to comment Share on other sites More sharing options...
Mariano DM Posted December 18, 2022 Author Share Posted December 18, 2022 OK .. after pulling out my hair I was able to do it ! a really ugly solution, hope I can do it properly put the pragma in the .c file instead of the header. #pragma data-name (push,"FONT") unsigned char GAME_FONT[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x3F,0x60,0xC0,0xC3,0x66,0x3C,0x33, 0x78,0xC6,0x11,0x01,0x02,0xFC,0x00,0x00, ... #pragma data-name (pop) Quote Link to comment Share on other sites More sharing options...
Rybags Posted December 18, 2022 Share Posted December 18, 2022 (edited) If you point directly to your font the alignment would have to be $400 - or $200 if for Gr. 1 or 2. Edited December 18, 2022 by Rybags Quote Link to comment Share on other sites More sharing options...
Mariano DM Posted December 18, 2022 Author Share Posted December 18, 2022 this is for graphic mode 7. align=$100, it only needs a page. right ? Quote Link to comment Share on other sites More sharing options...
Rybags Posted December 19, 2022 Share Posted December 19, 2022 For bitmap the alignment doesn't matter. It can't cross a 4K boundary, not sure if ALIGN could help there. When up at the 4K boundary the mode line should start -40 bytes from it (32 or 48 if narrow/wide DMA) then the next line will need LMS in the DList to start it at the next 4K. Generally the OS will always have RAMTOP aligned at a 4K boundary - it only does the second LMS in the hires modes that use 8K. 2 Quote Link to comment Share on other sites More sharing options...
baktra Posted December 19, 2022 Share Posted December 19, 2022 (edited) Your solution by putting the #pragma data-name directive to the font.c is correct. And that is exactly where it should have been in the first place. Why is that? The extern unsigned char GAME_FONT[]; statement doesn't generate any machine code or data. It is just a symbol for the compiler that will be resolved later by the linker. Therefore, there is no code or data that could go to the FONT segment. That is also clear from the .map file. The .map file has no mention of the FONT segment. So, if you want to use the #pragma data-name directive, use it where the data is defined, not where it is declared. Edited December 19, 2022 by baktra 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.