64tass strange behavior of macro

Programming the 6502 microprocessor and its relatives in assembly and other languages.
Post Reply
dderny
Posts: 15
Joined: 23 Oct 2019

64tass strange behavior of macro

Post by dderny »

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
soci
Posts: 20
Joined: 18 Nov 2019

Re: 64tass strange behavior of macro

Post by soci »

Hello!

I tried the source code fragments provided with all release versions of past 6 years without success.

Please try to reduce the source code to a minimal but complete example which reproduces this behaviour. The version number and command line options may be interesting as well.

Thanks!

Code: Select all

; 64tass Turbo Assembler Macro V1.54.2095 listing file
; 64tass --verbose-list -L listing.txt test.asm
; Mon Nov 18 21:08:15 2019

;Offset ;Hex            ;Monitor        ;Source

;******  Processing input file: a.asm

=1                                      MODREGS = 1
=1                                      MODLOAD = 1
=0                                      MODEXIT = 0

                                        DEFPKG .MACRO CMD, FILE
                                        .ENDM

                                        *=$1000

.1000                                   CMDREGS
                                        .IF MODREGS
                                        .INCLUDE "commands/" .. "regs" .. ".asm"

;******  Processing file: commands/regs.asm

.1000   ea              nop             NOP
.1001   60              rts             RTS

;******  Return to file: a.asm

                                        .ENDIF

.1002   ea              nop             NOP
.1003   20 00 10        jsr $1000       JSR CMDREGS
>1006	00 10				.ADDR CMDREGS

;******  End of listing
Post Reply