On Tue, Dec 06, 2011 at 06:32:39PM +0100, Björn Spruck wrote: > the following was working in ra65 _after_ fixing the ifnd in code and > well the @ numbering... it was not enough to use a @ whcih is dec and > inc on nesting level as ra65 has problem with redefined labels. thus the > @ is used as a index to a table which is using unique numbers... the > lyxass assmbler did not have this problems. > > macro _IFNE > inc@ > beq .iELSE@ > endm > > macro _IFEQ > inc@ > bne .iELSE@ > endm > > macro _ELSE > bra .iENDIF@ > .iELSE@ > endm > > macro _ENDIF > ifnd .iELSE@ > .iELSE@ > endif > .iENDIF@ > dec@ > endm A naive conversion of the code as I understand it looks like this: ----------------------------------------------------------------------------- counter .set 0 .macro _IFNE counter .set counter +1 beq .ident (.sprintf ("else%04d", counter)) .endmacro .macro _IFEQ counter .set counter +1 bne .ident (.sprintf ("else%04d", counter)) .endmacro .macro _ELSE bra .ident (.sprintf ("endif%04d", counter)) .ident (.sprintf ("else%04d", counter)) := * .endmacro .macro _ENDIF .if .not .defined( .ident (.sprintf ("else%04d", counter))) .ident (.sprintf ("else%04d", counter)) := * .endif .ident (.sprintf ("endif%04d", counter)) := * counter .set counter - 1 .endmacro ----------------------------------------------------------------------------- It doesn't do nesting, but I think you get the idea how to construct identifiers and use counters. To support nesting, I would add a second counter that counts the nesting level and is also placed into the identifier. > uh, but only if you have the name od the scope... which would be unknown > if the macros is creating it Yes. Regards Uz -- Ullrich von Bassewitz uz@musoftware.de ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo@musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.Received on Tue Dec 6 21:59:46 2011
This archive was generated by hypermail 2.1.8 : 2011-12-06 21:59:49 CET