RPGHacker / asar

(Now) official repository of the SNES assembler Asar, originally created by Alcaro
Other
199 stars 42 forks source link

(bug) newlines break nested macros #246

Closed blackmagemathie closed 2 years ago

blackmagemathie commented 2 years ago

encountered this bug while trying to use a shared subroutine inside another in pixi (props to @Atari2 for identifying the exact issue)

👇 this compiles

macro include()
    incsrc "a.asm"
endmacro

macro macro_without_newline()
endmacro

org $008000
%include()
;@file a.asm
lda ?test_label
%macro_without_newline()
?test_label:

👇 this doesn't

macro include()
    incsrc "a.asm"
endmacro

macro macro_with_newline()

endmacro

org $008000
%include()
;@file a.asm
lda ?test_label
%macro_with_newline()
?test_label:

and produces the following error : a.asm:1 (called from <input>:11): error: (E5060): Label ':macro_0_test_label' wasn't found. [lda ?test_label]

Alcaro commented 2 years ago

didn't we fix that yesterday

https://github.com/RPGHacker/asar/commit/bad824ab06588e3d811eb41bcb24a2a7d015e239

Atari2 commented 2 years ago

Yeah I already reported this privately and it was fixed yesterday by randomdude

randomdude999 commented 2 years ago

i wanna do a better fix for this later too though. currently using incsrc in a macro still creates a somewhat broken state, which should work most of the time but you can still run into more weird bugs

blackmagemathie commented 2 years ago

oh, i had no idea this had already been reported privately- apologies and thanks for your work then :)

randomdude999 commented 2 years ago

okay, i think i properly fixed this now - incsrc should behave much more consistently with regard to macros now. and well, the original bug was already fixed yesterday, so closing this for now