Code: Select all
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).
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.