Jump to content
IGNORED

DASM number of passes


Omegamatrix

Recommended Posts

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?

Link to comment
Share on other sites

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!
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...