Search code examples
assemblyscopemacrosc64

Is there a way to access global const from the macro in Kick Assembler for C64


I have defined a const to be used as argument in KickAssembler (C64) macro. This works:

.macro MAZE(start){
  .const WALL = $E0
  MAZE_fill(WALL)
}

This does not:

.const WALL = $E0
.macro MAZE(start){
    MAZE_fill(WALL)
}

So, if symbol is defined within macro, it is recognized during assembly. But if it is global, then it is not.
My motivation is to have global symbols, so there is only one place to change them.
Is there a way to do it?


Solution

  • It was wrong to use const. When using label, this works as expected (globally).

    .label WALL = $E0
    .macro MAZE(start){
        MAZE_fill(WALL)
    }