beautypg.com

Operands, Literal constants – Echelon Neuron User Manual

Page 20

background image

See Chapter 6, Neuron Assembly Language Instruction Statements, for a

description of all supported instructions.

Operands

Many Neuron assembly instructions require one or two operands to define the

machine instruction (opcode). Operands add information to the instruction, and

define the data that the instruction should operate on.
For example, some instructions require a register name (such as TOS or DSP) as

an argument to specify the source or destination of the data for the instruction.

In general, you can specify operand names in upper or lower case.
Some instructions use immediate addressing, for which you specify the operand

by prefixing a number sign or hash (#) to the value. An immediate value is used

as a literal value. For example, a PUSH #24 instruction pushes the literal value

“24” onto the stack, whereas a PUSH 24 instruction pushes the contents of

location 24 onto the stack.
Some instructions use base-relative addressing, for which the operand specifies a

location within the base-page relative to its starting address. Specify such a

displacement by prefixing an exclamation mark (!) to the operand.
Some instructions use one or two operands that specify a pointer register,

sometimes also with a displacement, or they specify a displacement relative to

the data stack pointer (DSP) or return stack pointer (RSP). Specify these types of

arguments by enclosing the argument in square brackets ([ ]).

Literal Constants

A literal constant is a numeric value, such as 12 or 173. The Neuron Assembler

supports numeric values in any of four radixes (bases): binary (base 2), octal

(base 8), decimal (base 10), and hexadecimal (base 16).
The RADIX directive specifies the default radix for an assembly language

function (see RADIX (Default Radix). To explicitly specify the radix for a literal

constant, prefix the constant’s value with one of the following letters and the

apostrophe character ():

b’ for binary numbers

o’ for octal numbers

d’ for decimal numbers

h’ for hexadecimal numbers

You can specify the radix letter in either upper or lower case. You can specify

leading zeros for any literal constant without changing its value. However, if the

default radix is hexadecimal, a literal constant must always begin with a numeric

digit or leading zero.
For example, you can specify the decimal value 123 as b’01111011, o’173, d’123,

or h’7b.

10

Introduction