It is currently Fri Nov 24, 2017 2:22 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sun Feb 12, 2017 10:57 am 
Offline
User avatar

Joined: Sun Nov 09, 2008 9:18 pm
Posts: 987
Location: Pennsylvania, USA
The ca65 docs say:

Code:
ca65 assigns each segment and each symbol an address size. This is true, even if the symbol is not used as an address. You may also think of a value range of the symbol instead of an address size.

Possible address sizes are:

Zeropage or direct (8 bits)
Absolute (16 bits)
Far (24 bits)
Long (32 bits)
Since the assembler uses default address sizes for the segments and symbols, it is usually not necessary to override the default behaviour. In cases, where it is necessary, the following keywords may be used to specify address sizes:

DIRECT, ZEROPAGE or ZP for zeropage addressing (8 bits).
ABSOLUTE, ABS or NEAR for absolute addressing (16 bits).
FAR for far addressing (24 bits).
LONG or DWORD for long addressing (32 bits).



How do you use these keywords? I've tried placing them before, between, and after a symbol definition as well as a symbol import, and also with and without a "." preceding. So it feels as though I've tried every permutation possible for applying these keywords, however ca65 was not happy with any given attempt.

The particular use case is I'm trying to get rid of a warning from ld65 saying my symbol is exported as zp but imported as absolute. I'm using .global to both import and export the symbol. It's happening because I'm tracking start and end locations of chr chunks in a CHR-ROM segment, where the address space starts at $0, so I assume that's why the assembler/linker is assigning zeropage in one case but doesn't know what to do in the other case.


Top
 Profile  
 
PostPosted: Sun Feb 12, 2017 11:14 am 
Offline
User avatar

Joined: Wed Oct 16, 2013 7:55 am
Posts: 130
Have you tried colon (:)? Like ".export symbol : absolute". Not sure if it works with .global


Top
 Profile  
 
PostPosted: Sun Feb 12, 2017 11:19 am 
Offline
User avatar

Joined: Sun Nov 09, 2008 9:18 pm
Posts: 987
Location: Pennsylvania, USA
Perfect, that worked! Thanks sir.


Top
 Profile  
 
PostPosted: Sun Feb 12, 2017 1:37 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5838
Location: Canada
Alternatively there's .importzp / .exportzp / .globalzp as a shorthand.

If you want to read the documentation about it:
http://cc65.github.io/doc/ca65.html#ss11.39


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group