Download Assembler/Linker/Librarian User's Guide

Transcript
ASSEMBLER/LINKER/LIBRARIAN
USER’S GUIDE
Chapter 3. Expression Syntax and Operation
3.1
INTRODUCTION
Various expression formats, syntax, and operations used by MPASM assembler are
described here.
Topics covered in this chapter:
•
•
•
•
3.2
Text Strings
Reserved Words and Section Names
Numeric Constants and Radix
Arithmetic Operators and Precedence
TEXT STRINGS
A “string” is a sequence of any valid ASCII character (of the decimal range of 0 to 127)
enclosed by double quotes. It may contain double quotes or null characters.
The way to get special characters into a string is to escape the characters, preceding
them with a backslash ‘\’ character. The same escape sequences that apply to strings
also apply to characters.
Strings may be of any length that will fit within a 255 column source line. If a matching
quote mark is found, the string ends. If none is found before the end of the line, the
string will end at the end of the line. While there is no direct provision for continuation
onto a second line, it is generally no problem to use a second dw directive for the next
line.
The dw directive will store the entire string into successive words. If a string has an odd
number of characters (bytes), the dw and data directives will pad the end of the string
with one byte of zero (00).
If a string is used as a literal operand, it must be exactly one character long, or an error
will occur.
© 2005 Microchip Technology Inc.
DS33014J-page 39