When I use define = yes in a CC65 config file, then the compiler defines the value of the segment as a constant.
This constant occupies actual ROM space. It is a value at a memory location that you can use with .import. When I want to use this value, I use the name (that the compiler turns into an address) and the program looks up the value at the corresponding location.
Now my question: Is there any way to let the compiler create the values as the kind of constants that are directly converted into values at compile time?
So, when I declare a segment SPRITES, I don't want the compiler to do this:
Because this occupies actual space in the ROM.
I want something like this:
Because this doesn't occupy ROM space. Instead, whenever I use these constants, the values are used directly.
I don't understand why anybody would want these values inside the ROM anyway. This is not actual game data stuff like a level map or something like that. It's just a constant for calculations. Therefore, I would never declare them in an actual memory location, but I would simply use the name = value version, so that whenever it is used, the actual values get used.
This constant occupies actual ROM space. It is a value at a memory location that you can use with .import. When I want to use this value, I use the name (that the compiler turns into an address) and the program looks up the value at the corresponding location.
Now my question: Is there any way to let the compiler create the values as the kind of constants that are directly converted into values at compile time?
So, when I declare a segment SPRITES, I don't want the compiler to do this:
Code:
__SPRITES_LOAD__: .byte $02, $00
__SPRITES_SIZE__: .byte $01, $00
__SPRITES_SIZE__: .byte $01, $00
Because this occupies actual space in the ROM.
I want something like this:
Code:
__SPRITES_LOAD__ = $0200
__SPRITES_SIZE__ = $0100
__SPRITES_SIZE__ = $0100
Because this doesn't occupy ROM space. Instead, whenever I use these constants, the values are used directly.
I don't understand why anybody would want these values inside the ROM anyway. This is not actual game data stuff like a level map or something like that. It's just a constant for calculations. Therefore, I would never declare them in an actual memory location, but I would simply use the name = value version, so that whenever it is used, the actual values get used.