Anteprima
Vedrai una selezione di 8 pagine su 33
68000 Assembler - User's Manual Pag. 1 68000 Assembler - User's Manual Pag. 2
Anteprima di 8 pagg. su 33.
Scarica il documento per vederlo tutto.
68000 Assembler - User's Manual Pag. 6
Anteprima di 8 pagg. su 33.
Scarica il documento per vederlo tutto.
68000 Assembler - User's Manual Pag. 11
Anteprima di 8 pagg. su 33.
Scarica il documento per vederlo tutto.
68000 Assembler - User's Manual Pag. 16
Anteprima di 8 pagg. su 33.
Scarica il documento per vederlo tutto.
68000 Assembler - User's Manual Pag. 21
Anteprima di 8 pagg. su 33.
Scarica il documento per vederlo tutto.
68000 Assembler - User's Manual Pag. 26
Anteprima di 8 pagg. su 33.
Scarica il documento per vederlo tutto.
68000 Assembler - User's Manual Pag. 31
1 su 33
D/illustrazione/soddisfatti o rimborsati
Disdici quando
vuoi
Acquista con carta
o PayPal
Scarica i documenti
tutte le volte che vuoi
Estratto del documento

Label Operation Operand,Operand,... Comment

For example, LOOP MOVE.L (A0)+,(A1)+ Sample source line

The fields may be separated by any combination of spaces and tabs. Except for the comment field and quoted strings, there must be no spaces or tabs within a field.

2.1.1 Label Field

Legal labels follow the rules for forming symbol names described in section 2.2. Labels may be distinguished in one of two ways: (1) They may begin in column 1, or (2) they may end in a colon, which does not become part of the label but simply serves to mark its end. A line may consist of a label alone.

When a label is encountered in the source code, it is defined to have a value equal to the current location counter. This symbol may be used elsewhere in the program to refer to that location.

2.1.2 Operation Field

The operation field specifies the instruction that is to be assembled or the assembler directive that is to be performed. A size code (.B, .W, .L, or .S) may be appended to the operation code if allowed, to specify Byte,

Word, Long, or Short operations, respectively. The operation field must not begin in the column 1, because the operation would be confused with a label.

2.1.3 Operand Field

The operand field may or may not be required, depending on the instruction or directive being used. If present, the field consists of one or more comma-separated items with no intervening spaces or tabs. (There may be spaces or tabs within an item, but only within quoted strings.) 42.

2.1.4 Comment Field

The comment field usually consists of everything on a source line after the operand field. No special character is needed to introduce the comment, and it may contain any characters desired. A comment may also be inserted in the source file in another way: An asterisk ("*") at the beginning of the line or after the label field will cause the rest of the line to be ignored, i.e., treated as a comment.

2.2 Symbols

Symbols appear in the source code as labels, constants, and operands. The first character of a symbol must be

either a letter (A-Z) or a period (".") The remaining characters may be letters, dollar signs ("$"), periods (".") or underscores ("_"). A symbol may be of any length, but only the first 8 characters are significant. Remember that capitalization is ignored, so symbols which are capitalized differently are really the same.

2.3 Expressions

An expression may be used in the source program anywhere a number is called for. An expression consists of one or more operands (numbers or symbols), combined with unary or binary operators. These components are described below. The value of the expression and intermediate values are always computed to 32 bits, with no account being made of any overflow that may occur. (Division by zero, however, will cause an error.)

2.3.1 Operands in Expressions

An operand in an expression is either a symbol or one of the following sorts of constants.

2.3.1.1 Decimal Numbers

A decimal number consists of a sequence of decimal digits (0-9) of any length.

A warning will be generated if the value of the number cannot be represented in 32 bits.

2.3.1.2 Hexadecimal Numbers

A hexadecimal number consists of a dollar sign ("$") followed by a sequence of hexadecimal digits (0-9 and A-F) of any length. A warning will be generated if the value of the number cannot be represented in 32 bits.

2.3.1.3 Binary Numbers

A binary number consists of a percent sign ("%") followed by a sequence of binary digits (0 and 1) of any length. A warning will be generated if the number consists of more than 32 digits.

2.3.1.4 Octal Numbers

An octal number consists of a commercial at sign ("@") followed by a sequence of octal digits (0-7) of any length. A warning will be generated if the value of the number cannot be represented in 32 bits.

2.3.1.5 ASCII Constants

An ASCII constant consists of one to four ASCII characters enclosed in single quote marks. If it is desired to put a single quote mark inside an ASCII constant, then two consecutive

singlequotes may be used to represent one such character. If the ASCII constant consists of one character, then it will be placed in the bottom byte of the 32 bit value; two characters will be placed in the bottom word, with the first character in the higher-order position. If four characters are used, then all four bytes will contain characters, with the first in the highest-order location. However, if three characters are used, then they will be placed in the three highest-order bytes of the 32-bit value, with 0 in the low byte (this is to accommodate the high-byte-first addressing used on the 68000). Note that ASCII constants in expressions are different from strings in DC directives, as the latter may be of any length.

2.3.2 Operators in Expressions

The operators allowed in expressions are shown in the following table, in order of decreasing precedence. Within each group, the operators are evaluated in left-to-right order (except for group 2, which is evaluated right-to-left).

Operators in Expressions

    1. Parenthesized subexpressions
    2. Unary minus (two's complement)
    3. Bitwise not (one's complement)
    4. Shift left
    5. Shift right
    6. Bitwise and
    7. Bitwise or
    8. Multiplication/ Integer division
    9. Modulus (x\y produces the remainder of x divided by y)
    10. Addition
    11. Subtraction

    62.4 Addressing Mode Specifications

    The 68000 and 68010 provide 14 general addressing modes.

    The formats used to specify these modes in assembly language programs are listed in the table below. The following symbols are used to describe the operand formats:

    • Dn = Data Register
    • An = Address Register (SP may used instead of A7)
    • Xn = Data or Address register
    • s = Index register size code (either .W or .L, .W will be assumed if omitted)
    • <ex8> = Expression that evaluates to an 8-bit value (may be empty, in which case 0 will be used)
    • <ex16> = Expression that evaluates to a 16-bit value (may be empty, in which case 0 will be used)
    • <ex> = Any expression
    • PC = Program Counter

    Addressing Mode

    
    <table>
      <tr>
        <th>Specifications</th>
        <th>Mode</th>
        <th>Assembler Format</th>
      </tr>
      <tr>
        <td>Data Register Direct</td>
        <td>Dn</td>
        <td><ex></td>
      </tr>
      <tr>
        <td>Address Register Direct</td>
        <td>An</td>
        <td><ex></td>
      </tr>
      <tr>
        <td>Address Register Indirect (An)</td>
        <td>An</td>
        <td><ex></td>
      </tr>
      <tr>
        <td>Address Register Indirect with Predecrement</td>
        <td>-(An)</td>
        <td><ex></td>
      </tr>
      <tr>
        <td>Address Register Indirect with Postincrement</td>
        <td>(An)+</td>
        <td><ex></td>
      </tr>
      <tr>
        <td>Address Register Indirect with Displacement</td>
        <td><ex16>(An)</td>
        <td><ex></td>
      </tr>
      <tr>
        <td>Address Register Indirect with Index</td>
        <td><ex8>(An,Xn.s)</td>
        <td><ex></td>
      </tr>
      <tr>
        <td>Absolute Short or Long (chosen by assembler)</td>
        <td><ex></td>
        <td><ex></td>
      </tr>
      <tr>
        <td>Program Counter with Displacement</td>
        <td><ex16>(PC)</td>
        <td><ex></td>
      </tr>
      <tr>
        <td>Program Counter with Index</td>
        <td><ex8>(PC,Xn.s)</td>
        <td><ex></td>
      </tr>
      <tr>
        <td>Immediate</td>
        <td>#<ex></td>
        <td><ex></td>
      </tr>
    </table>
    
    <h3>Assembly Details</h3>
    <p>3.1 Branch Instructions</p>
    <p>The branch instructions (Bcc, BRA, and BSR)</p>
    
    

    are unique in that they can take a ".S" size code. This suffix directs the assembler to assemble these as short branch instructions, i.e., one-word instructions with a range to -128 to +127 bytes. If the ".S" size code is used, and the destination is actually outside this range, then the assembler will print an error message. If the ".L" size code is used, the assembler will use a long branch, which is a two-word instruction with a range of -32768 to +32767 bytes. If neither size code is specified, then the assembler will use a short branch if possible (the branch destination must be known on the first pass to be within the short branch range); otherwise it will use long branch.

    3.2 MOVEM Instruction

    The MOVEM instruction, which is used for saving and restoring sets of registers, has one the following two forms:

    MOVEM <register_list>,<effective_address>

    MOVEM <effective_address>,<register_list>

    The register list may be an explicit register list of

    The form described in Section 4.2.3. On the other hand, if a particular set of registers is to be saved and restored repeatedly, the REG directive (Section 4.2.3) can be used to define a register list symbol that specifies the registers. For example, if the register list symbol WORKSET is defined as follows:

    WORKSET REG A0-A4/D1/D2

    then the following instructions will perform the same function:

    MOVEM.L WORKSET,-(SP)

    MOVEM.L A0-A4/D1/D2,-(SP)

    If a register list symbol is used, it must be defined before it appears in any MOVEM instructions.

    83.3 Quick Instructions (MOVEQ, ADDQ, SUBQ)

    The MOVE, ADD, and SUB instructions have one-word "quick" variations which can be used certain addressing modes and operand values. The assembler will use these faster variations automatically when possible, or they may be specified explicitly by writing the mnemonic as MOVEQ, ADDQ, or SUBQ.

    The MOVEQ instruction may be used for moving an immediate value in the range -128 to +127 into a data register. The

    assembler will assemble a MOVE.L #<value>,Dn as a MOVEQ if the value is known on the first pass.

    The ADDQ (SUBQ) instruction adds (subtracts) an immediate value from 1 to 8 to (from) any alterable destination. The assembler will use the quick form if the value is known on the first pass to be in the range 1 to 8.94.

    Assembler Directives

    4.1 ORG - Set Origin

    The assembler maintains a 32-bit location counter, whose value is initially zero and which is incremented by some amount whenever an instruction is assembled or a data storage directive is carried out. The value of this location counter may be set with the ORG directive. This is typically done at the start of a program and at appropriate places within it. The format of the ORG directive is <label> ORG <expression> where <expression> is an expression containing no forward references, i.e., its value must be known on the first pass at the point where the ORG directive appears. An error will result if an attempt is made to set

    The location counter to an odd value; in this case the location counter will be set to the specified value plus one. The <label> is optional and, if present, the specified symbol will be set to the new value of the location counter.

    4.2 Symbol Definition Directives

    4.2.1 EQU - Equate Symbol

    The equate directive is used to define symbols whose value will not change within the program. The format of this directive is <label> EQU <expression> where <expression> is an expression.

Dettagli
Publisher
A.A. 2012-2013
33 pagine
SSD Ingegneria industriale e dell'informazione ING-INF/05 Sistemi di elaborazione delle informazioni

I contenuti di questa pagina costituiscono rielaborazioni personali del Publisher valeria0186 di informazioni apprese con la frequenza delle lezioni di Architetture Sistemi Elaborazione e studio autonomo di eventuali libri di riferimento in preparazione dell'esame finale o della tesi. Non devono intendersi come materiale ufficiale dell'università Università degli studi di Napoli Federico II o del prof McKee Paul.