Arakula / dasmfw

The DisASseMbler FrameWork
GNU General Public License v2.0
13 stars 4 forks source link

Incorrect documentation for DEFLABEL #17

Open phillipeaton opened 1 year ago

phillipeaton commented 1 year ago

Documentation says:

deflabel addr [name] ... A little bit of caution is necessary here; if the same deflabel is used for different values, the last one wins and is used for the EQU statement.

What I'm seeing is that the last one is not winning, it's getting ignored, as evidenced below. I think it works fine, it's just the documentation that is wrong.

Using

deflabel 37A3 SCREEN_WIDTH_PIXELS
deflabel 37A8 SCREEN_WIDTH_PIXELS

results in

SCREEN_WIDTH_PIXELS     equ     $B8

         cmp     #SCREEN_WIDTH_PIXELS    ; 37A2: C9 B8    
         bcc     No_X_Wrap               ; 37A4: 90 03    
         sec                             ; 37A6: 38       
         sbc     #SCREEN_WIDTH_PIXELS    ; 37A7: E9 B8    

Using the address wrong for the second instance

deflabel 37A3 SCREEN_WIDTH_PIXELS
deflabel 37A7 SCREEN_WIDTH_PIXELS

results in

SCREEN_WIDTH_PIXELS     equ     $B8

         cmp     #SCREEN_WIDTH_PIXELS    ; 37A2: C9 B8    
         bcc     No_X_Wrap               ; 37A4: 90 03    
         sec                             ; 37A6: 38       
         sbc     #$B8                    ; 37A7: E9 B8