5.8.48. LCLA directive

The LCLA directive declares and initializes a local arithmetic variable. Local variables can be declared only within a macro.

The range of values that arithmetic variables may take is the same as that of numeric expressions. See Numeric expressions.


The syntax of LCLA is:

LCLA variable-name



is the name of the variable to set. The name mustbe unique within the macro that contains it. The initial value of the variable is 0.


See also MACRO directive. The scope of the variable is limited to a particular instantiation of the macro that contains it.

Using LCLA for a variable that is already defined re-initializes the variable to 0.

Set the value of the variable with the SETA directive. See SETA directive.

See GBLA directive for information on declaring global arithmetic variables.


								; Calculate the next-power-of-2
								; number >= the value given.
		MACRO						; Declare a macro
$rslt		NPOW2		$value				; Macro prototype line
		LCLA		newval				; Declare local arithmetic
								; variable newval.
newval		SETA		1				; Set value of newval to 1
		WHILE		(newval < $value)
								; Repeat a loop that
newval		SETA		(newval :SHL:1)				; multiplies newval by 2
		WEND						; until newval >= $value.
$rslt		EQU		(newval)				; Return newval in $rslt
		MEND						; No runtime instructions here!
Copyright © 1997, 1998 ARM Limited. All rights reserved.ARM DUI 0041C