• Keine Ergebnisse gefunden

EPSONExtended notation of symbols

When referencing an address with a symbol, you normally write the name of that symbol in the operand where an address is specified.

Examples: call LABEL ...LABEL = sign8

ld.w %rd, LABEL ...LABEL = sign6

The Assembler also accepts the referencing of an address with a specified displacement as shown below.

LABEL + imm32 LABEL + sign32

Example: call LABEL+0x10

Symbol mask

The basic instructions in the E0C33000 instruction set are characterized by the fact that the immediate size that can be specified in the operand of each instruction is limited. Consequently, an assembler error results when a symbol whose value exceeds the size is used. When using the basic instructions, the high-order bits must be written separately in the ext instruction. A symbol mask is used for this purpose.

Specifically, a symbol mask is used to get the values from a symbol value that are written separately in the ext instruction and the basic instruction, and is entered immediately after the symbol.

When using extended instructions, the Instruction Extender ext33 attaches the necessary symbol mask as it expands the instruction. Therefore, you do not specifically need to be concerned about the ext instruction or symbol mask.

Types of symbol masks

The following 8 types of symbol masks can be used:

Symbol mask Function

@rh or @RH Acquires the 10 high-order bits of a relative address.

@rm or @RM Acquires the 13 mid-order bits of a relative address.

@rl or @RL Acquires the 8 low-order bits of a relative address.

@h or @H Acquires the 13 high-order bits of an absolute address.

@m or @M Acquires the 13 mid-order bits of an absolute address.

@l or @L Acquires the 6 low-order bits of an absolute address.

@ah or @AH Acquires the 13 high-order bits of a relative address.

@al or @AL Acquires the 13 low-order bits of a relative address.

Examples:

ext LABEL@rh

ext LABEL@rm

call LABEL@rl Functions as "call LABEL".

ext LABEL@h

ext LABEL@m

ld.w %rd, LABEL@l Functions as "ld.w %rd, LABEL".

ext LABEL@ah

ext LABEL@al

ld.w %rd, [%rb] Functions as "ld.w %rd, [%rb+LABEL]".

Notes: · The symbol masks are effective only on the defined symbols. If a symbol mask is applied to a numeric value, an error will result.

· If a symbol mask is omitted, the lower bits effective for that instruction will be used. However, if the bit value does not fall within the instruction range, an error or warning will be issued.

4.3.3 Extended Instructions

The Instruction Extender ext33 provides extended instructions for creating assembly source files. An extended instruction is such that the contents which normally are written in multiple instructions including the ext instruction can be written in one instruction. Extended instructions are expanded into the smallest possible basic instructions by the Instruction Extender.

Types of extended instructions

xadd xsub xcmp xand xoor xxor xnot xsll xsrl xsla xsra xrl xrr xld.b xld.ub xld.h xld.uh xld.w xbset xbclr xbtst xbnot

xjp xjreq xjrne xjrgt xjrge xjrlt xjrle xjrugt xjruge xjrult xjrule xcall xjp.d xjreq.d xjrne.d xjrgt.d xjrge.d xjrlt.d xjrle.d xjrugt.d xjruge.d xjrult.d xjrule.d xcall.d

An extended instruction is derived from one of the basic instructions by adding the prefix "x". ("xoor" for the or instruction.)

Method for using extended instructions

The value or symbol for the expanded immediate size can be written directly in the operand.

Examples: xcall LABEL ; ext LABEL@rh

; ext LABEL@rm

; call LABEL@rl

xld.w %r1, sign32 ; ext sign32@h

; ext sign32@m

; ld.w sign@l

In addition to the immediate expansion function of the basic instructions, a special operand specification like the one shown below is accepted for some instructions.

Examples: xadd %r0, %r1, 0x1 ; R0 ¬ R1 + 1

xsub %sp, %sp, %r1 ; SP ¬ SP + R1

xld.w %r0, [symbol + 0x10] ; R0 ¬ [symbol + 0x10]

xjp LABEL + 5 ; Jumps to address LABEL + 5.

xrl %r0, 15 ; Rotates the R0 content left by 15 bits.

For details about the extended instructions that include operands, refer to Section 10.6, "Extended Instructions".

Note: Extended instructions must be processed by the Instruction Extender ext33. They cannot be input directly into the Assembler as33 (this results in an error).

CHAPTER 4: SOURCE FILES

EPSON

4.3.4 Additional Preprocessor Functions

The Preprocessor pp33 offers additional functions for the creation of assembly source files. This section will deal only with the notations for these functions. For details on each one of the functions, refer to Chapter 9,

"Preprocessor". The preprocessor processes the notations of the said functions into mnemonic statements that can be assembled, thereby delivering assembly source files.

Note: The statements dealt with in this section need to be processed by the preprocessor, and cannot be entered directly into the Assembler as33. (Direct entry into the assembler will result an error.) Preprocessor pseudo-instructions

The following five types of pseudo-instructions are provided for the Preprocessor pp33.

#include Insertion of file

#define Definition of character strings and numbers

#macro–#endm Definition of macros

#ifdef(ifndef)–#else–#endif Conditional assembly All of these pseudo-instructions begin with a sharp (#).

Examples: #include "define.h"

For details on the notation of each pseudo-instruction and function, refer to Section 9.5 "Preprocessor Pseudo-Instructions".

Operators

To specify a value in the source, an expression using the following operators can be used:

Examples

+ Addition, Plus sign +0xff, 1+2

- Subtraction, Minus sign -1+2, 0xfff-0b111

* Multiplication 0xf*5

/ Division 0x123/0x56

%% Residue 0x123%%0x56

>> Shifting to right 1>>2

<< Shifting to left 0x113<<3

& Logical product 0b1101&0b111

| Logical sum 0x123|0xff

^ Exclusive OR 12^35

~ Logical denial ~0x1234

^H Acquires bit field (31:19) 0x1234^H

^M Acquires bit field (18:6) 0x1234^M

^L Acquires bit field (5:0) 0x1234^L

^AH Acquires bit field (25:13) 0x1234^AH

^AL Acquires bit field (12:0) 0x1234^L

(, ) Parentheses 1+(1+2*5)

In the numeric parts of an expression, you can use a symbol whose value is defined by the preprocessor pseudo-instruction #define.

4.4 Precautions for Creation of Sources

(1) Place a tab stop every 8 characters. Mixed processing by the Disassembler dis33 or source display/mixed display with the Debugger db33 of a source set at a tab interval other than 8 characters will result in displaced output of the source part.

(2) When compiling/assembling a C source or assembly source that includes debugging information, do not include other source files (by using #include). It may cause a debugger operation error. This does not apply to ordinary header files that do not contain sources.

(3) When describing an assembly source in absolute format, do not define two or more CODE, DATA or BSS sections. Actually, a source file can contain two or more of the same type of sections, note, however the program may not work correctly if the sections are not described in ascending order or because of other problems. Therefore, the absolute source in which the same section is separately defined cannot be guaranteed to work.

(4) When using C and assembler modules in a program, pay attention to the interface between the C functions and assembler routines, such as arguments, size of return values and the parameter passing conventions.