e1will Posted September 16, 2009 Share Posted September 16, 2009 Is there any difference in DASM between these two lines in an .asm file? LEFT_BORDER = 9 LEFT_BORDER = #9 Or is the # ignored? --Will Quote Link to comment Share on other sites More sharing options...
tokumaru Posted September 16, 2009 Share Posted September 16, 2009 Is there any difference in DASM between these two lines in an .asm file? LEFT_BORDER = 9 LEFT_BORDER = #9 I'm not sure about DASM, but these would be treated differently in other assemblers I know of. It's not good programming practice to include the "#" in the definition though, because it will be harder to tell immediate and absolute/ZP instructions apart in the code, and that may result in bugs that will take you a long time to find. Quote Link to comment Share on other sites More sharing options...
SeaGtGruff Posted September 16, 2009 Share Posted September 16, 2009 Is there any difference in DASM between these two lines in an .asm file? LEFT_BORDER = 9 LEFT_BORDER = #9 Or is the # ignored? --Will I'm not sure if the context might make a difference, or perhaps the version of DASM, but when I tried it they were interpreted identically. So that means even if you use the pound sign in the equate, you'd still need to use a pound in an instruction if you want it to use the immediate mode: LEFT_BORDER_1 = $9 LEFT_BORDER_2 = #9 LDA LEFT_BORDER_1 ; this is equivalent to LDA $09 (zero page addressing) LDA LEFT_BORDER_2 ; this is also equivalent to LDA $09 (zero page addressing) LDA #LEFT_BORDER_1 ; this is equivalent to LDA #9 (immediate addressing) LDA #LEFT_BORDER_2 ; this is also equivalent to LDA #9 (immediate addressing) Michael Quote Link to comment Share on other sites More sharing options...
Bruce Tomlin Posted September 16, 2009 Share Posted September 16, 2009 The "#" is usually part of the instruction syntax, meaning "use immediate mode". The "$" is part of the syntax of constant numbers. I'm assuming that the "=" stores a numeric value in the symbol table, not a macro substitution string (such as #define in C), in which case you can't use "#" like that. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.