beautypg.com

4 location counter, Location counter – Epson S1C62 Family User Manual

Page 40

background image

CROSS ASSEMBLER ASM62XX

III-10

EPSON

S1C62 FAMILY

DEVELOPMENT TOOL REFERENCE MANUAL

Relational operators

A logical operator compares two terms; if the relationship between the terms is as the operator
specifies, 1FFFH (true) is returned; if not, 0 (false) is returned.

a_EQ_b

True when a is equal to b

a_NE_b

True when a is not equal to b

a_LT_b

True when a is less than b

a_LE_b

True when a is less than or equal to b

a_GT_b

True when a is greater than b

a_GE_b

True when a is greater than or equal to b

Be sure to insert one or more blanks for symbol "_" between terms. All operators must be entered in
uppercase letters.

An expression can contain one or more operators and pairs of parenthesis. In this case, operators are
basically evaluated from left to right. However, an operation stipulated by an operator with higher priority
or by parentheses is executed earlier. Every left parenthesis must have a corresponding right parenthesis.

The following table shows the priority of operators.

Operator

Priority

)

Low

OR, XOR

:

AND
EQ, NE, LT, LE, GT, GE
+ (addition), - (subtraction)
*, /, MOD, SHL, SHR
(
HIGH, LOW, NOT

:

- (monadic negative), + (monadic positive)

High

Examples:

Operational expressions (ABC = 1, BCD = 3)

LD

A,BCD*(ABC+1)

;A-register <- 6

LD

A,ABC LT BCD

;A-register <- 0FH (1111B)

OR

B,ABC SHL BCD

;Set bit 3 in B-register

;(=OR B,1000B)

AND B,ABC SHL BCD XOR 0FH

;Reset bit 3 in B-register

;(=AND B,0111B)

4.4.4

Location counter

The start address of each instruction code is set in the location counter when a statement is assembled. A
label or $ can be used when referencing the location counter value in a program.

Location counter

The location counter consists of 13 bits: one bit for the bank field, four bits for the page counter field,
and eight bits for the step counter field.

Bank

Page counter

Step counter

Bit

12

11

10

9

8

7

6

5

4

3

2

1

0

Contents

Bank

Page address

Step address

BNK

PCP

PCS

Example:

Location counter

(BNK) (PCP) (PCS)

0

1

02

JP

$+3

The location counter indicates the start address of the JP instruction, and the PCS value (02) is assigned to $.
Consequently, the statement is assembled as "JP 5", and the program sequence jumps to the location three
steps before (PCS=05) when it is executed.