OpenCores
URL https://opencores.org/ocsvn/a-z80/a-z80/trunk

Subversion Repositories a-z80

[/] [a-z80/] [trunk/] [tools/] [zmac/] [zmac.html] - Diff between revs 3 and 21

Show entire file | Details | Blame | View Log

Rev 3 Rev 21
Line 1... Line 1...
<H3>Overview of zmac</H3>
<H3>Overview of zmac</H3>
zmac is a Z-80 macro cross-assembler. It has all the features you'd
zmac is a Z-80 macro cross-assembler. It has all the features you'd
expect. It assembles the specified input file (with a '.z' extension
expect. It assembles the specified input file (with a '.z' extension
if there is no pre-existing extension and the file as given doesn't
if there is no pre-existing extension and the file as given doesn't
exist) and produces program output in many <A HREF="#format">different formats</A>.
exist) and produces program output in many different <A HREF="#format">formats</A>.
It also produces a nicely-formatted
It also produces a nicely-formatted
listing of the machine code and cycle counts alongside the source
listing of the machine code and cycle counts alongside the source
in a ".lst" file.
in a ".lst" file.
<P>
<P>
To reduce clutter and command line options, all zmac output is put
To reduce clutter and command line option usage, by default all zmac output is put
into an (auto-created) <TT>zout</TT> subdirectory.  For <TT>file.z</TT> the listing
into an (auto-created) <TT>zout</TT> subdirectory.  For <TT>file.z</TT> the listing
will be in <TT>zout/file.lst</TT>, the TRS-80 executable format in <TT>zout/file.cmd</TT>
will be in <TT>zout/file.lst</TT>, the TRS-80 executable format in <TT>zout/file.cmd</TT>
and so on.
and so on.  For more friendly usage in make files and integrated development
 
environments the <TT>-o</TT>, <TT>--oo</TT>, <TT>--xo</TT> and <TT>--xd</TT> options may be used to select
 
sepcific output file formats and where they are written.
<P>
<P>
<A HREF="#undoc">Undocumented</A> Z-80 instructions are supported as well as 8080 code.
<A HREF="#undoc">Undocumented</A> Z-80 instructions are supported as well as 8080 code.
<P>
<P>
zmac strives to be a powerful assembler with expressions familiar to C
zmac strives to be a powerful assembler with expressions familiar to C
programmers while providing good backward compatibility with original
programmers while providing good backward compatibility with original
Line 22... Line 24...
zmac
zmac
[ --help ]
[ --help ]
[ --version ]
[ --version ]
[ --dep ]
[ --dep ]
[ --mras ]
[ --mras ]
 
[ --od dir ]
 
[ --oo sfx1,sfx2 ]
 
[ --xo sfx1,sfx2 ]
[ --rel ]
[ --rel ]
 
[ --rel7 ]
[ --doc ]
[ --doc ]
[ --zmac ]
[ --zmac ]
[ -8bcefghijJlLmnopstz ]
[ -8bcefghijJlLmnopstz ]
[ filename[.z] ]
[ filename[.z] ]
<P>
<P>
<H3>Options</H3>
<H3>Options</H3>
<P>
<P>
<TABLE>
<TABLE>
<TR><TD VALIGN="TOP"><PRE>--help </PRE></TD><TD>Display a list of options and a terse description of what the options do. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>--help </PRE></TD><TD>Display a list of options and a terse description of what the options do. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>--version </PRE></TD><TD>Print zmac version name. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>--version </PRE></TD><TD>Print zmac version name. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>--mras </PRE></TD><TD>MRAS compatibility mode.  Any <TT>?</TT> in a label will be expanded to the current module identifier as set by <TT>*mod</TT>. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>--mras </PRE></TD><TD>MRAS compatibility mode.  Any <TT>?</TT> in a label will be expanded to the current module identifier as set by <TT>*mod</TT>. Operator <A HREF="#mrasord">precedence</A> and results are changed. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>--rel </PRE></TD><TD>Output ".rel" (relocatable object file) format only. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>--od dir </PRE></TD><TD>Place output files in <TT>dir</TT> instead of the default "zout" subdirectory. Creates <TT>dir</TT> if necessary. </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE>--oo hex,cmd </PRE></TD><TD>Output only the the file types by suffix.  Multiple --oo arguments may be used.  "--oo lst,cas" is equivalent to "--oo lst --oo cas". See "Output Formats" for a list of output types by <A HREF="#format">suffix</A>. </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE>--xo tap,wav </PRE></TD><TD>Do not output the file type types listed by suffix.  </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE>--rel </PRE></TD><TD>Output ".rel" (relocatable object file) format only.  Exported symbols are truncated to length 6. </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE>--rel7 </PRE></TD><TD>Output ".rel" (relocatable object file) format only.  Exported symbols are truncated to length 7. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>--zmac </PRE></TD><TD>zmac compatibility mode.  <TT>defl</TT> labels are undefined after each pass. Quotes and double quotes are stripped from macro arguments before expansion. <TT>$</TT> is ignored in identifiers allowing <TT>foo$bar</TT> to construct identifiers in macro expansions.  Use <TT>`</TT> (backquote) instead in normal mode.  Labels starting with <TT>"."</TT> are temporary and are reset whenever a non-temporary label is defined (thus they may be reused).  Labels starting with <TT>"_"</TT> are local to their file thus avoid multiple definition when brought in with <TT>include</TT>. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>--zmac </PRE></TD><TD>zmac compatibility mode.  <TT>defl</TT> labels are undefined after each pass. Quotes and double quotes are stripped from macro arguments before expansion. <TT>$</TT> is ignored in identifiers allowing <TT>foo$bar</TT> to construct identifiers in macro expansions.  Use <TT>`</TT> (backquote) instead in normal mode.  Labels starting with <TT>"."</TT> are temporary and are reset whenever a non-temporary label is defined (thus they may be reused).  Labels starting with <TT>"_"</TT> are local to their file thus avoid multiple definition when brought in with <TT>include</TT>. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>--dep </PRE></TD><TD>Print all files read by <TT>include</TT> and <TT>incbin</TT>. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>--dep </PRE></TD><TD>Print all files read by <TT>include</TT>, <TT>incbin</TT> and <TT>import</TT>. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>--doc </PRE></TD><TD>Print this documentation in HTML format to standard output. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>--doc </PRE></TD><TD>Print this documentation in HTML format to standard output. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-8 </PRE></TD><TD>Accept 8080 mnemonics preferentially.  Equivalent to <TT>.8080</TT> pseudo-op. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-Pk=number </PRE></TD><TD>Set <TT>@@k</TT> to the given numeric value before assembly.  Up to 10 parameters can be set from 0 though 9.  <TT>-Pk</TT> is shorthand for <TT>-Pk=-1</TT>. For example, <TT>P4=$123</TT> effectively puts <TT>@@4 equ $123</TT> at the top of the first file. </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE>-8 </PRE></TD><TD>Accept 8080 mnemonics preferentially and use 8080 instruction timings. Equivalent to <TT>.8080</TT> pseudo-op. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-b </PRE></TD><TD>Don't generate any machine code output at all. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-b </PRE></TD><TD>Don't generate any machine code output at all. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-c </PRE></TD><TD>Make the listing continuous, i.e., don't generate any page breaks or page headers. Can make things less confusing if you're going to consult the listing online rather than printing it.  This is the default. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-c </PRE></TD><TD>Don't display cycle counts in the listing. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-e </PRE></TD><TD>Omit the "error report" section in the listing. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-e </PRE></TD><TD>Omit the "error report" section in the listing. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-f </PRE></TD><TD>List instructions not assembled due to "<TT>if</TT>" expressions being false. (Normally these are not shown in the listing.) </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-f </PRE></TD><TD>List instructions not assembled due to "<TT>if</TT>" expressions being false. (Normally these are not shown in the listing.) </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-g </PRE></TD><TD>List only the first line of equivalent hex for a source line. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-g </PRE></TD><TD>List only the first line of equivalent hex for a source line. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-h </PRE></TD><TD>Display a list of options and a terse description of what the options do. (same as --help) </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-h </PRE></TD><TD>Display a list of options and a terse description of what the options do. (same as --help) </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-i </PRE></TD><TD>Don't list files included with <TT>include</TT> or <TT>read</TT>. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-i </PRE></TD><TD>Don't list files included with <TT>include</TT>, <TT>read</TT> or <TT>import</TT>. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-I dir </PRE></TD><TD>Add <TT>dir</TT> to the end of the include file search path. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-I dir </PRE></TD><TD>Add <TT>dir</TT> to the end of the include file search path. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-j </PRE></TD><TD>Promote relative jumps and <TT>DJNZ</TT> to absolute equivalents as needed. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-j </PRE></TD><TD>Promote relative jumps and <TT>DJNZ</TT> to absolute equivalents as needed. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-J </PRE></TD><TD>Error if an absolute jump could be replaced with a relative jump. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-J </PRE></TD><TD>Error if an absolute jump could be replaced with a relative jump. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-l </PRE></TD><TD>Don't generate a listing at all. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-l </PRE></TD><TD>List to standard output. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-L </PRE></TD><TD>Generate listing no matter what. Overrides any conflicting options. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-L </PRE></TD><TD>Generate listing no matter what. Overrides any conflicting options. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-m </PRE></TD><TD>List macro expansions. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-m </PRE></TD><TD>List macro expansions. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-n </PRE></TD><TD>Omit line numbers from listing. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-n </PRE></TD><TD>Omit line numbers from listing. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-o </PRE></TD><TD>List to standard output. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-o filename.cmd </PRE></TD><TD>Output only the named file.  Multiple "-o" options can be used to name a set of different files. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-p </PRE></TD><TD>Use a few linefeeds for page break in listing rather than ^L. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-p </PRE></TD><TD>Use a few linefeeds for page break in listing rather than ^L. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-P </PRE></TD><TD>Output listing for a printer with headers, multiple symbols per column, etc. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-P </PRE></TD><TD>Output listing for a printer with headers, multiple symbols per column, etc. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-s </PRE></TD><TD>Omit the symbol table from the listing. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-s </PRE></TD><TD>Omit the symbol table from the listing. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-t </PRE></TD><TD>Only output number of errors instead list of each one. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-t </PRE></TD><TD>Only output number of errors instead list of each one. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-z </PRE></TD><TD>Accept Z-80 mnemonics preferentially.  Equivalent to <TT>.z80</TT> pseudo-op. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>-z </PRE></TD><TD>Accept Z-80 mnemonics preferentially and use Z-80 instruction timings. Equivalent to <TT>.z80</TT> pseudo-op. </TD></TR>
</TABLE>
</TABLE>
<HR>
<HR>
<H3>Input Format</H3>
<H3>Input Format</H3>
<P>
<P>
zmac uses the standard Zilog mnemonics, and the pseudo-ops are also
zmac uses the standard Zilog mnemonics, and the pseudo-ops are also
Line 86... Line 97...
Labels can be up to 40 chars long.  They can start with and contain
Labels can be up to 40 chars long.  They can start with and contain
letters, digits, <TT>$</TT>, <TT>.</TT>, <TT>?</TT>, <TT>@</TT> and _.  Ambiguous identifiers like
letters, digits, <TT>$</TT>, <TT>.</TT>, <TT>?</TT>, <TT>@</TT> and _.  Ambiguous identifiers like
<TT>$FCB</TT> will be treated as hex constants unless defined as a label.  Labels
<TT>$FCB</TT> will be treated as hex constants unless defined as a label.  Labels
declared with two colons (<TT>label::</TT>) make the label public.
declared with two colons (<TT>label::</TT>) make the label public.
<P>
<P>
 
Single quotes are ignored at the end of identifiers allowing non-binding
 
<A HREF="#prime">notation</A> indicating alternate register use during heavy applications
 
of <TT>exx</TT> and <TT>ex</TT>.
 
<P>
Here is how other things work.  Numbers are used as examples, but a full
Here is how other things work.  Numbers are used as examples, but a full
<A HREF="#expr">expression</A> can be used in their place.
<A HREF="#expr">expression</A> can be used in their place.
<P>
<P>
<H4>Data</H4>
<H4>Data</H4>
<P>
<P>
<TT>defb 42</TT>
<TT>defb 42</TT>
<BLOCKQUOTE>A byte.  <TT>ascii</TT>, <TT>byte</TT>, <TT>db</TT>, <TT>defm</TT> and <TT>text</TT> are synonyms.
<BLOCKQUOTE>A byte.  <TT>ascii</TT>, <TT>byte</TT>, <TT>db</TT>, <TT>defm</TT>, <TT>dm</TT> and <TT>text</TT> are synonyms.
</BLOCKQUOTE>
</BLOCKQUOTE>
<P>
<P>
<TT>defb 'foobar'</TT>
<TT>defb 'foobar'</TT>
<BLOCKQUOTE>An ASCII character string (not NUL-terminated).
<BLOCKQUOTE>An ASCII character string (not NUL-terminated).
Double quotes can also be used.
Double quotes can also be used.
Line 122... Line 137...
<TT>block</TT>, <TT>ds</TT> and <TT>rmem</TT> are synonyms.
<TT>block</TT>, <TT>ds</TT> and <TT>rmem</TT> are synonyms.
</BLOCKQUOTE>
</BLOCKQUOTE>
<P>
<P>
<TT>dc 'string'</TT>
<TT>dc 'string'</TT>
<BLOCKQUOTE>Like <TT>ascii</TT> but accepts only a single string and the high bit of the
<BLOCKQUOTE>Like <TT>ascii</TT> but accepts only a single string and the high bit of the
last character will be set.
last character will be set. <TT>bytes</TT> is a synonym.
</BLOCKQUOTE>
</BLOCKQUOTE>
<P>
<P>
<TT>dc count,value</TT>
<TT>dc count,value</TT>
<BLOCKQUOTE>Repeat the byte <TT>value</TT> a total of <TT>count</TT> times.  Similar to <TT>defs</TT>
<BLOCKQUOTE>Repeat the byte <TT>value</TT> a total of <TT>count</TT> times.  Similar to <TT>defs</TT>
except that memory is always filled with <TT>value</TT>.
except that memory is always filled with <TT>value</TT>.
Line 144... Line 159...
is defined.  A symbol defined with <TT>equ</TT> or as a label can be defined only
is defined.  A symbol defined with <TT>equ</TT> or as a label can be defined only
once, except that a symbol defined with <TT>equ</TT> may be redefined to the
once, except that a symbol defined with <TT>equ</TT> may be redefined to the
same value.
same value.
</BLOCKQUOTE>
</BLOCKQUOTE>
<P>
<P>
<TT>label defl 200</TT>
<TT>varname defl 200</TT>
<BLOCKQUOTE>Define a symbol to have a changeable value.  The symbol cannot be used
<BLOCKQUOTE>Define a symbol to have a changeable value.  The symbol cannot be used
before it is defined, and it can be redefined to a different value later
before it is defined, and it can be redefined to a different value later
with another <TT>defl</TT>. <TT>aset</TT> is a synonym.
with another <TT>defl</TT>. <TT>aset</TT>, <TT>set</TT> and <TT>=</TT> are synonyms (despite <TT>set</TT>
 
also being a Z-80 mnemonic).
 
</BLOCKQUOTE>
 
<P>
 
<TT>varname OP = expression</TT>
 
<BLOCKQUOTE>Shorthand for <TT>varname defl varname OP expression</TT>.  Allows for C-like
 
handling of variable such as <TT>var += 5</TT>.  <TT>OP</TT> can be <TT>+</TT>, <TT>-</TT>, <TT>*</TT>, <TT>/</TT>,
 
<TT>%</TT>, <TT>&amp;</TT>, <TT>|</TT>, <TT>^</TT>, <TT>&lt;&lt;</TT>, <TT>&gt;&gt;</TT>, <TT>&amp;&amp;</TT> or <TT>||</TT>.
 
</BLOCKQUOTE>
 
<P>
 
<TT>varname++</TT>
 
<BLOCKQUOTE>Shorthand for <TT>varname defl varname + 1</TT>
 
</BLOCKQUOTE>
 
<P>
 
<TT>varname--</TT>
 
<BLOCKQUOTE>Shorthand for <TT>varname defl varname - 1</TT>
</BLOCKQUOTE>
</BLOCKQUOTE>
<P>
<P>
<TT>min</TT>
<TT>min</TT>
<P>
<P>
<TT>max</TT>
<TT>max</TT>
Line 176... Line 206...
<BLOCKQUOTE>The given labels will be visible to external modules when linking.
<BLOCKQUOTE>The given labels will be visible to external modules when linking.
No effect unless zmac is producing ".rel" output.
No effect unless zmac is producing ".rel" output.
<TT>global</TT> and <TT>entry</TT> are synonyms.
<TT>global</TT> and <TT>entry</TT> are synonyms.
</BLOCKQUOTE>
</BLOCKQUOTE>
<P>
<P>
 
<TT>label ++</TT>
 
<BLOCKQUOTE>Equivalent to <TT>label defl label + 1</TT>.
 
</BLOCKQUOTE>
 
<P>
 
<TT>label --</TT>
 
<BLOCKQUOTE>Equivalent to <TT>label defl label - 1</TT>.
 
</BLOCKQUOTE>
 
<P>
 
<TT>label += 10</TT>
 
<P>
 
<TT>label -= 10</TT>
 
<P>
 
<BLOCKQUOTE>Equivalent to <TT>label defl label + 10</TT> and <TT>label defl label - 10</TT> respectively.
 
Also works for <TT>*=</TT>, <TT>/=</TT>, <TT>%=</TT>, <TT>|=</TT>, <TT>&amp;=</TT>, <TT>^=</TT>, <TT>&lt;&lt;=</TT> and <TT>&gt;&gt;=</TT>.
 
</BLOCKQUOTE>
 
<P>
<H4>Location Control</H4>
<H4>Location Control</H4>
<P>
<P>
<TT>org 9000h</TT>
<TT>org 9000h</TT>
<BLOCKQUOTE>Set the address to assemble to 0x9000.
<BLOCKQUOTE>Set the address to assemble to 0x9000.
</BLOCKQUOTE>
</BLOCKQUOTE>
Line 200... Line 246...
<TT>dseg</TT>
<TT>dseg</TT>
<BLOCKQUOTE>Switch to the absolute, code and data segments respectively.
<BLOCKQUOTE>Switch to the absolute, code and data segments respectively.
No effect unless zmac is producing ".rel" output.
No effect unless zmac is producing ".rel" output.
</BLOCKQUOTE>
</BLOCKQUOTE>
<P>
<P>
 
<TT>common /name/</TT>
 
<BLOCKQUOTE>Set the address to the start of the selected common block.  The blank
 
common block will be selected if name is empty or all blanks or
 
omitted entirely.
 
No effect unless zmac is producing ".rel" output.
 
</BLOCKQUOTE>
 
<P>
<H4>Input Control</H4>
<H4>Input Control</H4>
<P>
<P>
<TT>end</TT>
<TT>end</TT>
<BLOCKQUOTE>Ends the input.  Any lines after an <TT>end</TT> are silently ignored.
<BLOCKQUOTE>Ends the input.  Any lines after an <TT>end</TT> are silently ignored.
If an arg is given, it declares the entry address for the program.
If an arg is given, it declares the entry address for the program.
This has no effect in ".cim" output. In ".hex" output
This has no effect in ".cim" output. In ".hex" output
it generates an S-record directing 0 bytes of data to be loaded
it generates an S-record directing 0 bytes of data to be loaded
at the given address.
at the given address.  It is required for ".500.cas", ".1000.cas"
 
and ".1500.cas" output.
</BLOCKQUOTE>
</BLOCKQUOTE>
<P>
<P>
<TT>if</TT> ... [ <TT>else</TT> ... ] <TT>endif</TT>
<TT>if</TT> ... [ <TT>else</TT> ... ] <TT>endif</TT>
<BLOCKQUOTE>For conditional assembly. If you do <TT>if foo</TT> and <TT>foo</TT> evaluates to
<BLOCKQUOTE>For conditional assembly. If you do <TT>if foo</TT> and <TT>foo</TT> evaluates to
zero, all the lines up until the next corresponding <TT>else</TT> or <TT>endif</TT>
zero, all the lines up until the next corresponding <TT>else</TT> or <TT>endif</TT>
are completely ignored.  Conversely, if <TT>foo</TT> evaluates to non-zero, any
are completely ignored.  Conversely, if <TT>foo</TT> evaluates to non-zero, any
lines from a corresponding <TT>else</TT> to the <TT>endif</TT> are ignored.  Ifs can
lines from a corresponding <TT>else</TT> to the <TT>endif</TT> are ignored.  Ifs can
be nested.  <TT>cond</TT>/<TT>endc</TT> are synonyms for <TT>if</TT>/<TT>endif</TT>.
be nested.  <TT>cond</TT>/<TT>endc</TT> are synonyms for <TT>if</TT>/<TT>endif</TT>.
</BLOCKQUOTE>
</BLOCKQUOTE>
<P>
<P>
 
<TT>ifdef symbol</TT>
 
<BLOCKQUOTE>Like <TT>if</TT>, but tests if <TT>symbol</TT> has been defined.  Declaring a symbol
 
as external counts as it being defined.
 
</BLOCKQUOTE>
 
<P>
 
<TT>ifndef symbol</TT>
 
<BLOCKQUOTE>Like <TT>if</TT>, but tests if <TT>symbol</TT> has not yet been defined.
 
</BLOCKQUOTE>
 
<P>
 
<TT>import file</TT>
 
<BLOCKQUOTE>Like <TT>include</TT> but will only bring in the file once.  File tracking is done
 
using only the file name so, for example, an <TT>import file</TT> will stop
 
both <TT>import ./file</TT> and <TT>import dir/file</TT> even if they actually refer to
 
different files.
 
</BLOCKQUOTE>
 
<P>
<TT>include file</TT>
<TT>include file</TT>
<BLOCKQUOTE>Include a file. Like C's (well, cpp's) #include and follows the same
<BLOCKQUOTE>Include a file. Like C's (well, cpp's) #include and follows the same
include path search rules, but the filename arg
include path search rules, but the filename arg
lacks the angle brackets or quotes (though single or double quotes may be used).
lacks the angle brackets or quotes (though single or double quotes may be used).
<TT>read</TT> is a synonym.
<TT>read</TT> is a synonym.  <TT>*include file</TT> also works if started in the first
 
column.  In <TT>--mras</TT> mode <TT>".asm"</TT> will be added if <TT>file</TT> has
 
no suffix.
 
</BLOCKQUOTE>
 
<P>
 
<TT>maclib file</TT>
 
<BLOCKQUOTE>Like <TT>include</TT> but adds <TT>.lib</TT> to the file name so includes <TT>file.lib</TT>.
</BLOCKQUOTE>
</BLOCKQUOTE>
<P>
<P>
<TT>comment X</TT>
<TT>comment X</TT>
<BLOCKQUOTE>Suspend assembly until the next occurence of character <TT>X</TT> on a line.
<BLOCKQUOTE>Suspend assembly until the next occurence of character <TT>X</TT> on a line.
The rest of the line will be ignored.  A multi-line comment.
The rest of the line will be ignored.  A multi-line comment.
Line 330... Line 406...
disassemblers.
disassemblers.
</BLOCKQUOTE>
</BLOCKQUOTE>
<P>
<P>
<H4>Miscellaneous</H4>
<H4>Miscellaneous</H4>
<P>
<P>
 
<TT>pragma str ...</TT>
 
<BLOCKQUOTE>Like C's #pragma, a generic hook for special purpose operations.  Only two
 
are currently defined.
 
</BLOCKQUOTE>
 
<P>
 
<BLOCKQUOTE><TT>pragma bds rest-of-line</TT> to
 
output <TT>rest-of-line</TT> to the <TT>.bds</TT> output file.
 
</BLOCKQUOTE>
 
<P>
 
<BLOCKQUOTE><TT>pragma mds rest-of-line</TT> to
 
output <TT>rest-of-line</TT> to the <TT>.mds</TT> output file.
 
</BLOCKQUOTE>
 
<P>
 
<BLOCKQUOTE>The <TT>.bds</TT> output format supports setting initial values for Z-80 registers
 
and I/O ports so <TT>pragma</TT> gives you access to that.
 
</BLOCKQUOTE>
 
<P>
 
<BLOCKQUOTE>The <TT>.mds</TT> output format is a MAME debug script thus additional initial
 
debugging commands may be output.  Of particular use on the TRS-80 Model II
 
is <TT>pragma mds ib@$ff=1</TT> which maps page 1 of RAM into $8000 .. $FFFF
 
and thus allows programs to load into that area.
 
</BLOCKQUOTE>
 
<P>
<TT>name str</TT>
<TT>name str</TT>
<BLOCKQUOTE>Set the name of the output model to <TT>str</TT>.  For compatibility reasons
<BLOCKQUOTE>Set the name of the output module to <TT>str</TT>.  For compatibility reasons
<TT>str</TT> may be parenthesized (e.g., "<TT>name ('foo')</TT>").  Not all output
<TT>str</TT> may be parenthesized (e.g., "<TT>name ('foo')</TT>").  Not all output
formats support an internal name and many have severe length limits.
formats support an internal name and many have severe length limits.
</BLOCKQUOTE>
</BLOCKQUOTE>
<P>
<P>
<TT>rsym</TT> and <TT>wsym</TT>
<TT>rsym</TT> and <TT>wsym</TT>
Line 364... Line 463...
options, though possibly with the sense reversed depending on the
options, though possibly with the sense reversed depending on the
default. Use an arg &gt;0 (or no arg) to enable, and an arg &lt;0 to
default. Use an arg &gt;0 (or no arg) to enable, and an arg &lt;0 to
disable.
disable.
</BLOCKQUOTE>
</BLOCKQUOTE>
<P>
<P>
<TT>list</TT>
<TT>list arg</TT>
<BLOCKQUOTE>Sets whether to list or not. You can use this to avoid listing certain
<BLOCKQUOTE>Turns output to listing file (.list) off if <TT>arg</TT> &lt; 0 or on if <TT>arg</TT> &gt; 0.
parts of the source. Takes same optional arg as 'elist', etc..
If no <TT>arg</TT> supplied then listing is enabled.
 
Use this to avoid listing certain parts of the source.
 
In <TT>--mras</TT> mode <TT>arg</TT> must be either <TT>on</TT> or <TT>off</TT> and
 
<TT>*list</TT> can be used if started in the first column.
</BLOCKQUOTE>
</BLOCKQUOTE>
<P>
<P>
<TT>title</TT>
<TT>title</TT>
<BLOCKQUOTE>Set title (used in listing and symbol file).
<BLOCKQUOTE>Set title (used in listing and symbol file).
</BLOCKQUOTE>
</BLOCKQUOTE>
<P>
<P>
<TT>space</TT>
<TT>space arg</TT>
<BLOCKQUOTE>Output arg blank lines in the listing, or one line if no arg is given.
<BLOCKQUOTE>Output arg blank lines in the listing, or one line if no arg is given.
</BLOCKQUOTE>
</BLOCKQUOTE>
<P>
<P>
<HR>
<HR>
<P>
<P>
Line 411... Line 513...
<P>
<P>
<TT>||</TT>
<TT>||</TT>
<P>
<P>
<TT>? :</TT>  (ternary choice operator)
<TT>? :</TT>  (ternary choice operator)
<P>
<P>
 
<A NAME="mrasord">Expressions</A> change significantly in <TT>--mras</TT> mode:
 
<BLOCKQUOTE>Evaluation is strictly left to right.  Except for <TT>and</TT>, <TT>or</TT>,
 
<TT>xor</TT> and <TT>=</TT>.  This doesn't break compatibility as original MRAS
 
source code only allows <TT>.and.</TT>, <TT>.or.</TT> and <TT>.xor.</TT> but the precedence
 
difference may surprise if code is added.
 
</BLOCKQUOTE>
 
<P>
 
<BLOCKQUOTE><TT>!</TT> is bitwise OR instead of logical not.
 
</BLOCKQUOTE>
 
<P>
 
<BLOCKQUOTE><TT>&lt;</TT> is left shift (or right shift when shift amount is negative)
 
</BLOCKQUOTE>
 
<P>
 
<BLOCKQUOTE>MRAS operators (<TT>.and.</TT> <TT>.eq.</TT> <TT>.ge.</TT> <TT>.gt.</TT> <TT>.high.</TT> <TT>.le.</TT> <TT>.low.</TT>
 
<TT>.lt.</TT> <TT>.mod.</TT> <TT>.ne.</TT> <TT>.not.</TT> <TT>.or.</TT> <TT>.shl.</TT> <TT>.shr.</TT> <TT>.xor.</TT>)
 
are recognized even if apparently in identifers.  (e.g., <TT>a.or.b</TT> is
 
seen as <TT>a .or. </TT>b).
 
</BLOCKQUOTE>
 
<P>
 
<BLOCKQUOTE>Logical operators return -1 for true and 0 for false.  Normally
 
zmac, like C, uses 1 for true.
 
</BLOCKQUOTE>
 
<P>
You can use normal parentheses or square brackets to override
You can use normal parentheses or square brackets to override
the precedence rules. Square brackets can be used where parentheses would
the precedence rules. Square brackets can be used where parentheses would
conflict with Z-80 mnemonic syntax, but this is not necessary in any
conflict with Z-80 mnemonic syntax, but this is not necessary in any
practical case.
practical case.
<P>
<P>
Line 470... Line 595...
</BLOCKQUOTE>
</BLOCKQUOTE>
<P>
<P>
Each time the macro is expanded the local labels are replaced with unique
Each time the macro is expanded the local labels are replaced with unique
names thus avoiding multiple definition problems.
names thus avoiding multiple definition problems.
<P>
<P>
For compatability with MRAS, macro arguments may be preceeded by <TT>&nbsp;</TT>
For compatability with MRAS, macro arguments may be preceeded by <TT>#</TT>
in their definition and use.
in their definition and use.
<P>
<P>
Any <TT>`</TT> (backquote) in a macro is ignored thus allowing a macro to
Any <TT>`</TT> (backquote) in a macro is ignored thus allowing a macro to
construct identifiers.  For example:
construct identifiers.  For example:
<P>
<P>
Line 483... Line 608...
<TR><TD VALIGN="TOP"><PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ld`dir`r</TT> </PRE></TD><TD> </TD></TR>
<TR><TD VALIGN="TOP"><PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ld`dir`r</TT> </PRE></TD><TD> </TD></TR>
<TR><TD VALIGN="TOP"><PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;endm</TT> </TD></TR>
<TR><TD VALIGN="TOP"><PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;endm</TT> </TD></TR>
</TABLE>
</TABLE>
<P>
<P>
Invoking <TT>move i</TT> will construct a <TT>ldir</TT> block move instruction.
Invoking <TT>move i</TT> will construct a <TT>ldir</TT> block move instruction.
 
<P>
 
For compatibility, <TT>&amp;</TT> can also be used as in MAC to concatenate
 
macro parameters.  This conflicts with zmac's bitwise and operator but
 
you can use the <TT>and</TT> synonym in macros to avoid the conflict.
 
<P>
 
In <TT>--mras</TT> mode arguments will be expanded even if they are inside other
 
identifiers.  The <TT>move</TT> could be written:
 
<P>
 
<TABLE>
 
<TR><TD VALIGN="TOP"><PRE><TT>move macro dir</TT> </PRE></TD><TD> </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lddirr</TT> </PRE></TD><TD> </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;endm</TT> </TD></TR>
 
</TABLE>
 
<P>
 
Macro definitions can contain macro definitions which will be defined
 
when the outer macro is first exapnded.  Macros can be redefined as
 
well.
 
<P>
 
Macro expansion continues to the <TT>endm</TT> directive but can be stopped
 
prematurely by the <TT>exitm</TT> directive.  Typically the <TT>exitm</TT> is inside
 
some conditional part of the macro.
 
<P>
 
Parameters passed to a macro can be empty and are tested with the <TT>nul</TT>
 
operator:
 
<P>
 
<TABLE>
 
<TR><TD VALIGN="TOP"><PRE><TT>if nul &amp;par</TT> </PRE></TD><TD> </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE><TT>...</TT> </PRE></TD><TD> </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE><TT>endif</TT> </TD></TR>
 
</TABLE>
 
<P>
 
Macro parameters can contain commas if grouped inside <TT>&lt;</TT> and <TT>&gt;</TT>.
 
Or a comma can be escaped with <TT>^</TT> which can also escape spaces and other
 
special characters.  It is also be put in front of a macro parameter
 
name inside the expansion to suppress the replacement by its value.
 
<P>
 
Expansion of parameters in a macro body is purely textual.  This can
 
lead to surprises in complex situations.  The <TT>%</TT> character can be used
 
to force a macro parameter to be replaced with the evaluation of it
 
as an expression.
 
<P>
 
<P>
 
<H4>Inline Macros</H4>
 
<P>
 
zmac supports the commonly available <TT>rept</TT>, <TT>irp</TT> and <TT>irpc</TT> inline macros
 
<P>
 
<TT>rept</TT> repeats its block the given number of times.  This will output 10
 
<TT>nop</TT> instructions:
 
<P>
 
<TABLE>
 
<TR><TD VALIGN="TOP"><PRE><TT>rept 10</TT> </PRE></TD><TD> </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nop</TT> </PRE></TD><TD> </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE><TT>endm</TT> </TD></TR>
 
</TABLE>
 
<P>
 
<TT>irpc</TT> runs through a string of letters assigned them to a variable and
 
expanding the macro block each time.  For example, this will load 7 into
 
registers <TT>b</TT>, <TT>d</TT> and <TT>h</TT>:
 
<P>
 
<TABLE>
 
<TR><TD VALIGN="TOP"><PRE><TT>irpc reg,bdh</TT> </PRE></TD><TD> </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ld &amp;reg,7</TT> </PRE></TD><TD> </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE><TT>endm</TT> </TD></TR>
 
</TABLE>
 
<P>
 
<TT>irp</TT> runs through a list of parameters assiging each entry to a variable
 
and expanding the macro block.  Here we load <TT>bc</TT>, <TT>de</TT> and <TT>hl</TT> with 0:
 
<P>
 
<TABLE>
 
<TR><TD VALIGN="TOP"><PRE><TT>irp rpair,&lt;bc,de,hl&gt;</TT> </PRE></TD><TD> </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ld &amp;rpair,0</TT> </PRE></TD><TD> </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE><TT>endm</TT> </TD></TR>
 
</TABLE>
 
<P>
 
Lists can be nested.  Here's an example of and <TT>irp</TT> passing lists on down
 
to another <TT>irp</TT>:
 
<P>
 
<TABLE>
 
<TR><TD VALIGN="TOP"><PRE><TT>irp listlist,&lt;&lt;one,two,three&gt;,&lt;four,five,six&gt;&gt;</TT> </PRE></TD><TD> </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE><TT>irp list,&lt;listlist&gt;</TT> </PRE></TD><TD> </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE><TT>ascii '&amp;list'</TT> </PRE></TD><TD> </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE><TT>endm</TT> </PRE></TD><TD> </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE><TT>endm</TT> </TD></TR>
 
</TABLE>
 
<P>
 
<P>
<HR>
<HR>
<H3>Compatibility</H3>
<H3>Compatibility</H3>
<P>
<P>
zmac is broadly compatible with many original Z-80 and 8080 assemblers
zmac is broadly compatible with many original Z-80 and 8080 assemblers
because it accepts many different names for common operations and has
because it accepts many different names for common operations and has
Line 496... Line 707...
When assembling old code keep these portability problems in mind.
When assembling old code keep these portability problems in mind.
<P>
<P>
Expression order of evaluation may be different.  zmac uses C semantics
Expression order of evaluation may be different.  zmac uses C semantics
more order of evaluation but assemblers often used simple left to right
more order of evaluation but assemblers often used simple left to right
ordering.  zmac will evaluate <TT>2+2*3</TT> as <TT>8</TT> where other assemblers will
ordering.  zmac will evaluate <TT>2+2*3</TT> as <TT>8</TT> where other assemblers will
yield <TT>12</TT>.
yield <TT>12</TT>.  However, in <TT>--mras</TT> mode expressions are evaluated strictly
 
left-to-right for compatibility.
<P>
<P>
zmac has no support operating on strings in macros.  Assemblers like Macro-80
zmac has no support operating on strings in macros.  Assemblers like Macro-80
could perform conditional tests on strings.
could perform conditional tests on strings.
<P>
<P>
Advanced macros are unlikely to work.  zmac hasn't advanced to the state where
Advanced macros are unlikely to work.  zmac hasn't advanced to the state where
all the possible ways of substituting parameters are supported.  Nor does it
all the possible ways of substituting parameters are supported.
have simple repetition, a way to exit a macro expansion early and so on.
 
<P>
<P>
Consult the original assembler manual.  zmac error messages won't help you
Consult the original assembler manual.  zmac error messages won't help you
figure out what an unknown assembler command is supposed to do.
figure out what an unknown assembler command is supposed to do.
<P>
<P>
Compare against original output.  The very safest thing to do when porting
Compare against original output.  The very safest thing to do when porting
Line 559... Line 770...
</TABLE>
</TABLE>
<P>
<P>
<HR>
<HR>
<H3>Output <A NAME="format">Formats</A></H3>
<H3>Output <A NAME="format">Formats</A></H3>
<P>
<P>
Except for ".rel", zmac writes every known output when assembling.  This
Except for ".rel", zmac writes every known output when assembling by default.
is no burden on modern computers and saves having to come up with options
This is no burden on modern computers and saves having to meticulously select
to select a particular output format.
the desired output format.
<P>
<P>
".rel" is a special case since that format is intended for linking and
".rel" is a special case since that format is intended for linking and
can have undefined external symbols which would be errors in the other
can have undefined external symbols which would be errors in the other formats.
formats which do not support them.
Conversely, a simple "org $8000" will be an error for ".rel" output as it
 
defaults to the code segment where absolute origin statements are forbidden.
 
<P>
 
If ".rel" is selected for output either by <TT>--relopt</TT> or with
 
<TT>--oo rel</TT> or <TT>-o file.rel</TT> then all other output formats are suppressed
 
(except the ".lst" source file listing).
<P>
<P>
<TABLE>
<TABLE>
<TR><TD VALIGN="TOP"><PRE>.ams </PRE></TD><TD>AMSDOS executable format for Amstrad computers. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>.ams </PRE></TD><TD>AMSDOS executable format for Amstrad computers. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>.bds </PRE></TD><TD>Experimental format with the potential for source-level debugging. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>.bds </PRE></TD><TD>For source-level debugging in <A HREF="http://www.48k.ca/trs80gp.html">trs80gp</A> </TD></TR>
<TR><TD VALIGN="TOP"><PRE>.cas </PRE></TD><TD>TRS-80 high-speed (1500 baud) cassette SYSTEM file.  The internal name of the file is the source file name shortened to 6 characters with suffixes removed. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>.1500.cas </PRE></TD><TD>TRS-80 high-speed (1500 baud) cassette SYSTEM file.  The internal name of the file is the source file name shortened to 6 characters with suffixes removed.  Requires an entry address. </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE>.250.cas </PRE></TD><TD>TRS-80 250 baud cassette Level I CLOAD file.  If your program has an entry address and $41FE does not contain that entry address then the file will be loaded at $41FE with relocation code added to move it to the desired location. </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE>.500.cas </PRE></TD><TD>TRS-80 low-speed (500 baud) cassette SYSTEM file.  The internal name of the file is the source file name shortened to 6 characters with suffixes removed. Requires an entry address. </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE>.1000.cas </PRE></TD><TD>Identical to 500 baud but intended for double-speed LNW-80 which can can load cassette files at double speed for an effective 1000 baud rate. Requires an entry address. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>.cim </PRE></TD><TD>Core In-Memory image.  A raw binary format with the first byte corresponding to the lowest generated code or data and proceeding contiguously until the highest address generated.  Any gaps are filled with zeros.  Typically used for CP/M where all executables start at address 256 or for ROM images. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>.cim </PRE></TD><TD>Core In-Memory image.  A raw binary format with the first byte corresponding to the lowest generated code or data and proceeding contiguously until the highest address generated.  Any gaps are filled with zeros.  Typically used for CP/M where all executables start at address 256 or for ROM images. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>.cmd </PRE></TD><TD>TRS-80 DOS executable file format as used by all major DOSes on the TRS-80 (TRS-DOS, LDOS, MULTIDOS, NEWDOS, etc.) </TD></TR>
<TR><TD VALIGN="TOP"><PRE>.cmd </PRE></TD><TD>TRS-80 DOS executable file format as used by all major DOSes on the TRS-80 (TRS-DOS, LDOS, MULTIDOS, NEWDOS, etc.) </TD></TR>
<TR><TD VALIGN="TOP"><PRE>.hex </PRE></TD><TD>Intel hex record format. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>.hex </PRE></TD><TD>Intel hex record format. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>.lcas </PRE></TD><TD>TRS-80 low-speed (500 baud) cassette SYSTEM file.  The internal name of the file is the source file name shortened to 6 characters with suffixes removed. </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE>.rel </PRE></TD><TD>Relocatable object module format as produced by MACRO-80 and other assemblers. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>.rel </PRE></TD><TD>Relocatable object module format as produced by MACRO-80 and other assemblers. </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE>.tap </PRE></TD><TD>ZX Spectrum cassette tape format. </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE>.1500.wav </PRE></TD><TD>Same as .1500.cas but in ready-to-play audio format. </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE>.250.wav </PRE></TD><TD>Same as .250.cas but in ready-to-play audio format. </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE>.500.wav </PRE></TD><TD>Same as .500.cas but in ready-to-play audio format. </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE>.1000.wav </PRE></TD><TD>Same as .1000.cas but in ready-to-play audio format. </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE>.mds </PRE></TD><TD>MAME debug script (e.g., mame trs80 -d -debugscript zout/prog.mds) </TD></TR>
</TABLE>
</TABLE>
<P>
<P>
<HR>
<HR>
<H3>Miscellaneous</H3>
<H3>Miscellaneous</H3>
In the symbol table listing, the <TT>=</TT> prefix is given for those symbols
In the symbol table listing, the <TT>=</TT> prefix is given for those symbols
defined by <TT>equ</TT> or <TT>defl</TT>.
defined by <TT>equ</TT> or <TT>defl</TT>.  The <TT>/</TT> prefix is shown for common blocks.
 
<P>
 
The <TT>.rel</TT> file format can store symbol names of up to 7 characters in length.
 
However, MACRO-80 truncates symbols to 6 characters so that it has one
 
character in reserve for extending linking operations such as subtracting
 
two externals from each other.  To be compatible (and sensible), <TT>--rel</TT>
 
truncates externals to 6 characters.  For MRAS compatibility, <TT>--mras</TT>
 
truncates symbols to 7 characters.  This is not a problem for MRAS as it
 
doesn't support extended linking.  But necessary if you want zmac to produce
 
<TT>.rel</TT> files that will link with MRAS generated <TT>.rel</TT> files.  The <TT>--rel7</TT>
 
option sets symbol truncation to 7 characters so you can assemble files
 
that will link with MRAS output.  However, it will break extended linking
 
on labels longer than 6 characters.
 
<P>
 
The <A NAME="prime">ignoring</A> of single quotes can be handy for tracking alternate
 
register usage.  Consider the following code fragment:
 
<P>
 
<TABLE>
 
<TR><TD VALIGN="TOP"><PRE><TT>ld    a,(hl)</TT> </PRE></TD><TD> </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE><TT>rra</TT> </PRE></TD><TD> </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE><TT>exx</TT> </PRE></TD><TD> </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE><TT>ld    a,(hl')</TT> </PRE></TD><TD> </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE><TT>ex    af,af'</TT> </PRE></TD><TD> </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE><TT>ld    a',(hl') </PRE></TD><TD> </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE></TT>rra'<TT> </PRE></TD><TD> </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE></TT>ex    af,af'<TT> </PRE></TD><TD> </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE></TT>djnz' loop<TT> </PRE></TD><TD> </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE></TT>ld    d',e'<TT> </PRE></TD><TD> </TD></TR>
 
<TR><TD VALIGN="TOP"><PRE></TT>exx<TT> </TD></TR>
 
</TABLE>
 
<P>
 
Although zmac does nothing but ignore the single quotes they are useful for
 
indicating which register we're talking using.  A more advanced mode
 
where zmac pays attention to the trailing quotes and emits exchange instrucitons
 
as needed has been considered.
 
<P>
<HR>
<HR>
<H3>Exit Status</H3>
<H3>Exit Status</H3>
<P>
<P>
<TABLE>
<TABLE>
<TR><TD VALIGN="TOP"><PRE>0 </PRE></TD><TD>No errors. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>0 </PRE></TD><TD>No errors. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>1 </PRE></TD><TD>One or more errors were found during assembly, or zmac exited with a fatal error. </TD></TR>
<TR><TD VALIGN="TOP"><PRE>1 </PRE></TD><TD>One or more errors were found during assembly, or zmac exited with a fatal error. </TD></TR>
</TABLE>
</TABLE>
<P>
<P>
<HR>
<HR>
<H3>Credits</H3>
<H3>Credits</H3>
Bruce Norskog original wrote zmac in 1978.
Bruce Norskog originally wrote zmac in 1978.
<P>
<P>
Updates and bugfixes over the years by John Providenza, Colin Kelley,
Updates and bugfixes over the years by John Providenza, Colin Kelley,
and more recently by Russell Marks, Mark RISON, Chris Smith,
and more recently by Russell Marks, Mark RISON, Chris Smith,
Matthew Phillips and Tim Mann.
Matthew Phillips and Tim Mann.
<P>
<P>
Line 604... Line 863...
".rel" output, 8080 mode and older assembler compatibilty were written
".rel" output, 8080 mode and older assembler compatibilty were written
by George Phillips.
by George Phillips.
<P>
<P>
This document was based on Russell Marks zmac man page which had
This document was based on Russell Marks zmac man page which had
tweaks by Mark RISON and Tim Mann.  George Phillips converted it to HTML
tweaks by Mark RISON and Tim Mann.  George Phillips converted it to HTML
and documented the new features and some older ones (e.g., <TT>phase</TT>/<TT>dephase</TT>).
and documented the new features and some older ones (e.g., </TT>phase<TT>/</TT>dephase<TT>).
 
</TT>
 
<p xmlns:dct="http://purl.org/dc/terms/" xmlns:vcard="http://www.w3.org/2001/vcard-rdf/3.0#">
 
  <a rel="license"
 
     href="http://creativecommons.org/publicdomain/zero/1.0/">
 
    <img src="http://i.creativecommons.org/p/zero/1.0/88x31.png" style="border-style: none;" alt="CC0" />
 
  </a>
 
  <br />
 
  To the extent possible under law,
 
  <a rel="dct:publisher"
 
     href="http://48k.ca/zmac.html">
 
    <span property="dct:title">George Phillips</span></a>
 
  has waived all copyright and related or neighboring rights to
 
  <span property="dct:title">zmac macro cross assembler for the Zilog Z-80 microprocessor</span>.
 
This work is published from:
 
<span property="vcard:Country" datatype="dct:ISO3166"
 
      content="CA" about="http://48k.ca/zmac.html">
 
  Canada</span>.
 
</p>
 
 
<!--
<!--
  If you ran "zmac --doc" you may want to send the output
  If you ran "zmac --doc" you may want to send the output
  to a file using "zmac --doc >zmac.html" and then open
  to a file using "zmac --doc >zmac.html" and then open
  zmac.html in your web browser.
  zmac.html in your web browser.
-->
-->

powered by: WebSVN 2.1.0

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