276
Section 3: Assembler
TI
-
89 / TI
-
92 Plus Sierra C Assembler Reference Manual
Not for Distribution
Beta Version February 2, 2001
VALUES MACRO
IFLT \2
MEXIT
ENDC
VALUES \1,?(\2-1),\3
\1\2 EQU \3\2
ENDM
OPT MEX
VALUES BIT,7,1<<
BIT0 EQU 1<<0
BIT1 EQU 1<<1
BIT2 EQU 1<<2
BIT3 EQU 1<<3
BIT4 EQU 1<<4
BIT5 EQU 1<<5
BIT6 EQU 1<<6
BIT7 EQU 1<<7
VALUES IDX,9,4*
IDX0 EQU 4*0
IDX1 EQU 4*1
IDX2 EQU 4*2
IDX3 EQU 4*3
IDX4 EQU 4*4
IDX5 EQU 4*5
IDX6 EQU 4*6
IDX7 EQU 4*7
IDX8 EQU 4*8
IDX9 EQU 4*9
The final example presents a macro that can be used to perform copying of
strings and arbitrary memory ranges. Its parameters include the source and
destination addresses, the type of copy to be performed, and the number of
bytes to be copied (not used for string copies). The final two parameters are
optional; they specify the address registers that will be used for the copy. The
macro’s size qualifier specifies the number of bytes to be copied at a time. The
macro
COUNT
uses the qualifier to compute the number of move instructions
needed to perform the copy. Two example invocations are shown following the
macro definitions.
COPY MACRO
IFNC '\3','STRING COPY'
COUNT \4,\0,MOVEQ,D0
ENDC
IFEQ NARG-6
LEA \1,A\5