Hello Stijn, Unfortunately this is not possible with SDCC.
Greets, Maarten > Hi all, > > I have a question regarding inline assembly in sdcc: > > I have some assembly code which I would like to put in a macro that is to > be called many times throughout my C-code. For efficiency reasons this > short piece of assembly must be inlined hence I can't use a function. Also > this macro must take an argument and herein lies the problem. My assembly > code must know which register contains this input value, i.e. I need a way > to "connect" my C variables to my assembly registers. > > I need something like: > > // placeholder == '%r', to be substituted by whatever register the > compiler allocates for 'val' > #define MY_MACRO (val) __asm__("mov a,%r", val) > > Is something like this possible? > > Even better would be if the compiler could also substitute a placeholder > by a free register that is unused by the surrounding function for more > complicated computations: > > // placeholder == '%ur', register to be reserved and substituted > #define MY_MACRO (val) __asm__( > "mov %ur,a\n", > "dec %ur\n", > "mov a,%ur\n" > ) > > Thanks, > > Stijn ------------------------------------------------------------------------------ Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user