da65-4.html
来自「cc65 的编译器文档」· HTML 代码 · 共 257 行
HTML
257 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><HTML><HEAD> <META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20"> <TITLE>da65 Users Guide: Info File Format</TITLE> <LINK HREF="da65-5.html" REL=next> <LINK HREF="da65-3.html" REL=previous> <LINK HREF="da65.html#toc4" REL=contents></HEAD><BODY><A HREF="da65-5.html">Next</A><A HREF="da65-3.html">Previous</A><A HREF="da65.html#toc4">Contents</A><HR><H2><A NAME="infofile"></A> <A NAME="s4">4.</A> <A HREF="da65.html#toc4">Info File Format</A></H2><P>The info file contains lists of specifications grouped together. Each groupdirective has an identifying token and an attribute list enclosed in curlybraces. Attributes have a name followed by a value. The syntax of the valuedepends on the type of the attribute. String attributes are places in doublequotes, numeric attributes may be specified as decimal numbers or hexadecimalwith a leading dollar sign. There are also attributes where the attributevalue is a keyword, in this case the keyword is given as is (without quotes oranything). Each attribute is terminated by a semicolon.</P><P><BLOCKQUOTE><CODE><PRE> group-name { attribute1 attribute-value; attribute2 attribute-value; }</PRE></CODE></BLOCKQUOTE></P><H2><A NAME="ss4.1">4.1</A> <A HREF="da65.html#toc4.1">Comments</A></H2><P>Comments start with a hash mark (<CODE>#</CODE>) and extend from the position ofthe mark to the end of the current line. Hash marks inside of strings willof course <EM>not</EM> start a comment.</P><H2><A NAME="global-options"></A> <A NAME="ss4.2">4.2</A> <A HREF="da65.html#toc4.2">Specifying global options</A></H2><P>Global options may be specified in a group with the name <CODE>GLOBAL</CODE>. Thefollowing attributes are recognized:</P><P><DL><DT><B><CODE>COMMENTS</CODE></B><DD><P>This attribute may be used instead of the <CODE><A HREF="da65-2.html#option--comments">--comments</A></CODE> option on the command line. It takes a numericalparameter between 0 and 4. Higher values increase the amount of informationwritten to the output file in form of comments.</P><DT><B><CODE>CPU</CODE></B><DD><P>This attribute may be used instead of the <CODE><A HREF="da65-2.html#option--cpu">--cpu</A></CODE> option on the command line. It takes a string parameter.</P><DT><B><CODE>INPUTNAME</CODE></B><DD><P>The attribute is followed by a string value, which gives the name of theinput file to read. If it is present, the disassembler does not accept aninput file name on the command line.</P><DT><B><CODE>INPUTOFFS</CODE></B><DD><P>The attribute is followed by a numerical value that gives an offset intothe input file which is skipped before reading data. The attribute may beused to skip headers or unwanted code sections in the input file.</P><DT><B><CODE>INPUTSIZE</CODE></B><DD><P><CODE>INPUTSIZE</CODE> is followed by a numerical value that gives the amount ofdata to read from the input file. Data beyond <CODE>INPUTOFFS + INPUTSIZE</CODE>is ignored.</P><P><A NAME="OUTPUTNAME"></A> </P><DT><B><CODE>OUTPUTNAME</CODE></B><DD><P>The attribute is followed by string value, which gives the name of theoutput file to write. If it is present, specification of an output file onthe command line using the <CODE><A HREF="da65-2.html#option-o">-o</A></CODE> option isnot allowed.</P><P>The default is to use <CODE>stdout</CODE> for output, so without this attribute orthe corresponding command line option <CODE><A HREF="da65-2.html#option-o">-o</A></CODE>the output will go to the terminal.</P><DT><B><CODE>PAGELENGTH</CODE></B><DD><P>This attribute may be used instead of the <CODE><A HREF="da65-2.html#option--pagelength">--pagelength</A></CODE> option on the command line. It takes a numericalparameter. Using zero as page length (which is the default) means that nopages are generated.</P><DT><B><CODE>STARTADDR</CODE></B><DD><P>This attribute may be used instead of the <CODE><A HREF="da65-2.html#option--start-addr">--start-addr</A></CODE> option on the command line. It takes a numericalparameter. The default for the start address is $10000 minus the size ofthe input file (this assumes that the input file is a ROM that contains thereset and irq vectors).</P></DL></P><H2><A NAME="ss4.3">4.3</A> <A HREF="da65.html#toc4.3">Specifying Ranges</A></H2><P>The <CODE>RANGE</CODE> directive is used to give information about address ranges. Thefollowing attributes are recognized:</P><P><DL><DT><B><CODE>END</CODE></B><DD><P>This gives the end address of the range. The end address is inclusive, thatmeans, it is part of the range. Of course, it may not be smaller than thestart address.</P><DT><B><CODE>NAME</CODE></B><DD><P>This is a convenience attribute. It takes a string argument and will causethe disassembler to define a label for the start of the range with thegiven name. So a separate <CODE><A HREF="#infofile-label">LABEL</A></CODE>directive is not needed.</P><DT><B><CODE>START</CODE></B><DD><P>This gives the start address of the range.</P><DT><B><CODE>TYPE</CODE></B><DD><P>This attribute specifies the type of data within the range. The attributevalue is one of the following keywords:</P><P><DL><DT><B><CODE>ADDRTABLE</CODE></B><DD><P>The range consists of data and is disassembled as a table of words(16 bit values). The difference to the <CODE>WORDTABLE</CODE> type is thata label is defined for each entry in the table.</P><DT><B><CODE>BYTETABLE</CODE></B><DD><P>The range consists of data and is disassembled as a byte table.</P><DT><B><CODE>CODE</CODE></B><DD><P>The range consists of code.</P><DT><B><CODE>DBYTETABLE</CODE></B><DD><P>The range consists of data and is disassembled as a table of dbytes(double byte values, 16 bit values with the low byte containing themost significant byte of the 16 bit value).</P><DT><B><CODE>DWORDTABLE</CODE></B><DD><P>The range consists of data and is disassembled as a table of doublewords (32 bit values).</P><DT><B><CODE>RTSTABLE</CODE></B><DD><P>The range consists of data and is disassembled as a table of words (16 bitvalues). The values are interpreted as words that are pushed onto thestack and jump to it via <CODE>RTS</CODE>. This means that they contain<CODE>address-1</CODE> of a function, for which a label will get defined by thedisassembler.</P><DT><B><CODE>SKIP</CODE></B><DD><P>The range is simply ignored when generating the output file. Please notethat this means that reassembling the output file will <EM>not</EM> generatethe original file, not only because the missing piece in between, but alsobecause the following code will be located on wrong addresses. Outputgenerated with <CODE>SKIP</CODE> ranges will need manual rework.</P><DT><B><CODE>TEXTTABLE</CODE></B><DD><P>The range consists of readable text.</P><DT><B><CODE>WORDTABLE</CODE></B><DD><P>The range consists of data and is disassembled as a table of words(16 bit values).</P></DL></P></DL></P><H2><A NAME="infofile-label"></A> <A NAME="ss4.4">4.4</A> <A HREF="da65.html#toc4.4">Specifying Labels</A></H2><P>The <CODE>LABEL</CODE> directive is used to give names for labels in the disassembledcode. The following attributes are recognized:</P><P><DL><DT><B><CODE>ADDR</CODE></B><DD><P>Followed by a numerical value. Specifies the value of the label.</P><DT><B><CODE>NAME</CODE></B><DD><P>The attribute is followed by a string value which gives the name of thelabel.</P><DT><B><CODE>SIZE</CODE></B><DD><P>This attribute is optional and may be used to specifiy the size of the datathat follows. If a size greater than 1 is specified, the disassembler willcreate labels in the form <CODE>label+offs</CODE> for all bytes within the givenrange, where <CODE>label</CODE> is the label name given with the <CODE>NAME</CODE>attribute, and <CODE>offs</CODE> is the offset within the data.</P></DL></P><H2><A NAME="ss4.5">4.5</A> <A HREF="da65.html#toc4.5">An Info File Example</A></H2><P>The following is a short example for an info file that contains most of thedirectives explained above:</P><P><BLOCKQUOTE><CODE><PRE> # This is a comment. It extends to the end of the line GLOBAL { OUTPUTNAME "kernal.s"; INPUTNAME "kernal.bin"; STARTADDR $E000; PAGELENGTH 0; # No paging CPU "6502"; }; RANGE { START $E612; END $E631; TYPE Code; }; RANGE { START $E632; END $E640; TYPE ByteTable; }; RANGE { START $EA51; END $EA84; TYPE RtsTable; }; RANGE { START $EC6C; END $ECAB; TYPE RtsTable; }; RANGE { START $ED08; END $ED11; TYPE AddrTable; }; # Zero page variables LABEL { NAME "fnadr"; ADDR $90; SIZE 3; }; LABEL { NAME "sal"; ADDR $93; }; LABEL { NAME "sah"; ADDR $94; }; LABEL { NAME "sas"; ADDR $95; }; # Stack LABEL { NAME "stack"; ADDR $100; SIZE 255; }; # Indirect vectors LABEL { NAME "cinv"; ADDR $300; SIZE 2; }; # IRQ LABEL { NAME "cbinv"; ADDR $302; SIZE 2; }; # BRK LABEL { NAME "nminv"; ADDR $304; SIZE 2; }; # NMI # Jump table at end of kernal ROM LABEL { NAME "kscrorg"; ADDR $FFED; }; LABEL { NAME "kplot"; ADDR $FFF0; }; LABEL { NAME "kiobase"; ADDR $FFF3; }; LABEL { NAME "kgbye"; ADDR $FFF6; }; # Hardware vectors LABEL { NAME "hanmi"; ADDR $FFFA; }; LABEL { NAME "hares"; ADDR $FFFC; }; LABEL { NAME "hairq"; ADDR $FFFE; };</PRE></CODE></BLOCKQUOTE></P><HR><A HREF="da65-5.html">Next</A><A HREF="da65-3.html">Previous</A><A HREF="da65.html#toc4">Contents</A></BODY></HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?