/*
 * Copyright 1992 Stan Burton
 *
 * Permission to use, copy, modify, distribute, and sell this software
 * and its documentation for any purpose is hereby granted without fee,
 * provided that the above copyright notice appear in all copies and
 * that both that copyright notice and this permission notice appear in
 * supporting documentation, and that the name of Stan Burton not be used
 * in advertising or publicity pertaining to distribution of the software
 * without specific, written prior permission.  I make no representations
 * about the suitability of  this software for any purpose.  It is
 * provided "as is" without express or implied warranty.
 *
 * THE ABOVE-NAMED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO EVENT
 * SHALL STAN BURTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
 * OF THIS SOFTWARE.
 *
 * Author:
 *		Stan Burton
 *
 *		1978 26 St. SE
 *		Medicine Hat, AB, CANADA
 *              T1A 2G8
 */

SOME OF THESE PROGRAMS REQUIRE AMIGADOS 2.0

slink requires V2.0, slink1.3 is a slower AmigaDOS V1.3 compatible
replacement for slink.  All other programs are V1.3 and 2.0 compatible.


INSTALLATION

Installation is simple. If you are reading this, and logically you must
be, then step 1 is done.
 2.  The directory containing this file and the other files unpacked from
       the archive should be added to your path (see warning about slink
       below).
 3.  Assign ADev11: to this directory.  This is required mainly for the
       C compiler.
 4.  Read the docs! I know you won't until you run into trouble, but make
       sure you have read them before you come to me for help.


CONVERTING FROM MOTOROLA STANDARD FORMAT

This assembler differs from the Motorola format in a few ways that will
be noticed when you try to assemble such a file.

1. The '*' used to indicate current address is replaced with '.'.
2. The usage 'sym1 equ *' would translate to 'sym1 equ .' which has a
     bug (see bug list); it should really be just 'sym1'.
3. String constants are enclosed in double quotes instead of single
     quotes.
4. The bit operands had a space separating the mask and label (if one),
     This assembler uses a comma to separate these.
5. The arguments of bit operations such as BRCLR and BRSET must be
     separated by commas; not spaces as in the Motorola format.
6. Sasm requires a PROCESSOR pseudo-op at the start of the source file.
     Without it there are no instruction mnemonics only pseudo-ops.

Other problems, unrelated to the format are;

1. Most Motorola files did not use segments, they must be used here.


COMMON PROBLEMS

slink reports 'Error 600: Invalid command MEM'
        You own SAS/C 6.x and are seeing a name clash.  You will have
          to refer to slink using a path, usually ADev11:slink
slink reports 'unknown hunk type'
	the assembler may have been aborted leaving a partial file
	the assembler source file may have code outside of a segment
sc11 reports a problem in byte_length
	certain errors in the C source file may cause SC11 to emit
	  68000 instructions.  For example
	    char c, *chr_ptr;
	    c = *(char *)*chr_ptr;
	this may be a legitimate bug.  If there is nothing wrong
	  with the C source, reduce the source file as much as
	  possible and send it to me.


KNOWN BUGS ---------------------------------
SC11 - see bug_list in C/
SAsm - a DC.l with a symbol can cause assembler to hang
ALL - the docs should have elaborative error message descriptions
SDis - requires at least one non-executable byte after the last executable
  opcode in memory or it will not print out the disassembled data
Slib - the -r option does nothing.


RELEASE CHANGES

2.1 ----------------------------------------
SC11 - The code generator optimization intended for brclr optimizations
  could be used with the wrong address mode.
SC11 - A particular combination of events in a switch statement would
  omit the generation of a compare instruction
SAsm - I have added high level if-else-endif statements.  See the docs.
Docs - There is now an AmigaGuide version of the documents.
Slink - has a new reserved keyword that makes it possible to generate a
  checksum for your rom.  See the docs.
Slink - would leave libraries open and memory unfreed if an error occurred
  during the library scan.
2.0b ---------------------------------------
SC11 - situations such as a large bodied if statement in a for loop could
  cause a byte_length error message
C_lib.lib - added getch a non-echoed version of getc
C_lib.lib - fixed incorrect handling of default in switch stmt
SC11 - could generate a short branch where a long branch is required
  if there are DC.x statements in between.
C_lib.lib - various problems with stdio functions fixed
C_lib.lib - more functions added (strcpy, strcmp, strcat plus 'n' versions
struct.inc - new file for defining C like structures in assembly
stdio.h - added conditional definition of NULL
SAsm - fixed incorrect generation for read-modify-write ops using direct,
  or either indexed mode
SAsm - enabled SAsm to recognize and ignore STABS and STABN debug info
SC11 - fixed minor peep-hole optimizer bug, not recognizing 'tba'
SC11 - enabled the generation of debugging information
SAsm - improved handling of equated symbols when used in operations
  so that un-needed promotions are not done.
SAsm - improved handling of equated symbols to reduce promotions to
  word addr from byte addr when not required.  For example
    lab   equ   4
          ldaa  lab     <== this was formerly promoted to word addr
SAsm - corrected reversed opcodes for 6805 word addr mode and indexed word
  addr
SC11 - docs now contain a list of C functions but no function descriptions
  especially required for the non ANSI funcitons
2.0a ---------------------------------------
SC11 - added optimization to reduce if/while/conditional (*ptr & 0x80)
  type expressions to brset/brclr instructions.
SC11 - added optimization to remove tstb from all comparisons.  It is
  not required since there are no 8 bit instructions that do not
  correctly set the CCR flags
SC11 - eliminated unneccesary promotion of unsigned types and allowed
  literal constant integers to be classed as unsigned if they fit in
  that range.
Docs - the library reference referred to HC11.lib rather than lib11.lib
SDis - will not disassemble small programs (fixed)
SAsm - 16 bit logicals (andd, etc) had reversed accumulators
HCload - fixed a problem with specifying a file without the -s option
HCload - now has a -m option for boards like the mini-board that have
  hardware echo built-in (this still doesn't work)
SDis - now accepts a file containing code entry addresses
MHex - now accepts command line values for EPROM start/end and interactive
  operation is no longer required.
Docs - filled rectangles were used to outline tables and they blocked out the
  tables
HCload - once again the version distributed was a version behind the docs
MHex - some numbers were being printed out in decimal rather than hex
SDis - a problem with printing out nonexistant label references
SDis - now accepts code entry addresses on the command line (see docs)
SDis - would not accept more than one additional address due to incorrect parsing
2.0 ----------------------------------------
HCload - small changes
SAsm - bit ops don't allow direct address mode
SAsm - equ isn't correct for symbols not in first hunk
SAsm - 'sym equ 354/12' doesn't work (in fact many operations didn't)
MHex - the output file is generated with one missing byte if an EPROM end
  address is specified rather than using the default
Slink always returns with an error code
SAsm - A -o option is added to redirect the output to some other file
SAsm - passing ? as the only argument to SAsm now prints the help info.
SAsm - A serious flaw resulted from an earlier change.  References to
  the second or later sections of the same segment were wrong.
SAsm - IF, IFCONST and IFNCONST were rarely correctly evaluated
1.2c ----------------------------------------
SAsm - operand field in listing is truncated and when there is no
  operand the comment is indented.
1.2b ----------------------------------------
HCload - The old version somehow sneaked into the 1.2 release; this
  release contains the correct version.
1.2a ----------------------------------------
SAsm - sym1 equ sym2 where sym2 is relocatable still results in a
  non-relocatable reference.
  OK - this just bit ME in the butt.  In the example above, sym1 is
  now a constant only if the expression (sym2) is constant.  An
  expression is constant if it contains only numeric constants and
  constant symbols.  This may not be correct in all cases.
  This fix corrects a related bug; if sym2 is a zpage (.z) symbol sym1
  was not.
SAsm - new opcodes CMPD and FCC for better compatability with
  Motorola source
1.2 ----------------------------------------
HCload was reworked in many ways by its original author Ron Eirich.
slink - added a new map mode to the map output.  This displays where, in
  memory, all the hunks from all the modules were placed.
SDis was in far worse shape than I knew.  Many bug fixes and improvements.
sasm mishandled direct references to XREF'd symbols by instructions
  having a prebyte
slink reports of address out of range now include the hunk relative
  address AND the module name AND the absolute address
SAsm - use of an EQUated symbol as the indexed offset or direct address
  of a BSET or BCLR could, in some cases, cause an unusable .o file
  to be produced.
lib11.lib new functions for printing in octal are __put_oct_str_sm,
  __put_oct_str, __put_oct_sm,  __put_oct.
lib11.lib all put_functions now use a symbol called __z_blank that is
  a leading zero blanking (lzb) flag/counter.  Its value is the number of
  leading digits that you want to consider using lzb on.  For example,
  these values printed with _put_asc (a word (5 digit) routine)
  __z_blank | value = 99 | value = 9 | value = 0
  ----------|------------|-----------|----------
       3    |    99      |    09     |    00
       4    |    99      |    9      |    0
       5    |    99      |    9      |
  Normally with a 5 digit routine you would use __z_blank = 4;
lib11.lib sm functions __put_asc_sm, __put_hex_sm, __put_asc_str_sm and
  __put_hex_str_sm now accept the value in the B register.  There are
  new functions __put_asc_usm, __put_asc_str_usm and.
SAsm - fcb and fdb did not treat constants the same as DC.b, particulary
  with respect to symbols and XREFs.
SAsm - fixed a long standing bug in branches to labels in the second or
  later sections of a segment within a module.  This could have produced
  incorrect code in some cases in others it would appear as a branch out
  of range error.  This also affected the use of the '.' symbol.
lib11.lib all functions are now preceeded by __ (assembler level). Done
  for compatibility with C environment.
lib11.lib the functions put_asc, put_asc_sm, put_asc_u, put_hex and
  put_hex_sm now modify the X register.  There are also new versions
  put_asc_str, put_asc_str_sm, put_asc_str_u that put the result in the
  string pointed to by the X register input.
SAsm now accepts the .z force on XREF and SEG.  This causes all symbols
  defined by such an XREF or declared in such a segment to use zero page
  addressing where applicable.  At the same time the restriction on
  automatic generation of page zero references with constant (not symbolic)
  addresses is lifted.
slink has been changed to apply special treatment to segments with the
    name IDATA.  (see docs for more details)
SAsm reported the wrong version number while running
SAsm undefined symbols were reported obliquely, due to a change in R1.1 I
    believe.
SAsm would not allow a symbol to be XDEF'd after it was defined.
SAsm an error resulting from a change just prior to the original release
    made it impossible to successfully reuse a segment within the same
    source file.
SAsm (HC11) has been modified to accept three new pseudo-mnemonics.  They
    are ANDD, EORD, ORD from the 68HC16 instruction set.  They produce, in
    the case of ANDD, an ANDB followed by an ANDA.  Therefore the result
    is correct but only the N bit of the CCR flags is correct.  The
    mnemonics are valid with all HC11 addressing modes.  This change was
    made to prepare for the C compiler and was done in the assembler
    because it could not be done with macros.
1.1 ----------------------------------------
SDis became confused if the S-record file to be dis-assembled contained a
    value for address FFFF. This would usually result in a crash.
SDis default for (y/N) question would default to Y instead
SAsm failed to recognize that a negative number or expression result >= -128
    could fit into an 8 bit immediate operand resulting in an illegal
    addressing mode error for instructions such as this.
	ldab	#1-2
SAsm - Minor improvement in pass handling under special conditions
SAsm - Unary operations and binary operations involving a single XREF'd symbol
    and an operator other than addition are not legal, but were not detected
    by the assembler and produced incorrect code.
It was not noted anywhere in the documents that some of the programs require
    AmigaDOS 2.0.  Now only slink does and there is a slink1.3 replacement
slink was accessing memory on an odd boundary which would cause a crash on
    68000 68010 processors
The 68HC11 registers include file 68HC11.inc is now included in the release.
    It is not quite complete yet ... as time permits.
A new utility, MHex, has been added which allows conversion of S record
    files to straight binary.  The source is also included in case you have
    a particular format requirement.  I would appreciate receiving any such
    conversions and I will try to make one grand unified utility out of them.
A simple monitor program is provided, along with source, I like it because
    its extensible command set allows me to easily develop command driven
    programs.
New library functions for printing values as hex ascii are available.
HCload was modified to work with any serial-type device and any unit number.
Two of the listed library functions were somehow left out of the library.

1.0 ----------------------------------------
SAsm, slink and slib now handle 68HC16 mnemonics and addressing modes as
far as I have been able to test.  I do not have a 68HC16 processor and
have relied on Motorola printed documents.

The doc file doc.txt is generated from the .ps file for those who don't
have access to a postscript printer or converter.

I can be reached at:
internet sburton@dres.dnd.ca      <= NOTE: change
BIX      sburton
mail     Stan Burton
         1978 26 St. SE
         Medicine Hat, AB CANADA
         T1A 2G8
