OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [binutils-2.18.50/] [gas/] [doc/] [c-z80.texi] - Diff between revs 38 and 156

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 38 Rev 156
@c This is part of the GAS manual.
@c This is part of the GAS manual.
@c For copying conditions, see the file as.texinfo.
@c For copying conditions, see the file as.texinfo.
 
 
@ifset GENERIC
@ifset GENERIC
@page
@page
@node Z80-Dependent
@node Z80-Dependent
@chapter Z80 Dependent Features
@chapter Z80 Dependent Features
@end ifset
@end ifset
 
 
 
 
@ifclear GENERIC
@ifclear GENERIC
@node Machine Dependencies
@node Machine Dependencies
@chapter Z80 Dependent Features
@chapter Z80 Dependent Features
@end ifclear
@end ifclear
 
 
@cindex Z80 support
@cindex Z80 support
@menu
@menu
* Z80 Options::              Options
* Z80 Options::              Options
* Z80 Syntax::               Syntax
* Z80 Syntax::               Syntax
* Z80 Floating Point::       Floating Point
* Z80 Floating Point::       Floating Point
* Z80 Directives::           Z80 Machine Directives
* Z80 Directives::           Z80 Machine Directives
* Z80 Opcodes::              Opcodes
* Z80 Opcodes::              Opcodes
@end menu
@end menu
 
 
@node Z80 Options
@node Z80 Options
@section Options
@section Options
@cindex Z80 options
@cindex Z80 options
@cindex options for Z80
@cindex options for Z80
The Zilog Z80 and Ascii R800 version of @code{@value{AS}} have a few machine
The Zilog Z80 and Ascii R800 version of @code{@value{AS}} have a few machine
dependent options.
dependent options.
@table @option
@table @option
@cindex @code{-z80} command line option, Z80
@cindex @code{-z80} command line option, Z80
@item -z80
@item -z80
Produce code for the Z80 processor. There are additional options to
Produce code for the Z80 processor. There are additional options to
request warnings and error messages for undocumented instructions.
request warnings and error messages for undocumented instructions.
@item  -ignore-undocumented-instructions
@item  -ignore-undocumented-instructions
@itemx -Wnud
@itemx -Wnud
Silently assemble undocumented Z80-instructions that have been adopted
Silently assemble undocumented Z80-instructions that have been adopted
as documented R800-instructions.
as documented R800-instructions.
@item  -ignore-unportable-instructions
@item  -ignore-unportable-instructions
@itemx -Wnup
@itemx -Wnup
Silently assemble all undocumented Z80-instructions.
Silently assemble all undocumented Z80-instructions.
@item  -warn-undocumented-instructions
@item  -warn-undocumented-instructions
@itemx -Wud
@itemx -Wud
Issue warnings for undocumented Z80-instructions that work on R800, do
Issue warnings for undocumented Z80-instructions that work on R800, do
not assemble other undocumented instructions without warning.
not assemble other undocumented instructions without warning.
@item  -warn-unportable-instructions
@item  -warn-unportable-instructions
@itemx -Wup
@itemx -Wup
Issue warnings for other undocumented Z80-instructions, do not treat any
Issue warnings for other undocumented Z80-instructions, do not treat any
undocumented instructions as errors.
undocumented instructions as errors.
@item  -forbid-undocumented-instructions
@item  -forbid-undocumented-instructions
@itemx -Fud
@itemx -Fud
Treat all undocumented z80-instructions as errors.
Treat all undocumented z80-instructions as errors.
@item  -forbid-unportable-instructions
@item  -forbid-unportable-instructions
@itemx -Fup
@itemx -Fup
Treat undocumented z80-instructions that do not work on R800 as errors.
Treat undocumented z80-instructions that do not work on R800 as errors.
 
 
@cindex @code{-r800} command line option, Z80
@cindex @code{-r800} command line option, Z80
@item -r800
@item -r800
Produce code for the R800 processor. The assembler does not support
Produce code for the R800 processor. The assembler does not support
undocumented instructions for the R800.
undocumented instructions for the R800.
In line with common practice, @code{@value{AS}} uses Z80 instruction names
In line with common practice, @code{@value{AS}} uses Z80 instruction names
for the R800 processor, as far as they exist.
for the R800 processor, as far as they exist.
@end table
@end table
 
 
@cindex Z80 Syntax
@cindex Z80 Syntax
@node Z80 Syntax
@node Z80 Syntax
@section Syntax
@section Syntax
The assembler syntax closely follows the 'Z80 family CPU User Manual' by
The assembler syntax closely follows the 'Z80 family CPU User Manual' by
Zilog.
Zilog.
In expressions a single @samp{=} may be used as ``is equal to''
In expressions a single @samp{=} may be used as ``is equal to''
comparison operator.
comparison operator.
 
 
Suffices can be used to indicate the radix of integer constants;
Suffices can be used to indicate the radix of integer constants;
@samp{H} or @samp{h} for hexadecimal, @samp{D} or @samp{d} for decimal,
@samp{H} or @samp{h} for hexadecimal, @samp{D} or @samp{d} for decimal,
@samp{Q}, @samp{O}, @samp{q} or @samp{o} for octal, and @samp{B} for
@samp{Q}, @samp{O}, @samp{q} or @samp{o} for octal, and @samp{B} for
binary.
binary.
 
 
The suffix @samp{b} denotes a backreference to local label.
The suffix @samp{b} denotes a backreference to local label.
 
 
@menu
@menu
* Z80-Chars::                Special Characters
* Z80-Chars::                Special Characters
* Z80-Regs::                 Register Names
* Z80-Regs::                 Register Names
* Z80-Case::                 Case Sensitivity
* Z80-Case::                 Case Sensitivity
@end menu
@end menu
 
 
@node Z80-Chars
@node Z80-Chars
@subsection Special Characters
@subsection Special Characters
 
 
@cindex line comment character, Z80
@cindex line comment character, Z80
@cindex Z80 line comment character
@cindex Z80 line comment character
The semicolon @samp{;} is the line comment character;
The semicolon @samp{;} is the line comment character;
 
 
@cindex location counter, Z80
@cindex location counter, Z80
@cindex hexadecimal prefix, Z80
@cindex hexadecimal prefix, Z80
@cindex Z80 $
@cindex Z80 $
The dollar sign @samp{$} can be used as a prefix for hexadecimal numbers
The dollar sign @samp{$} can be used as a prefix for hexadecimal numbers
and as a symbol denoting the current location counter.
and as a symbol denoting the current location counter.
 
 
@cindex character escapes, Z80
@cindex character escapes, Z80
@cindex Z80, \
@cindex Z80, \
A backslash @samp{\} is an ordinary character for the Z80 assembler.
A backslash @samp{\} is an ordinary character for the Z80 assembler.
 
 
@cindex character constant, Z80
@cindex character constant, Z80
@cindex single quote, Z80
@cindex single quote, Z80
@cindex Z80 '
@cindex Z80 '
The single quote @samp{'} must be followed by a closing quote. If there
The single quote @samp{'} must be followed by a closing quote. If there
is one character in between, it is a character constant, otherwise it is
is one character in between, it is a character constant, otherwise it is
a string constant.
a string constant.
 
 
@node Z80-Regs
@node Z80-Regs
@subsection Register Names
@subsection Register Names
@cindex Z80 registers
@cindex Z80 registers
@cindex register names, Z80
@cindex register names, Z80
 
 
The registers are referred to with the letters assigned to them by
The registers are referred to with the letters assigned to them by
Zilog. In addition @command{@value{AS}} recognizes @samp{ixl} and
Zilog. In addition @command{@value{AS}} recognizes @samp{ixl} and
@samp{ixh} as the least and most significant octet in @samp{ix}, and
@samp{ixh} as the least and most significant octet in @samp{ix}, and
similarly @samp{iyl} and  @samp{iyh} as parts of @samp{iy}.
similarly @samp{iyl} and  @samp{iyh} as parts of @samp{iy}.
 
 
@c The @samp{'} in @samp{ex af,af'} may be omitted.
@c The @samp{'} in @samp{ex af,af'} may be omitted.
 
 
@node Z80-Case
@node Z80-Case
@subsection Case Sensitivity
@subsection Case Sensitivity
@cindex Z80, case sensitivity
@cindex Z80, case sensitivity
@cindex case sensitivity, Z80
@cindex case sensitivity, Z80
 
 
Upper and lower case are equivalent in register names, opcodes,
Upper and lower case are equivalent in register names, opcodes,
condition codes  and assembler directives.
condition codes  and assembler directives.
The case of letters is significant in labels and symbol names. The case
The case of letters is significant in labels and symbol names. The case
is also important to distinguish the suffix @samp{b} for a backward reference
is also important to distinguish the suffix @samp{b} for a backward reference
to a local label from the suffix @samp{B} for a number in binary notation.
to a local label from the suffix @samp{B} for a number in binary notation.
 
 
@node Z80 Floating Point
@node Z80 Floating Point
@section Floating Point
@section Floating Point
@cindex floating point, Z80
@cindex floating point, Z80
@cindex Z80 floating point
@cindex Z80 floating point
Floating-point numbers are not supported.
Floating-point numbers are not supported.
 
 
@node Z80 Directives
@node Z80 Directives
@section Z80 Assembler Directives
@section Z80 Assembler Directives
 
 
@command{@value{AS}} for the Z80 supports some additional directives for
@command{@value{AS}} for the Z80 supports some additional directives for
compatibility with other assemblers.
compatibility with other assemblers.
 
 
@cindex Z80-only directives
@cindex Z80-only directives
These are the additional directives in @code{@value{AS}} for the Z80:
These are the additional directives in @code{@value{AS}} for the Z80:
 
 
@table @code
@table @code
@item db @var{expression}|@var{string}[,@var{expression}|@var{string}...]
@item db @var{expression}|@var{string}[,@var{expression}|@var{string}...]
@itemx defb @var{expression}|@var{string}[,@var{expression}|@var{string}...]
@itemx defb @var{expression}|@var{string}[,@var{expression}|@var{string}...]
For each @var{string} the characters are copied to the object file, for
For each @var{string} the characters are copied to the object file, for
each other @var{expression} the value is stored in one byte.
each other @var{expression} the value is stored in one byte.
A warning is issued in case of an overflow.
A warning is issued in case of an overflow.
 
 
@item dw @var{expression}[,@var{expression}...]
@item dw @var{expression}[,@var{expression}...]
@itemx defw @var{expression}[,@var{expression}...]
@itemx defw @var{expression}[,@var{expression}...]
For each @var{expression} the value is stored in two bytes, ignoring
For each @var{expression} the value is stored in two bytes, ignoring
overflow.
overflow.
 
 
@item d24 @var{expression}[,@var{expression}...]
@item d24 @var{expression}[,@var{expression}...]
@itemx def24 @var{expression}[,@var{expression}...]
@itemx def24 @var{expression}[,@var{expression}...]
For each @var{expression} the value is stored in three bytes, ignoring
For each @var{expression} the value is stored in three bytes, ignoring
overflow.
overflow.
 
 
@item d32 @var{expression}[,@var{expression}...]
@item d32 @var{expression}[,@var{expression}...]
@itemx def32 @var{expression}[,@var{expression}...]
@itemx def32 @var{expression}[,@var{expression}...]
For each @var{expression} the value is stored in four bytes, ignoring
For each @var{expression} the value is stored in four bytes, ignoring
overflow.
overflow.
 
 
@item ds @var{count}[, @var{value}]
@item ds @var{count}[, @var{value}]
@itemx defs @var{count}[, @var{value}]
@itemx defs @var{count}[, @var{value}]
@c Synonyms for @code{ds.b},
@c Synonyms for @code{ds.b},
@c which should have been described elsewhere
@c which should have been described elsewhere
Fill @var{count} bytes in the object file with @var{value}, if
Fill @var{count} bytes in the object file with @var{value}, if
@var{value} is omitted it defaults to zero.
@var{value} is omitted it defaults to zero.
 
 
@item @var{symbol} equ @var{expression}
@item @var{symbol} equ @var{expression}
@itemx @var{symbol} defl @var{expression}
@itemx @var{symbol} defl @var{expression}
These directives set the value of @var{symbol} to @var{expression}. If
These directives set the value of @var{symbol} to @var{expression}. If
@code{equ} is used, it is an error if @var{symbol} is already defined.
@code{equ} is used, it is an error if @var{symbol} is already defined.
Symbols defined with @code{equ} are not protected from redefinition.
Symbols defined with @code{equ} are not protected from redefinition.
 
 
@item set
@item set
This is a normal instruction on Z80, and not an assembler directive.
This is a normal instruction on Z80, and not an assembler directive.
 
 
@item psect @var{name}
@item psect @var{name}
A synonym for @xref{Section}, no second argument should be given.
A synonym for @xref{Section}, no second argument should be given.
@ignore
@ignore
 
 
The following attributes will possibly be recognized in the future
The following attributes will possibly be recognized in the future
@table @code
@table @code
@item abs
@item abs
The section is to be absolute. @code{@value{AS}} will issue an error
The section is to be absolute. @code{@value{AS}} will issue an error
message because it can not produce an absolute section.
message because it can not produce an absolute section.
@item global
@item global
The section is to be concatenated with other sections of the same name
The section is to be concatenated with other sections of the same name
by the linker, this is the default.
by the linker, this is the default.
@item local
@item local
The section is not global. @code{@value{AS}} will issue a warning if
The section is not global. @code{@value{AS}} will issue a warning if
object file format is not soff.
object file format is not soff.
@item ovrld
@item ovrld
The section is to be overlapped with other sections of the same name by
The section is to be overlapped with other sections of the same name by
the linker. @code{@value{AS}} will issue an error message
the linker. @code{@value{AS}} will issue an error message
because it can not mark a section as such.
because it can not mark a section as such.
@item pure
@item pure
The section is marked as read only.
The section is marked as read only.
@end table
@end table
@end ignore
@end ignore
 
 
@end table
@end table
 
 
@node Z80 Opcodes
@node Z80 Opcodes
@section Opcodes
@section Opcodes
In line with common practice, Z80 mnemonics are used for both the Z80 and
In line with common practice, Z80 mnemonics are used for both the Z80 and
the R800.
the R800.
 
 
In many instructions it is possible to use one of the half index
In many instructions it is possible to use one of the half index
registers (@samp{ixl},@samp{ixh},@samp{iyl},@samp{iyh}) in stead of an
registers (@samp{ixl},@samp{ixh},@samp{iyl},@samp{iyh}) in stead of an
8-bit general purpose register. This yields instructions that are
8-bit general purpose register. This yields instructions that are
documented on the R800 and undocumented on the Z80.
documented on the R800 and undocumented on the Z80.
Similarly @code{in f,(c)} is documented on the R800 and undocumented on
Similarly @code{in f,(c)} is documented on the R800 and undocumented on
the Z80.
the Z80.
 
 
The assembler also supports the following undocumented Z80-instructions,
The assembler also supports the following undocumented Z80-instructions,
that have not been adopted in the R800 instruction set:
that have not been adopted in the R800 instruction set:
@table @code
@table @code
@item out (c),0
@item out (c),0
Sends zero to the port pointed to by register c.
Sends zero to the port pointed to by register c.
 
 
@item sli @var{m}
@item sli @var{m}
Equivalent to @code{@var{m} = (@var{m}<<1)+1}, the operand @var{m} can
Equivalent to @code{@var{m} = (@var{m}<<1)+1}, the operand @var{m} can
be any operand that is valid for @samp{sla}. One can use @samp{sll} as a
be any operand that is valid for @samp{sla}. One can use @samp{sll} as a
synonym for @samp{sli}.
synonym for @samp{sli}.
 
 
@item @var{op} (ix+@var{d}), @var{r}
@item @var{op} (ix+@var{d}), @var{r}
This is equivalent to
This is equivalent to
 
 
@example
@example
ld @var{r}, (ix+@var{d})
ld @var{r}, (ix+@var{d})
@var{opc} @var{r}
@var{opc} @var{r}
ld (ix+@var{d}), @var{r}
ld (ix+@var{d}), @var{r}
@end example
@end example
 
 
The operation @samp{@var{opc}} may be any of @samp{res @var{b},},
The operation @samp{@var{opc}} may be any of @samp{res @var{b},},
@samp{set @var{b},}, @samp{rl}, @samp{rlc}, @samp{rr}, @samp{rrc},
@samp{set @var{b},}, @samp{rl}, @samp{rlc}, @samp{rr}, @samp{rrc},
@samp{sla}, @samp{sli}, @samp{sra} and @samp{srl}, and the register
@samp{sla}, @samp{sli}, @samp{sra} and @samp{srl}, and the register
@samp{@var{r}} may be any of @samp{a}, @samp{b}, @samp{c}, @samp{d},
@samp{@var{r}} may be any of @samp{a}, @samp{b}, @samp{c}, @samp{d},
@samp{e}, @samp{h} and @samp{l}.
@samp{e}, @samp{h} and @samp{l}.
 
 
@item @var{opc} (iy+@var{d}), @var{r}
@item @var{opc} (iy+@var{d}), @var{r}
As above, but with @samp{iy} instead of @samp{ix}.
As above, but with @samp{iy} instead of @samp{ix}.
@end table
@end table
 
 
The web site at @uref{http://www.z80.info} is a good starting place to
The web site at @uref{http://www.z80.info} is a good starting place to
find more information on programming the Z80.
find more information on programming the Z80.
 
 
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.