Files
oldlinux-files/Ref-docs/manual as/as_13.html
2024-02-19 00:21:47 -05:00

243 lines
6.3 KiB
HTML

<HTML>
<HEAD>
<!-- This HTML file has been created by texi2html 1.52
from ../texi/as.texinfo on 24 April 1999 -->
<TITLE>Using as - H8/300 Dependent Features</TITLE>
</HEAD>
<BODY>
Go to the <A HREF="as_1.html">first</A>, <A HREF="as_12.html">previous</A>, <A HREF="as_14.html">next</A>, <A HREF="as_27.html">last</A> section, <A HREF="as_toc.html">table of contents</A>.
<P><HR><P>
<H1><A NAME="SEC171" HREF="as_toc.html#TOC171">H8/300 Dependent Features</A></H1>
<P>
<A NAME="IDX520"></A>
</P>
<H2><A NAME="SEC172" HREF="as_toc.html#TOC172">Options</A></H2>
<P>
<A NAME="IDX521"></A>
<A NAME="IDX522"></A>
<CODE>as</CODE> has no additional command-line options for the Hitachi
H8/300 family.
</P>
<H2><A NAME="SEC173" HREF="as_toc.html#TOC173">Syntax</A></H2>
<H3><A NAME="SEC174" HREF="as_toc.html#TOC174">Special Characters</A></H3>
<P>
<A NAME="IDX523"></A>
<A NAME="IDX524"></A>
<SAMP>`;'</SAMP> is the line comment character.
</P>
<P>
<A NAME="IDX525"></A>
<A NAME="IDX526"></A>
<A NAME="IDX527"></A>
<SAMP>`$'</SAMP> can be used instead of a newline to separate statements.
Therefore <EM>you may not use <SAMP>`$'</SAMP> in symbol names</EM> on the H8/300.
</P>
<H3><A NAME="SEC175" HREF="as_toc.html#TOC175">Register Names</A></H3>
<P>
<A NAME="IDX528"></A>
<A NAME="IDX529"></A>
You can use predefined symbols of the form <SAMP>`r<VAR>n</VAR>h'</SAMP> and
<SAMP>`r<VAR>n</VAR>l'</SAMP> to refer to the H8/300 registers as sixteen 8-bit
general-purpose registers. <VAR>n</VAR> is a digit from <SAMP>`0'</SAMP> to
<SAMP>`7'</SAMP>); for instance, both <SAMP>`r0h'</SAMP> and <SAMP>`r7l'</SAMP> are valid
register names.
</P>
<P>
You can also use the eight predefined symbols <SAMP>`r<VAR>n</VAR>'</SAMP> to refer
to the H8/300 registers as 16-bit registers (you must use this form for
addressing).
</P>
<P>
On the H8/300H, you can also use the eight predefined symbols
<SAMP>`er<VAR>n</VAR>'</SAMP> (<SAMP>`er0'</SAMP> ... <SAMP>`er7'</SAMP>) to refer to the 32-bit
general purpose registers.
</P>
<P>
The two control registers are called <CODE>pc</CODE> (program counter; a
16-bit register, except on the H8/300H where it is 24 bits) and
<CODE>ccr</CODE> (condition code register; an 8-bit register). <CODE>r7</CODE> is
used as the stack pointer, and can also be called <CODE>sp</CODE>.
</P>
<H3><A NAME="SEC176" HREF="as_toc.html#TOC176">Addressing Modes</A></H3>
<P>
<A NAME="IDX530"></A>
<A NAME="IDX531"></A>
as understands the following addressing modes for the H8/300:
<DL COMPACT>
<DT><CODE>r<VAR>n</VAR></CODE>
<DD>
Register direct
<DT><CODE>@r<VAR>n</VAR></CODE>
<DD>
Register indirect
<DT><CODE>@(<VAR>d</VAR>, r<VAR>n</VAR>)</CODE>
<DD>
<DT><CODE>@(<VAR>d</VAR>:16, r<VAR>n</VAR>)</CODE>
<DD>
<DT><CODE>@(<VAR>d</VAR>:24, r<VAR>n</VAR>)</CODE>
<DD>
Register indirect: 16-bit or 24-bit displacement <VAR>d</VAR> from register
<VAR>n</VAR>. (24-bit displacements are only meaningful on the H8/300H.)
<DT><CODE>@r<VAR>n</VAR>+</CODE>
<DD>
Register indirect with post-increment
<DT><CODE>@-r<VAR>n</VAR></CODE>
<DD>
Register indirect with pre-decrement
<DT><CODE><CODE>@</CODE><VAR>aa</VAR></CODE>
<DD>
<DT><CODE><CODE>@</CODE><VAR>aa</VAR>:8</CODE>
<DD>
<DT><CODE><CODE>@</CODE><VAR>aa</VAR>:16</CODE>
<DD>
<DT><CODE><CODE>@</CODE><VAR>aa</VAR>:24</CODE>
<DD>
Absolute address <CODE>aa</CODE>. (The address size <SAMP>`:24'</SAMP> only makes
sense on the H8/300H.)
<DT><CODE>#<VAR>xx</VAR></CODE>
<DD>
<DT><CODE>#<VAR>xx</VAR>:8</CODE>
<DD>
<DT><CODE>#<VAR>xx</VAR>:16</CODE>
<DD>
<DT><CODE>#<VAR>xx</VAR>:32</CODE>
<DD>
Immediate data <VAR>xx</VAR>. You may specify the <SAMP>`:8'</SAMP>, <SAMP>`:16'</SAMP>, or
<SAMP>`:32'</SAMP> for clarity, if you wish; but <CODE>as</CODE> neither
requires this nor uses it--the data size required is taken from
context.
<DT><CODE><CODE>@</CODE><CODE>@</CODE><VAR>aa</VAR></CODE>
<DD>
<DT><CODE><CODE>@</CODE><CODE>@</CODE><VAR>aa</VAR>:8</CODE>
<DD>
Memory indirect. You may specify the <SAMP>`:8'</SAMP> for clarity, if you
wish; but <CODE>as</CODE> neither requires this nor uses it.
</DL>
<H2><A NAME="SEC177" HREF="as_toc.html#TOC177">Floating Point</A></H2>
<P>
<A NAME="IDX532"></A>
<A NAME="IDX533"></A>
The H8/300 family has no hardware floating point, but the <CODE>.float</CODE>
directive generates IEEE floating-point numbers for compatibility
with other development tools.
</P>
<H2><A NAME="SEC178" HREF="as_toc.html#TOC178">H8/300 Machine Directives</A></H2>
<P>
<A NAME="IDX534"></A>
<A NAME="IDX535"></A>
<A NAME="IDX536"></A>
<A NAME="IDX537"></A>
<CODE>as</CODE> has only one machine-dependent directive for the
H8/300:
</P>
<DL COMPACT>
<DT><CODE>.h8300h</CODE>
<DD>
<A NAME="IDX538"></A>
Recognize and emit additional instructions for the H8/300H variant, and
also make <CODE>.int</CODE> emit 32-bit numbers rather than the usual (16-bit)
for the H8/300 family.
</DL>
<P>
On the H8/300 family (including the H8/300H) <SAMP>`.word'</SAMP> directives
generate 16-bit numbers.
</P>
<H2><A NAME="SEC179" HREF="as_toc.html#TOC179">Opcodes</A></H2>
<P>
<A NAME="IDX539"></A>
<A NAME="IDX540"></A>
<A NAME="IDX541"></A>
<A NAME="IDX542"></A>
For detailed information on the H8/300 machine instruction set, see
<CITE>H8/300 Series Programming Manual</CITE> (Hitachi ADE--602--025). For
information specific to the H8/300H, see <CITE>H8/300H Series
Programming Manual</CITE> (Hitachi).
</P>
<P>
<CODE>as</CODE> implements all the standard H8/300 opcodes. No additional
pseudo-instructions are needed on this family.
</P>
<P>
<A NAME="IDX543"></A>
<A NAME="IDX544"></A>
Four H8/300 instructions (<CODE>add</CODE>, <CODE>cmp</CODE>, <CODE>mov</CODE>,
<CODE>sub</CODE>) are defined with variants using the suffixes <SAMP>`.b'</SAMP>,
<SAMP>`.w'</SAMP>, and <SAMP>`.l'</SAMP> to specify the size of a memory operand.
<CODE>as</CODE> supports these suffixes, but does not require them;
since one of the operands is always a register, <CODE>as</CODE> can
deduce the correct size.
</P>
<P>
For example, since <CODE>r0</CODE> refers to a 16-bit register,
<PRE>
mov r0,@foo
is equivalent to
mov.w r0,@foo
</PRE>
<P>
If you use the size suffixes, <CODE>as</CODE> issues a warning when
the suffix and the register size do not match.
</P>
<P><HR><P>
Go to the <A HREF="as_1.html">first</A>, <A HREF="as_12.html">previous</A>, <A HREF="as_14.html">next</A>, <A HREF="as_27.html">last</A> section, <A HREF="as_toc.html">table of contents</A>.
</BODY>
</HTML>