CONTENTS | PREV | NEXT
15A. identifier sharing
-----------------------
As you've probably guessed from the example in chapter 5D, assembly
instructions may be freely mixed with E code. The big secret is, that
a complete assembler has been built in to the compiler.
Apart from normal assembly addressing modes, you may use the following
identifiers from E:

mylabel:
LEA mylabel(PC),A1		/* labels */

DEF a				/* variables */
MOVE.L (A0)+,a			/* note that <var> is <offset>(A4) (or A5) */

MOVE.L dosbase,A6		/* library call identifiers */
JSR    Output(A6)

MOVEQ  #TRUE,D0			/* constants */


EC's assembler supports following constructs,

where
n	= registernum
x	= index
lab	= label, from: "label:" or "PROC label()"
abs	= absolute addressing
s	= size. L, W or B where appropriate.

- addressing modes supported by EC:

  Dn, An, (An), (An)+, -(An), x(An), x(An,Dn.s),
  lab(PC), lab(PC,Dn.s), abs, abs.W

  (note: write abs.W in hexadecimal, to not confuse it with a float
   value, i.e. write   MOVE.L $4.W,A6   )

- supported partially:

  #<constexp>

- not supported:

  lab (same as abs), #lab
  use LEA lab(PC),An instead.

- extra modes:

  var.s (transfers contents of var. optionally size is ".W" or ".B",
         default is ".L")

  LibraryFunction(A6)

  example:

  ...
  MOVE.W myvar.W,D0     -> move lowword of 'myvar'
  ...
  MOVE.L dosbase,A6
  JSR    Write(A6)



As an extra, E allows to directly return registers from a function:

  ENDPROC D0

You may even interpret this as multiple return values, i.e. D0/D1/D2.