Menu

#70 Conditional compiling problem

1.58.2974
pending-invalid
nobody
None
2
2023-08-13
2023-08-12
Zibri
No

I have this piece of code:

   +       .word (+), 10  ;pointer, line number
     .null INPUT, '"DENSITY FOR TRACKS >35";H:',PRINT
   +       .word (+), 15  ;pointer, line number
     .null FOR,"T",EQUALS,"1",TO,"41:T$",EQUALS,RIGHTS,"(",STRS,"(T",PLUS,"100),2)"

.if DC==0

   +       .word (+), 20  ;pointer, line number
     .null POKE, format("%d,", XX),ASC,"(",LEFTS,'(T$,1))'
   +       .word (+), 25  ;pointer, line number
     .null POKE, format("%d,", XX+1),ASC,"(",RIGHTS,'(T$,1))'
.endif


   +       .word (+), 30  ;pointer, line number
     .null SYS, format("%4d", UPLOAD),":",REM," UPLOAD"
   +       .word (+), 35  ;pointer, line number

At the top, for debugging I have DC=0 or DC=1
if I put DC=0 and compile, everything is fine.
But if I put DC=1 it says:

znibp11.s:12:16: error: not defined anonsymbol '+'

 +       .word (+), 15  ;pointer, line number
                ^

Discussion

  • Soci/Singular

    Soci/Singular - 2023-08-13
    • status: open --> pending-invalid
     
  • Soci/Singular

    Soci/Singular - 2023-08-13

    Not really a bug as it was documented since 2017 (and works like this since 2010):

    https://tass64.sourceforge.net/#symbols-anonymous

    Anonymous labels within conditionally assembled code are counted
    even if the code itself is not compiled and the label won't get defined.
    This ensures that anonymous labels are always at the same "distance"
    independent of the conditions in between.

    and once more

    https://tass64.sourceforge.net/#conditional-assembly

    Anonymous labels are still recognized in the non-compiling parts even if
    they won't get defined. This ensures consistent relative referencing
    across conditionally compiled areas with such labels.

    I've considered briefly to change this but then realized it'd just make anonymous label use even more dangerous than already when combined with conditional assembly.

    Instead just move the anonymous labels so that the conditionally compiled part has only self contained references:

       +       .word (+), 10  ;pointer, line number
         .null INPUT, '"DENSITY FOR TRACKS >35";H:',PRINT
       +       .word (+), 15  ;pointer, line number
         .null FOR,"T",EQUALS,"1",TO,"41:T$",EQUALS,RIGHTS,"(",STRS,"(T",PLUS,"100),2)"
       +
    .if DC==0
               .word (+), 20  ;pointer, line number
         .null POKE, format("%d,", XX),ASC,"(",LEFTS,'(T$,1))'
       +      .word (+), 25  ;pointer, line number
         .null POKE, format("%d,", XX+1),ASC,"(",RIGHTS,'(T$,1))'
       +
    .endif
               .word (+), 30  ;pointer, line number
         .null SYS, format("%4d", UPLOAD),":",REM," UPLOAD"
       +      .word (+), 35  ;pointer, line number
    

    It's do the same.

     

Log in to post a comment.

MongoDB Logo MongoDB