LEVELI.DOC

(23 KB) Pobierz









                             PseudoSam Assembler Manual Level I
                             Copyright(c) 1986,87,88 PseudoCorp
                             All right reserved!





Disclaimer:

            PseudoSam software is distributed as is, with no guarantee that
            it will work correctly in all situations.  In no event will the
            Author be liable for any damages, including lost profits,
            lost savings or other incidental or consequential damages
            arising out of the use of or inability to use these
            programs, even if the Author has been advised of the
            possibility of such damages, or for any claim by any other
            party.

            It is the users reponsibility to back up all important files!

            See copyright information in appendix B





                         Table of Contents

Chapter 1  PseudoSam Assemblers vs. other assemblers.

Chapter 2  Running the assembler program.

Chapter 3  Assembler statement syntax.

Chapter 4  Data types.

Chapter 5  Expressions.

Chapter 6  Assembler Directives.
  (also known as assembler pseudo-opcodes, or pseudo-ops)

Appendix A      ASCII character set.

Appendix B      Copyright information.


Chapter 1 PseudoSam assemblers vs. other assemblers

     All PseudoSam(Pseudo brand Symbolic AsseMbler) assemblers conform to
     a common syntax based on the UNIX system V assembler syntax. By
     conforming to this Pseudo standard, conflicts with the manufacturers
     syntax are created.

* The difference between another assembler's name and the PseudoSam name
  of an assembler directive can be circumvented by the .opdef
  directive.

  example

   .opdef  eject,.eject      ;defines eject to be synonymous with .eject
   .opdef  fcc,.db           ;fcc will now form constant characters as it
                             ;should.

*  A file syn.asm is distributed with the assembler with some useful
   redefinitions.










Unix system V is a trademark of AT & T.







Chapter 2  Running the assembler program

1.  Command line switch setting and source file specification.

     Assuming the user has an assembly language source file called foo.asm
     type the following command:

aXX foo

 where the PseudoSam assembler number is substituted for XX.

     The assembler will assemble the program foo.asm using the default
     assembler switch settings. the following files will be generated
     by the assembler:

     foo.lst   ;assembled listing shown the code conversion and
               ; any errors that where discover by the assembler.

     foo.obj   ;assembled object code in Hex format.

**  for a list of switch setting see the .command assembler directive
    description in chapter 6.

*** The assembler uses the following temporary file names.

    z0z0z0z0.tmp
    z1z1z1z1.tmp

    ANY files with these names will be DESTROYED by the
    by the assembler.







Chapter 3  Assembler statement syntax

1. Assembler Statements

     Assembler statements contain from zero to 4 fields as shown in
     following.

<label> <opcode> <expressions> <comment>

     All fields are optional, but they must be in this order.

A.   Labels (<label>) are symbolic names that are assigned the starting
     address of any code generated by the opcode and or expressions
     of the line containing the label declaration.(see section 2).

B.   Operation codes(<opcode>) tell the assembler what machine instruction
     to generate, or what assembler control function to perform.
     The operation code also tells the assembler what expressions are
     required to complete the machine instruction or assembler directive.
     (see chapter 6).

C.   Expression requirements are set by the opcode(see the microprocessor
     manufacturers reference manual or the assembler directives chapter
     for individual opcode requirements).(see chapter 5).

D.   Comments are notes written by the programmer to explain what the
     program is trying to accomplish. Comments generate no code.
     (see section 3).







2.  Labels

     Labels can be unlimited in length, but only the first eight characters
     are used to distinguish between them.  They must conform to the
     following syntax.

     <label>  -> <identifier>':'

     <identifier> -> <alphabetic character> <identifier character string>

     <alphabetic character> -> character in the set ['A'..'Z', 'a'..'z', '.']

     <identifier character string> -> any sequence of characters from the
                                      set ['A'..'Z','a'..'z', '.', '0'..'9']

example
abc:                  ;label referred to as abc
a c:                  ;not a valid label
         foo:         ;label referred to as foo
.123:                 ;label referred to as .123

* Case makes NO difference!

d:      ;is the same as
D:


3.  Comments
     Comments must start with a semi-colon ; and are terminated
     by an end of line or file( <lf>(^J) or <sub>(^Z) ). An end
     of line is inserted by typing the enter or return key by
     most text editors.







Chapter 4     Data types

1.  Integers

    Integer constants can be specified in any of the following forms:

A.  Binary

    b'bb             ;bb=string of binary digits
    B'bb

B.  Decimal

    ndd
    d'dd             ;n=nozero decimal digit
    D'dd             ;dd=string of decimal digits

C.  Octal

    0qq              ;qq=string of octal digits
    o'qq
    O'qq
    q'qq
    Q'qq

D.  Hexidecimal

    0x'hh            ;hh=string of hexidecimal digits
    0X'hh
    h'hh
    H'hh
    x'hh
    X'hh


Examples:

    077        ;octal number 77 = decimal 63
    b'0101     ;binary number 101 = decimal 5
    77         ;decimal number 77 = octal 115
    h'ff       ;hexidecimal ff = decimal 255






2.  Strings:

    Strings consist of a beginning quote " followed by any reasonable number
    of characters followed by an ending quote ". Control characters and double
    quotes " and backslash \ may not be used in strings directly.  These
    special characters are included by using a special escape sequence which
    the assembler translates into the appropriate ASCII code.

Note: Strings may not be used in expressions!
      Although character constants may(see below).

Escape sequences
  "\"" string containing "
  "\\" string containing \
  "\'" string containing '
  "\0" string containing null
  "\n" string containing linefeed
  "\r" string containing carriage return
  "\f" string containing formfeed
  "\t" string containing horizontal tab
  "\nnn" string containing the ASCII character who's code is o'nnn
         (nnn are octal digits).
  * see appendix A for ASCII codes.

3.  Character Constants:

    Character constants consist of  a single quote ' followed by
    a character or an escape sequence(see above) followed by a
    single quote '.

example:
   'A' = ASCII character value for the letter A = 65 (decimal);
   '\''= ASCII character value for the character ' = 39 (decimal).

Character constants are treated as integers by the assembler and
are valid where ever an integer value is valid.

example:
   'A' + 1 = 66

  * see appendix A for ASCII codes.

4.  Symbolic values

    Symbolic values are generally labels, but may be any identifier
    assigned an integer value(using .set or .equ pseudo-ops).

    As a special case the symbol * when used as an operand in an
    expression denotes the value of the location counter (the value
    the program counter will have during operation) at the beginning
    of the current line.






Chapter 5  Expressions

     All expressions evaluate to integer values modulo 65536(2^16) and are
     written in infix notation(the way you normally write them).  Operators
     provided are grouped below in order of precedence.

1. (unary)
~           logical bit wise complement(not) of its operand(one's complement).
-           arithemetic complement, or negation(two's complement).

2. (binary)
*           integer multiply (two's complement).
/           integer divide   (two's complement).
%           modulus          (result is always positive)
>>          logical shift right (left operand shifted right operand times).
<<          logical shift left (left operand shifted right operand times).
~           equivalent to  A or ( ~B ).

3. (binary)
|           logical bitwise or(inclusive-or) of two operands.
^           logical bitwise exclusive-or of two operands.
&           logical bitwise and of two operands.

4. (binary)
+           addition (two's complement).
-           subtraction (two's complement).

     Since this version does not generate relocatable code there exists only
     one "type" of operand that can be in an expression.  So anything goes
     except divide by 0(1 will be substituted ).

examples:
    -1 = h'ffff  (two's complement notation).
    -1 >> 8 = h'00ff
    -1 << 8 = h'ff00
    3 / 2 = 1
    6 / 2 = 3
    5 / 0 = 5
    -2 / 1 = -2
    -3 /-2 = 1
    2 * -3 = -6
    b'00 & b'11 = 0
    b'11 & b'10 = 2
    2 * b'01 & b'10 = 2
    b'01 ^ b'11 = 2
    b'01 | b'11 = 3

Notice that spaces are ignored in expressions.








Chapter 6  Assembler Directives
  (also known as assembler Pseudo-opcodes)

     The assembler recognizes the following directives:

      directive  section...
Zgłoś jeśli naruszono regulamin