Jump to content



1

DASM number of passes


4 replies to this topic

#1 Omegamatrix OFFLINE  

Omegamatrix

    River Patroller

  • 4,796 posts
  • Location:Oh, Canada

Posted Mon Mar 14, 2011 11:56 AM

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?

#2 Nukey Shay OFFLINE  

Nukey Shay

    Sheik Yerbouti

  • 20,458 posts
  • Location:The land of Gorch

Posted Mon Mar 14, 2011 5:29 PM

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.


Leeloo said:

Multipass!


#3 Omegamatrix OFFLINE  

Omegamatrix

    River Patroller

  • 4,796 posts
  • Location:Oh, Canada

Posted Mon Mar 14, 2011 5:43 PM

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!!

[quote name='Leeloo']Multipass![/quote]
[/quote]

Muuuullllttttiii passs!

#4 batari OFFLINE  

batari

    )66]U('=I;B$*

  • 6,236 posts
  • begin 644 contest

Posted Wed Mar 23, 2011 11:38 PM

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.

#5 Thomas Jentzsch OFFLINE  

Thomas Jentzsch

    Thrust, Jammed, SWOOPS!

  • 16,745 posts
  • Always left from right here!
  • Location:Düsseldorf, Germany

Posted Thu Mar 24, 2011 5:08 AM

View Postbatari, on Wed Mar 23, 2011 11:38 PM, said:

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.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users