Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use the +/- anonymous labels preceding a macro call #10

Closed
svallee-dev opened this issue Nov 26, 2021 · 4 comments
Closed

Cannot use the +/- anonymous labels preceding a macro call #10

svallee-dev opened this issue Nov 26, 2021 · 4 comments

Comments

@svallee-dev
Copy link

svallee-dev commented Nov 26, 2021

Found another issue, something that used to work before but is now throwing an error: whenever I have a "+" or "-" anonymous label on a line where I call a macro, I'm getting this error:

Cannot redefine "+".

For instance:

GetWritePtr
		lda zp_write_buffer
		beq +
		.SET16 BC, RAMMap.Map1
		rts
+		.SET16 BC, RAMMap.Map0
		rts

(note that my macro does not contain a + label, which was my first guess).

Using an anonymous label seems to always work fine if I use it on a non-macro instruction. For instance if I add a "nop" instruction on the + line in the example above, it compiles without errors.

@svallee-dev svallee-dev changed the title Cannot use the the "+" anonymous label preceding a macro call Cannot use the "+" anonymous label preceding a macro call Nov 26, 2021
@svallee-dev svallee-dev changed the title Cannot use the "+" anonymous label preceding a macro call Cannot use the +/- anonymous labels preceding a macro call Nov 26, 2021
@informedcitizenry
Copy link
Owner

informedcitizenry commented Dec 22, 2021

Again, I think the culprit may be your macro. Here is my mock-up of your code, all compiles fine.

SET16   .macro v1, v2
        tax
        lda \v1
        sta (0,x)
        lda \v2
        sta (1,x)
        .endmacro

BC = 3
zp_write_buffer = 0

GetWritePtr
		lda zp_write_buffer
		beq +
		.SET16 BC, RAMMap.Map1
		rts
+		.SET16 BC, RAMMap.Map0
		rts

    .namespace RAMMap
Map1    .word ?
Map0    .word ?
    .endnamespace

@svallee-dev
Copy link
Author

svallee-dev commented Dec 25, 2021

Thank you for looking into all of them! Not sure how they are not replicable on your side but I'll try to dig more and find better repro steps.

The +/- breaking my Macros with a "Cannot redefine +" error happens 100% of the time on my side. Does not matter which macro I use, and all these macros works fine when used without a preceding +/-.

Here's more context that maybe matters: the code breaking by using +/- before a macro are inside various block/endblock, and the macros are defined outside of these blocks.

@informedcitizenry
Copy link
Owner

Just curious, does the layout of the blocks look something like this?

someblock  .block

    GetWritePtr
    		lda zp_write_buffer
    		beq +
		.SET16 BC, RAMMap.Map1
		rts

    someother .block

    +		.SET16 BC, RAMMap.Map0

              .endblock

		rts

           .endblock

@informedcitizenry
Copy link
Owner

Just a final follow-up on this. I believe the issue may have been you were referencing anonymous labels out of scope. Can you confirm?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants