head	1.1;
access;
symbols;
locks
	david:1.1; strict;
comment	@# @;


1.1
date	97.06.04.02.59.13;	author david;	state Exp;
branches;
next	;


desc
@Initial Version.
@


1.1
log
@Initial revision
@
text
@$Id$

                  Intel 8048 Macro Cross Assembler
                       by David Summers

  This program provides the capability to assemble Intel 8048
assembly language instructions on almost any computer that has a C
Language compiler (which includes MS-DOS machines, Unix/Xenix machines,
CP/M, Amiga, etc.).

   This paticular implementation of the assembler is a fairly straight
forward and simple implementation. It allows for MACRO calls and
conditional assembly of statements, as well as included files.

   The assembler has a limited set of ways to specify a constant operand.
At the moment the assembler only recognizes constant operands of the
following types:
   1) Decimal - Specified with one or more of the numbers 0-9.
   2) Binary - Specified with a preceding '%' or a 'B' following the
      string of numbers '0' and '1'. Example:
      %1101011 ;Specify (as operand) a binary number.
      1101011B ;This specifies the same number.
   3) Hexadecimal - Specified with a preceding '$' or an 'H' following the
      string of numbers '0' - '9', 'A'-'F'. Example:
      $500 ;Specify a hexadecimal number.
      500h ;Specify the same number.

Expressions in Operands
-----------------------
The assembler will also take expressions in operands. For example, the
programmer may need to find out the length of a section of memory. He
might do it this way: 
   STRUC DS 0 ;Give this structure an address.
   Name  DS 25 ;Reserve 25 characters for the name.
   Addr  DS 25 ;Reserve 25 characters for the address.
   City  DS 15 ;Reserve 15 characters for the City.
   State DS 2  ;Reserve 2 characters for the State.
   Zip   DS 10 ;Reserve 10 characters for the Zip Code.
   STRLEN EQU $ - STRUC ;Set STRLEN equal to the length of the structure.

The only expression operators that the assembler will recognize are the
following:
   1) + (Addition)
   2) - (Subtraction)
   3) * (Multiplication)
   4) / (Division)
   5) AND
   6) OR
   7) NOT

   Here is an example which uses expressions in operands:
      PROLEN EQU FINISH - START
      MYDATA EQU $500 + PROLEN
      FLOSIZ EQU MANTISA + EXPONT
      ARYSIZ EQU MYDATA / FLOSIZ

   The following is the list of assembler directives that this assembler
supports:

   DB - Define Byte. This directive will define a byte (or a string of
      bytes). Examples:
         DATA1 DB $20 ;Define DATA1 to be Hexadecimal 20.
         DATA2 DB 'A' ;Define DATA2 to be the ASCII character 'A'.
         DATA3 DB 'This is a test',0 ;Define string and NULL (0).
         DATA4 DB TEMP ;Place TEMP at data location DATA4.

   DS - Define Space. This directive will reserve the specified amount of
      space in memory. Examples:
         SPACE1 DS 50 ;Reserve 50 bytes of space for SPACE1.
         SPACE2 DS TEMP ;Reserve TEMP bytes of space for SPACE2.
                DS $20 ;Reserve 32 (20 Hex) bytes of space.

   DW - Define Word. This directive is similar to the DB directive except
      that it defines 2 bytes of space at a time. The high order byte is
      placed in memory followed by the low order byte.
      Examples:
         DW1 DW START ;Place address of START at DW1.
         JMPTAB DW 0  ;Initialize JMPTAB (2 bytes) to 0.

   EQU - This directive sets a symbol equal the the specified expression.
      Examples:

      START EQU $ ;Set START equal to the present location counter.
      ENDNG EQU 11001101B ;Set ENDNG equal to CD (Hex) = 11001101 (Binary)

   IF - This directive checks to see whether or not it's operand is zero.
      IF it is zero, then the statement is FALSE and the statements up to
      and "ELSE" or "ENDIF" will NOT be assembled. Otherwise the statements
      will be assembled. The operand of IF HAS to be known during the pass
      1 of the assembler.
      Example:

      RELOC   EQU    500
      START   EQU    $
              IF     START AND LEN
              MOV    A,#START+RELOC
              ELSE
              MOV    A,#START
              ENDIF

   HIGH - This directive returns as its results the high order byte of the
      specified expression or identifier.  For example:

      MYLABEL HIGH $1234

      would generate as its result the byte $12.

   LOW - This directive returns as its results the low order byte of the
      specified expression or identifier.  For example:

      YOURLABEL LOW $1234

      would generate as its result the byte $34.

   MACRO - This directive allows the programmer to specify a whole set of
      lines of assembly code to be generated in place of a single line.
      This allows "in-line" subroutine coding, etc.  Inside the Macro
      definition any assembly statements or directives may be used.  A
      Macro definition is ended with an 'ENDM' statement. A MACRO consists
      of two parts.  The first part is the Macro Definition.  A Macro
      Definition consists of the name of the macro, in the position usually
      reserved for assembler symbols, and the formal parameters which is
      a list of parameters which, when used in the body of the Macro, are
      the parameters to be replaced with the actual parameters.  For example:
      
      MYMAC  MACRO  Par1,Par2,Par3
             MOV    A,#Par1
             ADD    A,#Par2
             ADD    A,#Par3
             ENDM

      The second part of a Macro is where the Macro is used.  At the point
      that the programmer specifies a defined Macro, the code in the Macro
      is included and any formal parameters are substituted with actual
      parameters.  For example:
  
      ;This is where the Macro 'MYMAC' is used.
             MYMAC  1,2,3

      The result will be:

             MOV  A,#1
             ADD  A,#2
             ADD  A,#3


   ORG - This directive tells the assembler to move the location counter
      to the specifed memory location.
      Examples:

      START EQU $500
      ORG START


   END - This directive indicates the end of program. The assembler will
      quit. This directive is required. Also, for use in absolute program
      loaders, the directive may have an expression as the operand which
      indicates where the program is to begin execution.
      Example:

      QUIT END START ;End assembly and tell loader to start at START.

   SHL - This directive takes two arguments; the expression or identifier to
      be shifted and the number of bits to be shifted left.  For example:

      $1234 SHL 4

      would generate as its result the $2340 word.

   SHR - This directive takes two arguments; the expression or identifier to
      be shifted and the number of bits to be shifted right.  For example:

      $1234 SHR 4

      would generate as its result the $0123 word.


   Note: The '$' used by itself in an operand (not preceding a Hexadecimal
         number) is used as the current Psuedo Location Counter. This is
         the current Assembly Time location counter, and the Program Counter
         in the processor. For an example of the use of this operand, see the
         section above entitled "Expressions in Operands".
@
