beautypg.com

Accessing global and static data, Addressing modes, Immediate – Echelon Neuron User Manual

Page 40: Absolute

background image

Instead of relying on the developer to specify these memory areas, the Neuron

Linker automatically determines the amount of memory required for each type,

and constructs a memory map to meet the requirements of the chip, the firmware

and the application.

Accessing Global and Static Data

The Neuron C compiler places each global and static data object in its own

relocatable data segment of the appropriate type (RAMNEAR, RAMFAR,

EENEAR, EEFAR, or ROM, depending on the storage type declared for the

Neuron C variable). For a Neuron assembly language function, you should also

place global and static data into relocatable data segments.

Addressing Modes

The Neuron assembly language supports several addressing modes to specify the

effective address of the argument of an instruction. The syntax for the

instruction operand generally specifies the addressing mode used. For example,

the number sign or hash (#) denotes the immediate addressing mode.
Not all of the addressing modes are available for all instructions. See Chapter 6,

Neuron Assembly Language Instruction Statements, for a description of the

instructions and the addressing modes that each supports.
The following sections describe the supported addressing modes.

Immediate

In the immediate addressing mode, the instruction operand is a literal constant

or an expression that resolves to a constant value. In this addressing mode, the

instruction does not reference any registers or memory addresses.
Example:

push #10 ; (10, ...)

pushd #h’98bc ; (bc, 98, ...)

The push #10 instruction pushes the number 10 onto the data stack. The pushd

#h’98bc instruction pushes the most-significant byte (h’98) into NEXT and the

least-significant byte (h’bc) into TOS.

Absolute

In the absolute addressing mode, the instruction operand is an absolute address

in memory or an expression that resolves to an absolute address. Because the

address is an absolute address, the address must be 16 bits.
Example:

push myVariable ; (myVar, ...)

callf myRoutine ; (--)

The push myVariable instruction pushes the value at the location named

myVariable into TOS. The callf myRoutine instruction is a far call to the

myRoutine function.

30

Neuron Architecture for Neuron Assembly Programming