[A83] Re: Macros


[Prev][Next][Index][Thread]

[A83] Re: Macros




#define LD_HL_DE ld h,d\ ld l,e
#define LD_HL(x,y) ld hl,((x)<<8)+(y)

The first one is the type with no paramaters. It is replaced literally. Note
the \ means a linebreak. The second one is with paramaters. You name the
parameters whatever you want. You can have 1, 2, etc (or none obviously). In
the expression then, wherever the parameter names are, the macro values are
replaced. Example:

"LD_HL(3,5)" is replaced with "ld hl,((3)<<8)+(5)"

This macro is often useful for the text display routines, where you need to
combine coordinates into a register pair. Note the ( ) around the x and y
that seem to have no purpose -- they are necessary to make the macro always
work properly. Otherwise the order of operations can sometimes get mixed up.

Kirk

-----Original Message-----
From: assembly-83-bounce@lists.ticalc.org
[mailto:assembly-83-bounce@lists.ticalc.org]On Behalf Of Jeff Ruud
Sent: Sunday, July 01, 2001 9:16 PM
To: assembly-83@lists.ticalc.org
Subject: [A83] Macros



Can someone please explain to me how to use macros,
and how to write routines with them?

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/




Follow-Ups: References: