Short Contents
**************

DreamAss
1 Preface
2 Installation
3 Command Line Options
4 Command Reference
5 General Usage
Appendix A History
Appendix B Copying This Manual
List of Tables
Concept Index


Table of Contents
*****************

DreamAss
1 Preface
2 Installation
  2.1 How to obtain DreamAss
  2.2 Requirements
  2.3 Porting DreamAss
  2.4 Compilation of the source distribution
  2.5 Debugging DreamAss
3 Command Line Options
  3.1 Set Debug Mode
  3.2 Define variable
  3.3 Set Verbose Mode
  3.4 Set Error Logging
  3.5 Set Label Logging
  3.6 Set the maximum number of errors
  3.7 Set the maximum number of warnings
  3.8 Select Output File
  3.9 Add Include path
  3.10 Modify Warning Level
  3.11 Simple Redefines
  3.12 Show Help
4 Command Reference
  4.1 Pseudo Opcodes
    4.1.1 Binary Include
    4.1.2 Dump Bytes
    4.1.3 Dump Words
    4.1.4 Dump Text
    4.1.5 Dump Petascii
    4.1.6 Dump Screencode
    4.1.7 Switch Segment
    4.1.8 Set Petascii Mode
    4.1.9 Set Screencode Mode
    4.1.10 Fill Area
    4.1.11 Align
    4.1.12 Open Local Block
    4.1.13 Close Local Block
    4.1.14 Pseudo PC
    4.1.15 Real PC
  4.2 Preprocessor Directives
    4.2.1 Error
    4.2.2 If
    4.2.3 If Defined
    4.2.4 If Not Defined
    4.2.5 Else If
    4.2.6 Else If Defined
    4.2.7 Else If Not Defined
    4.2.8 Else
    4.2.9 End If
    4.2.10 Include
    4.2.11 Macro
    4.2.12 Outfile
    4.2.13 Print
    4.2.14 Segdef
    4.2.15 Warning
5 General Usage
  5.1 Macros
  5.2 Conditional Assembly
  5.3 Segments
  5.4 Outfiles
  5.5 Terms
  5.6 Local Blocks
Appendix A History
Appendix B Copying This Manual
  B.1 GNU Free Documentation License
    B.1.1 ADDENDUM: How to use this License for your documents
List of Tables
Concept Index


DreamAss
********

This manual is for DreamAss (version 0.9, 2006-04-18), a crossassembler
for 6510, 65816 and compatible CPUs.

Copyright (C)  2002, 2003, 2004, 2005, 2006  Christoph Thelen.

     Permission is granted to copy, distribute and/or modify this
     document under the terms of the GNU Free Documentation License,
     Version 1.2 or any later version published by the Free Software
     Foundation; with no Invariant Sections, no Front-Cover Texts, and
     no Back-Cover Texts.  A copy of the license is included in the
     section entitled "GNU Free Documentation License".

1 Preface
*********

"DreamAss"(1) is a crossassembler. It produces binaries for 6510, 65816
and compatible CPUs.  The 'illegal' opcodes of the 6510 are also
supported.

These are the tools I used to develop this programm:
   * gcc (http://directory.fsf.org/GNU/gcc.html) and  gdb
     (http://directory.fsf.org/GNU/gdb.html)

   * valgrind (http://valgrind.org), an excellent debugger

   * the development environment KDevelop (http://www.kdevelop.org)


Doc Bacardi/DRM

           ______              ______              ___________
         __\     \    ______ __\     \    ______ __\          \    ______
        /\  \_____\ __\     \   \_____\ __\     \   \__________\ __\     \
       /  \__\__   \_  \_____\ __\__   \_  \_____\ __\_______   \_  \_____\
      /   /    /    /\__\__   \_   /____/\__\__   \_   /    /    /\__\__   \_
     /   /    /    / /   _/    /  ___/_  /   _/    /  /    /    / /    /____/
     \  /    /    / /    \____/  /    / /    \    /  /    /    / /\___    \
      ./_________/ /    /    /_______/ /    /    /__/____/    /\/    /    /
                 \/____/    /        \/____/    /      \/_____\ \________/
                     \/_____\            \/_____\
                  cRu/1oo
                    .                       `http://www.the-dreams.de'

---------- Footnotes ----------

(1) The name "DreamAss" is the short form of "The Dreams Assembler".
"The Dreams" is a C64 group, visit `http://www.the-dreams.de' for more
info.

2 Installation
**************

2.1 How to obtain DreamAss
==========================

The sourcecode of the latest DreamAss version can be downloaded from:
`http://people.freenet.de/LittleDreamLand'. The site also provides
pre-build documentation and binaries for a selection of operating
systems.

2.2 Requirements
================

You'll need a C compiler like gcc or icc to build the binary. I'm
trying to keep the code type size independent, i.e. I don't assume that
an int is 32 bit wide. Instead I rely on the types defined in
'stdint.h'.

The docs are Texinfo. You'll need 'makeinfo' to convert them to plain
ascii, html or the info format. The download site provides pre-build
docs.

2.3 Porting DreamAss
====================

If you are compiling DreamAss for a small computer with few ressources
you might want to edit 'sizes.h'. There you can define the maximum
sizes for all dynamic arrays. Smaller maximum sizes have several
advantages:

   * Indices to listentries get smaller. As they are used a lot you
     might need some KBytes of ram less for assembling big sources.

   * Using the cpu's register size (or less) saves a lot of code on
     smaller machines. Example: Operations on 16 bit indices have to be
     split up into 2 parts on an 8 bit cpu.

Options found in 'sizes.h':

   * ARRAYSIZE_IncludePaths Maximum number of include paths which can be
     passed via commandline.

   * ARRAYSIZE_SourceFiles Maximum number of source files which can be
     passed via commandline.

   * ARRAYSIZE_Files Maximum number of files

   * ARRAYSIZE_Lines Maximum number of lines for one file

   * ARRAYSIZE_LineChars Maximum number of chars per line

   * ARRAYSIZE_Macros Maximum number of macros

   * ARRAYSIZE_MacroParameters Maximum number of parameters for one
     macro

   * ARRAYSIZE_Term Maximum number of elements in one term. An element
     is a number or an operator like '+', '>>' or 'segmentof'.

2.4 Compilation of the source distribution
==========================================

DreamAss is a simple tool with no use for autoconfig. I'm using no libs
so far, just type 'make' and there should be a binary. If you're
compiling on strange systems (i.e. != Linux ;) you may need to adjust
the C compiler and Flags in the 'Makefile'.

Without 'make' or a similar tool, just replace the CC in the following
command with your C compiler:
     CC -o dreamass *.c
Please note that this is just a quick solution to get an executable. The
resulting file does not have a version number and is not optimized.

If you run into trouble building the binary feel free to contact me:
<DocBacardi@the-dreams.de>

2.5 Debugging DreamAss
======================

I'm using valgrind to debug DreamAss. It's easy to use, non-intrusive
and needs no special libs to be linked with the code. This chapter
gives a brief description how to get valgrind running with dreamass.
It's no substitute for the docs.

Start 'valgrind-listener' on a console. It prints a short message and
waits for a debugging-session.

     baccy@Yakumo:~$ valgrind-listener
     valgrind-listener started at Tue Feb 10 13:39:36 2004

Go to a new colsole. Prepend valgrind before the command to debug:

valgrind --leak-check=yes --log-socket=127.0.0.1:1500
--show-reachable=yes -v {command}

Example for dreamass:

     valgrind --leak-check=yes --log-socket=127.0.0.1:1500 --show-reachable=yes -v dreamass -v -o test.prg test.src

Don't worry if the execution time increases significantly. Valgrind
emulates a complete cpu/mem environment for the debugging session, this
takes some time.  Now switch back to the console showing the
'valgrind-listener'. There is a lot of output. Look for a line
containing the words "ERROR SUMMARY". It shows the number of memory
errors like accessing not allocated memory, double frees, etc.  The
next line indicates memory leaks.

     (1) ==732== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
     (1) ==732== malloc/free: in use at exit: 0 bytes in 0 blocks.

The example shows the result for a run without errors and leaks.
Unfortunately this is not always the case with dreamass. If there are
errors or leaks, please copy the complete output to a mail and send it
to <DocBacardi@the-dreams.de>.  I'm also very grateful for bug-fixes. :)

3 Command Line Options
**********************

short form  long form              function                         default
---------------------------------------------------------------------------- 
`-d' FILE   `--debug' FILE         *Note Set Debug Mode::           off
`-D'VAR=VALUE                       *Note Define variable::          
`-e' FILE   `--error-log' FILE     *Note Set Error Logging::        none
`-h'        `--help'               *Note Show Help::                off
`-I'PATH                           *Note Add Include path::         
`-l' FILE   `--label-log' FILE     *Note Set Label Logging::        none
`-me'       `--max-errors' NUMBER  *Note Set the maximum number of  20
NUMBER                             errors::                         
`-mw'       `--max-warnings'       *Note Set the maximum number of  20
NUMBER      NUMBER                 warnings::                       
`-o' FILE   `--output' FILE        *Note Select Output File::       "a.out"
`-r'        `--simple-redefine'    *Note Simple Redefines::         off
`-v'        `--verbose'            *Note Set Verbose Mode::         off
`-W'TAG                            *Note Modify Warning Level::     

Table 3.1: all commandline options

3.1 Set Debug Mode
==================

The debug mode is primarily made for people developing and modifying
DreamAss.  It writes a lot of info on how things were parsed, syntax
trees were built and so on. This sounds rather boring for the user, but
it proved it's use also for them:

   * the debug listing shows the expansions of macros in detail

   * terms...

   * labelsizes...

Short syntax:
     -d file

Long syntax:
     --debug file

3.2 Define variable
===================

Define a variable globally.

Short syntax:
     -Dvar=value

Example:
     % dreamass -Duse_lightpen=1 decathlon.src
This defines the variable 'use_lightpen' to the value '1'.

3.3 Set Verbose Mode
====================

In verbose mode dreamass prints information on the assembling process.
This is

   * the number of the current pass

   * a summary of the produced objects

   * and finally a hello and bye message

Short syntax:
     -v

Long syntsx:
     --verbose

Example:
     % dreamass -v emacs.src
This assembles the source 'emacs.src' in verbose mode.

3.4 Set Error Logging
=====================

The default behavior is to print all errors and warnings to 'stderr'.
With this option it will also be written to a file.

     -e file

     --error-log file

Examples:
     % dreamass -e pingpong.errors pingpong.src
or
     % dreamass --error-log pingpong.errors pingpong.src

Both examples log the errors and warnings from assembling
'pingpong.src' to the file 'pingpong.errors'.

3.5 Set Label Logging
=====================

Dump all used lables to a file. This has the format
     Labelname = Value
      ...

Short syntax:
     -l file

Long syntax:
     --label-log file

Example:
     % dreamass -l CooSaysTheMow.labels CooSaysTheMow.src
This dumps the global labels to the file 'CooSaysTheMow.labels'.

3.6 Set the maximum number of errors
====================================

Set the maximum number of errors before aborting assembly. If the
argument is 0 or negativ, all errors will be shown. If no '-me' or
'-max_errors' option is present, the default value of 20 is used.
Please note that the limit is only checked _after_ a complete line is
parsed. If one line of sourcecode produces more than one error, this
can break the desired maximum. This 'relaxed' checking is necessary as
some errors do not make much sense alone.

Short syntax:
     -me number

Long syntax:
     --max-errors number

Examples:
     % dreamass -me 100 debugger.src
 ...stop assembling after 100 errors.

     % dreamass -me -1 bugger.src
 ...do not stop assembling after errors.

3.7 Set the maximum number of warnings
======================================

Set the maximum number of warnings to show. More warnings will not be
shown, but counted. If the argument is 0 or negativ, all warnings will
be shown. If no '-mw' or '-max_warnings' option is present, the default
value of 20 is used.

Short syntax:
     -mw number

Long syntax:
     --max-warnings number

Examples:
     % dreamass -mw 100 debugger.src
 ...show only the first 100 warnings. All further warnings will be
suppressed.

     % dreamass -mw -1 bugger.src
 ...show all warnings.

3.8 Select Output File
======================

Specify the default filename for the assembled binary. If no '-o'
option and no '#outfile' is present the file `a.out' is used.

Short syntax:
     -o file

Long syntax:
     --output file

Examples:
     % dreamass meow.src
 ...dumps the object to `a.out'.

     % dreamass -o BananaBoat.c64 BananaBoat.src
 ...dumps the object to `BananaBoat.c64'.

3.9 Add Include path
====================

Add a path to search files in. The include path is used to open
   * sourcefiles from the commandline

   * '#include'd sourcefiles

   * binaries included with '#binclude'

Syntax:
     -Ipath

The path does not have to end with a '/'. DreamAss adds one
automatically if it is missing.

Example:
     % dreamass -I/home/baccy/ -I/usr/include/dreamass readpilot.src
This defines the include paths '/home/baccy/' and
'/usr/include/dreamass/' (note the added '/'). The file 'readpilot.src'
will be searched in the current path, then in '/home/baccy/' and
finally in '/usr/include/dreamass/'. The same goes for every '#include'
and '#binclude' in the source.

     Note: The current path while calling dreamass is always searched
     before the include paths.

     Note: The include paths are searched after the current path in the
     order of their appearence in the commandline. If the file in
     question is found in one path the search is stopped even if a file
     with the same name appears in a later include path.

3.10 Modify Warning Level
=========================

Select which warnings will be shown (and counted) during assembly.

Syntax:
     -Wtag
The 'tag' is an identifier for the warning which should be enabled

tag            meanings
-------------------------------------------------------------------------- 
`user'         User warnings generated with the #warning command
`preuse'       An undefined label is used in a context which allows only
               one size (e.g.  'lda #label')
`adrmode'      A 1 byte label is used for absolute addressing. It has to
               be expanded to 2 bytes.
`bincludes'    An included binary exceeds the 64K border. The extra data
               will be ignored.
`segdef'       One argument of the #segdef command is set more than
               once. Only the last value will be used.
`outfile'      One argument of the #outfile command is set more than
               once. Only the last value will be used.
`jmpind'       The destination address of an indirect jump is at the end
               of a page ($??FF).
`pcblock'      The PC was shifted with .pseudopc and is still not back
               to normal at end of file.
`localblock'   A local block was opened but is still not closed at end
               of file.

Table 3.2: the basic warning tags

Some special tags are defined to make life easier:

tag            meaning
-------------------------------------------------------------------------- 
`all'          show all warnings
`none'         show no warnings
`normal'       show the default selection of warnings. this is the same
               as '-Wuser -Wbincludes -Wsegdef -Woutfile -Wjmpind
               -Wpcblock -Wlocalblock'

Table 3.3: the special warning tags

If no '-W' option is present, dreamass falls back to '-Wnormal'. If one
or more '-W' options are present, no internal defaults are used. Only
the specified warnings are listed.
     % dreamass mover.src
no '-W' present. fallback to '-Wnormal'.

     % dreamass -Wadrmode mover.src
only show the 'adrmode' warnings

Multiple '-W' options can be used to enable several warnings:

     % dreamass -Wuser -Wjmpind mover.src
 ...show user and indirect jump warnings.

3.11 Simple Redefines
=====================

Allow simple redefines. Simple means a redefinition with the '='
operator does not result in an error as usual. It will be accepted as
if the ':=' operator was used.

Please note that the idea behind bitching about a redefinition is to
prevent errors. Especially at big projects labelnames are reused
unintentionally sometimes, which can produce quite strange results. So
only use simple redefines if you really need it.

Short syntax:
     -r

Long syntax:
     --simple-redefine

Example:
     % dreamass -r sloppy.src
This assembles the source 'sloppy.src' without caring about
redefinitions with the '=' operator.

3.12 Show Help
==============

Show all commandline options. This is a summary of this chapter.

Short syntax:
     -h

Long syntax:
     --help

Example:
     % dreamass --help

     Note: All other commandline options are silently ignored.

4 Command Reference
*******************

4.1 Pseudo Opcodes
==================

syntax                                      command
-------------------------------------------------------------------------- 
`.binclude FILENAME [,OFFSET                *Note Binary Include::
[,MAX_LENGTH]]'                             
`.byte TERM [,TERM...]'                     *Note Dump Bytes:: (alias
                                            for '.db').
`.db TERM [,TERM...]'                       *Note Dump Bytes::
`.dw TERM [,TERM...]'                       *Note Dump Words::
`.text [TERM | TEXT] [,TERM | ,TEXT]...'    *Note Dump Text::
`.dt [TERM | TEXT] [,TERM | ,TEXT]...'      *Note Dump Text:: (alias for
                                            .text).
`.pet [TERM | TEXT] [,TERM | ,TEXT]...'     *Note Dump Petascii::
`.dp [TERM | TEXT] [,TERM | ,TEXT]...'      *Note Dump Petascii:: (alias
                                            for .pet).
`.scr [TERM | TEXT] [,TERM | ,TEXT]...'     *Note Dump Screencode::
`.ds [TERM | TEXT] [,TERM | ,TEXT]...'      *Note Dump Screencode::
                                            (alias for .scr).
`.segment NAME'                             *Note Switch Segment::
`.setpet'                                   *Note Set Petascii Mode::
`.setscr'                                   *Note Set Screencode Mode::
`.word TERM [,TERM...]'                     *Note Dump Words::
`.dsb SIZE [,FILLYTE]'                      *Note Fill Area::
`.align BASE [,FILLYTE]'                    *Note Align::
`.('                                        *Note Open Local Block::
`.)'                                        *Note Close Local Block::
`.pseudopc ADDRESS'                         *Note Pseudo PC::
`.realpc'                                   *Note Real PC::

Table 4.1: all pseudo opcodes

4.1.1 Binary Include
--------------------

Includes a file 'as it is'.

Syntax:
     `.binclude FILENAME [,OFFSET [,MAX_LENGTH]]'

Examples:
     .binclude "gfx/bitmap01.koa"
This includes the complete file `gfx/bitmap01.koa'.

     .binclude "sfx/sound01.prg",2
The offset is used to skip bytes at the beginning of the file. This
example ignores the first 2 bytes of the file.

     .binclude "gfx/bitmap02.koa",2,8000
The third parameter is the maximum number of bytes to include. If
MAX_LENGTH is omitted, the maximum possible length is used.  This
example reads from file `gfx/bitmap02.koala'. The first 2 bytes are
skipped, then 8000 bytes are included. The file may contain more data,
but it is ignored.  For a picture in koala format this example would
extract the bitmap.

     Note: If the file is not found in the current path, the
     includepaths are serached.

4.1.2 Dump Bytes
----------------

Dump a sequence of 8 bit values. The values are seperated with a comma.

Syntax:
     `.db TERM [,TERM...]'

Examples:
     .DB 0
     .DB $ab, 'd', 4, 6*(%10110+&711)

Wrong example:
     .DB $123        ;*** DOES NOT WORK ***
This will produce an 'overflow error' as $123 does not fit in one byte

4.1.3 Dump Words
----------------

Produces a sequence of 16 bit values. The byteorder is big endian. Two
and more values are seperated with a comma. Bytevalues will be expanded
to word values.

Syntax:
     `.dw TERM [,TERM...]'

Examples:
     .DW 0
     .dw $abcd, 'd', 1024, $6*(%10110+&711)

Wrong example:
     .DW $12345      ;*** DOES NOT WORK ***
This will produce an `overflow error' as $12345 does not fit in a word.

4.1.4 Dump Text
---------------

Dumps text and numbers. A number can have a size of 1 to 4 bytes. The
text is converted according to the actual pet/screen mode.

Syntax:
     `.text [TERM | TEXT] [,TERM | ,TEXT]...'

Examples:
     .text "poop",0
produces `$50,$4F,$4F,$50,$00' in pet mode or `$10,$0F,$0F,$10,$00' in
screencode mode

     .text $12,$1234,$123456,$12345678
produces `$12, $34,$12, $56,$34,$12, $78,$56,$34,$12'

4.1.5 Dump Petascii
-------------------

Dumps text and numbers. A number can have a size of 1 to 4 bytes. The
text is converted to petascii.

Syntax:

     `.pet [TERM | TEXT] [,TERM | ,TEXT]...'

Examples:
     .pet "poop",0
produces `$50,$4F,$4F,$50,$00'

     .pet $12,$1234,$123456,$12345678
produces `$12, $34,$12, $56,$34,$12, $78,$56,$34,$12'

4.1.6 Dump Screencode
---------------------

Dumps text and numbers. A number can have a size of 1 to 4 bytes. The
text is converted to screencode.

Syntax:

     `.scr [TERM | TEXT] [,TERM | ,TEXT]...'

Examples:
     .scr "poop",0
produces `$10,$0F,$0F,$10,$00'

     .scr $12,$1234,$123456,$12345678
produces `$12, $34,$12, $56,$34,$12, $78,$56,$34,$12'

4.1.7 Switch Segment
--------------------

Switch to a segment. Take a look at the chapter Segments for detailed
info on defining and using segments.

Syntax:
     `.segment NAME'

Examples:
     .segment "gamecode"
Switch to the segment `gamecode'.

     disksegment = "bank3"

     .segment disksegment
Switch to the segment `bank3'.

4.1.8 Set Petascii Mode
-----------------------

Set petascii as the default text format. This affects the conversion of
and string arguments for the .text opcode text converted to numbers
using the '...' syntax

Syntax:
     `.setpet'

Examples:
     .setpet
             lda #'a'
produces `$a9, $41'

     .setpet
             .text "mooh"
             .db 'a'
produces `$4d, $4f, $4f, $48, $41'

4.1.9 Set Screencode Mode
-------------------------

Set screencode as the default text format. This affects the conversion
of and string arguments for the .text opcode text converted to numbers
using the '...' syntax

Syntax:
     `.setscr'

Examples:
     .setscr
             lda #'a'
produces `$a9, $01'

     .setscr
             .text "mooh"
             .db 'a'
produces `$0d, $0f, $0f, $08, $01'

4.1.10 Fill Area
----------------

Fill an area with a value.

Syntax:
     `.dsb SIZE [,FILLYTE]'

Examples:
     .dsb 4
produces `$00, $00, $00, $00'

     .dsb 4,$ab
produces `$ab, $ab, $ab, $ab'

     .dsb 0
produces nothing

4.1.11 Align
------------

Align the PC to a base by inserting a fillbyte. Aligning means after the
.align command the PC will be divisible by base without remainder.

Syntax:
     `.align BASE [,FILLYTE]'

Examples:
     .align $100
     CriticalTiming:
             lda #shiftcol
             bit $ea
             sta $d011
             ...
This aligns the PC to $100, so the routine `CriticalTiming' will start
at the beginning of a page.

             .align $40
     sprite:
     .binclude "sprite.bin"

             ...

             lda #sprite/$40
             sta $07f8
This inserts sprite data at the next possible sprite block.

4.1.12 Open Local Block
-----------------------

Open a local block. A local block capsules the variables defined
inside. All variables defined inside a local block can not be accessed
from outside. The outer variables can be used like usual. See also the
chapter Local Blocks for details.

Syntax:
     `.('

Examples:
     a=4

         .(                  ;open a new local block
             #print a        ;'4' -> a is visible inside the local block
             b=3
         .)                  ;close the local block

     #print b                ;'undefined' -> b is not visible outside

     Note: Every `.(' must have a matching `.)' to close the local
     block.

     Note: Local blocks can be nested, i.e. a local block can contain
     one or more local blocks.

4.1.13 Close Local Block
------------------------

Close a local block.

Syntax:
     `.)'

Please see Open Local Block for examples.

4.1.14 Pseudo PC
----------------

Produce code for a diferent location.

Syntax:
     `.pseudopc ADDRESS'

Examples:
             *=$c000

             sei
             ldx #ClearCodeEnd-ClearCode-1
     copyloop:
             lda ClearCode,x
             sta $0140,x
             dex
             bpl copyloop
             lda #$34
             sta 1
             jmp $0140

     ClearCode:
         .pseudopc $0140
             lda #0
             tax
     selfmod:
             sta $0200,x
             inx
             bne selfmod
             inc selfmod+2
             bne selfmod
             lda #$37
             sta 1
             jmp $fce2
         .realpc
     ClearCodeEnd:
The `.pseudopc $0140' assembles the following code to run at $0140, but
it is still put to $c013.

     Note: Every .pseudopc must have a matching .realpc.

     Note: .pseudopc can be nested.

4.1.15 Real PC
--------------

Stop producing code for a different location.

Syntax:
     `.realpc'

Please see Pseudo PC for examples.

4.2 Preprocessor Directives
===========================

syntax                                      command
-------------------------------------------------------------------------- 
#error [term | text] [,term | ,text]...     Error
#if condition                               If
#ifdef variable                             If Defined
#ifndef variable                            If Not Defined
#elsif condition                            Else If
#elsifdef variable                          Else If Defined
#elsifndef variable                         Else If Not Defined
#else                                       Else
#endif                                      End If
#include "filename"                         Include
#macro name [( [parameter [,                Macro
parameter...]] )]  { [macrotext |           
{parameter}]... }                           
#outfile {"filename" | } [, sort |          Outfile
startadr | fillbyte | "segmentname"]...     
#print [term | text] [,term | ,text]...     Print
#segdef "name" , start-end [, fillup |      Segdef
force | fillbyte | typ | "segmentname"]...  
#warning [term | text] [,term | ,text]...   Warning

Table 4.2: all preprocessor directives

4.2.1 Error
-----------

Generate an error and print a sequence of arguments just like the Print
command. Use in conclusion with If to check vital parameters.

Syntax:
     #error [term | text] [,term | ,text]...

Examples:
     #error
Generate an error with no message

     #if Divisor==0
     #error "The divisor must not be zero!"
     #endif
another way of 'division by zero'

             *=$0100
     StackDepack:
             ...
             rts

     #if *>$01f8
     #error "StackDepack routine is too long. It ends here: ", *
     #endif
Test if a routine on the stack gets too big.

4.2.2 If
--------

Only assemble the next lines if the condition is true (i.e. it
evaluates to a number not equal to 0). See Conditional Assembly for
details and examples.

Syntax:
     #if condition

4.2.3 If Defined
----------------

Only assemble the next lines if the variable is defined. See Conditional
Assembly for details and examples.

Syntax:
     #ifdef variable

4.2.4 If Not Defined
--------------------

Only assemble the next lines if the variable is not defined. See
Conditional Assembly for details and examples.

Syntax:
     #ifndef variable

4.2.5 Else If
-------------

Only assemble the next lines if the condition is true (i.e. it
evaluates to a number not equal to 0) and no prior condition was true.
See Conditional Assembly for details and examples.

Syntax:
     #elsif condition

4.2.6 Else If Defined
---------------------

Only assemble the next lines if the variable is defined and no prior
condition was true. See Conditional Assembly for details and examples.

Syntax:
     #elsifdef variable

4.2.7 Else If Not Defined
-------------------------

Only assemble the next lines if the variable is not defined and no prior
condition was true. See Conditional Assembly for details and examples.

Syntax:
     #elsifndef variable

4.2.8 Else
----------

Only assemble the next lines no prior condition was true. See
Conditional Assembly for details and examples.

Syntax:
     #else

4.2.9 End If
------------

Concludes a block of conditionals. See Conditional Assembly for details
and examples.

Syntax:
     #endif

4.2.10 Include
--------------

Include a file at this position and process the inclosed text. It is
like the file was pasted into the sourcecode.

Syntax:
     #include "filename"

     Note: If the file is not found in the current path, the
     includepaths are serached.

4.2.11 Macro
------------

Define a macro.

Syntax:
     #macro name [( [parameter [, parameter...]] )]
      { [macrotext | {parameter}]... }

For more details and examples take a look at the Macros chapter.

4.2.12 Outfile
--------------

Define an output file.

Syntax:
     #outfile {"filename" | @} [, sort | startadr | fillbyte | "segmentname"]...

For more details and examples take a look at the Outfiles chapter.

4.2.13 Print
------------

Print a sequence of arguments. Arguments are seperated with a comma.

Syntax:
     #print [term | text] [,term | ,text]...

Examples:
     a=4
     cnt_b = 10
     cnt_c = 20

     #print "a is now: ", a

     #print 100-cnt_b," bottles left. ",50-cnt_c," carrots left."
produces an output like this:
     test.src:5: print:"a is now: ", $4
     test.src:7: print:$5a, " bottles left. ", $1e, " carrots left."

4.2.14 Segdef
-------------

Define a segment.

Syntax:
     #segdef "name" , start-end [, fillup | force | fillbyte | typ | "segmentname"]...
For more details and examples take a look at the Segments chapter.

4.2.15 Warning
--------------

Generate a warning. This is intended for non critical errors. A warning
prints a sequence of arguments to stdout just like the #print command.

Syntax:
     #warning [term | text] [,term | ,text]...

Examples:
             ...
     EndOfLongRoutine:
             rts

     #if $8000-*<16
     #warning "space between LongRoutine and AnotherBigOne is running out!"
     #warning "Only ", $8000-* ," bytes left!"
     #endif

             * = $8000
     AnotherBigOne:
             ...
How much space is left between two routines? This will print a warning
if they are getting too close.

5 General Usage
***************

5.1 Macros
==========

Macros are used like 'cut and paste' textsegments with parameters. Just
think of a program using word sized data alot. It would come in very
handy to have an opcode like 'copy_w' which copies the 2 bytes found at
one adress to another. In plain assembler you would use

     lda from
     sta to
     lda from+1
     sta to+1
everytime you want to copy a word. A macro can hide the 4 needed lines
behind one litte name, the identifier.

Definition syntax:
     #macro name [( [parameter [, parameter...]] )]
     { [macrotext | {parameter}]... }

Call Syntax:
     .name [( [parameter [, parameter...]] )]

Definition:
     #macro copy_word (from, to)
     {
             lda {from}
             sta {to}
             lda {from}+1
             sta {to}+1
     }

Call:
     .copy_word (cols, $d020)
Expands to:
             lda cols
             sta $d020
             lda cols+1
             sta $d020+1

Note the lines at the start and end of the macro which only contain the
curled bracket. As everything between the enclosing brackets is used as
macro text, the newlines after the opening and before the closing
bracket are also included. This gets important if you intend to use a
macro in the middle of a line. Take a look at this two examples: The
macro 'func' is used with a 2 dimensional table with 4 rows and 4
columns to calculate the offset of an element.

Definition:
     #macro func(row, col)
     {
             {row}+4*{col}       ;*** This won't work ***
     }
Call:
             ldx #.func(2,1)         ;*** This won't work ***
             lda table,x
This will not work as the macro includes newlines inside the brackets
again. This piece of code expands to:

             ldx #
     2+4*1

             lda table,x
To get rid of these newlines simply place the whole macro in one line:

     #macro func(row, col)
     { {row}+4*{col} }
or
     #macro func(row, col) {{row}+4*{col}}
Both will expand to
             ldx #2+4*1
             lda table,x
So you might ask why macros have these nasty trapdoors, but it's a
feature. It allows you to define macros for a lot of special situations
with a minimum of limitation.

5.2 Conditional Assembly
========================

Conditional assembly is used to adapt a sourcecode to different
situations.  Imagine you have a lot of debug output in your code but
don't want it in public releases. One solution is to comment every
single line with debug output out and after the release back in. That's
quite annoying, but with conditional assembly you can change from debug
to release in no time.

Overview:
     #if condition_0
             text_0
     #elsif condition_1
             text_1
     #elsif condition_2
             text_2

      ...

     #else
             text_n
     #endif

If condition0 is true, i.e. if it evaluates to a number different from
0, text_0 is assembled.

If condition0 is false, i.e. if it evaluates to 0, text_0 is completely
ignored. The syntax is even not checked, so it could be complete
nonsense.

The #elsif's are in general like the first #if, but they are only
evaluated if no previous condition was true.

The #else does not have a condition. It's like a 'if everything else
was false' branch.

Examples:
     #if DEBUG
             lda LittleBugger
             jsr Print
     #endif
This will only be assembled if the variable 'DEBUG' has a value
different from 0. So 'DEBUG=0' turns it off and 'DEBUG=1' on again.

     /* uncomment one of the next 2 lines to switch safety
      * questions on (safety) or off (risky)
      */
     VERSION="risky"
     ;VERSION="safety"

      ...

     #if VERSION=="safety"
             jsr AskYesNo
             bcs Abort
     #endif
             jsr FormatDisk

Not all people like safety questions while others can't do without
(like me).  With conditional assembly it is easy to build two different
versions

     #if 3*3==6
             #error "Am I Pipi Langstrumpf?"
     #elsif 1+1=1
             #error "I don't feel so well today..."
     #else
             #print "Phew, I'm still up to it!"
     #endif
A little selftest.

5.3 Segments
============

By default DreamAss has no memory restrictions. The code can be
assembled to any place from $0000 to $ffff. Several situations make it
necessary to change this:
   * You are developing a cartridge. Let's say it has 1 bank from $8000
     to $c000. It would be fatal if your code exceeds these boundaries.
     A segment can limit the useable memory to the cartridge's range.

   * A carefully planned project splits the memory in an area for code,
     one for constant data and one for working space. Segments reflect
     this concept very closely and make it easy to switch between the
     differen output locations.

Definition syntax:
     #segdef "name" , start-end [, fillup | force | fillbyte | typ | "segmentname"]...

"name" is an identifier for the segment. It is used to switch to the
segment (see .segment).

start-end defines the addressrange of this segment. start is the
startaddress.  end is the last address of the segment + 1. To define a
segment which can use the addresses 3,4 and 5 the addressrange is 3-6 .

fillup enforces the specified addressrange even if the segment is not
completely filled. If fillup is not present the segment's size depends
on it's contents. If fillup is present the segment is always filled up
to the complete addressrange. The default is no fillup.

If a segment is empty, it is not written to a file, even if fillup is
present.  If force is present, empty segments are filled up with the
fillbyte and written to a file. The default is no force.

fillbyte is used to fill up gaps between the segment's contents. The
default fillbyte is $00.

typ specifies the typ of the segment. It can be one of the following:
   * abs is a segment with no special attributes

   * zp is a zeropage segment. Start and End can only be between $00
     and $100.

   * bss is a non-initialized segment. This means only addresses are
     defined.
The default is abs.

Switch syntax:
             .segment name

Examples:
     #segdef "code",$0800-$1000
     #segdef "gfx",$4000-$8000

     .segment "code"                 ;enter the code segment
             *=$0801
     ;basicstart
             .word bas_end
             .word 2003
             .byte $9e               ;sys
             .pet "2061"
             .byte 0
     bas_end:
             .word 0

             lda #2
             sta $dd00
             lda #$3b
             sta $d011
             lda #$18
             sta $d016
             lda #$80
             sta $d018

             ldx #0
     copyd8:
             lda pic_d8,x
             sta $d800,x
             lda pic_d8+$100,x
             sta $d900,x
             lda pic_d8+$200,x
             sta $da00,x
             lda pic_d8+$300,x
             sta $db00,x
             inx
             bne copyd8

     stop:
             jmp stop

     ;--------------------------------------

     .segment "gfx"                          ;enter the gfx segment

             *=$4000
     .binclude "koalapic.prg",2,8000         ;include the bitmap

             *=$6000
     .binclude "koalapic.prg",8002,1000      ;include the screenram

             *=$6400
     pic_d8:
     .binclude "koalapic.prg",9002,1000      ;include the colorram

A little koala viewer.

5.4 Outfiles
============

The normal behavior of dreamass is to write all object code to the file
specified with the -o commandline option. If no -o was present, the
file "a.out" is used instead. All segments are sorted and gaps between
them are filled with $00, just like a simple linker. A startaddress is
prepended to the file.

This works great for most situations, but in some special cases the
defaults need to be changed. Some examples:

   * The source for a cartridge consists of several banks. All of them
     have the same startaddress. The linker would detect an overlap of
     all segments and refuse to process them.

   * A complex tool has 2 separate subsections which should stay packed
     in the memory until they are used. Both sections and the main part
     are written to one file each. Then the two subsections are packed
     and linked to the main binary.

   * The binary should not have a start address.

To define output files, the #outfile command is used.

Syntax:

     #outfile {"filename" | @ } [, sort | startadr | fillbyte | "segmentname"]...

"filename" is the name for the object file. For some philosophic reasons
variables can not be used here, only plain strings.

@ can be used as an alternative to "filename". It represents the
filename specified with the -o commandline option or "a.out" if no -o
was present.

Every file must have a name, so every #outfile must start with
"filename" or @.

sort enables sorting of the segments in this outfile. If sort is
present in the outfile definition, all included segments are sorted by
their startaddress and gaps between the segments are filled with the
fillbyte (see below). This works very much like a simple linker. If two
or more segments overlap, i.e. they use (partially or completely) the
same address range, assembly stops with an error.  If there is no sort,
all segments are just written to the outfile in the order of their
appearence in the definition. No checking is done so segments can
overlap as they like. By default sorting is off.

If startadr is present, the address of the first segment is prepended
to the file. This is exactly the same as the startaddress in C64 prg
files. The default is no startaddress.

The fillbyte is used only if sorting is enabled. If two adjacent
segments have a gap between them, it is filled with this byte. For some
philosophic reasons variables can not be used here, only plain numbers.
The default fillbyte is $00.

"segmentname" is a segment to write to this file. If sorting is
disabled, it is possible to use the same segment more than once in a
file (sounds stupid, but is very handy sometimes).

Examples:

     #outfile "bank0.bin", "bank0"
     #outfile "bank1.bin", "bank1"
Write the segment "bank0" to the file "bank0.bin" and "bank1" to the
file "bank1.bin". No startaddress is written for both files.

     #outfile "toki-o.bin", "bank0", "common", "bank1", "common"
Write the segments "bank0", "common", "bank1" and again "common" to the
file "toki-o.bin". No startaddress is written.

     #outfile @, sort, startadr, $bd, "code", "bitmap", "color", "d8", "sfx"
Write the segments "code", "bitmap", "color", "d8" and "sfx" to the file
specified with the -o commandline switch (or "a.out"). 'sort' is
present so the segments are sorted by their startaddress. $bd is the
fillbyte to fill gaps between the segments. A startaddress is prepended
to the file.

5.5 Terms
=========

Whenever a command expects a number or a text it can be specified by a
term. The following arithmetics may be used:

symbol         function
-------------------------------------------------------------------------- 
`isdef'        test if a variable is defined
`segmentof'    get the name of the segment where a variable was defined
               or modified
`~'            bit not
`++'           increment, pre or post
`--'           decrement, pre or post
`+'            positive sign or addition
`-'            negative sign or subtraction
`*'            multiply or PC
`/'            divide
`mod'          modulo
`>>'           shift right
`<<'           shift left
`>'            greater or high byte
`>='           greater or equal
`<'            smaller or low byte
`<='           smaller or equal
`=='           equal
`!='           not equal
`&'            bit and
`^'            bit eor
`|'            bit or
`&&'           boolean and
`||'           boolean or
`='            assign
`:='           reassign
`*='           multiply and assign
`/='           divide and assign
`mod='         modulo and assign
`+='           add and assign
`-='           subtract and assign
`>>='          shift right and assign
`<<='          shift left and assign
`&='           bit and and assign
`^='           bit eor and assign
`|='           bit or and assign

Table 5.1: symbols for all operands

prioritysymbols
-------------------------------------------------------------------------- 
13      `isdef',  `segmentof'
12      `~',  `++' (postunary),  `++' (preunary),  `--' (postunary),
        `--' (preunary),  `+' (sign),  `-' (sign)
11      `*',  `/',  `mod'
10      `+' (addition),  `-' (subtraction)
9       `<<',  `>>'
8       `<' (binary: less than),  `<=',  `>=',  `>'  (binary: greater
        than)
7       `==',  `!='
6       `&',  `>' (unary: high byte),  `<' (unary: low byte)
5       `^'
4       `|'
3       `&&'
2       `||'
1       `=',  `:=',  `*=',  `/=',  `mod=',  `+=',  `-=',  `<<=',  `>>=',
        `&=',  `^=',  `|='

Table 5.2: priority of the operands

The priority determines the order in which operators are evaluated. The
operator with the highest priority is evaluated first. 2 + 3 * 4 is the
same as 2 + (3*4) The priority of a multiplication is 11, for an
addition it's 10. Thus the multiplication is evaluated first.

Operators with the same priority are executed from left to right.  3 -
2 + 1 is the same as (3-2) + 1

Example: All lines produce the same output
     .dw c002
     .dw 49152+8>>2
     .dw (8+4)*$1000 + 2

5.6 Local Blocks
================

The '.(' and '.)' operators create a local block. It capsules the
variables defined inside. They can not be reached outside.

        .(          ; local block start
             a=5
        .)          ; local block end

     #print a       ; will show "undefined"
This example defines the variable 'a' with the value 5 inside a local
block. It can not be accessed outside the block, the '#print' statement
will show 'undefined'.

Local blocks can be nested, which is shown in the next example. Each
block has a level-number which indicates how deep the nesting is.
     ;here is level 0
        .(
             ;here is level 1
                .(
                     ;here is level 2
                        .(
                             ;here is level 3
                        .)
                     ;here is level 2
                        .(
                             ;another level 3
                        .)
                     ;here is level 2
                .)
             ;here is level 1
        .)
     ;here is level 0

Variables are visible in all subjacent local blocks, but not in lower
levels:
        .(
                .(
                     a=7
                        .(
                             ;a is visible
                        .)
                     ;a is visible
                        .(
                             ;a is visible
                        .)
                     ;a is visible
                .)
             ;a is not visible
        .)
     ;a is not visible

The '@' operator changes the local block to operate in for a variable.
The syntax is:

     @ [level] {labelname}

If 'level' is omitted, the current level is used.

Examples:
        .(
                .(
                     a=6
                     @0b=7
                     @1c=8
                     @d=9
                .)
        .)
'a' is defined without modification of the level.This means: either a
definition of lower blocks is modified or a new local definition is
assigned. 'b' is defined in level 0, so it's a global variable which is
visible in every local block. 'c' is defined in level 1. This is 1
level above the current one. 'd' is defined without any levelnumber.
This means it's defined in the current level, even if the variabel was
already defined in lower levels. This syntax is useful to force a label
to be local.

The '@' operator is also useful to force a new local definition of a
label. The next example starts with a definition of the variable 'a' in
level 0. This means it's visible in all local blocks. Therefore the
statement 'a=6' inside the local block does not create a new instance
of 'a'. The global variable is modified instead.
     a=5
        .(
             a=6    ;modification of the variable level 0
        .)
     #print a       ;this is 6

To avoid this behaviour, the '@' operator is used to force a new, local
instance of 'a'.
     a=5
        .(
             @a=6   ;now the definition is forced to local
        .)
     #print a       ;5

The '@' operator can not only be used at definition time. In the next
example it is used to select local instances of the variable a.
     a=5
        .(
             @a=6
                .(
                     @a=7

                     #print @0a    ;shows level 0 value of a: 5
                     #print @1a    ;shows level 1 value of a: 6
                     #print @2a    ;shows level 2 value of a: 7
                .)
        .)

Appendix A History
******************

26.03.2006
==========

     New:


        * `--version' command

        * man page

        * More than one sourcefile

        * rule for Debian packet in Makefile (try 'make deb')

        * changed crosscompiler to djgpp, now dreamass runs from plain
          dos

     Fixed:


        * rewrote output from `--help' to match help2man's requrements

        * tricky use of unedfined variabled produced endless assemble
          passes

        * `.text' with an undefined variable resulted in a crash if
          this var turned out to be numeric later

        * use of undefined macro shows strange error, but not something
          like "macro undefined"

        * Macro redefinition now results in an errormessage

        * a single `jsr' was accepted

        * Undef variable in `.DP' caused endless passes too, but only
          if `-d' was not set.

        * Printing a string with `#print' freed the memory

27.02.2005
==========

     Fixed:


        * Unmatched `.)' resulted in an assertion instead of an error

19.02.2005
==========

     Fixed:


        * `.text' did not respect forced sizes of numeric arguments

30.01.2005
==========

     New:


        * new opcodes: 65816 and 6510Illegals

        * new pseudo opcodes: `.asize', `.xysize', `.cpu'

     Fixed:


        * fixed small bug in errormessage for undefined segments

        * by default (no `#outfile' directive) zp and bss segments are
          not written to the output file.

21.08.2004
==========

     New:


        * operator for terms: '.' forces the size of a numeric value.
          example : $50.2 forces a word, this is useful to prevent
          warnings in situations like `sta $50,y'

        * operator: `sizeof' 		gets the size of it's argument in
          bytes. the pc is fixed to 2 bytes.  		examples:
               	a=$12 : #print sizeof a   ; 1
               	b=$1234 : #print sizeof b ; 2
               	#print sizeof *           ; 2
               	#print sizeof "abcdef"    ; 6


        * set length of values in the label dump to a multiple of 2.
          e.g 2 will be printed as $02

29.04.2004
==========

     New:


        * `@' operator docs

        * warning if .PSEUDOPC block level at start of file is not
          equal to end

        * Macros must start with the identifier '.' . This prevents
          strange errors if macros are not defined but used

     Fixed:


        * Missing Endline at end of file crashed

        * Unmatched `.PSEUDOPC' or `.REALPC' produced no error

        * macro without parameter did not work

2004.02.22
==========

     New:


        * Old historyfile was out of date, no hope to catch up. :( 	This
          is a new start. Maybe it will last a bit longer.

     Fixed:


        * 'sort' option for the `#outfile' command crashed

        * again some memory leaks

2004.02.10
==========

     Fixed:


        * memory leak in term generation

        * `#outfile' with 'sort' option for only 1 segment while more
          segments defined failed

        * Parse order of included files

2003.09.27
==========

     New:


        * ':' concats several assembler statements in one line
          example:
               	ldx #0 : label : stx $d020 : inx : bne label


        * `--help' command for the commandline

     Fixed:


        * pet and scr mode was not saved over several passes

2003.08.20
==========

     New:


        * isdef Operator docs

     Fixed:


        * PC definition with `* =' did not work, only `*='

2003.07.02
==========

     Fixed:


        * segment and segelem overlaps were not recognized properly

2003.06.19
==========

     New:


        * check if indirect jmp argument starts at last byte of a page
          Thanks to Groepaz for the idea!

2003.05.11
==========

     Fixed:


        * Better errorhandling in Opcode parser

2003.05.07
==========

     Fixed:


        * some nasty bugs in scanner

     New:


        * variables can be strings now

        * new number format: 'xy', up to 4 chars are converted to a
          number

Appendix B Copying This Manual
******************************

B.1 GNU Free Documentation License
==================================

                      Version 1.2, November 2002

     Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
     51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA

     Everyone is permitted to copy and distribute verbatim copies
     of this license document, but changing it is not allowed.

  0. PREAMBLE

     The purpose of this License is to make a manual, textbook, or other
     functional and useful document "free" in the sense of freedom: to
     assure everyone the effective freedom to copy and redistribute it,
     with or without modifying it, either commercially or
     noncommercially.  Secondarily, this License preserves for the
     author and publisher a way to get credit for their work, while not
     being considered responsible for modifications made by others.

     This License is a kind of "copyleft", which means that derivative
     works of the document must themselves be free in the same sense.
     It complements the GNU General Public License, which is a copyleft
     license designed for free software.

     We have designed this License in order to use it for manuals for
     free software, because free software needs free documentation: a
     free program should come with manuals providing the same freedoms
     that the software does.  But this License is not limited to
     software manuals; it can be used for any textual work, regardless
     of subject matter or whether it is published as a printed book.
     We recommend this License principally for works whose purpose is
     instruction or reference.

  1. APPLICABILITY AND DEFINITIONS

     This License applies to any manual or other work, in any medium,
     that contains a notice placed by the copyright holder saying it
     can be distributed under the terms of this License.  Such a notice
     grants a world-wide, royalty-free license, unlimited in duration,
     to use that work under the conditions stated herein.  The
     "Document", below, refers to any such manual or work.  Any member
     of the public is a licensee, and is addressed as "you".  You
     accept the license if you copy, modify or distribute the work in a
     way requiring permission under copyright law.

     A "Modified Version" of the Document means any work containing the
     Document or a portion of it, either copied verbatim, or with
     modifications and/or translated into another language.

     A "Secondary Section" is a named appendix or a front-matter section
     of the Document that deals exclusively with the relationship of the
     publishers or authors of the Document to the Document's overall
     subject (or to related matters) and contains nothing that could
     fall directly within that overall subject.  (Thus, if the Document
     is in part a textbook of mathematics, a Secondary Section may not
     explain any mathematics.)  The relationship could be a matter of
     historical connection with the subject or with related matters, or
     of legal, commercial, philosophical, ethical or political position
     regarding them.

     The "Invariant Sections" are certain Secondary Sections whose
     titles are designated, as being those of Invariant Sections, in
     the notice that says that the Document is released under this
     License.  If a section does not fit the above definition of
     Secondary then it is not allowed to be designated as Invariant.
     The Document may contain zero Invariant Sections.  If the Document
     does not identify any Invariant Sections then there are none.

     The "Cover Texts" are certain short passages of text that are
     listed, as Front-Cover Texts or Back-Cover Texts, in the notice
     that says that the Document is released under this License.  A
     Front-Cover Text may be at most 5 words, and a Back-Cover Text may
     be at most 25 words.

     A "Transparent" copy of the Document means a machine-readable copy,
     represented in a format whose specification is available to the
     general public, that is suitable for revising the document
     straightforwardly with generic text editors or (for images
     composed of pixels) generic paint programs or (for drawings) some
     widely available drawing editor, and that is suitable for input to
     text formatters or for automatic translation to a variety of
     formats suitable for input to text formatters.  A copy made in an
     otherwise Transparent file format whose markup, or absence of
     markup, has been arranged to thwart or discourage subsequent
     modification by readers is not Transparent.  An image format is
     not Transparent if used for any substantial amount of text.  A
     copy that is not "Transparent" is called "Opaque".

     Examples of suitable formats for Transparent copies include plain
     ASCII without markup, Texinfo input format, LaTeX input format,
     SGML or XML using a publicly available DTD, and
     standard-conforming simple HTML, PostScript or PDF designed for
     human modification.  Examples of transparent image formats include
     PNG, XCF and JPG.  Opaque formats include proprietary formats that
     can be read and edited only by proprietary word processors, SGML or
     XML for which the DTD and/or processing tools are not generally
     available, and the machine-generated HTML, PostScript or PDF
     produced by some word processors for output purposes only.

     The "Title Page" means, for a printed book, the title page itself,
     plus such following pages as are needed to hold, legibly, the
     material this License requires to appear in the title page.  For
     works in formats which do not have any title page as such, "Title
     Page" means the text near the most prominent appearance of the
     work's title, preceding the beginning of the body of the text.

     A section "Entitled XYZ" means a named subunit of the Document
     whose title either is precisely XYZ or contains XYZ in parentheses
     following text that translates XYZ in another language.  (Here XYZ
     stands for a specific section name mentioned below, such as
     "Acknowledgements", "Dedications", "Endorsements", or "History".)
     To "Preserve the Title" of such a section when you modify the
     Document means that it remains a section "Entitled XYZ" according
     to this definition.

     The Document may include Warranty Disclaimers next to the notice
     which states that this License applies to the Document.  These
     Warranty Disclaimers are considered to be included by reference in
     this License, but only as regards disclaiming warranties: any other
     implication that these Warranty Disclaimers may have is void and
     has no effect on the meaning of this License.

  2. VERBATIM COPYING

     You may copy and distribute the Document in any medium, either
     commercially or noncommercially, provided that this License, the
     copyright notices, and the license notice saying this License
     applies to the Document are reproduced in all copies, and that you
     add no other conditions whatsoever to those of this License.  You
     may not use technical measures to obstruct or control the reading
     or further copying of the copies you make or distribute.  However,
     you may accept compensation in exchange for copies.  If you
     distribute a large enough number of copies you must also follow
     the conditions in section 3.

     You may also lend copies, under the same conditions stated above,
     and you may publicly display copies.

  3. COPYING IN QUANTITY

     If you publish printed copies (or copies in media that commonly
     have printed covers) of the Document, numbering more than 100, and
     the Document's license notice requires Cover Texts, you must
     enclose the copies in covers that carry, clearly and legibly, all
     these Cover Texts: Front-Cover Texts on the front cover, and
     Back-Cover Texts on the back cover.  Both covers must also clearly
     and legibly identify you as the publisher of these copies.  The
     front cover must present the full title with all words of the
     title equally prominent and visible.  You may add other material
     on the covers in addition.  Copying with changes limited to the
     covers, as long as they preserve the title of the Document and
     satisfy these conditions, can be treated as verbatim copying in
     other respects.

     If the required texts for either cover are too voluminous to fit
     legibly, you should put the first ones listed (as many as fit
     reasonably) on the actual cover, and continue the rest onto
     adjacent pages.

     If you publish or distribute Opaque copies of the Document
     numbering more than 100, you must either include a
     machine-readable Transparent copy along with each Opaque copy, or
     state in or with each Opaque copy a computer-network location from
     which the general network-using public has access to download
     using public-standard network protocols a complete Transparent
     copy of the Document, free of added material.  If you use the
     latter option, you must take reasonably prudent steps, when you
     begin distribution of Opaque copies in quantity, to ensure that
     this Transparent copy will remain thus accessible at the stated
     location until at least one year after the last time you
     distribute an Opaque copy (directly or through your agents or
     retailers) of that edition to the public.

     It is requested, but not required, that you contact the authors of
     the Document well before redistributing any large number of
     copies, to give them a chance to provide you with an updated
     version of the Document.

  4. MODIFICATIONS

     You may copy and distribute a Modified Version of the Document
     under the conditions of sections 2 and 3 above, provided that you
     release the Modified Version under precisely this License, with
     the Modified Version filling the role of the Document, thus
     licensing distribution and modification of the Modified Version to
     whoever possesses a copy of it.  In addition, you must do these
     things in the Modified Version:

       A. Use in the Title Page (and on the covers, if any) a title
          distinct from that of the Document, and from those of
          previous versions (which should, if there were any, be listed
          in the History section of the Document).  You may use the
          same title as a previous version if the original publisher of
          that version gives permission.

       B. List on the Title Page, as authors, one or more persons or
          entities responsible for authorship of the modifications in
          the Modified Version, together with at least five of the
          principal authors of the Document (all of its principal
          authors, if it has fewer than five), unless they release you
          from this requirement.

       C. State on the Title page the name of the publisher of the
          Modified Version, as the publisher.

       D. Preserve all the copyright notices of the Document.

       E. Add an appropriate copyright notice for your modifications
          adjacent to the other copyright notices.

       F. Include, immediately after the copyright notices, a license
          notice giving the public permission to use the Modified
          Version under the terms of this License, in the form shown in
          the Addendum below.

       G. Preserve in that license notice the full lists of Invariant
          Sections and required Cover Texts given in the Document's
          license notice.

       H. Include an unaltered copy of this License.

       I. Preserve the section Entitled "History", Preserve its Title,
          and add to it an item stating at least the title, year, new
          authors, and publisher of the Modified Version as given on
          the Title Page.  If there is no section Entitled "History" in
          the Document, create one stating the title, year, authors,
          and publisher of the Document as given on its Title Page,
          then add an item describing the Modified Version as stated in
          the previous sentence.

       J. Preserve the network location, if any, given in the Document
          for public access to a Transparent copy of the Document, and
          likewise the network locations given in the Document for
          previous versions it was based on.  These may be placed in
          the "History" section.  You may omit a network location for a
          work that was published at least four years before the
          Document itself, or if the original publisher of the version
          it refers to gives permission.

       K. For any section Entitled "Acknowledgements" or "Dedications",
          Preserve the Title of the section, and preserve in the
          section all the substance and tone of each of the contributor
          acknowledgements and/or dedications given therein.

       L. Preserve all the Invariant Sections of the Document,
          unaltered in their text and in their titles.  Section numbers
          or the equivalent are not considered part of the section
          titles.

       M. Delete any section Entitled "Endorsements".  Such a section
          may not be included in the Modified Version.

       N. Do not retitle any existing section to be Entitled
          "Endorsements" or to conflict in title with any Invariant
          Section.

       O. Preserve any Warranty Disclaimers.

     If the Modified Version includes new front-matter sections or
     appendices that qualify as Secondary Sections and contain no
     material copied from the Document, you may at your option
     designate some or all of these sections as invariant.  To do this,
     add their titles to the list of Invariant Sections in the Modified
     Version's license notice.  These titles must be distinct from any
     other section titles.

     You may add a section Entitled "Endorsements", provided it contains
     nothing but endorsements of your Modified Version by various
     parties--for example, statements of peer review or that the text
     has been approved by an organization as the authoritative
     definition of a standard.

     You may add a passage of up to five words as a Front-Cover Text,
     and a passage of up to 25 words as a Back-Cover Text, to the end
     of the list of Cover Texts in the Modified Version.  Only one
     passage of Front-Cover Text and one of Back-Cover Text may be
     added by (or through arrangements made by) any one entity.  If the
     Document already includes a cover text for the same cover,
     previously added by you or by arrangement made by the same entity
     you are acting on behalf of, you may not add another; but you may
     replace the old one, on explicit permission from the previous
     publisher that added the old one.

     The author(s) and publisher(s) of the Document do not by this
     License give permission to use their names for publicity for or to
     assert or imply endorsement of any Modified Version.

  5. COMBINING DOCUMENTS

     You may combine the Document with other documents released under
     this License, under the terms defined in section 4 above for
     modified versions, provided that you include in the combination
     all of the Invariant Sections of all of the original documents,
     unmodified, and list them all as Invariant Sections of your
     combined work in its license notice, and that you preserve all
     their Warranty Disclaimers.

     The combined work need only contain one copy of this License, and
     multiple identical Invariant Sections may be replaced with a single
     copy.  If there are multiple Invariant Sections with the same name
     but different contents, make the title of each such section unique
     by adding at the end of it, in parentheses, the name of the
     original author or publisher of that section if known, or else a
     unique number.  Make the same adjustment to the section titles in
     the list of Invariant Sections in the license notice of the
     combined work.

     In the combination, you must combine any sections Entitled
     "History" in the various original documents, forming one section
     Entitled "History"; likewise combine any sections Entitled
     "Acknowledgements", and any sections Entitled "Dedications".  You
     must delete all sections Entitled "Endorsements."

  6. COLLECTIONS OF DOCUMENTS

     You may make a collection consisting of the Document and other
     documents released under this License, and replace the individual
     copies of this License in the various documents with a single copy
     that is included in the collection, provided that you follow the
     rules of this License for verbatim copying of each of the
     documents in all other respects.

     You may extract a single document from such a collection, and
     distribute it individually under this License, provided you insert
     a copy of this License into the extracted document, and follow
     this License in all other respects regarding verbatim copying of
     that document.

  7. AGGREGATION WITH INDEPENDENT WORKS

     A compilation of the Document or its derivatives with other
     separate and independent documents or works, in or on a volume of
     a storage or distribution medium, is called an "aggregate" if the
     copyright resulting from the compilation is not used to limit the
     legal rights of the compilation's users beyond what the individual
     works permit.  When the Document is included in an aggregate, this
     License does not apply to the other works in the aggregate which
     are not themselves derivative works of the Document.

     If the Cover Text requirement of section 3 is applicable to these
     copies of the Document, then if the Document is less than one half
     of the entire aggregate, the Document's Cover Texts may be placed
     on covers that bracket the Document within the aggregate, or the
     electronic equivalent of covers if the Document is in electronic
     form.  Otherwise they must appear on printed covers that bracket
     the whole aggregate.

  8. TRANSLATION

     Translation is considered a kind of modification, so you may
     distribute translations of the Document under the terms of section
     4.  Replacing Invariant Sections with translations requires special
     permission from their copyright holders, but you may include
     translations of some or all Invariant Sections in addition to the
     original versions of these Invariant Sections.  You may include a
     translation of this License, and all the license notices in the
     Document, and any Warranty Disclaimers, provided that you also
     include the original English version of this License and the
     original versions of those notices and disclaimers.  In case of a
     disagreement between the translation and the original version of
     this License or a notice or disclaimer, the original version will
     prevail.

     If a section in the Document is Entitled "Acknowledgements",
     "Dedications", or "History", the requirement (section 4) to
     Preserve its Title (section 1) will typically require changing the
     actual title.

  9. TERMINATION

     You may not copy, modify, sublicense, or distribute the Document
     except as expressly provided for under this License.  Any other
     attempt to copy, modify, sublicense or distribute the Document is
     void, and will automatically terminate your rights under this
     License.  However, parties who have received copies, or rights,
     from you under this License will not have their licenses
     terminated so long as such parties remain in full compliance.

 10. FUTURE REVISIONS OF THIS LICENSE

     The Free Software Foundation may publish new, revised versions of
     the GNU Free Documentation License from time to time.  Such new
     versions will be similar in spirit to the present version, but may
     differ in detail to address new problems or concerns.  See
     `http://www.gnu.org/copyleft/'.

     Each version of the License is given a distinguishing version
     number.  If the Document specifies that a particular numbered
     version of this License "or any later version" applies to it, you
     have the option of following the terms and conditions either of
     that specified version or of any later version that has been
     published (not as a draft) by the Free Software Foundation.  If
     the Document does not specify a version number of this License,
     you may choose any version ever published (not as a draft) by the
     Free Software Foundation.

B.1.1 ADDENDUM: How to use this License for your documents
----------------------------------------------------------

To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and license
notices just after the title page:

       Copyright (C)  YEAR  YOUR NAME.
       Permission is granted to copy, distribute and/or modify this document
       under the terms of the GNU Free Documentation License, Version 1.2
       or any later version published by the Free Software Foundation;
       with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
       Texts.  A copy of the license is included in the section entitled ``GNU
       Free Documentation License''.

If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
replace the "with...Texts." line with this:

         with the Invariant Sections being LIST THEIR TITLES, with
         the Front-Cover Texts being LIST, and with the Back-Cover Texts
         being LIST.

If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.

If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License, to
permit their use in free software.

List of Tables
**************

Table 3.1: all commandline options             See 3.
Table 3.2: the basic warning tags              See 3.10.
Table 3.3: the special warning tags            See 3.10.
Table 4.1: all pseudo opcodes                  See 4.1.
Table 4.2: all preprocessor directives         See 4.2.
Table 5.1: symbols for all operands            See 5.5.
Table 5.2: priority of the operands            See 5.5.

Concept Index
*************

Command Line Options, Add Include path:        See 3.9.      (line  435)
Command Line Options, Define variable:         See 3.2.      (line  301)
Command Line Options, Modify Warning Level:    See 3.10.     (line  467)
Command Line Options, Overview:                See 3.        (line  259)
Command Line Options, Select Output File:      See 3.8.      (line  416)
Command Line Options, Set Debug Mode:          See 3.1.      (line  281)
Command Line Options, Set Error Logging:       See 3.4.      (line  335)
Command Line Options, Set Label Logging:       See 3.5.      (line  353)
Command Line Options, Set the maximum number of errors:See 3.6.
                                                             (line  370)
Command Line Options, Set the maximum number of warnings:See 3.7.
                                                             (line  394)
Command Line Options, Set Verbose Mode:        See 3.3.      (line  313)
Command Line Options, Show Help:               See 3.12.     (line  547)
Command Line Options, Simple Redefines:        See 3.11.     (line  524)
Command Reference, Overview:                   See 4.        (line  563)
Compilation of the source distribution:        See 2.4.      (line  203)
Conditional Assembly:                          See 5.2.      (line 1201)
Debugging DreamAss:                            See 2.5.      (line  220)
FDL, GNU Free Documentation License:           See B.1.      (line 1876)
General Usage:                                 See 5.        (line 1123)
How to obtain DreamAss:                        See 2.1.      (line  146)
Index:
          See ``Concept Index''.                             (line 2316)
Installation:                                  See 2.        (line  143)
Local Blocks:                                  See 5.6.      (line 1540)
Macros:                                        See 5.1.      (line 1126)
Outfiles:                                      See 5.4.      (line 1379)
Porting DreamAss:                              See 2.3.      (line  166)
Preface:                                       See 1.        (line  106)
Preprocessor Directives, Else:                 See 4.2.8.    (line 1018)
Preprocessor Directives, Else If:              See 4.2.5.    (line  990)
Preprocessor Directives, Else If Defined:      See 4.2.6.    (line 1000)
Preprocessor Directives, Else If Not Defined:  See 4.2.7.    (line 1009)
Preprocessor Directives, End If:               See 4.2.9.    (line 1027)
Preprocessor Directives, Error:                See 4.2.1.    (line  934)
Preprocessor Directives, If:                   See 4.2.2.    (line  962)
Preprocessor Directives, If Defined:           See 4.2.3.    (line  972)
Preprocessor Directives, If Not Defined:       See 4.2.4.    (line  981)
Preprocessor Directives, Include:              See 4.2.10.   (line 1036)
Preprocessor Directives, Macro:                See 4.2.11.   (line 1048)
Preprocessor Directives, Outfile:              See 4.2.12.   (line 1059)
Preprocessor Directives, Overview:             See 4.2.      (line  907)
Preprocessor Directives, Print:                See 4.2.13.   (line 1069)
Preprocessor Directives, Segdef:               See 4.2.14.   (line 1089)
Preprocessor Directives, Warning:              See 4.2.15.   (line 1098)
Pseudo Opcodes, Align:                         See 4.1.11.   (line  787)
Pseudo Opcodes, Binary Include:                See 4.1.1.    (line  599)
Pseudo Opcodes, Close Local Block:             See 4.1.13.   (line  843)
Pseudo Opcodes, Dump Bytes:                    See 4.1.2.    (line  626)
Pseudo Opcodes, Dump Petascii:                 See 4.1.5.    (line  677)
Pseudo Opcodes, Dump Screencode:               See 4.1.6.    (line  694)
Pseudo Opcodes, Dump Text:                     See 4.1.4.    (line  660)
Pseudo Opcodes, Dump Words:                    See 4.1.3.    (line  642)
Pseudo Opcodes, Fill Area:                     See 4.1.10.   (line  769)
Pseudo Opcodes, Open Local Block:              See 4.1.12.   (line  816)
Pseudo Opcodes, Overview:                      See 4.1.      (line  566)
Pseudo Opcodes, Pseudo PC:                     See 4.1.14.   (line  853)
Pseudo Opcodes, Real PC:                       See 4.1.15.   (line  897)
Pseudo Opcodes, Set Petascii Mode:             See 4.1.8.    (line  729)
Pseudo Opcodes, Set Screencode Mode:           See 4.1.9.    (line  749)
Pseudo Opcodes, Switch Segment:                See 4.1.7.    (line  711)
Requirements:                                  See 2.2.      (line  154)
Segments:                                      See 5.3.      (line 1273)
Terms:                                         See 5.5.      (line 1459)
