📄 as.texinfo
字号:
* Constants:: Constants@end menu@node Preprocessing@section Preprocessing@cindex preprocessingThe @code{@value{AS}} internal preprocessor:@itemize @bullet@cindex whitespace, removed by preprocessor@itemadjusts and removes extra whitespace. It leaves one space or tab beforethe keywords on a line, and turns any other whitespace on the line intoa single space.@cindex comments, removed by preprocessor@itemremoves all comments, replacing them with a single space, or anappropriate number of newlines.@cindex constants, converted by preprocessor@itemconverts character constants into the appropriate numeric values.@end itemizeIt does not do macro processing, include file handling, oranything else you may get from your C compiler's preprocessor. You cando include file processing with the @code{.include} directive(@pxref{Include,,@code{.include}}). You can use the @sc{gnu} C compiler driverto get other ``CPP'' style preprocessing, by giving the input file a@samp{.S} suffix. @xref{Overall Options,, Options Controlling the Kind ofOutput, gcc.info, Using GNU CC}.Excess whitespace, comments, and character constantscannot be used in the portions of the input text that are notpreprocessed.@cindex turning preprocessing on and off@cindex preprocessing, turning on and off@kindex #NO_APP@kindex #APPIf the first line of an input file is @code{#NO_APP} or if you use the@samp{-f} option, whitespace and comments are not removed from the input file.Within an input file, you can ask for whitespace and comment removal inspecific portions of the by putting a line that says @code{#APP} before thetext that may contain whitespace or comments, and putting a line that says@code{#NO_APP} after this text. This feature is mainly intend to support@code{asm} statements in compilers whose output is otherwise free of commentsand whitespace.@node Whitespace@section Whitespace@cindex whitespace@dfn{Whitespace} is one or more blanks or tabs, in any order.Whitespace is used to separate symbols, and to make programs neater forpeople to read. Unless within character constants(@pxref{Characters,,Character Constants}), any whitespace means the sameas exactly one space.@node Comments@section Comments@cindex commentsThere are two ways of rendering comments to @code{@value{AS}}. In bothcases the comment is equivalent to one space.Anything from @samp{/*} through the next @samp{*/} is a comment.This means you may not nest these comments.@smallexample/* The only way to include a newline ('\n') in a comment is to use this sort of comment.*//* This sort of comment does not nest. */@end smallexample@cindex line comment characterAnything from the @dfn{line comment} character to the next newlineis considered a comment and is ignored. The line comment character is@ifset A29K@samp{;} for the AMD 29K family;@end ifset@ifset ARC@samp{;} on the ARC;@end ifset@ifset ARM@samp{@@} on the ARM;@end ifset@ifset H8/300@samp{;} for the H8/300 family;@end ifset@ifset H8/500@samp{!} for the H8/500 family;@end ifset@ifset HPPA@samp{;} for the HPPA;@end ifset@ifset I80386@samp{#} on the i386 and x86-64;@end ifset@ifset I960@samp{#} on the i960;@end ifset@ifset PJ@samp{;} for picoJava;@end ifset@ifset SH@samp{!} for the Hitachi SH;@end ifset@ifset SPARC@samp{!} on the SPARC;@end ifset@ifset M32R@samp{#} on the m32r;@end ifset@ifset M680X0@samp{|} on the 680x0;@end ifset@ifset M68HC11@samp{#} on the 68HC11 and 68HC12;@end ifset@ifset VAX@samp{#} on the Vax;@end ifset@ifset Z8000@samp{!} for the Z8000;@end ifset@ifset V850@samp{#} on the V850;@end ifsetsee @ref{Machine Dependencies}. @refill@c FIXME What about m88k, i860?@ifset GENERICOn some machines there are two different line comment characters. Onecharacter only begins a comment if it is the first non-whitespace character ona line, while the other always begins a comment.@end ifset@ifset V850The V850 assembler also supports a double dash as starting a comment thatextends to the end of the line.@samp{--};@end ifset@kindex #@cindex lines starting with @code{#}@cindex logical line numbersTo be compatible with past assemblers, lines that begin with @samp{#} have aspecial interpretation. Following the @samp{#} should be an absoluteexpression (@pxref{Expressions}): the logical line number of the @emph{next}line. Then a string (@pxref{Strings,, Strings}) is allowed: if present it is anew logical file name. The rest of the line, if any, should be whitespace.If the first non-whitespace characters on the line are not numeric,the line is ignored. (Just like a comment.)@smallexample # This is an ordinary comment.# 42-6 "new_file_name" # New logical file name # This is logical line # 36.@end smallexampleThis feature is deprecated, and may disappear from future versionsof @code{@value{AS}}.@node Symbol Intro@section Symbols@cindex characters used in symbols@ifclear SPECIAL-SYMSA @dfn{symbol} is one or more characters chosen from the set of allletters (both upper and lower case), digits and the three characters@samp{_.$}.@end ifclear@ifset SPECIAL-SYMS@ifclear GENERIC@ifset H8A @dfn{symbol} is one or more characters chosen from the set of allletters (both upper and lower case), digits and the three characters@samp{._$}. (Save that, on the H8/300 only, you may not use @samp{$} insymbol names.)@end ifset@end ifclear@end ifset@ifset GENERICOn most machines, you can also use @code{$} in symbol names; exceptionsare noted in @ref{Machine Dependencies}.@end ifsetNo symbol may begin with a digit. Case is significant.There is no length limit: all characters are significant. Symbols aredelimited by characters not in that set, or by the beginning of a file(since the source program must end with a newline, the end of a file isnot a possible symbol delimiter). @xref{Symbols}.@cindex length of symbols@node Statements@section Statements@cindex statements, structure of@cindex line separator character@cindex statement separator character@ifclear GENERIC@ifclear abnormal-separatorA @dfn{statement} ends at a newline character (@samp{\n}) or at asemicolon (@samp{;}). The newline or semicolon is considered part ofthe preceding statement. Newlines and semicolons within characterconstants are an exception: they do not end statements.@end ifclear@ifset abnormal-separator@ifset A29KA @dfn{statement} ends at a newline character (@samp{\n}) or an ``at''sign (@samp{@@}). The newline or at sign is considered part of thepreceding statement. Newlines and at signs within character constantsare an exception: they do not end statements.@end ifset@ifset HPPAA @dfn{statement} ends at a newline character (@samp{\n}) or an exclamation point (@samp{!}). The newline or exclamation point is considered part of thepreceding statement. Newlines and exclamation points within characterconstants are an exception: they do not end statements.@end ifset@ifset H8A @dfn{statement} ends at a newline character (@samp{\n}); or (for theH8/300) a dollar sign (@samp{$}); or (for theHitachi-SH or theH8/500) a semicolon(@samp{;}). The newline or separator character is considered part ofthe preceding statement. Newlines and separators within characterconstants are an exception: they do not end statements.@end ifset@end ifset@end ifclear@ifset GENERICA @dfn{statement} ends at a newline character (@samp{\n}) or lineseparator character. (The line separator is usually @samp{;}, unlessthis conflicts with the comment character; @pxref{Machine Dependencies}.) Thenewline or separator character is considered part of the precedingstatement. Newlines and separators within character constants are anexception: they do not end statements.@end ifset@cindex newline, required at file end@cindex EOF, newline must precedeIt is an error to end any statement with end-of-file: the lastcharacter of any input file should be a newline.@refillAn empty statement is allowed, and may include whitespace. It is ignored.@cindex instructions and directives@cindex directives and instructions@c "key symbol" is not used elsewhere in the document; seems pedantic to@c @defn{} it in that case, as was done previously... doc@cygnus.com,@c 13feb91.A statement begins with zero or more labels, optionally followed by akey symbol which determines what kind of statement it is. The keysymbol determines the syntax of the rest of the statement. If thesymbol begins with a dot @samp{.} then the statement is an assemblerdirective: typically valid for any computer. If the symbol begins witha letter the statement is an assembly language @dfn{instruction}: itassembles into a machine language instruction.@ifset GENERICDifferent versions of @code{@value{AS}} for different computersrecognize different instructions. In fact, the same symbol mayrepresent a different instruction in a different computer's assemblylanguage.@refill@end ifset@cindex @code{:} (label)@cindex label (@code{:})A label is a symbol immediately followed by a colon (@code{:}).Whitespace before a label or after a colon is permitted, but you may nothave whitespace between a label's symbol and its colon. @xref{Labels}.@ifset HPPAFor HPPA targets, labels need not be immediately followed by a colon, but the definition of a label must begin in column zero. This also implies thatonly one label may be defined on each line.@end ifset@smallexamplelabel: .directive followed by somethinganother_label: # This is an empty statement. instruction operand_1, operand_2, @dots{}@end smallexample@node Constants@section Constants@cindex constantsA constant is a number, written so that its value is known byinspection, without knowing any context. Like this:@smallexample@group.byte 74, 0112, 092, 0x4A, 0X4a, 'J, '\J # All the same value..ascii "Ring the bell\7" # A string constant..octa 0x123456789abcdef0123456789ABCDEF0 # A bignum..float 0f-314159265358979323846264338327\95028841971.693993751E-40 # - pi, a flonum.@end group@end smallexample@menu* Characters:: Character Constants* Numbers:: Number Constants@end menu@node Characters@subsection Character Constants@cindex character constants@cindex constants, characterThere are two kinds of character constants. A @dfn{character} standsfor one character in one byte and its value may be used innumeric expressions. String constants (properly called string@emph{literals}) are potentially many bytes and their values may not beused in arithmetic expressions.@menu* Strings:: Strings* Chars:: Characters@end menu@node Strings@subsubsection Strings@cindex string constants@cindex constants, stringA @dfn{string} is written between double-quotes. It may containdouble-quotes or null characters. The way to get special charactersinto a string is to @dfn{escape} these characters: precede them witha backslash @samp{\} character. For example @samp{\\} representsone backslash: the first @code{\} is an escape which tells@code{@value{AS}} to interpret the second character literally as a backslash(which prevents @code{@value{AS}} from recognizing the second @code{\} as anescape character). The complete list of escapes follows.@cindex escape codes, character@cindex character escape codes@table @kbd@c @item \a@c Mnemonic for ACKnowledge; for ASCII this is octal code 007.@c@cindex @code{\b} (backspace character)@cindex backspace (@code{\b})@item \bMnemonic for backspace; for ASCII this is octal code 010.@c @item \e@c Mnemonic for EOText; for ASCII this is octal code 004.@c@cindex @code{\f} (formfeed character)@cindex formfeed (@code{\f})@item \fMnemonic for FormFeed; for ASCII this is octal code 014.@cindex @code{\n} (newline character)@cindex newline (@code{\n})@item \nMnemonic for newline; for ASCII this is octal code 012.@c @item \p@c Mnemonic for prefix; for ASCII this is octal code 033, usually known as @code{escape}.@c@cindex @code{\r} (carriage return character)@cindex carriage return (@code{\r})@item \rMnemonic for carriage-Return; for ASCII this is octal code 015.@c @item \s@c Mnemonic for space; for ASCII this is octal code 040. Included for compliance with@c other assemblers.@c@cindex @code{\t} (tab)@cindex tab (@code{\t})@item \tMnemonic for horizontal Tab; for ASCII this is octal code 011.@c @item \v@c Mnemonic for Vertical tab; for ASCII this is octal code 013.@c @item \x @var{digit} @var{digit} @var{digit}@c A hexadecimal character code. The numeric code is 3 hexadecimal digits.@c@cindex @code{\@var{ddd}} (octal character code)@cindex octal character code (@code{\@var
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -