You can reference E variables simply by using them in an operand. Follow the comments in the next example (the comments are on the same lines as the Assembly mnemonics, the other lines are normal E statements):
PROC main() DEF x x:=1 MOVE.L x, D0 /* Copy the value in x to register D0 */ ADD.L D0, D0 /* Double the value in D0 */ MOVE.L D0, x /* Copy the value in D0 back to variable x */ WriteF('x is now \d\n', x) ENDPROC
Constants can also be referenced but you need to precede the constant with a `#'.
CONST APPLE=2 PROC main() DEF x MOVE.L #APPLE, D0 /* Copy the constant APPLE to register D0 */ ADD.L D0, D0 /* Double the value in D0 */ MOVE.L D0, x /* Copy the value in D0 to variable x */ WriteF('x is now \d\n', x) ENDPROC
Labels and procedures can similarly be referenced, but these are PC-relative so you can only address them in this way. The following example illustrates this, but doesn't do anything useful:
PROC main() DEF x LEA main(PC), A0 /* Copy the address of main to register A0 */ MOVE.L A0, x /* Copy the value in A0 to variable x */ WriteF('x is now \d\n', x) ENDPROC
You can call Amiga system functions in the same way as you would normally in Assembly.
You need to load the A6 register with the appropriate library base, load the other registers with appropriate data and then
JSR to the system routine.
This next example uses the E built-in variable
intuitionbase and the Intuition library routine
When you run it the screen flashes (or, with Workbench 2.1 and above, you might get a beep or a sampled sound, depending on your Workbench setup).
PROC main() MOVE.L #NIL, A0 MOVE.L intuitionbase, A6 JSR DisplayBeep(A6) ENDPROC
Go to the Next or Previous section, the Detailed Contents, or the Amiga E Encyclopedia.