nesdev.com
https://forums.nesdev.com/

Can someone please tell me how local labels work on WLA?
https://forums.nesdev.com/viewtopic.php?f=12&t=16959
Page 1 of 1

Author:  kp64 [ Sat Jan 20, 2018 2:08 am ]
Post subject:  Can someone please tell me how local labels work on WLA?

I guess this is fairly trivial but I read the WLA documentation and used search engines and I can't understand were the problem is,
So, if someone is kind enough to tell me what is wrong with this I will be very glad.

So, I have an .ENUM inside a .SECTION like this:

Code:
.SECTION "section name" SEMIFREE
.ENUM $00
       _local_label dw
.ENDE

.ENDS


and then I have the same exact enum inside of another .SECTION

As far as I know the underscore makes the label local to the section were the .ENUM is,
So there shouldn't be any collisions with labels in other sections, yet WLA-DX says DIRECTIVE_ERROR: "_local_label" was defined for the second time.
Strangely enough, when using .ENUM, WLA-DX throws the DIRECTIVE_ERROR and doesn't generate any obj file, but if I use .DEFINE instead, it throws the same error but it does generate an object file ¿?

I also tried using @local_label and I got the same result.

There is anything I'm missing out?

Author:  kp64 [ Mon Jan 22, 2018 1:58 am ]
Post subject:  Re: Can someone please tell me how local labels work on WLA?

OK, I think that I get it now
Underscore for local section labels only work with labels defined within the code.

Labels defined with .DEFINE( or .DEF .EQU .ENUM which are the same) are always in the module file scope,
labels defined with .DEF .EQU or .ENUM also do not show in the object symbol table unless you use .EXPORT
I can have the same .DEFINE in two different modules but not in the same one.

I guess I will have to use .RAMBANKS .STRUCT or whatever WLA has to offer, I wanted to use .ENUMS/.DEFINES thought,
as I only wanted to give names to the offset values of my local vars at to the stack.

Also if I understand it right, WLA Directives are a kind of minilanguage, is not like the C preprocessor that only expands text, C defines never show up on the symbol table since they are expanded out at preprocessing time( so just text expanding is performed)

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/