sasq64 / bass

Advanced 6502 assembler
23 stars 4 forks source link

[request] section labels #11

Closed antis81 closed 1 year ago

antis81 commented 3 years ago

Can't a section also define a (global) label?

!section "math", start=$1000
math:  ; <-- redundant
  .func1: !fill 256, <some-function>
  .func2: !fill 256, <some-other-function>
  … 

Also a NoLabel=true option could be useful to disable the feature.

EDIT: Further it may be a good idea that labels become global to a section. Given the above example that means:

!section "math", start=$1000
  func1: !fill 256, <some-function>           ; <-- call: math.func1
  func2: !fill 256, <some-other-function>     ; <-- call: math.func2
  …
sasq64 commented 1 year ago

I think local labels to section is both hard to do (since they act as global, non-dot within the section and dotted outside) and surprising, since in other assemblers a global label is global regardless of which section it's in.

Auto defining symbols for sections is useful. Both start, end, size and pc actually, so you have labels to reference when copying a relocated section to it's correct place.