📄 gasp.html
字号:
<H3><A NAME="SEC10" HREF="gasp_toc.html#TOC10">Uninitialized data</A></H3><P>Use the <CODE>.RES</CODE>, <CODE>.SRES</CODE>, <CODE>.SRESC</CODE>, and <CODE>.SRESZ</CODE>directives to reserve memory and leave it uninitialized. GASPresolves these directives to appropriate calls of the GNU<CODE>as</CODE> <CODE>.space</CODE> directive.</P><DL COMPACT><DT><CODE>.RES <VAR>count</VAR></CODE><DD><A NAME="IDX74"></A><DT><CODE>.RES.B <VAR>count</VAR></CODE><DD><A NAME="IDX75"></A><DT><CODE>.RES.W <VAR>count</VAR></CODE><DD><A NAME="IDX76"></A><DT><CODE>.RES.L <VAR>count</VAR></CODE><DD><A NAME="IDX77"></A>Reserve room for <VAR>count</VAR> uninitialized elements of data. Thesuffix specifies the size of each element: <CODE>.RES.B</CODE> reserves<VAR>count</VAR> bytes, <CODE>.RES.W</CODE> reserves <VAR>count</VAR> pairs of bytes,and <CODE>.RES.L</CODE> reserves <VAR>count</VAR> quartets. <CODE>.RES</CODE> without asuffix is equivalent to <CODE>.RES.L</CODE>.<DT><CODE>.SRES <VAR>count</VAR></CODE><DD><A NAME="IDX78"></A><DT><CODE>.SRES.B <VAR>count</VAR></CODE><DD><A NAME="IDX79"></A><DT><CODE>.SRES.W <VAR>count</VAR></CODE><DD><A NAME="IDX80"></A><DT><CODE>.SRES.L <VAR>count</VAR></CODE><DD><A NAME="IDX81"></A><CODE>.SRES</CODE> is a synonym for <SAMP>`.RES'</SAMP>.<DT><CODE>.SRESC <VAR>count</VAR></CODE><DD><A NAME="IDX82"></A><DT><CODE>.SRESC.B <VAR>count</VAR></CODE><DD><A NAME="IDX83"></A><DT><CODE>.SRESC.W <VAR>count</VAR></CODE><DD><A NAME="IDX84"></A><DT><CODE>.SRESC.L <VAR>count</VAR></CODE><DD><A NAME="IDX85"></A>Like <CODE>.SRES</CODE>, but reserves space for <CODE><VAR>count</VAR>+1</CODE> elements.<DT><CODE>.SRESZ <VAR>count</VAR></CODE><DD><A NAME="IDX86"></A><DT><CODE>.SRESZ.B <VAR>count</VAR></CODE><DD><A NAME="IDX87"></A><DT><CODE>.SRESZ.W <VAR>count</VAR></CODE><DD><A NAME="IDX88"></A><DT><CODE>.SRESZ.L <VAR>count</VAR></CODE><DD><A NAME="IDX89"></A>Like <CODE>.SRES</CODE>, but reserves space for <CODE><VAR>count</VAR>+1</CODE> elements.</DL><H2><A NAME="SEC11" HREF="gasp_toc.html#TOC11">Assembly listing control</A></H2><P>The GASP listing-control directives correspond torelated GNU <CODE>as</CODE> directives.</P><DL COMPACT><DT><CODE>.PRINT LIST</CODE><DD><A NAME="IDX90"></A><DT><CODE>.PRINT NOLIST</CODE><DD><A NAME="IDX91"></A>Print control. This directive emits the GNU <CODE>as</CODE> directive<CODE>.list</CODE> or <CODE>.nolist</CODE>, according to its argument. See section `<CODE>.list</CODE>' in <CITE>Using as</CITE>, for details on how these directivesinteract.<DT><CODE>.FORM LIN=<VAR>ln</VAR></CODE><DD><A NAME="IDX92"></A><DT><CODE>.FORM COL=<VAR>cols</VAR></CODE><DD><A NAME="IDX93"></A><DT><CODE>.FORM LIN=<VAR>ln</VAR> COL=<VAR>cols</VAR></CODE><DD><A NAME="IDX94"></A>Specify the page size for assembly listings: <VAR>ln</VAR> represents thenumber of lines, and <VAR>cols</VAR> the number of columns. You may specifyeither page dimension independently, or both together. If you do notspecify the number of lines, GASP assumes 60 lines; if you do notspecify the number of columns, GASP assumes 132 columns.(Any values you may have specified in previous instances of <CODE>.FORM</CODE>do <EM>not</EM> carry over as defaults.) Emits the <CODE>.psize</CODE>assembler directive.<DT><CODE>.HEADING <VAR>string</VAR></CODE><DD><A NAME="IDX95"></A>Specify <VAR>string</VAR> as the title of your assembly listings. Emits<SAMP>`.title "<VAR>string</VAR>"'</SAMP>.<DT><CODE>.PAGE</CODE><DD><A NAME="IDX96"></A>Force a new page in assembly listings. Emits <SAMP>`.eject'</SAMP>.</DL><H2><A NAME="SEC12" HREF="gasp_toc.html#TOC12">Miscellaneous commands</A></H2><DL COMPACT><DT><CODE>.ALTERNATE</CODE><DD><A NAME="IDX97"></A>Use the alternate macro syntax henceforth in the assembly.See section <A HREF="gasp.html#SEC19">Alternate macro syntax</A>.<DT><CODE>.ORG</CODE><DD><A NAME="IDX98"></A>This command is recognized, but not yet implemented. GASPgenerates an error message for programs that use <CODE>.ORG</CODE>.<DT><CODE>.RADIX <VAR>s</VAR></CODE><DD><A NAME="IDX99"></A>GASP understands numbers in any of base two, eight, ten, orsixteen. You can encode the base explicitly in any numeric constant(see section <A HREF="gasp.html#SEC15">String and numeric constants</A>). If you writenumbers without an explicit indication of the base, the most recent<SAMP>`.RADIX <VAR>s</VAR>'</SAMP> command determines how they are interpreted.<VAR>s</VAR> is a single letter, one of the following:<DL COMPACT><DT><CODE>.RADIX B</CODE><DD>Base 2.<DT><CODE>.RADIX Q</CODE><DD>Base 8.<DT><CODE>.RADIX D</CODE><DD>Base 10. This is the original default radix.<DT><CODE>.RADIX H</CODE><DD>Base 16.</DL>You may specify the argument <VAR>s</VAR> in lower case (any of <SAMP>`bqdh'</SAMP>)with the same effects.<DT><CODE>.EXPORT <VAR>name</VAR></CODE><DD><A NAME="IDX100"></A><DT><CODE>.GLOBAL <VAR>name</VAR></CODE><DD><A NAME="IDX101"></A>Declare <VAR>name</VAR> global (emits <SAMP>`.global <VAR>name</VAR>'</SAMP>). The twodirectives are synonymous.<DT><CODE>.PROGRAM</CODE><DD><A NAME="IDX102"></A>No effect: GASP accepts this directive, and silently ignores it.<DT><CODE>.END</CODE><DD><A NAME="IDX103"></A>Mark end of each preprocessor file. GASP issues a warning if itreaches end of file without seeing this command.<DT><CODE>.INCLUDE "<VAR>str</VAR>"</CODE><DD><A NAME="IDX104"></A>Preprocess the file named by <VAR>str</VAR>, as if its contents appearedwhere the <CODE>.INCLUDE</CODE> directive does. GASP imposes a maximumlimit of 30 stacked include files, as a sanity check.<DT><CODE>.ALIGN <VAR>size</VAR></CODE><DD><A NAME="IDX105"></A>Evaluate the absolute expression <VAR>size</VAR>, and emit the assemblyinstruction <SAMP>`.align <VAR>size</VAR>'</SAMP> using the result.</DL><H2><A NAME="SEC13" HREF="gasp_toc.html#TOC13">Details of the GASP syntax</A></H2><P>Since GASP is meant to work with assembly code, its statementsyntax has no surprises for the assembly programmer.</P><P><A NAME="IDX106"></A><EM>Whitespace</EM> (blanks or tabs; <EM>not</EM> newline) is partiallysignificant, in that it delimits up to three fields in a line. Theamount of whitespace does not matter; you may line up fields in separatelines if you wish, but GASP does not require that.</P><P><A NAME="IDX107"></A><A NAME="IDX108"></A>The <EM>first field</EM>, an optional <EM>label</EM>, must be flush left in aline (with no leading whitespace) if it appears at all. You may use acolon after the label if you wish; GASP neither requires the colonnor objects to it (but will not include it as part of the label name).</P><P><A NAME="IDX109"></A>The <EM>second field</EM>, which must appear after some whitespace,contains a GASP or assembly <EM>directive</EM>.</P><P><A NAME="IDX110"></A>Any <EM>further fields</EM> on a line are <EM>arguments</EM> to thedirective; you can separate them from one another using either commas orwhitespace.</P><H3><A NAME="SEC14" HREF="gasp_toc.html#TOC14">Special syntactic markers</A></H3><P>GASP recognizes a few special markers: to delimit comments, tocontinue a statement on the next line, to separate symbols from othercharacters, and to copy text to the output literally. (One otherspecial marker, <SAMP>`\@'</SAMP>, works only within macro definitions;see section <A HREF="gasp.html#SEC7">Defining your own directives</A>.)</P><P><A NAME="IDX111"></A>The trailing part of any GASP source line may be a <EM>comment</EM>.A comment begins with the first unquoted comment character (<SAMP>`!'</SAMP> bydefault), or an escaped or doubled comment character (<SAMP>`\!'</SAMP> or<SAMP>`!!'</SAMP> by default), and extends to the end of a line. You canspecify what comment character to use with the <SAMP>`-c'</SAMP> option(see section <A HREF="gasp.html#SEC2">Command Line Options</A>). The two kinds ofcomment markers lead to slightly different treatment:</P><DL COMPACT><DT><CODE>!</CODE><DD>A single, un-escaped comment character generates an assembly comment inthe GASP output. GASP evaluates any preprocessor variables(macro arguments, or variables defined with <CODE>.ASSIGNA</CODE> or<CODE>.ASSIGNC</CODE>) present. For example, a macro that begins like this<PRE> .MACRO SUM FROM=0, TO=9 ! \FROM \TO</PRE>issues as the first line of output a comment that records thevalues you used to call the macro.<DT><CODE>\!</CODE><DD><DT><CODE>!!</CODE><DD>Either an escaped comment character, or a double comment character,marks a GASP source comment. GASP does not copy such commentsto the assembly output.</DL><P><A NAME="IDX112"></A><A NAME="IDX113"></A>To <EM>continue a statement</EM> on the next line of the file, begin thesecond line with the character <SAMP>`+'</SAMP>.</P><P><A NAME="IDX114"></A><A NAME="IDX115"></A><A NAME="IDX116"></A><A NAME="IDX117"></A>Occasionally you may want to prevent GASP from preprocessing someparticular bit of text. To <EM>copy literally</EM> from the GASPsource to its output, place <SAMP>`\('</SAMP> before the string to copy, and<SAMP>`)'</SAMP> at the end. For example, write <SAMP>`\(\!)'</SAMP> if you need thecharacters <SAMP>`\!'</SAMP> in your assembly output.</P><P><A NAME="IDX118"></A><A NAME="IDX119"></A><A NAME="IDX120"></A>To <EM>separate a preprocessor variable</EM> from text to appearimmediately after its value, write a single quote (<CODE>'</CODE>). Forexample, <SAMP>`.SDATA "\P'1"'</SAMP> writes a string built by concatenating thevalue of <CODE>P</CODE> and the digit <SAMP>`1'</SAMP>. (You cannot achieve this bywriting just <SAMP>`\P1'</SAMP>, since <SAMP>`P1'</SAMP> is itself a valid name for apreprocessor variable.)</P><H3><A NAME="SEC15" HREF="gasp_toc.html#TOC15">String and numeric constants</A></H3><P>There are two ways of writing <EM>string constants</EM> in GASP: asliteral text, and by numeric byte value. Specify a string literalbetween double quotes (<CODE>"<VAR>str</VAR>"</CODE>). Specify an individualnumeric byte value as an absolute expression between angle brackets(<CODE><<VAR>expr</VAR>></CODE>. Directives that output strings allow you tospecify any number of either kind of value, in whatever order isconvenient, and concatenate the result. (Alternate syntax modeintroduces a number of alternative string notations; see section <A HREF="gasp.html#SEC19">Alternate macro syntax</A>.)</P><P>You can write <EM>numeric constants</EM> either in a specific base, or inwhatever base is currently selected (either 10, or selected by the mostrecent <CODE>.RADIX</CODE>).</P><P>To write a number in a <EM>specific base</EM>, use the pattern<CODE><VAR>s</VAR>'<VAR>ddd</VAR></CODE>: a base specifier character <VAR>s</VAR>, followedby a single quote followed by digits <VAR>ddd</VAR>. The base specifiercharacter matches those you can specify with <CODE>.RADIX</CODE>: <SAMP>`B'</SAMP> forbase 2, <SAMP>`Q'</SAMP> for base 8, <SAMP>`D'</SAMP> for base 10, and <SAMP>`H'</SAMP> for base16. (You can write this character in lower case if you prefer.)</P><H3><A NAME="SEC16" HREF="gasp_toc.html#TOC16">Symbols</A></H3><P>GASP recognizes symbol names that start with any alphabetic character,<SAMP>`_'</SAMP>, or <SAMP>`$'</SAMP>, and continue with any of the same characters orwith digits. Label names follow the same rules.</P><H3><A NAME="SEC17" HREF="gasp_toc.html#TOC17">Arithmetic expressions in GASP</A></H3><P><A NAME="IDX121"></A><A NAME="IDX122"></A>There are two kinds of expressions, depending on their result:<EM>absolute</EM> expressions, which resolve to a constant (that is, theydo not involve any values unknown to GASP), and <EM>relocatable</EM>expressions, which must reduce to the form</P><PRE><VAR>addsym</VAR>+<VAR>const</VAR>-<VAR>subsym</VAR></PRE><P>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -