Jump to content
Sign in to follow this  
Karl G

Dumb DASM Question

Recommended Posts

How can I get rid of warnings about undefined symbols that are used for conditional assembly. For example, I have the following in my code:

 ifconst RANDOM_PLAY
    jsr SubGetRand
 else
    lda SWCHA
 endif

I'll either define the RANDOM_PLAY symbol or leave it commented before that depending on the behavior I want. This works fine, but the assembler gives warnings about missing symbols. is there any way to suppress these warnings, or a better way to accomplish the above that doesn't generate the warnings?

 

Share this post


Link to post
Share on other sites

Personally, I'd do something like

MODE_Random_Play = 1
MODE_Not_Random = 2

.if GAME_MODE = MODE_Random_Play
   jsr SubGetRand
.else
   lda SWCHA
.endif

disclaimer: I don't use dasm, so YMMV

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

I use this and don't get any warnings:

 

    IFCONST AFP_TARGET
        IF AFP_TARGET != 1
            lda #%00000010
            sta VBLANK
        ENDIF
    ENDIF

Then tried adding a new reference I know doesn't exist:

 

    IFCONST TEST_0987654321
        ECHO "defined"
    ENDIF

Still no warnings. Are you sure it's not caused by something else?

 

Dasm version: DASM 2.20.11 20171206

Edited by azure
  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

The symbol list only normally shows up on a successful assemble when using the -v3 or -v4 switches. If that's the issue, just use a lower verbosity.

 

Or maybe you mean that all of these non-problem symbols show up in the unresolved list when there's a problematic unresolved symbol that prevents assembling?

 

In that case, you could define all of the constant options early on in your code, and just test their values instead. That way they're defined either way.

 

RANDOM_PLAY = 0

  ;bunch of code

  if RANDOM_PLAY == 1
    jsr SubGetRand
 else
    lda SWCHA
 endif
  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Good solutions, both. I probably don't need the verbosity that high most of the time, and I didn't think about testing for the value of the constant instead of its existence. Thanks!

  • Like 1

Share this post


Link to post
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.

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...