beautypg.com

Alloc (allocate) – Echelon Neuron User Manual

Page 77

background image

ALLOC (Allocate)

The ALLOC instruction allocates a specified number of bytes on the data stack.

The specified number of bytes must be in the range 1 to 8. The ALLOC

instruction uses the immediate addressing mode. The allocated bytes are not

initialized and have non-deterministic values.
Recommendation: Use the _alloc system function to allocate more than eight

bytes on the data stack, or to allocate any number of bytes that will be initialized

to zero. See _alloc (Allocate Stack Space) for more information.
See also DEALLOC (Deallocate and Return) to deallocate space on the data stack.
The ALLOC instruction applies to Series 3100, 5000, and 6000 devices.

Syntax:
The ALLOC instruction requires a single operand to specify the number of bytes

to allocate on the data stack:

ALLOC #number

The value of number must be in the range 1..8. The number sign or hash (#) is

required to specify the immediate value.
Table 13 describes the attributes of the ALLOC instruction.

Table 13. ALLOC Instruction

Instruction

Hexadecimal

Opcode

Instruction

Size (Bytes)

CPU Cycles

Required

Affect on

Carry Flag

ALLOC #1

C0

1

3

None

ALLOC #2

C1

1

3

None

ALLOC #3

C2

1

3

None

ALLOC #4

C3

1

3

None

ALLOC #5

C4

1

3

None

ALLOC #6

C5

1

3

None

ALLOC #7

C6

1

3

None

ALLOC #8

C7

1

3

None

Example:
The following example allocates two bytes on the data stack. The resulting

values of TOS and NEXT are not specified.

alloc #2 ; (a, b)

Neuron Assembly Language Reference

67