+Karl G Posted June 15, 2021 Share Posted June 15, 2021 If I make a macro to do a bankswitch, storing the return address on the stack, can a label at the end of the macro be used for this return address? I would think yes, but I'm running into some odd problems, and wanted to make sure I wasn't missing something obvious. Alternately, I could pass the return address as a macro parameter, but I was hoping to avoid that if possible. Link to comment Share on other sites More sharing options...
+Andrew Davie Posted June 16, 2021 Share Posted June 16, 2021 No answers yet? Mmh. Macros create a local scope, so local labels will not be accessible across macro instantiation, or outside of a macro usage. By that I mean that if you have a macro "call" between use and declaration of a local label, that will fail because the use of the macro destroys the local label scope. Likewise, a local label inside a macro (which is encouraged, and actually necessary if you instantiate the macro more than once) should successfully allocate the correct address to each usage, as if it were inside its own "subroutine" block. That is, macros create an effective new scope when instantiated, and local labels inside the macros are handled with correct addresses as you would want/expect. If you're asking if you can use a local label inside a macro in some way so that this becomes the address code will continue from - I don't see any reason why this should not work. Maybe I'm not understanding the question. Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted June 16, 2021 Share Posted June 16, 2021 I am also not sure what Karl is asking for. Why would you need such a label? Link to comment Share on other sites More sharing options...
+Karl G Posted June 16, 2021 Author Share Posted June 16, 2021 Yeah, I think I was overthinking it. I've not done much with local labels, but if I can see it within the macro, I can put the address on the stack just like any other address. Whatever I'm doing wrong isn't because of this (outside the scope of DASM discussion). Anyway, thanks! I'm just trying to rule out some possible causes. Link to comment Share on other sites More sharing options...
Recommended Posts