Can someone please tell me how local labels work on WLA?

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Post Reply
kp64
Posts: 31
Joined: Fri Aug 01, 2014 3:13 pm

Can someone please tell me how local labels work on WLA?

Post by kp64 »

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: Select all

.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?
kp64
Posts: 31
Joined: Fri Aug 01, 2014 3:13 pm

Re: Can someone please tell me how local labels work on WLA?

Post by kp64 »

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)
Post Reply