Viitor_cc65/usr/share/doc/cc65/webdoc/da65-4.html
kueller 223cc6685e Neue Version V963
git-svn-id: svn://svn.compuextreme.de/Viitor/V963/Viitor_cc65@5933 504e572c-2e33-0410-9681-be2bf7408885
2011-01-03 10:48:06 +00:00

316 lines
12 KiB
HTML

<!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 group
directive has an identifying token and an attribute list enclosed in curly
braces. Attributes have a name followed by a value. The syntax of the value
depends on the type of the attribute. String attributes are places in double
quotes, numeric attributes may be specified as decimal numbers or hexadecimal
with a leading dollar sign. There are also attributes where the attribute
value is a keyword, in this case the keyword is given as is (without quotes or
anything). 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 of
the mark to the end of the current line. Hash marks inside of strings will
of 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>. The
following 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 numerical
parameter between 0 and 4. Higher values increase the amount of information
written 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 the
input file to read. If it is present, the disassembler does not accept an
input 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 into
the input file which is skipped before reading data. The attribute may be
used 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 of
data 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 the
output file to write. If it is present, specification of an output file on
the command line using the <CODE>
<A HREF="da65-2.html#option-o">-o</A></CODE> option is
not allowed.</P>
<P>The default is to use <CODE>stdout</CODE> for output, so without this attribute or
the 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 numerical
parameter. Using zero as page length (which is the default) means that no
pages 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 numerical
parameter. The default for the start address is $10000 minus the size of
the input file (this assumes that the input file is a ROM that contains the
reset 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. The
following attributes are recognized:</P>
<P>
<DL>
<DT><B><CODE>COMMENT</CODE></B><DD><P>This attribute is only allowed if a label is also given. It takes a string
as argument. See the description of the <CODE>
<A HREF="#infofile-label">LABEL</A></CODE> directive for an explanation.</P>
<DT><B><CODE>END</CODE></B><DD><P>This gives the end address of the range. The end address is inclusive, that
means, it is part of the range. Of course, it may not be smaller than the
start address.</P>
<DT><B><CODE>NAME</CODE></B><DD><P>This is a convenience attribute. It takes a string argument and will cause
the disassembler to define a label for the start of the range with the
given 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 attribute
value 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 that
a 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 the
most 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 double
words (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 bit
values). The values are interpreted as words that are pushed onto the
stack 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 the
disassembler.</P>
<DT><B><CODE>SKIP</CODE></B><DD><P>The range is simply ignored when generating the output file. Please note
that this means that reassembling the output file will <EM>not</EM> generate
the original file, not only because the missing piece in between, but also
because the following code will be located on wrong addresses. Output
generated 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 disassembled
code. 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>COMMENT</CODE></B><DD><P>Attribute argument is a string. The comment will show up in a separate line
before the label, if the label is within code or data range, or after the
label if it is outside.</P>
<P>Example output:</P>
<P>
<BLOCKQUOTE><CODE>
<PRE>
foo := $0001 ; Comment for label named "foo"
; Comment for label named "bar"
bar:
</PRE>
</CODE></BLOCKQUOTE>
</P>
<DT><B><CODE>NAME</CODE></B><DD><P>The attribute is followed by a string value which gives the name of the
label.</P>
<DT><B><CODE>SIZE</CODE></B><DD><P>This attribute is optional and may be used to specify the size of the data
that follows. If a size greater than 1 is specified, the disassembler will
create labels in the form <CODE>label+offs</CODE> for all bytes within the given
range, 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="infofile-asminc"></A> <A NAME="ss4.5">4.5</A> <A HREF="da65.html#toc4.5">Specifying Assembler Includes</A>
</H2>
<P>The <CODE>ASMINC</CODE> directive is used to give the names of input files containing
symbol assignments in assembler syntax:</P>
<P>
<BLOCKQUOTE><CODE>
<PRE>
Name = value
Name := value
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>The usual conventions apply for symbol names. Values may be specified as hex
(leading $), binary (leading %) or decimal. The values may optionally
be signed.</P>
<P>NOTE: The include file parser is very simple. Expressions are not allowed, and
anything but symbol assignments is flagged as an error (but see the
<CODE>IGNOREUNKNOWN</CODE> directive below).</P>
<P>The following attributes are recognized:</P>
<P>
<DL>
<DT><B><CODE>FILE</CODE></B><DD><P>Followed by a string value. Specifies the name of the file to read.</P>
<DT><B><CODE>COMMENTSTART</CODE></B><DD><P>The optional attribute is followed by a character constant. It specifies the
character that starts a comment. The default value is a semicolon. This
value is ignored if <CODE>IGNOREUNKNOWN</CODE> is true.</P>
<DT><B><CODE>IGNOREUNKNOWN</CODE></B><DD><P>This attribute is optional and is followed by a boolean value. It allows to
ignore input lines that don't have a valid syntax. This allows to read in
assembler include files that contain more than just symbol assignments.
Note: When this attribute is used, the disassembler will ignore any errors
in the given include file. This may have undesired side effects.</P>
</DL>
</P>
<H2><A NAME="ss4.6">4.6</A> <A HREF="da65.html#toc4.6">An Info File Example</A>
</H2>
<P>The following is a short example for an info file that contains most of the
directives 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>