jbs30000 #1 Posted December 9, 2010 First, this is post is kind of long probably complicated. I was playing around with macros, and decided to see what could be done with if-then statements. This macro seems to produce perfectly valid asm code, but gives a fatal assembly error. I'm just curious as to what the error is, seeing as how the asm looks fine, and if there's another way to write this code to avoid the error. If not then no biggie. bB Code dim Mario=a const T1=3 const V1=1 macro Value_If temp1={1}&{3} if temp1={3} then goto {4} end callmacro Value_If Mario T1 V1 JLoop JLoop Here's the asm code, which seems fine: 0 f48f Value_If Mario, #T1, #V1, JLoop, 1 f48f 2 f48f .L05 3 f48f 4 f48f a5 d6 LDA Mario 5 f491 29 01 AND #V1 6 f493 85 9c STA temp1 7 f495 .L06 8 f495 9 f495 a5 9c LDA temp1 10 f497 c9 01 CMP #V1 11 f499 d0 03 BNE .skipL06 12 f49b .condpart0 13 f49b 4c 00 00 jmp .JLoop 14 f49e 15 f49e .skipL06 1568 f49e . 1569 f49e ; 1570 f49e 1571 f49e .JLoop But I get this error: DASM V2.20.07, Macro Assembler (C)1988-2003 bytes of ROM space left 2814 bytes of ROM space left 2814 bytes of ROM space left --- Unresolved Symbol List pfcenter 0000 ???? (R ) 22.JLoop 0000 ???? (R ) kernelmacrodef 0000 ???? (R ) pfhalfwidth 0000 ???? (R ) Fatal assembly error: Source is not resolvable. Errors were encountered during assembly. I've even tried using asm within the macro, but still get the same error. macro Value_If asm lda {1} and {3} cmp {3} beq {4} end end Quote Share this post Link to post Share on other sites
+GroovyBee #2 Posted December 9, 2010 What happens if you remove the callmacro calls? Do you still get the assembler error? Quote Share this post Link to post Share on other sites
jbs30000 #3 Posted December 9, 2010 No, just having the macro is fine. It's when I try to use it that I get the error. Quote Share this post Link to post Share on other sites
+GroovyBee #4 Posted December 9, 2010 Where is the label 22.JLoop defined in the final assembly language listing? Are you using the macro more than once? Quote Share this post Link to post Share on other sites
+GroovyBee #5 Posted December 9, 2010 Double post due to "Internal sever error" Quote Share this post Link to post Share on other sites
jbs30000 #6 Posted December 9, 2010 That double post is kind of funny. Anyway, I don't know why it says 22.JLoop. The 9 lines of code I posted is all there is. Quote Share this post Link to post Share on other sites
+RevEng #7 Posted December 9, 2010 (edited) The problem is definitely with JLoop. The hex for the opcode has zero for address bytes. The 22.JLoop is happening because bB actually uses a . in front of the basic label names when it generates the assembly. But when dasm see's the .JLoop in a macro, it thinks the label needs to be renamed to be unique. It you restructure your code to use inline assembly and to use "jmp JLoop" instead of "jmp .JLoop", and define the JLoop label within an inline assembly block, I think it will work. Edited December 9, 2010 by RevEng Quote Share this post Link to post Share on other sites
jbs30000 #8 Posted December 9, 2010 If you look though, JLoop is named .JLoop in the asm output. But you're right that the machine code seems to be saying jump to address 0, which isn't right. Anyway, what I was trying for was to be able to jump to any label, not just labels inside of the macro. But that's OK, after trying a few different tricks it looks like it's not possible. It's not that big of a deal, there are other ways to accomplish what I want. Thank you for the help. I appreciate it. Quote Share this post Link to post Share on other sites