CONTENTS | PREV | NEXT
15E. Inline asm and register variables
---------------------------------------
register variables are a great companion to inline assembly, as
they function just as registers, but at the same time have clear
identifiers instead of Dx, and also are automatically saved and
restored by E code. example:

PROC bla()
  DEF count:REG
  MOVEQ #10,count
loop: WriteF('count=\d\n',count)
  DBRA count,loop
ENDPROC

all instruction that can work with a Dx EA, work with register
variables. examples:

MOVEQ #1,a
MOVEM.L D0/D1/a/b/A0,-(A7)
LSL.L a,b

etc.

as may be known, EC uses D3-D7 for these register variables. If you wish
to write code that freely mixes assembly with E, it's advisable to
keep longer-term values in register variables, and temporaries in
D0-D2/A0-A3/A6