64tass strange behavior of macro
Posted: Fri Nov 15, 2019 8:53 pm
I'm using 64tass to build an application composed of optional modules
to avoid a lengthy list of includes I created a macro
I have a table of all the modules with value 0 or 1 (one if wanted)
...
MODREGS = 1
MODLOAD = 1
MODEXIT = 0
...
DEFPKG .MACRO CMD, FILE
.IF MOD\CMD
.INCLUDE "commands/" .. \FILE .. ".asm"
.ENDIF
.ENDM
with this macro I can reduce the include to 1 line by module
ex:
...
CMDLOAD .DEFPKG LOAD, "load"
CMDREGS .DEFPKG REGS, "regs"
...
here the content of "load" is only called from a table of pointers (the pointers are correct)
but for regs it's call directly (if the module is assembled in the code) or via the table of pointers
via the table of pointers, it always works
for the direct call the label CMDREGS is defined as 0000 so the application crashes
code generated:
...
.612b 20 26 62 jsr $6226 JSR PRTCRLF
.612e 20 00 00 jsr $0000 JSR CMDREGS ;- display the registers
.6131 2c 0e 7a bit $7a0e CMDLOOP: BIT STUFFED ;- suffed mode ?
...
64tass works fine but I'm new with 64tass and I'm really struggling with the macro
any idea on how I could solve this problem?
thanks
to avoid a lengthy list of includes I created a macro
I have a table of all the modules with value 0 or 1 (one if wanted)
...
MODREGS = 1
MODLOAD = 1
MODEXIT = 0
...
DEFPKG .MACRO CMD, FILE
.IF MOD\CMD
.INCLUDE "commands/" .. \FILE .. ".asm"
.ENDIF
.ENDM
with this macro I can reduce the include to 1 line by module
ex:
...
CMDLOAD .DEFPKG LOAD, "load"
CMDREGS .DEFPKG REGS, "regs"
...
here the content of "load" is only called from a table of pointers (the pointers are correct)
but for regs it's call directly (if the module is assembled in the code) or via the table of pointers
via the table of pointers, it always works
for the direct call the label CMDREGS is defined as 0000 so the application crashes
code generated:
...
.612b 20 26 62 jsr $6226 JSR PRTCRLF
.612e 20 00 00 jsr $0000 JSR CMDREGS ;- display the registers
.6131 2c 0e 7a bit $7a0e CMDLOOP: BIT STUFFED ;- suffed mode ?
...
64tass works fine but I'm new with 64tass and I'm really struggling with the macro
any idea on how I could solve this problem?
thanks