Re: [cc65] Macro/asm problem

From: Groepaz <>
Date: 2004-06-01 14:02:11
On Friday 28 May 2004 17:04, Ullrich von Bassewitz wrote:
> Hi!
> On Fri, May 28, 2004 at 10:51:41AM -0400, Keates, Mark wrote:
> > Just a thought... couldn't the macro create its own 'scope'
> > and so allowing the label to be re-used many times within
> > the current scope?
> No. The macro could create a C scope, but this doesn't help, because a C
> scope doesn't create an assembler scope. And creating an assembler scope
> directly (by emitting .scope) is something that is not possible with the
> inline assembler.

i have a solution for this that works almost perfectly: use the __LINE__
symbol to generate the labels like this: (this avoids passing them to
the macro as arguments)

#define uaddsc(_a,_b) \
        __asm__ ("lda %v", _a); \
        __asm__ ("clc"); \
        __asm__ ("adc %v", _b); \
        __asm__ ("sta %v", _a); \
        __asm__ ("bcc @L%s", __LINE__); \
        __asm__ ("inc %v+1", _a); \
        __asm__ ("@L%s:", __LINE__);


To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Tue Jun 1 14:18:42 2004

This archive was generated by hypermail 2.1.8 : 2004-06-01 14:18:50 CEST