beautypg.com

3 operator, Operator – Epson S1C62 Family User Manual

Page 39

background image

CROSS ASSEMBLER ASM62XX

S1C62 FAMILY

EPSON

III-9

DEVELOPMENT TOOL REFERENCE MANUAL

4.4.3

Operator

When specifying a value for an item such as an operand, an operational expression can be written instead
of a constant, and its result can be used as the value.
Labels and symbols as well as constants can be used as terms in expressions. These values are processed as
13-bit data (bit 14 and subsequent high-order bits are ignored); the operation result also consists of 13 bits.
If the result exceeds the number of significant digits of the instruction operand, an error occurs.
There are three types of operator—arithmetic, logical, and relational—as listed below (a and b represent
terms, and _ represents one or more blanks).

Arithmetic operators

There are 11 arithmetic operators including the ones for addition, subtraction, multiplication, division,
bit shifting, and bit separation.

+a

Monadic positive (indicates the subsequent value is positive)

-a

Monadic negative (indicates the subsequent value is negative)

a+b

Addition (unsigned)

a-b

Subtraction (unsigned)

a*b

Multiplication (unsigned)

a/b

Division (unsigned)

a_MOD_b

Remainder of a/b

a_SHL_b

Shifts a b bits to the left.

[b7<<<<<

0

Example:

00000011B SHL 2

00001100B

a_SHR_b

Shifts a b bits to the right. 0

[b7>>>>>>b0]

Example:

11000011B SHR 2

00110000B

HIGH_a

Separates the high-order eight bits from a (13 bits).

Example:

HIGH 1234H

12H

LOW_a

Separates the low-order eight bits from a (13 bits).

Example:

LOW 1234H

34H

Logical operators

There are four logical operators as listed below. The logical operator returns the result of logical
operation on the specified terms.

a_AND_b

Logical product

Example:

00001111B AND 00000011B

00000011B

a_OR_b

Logical sum

Example:

00001111B OR 11110000B

11111111B

a_XOR_b

Exclusive logical sum

Example:

00001111B XOR 00000011B

00001100B

NOT_a

Logical negation

Example:

NOT 00001111B

11110000B