Omegamatrix Posted March 14, 2011 Share Posted March 14, 2011 To find how many bytes I got left in my rom I use statements similar to this: ;game code end here ECHO ([$FF00-*]d), "bytes free bank 1" ORG $1F00 RORG $F000 ;gfx bytes start here This will return the number of bytes I have left in that bank (in decimal form). The problem is that it gets outputted multiple times with multiple passes. This output gets long when you have multiple banks. I'd like to build an IF statement that outputs it just once, or prehaps just on the 2nd pass and higher. Any ideas? Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted March 14, 2011 Share Posted March 14, 2011 Dasm automatically does 2 passes by default...so one thing you could do is to assign a new constant at the end of the assembly. Since Dasm would not know this value ahead of time on the first pass, you can include that as part of the IF condition... ;within the program: IF PASS ECHO * ENDIF ;at the end of the assembly file: PASS = 1 I dunno if there is a way to call up the correct number of passes (if more than 2), but this would work for 2 passes. Multipass! Quote Link to comment Share on other sites More sharing options...
Omegamatrix Posted March 14, 2011 Author Share Posted March 14, 2011 Perfect! That does everything I want it to do. I never purposely invoke DASM to do extra passes anyhow, so anything 2 and above is fine. I didn't think of putting the definition below the IF statement. Very simple solution, as I don't have to rely on a DASM parameter now. Thanks Nukey!! Multipass! Muuuullllttttiii passs! Quote Link to comment Share on other sites More sharing options...
+batari Posted March 24, 2011 Share Posted March 24, 2011 I think you can do something like this to detect the current pass: ifnconst pass pass set 1 else pass set pass+1 endif However, this will not tell you when the assembler is on the last pass. I was so tired of this issue myself (along with pages of bogus label mismatch errors) that I modified DASM source code to cache any output and only display it for the last pass. Another reason was to fix a branch bug (sometimes DASM reports a branch out of range that really isn't.) I don't know if I ever posted it, though. Quote Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted March 24, 2011 Share Posted March 24, 2011 I think you can do something like this to detect the current pass: ifnconst pass pass set 1 else pass set pass+1 endif However, this will not tell you when the assembler is on the last pass. I was so tired of this issue myself (along with pages of bogus label mismatch errors) that I modified DASM source code to cache any output and only display it for the last pass. Another reason was to fix a branch bug (sometimes DASM reports a branch out of range that really isn't.) I don't know if I ever posted it, though. Sounds like a good idea. Maybe this could even help my problem. I am trying to decide automatically if an unconditional branch would be out of range and replace it with a jmp. But so far I got no macro working this way. Maybe by incorporating the PASS number, I have a better chance. 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.