home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 346_02 / asmlnk.doc < prev    next >
Text File  |  1991-02-10  |  157KB  |  4,535 lines

  1.  
  2.  
  3.          
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.                                 ASxxxx Assemblers
  27.  
  28.  
  29.                                        and
  30.  
  31.  
  32.                             ASLINK Relocating Linker
  33. CHAPTER 1  THE ASSEMBLER                                 1-1 
  34.   1.1     THE ASXXXX ASSEMBLERS                          1-1 
  35.   1.1.1     Assembly Pass 1                              1-2 
  36.   1.1.2     Assembly Pass 2                              1-2 
  37.   1.1.3     Assembly Pass 3                              1-2 
  38.   1.2     SOURCE PROGRAM FORMAT                          1-3 
  39.   1.2.1     Statement Format                             1-3 
  40.   1.2.1.1     Label Field                                1-3 
  41.   1.2.1.2     Operator Field                             1-5 
  42.   1.2.1.3     Operand Field                              1-5 
  43.   1.2.1.4     Comment Field                              1-6 
  44.   1.3     SYMBOLS AND EXPRESSIONS                        1-6 
  45.   1.3.1     Character Set                                1-6 
  46.   1.3.2     User-Defined Symbols                        1-10 
  47.   1.3.3     Local Symbols                               1-11 
  48.   1.3.4     Current Location Counter                    1-12 
  49.   1.3.5     Numbers                                     1-14 
  50.   1.3.6     Terms                                       1-14 
  51.   1.3.7     Expressions                                 1-15 
  52.   1.4     GENERAL ASSEMBLER DIRECTIVES                  1-16 
  53.   1.4.1     .module Directive                           1-16 
  54.   1.4.2     .title Directive                            1-17 
  55.   1.4.3     .sbttl Directive                            1-17 
  56.   1.4.4     .page Directive                             1-17 
  57.   1.4.5     .byte and .db Directives                    1-17 
  58.   1.4.6     .word and .dw Directives                    1-18 
  59.   1.4.7     .blkb, .blkw, and .ds Directives            1-18 
  60.   1.4.8     .ascii Directive                            1-18 
  61.   1.4.9     .asciz Directive                            1-19 
  62.   1.4.10    .radix Directive                            1-19 
  63.   1.4.11    .even Directive                             1-20 
  64.   1.4.12    .odd Directive                              1-20 
  65.   1.4.13    .area Directive                             1-20 
  66.   1.4.14    .org Directive                              1-22 
  67.   1.4.15    .globl Directive                            1-22 
  68.   1.4.16    .if, .else, and .endif Directives           1-23 
  69.   1.4.17    .include Directive                          1-24 
  70.   1.4.18    .setdp Directive                            1-24 
  71.   1.5     INVOKING ASXXXX                               1-26 
  72.   1.6     ERRORS                                        1-27 
  73.   1.7     LISTING FILE                                  1-28 
  74.   1.8     SYMBOL TABLE FILE                             1-30 
  75.   1.9     OBJECT FILE                                   1-30 
  76.  
  77. CHAPTER 2  THE LINKER                                    2-1 
  78.   2.1     ASLINK RELOCATING LINKER                       2-1 
  79.   2.2     INVOKING ASLINK                                2-2 
  80.   2.3     ASLINK PROCESSING                              2-3 
  81.   2.4     LINKER INPUT FORMAT                            2-4 
  82.   2.4.1     Object Module Format                         2-5 
  83.   2.4.2     Header Line                                  2-5 
  84.   2.4.3     Module Line                                  2-5 
  85.   2.4.4     Symbol Line                                  2-5 
  86.   2.4.5     Area Line                                    2-6 
  87.   2.4.6     T Line                                       2-6 
  88.   2.4.7     R Line                                       2-6 
  89.   2.4.8     P Line                                       2-7 
  90.   2.5     LINKER ERROR MESSAGES                          2-7 
  91.                                                      Page ii
  92.  
  93.  
  94.  
  95. CHAPTER 3  BUILDING ASXXXX AND ASLINK                    3-1 
  96.   3.1     BUILDING AN ASSEMBLER                          3-1 
  97.   3.2     BUILDING ASLINK                                3-2 
  98.  
  99. APPENDIX A  AS6800 ASSEMBLER                             A-1 
  100.   A.1     6800 REGISTER SET                              A-1 
  101.   A.2     6800 INSTRUCTION SET                           A-1 
  102.   A.2.1     Inherent Instructions                        A-2 
  103.   A.2.2     Branch Instructions                          A-2 
  104.   A.2.3     Single Operand Instructions                  A-3 
  105.   A.2.4     Double Operand Instructions                  A-4 
  106.   A.2.5     Jump and Jump to Subroutine Instructions     A-4 
  107.   A.2.6     Long Register Instructions                   A-5 
  108.  
  109. APPENDIX B  AS6801 ASSEMBLER                             B-1 
  110.   B.1     .hd6303 DIRECTIVE                              B-1 
  111.   B.2     6801 REGISTER SET                              B-1 
  112.   B.3     6801 INSTRUCTION SET                           B-1 
  113.   B.3.1     Inherent Instructions                        B-2 
  114.   B.3.2     Branch Instructions                          B-2 
  115.   B.3.3     Single Operand Instructions                  B-3 
  116.   B.3.4     Double Operand Instructions                  B-4 
  117.   B.3.5     Jump and Jump to Subroutine Instructions     B-5 
  118.   B.3.6     Long Register Instructions                   B-5 
  119.   B.3.7     6303 Specific Instructions                   B-5 
  120.  
  121. APPENDIX C  AS6804 ASSEMBLER                             C-1 
  122.   C.1     6804 REGISTER SET                              C-1 
  123.   C.2     6804 INSTRUCTION SET                           C-1 
  124.   C.2.1     Inherent Instructions                        C-2 
  125.   C.2.2     Branch Instructions                          C-2 
  126.   C.2.3     Single Operand Instructions                  C-2 
  127.   C.2.4     Jump and Jump to Subroutine Instructions     C-2 
  128.   C.2.5     Bit Test Instructions                        C-2 
  129.   C.2.6     Load Immediate data Instruction              C-3 
  130.   C.2.7     6804 Derived Instructions                    C-3 
  131.  
  132. APPENDIX D  AS6805 ASSEMBLER                             D-1 
  133.   D.1     6805 REGISTER SET                              D-1 
  134.   D.2     6805 INSTRUCTION SET                           D-1 
  135.   D.2.1     Control Instructions                         D-2 
  136.   D.2.2     Bit Manipulation Instructions                D-2 
  137.   D.2.3     Branch Instructions                          D-2 
  138.   D.2.4     Read-Modify-Write Instructions               D-3 
  139.   D.2.5     Register\Memory Instructions                 D-3 
  140.   D.2.6     Jump and Jump to Subroutine Instructions     D-4 
  141.  
  142. APPENDIX E  AS6809 ASSEMBLER                             E-1 
  143.   E.1     6809 REGISTER SET                              E-1 
  144.   E.2     6809 INSTRUCTION SET                           E-1 
  145.   E.2.1     Inherent Instructions                        E-3 
  146.   E.2.2     Short Branch Instructions                    E-3 
  147.   E.2.3     Long Branch Instructions                     E-3 
  148.   E.2.4     Single Operand Instructions                  E-4 
  149.                                                     Page iii
  150.  
  151.  
  152.  
  153.   E.2.5     Double Operand Instructions                  E-5 
  154.   E.2.6     D-register Instructions                      E-5 
  155.   E.2.7     Index/Stack Register Instructions            E-5 
  156.   E.2.8     Jump and Jump to Subroutine Instructions     E-6 
  157.   E.2.9     Register - Register Instructions             E-6 
  158.   E.2.10    Condition Code Register Instructions         E-6 
  159.   E.2.11    6800 Compatibility Instructions              E-6 
  160.  
  161. APPENDIX F  AS6811 ASSEMBLER                             F-1 
  162.   F.1     6811 REGISTER SET                              F-1 
  163.   F.2     6811 INSTRUCTION SET                           F-1 
  164.   F.2.1     Inherent Instructions                        F-2 
  165.   F.2.2     Branch Instructions                          F-2 
  166.   F.2.3     Single Operand Instructions                  F-3 
  167.   F.2.4     Double Operand Instructions                  F-4 
  168.   F.2.5     Bit Manupulation Instructions                F-4 
  169.   F.2.6     Jump and Jump to Subroutine Instructions     F-5 
  170.   F.2.7     Long Register Instructions                   F-5 
  171.  
  172. APPENDIX G  AS6816 ASSEMBLER                             G-1 
  173.   G.1     6816 REGISTER SET                              G-1 
  174.   G.2     6816 INSTRUCTION SET                           G-1 
  175.   G.2.1     Inherent Instructions                        G-2 
  176.   G.2.2     Push/Pull Multiple Register Instructions     G-3 
  177.   G.2.3     Short Branch Instructions                    G-3 
  178.   G.2.4     Long Branch Instructions                     G-3 
  179.   G.2.5     Bit Manipulation Instructions                G-3 
  180.   G.2.6     Single Operand Instructions                  G-4 
  181.   G.2.7     Double Operand Instructions                  G-5 
  182.   G.2.8     Index/Stack Register Instructions            G-5 
  183.   G.2.9     Jump and Jump to Subroutine Instructions     G-6 
  184.   G.2.10    Condition Code Register Instructions         G-6 
  185.   G.2.11    Multiply and Accumulate Instructions         G-6 
  186.  
  187. APPENDIX H  AS8085 ASSEMBLER                             H-1 
  188.   H.1     8085 REGISTER SET                              H-1 
  189.   H.2     8085 INSTRUCTION SET                           H-1 
  190.   H.2.1     Inherent Instructions                        H-2 
  191.   H.2.2     Register/Memory/Immediate Instructions       H-2 
  192.   H.2.3     Call and Return Instructions                 H-2 
  193.   H.2.4     Jump Instructions                            H-2 
  194.   H.2.5     Input/Output/Reset Instructions              H-3 
  195.   H.2.6     Move Instructions                            H-3 
  196.   H.2.7     Other Instructions                           H-3 
  197.  
  198. APPENDIX I  ASZ80 ASSEMBLER                              I-1 
  199.   I.1     .hd64 DIRECTIVE                                I-1 
  200.   I.2     Z80 REGISTER SET AND CONDITIONS                I-1 
  201.   I.3     Z80 INSTRUCTION SET                            I-2 
  202.   I.3.1     Inherent Instructions                        I-3 
  203.   I.3.2     Implicit Operand Instructions                I-3 
  204.   I.3.3     Load Instruction                             I-4 
  205.   I.3.4     Call/Return Instructions                     I-4 
  206.   I.3.5     Jump and Jump to Subroutine Instructions     I-4 
  207.                                                      Page iv
  208.  
  209.  
  210.  
  211.   I.3.6     Bit Manipulation Instructions                I-5 
  212.   I.3.7     Interrupt Mode and Reset Instructions        I-5 
  213.   I.3.8     Input and Output Instructions                I-5 
  214.   I.3.9     Register Pair Instructions                   I-5 
  215.   I.3.10    HD64180 Specific Instructions                I-6 
  216.  
  217.  
  218.                                                                   Page v
  219.         
  220.  
  221.  
  222.          
  223.  
  224.  
  225.  
  226.  
  227.  
  228.                                   P R E F A C E
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.            The  ASxxxx  assemblers  were  written following the style of
  236.         several cross assemblers found in the Digital Equipment Corpora-
  237.         tion  Users  Society  (DECUS)  distribution of the C programming
  238.         language.  The DECUS code was provided with no documentation  as
  239.         to  the  input  syntax  or the output format.  Study of the code
  240.         revealed that the unknown author of the code  had  attempted  to
  241.         formulate  an assembler with attributes similiar to those of the
  242.         PDP-11 MACRO assembler (without macro's).  The  incomplete  code
  243.         from  the  DECUS C distribution has been largely rewritten, only
  244.         the program structure, and C source  file  organization  remains
  245.         relatively  unchanged.   However, I wish to thank the author for
  246.         his contribution to this set of assemblers.  
  247.  
  248.            The  ASLINK  program was written as a companion to the ASxxxx
  249.         assemblers, its design and implementation was not  derived  from
  250.         any other work.  
  251.  
  252.            The  ASxxxx  assemblers  and the ASLINK relocating linker are
  253.         placed in the Public Domain.   Publication  or  distribution  of
  254.         these programs for non-commercial use is hereby granted with the
  255.         stipulation that the  copyright  notice  be  included  with  all
  256.         copies.  
  257.  
  258.            I  would  greatly  appreciate  receiving  the  details of any
  259.         changes, additions, or errors pertaining to these  programs  and
  260.         will  attempt  to  incorporate  any  fixes  or  generally useful
  261.         changes in a future update to these programs.  
  262.  
  263.  
  264.  
  265.  
  266.                        Alan R.  Baldwin 
  267.                        Kent State University 
  268.                        Physics Department 
  269.                        Kent, Ohio 44242 
  270.  
  271.  
  272.          
  273.  
  274.  
  275.  
  276.  
  277.  
  278.                         C H A N G E S   I N   V 0 1 . 5 0
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.            The  ASxxxx  assembler  and  linker have been updated to move
  286.         byte index, direct page  mode,  and  byte  pc  relative  address
  287.         checking  from the assembler to the linker.  This change has al-
  288.         lowed the following enhancements:  
  289.  
  290.              1.  The  .setdp  directive  now has a common format for all
  291.                  AS68xx assemblers.  
  292.  
  293.              2.  Direct  page  variables  may be externally defined with
  294.                  their addresses resolved at link time.  
  295.  
  296.              3.  Byte  index  offsets  may  be  external  references and
  297.                  resolved at link time.  
  298.  
  299.              4.  Byte  pc  relative  instructions  (i.e.   branches) may
  300.                  reference external labels or labels in other areas.  
  301.  
  302.  
  303.            The  ASxxxx  assemblers  (using  the  -f  or  -ff option) can
  304.         generate a listing file which flags the data that will be  relo-
  305.         cated by the linker.  
  306.  
  307.            The  REL file format now has an additional directive for pag-
  308.         ing information and has additional flags for  page0,  page,  and
  309.         unsigned  byte  formats.   The new linker is compatible with the
  310.         first version of the ASxxxx assemblers.  
  311.  
  312.            The  remaining changes are related to non-portable code found
  313.         while porting the assemblers to a motorola 68030 system.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.                                     CHAPTER 1
  329.  
  330.                                   THE ASSEMBLER
  331.  
  332.  
  333.  
  334.  
  335.  
  336.         1.1  THE ASXXXX ASSEMBLERS 
  337.  
  338.  
  339.            The  ASxxxx  assemblers are a series of microprocessor assem-
  340.         blers written in the C programming language.  Each assembler has
  341.         a device specific section which includes:  
  342.  
  343.              1.  device  description, byte order, and file extension in-
  344.                  formation 
  345.  
  346.              2.  a  table  of  the assembler general directives, special
  347.                  device directives, assembler mnemonics  and  associated
  348.                  operation codes 
  349.  
  350.              3.  machine specific code for processing the device mnemon-
  351.                  ics, addressing modes, and special directives 
  352.  
  353.         The device specific information is detailed in the appendices.  
  354.  
  355.            The assemblers have a common device independent section which
  356.         handles the details of file input/output, symbol  table  genera-
  357.         tion,  program/data  areas,  expression  analysis, and assembler
  358.         directive processing.  
  359.  
  360.         The assemblers provide the following features:  
  361.  
  362.              1.  Command string control of assembly functions 
  363.  
  364.              2.  Alphabetized, formatted symbol table listing 
  365.  
  366.              3.  Relocatable object modules 
  367.  
  368.              4.  Global symbols for linking object modules 
  369.  
  370.              5.  Conditional assembly directives 
  371.  
  372.  
  373.  
  374.         THE ASSEMBLER                                           PAGE 1-2
  375.         THE ASXXXX ASSEMBLERS
  376.  
  377.  
  378.              6.  Program sectioning directives 
  379.  
  380.  
  381.            ASxxxx assembles one or more source files into a single relo-
  382.         catable ascii object file.  The output of the ASxxxx  assemblers
  383.         consists of an ascii relocatable object file(*.rel), an assembly
  384.         listing file(*.lst), and a symbol file(*.sym).  
  385.  
  386.  
  387.         1.1.1  Assembly Pass 1 
  388.  
  389.  
  390.            During  pass  1, ASxxxx opens all source files and performs a
  391.         rudimenatry assembly of each source statement.  During this pro-
  392.         cess  all symbol tables are built, program sections defined, and
  393.         number of bytes for each assembled source line is estimated.  
  394.  
  395.            At the end of pass 1 all undefined symbols may be made global
  396.         (external) using the ASxxxx switch -g, otherwise undefined  sym-
  397.         bols will be flagged as errors during succeeding passes.  
  398.  
  399.  
  400.         1.1.2  Assembly Pass 2 
  401.  
  402.  
  403.            During  pass  2  the ASxxxx assembler resolves forward refer-
  404.         ences and determines the number  of  bytes  for  each  assembled
  405.         line.   The  number  of bytes used by a particular assembler in-
  406.         struction may depend upon the addressing mode, whether  the  in-
  407.         struction allows multiple forms based upon the relative distance
  408.         to the addressed location, or other factors.   Pass  2  resolves
  409.         these cases and determines the address of all symbols.  
  410.  
  411.  
  412.         1.1.3  Assembly Pass 3 
  413.  
  414.  
  415.            Pass 3 by the assembler generates the listing file, the relo-
  416.         catable output file, and the symbol tables.  Also during pass  3
  417.         the errors will be reported.  
  418.  
  419.            The  relocatable object file is an ascii file containing sym-
  420.         bol references and definitions, program  area  definitions,  and
  421.         the  relocatable assembled code, the linker ASLINK will use this
  422.         information to generate an absolute load file (Motorola or Intel
  423.         formats).  
  424.  
  425.  
  426.  
  427.  
  428.         THE ASSEMBLER                                           PAGE 1-3
  429.         SOURCE PROGRAM FORMAT
  430.  
  431.  
  432.         1.2  SOURCE PROGRAM FORMAT 
  433.  
  434.  
  435.  
  436.         1.2.1  Statement Format 
  437.  
  438.  
  439.            A source program is composed of assembly-language statements.
  440.         Each statement must be completed on one line.  A line  may  con-
  441.         tain a maximum of 128 characters, longer lines are truncated and
  442.         lost.  
  443.  
  444.            An  ASxxxx  assembler  statement  may  have  as  many as four
  445.         fields.  These fields are identified by their order  within  the
  446.         statement  and/or  by separating characters between fields.  The
  447.         general format of the ASxxxx statement is:  
  448.  
  449.               [label:]  Operator        Operand         [;Comment(s)] 
  450.  
  451.            The  label and comment fields are optional.  The operator and
  452.         operand fields are interdependent.  The operator field may be an
  453.         assembler  directive or an assembly mnemonic.  The operand field
  454.         may be optional or required as defined in  the  context  of  the
  455.         operator.  
  456.  
  457.            ASxxxx  interprets  and  processes source statements one at a
  458.         time.  Each statement causes a particular operation to  be  per-
  459.         formed.  
  460.  
  461.  
  462.         1.2.1.1  Label Field  - 
  463.  
  464.            A  label is a user-defined symbol which is assigned the value
  465.         of the current location counter and entered into  the  user  de-
  466.         fined  symbol  table.   The  current location counter is used by
  467.         ASxxxx to assign memory addresses to the source  program  state-
  468.         ments as they are encountered during the assembly process.  Thus
  469.         a label is a means  of  symbolically  referring  to  a  specific
  470.         statement.  
  471.  
  472.            When  a program section is absolute, the value of the current
  473.         location counter is absolute;  its value references an  absolute
  474.         memory  address.   Similarly, when a program section is relocat-
  475.         able, the value of the current location counter is  relocatable.
  476.         A  relocation  bias  calculated at link time is added to the ap-
  477.         parent value of the current location counter  to  establish  its
  478.         effective  absolute  address  at  execution time.  (The user can
  479.         also force the linker to relocate sections defined as  absolute.
  480.         This may be required under special circumstances.) 
  481.  
  482.            If  present,  a  label  must  be  the first field in a source
  483.         statement and must be terminated by a colon (:).   For  example,
  484.  
  485.  
  486.         THE ASSEMBLER                                           PAGE 1-4
  487.         SOURCE PROGRAM FORMAT
  488.  
  489.  
  490.         if  the  value  of  the  current  location  counter  is absolute
  491.         01F0(H), the statement:  
  492.  
  493.               abcd:     nop 
  494.  
  495.         assigns  the  value  01F0(H) to the label abcd.  If the location
  496.         counter value were relocatable, the final value of abcd would be
  497.         01F0(H)+K, where K represents the relocation bias of the program
  498.         section, as calculated by the linker at link time.  
  499.  
  500.            More  than  one label may appear within a single label field.
  501.         Each label so specified is assigned the same address value.  For
  502.         example,  if  the  value  of  the  current  location  counter is
  503.         1FF0(H), the multiple labels in the following statement are each
  504.         assigned the value 1FF0(H):  
  505.  
  506.               abcd:     aq:     $abc:   nop 
  507.  
  508.            Multiple labels may also appear on successive lines.  For ex-
  509.         ample, the statements 
  510.  
  511.               abcd:  
  512.               aq:  
  513.               $abc:     nop 
  514.  
  515.         likewise  cause  the  same value to be assigned to all three la-
  516.         bels.  
  517.  
  518.            A  double  colon  (::)  defines the label as a global symbol.
  519.         For example, the statement 
  520.  
  521.               abcd::    nop 
  522.  
  523.         establishes the label abcd as a global symbol.  The distinguish-
  524.         ing attribute of a global symbol is that it  can  be  referenced
  525.         from  within an object module other than the module in which the
  526.         symbol is defined.  References to this label  in  other  modules
  527.         are  resolved when the modules are linked as a composite execut-
  528.         able image.  
  529.  
  530.         The legal characters for defining labels are:  
  531.  
  532.                 A through Z 
  533.                 a through z 
  534.                 0 through 9 
  535.                 . (Period) 
  536.                 $ (Dollar sign) 
  537.                 _ (underscore) 
  538.  
  539.            A  label may be any length, however, only the first eight (8)
  540.         characters are significant and, therefore must be  unique  among
  541.         all   labels  in  the  source  program  (not  necessarily  among
  542.  
  543.  
  544.         THE ASSEMBLER                                           PAGE 1-5
  545.         SOURCE PROGRAM FORMAT
  546.  
  547.  
  548.         separately compiled modules).  An error code(s) (m or p) will be
  549.         generated  in the assembly listing if the first eight characters
  550.         in two or more labels are the same.  The m code is caused by the
  551.         redeclaration  of  the symbol or its reference by another state-
  552.         ment.  The p code is generated because the symbols  location  is
  553.         changing on each pass through the source file.  
  554.  
  555.            The  label  must  not  start with the characters 0-9, as this
  556.         designates a local symbol with special attributes described in a
  557.         later section.  
  558.  
  559.  
  560.         1.2.1.2  Operator Field  - 
  561.  
  562.            The  operator field specifies the action to be performed.  It
  563.         may consist of an instruction mnemonic (op code) or an assembler
  564.         directive.  
  565.  
  566.            When  the  operator is an instruction mnemonic, a machine in-
  567.         struction is generated and the assembler evaluates the addresses
  568.         of  the operands which follow.  When the operator is a directive
  569.         ASxxxx performs certain control actions or processing operations
  570.         during assembly of the source program.  
  571.  
  572.            Leading  and  trailing  spaces  or tabs in the operator field
  573.         have no significance;  such characters serve  only  to  separate
  574.         the operator field from the preceeding and following fields.  
  575.  
  576.            An operator is terminated by a space, tab or end of line.  
  577.  
  578.  
  579.         1.2.1.3  Operand Field  - 
  580.  
  581.            When  the  operator is an instruction mnemonic (op code), the
  582.         operand  field  contains  program  variables  that  are  to   be
  583.         evaluated/manipulated by the operator.  
  584.  
  585.            Operands  may  be  expressions  or  symbols, depending on the
  586.         operator.  Multiple expressions used in the operand  fields  may
  587.         be  separated  by a comma.  An operand should be preceeded by an
  588.         operator field;  if it is not, the statement will give an  error
  589.         (q  or  o).   All  operands  following instruction mnemonics are
  590.         treated as expressions.  
  591.  
  592.            The operand field is terminated by a semicolon when the field
  593.         is followed  by  a  comment.   For  example,  in  the  following
  594.         statement:  
  595.  
  596.               label:    lda     abcd,x          ;Comment field 
  597.  
  598.         the  tab  between lda and abcd terminates the operator field and
  599.         defines the beginning of the operand field;  a  comma  separates
  600.  
  601.  
  602.         THE ASSEMBLER                                           PAGE 1-6
  603.         SOURCE PROGRAM FORMAT
  604.  
  605.  
  606.         the operands abcd and x;  and a semicolon terminates the operand
  607.         field and defines the beginning of the comment field.   When  no
  608.         comment  field  follows,  the operand field is terminated by the
  609.         end of the source line.  
  610.  
  611.  
  612.         1.2.1.4  Comment Field  - 
  613.  
  614.            The comment field begins with a semicolon and extends through
  615.         the end of the line.  This field is optional and may contain any
  616.         7-bit ascii character except null.  
  617.  
  618.            Comments  do not affect assembly processing or program execu-
  619.         tion.  
  620.  
  621.  
  622.         1.3  SYMBOLS AND EXPRESSIONS 
  623.  
  624.  
  625.            This  section  describes the generic components of the ASxxxx
  626.         assemblers:  the character set, the conventions observed in con-
  627.         structing  symbols,  and  the use of numbers, operators, and ex-
  628.         pressions.  
  629.  
  630.  
  631.         1.3.1  Character Set 
  632.  
  633.  
  634.            The following characters are legal in ASxxxx source programs: 
  635.  
  636.              1.  The  letters  A  through Z.  Both upper- and lower-case
  637.                  letters are acceptable.  The assemblers are case sensi-
  638.                  tive,  i.e.  ABCD and abcd are different symbols.  (The
  639.                  assemblers can be made case insensitive by  recompiling
  640.                  with the appropriate switches.) 
  641.  
  642.              2.  The digits 0 through 9 
  643.  
  644.              3.  The  characters . (period), $ (dollar sign), and _ (un-
  645.                  derscore).  
  646.  
  647.              4.  The special characters listed in Tables 1 through 6.  
  648.  
  649.  
  650.            Tables  1  through  6  describe  the various ASxxxx label and
  651.         field terminators, assignment operators, operand separators, as-
  652.         sembly, unary, binary, and radix operators.  
  653.  
  654.  
  655.         THE ASSEMBLER                                           PAGE 1-7
  656.         SYMBOLS AND EXPRESSIONS
  657.  
  658.  
  659.         Table 1         Label Terminators and Assignment Operators 
  660.         ---------------------------------------------------------------- 
  661.  
  662.                 :   Colon               Label terminator.  
  663.  
  664.                 ::  Double colon        Label  Terminator;   defines the
  665.                                         label as a global label.  
  666.  
  667.                 =   Equal sign          Direct assignment operator.  
  668.  
  669.                 ==  Double equal        Direct assignment operator;  
  670.                     sign                defines  the  symbol as a global
  671.                                         symbol.  
  672.  
  673.         ---------------------------------------------------------------- 
  674.  
  675.  
  676.  
  677.  
  678.  
  679.         Table 2         Field Terminators and Operand Separators 
  680.         ---------------------------------------------------------------- 
  681.  
  682.                     Tab                 Item or field terminator.  
  683.  
  684.                     Space               Item or field terminator.  
  685.  
  686.                 ,   Comma               Operand field separator.  
  687.  
  688.                 ;   Semicolon           Comment field indicator.  
  689.  
  690.         ---------------------------------------------------------------- 
  691.  
  692.  
  693.  
  694.  
  695.  
  696.         Table 3         Assembler Operators 
  697.         ---------------------------------------------------------------- 
  698.  
  699.                 #   Number sign         Immediate expression indicator. 
  700.  
  701.                 .   Period              Current location counter.  
  702.  
  703.                 (   Left parenthesis    Expression delimiter.  
  704.  
  705.                 )   Right parenthesis   Expression delimeter.  
  706.  
  707.         ---------------------------------------------------------------- 
  708.  
  709.  
  710.         THE ASSEMBLER                                           PAGE 1-8
  711.         SYMBOLS AND EXPRESSIONS
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.         Table 4         Unary Operators 
  720.         ---------------------------------------------------------------- 
  721.  
  722.                 <   Left bracket        <FEDC   Produces  the lower byte
  723.                                                 value of the expression.
  724.                                                 (DC) 
  725.  
  726.                 >   Right bracket       >FEDC   Produces  the upper byte
  727.                                                 value of the expression.
  728.                                                 (FE) 
  729.  
  730.                 +   Plus sign           +A      Positive value of A 
  731.  
  732.                 -   Minus sign          -A      Produces   the  negative
  733.                                                 (2's complement) of A.  
  734.  
  735.                 ~   Tilde               ~A      Produces the 1's comple-
  736.                                                 ment of A.  
  737.  
  738.                 '   Single quote        'D      Produces  the  value  of
  739.                                                 the character D.  
  740.  
  741.                 "   Double quote        "AB     Produces the double byte
  742.                                                 value for AB.  
  743.  
  744.                 \   Backslash           '\n     Unix style characters 
  745.                                                 \b, \f, \n, \r, \t 
  746.                                      or '\001   or octal byte values.  
  747.  
  748.         ---------------------------------------------------------------- 
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756.         THE ASSEMBLER                                           PAGE 1-9
  757.         SYMBOLS AND EXPRESSIONS
  758.  
  759.  
  760.         Table 5         Binary Operators 
  761.         ---------------------------------------------------------------- 
  762.  
  763.                 <<  Double          0800 << 4   Produces the 4 bit 
  764.                     Left bracket                left-shifted   value  of
  765.                                                 0800.  (8000) 
  766.  
  767.                 >>  Double          0800 >> 4   Produces the 4 bit 
  768.                     Right bracket               right-shifted  value  of
  769.                                                 0800.  (0080) 
  770.  
  771.                 +   Plus sign       A + B       Arithmetic      Addition
  772.                                                 operator.  
  773.  
  774.                 -   Minus sign      A - B       Arithmetic   Subtraction
  775.                                                 operator.  
  776.  
  777.                 *   Asterisk        A * B       Arithmetic   Multiplica-
  778.                                                 tion operator.   (signed
  779.                                                 16-bit) 
  780.  
  781.                 /   Slash           A / B       Arithmetic      Division
  782.                                                 operator.        (signed
  783.                                                 16-bit quotient) 
  784.  
  785.                 &   Ampersand       A & B       Logical AND operator.  
  786.  
  787.                 |   Bar             A | B       Logical OR operator.  
  788.  
  789.                 %   Percent sign    A % B       Modulus operator.  
  790.                                                 (16-bit value) 
  791.  
  792.                 ^   Up arrow or     A ^ B       EXCLUSIVE OR operator.  
  793.                     circumflex 
  794.  
  795.         ---------------------------------------------------------------- 
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.         THE ASSEMBLER                                          PAGE 1-10
  804.         SYMBOLS AND EXPRESSIONS
  805.  
  806.  
  807.         Table 6         Temporary Radix Operators 
  808.         ---------------------------------------------------------------- 
  809.  
  810.                 0b, 0B                  Binary radix operator.  
  811.  
  812.                 0@, 0o, 0O, 0q, 0Q      Octal radix operator.  
  813.  
  814.                 0d, 0D                  Decimal radix operator.  
  815.  
  816.                 0h, 0H, 0x, 0X          Hexidecimal radix operator.  
  817.  
  818.  
  819.                 Potential  ambiguities arising from the use of 0b and 0d
  820.                 as temporary radix operators may be circumvented by pre-
  821.                 ceding  all  non-prefixed  hexidecimal  numbers with 00.
  822.                 Leading 0's are required in any  case  where  the  first
  823.                 hexidecimal  digit is abcdef as the assembler will treat
  824.                 the letter sequence as a label.  
  825.  
  826.         ---------------------------------------------------------------- 
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.         1.3.2  User-Defined Symbols 
  835.  
  836.  
  837.            User-defined  symbols are those symbols that are equated to a
  838.         specific value through a direct assignment statement  or  appear
  839.         as  labels.  These symbols are added to the User Symbol Table as
  840.         they are encountered during assembly.  
  841.  
  842.         The following rules govern the creation of user-defined symbols: 
  843.  
  844.              1.  Symbols  can  be  composed  of alphanumeric characters,
  845.                  dollar signs ($),  periods  (.),  and  underscores  (_)
  846.                  only.  
  847.  
  848.              2.  The  first  character  of a symbol must not be a number
  849.                  (except in the case of local symbols).  
  850.  
  851.              3.  The  first eight characters of a symbol must be unique.
  852.                  A symbol can be written  with  more  than  eight  legal
  853.                  characters, but the ninth and subsequent characters are
  854.                  ignored.  
  855.  
  856.              4.  Spaces and Tabs must not be embedded within a symbol.  
  857.  
  858.  
  859.  
  860.  
  861.         THE ASSEMBLER                                          PAGE 1-11
  862.         SYMBOLS AND EXPRESSIONS
  863.  
  864.  
  865.         1.3.3  Local Symbols 
  866.  
  867.  
  868.            Local  symbols are specially formatted symbols used as labels
  869.         within a block of coding that has been delimited as a local sym-
  870.         bol  block.   Local  symbols  are  of  the form n$, where n is a
  871.         decimal integer from 0 to 255,  inclusive.   Examples  of  local
  872.         symbols are:  
  873.  
  874.               1$ 
  875.               27$ 
  876.               138$ 
  877.               244$ 
  878.  
  879.            The  range  of  a local symbol block consists of those state-
  880.         ments between two normally constructed  symbolic  labels.   Note
  881.         that a statement of the form:  
  882.  
  883.               ALPHA = EXPRESSION 
  884.  
  885.         is a direct assignment statement but does not create a label and
  886.         thus does not delimit the range of a local symbol block.  
  887.  
  888.            Note that the range of a local symbol block may extend across
  889.         program areas.  
  890.  
  891.            Local symbols provide a convenient means of generating labels
  892.         for branch instructions and other such references  within  local
  893.         symbol  blocks.   Using local symbols reduces the possibility of
  894.         symbols with multiple definitions appearing within a  user  pro-
  895.         gram.   In  addition,  the  use  of local symbols differentiates
  896.         entry-point labels from local labels, since local labels  cannot
  897.         be referenced from outside their respective local symbol blocks.
  898.         Thus, local symbols of the same name can appear in  other  local
  899.         symbol blocks without conflict.  Local symbols require less sym-
  900.         bol table space than normal symbols.  Their use is recommended. 
  901.  
  902.            The  use of the same local symbol within a local symbol block
  903.         will generate one or both of the m or p errors.  
  904.  
  905.  
  906.         THE ASSEMBLER                                          PAGE 1-12
  907.         SYMBOLS AND EXPRESSIONS
  908.  
  909.  
  910.         Example of local symbols:  
  911.  
  912.                 a:      ldx     #atable ;get table address
  913.                         lda     #0d48   ;table length
  914.                 1$:     clr     ,x+     ;clear
  915.                         deca
  916.                         bne     1$
  917.                         
  918.                 b:      ldx     #btable ;get table address
  919.                         lda     #0d48   ;table length
  920.                 1$:     clr     ,x+     ;clear
  921.                         deca
  922.                         bne     1$
  923.  
  924.  
  925.         1.3.4  Current Location Counter 
  926.  
  927.  
  928.            The  period  (.) is the symbol for the current location coun-
  929.         ter.  When used in the operand  field  of  an  instruction,  the
  930.         period   represents  the  address  of  the  first  byte  of  the
  931.         instruction:  
  932.  
  933.                 AS:     ldx     #.      ;The period (.) refers to
  934.                                         ;the address of the ldx
  935.                                         ;instruction.
  936.  
  937.            When  used  in  the  operand field of an ASxxxx directive, it
  938.         represents the address of the current byte or word:  
  939.  
  940.                 QK = 0
  941.         
  942.                 .word   0xFFFE,.+4,QK   ;The operand .+4 in the .word
  943.                                         ;directive represents a value
  944.                                         ;stored in the second of the
  945.                                         ;three words during assembly.
  946.  
  947.            If  we  assume  the  current  value of the program counter is
  948.         0H0200, then during assembly, ASxxxx  reserves  three  words  of
  949.         storage  starting  at  location 0H0200.  The first value, a hex-
  950.         idecimal constant FFFE, will be stored at location 0H0200.   The
  951.         second  value  represented  by  .+4  will  be stored at location
  952.         0H0202, its value will be 0H0206 ( = 0H0202  +  4).   The  third
  953.         value  defined  by  the  symbol  QK  will  be placed at location
  954.         0H0204.  
  955.  
  956.            At the beginning of each assembly pass, ASxxxx resets the lo-
  957.         cation counter.  Normally, consecutive memory locations are  as-
  958.         signed  to  each  byte  of  object code generated.  However, the
  959.         value of the location counter can be changed  through  a  direct
  960.         assignment statement of the following form:  
  961.  
  962.  
  963.  
  964.         THE ASSEMBLER                                          PAGE 1-13
  965.         SYMBOLS AND EXPRESSIONS
  966.  
  967.  
  968.               . = . + expression 
  969.  
  970.  
  971.            The  new  location  counter can only be specified relative to
  972.         the current location counter.  Neglecting to specify the current
  973.         program  counter  along with the expression on the right side of
  974.         the assignment operator will generate the (.) error.   (Absolute
  975.         program areas may use the .org directive to specify the absolute
  976.         location of the current program counter.) 
  977.  
  978.         The following coding illustrates the use of the current location
  979.         counter:  
  980.  
  981.                 .area   CODE1   (ABS)   ;program area CODE1
  982.                                         ;is ABSOLUTE
  983.         
  984.                 .org    0H100           ;set location to
  985.                                         ;0H100 absolute
  986.         
  987.         num1:   ldx     #.+0H10         ;The label num1 has
  988.                                         ;the value 0H100.
  989.                                         ;X is loaded with
  990.                                         ;0H100 + 0H10
  991.         
  992.                 .org    0H130           ;location counter
  993.                                         ;set to 0H130
  994.         
  995.         num2:   ldy     #.              ;The label num2 has
  996.                                         ;the value 0H130.
  997.                                         ;Y is loaded with
  998.                                         ;value 0H130.
  999.         
  1000.         
  1001.                 .area   CODE2   (REL)   ;program area CODE2
  1002.                                         ;is RELOCATABLE
  1003.         
  1004.                 . = . + 0H20            ;Set location counter
  1005.                                         ;to relocatable 0H20 of
  1006.                                         ;the program section.
  1007.         
  1008.         num3:   .word   0               ;The label num3 has
  1009.                                         ;the value
  1010.                                         ;of relocatable 0H20.
  1011.         
  1012.                 . = . + 0H40            ;will reserve 0H40
  1013.                                         ;bytes of storage as will
  1014.                 .blkb   0H40            ;or
  1015.                 .blkw   0H20
  1016.  
  1017.            The  .blkb  and .blkw directives are the preferred methods of
  1018.         allocating space.  
  1019.  
  1020.  
  1021.  
  1022.         THE ASSEMBLER                                          PAGE 1-14
  1023.         SYMBOLS AND EXPRESSIONS
  1024.  
  1025.  
  1026.         1.3.5  Numbers 
  1027.  
  1028.  
  1029.            ASxxxx  assumes that all numbers in the source program are to
  1030.         be interpreted in decimal radix unless otherwise specified.  The
  1031.         .radix  directive  may  be used to specify the default as octal,
  1032.         decimal, or hexidecimal.  Individual numbers can  be  designated
  1033.         as  binary, octal, decimal, or hexidecimal through the temporary
  1034.         radix prefixes shown in table 6.  
  1035.  
  1036.            Negative  numbers  must be preceeded by a minus sign;  ASxxxx
  1037.         translates such numbers into two's  complement  form.   Positive
  1038.         numbers may (but need not) be preceeded by a plus sign.  
  1039.  
  1040.            Numbers are always considered to be absolute values, therefor
  1041.         they are never relocatable.  
  1042.  
  1043.  
  1044.         1.3.6  Terms 
  1045.  
  1046.  
  1047.            A  term is a component of an expression and may be one of the
  1048.         following:  
  1049.  
  1050.  
  1051.              1.  A number.  
  1052.  
  1053.              2.  A symbol:  
  1054.                  1.  A  period (.) specified in an expression causes the
  1055.                      current location counter to be used.  
  1056.                  2.  A User-defined symbol.  
  1057.                  3.  An undefined symbol is assigned a value of zero and
  1058.                      inserted in the User-Defined symbol table as an un-
  1059.                      defined symbol.  
  1060.  
  1061.              3.  A single quote followed by a single ascii character, or
  1062.                  a double quote followed by two ascii characters.  
  1063.  
  1064.              4.  An  expression enclosed in parenthesis.  Any expression
  1065.                  so enclosed is evaluated and reduced to a  single  term
  1066.                  before  the remainder of the expression in which it ap-
  1067.                  pears is evaluated.  Parenthesis, for example,  may  be
  1068.                  used  to  alter the left-to-right evaluation of expres-
  1069.                  sions, (as in A*B+C versus A*(B+C)), or to apply a  un-
  1070.                  ary operator to an entire expression (as in -(A+B)).  
  1071.  
  1072.              5.  A unary operator followed by a symbol or number.  
  1073.  
  1074.  
  1075.  
  1076.  
  1077.  
  1078.         THE ASSEMBLER                                          PAGE 1-15
  1079.         SYMBOLS AND EXPRESSIONS
  1080.  
  1081.  
  1082.         1.3.7  Expressions 
  1083.  
  1084.  
  1085.            Expressions  are  combinations  of  terms  joined together by
  1086.         binary operators.  Expressions reduce to a  16-bit  value.   The
  1087.         evaluation  of  an  expression includes the determination of its
  1088.         attributes.  A resultant expression value may be  one  of  three
  1089.         types  (as  described  later in this section):  relocatable, ab-
  1090.         solute, and external.  
  1091.  
  1092.         Expressions are evaluate with an operand hierarchy as follows:  
  1093.  
  1094.                 *       /       %       multiplication,
  1095.                                         division, and
  1096.                                         modulus first.
  1097.         
  1098.                 +       -               addition and
  1099.                                         subtraction second.
  1100.         
  1101.                 <<      >>              left shift and
  1102.                                         right shift third.
  1103.         
  1104.                 ^                       exclusive or fourth.
  1105.         
  1106.                 &                       logical and fifth.
  1107.         
  1108.                 |                       logical or last
  1109.         
  1110.                 except that unary operators take precedence over binary
  1111.                 operators.
  1112.  
  1113.  
  1114.            A  missing  or  illegal  operator  terminates  the expression
  1115.         analysis, causing error codes (o) and/or  (q)  to  be  generated
  1116.         depending upon the context of the expression itself.  
  1117.  
  1118.            At assembly time the value of an external (global) expression
  1119.         is equal to the value of the absolute part of  that  expression.
  1120.         For  example,  the expression external+4, where 'external' is an
  1121.         external symbol, has the value of 4.  This expression,  however,
  1122.         when  evaluated  at link time takes on the resolved value of the
  1123.         symbol 'external', plus 4.  
  1124.  
  1125.            Expressions,  when  evaluated  by  ASxxxx,  are  one of three
  1126.         types:  relocatable, absolute, or external.  The following  dis-
  1127.         tinctions are important:  
  1128.  
  1129.              1.  An  expression is relocatable if its value is fixed re-
  1130.                  lative to the base address of the program area in which
  1131.                  it appears;  it will have an offset value added at link
  1132.                  time.  Terms that contain labels defined in relocatable
  1133.                  program   areas   will   have   a   relocatable  value;
  1134.  
  1135.  
  1136.         THE ASSEMBLER                                          PAGE 1-16
  1137.         SYMBOLS AND EXPRESSIONS
  1138.  
  1139.  
  1140.                  similarly, a period (.) in a relocatable program  area,
  1141.                  representing  the value of the current program location
  1142.                  counter, will also have a relocatable value.  
  1143.  
  1144.              2.  An  expression  is  absolute if its value is fixed.  An
  1145.                  expression whose terms are numbers and ascii characters
  1146.                  will  reduce  to  an absolute value.  A relocatable ex-
  1147.                  pression or term minus a relocatable term,  where  both
  1148.                  elements  being  evaluated  belong  to the same program
  1149.                  area, is an absolute expression.  This is because every
  1150.                  term  in  a  program area has the same relocation bias.
  1151.                  When one term is subtracted from the other the  reloca-
  1152.                  tion bias is zero.  
  1153.  
  1154.              3.  An  expression is external (or global) if it contains a
  1155.                  single global reference (plus or minus an absolute  ex-
  1156.                  pression  value) that is not defined within the current
  1157.                  program.  Thus, an external  expression  is  only  par-
  1158.                  tially  defined following assembly and must be resolved
  1159.                  at link time.  
  1160.  
  1161.  
  1162.  
  1163.         1.4  GENERAL ASSEMBLER DIRECTIVES 
  1164.  
  1165.  
  1166.            An  ASxxxx  directive  is placed in the operator field of the
  1167.         source line.  Only one directive is  allowed  per  source  line.
  1168.         Each  directive  may  have  a blank operand field or one or more
  1169.         operands.  Legal operands differ with each directive.  
  1170.  
  1171.  
  1172.         1.4.1  .module Directive 
  1173.  
  1174.         Format:  
  1175.  
  1176.                 .module string 
  1177.  
  1178.            The .module directive causes the string to be included in the
  1179.         assemblers output file as an identifier for this particular  ob-
  1180.         ject  module.   The  string  may  be  from  1 to 8 characters in
  1181.         length.  Only one identifier is allowed  per  assembled  module.
  1182.         The  main use of this directive is to allow the linker to report
  1183.         a modules' use of undefined symbols.  At link time all undefined
  1184.         symbols  are  reported  and  the  modules  referencing  them are
  1185.         listed.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.         THE ASSEMBLER                                          PAGE 1-17
  1191.         GENERAL ASSEMBLER DIRECTIVES
  1192.  
  1193.  
  1194.         1.4.2  .title Directive 
  1195.  
  1196.         Format:  
  1197.  
  1198.                 .title  string 
  1199.  
  1200.            The .title directive provides a character string to be placed
  1201.         on the second line of each page during listing.  
  1202.  
  1203.  
  1204.         1.4.3  .sbttl Directive 
  1205.  
  1206.         Format:  
  1207.  
  1208.                 .sbttl  string 
  1209.  
  1210.            The .sbttl directive provides a character string to be placed
  1211.         on the third line of each page during listing.  
  1212.  
  1213.  
  1214.         1.4.4  .page Directive 
  1215.  
  1216.         Format:  
  1217.  
  1218.                 .page 
  1219.  
  1220.            The .page directive causes a page ejection with a new heading
  1221.         to be printed.  The new page occurs after the next line  of  the
  1222.         source  program is processed, this allows an immediately follow-
  1223.         ing .sbttl directive to appear  on  the  new  page.   The  .page
  1224.         source line will not appear in the file listing.  
  1225.  
  1226.  
  1227.         1.4.5  .byte and .db Directives 
  1228.  
  1229.         Format:  
  1230.  
  1231.                 .byte   exp             ;Stores the binary value
  1232.                 .db     exp             ;of the expression in the
  1233.                                         ;next byte.
  1234.         
  1235.                 .byte   exp1,exp2,expn  ;Stores the binary values
  1236.                 .db     exp1,exp2,expn  ;of the list of expressions
  1237.                                         ;in successive bytes.
  1238.         
  1239.         where:  exp,    represent expressions that will be
  1240.                 exp1,   truncated to 8-bits of data.
  1241.                 .       Each expression will be calculated
  1242.                 .       as a 16-bit word expression,
  1243.                 .       the high-order byte will be truncated.
  1244.                 .       Multiple expressions must be
  1245.                 expn    separated by commas.
  1246.  
  1247.  
  1248.         THE ASSEMBLER                                          PAGE 1-18
  1249.         GENERAL ASSEMBLER DIRECTIVES
  1250.  
  1251.  
  1252.            The  .byte  or .db directives are used to generate successive
  1253.         bytes of binary data in the object module.  
  1254.  
  1255.  
  1256.         1.4.6  .word and .dw Directives 
  1257.  
  1258.         Format:  
  1259.  
  1260.                 .word   exp             ;Stores the binary value
  1261.                 .dw     exp             ;of the expression in
  1262.                                         ;the next word.
  1263.         
  1264.                 .word   exp1,exp2,expn  ;Stores the binary values
  1265.                 .dw     exp1,exp2,expn  ;of the list of expressions
  1266.                                         ;in successive words.
  1267.         
  1268.         where:  exp,    represent expressions that will occupy two
  1269.                 exp1,   bytes of data. Each expression will be
  1270.                 .       calculated as a 16-bit word expression.
  1271.                 .       Multiple expressions must be
  1272.                 expn    separated by commas.
  1273.  
  1274.            The  .word  or .dw directives are used to generate successive
  1275.         words of binary data in the object module.  
  1276.  
  1277.  
  1278.         1.4.7  .blkb, .blkw, and .ds Directives 
  1279.  
  1280.         Format:  
  1281.  
  1282.                 .blkb   N       ;reserve N bytes of space
  1283.                 .blkw   N       ;reserve N words of space
  1284.                 .ds     N       ;reserve N bytes of space
  1285.  
  1286.            The  .blkb  and .ds directives reserve byte blocks in the ob-
  1287.         ject module;  the .blkw directive reserves word blocks.  
  1288.  
  1289.  
  1290.         1.4.8  .ascii Directive 
  1291.  
  1292.         Format:  
  1293.  
  1294.                 .ascii  /string/ 
  1295.  
  1296.         where:  string  is a string of printable ascii characters.  
  1297.  
  1298.                 /  /    represent   the  delimiting  characters.   These
  1299.                         delimiters   may   be   any   paired    printing
  1300.                         characters,  as  long  as the characters are not
  1301.                         contained within  the  string  itself.   If  the
  1302.                         delimiting  characters  do not match, the .ascii
  1303.                         directive will give the (q) error.  
  1304.  
  1305.  
  1306.         THE ASSEMBLER                                          PAGE 1-19
  1307.         GENERAL ASSEMBLER DIRECTIVES
  1308.  
  1309.  
  1310.  
  1311.         The  .ascii  directive  places  one binary byte of data for each
  1312.         character in the string into the object module.  
  1313.  
  1314.  
  1315.         1.4.9  .asciz Directive 
  1316.  
  1317.         Format:  
  1318.  
  1319.                 .asciz  /string/ 
  1320.  
  1321.         where:  string  is a string of printable asciz characters.  
  1322.  
  1323.                 /  /    represent   the  delimiting  characters.   These
  1324.                         delimiters   may   be   any   paired    printing
  1325.                         characters,  as  long  as the characters are not
  1326.                         contained within  the  string  itself.   If  the
  1327.                         delimiting  characters  do not match, the .asciz
  1328.                         directive will give the (q) error.  
  1329.  
  1330.         The  .ascii  directive  places  one binary byte of data for each
  1331.         character in the string into the object module.   Following  all
  1332.         the  character  data  a  zero  byte is inserted to terminate the
  1333.         character string.  
  1334.  
  1335.  
  1336.         1.4.10  .radix Directive 
  1337.  
  1338.         Format:  
  1339.  
  1340.                 .radix  character 
  1341.  
  1342.         where:  character  represents  a single character specifying the
  1343.                         default radix to be used for succeeding numbers.
  1344.                         The character may be any one of the following:  
  1345.  
  1346.                         B,b     Binary
  1347.         
  1348.                         O,o     Octal
  1349.                         Q,q
  1350.                         @
  1351.         
  1352.                         D,d     Decimal
  1353.                         'blank'
  1354.         
  1355.                         H,h     Hexidecimal
  1356.                         X,x
  1357.  
  1358.  
  1359.  
  1360.  
  1361.         THE ASSEMBLER                                          PAGE 1-20
  1362.         GENERAL ASSEMBLER DIRECTIVES
  1363.  
  1364.  
  1365.         1.4.11  .even Directive 
  1366.  
  1367.         Format:  
  1368.  
  1369.                 .even 
  1370.  
  1371.            The .even directive ensures that the current location counter
  1372.         contains an even boundary value by adding 1 if the current loca-
  1373.         tion is odd.  
  1374.  
  1375.  
  1376.         1.4.12  .odd Directive 
  1377.  
  1378.         Format:  
  1379.  
  1380.                 .odd 
  1381.  
  1382.            The  .odd directive ensures that the current location counter
  1383.         contains an odd boundary value by adding one if the current  lo-
  1384.         cation is even.  
  1385.  
  1386.  
  1387.         1.4.13  .area Directive 
  1388.  
  1389.         Format:  
  1390.  
  1391.                 .area   name    [(options)] 
  1392.  
  1393.         where:  name    represents the symbolic name of the program sec-
  1394.                         tion.   This  name  may  be  the  same  as   any
  1395.                         user-defined  symbol  as  the area names are in-
  1396.                         dependent of all symbols and labels.  
  1397.  
  1398.                 options specify the type of program or data area:  
  1399.                         ABS     absolute (automatically invokes OVR) 
  1400.                         REL     relocatable 
  1401.                         OVR     overlay 
  1402.                         CON     concatenate 
  1403.                         PAG     paged area 
  1404.  
  1405.  
  1406.            The .area directive provides a means of defining and separat-
  1407.         ing multiple programming and data sections.   The  name  is  the
  1408.         area  label used by the assembler and the linker to collect code
  1409.         from various separately assembled modules into one section.  The
  1410.         name may be from 1 to 8 characters in length.  
  1411.  
  1412.            The options are specified within parenthesis and separated by
  1413.         commas as shown in the following example:  
  1414.  
  1415.                 .area  TEST  (REL,CON)  ;This section is relocatable
  1416.                                         ;and concatenated with other
  1417.  
  1418.  
  1419.         THE ASSEMBLER                                          PAGE 1-21
  1420.         GENERAL ASSEMBLER DIRECTIVES
  1421.  
  1422.  
  1423.                                         ;sections of this program area.
  1424.         
  1425.                 .area  DATA  (REL,OVR)  ;This section is relocatable
  1426.                                         ;and overlays other sections
  1427.                                         ;of this program area.
  1428.         
  1429.                 .area  SYS   (ABS,OVR)  ;(CON not allowed with ABS)
  1430.                                         ;This section is defined as
  1431.                                         ;absolute. Absolute sections
  1432.                                         ;are always overlayed with
  1433.                                         ;other sections of this program
  1434.                                         ;area.
  1435.         
  1436.                 .area  PAGE  (PAG)      ;This is a paged section. The
  1437.                                         ;section must be on a 256 byte
  1438.                                         ;boundary and its length is
  1439.                                         ;checked by the linker to be
  1440.                                         ;no larger than 256 bytes.
  1441.                                         ;This is useful for direct page
  1442.                                         ;areas.
  1443.  
  1444.            The  default  area type is REL|CON;  i.e.  a relocatable sec-
  1445.         tion which is concatenated with other sections of code with  the
  1446.         same area name.  The ABS option indicates an absolute area.  The
  1447.         OVR and CON options indicate if program  sections  of  the  same
  1448.         name  will overlay each other (start at the same location) or be
  1449.         concatenated with each other (appended to each other).  
  1450.  
  1451.            Multiple  invocations  of  the  .area directive with the same
  1452.         name must specify the same options or leave  the  options  field
  1453.         blank,  this  defaults  to  the previously specified options for
  1454.         this program area.  
  1455.  
  1456.            The  ASxxxx  assemblers  automatically  provide  two  program
  1457.         sections:  
  1458.  
  1459.                 '.  .ABS.'      This dumby section contains all absolute
  1460.                                 symbols and their values.  
  1461.  
  1462.                 '_CODE'         This  is  the default program/data area.
  1463.                                 This program area is of type (REL,CON). 
  1464.  
  1465.  
  1466.  
  1467.  
  1468.         THE ASSEMBLER                                          PAGE 1-22
  1469.         GENERAL ASSEMBLER DIRECTIVES
  1470.  
  1471.  
  1472.         1.4.14  .org Directive 
  1473.  
  1474.         Format:  
  1475.  
  1476.                 .org    exp 
  1477.  
  1478.         where:  exp     is  an absolute expression that becomes the cur-
  1479.                         rent location counter.  
  1480.  
  1481.         The  .org directive is valid only in an absolute program section
  1482.         and will give a (q) error if used in a relocatable program area.
  1483.         The  .org  directive specifies that the current location counter
  1484.         is to become the specified absolute value.  
  1485.  
  1486.  
  1487.         1.4.15  .globl Directive 
  1488.  
  1489.         Format:  
  1490.  
  1491.                 .globl  sym1,sym2,...,symn 
  1492.  
  1493.         where:  sym1,           represent legal symbolic names. When
  1494.                 sym2,...        When multiple symbols are specified,
  1495.                 symn            they are separated by commas.
  1496.  
  1497.            A  .globl directive may also have a label field and/or a com-
  1498.         ment field.  
  1499.  
  1500.            The  .globl directive is provided to define (and thus provide
  1501.         linkage to) symbols not  otherwise  defined  as  global  symbols
  1502.         within  a  module.   In  defining  global  symbols the directive
  1503.         .globl J is similar to:  
  1504.  
  1505.               J == expression or J::  
  1506.  
  1507.            Because  object  modules  are linked by global symbols, these
  1508.         symbols are vital to a program.  All internal symbols  appearing
  1509.         within  a  given program must be defined at the end of pass 1 or
  1510.         they will be considered undefined.  The assembly directive  (-g)
  1511.         can  be  be  invoked to make all undefined symbols global at the
  1512.         end of pass 1.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.         THE ASSEMBLER                                          PAGE 1-23
  1518.         GENERAL ASSEMBLER DIRECTIVES
  1519.  
  1520.  
  1521.         1.4.16  .if, .else, and .endif Directives 
  1522.  
  1523.         Format:  
  1524.  
  1525.                 .if     expr
  1526.                 .                       ;}
  1527.                 .                       ;} range of true condition
  1528.                 .                       ;}
  1529.                 .else
  1530.                 .                       ;}
  1531.                 .                       ;} range of false condition
  1532.                 .                       ;}
  1533.                 .endif
  1534.  
  1535.            The  conditional  assembly directives allow you to include or
  1536.         exclude blocks of source code during the assembly process, based
  1537.         on the evaluation of the condition test.  
  1538.  
  1539.            The  range of true condition will be processed if the expres-
  1540.         sion 'expr' is not zero (i.e.  true) and the range of false con-
  1541.         dition  will  be processed if the expression 'expr' is zero (i.e
  1542.         false).  The range of true condition is optional as is the .else
  1543.         directive  and  the range of false condition.  The following are
  1544.         all valid .if/.else/.endif constructions:  
  1545.  
  1546.                 .if     A-4             ;evaluate A-4
  1547.                 .byte   1,2             ;insert bytes if A-4 is
  1548.                 .endif                  ;not zero
  1549.         
  1550.                 .if     K+3             ;evaluate K+3
  1551.                 .else
  1552.                 .byte   3,4             ;insert bytes if K+3
  1553.                 .endif                  ;is zero
  1554.         
  1555.                 .if     J&3             ;evaluate J masked by 3
  1556.                 .byte   12              ;insert this byte if J&3
  1557.                 .else                   ;is not zero
  1558.                 .byte   13              ;insert this byte if J&3
  1559.                 .endif                  ;is zero
  1560.  
  1561.  
  1562.         The .if/.else/.endif directives may be nested upto 10 levels.  
  1563.  
  1564.            The  .page  directive  is  processed within a false condition
  1565.         range to allow extended textual information to  be  incorporated
  1566.         in  the  source  program  with  out  the need to use the comment
  1567.         delimiter (;):  
  1568.  
  1569.                 .if     0
  1570.         
  1571.                 .page
  1572.                 This text will be bypassed during assembly
  1573.  
  1574.  
  1575.         THE ASSEMBLER                                          PAGE 1-24
  1576.         GENERAL ASSEMBLER DIRECTIVES
  1577.  
  1578.  
  1579.                 but appear in the listing file.
  1580.                 .
  1581.                 .
  1582.                 .
  1583.         
  1584.                 .endif
  1585.  
  1586.  
  1587.         1.4.17  .include Directive 
  1588.  
  1589.         Format:  
  1590.  
  1591.                 .include        string 
  1592.  
  1593.         where:  string  represents  a  delimited string that is the file
  1594.                         specification of an ASxxxx source file.  
  1595.  
  1596.            The .include directive is used to insert a source file within
  1597.         the source file currently being assembled.  When this  directive
  1598.         is encountered, an implicit .page directive is issued.  When the
  1599.         end of the specified source file is reached, an  implicit  .page
  1600.         directive is issued and input continues from the previous source
  1601.         file.  The maximum nesting level of source files specified by  a
  1602.         .include  directive  is  five.  The line containing the .include
  1603.         directive will not appear in the listing file.  
  1604.  
  1605.            The  total  number  of separately specified .include files is
  1606.         unlimited as each .include file is opened and then closed during
  1607.         each pass made by the assembler.  
  1608.  
  1609.  
  1610.         1.4.18  .setdp Directive 
  1611.  
  1612.         Format:  
  1613.  
  1614.                 .setdp [base [,area]] 
  1615.  
  1616.         The  set  direct  page  directive has a common format in all the
  1617.         AS68xx assemblers.  The .setdp directive is used to  inform  the
  1618.         assembler  of  the current direct page region and the offset ad-
  1619.         dress within the selected area.  The normal  invocation  methods
  1620.         are:  
  1621.  
  1622.                 .area   DIRECT  (PAG)
  1623.                 .setdp
  1624.         
  1625.                 or
  1626.         
  1627.                 .setdp  0,DIRECT
  1628.  
  1629.         for  all  the  68xx microprocessors (the 6804 has only the paged
  1630.         ram area).  The commands specify that the direct page is in area
  1631.  
  1632.  
  1633.         THE ASSEMBLER                                          PAGE 1-25
  1634.         GENERAL ASSEMBLER DIRECTIVES
  1635.  
  1636.  
  1637.         DIRECT and its offset address is 0 (the only valid value for all
  1638.         but the 6809 microprocessor).  Be sure to place the DIRECT  area
  1639.         at address 0 during linking.  When the base address and area are
  1640.         not specified, then zero and the current area are the  defaults.
  1641.         If  a  .setdp directive is not issued the assembler defaults the
  1642.         direct page to the area "_CODE" at offset 0.  
  1643.  
  1644.            The  assembler  verifies  that  any  local variable used in a
  1645.         direct variable reference is located in this area.  Local  vari-
  1646.         able  and  constant value direct access addresses are checked to
  1647.         be within the address range from 0 to 255.  
  1648.  
  1649.            External direct references are assumed by the assembler to be
  1650.         in the correct area and have valid  offsets.   The  linker  will
  1651.         check all direct page relocations to verify that they are within
  1652.         the correct area.  
  1653.  
  1654.            The  6809  microprocessor  allows the selection of the direct
  1655.         page to be on any 256 byte boundary by loading  the  appropriate
  1656.         value  into the dp register.  Typically one would like to select
  1657.         the page boundary at link time, one method follows:  
  1658.  
  1659.                 .area   DIRECT  (PAG)   ; define the direct page
  1660.                 .setdp
  1661.                 .
  1662.                 .
  1663.                 .
  1664.                 .area   PROGRAM
  1665.                 .
  1666.                 ldd     #DIRECT         ; load the direct page register
  1667.                 tfr     a,dp            ; for access to the direct page
  1668.  
  1669.         At  link  time specify the base and global equates to locate the
  1670.         direct page:  
  1671.  
  1672.                 -b DIRECT = 0x1000
  1673.                 -g DIRECT = 0x1000
  1674.  
  1675.         Both  the  area address and offset value must be specified (area
  1676.         and variable names are independent).   The  linker  will  verify
  1677.         that  the  relocated  direct page accesses are within the direct
  1678.         page.  
  1679.  
  1680.  
  1681.         THE ASSEMBLER                                          PAGE 1-26
  1682.         GENERAL ASSEMBLER DIRECTIVES
  1683.  
  1684.  
  1685.         The  preceeding  sequence  could  be repeated for multiple paged
  1686.         areas, however an alternate method is to define a non-paged area
  1687.         and use the .setdp directive to specify the offset value:  
  1688.  
  1689.                 .area   DIRECT          ; define non-paged area
  1690.                 .
  1691.                 .
  1692.                 .
  1693.                 .area   PROGRAM
  1694.                 .
  1695.                 .setdp  0,DIRECT        ; direct page area
  1696.                 ldd     #DIRECT         ; load the direct page register
  1697.                 tfr     a,dp            ; for access to the direct page
  1698.                 .
  1699.                 .
  1700.                 .setdp  0x100,DIRECT    ; direct page area
  1701.                 ldd     #DIRECT+0x100   ; load the direct page register
  1702.                 tfr     a,dp            ; for access to the direct page
  1703.  
  1704.         The  linker  will  verify that subsequent direct page references
  1705.         are in the specified area and offset address range.  It  is  the
  1706.         programmers responsibility to load the dp register with the cor-
  1707.         rect page segment  corresponding  to  the  .setdp  base  address
  1708.         specified.  
  1709.  
  1710.            For  those  cases  where a single piece of code must access a
  1711.         defined data structure within a direct page and there  are  many
  1712.         pages,  define  a  dumby  direct page linked at address 0.  This
  1713.         dumby page is used only to define  the  variable  labels.   Then
  1714.         load  the dp register with the real base address but donot use a
  1715.         .setdp directive.  This method is equivalent to indexed address-
  1716.         ing,  where the dp register is the index register and the direct
  1717.         addressing is the offset.  
  1718.  
  1719.  
  1720.         1.5  INVOKING ASXXXX 
  1721.  
  1722.  
  1723.            The  ASxxxx  assemblers are command line oriented.  After the
  1724.         assembler is started, enter the option(s) and file(s) to  assem-
  1725.         ble following the 'argv:' prompt:  
  1726.  
  1727.         argv:  [-dqxgalosf] file1 [file2 file3 ...  file6] 
  1728.  
  1729.         The options are:  
  1730.  
  1731.                 d       decimal listing
  1732.                 q       octal   listing
  1733.                 x       hex     listing (default)
  1734.         
  1735.                         The listing radix affects the
  1736.                         .lst, .rel, and .sym files.
  1737.  
  1738.  
  1739.         THE ASSEMBLER                                          PAGE 1-27
  1740.         INVOKING ASXXXX
  1741.  
  1742.  
  1743.         
  1744.                 g       undefined symbols made global
  1745.                 a       all user symbols made global
  1746.         
  1747.                 l       create list   output file1.lst
  1748.                 o       create object output file1.rel
  1749.                 s       create symbol output file1.sym
  1750.         
  1751.                 f       flag relocatable references by  `   in the list-
  1752.         ing file
  1753.                 ff      flag relocatable references by mode in the list-
  1754.         ing file
  1755.  
  1756.            The file name for the .lst, .rel, and .sym files is the first
  1757.         file name specified in the command line.  All output  files  are
  1758.         ascii  text  files which may be edited, copied, etc.  The output
  1759.         files are the concatenation of all the input files, if files are
  1760.         to  be  assembled  independently  invoke  the assembler for each
  1761.         file.  
  1762.  
  1763.            The  .rel  file contains a radix directive so that the linker
  1764.         will use the proper conversion for this file.  Linked files  may
  1765.         have different radices.  
  1766.  
  1767.            If  the list (l) option is specified without the symbol table
  1768.         (s) option, the symbol table is placed at the end of the listing
  1769.         file.  
  1770.  
  1771.  
  1772.         1.6  ERRORS 
  1773.  
  1774.  
  1775.            The  ASxxxx assemblers provide limited diagnostic error codes
  1776.         during the assembly process, these errors will be noted  in  the
  1777.         listing file and printed on the stderr device.  The errors are: 
  1778.  
  1779.               (.)   This  error  is caused by an absolute direct assign-
  1780.                     ment of the current location counter 
  1781.                           . = expression (incorrect) 
  1782.                     rather than the correct 
  1783.                           . = . + expression 
  1784.  
  1785.               (a)   Indicates  a machine specific addressing or address-
  1786.                     ing mode error.  
  1787.  
  1788.               (b)   Indicates a direct page boundary error.  
  1789.  
  1790.               (d)   Indicates a direct page addressing error.  
  1791.  
  1792.               (i)   Caused  by  an  .include file error or an .if/.endif
  1793.                     mismatch.  
  1794.  
  1795.  
  1796.  
  1797.         THE ASSEMBLER                                          PAGE 1-28
  1798.         ERRORS
  1799.  
  1800.  
  1801.               (m)   Multiple  definitions  of  the  same label, multiple
  1802.                     .module directives, or multiple  conflicting  attri-
  1803.                     butes in an .area directive.  
  1804.  
  1805.               (o)   Directive  or  mnemonic error or the use of the .org
  1806.                     directive in a relocatable area.  
  1807.  
  1808.               (p)   Phase error:  label location changing between passes
  1809.                     2 and 3.  Normally caused by having  more  than  one
  1810.                     level of forward referencing.  
  1811.  
  1812.               (q)   Questionable syntax:  missing or improper operators,
  1813.                     terminators, or delimiters.  
  1814.  
  1815.               (r)   Relocation  error:   logic  operation attempted on a
  1816.                     relocatable term, addition of two relocatable terms,
  1817.                     subtraction  of two relocatable terms not within the
  1818.                     same programming area or external symbols.  
  1819.  
  1820.               (u)   Undefined symbol encountered during assembly.  
  1821.  
  1822.  
  1823.         1.7  LISTING FILE 
  1824.  
  1825.  
  1826.            The  (-l) option produces an ascii output listing file.  Each
  1827.         page of output contains a four line header:  
  1828.  
  1829.  
  1830.              1.  The ASxxxx program name and page number 
  1831.  
  1832.              2.  Title from a .title directive (if any) 
  1833.  
  1834.              3.  Subtitle from a .sbttl directive (if any) 
  1835.  
  1836.              4.  Blank line 
  1837.  
  1838.  
  1839.  
  1840.         Each succeeding line contains five fields:  
  1841.  
  1842.  
  1843.              1.  Error field (first three characters of line) 
  1844.  
  1845.              2.  Current location counter 
  1846.  
  1847.              3.  Generated code in byte format 
  1848.  
  1849.              4.  Source text line number 
  1850.  
  1851.              5.  Source text 
  1852.  
  1853.  
  1854.  
  1855.         THE ASSEMBLER                                          PAGE 1-29
  1856.         LISTING FILE
  1857.  
  1858.  
  1859.            The error field may contain upto 2 error flags indicating any
  1860.         errors encountered while assembling this line of source code.  
  1861.  
  1862.            The  current  location counter field displays the 16-bit pro-
  1863.         gram position.  This field will be in the selected radix.  
  1864.  
  1865.            The generated code follows the program location.  The listing
  1866.         radix determines the number of bytes that will be  displayed  in
  1867.         this field.  Hexidecimal listing allows six bytes of data within
  1868.         the field, decimal and octal allow four bytes within the  field.
  1869.         If more than one field of data is generated from the assembly of
  1870.         a single line of source code, then the data field is repeated on
  1871.         successive lines.  
  1872.  
  1873.            The source text line number is printed in decimal and is fol-
  1874.         lowed by the source text.  
  1875.  
  1876.            Two  special  cases  will  disable  the  listing of a line of
  1877.         source text:  
  1878.  
  1879.              1.  Source line with a .page directive is never listed.  
  1880.  
  1881.              2.  Source  line  with  a  .include  file  directive is not
  1882.                  listed unless the .include file cannot be opened.  
  1883.  
  1884.  
  1885.            Two  data  field  options  are  available to flag those bytes
  1886.         which will be relocated by the linker.   If  the  -f  option  is
  1887.         specified  then  each  byte to be relocated will be preceeded by
  1888.         the '`' character.  If the -ff option  is  specified  then  each
  1889.         byte  to  be relocated will be preceeded by one of the following
  1890.         characters:  
  1891.  
  1892.              1.  *   paged relocation 
  1893.  
  1894.              2.  u   unsigned byte relocation 
  1895.  
  1896.              3.  p   PCR byte or low  byte of word relocation 
  1897.  
  1898.              4.  q   PCR high byte of word relocation 
  1899.  
  1900.              5.  r   low  byte relocation 
  1901.  
  1902.              6.  s   high byte relocation 
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.         THE ASSEMBLER                                          PAGE 1-30
  1909.         SYMBOL TABLE FILE
  1910.  
  1911.  
  1912.         1.8  SYMBOL TABLE FILE 
  1913.  
  1914.  
  1915.            The symbol table has two parts:  
  1916.  
  1917.              1.  The alphabetically sorted list of symbols and/or labels
  1918.                  defined or referenced in the source program.  
  1919.  
  1920.              2.  A  list of the program areas defined during assembly of
  1921.                  the source program.  
  1922.  
  1923.  
  1924.            The sorted list of symbols and/or labels contains the follow-
  1925.         ing information:  
  1926.  
  1927.              1.  Program  area  number (none if absolute value or exter-
  1928.                  nal) 
  1929.  
  1930.              2.  The symbol or label 
  1931.  
  1932.              3.  Directly assigned symbol is denoted with an (=) sign 
  1933.  
  1934.              4.  The  value of a symbol, location of a label relative to
  1935.                  the program area base address (=0), or a ****  indicat-
  1936.                  ing the symbol or label is undefined.  
  1937.  
  1938.              5.  The  characters:   G - global, R - relocatable, and X -
  1939.                  external.  
  1940.  
  1941.  
  1942.            The list of program areas provides the correspondence between
  1943.         the program area numbers and the defined program areas, the size
  1944.         of the program areas, and the area flags (attributes).  
  1945.  
  1946.  
  1947.         1.9  OBJECT FILE 
  1948.  
  1949.  
  1950.            The  object  file is an ascii file containing the information
  1951.         needed by the linker to bind multiple object modules into a com-
  1952.         plete  loadable  memory  image.   The object module contains the
  1953.         following designators:  
  1954.  
  1955.                 [XDQ][HL]
  1956.                         X       Hexidecimal radix
  1957.                         D       Decimal radix
  1958.                         Q       Octal radix
  1959.         
  1960.                         H       Most significant byte first
  1961.                         L       Least significant byte first
  1962.         
  1963.                 H       Header 
  1964.  
  1965.  
  1966.         THE ASSEMBLER                                          PAGE 1-31
  1967.         OBJECT FILE
  1968.  
  1969.  
  1970.                 M       Module
  1971.                 A       Area
  1972.                 S       Symbol
  1973.                 T       Object code
  1974.                 R       Relocation information
  1975.                 P       Paging information
  1976.  
  1977.            Refer to the linker for a detailed description of each of the
  1978.         designators and the format of the information contained  in  the
  1979.         object file.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.  
  1985.  
  1986.  
  1987.  
  1988.  
  1989.  
  1990.  
  1991.  
  1992.  
  1993.  
  1994.                                     CHAPTER 2
  1995.  
  1996.                                    THE LINKER
  1997.  
  1998.  
  1999.  
  2000.  
  2001.  
  2002.         2.1  ASLINK RELOCATING LINKER 
  2003.  
  2004.  
  2005.            ASLINK is the companion linker for the ASxxxx assemblers.  
  2006.  
  2007.            The  program ASLINK is a general relocating linker performing
  2008.         the following functions:  
  2009.  
  2010.              1.  Bind multiple object modules into a single memory image 
  2011.  
  2012.              2.  Resolve inter-module symbol references 
  2013.  
  2014.              3.  Combine  code  belonging to the same area from multiple
  2015.                  object files into a single contiguous memory region 
  2016.  
  2017.              4.  Perform   byte   and   word  program  counter  relative
  2018.                  (pc or pcr) addressing calculations 
  2019.  
  2020.              5.  Define absolute symbol values at link time 
  2021.  
  2022.              6.  Define absolute area base address values at link time 
  2023.  
  2024.              7.  Produce Intel Hex or Motorola S19 output file 
  2025.  
  2026.              8.  Produce a map of the linked memory image 
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.         THE LINKER                                              PAGE 2-2
  2033.         INVOKING ASLINK
  2034.  
  2035.  
  2036.         2.2  INVOKING ASLINK 
  2037.  
  2038.  
  2039.            The  linker  may run in the command line mode or command file
  2040.         modes.  The allowed startup linker commands are:  
  2041.  
  2042.         -c/-f           command line / command file modes 
  2043.  
  2044.         -p/-n           enable/disable echo file.lnk input to stdout 
  2045.  
  2046.            If  command  line  mode is selected, all linker commands come
  2047.         from stdin, if the command file mode is  selected  the  commands
  2048.         are input from the specified file (extension must be .lnk).  
  2049.  
  2050.            The linker is started via 
  2051.  
  2052.                 ASLINK  -(cfpn) 
  2053.  
  2054.         After invoking the linker the valid options are:  
  2055.  
  2056.              1.  -i/-s   Intel Hex (file.ihx) or Motorola S19 (file.s19)
  2057.                  image output file.  
  2058.  
  2059.              2.  -m      Generate a map file (file.map).  This file con-
  2060.                  tains a list of the symbols (by area) with absolute ad-
  2061.                  dresses,  sizes  of  linked  areas,  and  other linking
  2062.                  information.  
  2063.  
  2064.              3.  -xdq    Specifies  the  number  radix  for the map file
  2065.                  (Hexidecimal, Decimal, or Octal).  
  2066.  
  2067.              4.  fileN   Files  to  be linked.  Files may be on the same
  2068.                  line as the above options or on a separate line(s)  one
  2069.                  file  per line or multiple files separated by spaces or
  2070.                  tabs.  
  2071.  
  2072.              5.  -b  area = expression (one definition per line) 
  2073.                  This  specifies  an area base address where the expres-
  2074.                  sion may contain constants and/or defined symbols  from
  2075.                  the linked files.  
  2076.  
  2077.              6.  -g  symbol = expression (one definition per line) 
  2078.                  This  specifies  the value for the symbol where the ex-
  2079.                  pression may contain constants and/or  defined  symbols
  2080.                  from the linked files.  
  2081.  
  2082.              7.  -e      or null line, terminates input to the linker.  
  2083.  
  2084.  
  2085.  
  2086.  
  2087.  
  2088.         THE LINKER                                              PAGE 2-3
  2089.         ASLINK PROCESSING
  2090.  
  2091.  
  2092.         2.3  ASLINK PROCESSING 
  2093.  
  2094.  
  2095.            The  linker  processes  the  files  in  the  order  they  are
  2096.         presented.  The first pass through the input files  is  used  to
  2097.         define  all  program  areas, the section area sizes, and symbols
  2098.         defined or referenced.  After the first pass the -b  (area  base
  2099.         address)  definitions,  if  any,  are  processed  and  the areas
  2100.         linked.  
  2101.  
  2102.            The  area  linking proceeds by first examining the area types
  2103.         ABS, CON, REL, OVR and PAG.  Absolute areas (ABS) from  separate
  2104.         object modules are always overlayed and have been assembled at a
  2105.         specific address, these are not normally relocated (if a -b com-
  2106.         mand  is  used  on an absolute area the area will be relocated).
  2107.         Relative areas (normally defined as REL|CON) have a base address
  2108.         of  0x0000  as read from the object files, the -b command speci-
  2109.         fies the beginning address of the area.  All subsequent relative
  2110.         areas  will  be  concatenated  with  proceeding  relative areas.
  2111.         Where specific ordering is desired, the first linker input  file
  2112.         should  have  the area definitions in the desired order.  At the
  2113.         completion of the area linking all area  addresses  and  lengths
  2114.         have  been determined.  The areas of type PAG are verified to be
  2115.         on a 256 byte boundary and that the length does not  exceed  256
  2116.         bytes.  Any errors are noted on stderr and in the map file.  
  2117.  
  2118.            Next  the  global symbol definitions (-g option), if any, are
  2119.         processed.  The symbol definitions have been delayed until  this
  2120.         point because the absolute addresses of all internal symbols are
  2121.         known and can be used in the expression calculations.  
  2122.  
  2123.            Before  continuing  with the linking process the symbol table
  2124.         is scanned to determine if any symbols have been referenced  but
  2125.         not defined.  Undefined symbols are listed on the stderr device.
  2126.         if a .module directive was included in the  assembled  file  the
  2127.         module  making  the reference to this undefined variable will be
  2128.         printed.  
  2129.  
  2130.            Constants  defined  as global in more than one module will be
  2131.         flagged as multiple definitions if their values are not  identi-
  2132.         cal.  
  2133.  
  2134.            After  the  preceeding  processes are complete the linker may
  2135.         output a map file (-m option).  This file provides the following
  2136.         information:  
  2137.  
  2138.              1.  Global symbol values and label absolute addresses 
  2139.  
  2140.              2.  Defined areas and there lengths 
  2141.  
  2142.              3.  Remaining undefined symbols 
  2143.  
  2144.  
  2145.  
  2146.         THE LINKER                                              PAGE 2-4
  2147.         ASLINK PROCESSING
  2148.  
  2149.  
  2150.              4.  List of modules linked 
  2151.  
  2152.              5.  List of -b and -g definitions 
  2153.  
  2154.  
  2155.  
  2156.  
  2157.            The final step of the linking process is performed during the
  2158.         second pass of the input files.  As the xxx.rel files  are  read
  2159.         the code is relocated by substituting the physical addresses for
  2160.         the referenced symbols and areas and may be output in  Intel  or
  2161.         Motorola  formats.   The  number of files linked and symbols de-
  2162.         fined/referenced is limited by the processor space available  to
  2163.         build the area/symbol lists.  
  2164.  
  2165.  
  2166.         2.4  LINKER INPUT FORMAT 
  2167.  
  2168.  
  2169.            The  linkers'  input  object file is an ascii file containing
  2170.         the information needed by the linker  to  bind  multiple  object
  2171.         modules into a complete loadable memory image.  
  2172.  
  2173.         The object module contains the following designators:  
  2174.  
  2175.                 [XDQ][HL]
  2176.                         X       Hexidecimal radix
  2177.                         D       Decimal radix
  2178.                         Q       Octal radix
  2179.         
  2180.                         H       Most significant byte first
  2181.                         L       Least significant byte first
  2182.         
  2183.                 H       Header 
  2184.                 M       Module
  2185.                 A       Area
  2186.                 S       Symbol
  2187.                 T       Object code
  2188.                 R       Relocation information
  2189.                 P       Paging information
  2190.  
  2191.  
  2192.  
  2193.  
  2194.         THE LINKER                                              PAGE 2-5
  2195.         LINKER INPUT FORMAT
  2196.  
  2197.  
  2198.         2.4.1  Object Module Format 
  2199.  
  2200.  
  2201.            The  first  line  of  an object module contains the [XDQ][HL]
  2202.         format specifier (i.e.  XH indicates  a  hexidecimal  file  with
  2203.         most significant byte first) for the following designators.  
  2204.  
  2205.  
  2206.         2.4.2  Header Line 
  2207.  
  2208.                 H aa areas gg global symbols 
  2209.  
  2210.            The  header  line  specifies  the number of areas(aa) and the
  2211.         number of global symbols(gg) defined or referenced in  this  ob-
  2212.         ject module segment.  
  2213.  
  2214.  
  2215.         2.4.3  Module Line 
  2216.  
  2217.                 M name 
  2218.  
  2219.            The  module  line  specifies  the module name from which this
  2220.         header segment was assembled.  The module line will  not  appear
  2221.         if the .module directive was not used in the source program.  
  2222.  
  2223.  
  2224.         2.4.4  Symbol Line 
  2225.  
  2226.                 S string Defnnnn 
  2227.  
  2228.                         or 
  2229.  
  2230.                 S string Refnnnn 
  2231.  
  2232.            The  symbol line defines (Def) or references (Ref) the symbol
  2233.         'string' with the value nnnn.  The defined value is relative  to
  2234.         the  current area base address.  References to constants and ex-
  2235.         ternal global symbols will always appear before the  first  area
  2236.         definition.  References to external symbols will have a value of
  2237.         zero.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.         THE LINKER                                              PAGE 2-6
  2243.         LINKER INPUT FORMAT
  2244.  
  2245.  
  2246.         2.4.5  Area Line 
  2247.  
  2248.                 A label size ss flags ff 
  2249.  
  2250.            The  area  line  defines the area label, the size (ss) of the
  2251.         area in bytes, and the area flags (ff).  The area flags  specify
  2252.         the ABS, REL, CON, OVR, and PAG parameters:  
  2253.  
  2254.                 OVR/CON (0x04/0x00 i.e.  bit position 2) 
  2255.  
  2256.                 ABS/REL (0x08/0x00 i.e.  bit position 3) 
  2257.  
  2258.                 PAG (0x10 i.e.  bit position 4) 
  2259.  
  2260.  
  2261.         2.4.6  T Line 
  2262.  
  2263.                 T xx xx nn nn nn nn nn ...  
  2264.  
  2265.            The  T  line contains the assembled code output by the assem-
  2266.         bler with xx xx being the offset address from the  current  area
  2267.         base address and nn being the assembled instructions and data in
  2268.         byte format.  
  2269.  
  2270.  
  2271.         2.4.7  R Line 
  2272.  
  2273.                 R 0 0 nn nn n1 n2 xx xx ...  
  2274.  
  2275.            The R line provides the relocation information to the linker.
  2276.         The nn nn value is the current area index, i.e.  which area  the
  2277.         current  values  were  assembled.  Relocation information is en-
  2278.         coded in groups of 4 bytes:  
  2279.  
  2280.              1.  n1 is the relocation mode and object format 
  2281.                  1.  bit 0 word(0x00)/byte(0x01) 
  2282.                  2.  bit 1 relocatable area(0x00)/symbol(0x02) 
  2283.                  3.  bit 2 normal(0x00)/PC relative(0x04) relocation 
  2284.                  4.  bit  3  1-byte(0x00)/2-byte(0x08) object format for
  2285.                      byte data 
  2286.                  5.  bit 4 signed(0x00)/unsigned(0x10) byte data 
  2287.                  6.  bit 5 normal(0x00)/page '0'(0x20) reference 
  2288.                  7.  bit 6 normal(0x00)/page 'nnn'(0x40) reference 
  2289.  
  2290.              2.  n2  is  a byte index into the corresponding (i.e.  pre-
  2291.                  ceeding) T line data (i.e.  a pointer to the data to be
  2292.                  updated  by  the  relocation).   The T line data may be
  2293.                  1-byte or  2-byte  byte  data  format  or  2-byte  word
  2294.                  format.  
  2295.  
  2296.  
  2297.  
  2298.         THE LINKER                                              PAGE 2-7
  2299.         LINKER INPUT FORMAT
  2300.  
  2301.  
  2302.              3.  xx xx  is the area/symbol index for the area/symbol be-
  2303.                  ing referenced.  the corresponding area/symbol is found
  2304.                  in the header area/symbol lists.  
  2305.  
  2306.  
  2307.         The groups of 4 bytes are repeated for each item requiring relo-
  2308.         cation in the preceeding T line.  
  2309.  
  2310.  
  2311.         2.4.8  P Line 
  2312.  
  2313.                 P 0 0 nn nn n1 n2 xx xx 
  2314.  
  2315.            The  P  line provides the paging information to the linker as
  2316.         specified by a .setdp directive.  The format of  the  relocation
  2317.         information is identical to that of the R line.  The correspond-
  2318.         ing T line has the following information:  
  2319.                 T xx xx aa aa bb bb 
  2320.  
  2321.            Where  aa aa is the area reference number which specifies the
  2322.         selected page area and bb bb is the base address  of  the  page.
  2323.         bb bb will require relocation processing if the 'n1 n2 xx xx' is
  2324.         specified in the P line.  The linker will verify that  the  base
  2325.         address is on a 256 byte boundary and that the page length of an
  2326.         area defined with the PAG type is not larger than 256 bytes.  
  2327.  
  2328.            The  linker  defaults any direct page references to the first
  2329.         area defined in the input REL file.  All ASxxxx assemblers  will
  2330.         specify the _CODE area first, making this the default page area. 
  2331.  
  2332.  
  2333.         2.5  LINKER ERROR MESSAGES 
  2334.  
  2335.  
  2336.            The linker provides detailed error messages allowing the pro-
  2337.         grammer to quickly find the errant code.   As  the  linker  com-
  2338.         pletes  pass 1  over  the  input  file(s)  it  reports  any page
  2339.         boundary or page length errors as follows:  
  2340.  
  2341.         ?ASlink-W-Paged Area PAGE0 Boundary Error
  2342.         
  2343.         and/or
  2344.         
  2345.         ?ASlink-W-Paged Area PAGE0 Length Error
  2346.  
  2347.         where PAGE0 is the paged area.  
  2348.  
  2349.            During  Pass  two the linker reads the T, R, and P lines per-
  2350.         forming the necessary relocations and  outputting  the  absolute
  2351.         code.  Various errors may be reported during this process 
  2352.  
  2353.  
  2354.         THE LINKER                                              PAGE 2-8
  2355.         LINKER ERROR MESSAGES
  2356.  
  2357.  
  2358.         The P line processing can produce only one possible error:  
  2359.  
  2360.         ?ASlink-W-Page Definition Boundary Error
  2361.                  file        module      pgarea      pgoffset
  2362.           PgDef  t6809l      t6809l      PAGE0       0001
  2363.  
  2364.         The error message specifies the file and module where the .setdp
  2365.         direct was issued and indicates  the  page  area  and  the  page
  2366.         offset value determined after relocation.  
  2367.  
  2368.  
  2369.         The R line processing produces various errors:  
  2370.  
  2371.         ?ASlink-W-Byte PCR relocation error for symbol  bra2
  2372.                  file        module      area        offset
  2373.           Refby  t6809l      t6809l      TEST        00FE
  2374.           Defin  tconst      tconst      .  .ABS.    0080
  2375.  
  2376.         ?ASlink-W-Unsigned Byte error for symbol  two56
  2377.                  file        module      area        offset
  2378.           Refby  t6800l      t6800l      DIRECT      0015
  2379.           Defin  tconst      tconst      .  .ABS.    0100
  2380.  
  2381.         ?ASlink-W-Page0 relocation error for symbol  ltwo56
  2382.                  file        module      area        offset
  2383.           Refby  t6800l      t6800l      DIRECT      000D
  2384.           Defin  tconst      tconst      DIRECT      0100
  2385.  
  2386.         ?ASlink-W-Page Mode relocation error for symbol  two56
  2387.                  file        module      area        offset
  2388.           Refby  t6809l      t6809l      DIRECT      0005
  2389.           Defin  tconst      tconst      .  .ABS.    0100
  2390.  
  2391.         ?ASlink-W-Page Mode relocation error
  2392.                  file        module      area        offset
  2393.           Refby  t           Pagetest    PROGRAM     0006
  2394.           Defin  t           Pagetest    DIRECT      0100
  2395.  
  2396.         These  error messages specify the file, module, area, and offset
  2397.         within the area of the code  referencing  (Refby)  and  defining
  2398.         (Defin) the symbol.  If the symbol is defined in the same module
  2399.         as the reference the linker is unable to report the symbol name.
  2400.         The  assembler  listing file(s) should be examined at the offset
  2401.         from the specified area to located the offending code.  
  2402.  
  2403.            The errors are:  
  2404.  
  2405.              1.  The  byte PCR error is caused by exceeding the pc rela-
  2406.                  tive byte branch range.  
  2407.  
  2408.              2.  The Unsigned byte error indicates an indexing value was
  2409.                  negative or larger than 255.  
  2410.  
  2411.  
  2412.         THE LINKER                                              PAGE 2-9
  2413.         LINKER ERROR MESSAGES
  2414.  
  2415.  
  2416.              3.  The  Page0  error is generated if the direct page vari-
  2417.                  able is not in the page0 range of 0 to 255.  
  2418.  
  2419.              4.  The page mode error is generated if the direct variable
  2420.                  is not within the current direct page (6809).  
  2421.  
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.                                     CHAPTER 3
  2437.  
  2438.                            BUILDING ASXXXX AND ASLINK
  2439.  
  2440.  
  2441.  
  2442.  
  2443.            The assemblers and linker have been successfully compiled us-
  2444.         ing  the  DECUS C  (PDP-11)  compiler  (patch  level   9)   with
  2445.         RT-11/TSX+,  Eyring  Research  Institute,  Inc.   PDOS (680x0) C
  2446.         V5.4b compiler, and with  Borland's  Turbo C  V1.5  with  MS-DOS
  2447.         (80x86).  
  2448.  
  2449.            The  device  specific  header  file  (i.e.  m6800.h, m6801.h,
  2450.         etc.) contains the DECUS C 'BUILD' directives for  generating  a
  2451.         command  file to compile, assemble, and link the necessary files
  2452.         to prepare an executable image for a particular assembler.  
  2453.  
  2454.  
  2455.         3.1  BUILDING AN ASSEMBLER 
  2456.  
  2457.  
  2458.            The  building  of  a typical assembler (6809 for example) re-
  2459.         quires the following files:  
  2460.  
  2461.              1.  M6809.H 
  2462.              2.  M09EXT.C 
  2463.              3.  M09MCH.C 
  2464.              4.  M09ADR.C 
  2465.              5.  M09PST.C 
  2466.              6.  ASM.H 
  2467.              7.  ASMAIN.C 
  2468.              8.  ASLEX.C 
  2469.              9.  ASSYM.C 
  2470.             10.  ASSUBR.C 
  2471.             11.  ASEXPR.C 
  2472.             12.  ASDATA.C 
  2473.             13.  ASLIST.C 
  2474.             14.  ASOUT.C 
  2475.  
  2476.  
  2477.            The  first  five  files are the 6809 processor dependent sec-
  2478.         tions which contain the following:  
  2479.  
  2480.  
  2481.  
  2482.         BUILDING ASXXXX AND ASLINK                              PAGE 3-2
  2483.         BUILDING AN ASSEMBLER
  2484.  
  2485.  
  2486.              1.  m6809.h -  header  file containing the machine specific
  2487.                  definitions of constants,  variables,  structures,  and
  2488.                  types 
  2489.  
  2490.              2.  m09ext -  device  description, byte order, and file ex-
  2491.                  tension information 
  2492.  
  2493.              3.  m09pst -  a  table of the assembler general directives,
  2494.                  special device directives, and assembler mnemonics with
  2495.                  associated operation codes 
  2496.  
  2497.              4.  m09mch / m09adr -  machine specific code for processing
  2498.                  the device mnemonics,  addressing  modes,  and  special
  2499.                  directives 
  2500.  
  2501.  
  2502.            The  remaining nine files provide the device independent sec-
  2503.         tions which handle the  details  of  file  input/output,  symbol
  2504.         table  generation,  program/data areas, expression analysis, and
  2505.         assembler directive processing.  
  2506.  
  2507.            The  assembler defaults to the case sensitive mode.  This may
  2508.         be altered by changing the case sensitivity flag in asm.h to 
  2509.  
  2510.                 /*
  2511.                  * Case Sensitivity Flag
  2512.                  */
  2513.                 #define CASE_SENSITIVE  0
  2514.  
  2515.            The  assemblers  and  linker should be compiled with the same
  2516.         case sensitivity option.  
  2517.  
  2518.            The  DECUS C  build files are asxxxx.bld and the Turbo C pro-
  2519.         ject files are asxxxx.prj.  
  2520.  
  2521.  
  2522.         3.2  BUILDING ASLINK 
  2523.  
  2524.  
  2525.            The building of the linker requires the following files:  
  2526.  
  2527.              1.  ASLINK.H 
  2528.              2.  LKMAIN.C 
  2529.              3.  LKLEX.C 
  2530.              4.  LKAREA.C 
  2531.              5.  LKHEAD.C 
  2532.              6.  LKSYM.C 
  2533.              7.  LKEVAL.C 
  2534.              8.  LKDATA.C 
  2535.              9.  LKLIST.C 
  2536.             10.  LKRLOC.C 
  2537.  
  2538.  
  2539.         BUILDING ASXXXX AND ASLINK                              PAGE 3-3
  2540.         BUILDING ASLINK
  2541.  
  2542.  
  2543.             11.  LKS19.C 
  2544.             12.  LKIHX.C 
  2545.  
  2546.  
  2547.            The  linker defaults to the case sensitive mode.  This may be
  2548.         altered by changing the case sensitivity flag in aslink.h to 
  2549.  
  2550.                 /*
  2551.                  * Case Sensitivity Flag
  2552.                  */
  2553.                 #define CASE_SENSITIVE  0
  2554.  
  2555.            The  linker  and  assemblers should be compiled with the same
  2556.         case sensitivity option.  
  2557.  
  2558.            The  DECUS C build file is aslink.bld and the Turbo C project
  2559.         file is aslink.prj.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571.  
  2572.  
  2573.  
  2574.                                    APPENDIX A
  2575.  
  2576.                                 AS6800 ASSEMBLER
  2577.  
  2578.  
  2579.  
  2580.  
  2581.  
  2582.         A.1  6800 REGISTER SET 
  2583.  
  2584.         The following is a list of the 6800 registers used by AS6800:  
  2585.  
  2586.                 a,b     -       8-bit accumulators
  2587.                 x       -       index register
  2588.  
  2589.  
  2590.         A.2  6800 INSTRUCTION SET 
  2591.  
  2592.  
  2593.            The following tables list all 6800/6802/6808 mnemonics recog-
  2594.         nized by the AS6800 assembler.  The designation [] refers  to  a
  2595.         required addressing mode argument.  The following list specifies
  2596.         the format for each addressing mode supported by AS6800:  
  2597.  
  2598.                 #data           immediate data
  2599.                                 byte or word data
  2600.         
  2601.                 *dir            direct page addressing
  2602.                                 (see .setdp directive)
  2603.                                 0 <= dir <= 255 
  2604.         
  2605.                 ,x              register indirect addressing
  2606.                                 zero offset
  2607.         
  2608.                 offset,x        register indirect addressing
  2609.                                 0 <= offset <= 255
  2610.         
  2611.                 ext             extended addressing
  2612.         
  2613.                 label           branch label
  2614.  
  2615.         The  terms  data, dir, offset, ext, and label may all be expres-
  2616.         sions.  
  2617.  
  2618.  
  2619.  
  2620.         AS6800 ASSEMBLER                                        PAGE A-2
  2621.         6800 INSTRUCTION SET
  2622.  
  2623.  
  2624.            Note  that  not all addressing modes are valid with every in-
  2625.         struction, refer to the 6800 technical data for valid modes.  
  2626.  
  2627.  
  2628.         A.2.1  Inherent Instructions 
  2629.  
  2630.                 aba                     cba
  2631.                 clc                     cli
  2632.                 clv                     daa
  2633.                 des                     dex
  2634.                 ins                     inx
  2635.                 nop                     rti
  2636.                 rts                     sba
  2637.                 sec                     sei
  2638.                 sev                     swi
  2639.                 tab                     tap
  2640.                 tba                     tpa
  2641.                 tsx                     txs
  2642.                 wai
  2643.         
  2644.                 psha                    pshb
  2645.                 psh a                   psh b
  2646.                 pula                    pulb
  2647.                 pul a                   pul b
  2648.  
  2649.  
  2650.         A.2.2  Branch Instructions 
  2651.  
  2652.                 bra     label           bhi     label
  2653.                 bls     label           bcc     label
  2654.                 bhs     label           bcs     label
  2655.                 blo     label           bne     label
  2656.                 beq     label           bvc     label
  2657.                 bvs     label           bpl     label
  2658.                 bmi     label           bge     label
  2659.                 blt     label           bgt     label
  2660.                 ble     label           bsr     label
  2661.  
  2662.  
  2663.         AS6800 ASSEMBLER                                        PAGE A-3
  2664.         6800 INSTRUCTION SET
  2665.  
  2666.  
  2667.         A.2.3  Single Operand Instructions 
  2668.  
  2669.                 asla                    aslb
  2670.                 asl a                   asl b
  2671.                 asl     []
  2672.         
  2673.                 asra                    asrb
  2674.                 asr a                   asr b
  2675.                 asr     []
  2676.         
  2677.                 clra                    clrb
  2678.                 clr a                   clr b
  2679.                 clr     []
  2680.         
  2681.                 coma                    comb
  2682.                 com a                   com b
  2683.                 com     []
  2684.         
  2685.                 deca                    decb
  2686.                 dec a                   dec b
  2687.                 dec     []
  2688.         
  2689.                 inca                    incb
  2690.                 inc a                   inc b
  2691.                 inc     []
  2692.         
  2693.                 lsla                    lslb
  2694.                 lsl a                   lsl b
  2695.                 lsl     []
  2696.         
  2697.                 lsra                    lsrb
  2698.                 lsr a                   lsr b
  2699.                 lsr     []
  2700.         
  2701.                 nega                    negb
  2702.                 neg a                   neg b
  2703.                 neg     []
  2704.         
  2705.                 rola                    rolb
  2706.                 rol a                   rol b
  2707.                 rol     []
  2708.         
  2709.                 rora                    rorb
  2710.                 ror a                   ror b
  2711.                 ror     []
  2712.         
  2713.                 tsta                    tstb
  2714.                 tst a                   tst b
  2715.                 tst     []
  2716.  
  2717.  
  2718.         AS6800 ASSEMBLER                                        PAGE A-4
  2719.         6800 INSTRUCTION SET
  2720.  
  2721.  
  2722.         A.2.4  Double Operand Instructions 
  2723.  
  2724.                 adca    []              adcb    []
  2725.                 adc a   []              adc b   []
  2726.         
  2727.                 adda    []              addb    []
  2728.                 add a   []              add b   []
  2729.         
  2730.                 anda    []              andb    []
  2731.                 and a   []              and b   []
  2732.         
  2733.                 bita    []              bitb    []
  2734.                 bit a   []              bit b   []
  2735.         
  2736.                 cmpa    []              cmpb    []
  2737.                 cmp a   []              cmp b   []
  2738.         
  2739.                 eora    []              eorb    []
  2740.                 eor a   []              eor b   []
  2741.         
  2742.                 ldaa    []              ldab    []
  2743.                 lda a   []              lda b   []
  2744.         
  2745.                 oraa    []              orab    []
  2746.                 ora a   []              ora b   []
  2747.         
  2748.                 sbca    []              sbcb    []
  2749.                 sbc a   []              sbc b   []
  2750.         
  2751.                 staa    []              stab    []
  2752.                 sta a   []              sta b   []
  2753.         
  2754.                 suba    []              subb    []
  2755.                 sub a   []              sub b   []
  2756.  
  2757.  
  2758.         A.2.5  Jump and Jump to Subroutine Instructions 
  2759.  
  2760.                 jmp     []              jsr     []
  2761.  
  2762.  
  2763.  
  2764.  
  2765.         AS6800 ASSEMBLER                                        PAGE A-5
  2766.         6800 INSTRUCTION SET
  2767.  
  2768.  
  2769.         A.2.6  Long Register Instructions 
  2770.  
  2771.                 cpx     []
  2772.                 lds     []              sts     []
  2773.                 ldx     []              stx     []
  2774.  
  2775.  
  2776.  
  2777.  
  2778.  
  2779.  
  2780.  
  2781.  
  2782.  
  2783.  
  2784.  
  2785.  
  2786.  
  2787.  
  2788.                                    APPENDIX B
  2789.  
  2790.                                 AS6801 ASSEMBLER
  2791.  
  2792.  
  2793.  
  2794.  
  2795.  
  2796.         B.1  .hd6303 DIRECTIVE 
  2797.  
  2798.         Format:  
  2799.  
  2800.                 .hd6303 
  2801.  
  2802.         The  .hd6303 directive enables processing of the HD6303 specific
  2803.         mnemonics not included in  the  6801  instruction  set.   HD6303
  2804.         mnemonics  encountered  without  the  .hd6303  directive will be
  2805.         flagged with an 'o' error.  
  2806.  
  2807.  
  2808.         B.2  6801 REGISTER SET 
  2809.  
  2810.         The following is a list of the 6801 registers used by AS6801:  
  2811.  
  2812.                 a,b     -       8-bit accumulators
  2813.                 d       -       16-bit accumulator <a:b>
  2814.                 x       -       index register
  2815.  
  2816.  
  2817.         B.3  6801 INSTRUCTION SET 
  2818.  
  2819.  
  2820.            The  following tables list all 6801/6303 mnemonics recognized
  2821.         by the AS6801 assembler.  The designation []  refers  to  a  re-
  2822.         quired  addressing  mode argument.  The following list specifies
  2823.         the format for each addressing mode supported by AS6801:  
  2824.  
  2825.                 #data           immediate data
  2826.                                 byte or word data
  2827.         
  2828.                 *dir            direct page addressing
  2829.                                 (see .setdp directive)
  2830.                                 0 <= dir <= 255 
  2831.         
  2832.  
  2833.  
  2834.         AS6801 ASSEMBLER                                        PAGE B-2
  2835.         6801 INSTRUCTION SET
  2836.  
  2837.  
  2838.                 ,x              register indirect addressing
  2839.                                 zero offset
  2840.         
  2841.                 offset,x        register indirect addressing
  2842.                                 0 <= offset <= 255
  2843.         
  2844.                 ext             extended addressing
  2845.         
  2846.                 label           branch label
  2847.  
  2848.         The  terms  data, dir, offset, ext, and label may all be expres-
  2849.         sions.  
  2850.  
  2851.            Note  that  not all addressing modes are valid with every in-
  2852.         struction, refer to  the  6801/6303  technical  data  for  valid
  2853.         modes.  
  2854.  
  2855.  
  2856.         B.3.1  Inherent Instructions 
  2857.  
  2858.                 aba             abx
  2859.                 cba             clc
  2860.                 cli             clv
  2861.                 daa             des
  2862.                 dex             ins
  2863.                 inx             mul
  2864.                 nop             rti
  2865.                 rts             sba
  2866.                 sec             sei
  2867.                 sev             swi
  2868.                 tab             tap
  2869.                 tba             tpa
  2870.                 tsx             txs
  2871.                 wai
  2872.  
  2873.  
  2874.         B.3.2  Branch Instructions 
  2875.  
  2876.                 bra     label           brn     label
  2877.                 bhi     label           bls     label
  2878.                 bcc     label           bhs     label
  2879.                 bcs     label           blo     label
  2880.                 bne     label           beq     label
  2881.                 bvc     label           bvs     label
  2882.                 bpl     label           bmi     label
  2883.                 bge     label           blt     label
  2884.                 bgt     label           ble     label
  2885.                 bsr     label
  2886.  
  2887.  
  2888.         AS6801 ASSEMBLER                                        PAGE B-3
  2889.         6801 INSTRUCTION SET
  2890.  
  2891.  
  2892.         B.3.3  Single Operand Instructions 
  2893.  
  2894.                 asla            aslb            asld
  2895.                 asl a           asl b           asl d
  2896.                 asl     []
  2897.         
  2898.                 asra            asrb
  2899.                 asr a           asr b
  2900.                 asr     []
  2901.         
  2902.                 clra            clrb
  2903.                 clr a           clr b
  2904.                 clr     []
  2905.         
  2906.                 coma            comb
  2907.                 com a           com b
  2908.                 com     []
  2909.         
  2910.                 deca            decb
  2911.                 dec a           dec b
  2912.                 dec     []
  2913.         
  2914.                 eora            eorb
  2915.                 eor a           eor b
  2916.                 eor     []
  2917.         
  2918.                 inca            incb
  2919.                 inc a           inc b
  2920.                 inc     []
  2921.         
  2922.                 lsla            lslb            lsld
  2923.                 lsl a           lsl b           lsl d
  2924.                 lsl     []
  2925.         
  2926.                 lsra            lsrb            lsrd
  2927.                 lsr a           lsr b           lsr d
  2928.                 lsr     []
  2929.         
  2930.                 nega            negb
  2931.                 neg a           neg b
  2932.                 neg     []
  2933.         
  2934.                 psha            pshb            pshx
  2935.                 psh a           psh b           psh x
  2936.         
  2937.                 pula            pulb            pulx
  2938.                 pul a           pul b           pul x
  2939.         
  2940.                 rola            rolb
  2941.                 rol a           rol b
  2942.                 rol     []
  2943.         
  2944.  
  2945.  
  2946.         AS6801 ASSEMBLER                                        PAGE B-4
  2947.         6801 INSTRUCTION SET
  2948.  
  2949.  
  2950.                 rora            rorb
  2951.                 ror a           ror b
  2952.                 ror     []
  2953.         
  2954.                 tsta            tstb
  2955.                 tst a           tst b
  2956.                 tst     []
  2957.  
  2958.  
  2959.         B.3.4  Double Operand Instructions 
  2960.  
  2961.                 adca    []      adcb    []
  2962.                 adc a   []      adc b   []
  2963.         
  2964.                 adda    []      addb    []      addd    []
  2965.                 add a   []      add b   []      add d   []
  2966.         
  2967.                 anda    []      andb    []
  2968.                 and a   []      and b   []
  2969.         
  2970.                 bita    []      bitb    []
  2971.                 bit a   []      bit b   []
  2972.         
  2973.                 cmpa    []      cmpb    []
  2974.                 cmp a   []      cmp b   []
  2975.         
  2976.                 ldaa    []      ldab    []
  2977.                 lda a   []      lda b   []
  2978.         
  2979.                 oraa    []      orab    []
  2980.                 ora a   []      ora b   []
  2981.         
  2982.                 sbca    []      sbcb    []
  2983.                 sbc a   []      sbc b   []
  2984.         
  2985.                 staa    []      stab    []
  2986.                 sta a   []      sta b   []
  2987.         
  2988.                 suba    []      subb    []      subd    []
  2989.                 sub a   []      sub b   []      sub d   []
  2990.  
  2991.  
  2992.  
  2993.  
  2994.         AS6801 ASSEMBLER                                        PAGE B-5
  2995.         6801 INSTRUCTION SET
  2996.  
  2997.  
  2998.         B.3.5  Jump and Jump to Subroutine Instructions 
  2999.  
  3000.                 jmp     []      jsr     []
  3001.  
  3002.  
  3003.         B.3.6  Long Register Instructions 
  3004.  
  3005.                 cpx     []      ldd     []
  3006.                 lds     []      ldx     []
  3007.                 std     []      sts     []
  3008.                 stx     []
  3009.  
  3010.  
  3011.         B.3.7  6303 Specific Instructions 
  3012.  
  3013.                 aim     #data, []       eim     #data, []
  3014.                 oim     #data, []       tim     #data, []
  3015.         
  3016.                 xgdx            slp
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.                                    APPENDIX C
  3032.  
  3033.                                 AS6804 ASSEMBLER
  3034.  
  3035.  
  3036.  
  3037.  
  3038.            Requires the .setdp directive to specify the ram area.  
  3039.  
  3040.  
  3041.         C.1  6804 REGISTER SET 
  3042.  
  3043.         The following is a list of the 6804 registers used by AS6804:  
  3044.  
  3045.                 x,y     -       index registers
  3046.  
  3047.  
  3048.         C.2  6804 INSTRUCTION SET 
  3049.  
  3050.  
  3051.            The  following  tables  list all 6804 mnemonics recognized by
  3052.         the AS6804 assembler.  The designation [] refers to  a  required
  3053.         addressing  mode  argument.   The  following  list specifies the
  3054.         format for each addressing mode supported by AS6804:  
  3055.  
  3056.                 #data           immediate data
  3057.                                 byte or word data
  3058.         
  3059.                 ,x              register indirect addressing
  3060.         
  3061.                 dir             direct addressing
  3062.                                 (see .setdp directive)
  3063.                                 0 <= dir <= 255
  3064.         
  3065.                 ext             extended addressing
  3066.         
  3067.                 label           branch label
  3068.  
  3069.         The  terms data, dir, and ext may be expressions.  The label for
  3070.         the short branchs beq, bne, bcc, and bcs must not be external.  
  3071.  
  3072.            Note  that  not all addressing modes are valid with every in-
  3073.         struction, refer to the 6804 technical data for valid modes.  
  3074.  
  3075.  
  3076.         AS6804 ASSEMBLER                                        PAGE C-2
  3077.         6804 INSTRUCTION SET
  3078.  
  3079.  
  3080.         C.2.1  Inherent Instructions 
  3081.  
  3082.                 coma            decx
  3083.                 decy            incx
  3084.                 incy            rola
  3085.                 rti             rts
  3086.                 stop            tax
  3087.                 tay             txa
  3088.                 tya             wait
  3089.  
  3090.  
  3091.         C.2.2  Branch Instructions 
  3092.  
  3093.                 bne     label           beq     label
  3094.                 bcc     label           bcs     label
  3095.  
  3096.  
  3097.         C.2.3  Single Operand Instructions 
  3098.  
  3099.                 add     []
  3100.                 and     []
  3101.                 cmp     []
  3102.                 dec     []
  3103.                 inc     []
  3104.                 lda     []
  3105.                 sta     []
  3106.                 sub     []
  3107.  
  3108.  
  3109.         C.2.4  Jump and Jump to Subroutine Instructions 
  3110.  
  3111.                 jsr     []
  3112.                 jmp     []
  3113.  
  3114.  
  3115.         C.2.5  Bit Test Instructions 
  3116.  
  3117.                 brclr   #data,[],label
  3118.                 brset   #data,[],label
  3119.         
  3120.                 bclr    #label,[]
  3121.                 bset    #label,[]
  3122.  
  3123.  
  3124.  
  3125.  
  3126.         AS6804 ASSEMBLER                                        PAGE C-3
  3127.         6804 INSTRUCTION SET
  3128.  
  3129.  
  3130.         C.2.6  Load Immediate data Instruction 
  3131.  
  3132.                 mvi     [],#data
  3133.  
  3134.  
  3135.         C.2.7  6804 Derived Instructions 
  3136.  
  3137.                 asla
  3138.                 bam     label
  3139.                 bap     label
  3140.                 bxmi    label
  3141.                 bxpl    label
  3142.                 bymi    label
  3143.                 bypl    label
  3144.                 clra
  3145.                 clrx
  3146.                 clry
  3147.                 deca
  3148.                 decx
  3149.                 decy
  3150.                 inca
  3151.                 incx
  3152.                 incy
  3153.                 ldxi    #data
  3154.                 ldyi    #data
  3155.                 nop
  3156.                 tax
  3157.                 tay
  3158.                 txa
  3159.                 tya
  3160.  
  3161.  
  3162.  
  3163.  
  3164.  
  3165.  
  3166.  
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172.  
  3173.  
  3174.                                    APPENDIX D
  3175.  
  3176.                                 AS6805 ASSEMBLER
  3177.  
  3178.  
  3179.  
  3180.  
  3181.  
  3182.         D.1  6805 REGISTER SET 
  3183.  
  3184.         The following is a list of the 6805 registers used by AS6805:  
  3185.  
  3186.                 a       -       8-bit accumulator
  3187.                 x       -       index register
  3188.  
  3189.  
  3190.         D.2  6805 INSTRUCTION SET 
  3191.  
  3192.  
  3193.            The  following  tables  list all 6805 mnemonics recognized by
  3194.         the AS6805 assembler.  The designation [] refers to  a  required
  3195.         addressing  mode  argument.   The  following  list specifies the
  3196.         format for each addressing mode supported by AS6805:  
  3197.  
  3198.                 #data           immediate data
  3199.                                 byte or word data
  3200.         
  3201.                 *dir            direct page addressing
  3202.                                 (see .setdp directive)
  3203.                                 0 <= dir <= 255 
  3204.         
  3205.                 ,x              register indirect addressing
  3206.                                 zero offset
  3207.         
  3208.                 offset,x        register indirect addressing
  3209.                                   0 <= offset <= 255   --- byte mode
  3210.                                 256 <= offset <= 65535 --- word mode
  3211.                                 (an externally defined offset uses the
  3212.                                  word mode)
  3213.         
  3214.                 ext             extended addressing
  3215.         
  3216.                 label           branch label
  3217.  
  3218.  
  3219.  
  3220.         AS6805 ASSEMBLER                                        PAGE D-2
  3221.         6805 INSTRUCTION SET
  3222.  
  3223.  
  3224.         The terms data, dir, offset, and ext may all be expressions.  
  3225.  
  3226.            Note  that  not all addressing modes are valid with every in-
  3227.         struction, refer to the 6805 technical data for valid modes.  
  3228.  
  3229.  
  3230.         D.2.1  Control Instructions 
  3231.  
  3232.                 clc             cli
  3233.                 nop             rsp
  3234.                 rti             rts
  3235.                 sec             sei
  3236.                 stop            swi
  3237.                 tax             txa
  3238.                 wait
  3239.  
  3240.  
  3241.         D.2.2  Bit Manipulation Instructions 
  3242.  
  3243.                 brset   #data,*dir,label
  3244.                 brclr   #data,*dir,label
  3245.         
  3246.                 bset    #data,*dir
  3247.                 bclr    #data,*dir
  3248.  
  3249.  
  3250.         D.2.3  Branch Instructions 
  3251.  
  3252.                 bra     label           brn     label
  3253.                 bhi     label           bls     label
  3254.                 bcc     label           bcs     label
  3255.                 bne     label           beq     label
  3256.                 bhcc    label           bhcs    label
  3257.                 bpl     label           bmi     label
  3258.                 bmc     label           bms     label
  3259.                 bil     label           bih     label
  3260.                 bsr     label
  3261.  
  3262.  
  3263.         AS6805 ASSEMBLER                                        PAGE D-3
  3264.         6805 INSTRUCTION SET
  3265.  
  3266.  
  3267.         D.2.4  Read-Modify-Write Instructions 
  3268.  
  3269.                 nega            negx
  3270.                 neg     []
  3271.         
  3272.                 coma            comx
  3273.                 com     []
  3274.         
  3275.                 lsra            lsrx
  3276.                 lsr     []
  3277.         
  3278.                 rora            rorx
  3279.                 ror     []
  3280.         
  3281.                 asra            asrx
  3282.                 asr     []
  3283.         
  3284.                 lsla            lslx
  3285.                 lsl     []
  3286.         
  3287.                 rola            rolx
  3288.                 rol     []
  3289.         
  3290.                 deca            decx
  3291.                 dec     []
  3292.         
  3293.                 inca            incx
  3294.                 inc     []
  3295.         
  3296.                 tsta            tstx
  3297.                 tst     []
  3298.         
  3299.                 clra            clrx
  3300.                 clr     []
  3301.  
  3302.  
  3303.         D.2.5  Register\Memory Instructions 
  3304.  
  3305.                 sub     []              cmp     []
  3306.                 sbc     []              cpx     []
  3307.                 and     []              bit     []
  3308.                 lda     []              sta     []
  3309.                 eor     []              adc     []
  3310.                 ora     []              add     []
  3311.                 ldx     []              stx     []
  3312.  
  3313.  
  3314.         AS6805 ASSEMBLER                                        PAGE D-4
  3315.         6805 INSTRUCTION SET
  3316.  
  3317.  
  3318.         D.2.6  Jump and Jump to Subroutine Instructions 
  3319.  
  3320.                 jmp     []              jsr     []
  3321.  
  3322.  
  3323.  
  3324.  
  3325.  
  3326.  
  3327.  
  3328.  
  3329.  
  3330.  
  3331.  
  3332.  
  3333.  
  3334.  
  3335.                                    APPENDIX E
  3336.  
  3337.                                 AS6809 ASSEMBLER
  3338.  
  3339.  
  3340.  
  3341.  
  3342.  
  3343.         E.1  6809 REGISTER SET 
  3344.  
  3345.         The following is a list of the 6809 registers used by AS6809:  
  3346.  
  3347.                 a,b     -       8-bit accumulators
  3348.                 d       -       16-bit accumulator <a:b>
  3349.                 x,y     -       index registers
  3350.                 s,u     -       stack pointers
  3351.                 pc      -       program counter
  3352.                 cc      -       condition code
  3353.                 dp      -       direct page
  3354.  
  3355.  
  3356.         E.2  6809 INSTRUCTION SET 
  3357.  
  3358.  
  3359.            The  following  tables  list all 6809 mnemonics recognized by
  3360.         the AS6809 assembler.  The designation [] refers to  a  required
  3361.         addressing  mode  argument.   The  following  list specifies the
  3362.         format for each addressing mode supported by AS6809:  
  3363.  
  3364.                 #data           immediate data
  3365.                                 byte or word data
  3366.         
  3367.                 *dir            direct page addressing
  3368.                                 (see .setdp directive)
  3369.                                 0 <= dir <= 255 
  3370.         
  3371.                 label           branch label
  3372.         
  3373.                 r,r1,r2         registers
  3374.                                 cc,a,b,d,dp,x,y,s,u,pc
  3375.         
  3376.                 ,-x     ,--x    register indexed
  3377.                                 autodecrement
  3378.         
  3379.  
  3380.  
  3381.         AS6809 ASSEMBLER                                        PAGE E-2
  3382.         6809 INSTRUCTION SET
  3383.  
  3384.  
  3385.                 ,x+     ,x++    register indexed
  3386.                                 autoincrement
  3387.         
  3388.                 ,x              register indexed addressing
  3389.                                 zero offset
  3390.         
  3391.                 offset,x        register indexed addressing
  3392.                                    -16 <= offset <= 15    ---  5-bit
  3393.                                   -128 <= offset <= -17   ---  8-bit
  3394.                                     16 <= offset <= 127   ---  8-bit
  3395.                                 -32768 <= offset <= -129  --- 16-bit
  3396.                                    128 <= offset <= 32767 --- 16-bit
  3397.                                 (external definition of offset
  3398.                                  uses 16-bit mode)
  3399.         
  3400.                 a,x             accumulator offset indexed addressing
  3401.         
  3402.                 ext             extended addressing
  3403.         
  3404.                 ext,pc          pc addressing ( pc <- pc + ext )
  3405.         
  3406.                 ext,pcr         pc relative addressing
  3407.                                 
  3408.                 [,--x]          register indexed indirect
  3409.                                 autodecrement
  3410.         
  3411.                 [,x++]          register indexed indirect
  3412.                                 autoincrement
  3413.         
  3414.                 [,x]            register indexed indirect addressing
  3415.                                 zero offset
  3416.         
  3417.                 [offset,x]      register indexed indirect addressing
  3418.                                   -128 <= offset <= 127   ---  8-bit
  3419.                                 -32768 <= offset <= -129  --- 16-bit
  3420.                                    128 <= offset <= 32767 --- 16-bit
  3421.                                 (external definition of offset
  3422.                                  uses 16-bit mode)
  3423.         
  3424.                 [a,x]           accumulator offset indexed
  3425.                                 indirect addressing
  3426.         
  3427.                 [ext]           extended indirect addressing
  3428.         
  3429.                 [ext,pc]        pc indirect addressing
  3430.                                 ( [pc <- pc + ext] )
  3431.         
  3432.                 [ext,pcr]       pc relative indirect addressing
  3433.  
  3434.         The  terms  data, dir, label, offset, and ext may all be expres-
  3435.         sions.  
  3436.  
  3437.  
  3438.  
  3439.         AS6809 ASSEMBLER                                        PAGE E-3
  3440.         6809 INSTRUCTION SET
  3441.  
  3442.  
  3443.            Note  that  not all addressing modes are valid with every in-
  3444.         struction, refer to the 6809 technical data for valid modes.  
  3445.  
  3446.  
  3447.         E.2.1  Inherent Instructions 
  3448.  
  3449.                 abx             daa
  3450.                 mul             nop
  3451.                 rti             rts
  3452.                 sex             swi
  3453.                 swi1            swi2
  3454.                 swi3            sync
  3455.  
  3456.  
  3457.         E.2.2  Short Branch Instructions 
  3458.  
  3459.                 bcc     label           bcs     label
  3460.                 beq     label           bge     label
  3461.                 bgt     label           bhi     label
  3462.                 bhis    label           bhs     label
  3463.                 ble     label           blo     label
  3464.                 blos    label           bls     label
  3465.                 blt     label           bmi     label
  3466.                 bne     label           bpl     label
  3467.                 bra     label           brn     label
  3468.                 bvc     label           bvs     label
  3469.                 bsr     label
  3470.  
  3471.  
  3472.         E.2.3  Long Branch Instructions 
  3473.  
  3474.                 lbcc    label           lbcs    label
  3475.                 lbeq    label           lbge    label
  3476.                 lbgt    label           lbhi    label
  3477.                 lbhis   label           lbhs    label
  3478.                 lble    label           lblo    label
  3479.                 lblos   label           lbls    label
  3480.                 lblt    label           lbmi    label
  3481.                 lbne    label           lbpl    label
  3482.                 lbra    label           lbrn    label
  3483.                 lbvc    label           lbvs    label
  3484.                 lbsr    label
  3485.  
  3486.  
  3487.         AS6809 ASSEMBLER                                        PAGE E-4
  3488.         6809 INSTRUCTION SET
  3489.  
  3490.  
  3491.         E.2.4  Single Operand Instructions 
  3492.  
  3493.                 asla            aslb
  3494.                 asl     []
  3495.         
  3496.                 asra            asrb
  3497.                 asr     []
  3498.         
  3499.                 clra            clrb
  3500.                 clr     []
  3501.         
  3502.                 coma            comb
  3503.                 com     []
  3504.         
  3505.                 deca            decb
  3506.                 dec     []
  3507.         
  3508.                 inca            incb
  3509.                 inc     []
  3510.         
  3511.                 lsla            lslb
  3512.                 lsl     []
  3513.         
  3514.                 lsra            lsrb
  3515.                 lsr     []
  3516.         
  3517.                 nega            negb
  3518.                 neg     []
  3519.         
  3520.                 rola            rolb
  3521.                 rol     []
  3522.         
  3523.                 rora            rorb
  3524.                 ror     []
  3525.         
  3526.                 tsta            tstb
  3527.                 tst     []
  3528.  
  3529.  
  3530.         AS6809 ASSEMBLER                                        PAGE E-5
  3531.         6809 INSTRUCTION SET
  3532.  
  3533.  
  3534.         E.2.5  Double Operand Instructions 
  3535.  
  3536.                 adca    []              adcb    []
  3537.         
  3538.                 adda    []              addb    []
  3539.         
  3540.                 anda    []              andb    []
  3541.         
  3542.                 bita    []              bitb    []
  3543.         
  3544.                 cmpa    []              cmpb    []
  3545.         
  3546.                 eora    []              eorb    []
  3547.         
  3548.                 lda     []              ldb     []
  3549.         
  3550.                 ora     []              orb     []
  3551.         
  3552.                 sbca    []              sbcb    []
  3553.         
  3554.                 sta     []              stb     []
  3555.         
  3556.                 suba    []              subb    []
  3557.  
  3558.  
  3559.         E.2.6  D-register Instructions 
  3560.  
  3561.                 addd    []              subd    []
  3562.                 cmpd    []              ldd     []
  3563.                 std     []
  3564.  
  3565.  
  3566.         E.2.7  Index/Stack Register Instructions 
  3567.  
  3568.                 cmps    []              cmpu    []
  3569.                 cmpx    []              cmpy    []
  3570.         
  3571.                 lds     []              ldu     []
  3572.                 ldx     []              ldy     []
  3573.         
  3574.                 leas    []              leau    []
  3575.                 leax    []              leay    []
  3576.         
  3577.                 sts     []              stu     []
  3578.                 stx     []              sty     []
  3579.         
  3580.                 pshs    r               pshu    r
  3581.                 puls    r               pulu    r
  3582.  
  3583.  
  3584.         AS6809 ASSEMBLER                                        PAGE E-6
  3585.         6809 INSTRUCTION SET
  3586.  
  3587.  
  3588.         E.2.8  Jump and Jump to Subroutine Instructions 
  3589.  
  3590.                 jmp     []              jsr     []
  3591.  
  3592.  
  3593.         E.2.9  Register - Register Instructions 
  3594.  
  3595.                 exg     r1,r2           tfr     r1,r2
  3596.  
  3597.  
  3598.         E.2.10  Condition Code Register Instructions 
  3599.  
  3600.                 andcc   #data           orcc    #data
  3601.                 cwai    #data
  3602.  
  3603.  
  3604.         E.2.11  6800 Compatibility Instructions 
  3605.  
  3606.                 aba             cba
  3607.                 clc             cli
  3608.                 clv             des
  3609.                 dex             ins
  3610.                 inx
  3611.                 ldaa    []      ldab    []
  3612.                 oraa    []      orab    []
  3613.                 psha            pshb
  3614.                 pula            pulb
  3615.                 sba             sec
  3616.                 sei             sev
  3617.                 staa    []      stab    []
  3618.                 tab             tap
  3619.                 tba             tpa
  3620.                 tsx             txs
  3621.                 wai
  3622.  
  3623.  
  3624.  
  3625.  
  3626.  
  3627.  
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634.  
  3635.  
  3636.                                    APPENDIX F
  3637.  
  3638.                                 AS6811 ASSEMBLER
  3639.  
  3640.  
  3641.  
  3642.  
  3643.  
  3644.         F.1  6811 REGISTER SET 
  3645.  
  3646.         The following is a list of the 6811 registers used by AS6811:  
  3647.  
  3648.                 a,b     -       8-bit accumulators
  3649.                 d       -       16-bit accumulator <a:b>
  3650.                 x,y     -       index registers
  3651.  
  3652.  
  3653.         F.2  6811 INSTRUCTION SET 
  3654.  
  3655.  
  3656.            The  following  tables  list all 6811 mnemonics recognized by
  3657.         the AS6811 assembler.  The designation [] refers to  a  required
  3658.         addressing  mode  argument.   The  following  list specifies the
  3659.         format for each addressing mode supported by AS6811:  
  3660.  
  3661.                 #data           immediate data
  3662.                                 byte or word data
  3663.         
  3664.                 *dir            direct page addressing
  3665.                                 (see .setdp directive)
  3666.                                 0 <= dir <= 255 
  3667.         
  3668.                 ,x              register indirect addressing
  3669.                                 zero offset
  3670.         
  3671.                 offset,x        register indirect addressing
  3672.                                 0 <= offset <= 255
  3673.         
  3674.                 ext             extended addressing
  3675.         
  3676.                 label           branch label
  3677.  
  3678.         The terms data, dir, offset, and ext may all be expressions.  
  3679.  
  3680.  
  3681.  
  3682.         AS6811 ASSEMBLER                                        PAGE F-2
  3683.         6811 INSTRUCTION SET
  3684.  
  3685.  
  3686.            Note  that  not all addressing modes are valid with every in-
  3687.         struction, refer to the 6811 technical data for valid modes.  
  3688.  
  3689.  
  3690.         F.2.1  Inherent Instructions 
  3691.  
  3692.                 aba             abx
  3693.                 aby             cba
  3694.                 clc             cli
  3695.                 clv             daa
  3696.                 des             dex
  3697.                 dey             fdiv
  3698.                 idiv            ins
  3699.                 inx             iny
  3700.                 mul             nop
  3701.                 rti             rts
  3702.                 sba             sec
  3703.                 sei             sev
  3704.                 stop            swi
  3705.                 tab             tap
  3706.                 tba             tpa
  3707.                 tsx             txs
  3708.                 wai             xgdx
  3709.                 xgdy
  3710.         
  3711.                 psha            pshb
  3712.                 psh a           psh b
  3713.                 pshx            pshy
  3714.                 psh x           psh y
  3715.         
  3716.                 pula            pulb
  3717.                 pul a           pul b
  3718.                 pulx            puly
  3719.                 pul x           pul y
  3720.  
  3721.  
  3722.         F.2.2  Branch Instructions 
  3723.  
  3724.                 bra     label           brn     label
  3725.                 bhi     label           bls     label
  3726.                 bcc     label           bhs     label
  3727.                 bcs     label           blo     label
  3728.                 bne     label           beq     label
  3729.                 bvc     label           bvs     label
  3730.                 bpl     label           bmi     label
  3731.                 bge     label           blt     label
  3732.                 bgt     label           ble     label
  3733.                 bsr     label
  3734.  
  3735.  
  3736.         AS6811 ASSEMBLER                                        PAGE F-3
  3737.         6811 INSTRUCTION SET
  3738.  
  3739.  
  3740.         F.2.3  Single Operand Instructions 
  3741.  
  3742.                 asla            aslb            asld
  3743.                 asl a           asl b           asl d
  3744.                 asl     []
  3745.         
  3746.                 asra            asrb
  3747.                 asr a           asr b
  3748.                 asr     []
  3749.         
  3750.                 clra            clrb
  3751.                 clr a           clr b
  3752.                 clr     label
  3753.         
  3754.                 coma            comb
  3755.                 com a           com b
  3756.                 com     []
  3757.         
  3758.                 deca            decb
  3759.                 dec a           dec b
  3760.                 dec     []
  3761.         
  3762.                 inca            incb
  3763.                 inc a           inc b
  3764.                 inc     []
  3765.         
  3766.                 lsla            lslb            lsld
  3767.                 lsl a           lsl b           lsl d
  3768.                 lsl     []
  3769.         
  3770.                 lsra            lsrb            lsrd
  3771.                 lsr a           lsr b           lsr d
  3772.                 lsr     []
  3773.         
  3774.                 nega            negb
  3775.                 neg a           neg b
  3776.                 neg     []
  3777.         
  3778.                 rola            rolb
  3779.                 rol a           rol b
  3780.                 rol     []
  3781.         
  3782.                 rora            rorb
  3783.                 ror a           ror b
  3784.                 ror     []
  3785.         
  3786.                 tsta            tstb
  3787.                 tst a           tst b
  3788.                 tst     []
  3789.  
  3790.  
  3791.         AS6811 ASSEMBLER                                        PAGE F-4
  3792.         6811 INSTRUCTION SET
  3793.  
  3794.  
  3795.         F.2.4  Double Operand Instructions 
  3796.  
  3797.                 adca    []              adcb    []
  3798.                 adc a   []              adc b   []
  3799.         
  3800.                 adda    []      addb    []      addd    []
  3801.                 add a   []      add b   []      add d   []
  3802.         
  3803.                 anda    []              andb    []
  3804.                 and a   []              and b   []
  3805.         
  3806.                 bita    []              bitb    []
  3807.                 bit a   []              bit b   []
  3808.         
  3809.                 cmpa    []              cmpb    []
  3810.                 cmp a   []              cmp b   []
  3811.         
  3812.                 eora    []              eorb    []
  3813.                 eor a   []              eor b   []
  3814.         
  3815.                 ldaa    []              ldab    []
  3816.                 lda a   []              lda b   []
  3817.         
  3818.                 oraa    []              orab    []
  3819.                 ora a   []              ora b   []
  3820.         
  3821.                 sbca    []              sbcb    []
  3822.                 sbc a   []              sbc b   []
  3823.         
  3824.                 staa    []              stab    []
  3825.                 sta a   []              sta b   []
  3826.         
  3827.                 suba    []      subb    []      subd    []
  3828.                 sub a   []      sub b   []      sub d   []
  3829.  
  3830.  
  3831.         F.2.5  Bit Manupulation Instructions 
  3832.  
  3833.                 bclr    [],#data
  3834.                 bset    [],#data
  3835.         
  3836.                 brclr   [],#data,label
  3837.                 brset   [],#data,label
  3838.  
  3839.  
  3840.  
  3841.  
  3842.         AS6811 ASSEMBLER                                        PAGE F-5
  3843.         6811 INSTRUCTION SET
  3844.  
  3845.  
  3846.         F.2.6  Jump and Jump to Subroutine Instructions 
  3847.  
  3848.                 jmp     []              jsr     []
  3849.  
  3850.  
  3851.         F.2.7  Long Register Instructions 
  3852.  
  3853.                 cpx     []              cpy     []
  3854.         
  3855.                 ldd     []              lds     []
  3856.                 ldx     []              ldy     []
  3857.         
  3858.                 std     []              sts     []
  3859.                 stx     []              sty     []
  3860.  
  3861.  
  3862.  
  3863.  
  3864.  
  3865.  
  3866.  
  3867.  
  3868.  
  3869.  
  3870.  
  3871.  
  3872.  
  3873.  
  3874.                                    APPENDIX G
  3875.  
  3876.                                 AS6816 ASSEMBLER
  3877.  
  3878.  
  3879.  
  3880.  
  3881.  
  3882.         G.1  6816 REGISTER SET 
  3883.  
  3884.         The following is a list of the 6816 registers used by AS6816:  
  3885.  
  3886.                 a,b     -       8-bit accumulators
  3887.                 d       -       16-bit accumulator <a:b>
  3888.                 e       -       16-bit accumulator
  3889.                 x,y,z   -       index registers
  3890.                 k       -       address extension register
  3891.                 s       -       stack pointer
  3892.                 ccr     -       condition code
  3893.  
  3894.  
  3895.         G.2  6816 INSTRUCTION SET 
  3896.  
  3897.  
  3898.            The  following  tables  list all 6816 mnemonics recognized by
  3899.         the AS6816 assembler.  The designation [] refers to  a  required
  3900.         addressing  mode  argument.   The  following  list specifies the
  3901.         format for each addressing mode supported by AS6816:  
  3902.  
  3903.                 #data           immediate data
  3904.                                 byte or word data
  3905.         
  3906.                 #xo,#yo         local immediate data (mac / rmac)
  3907.         
  3908.                 label           branch label
  3909.         
  3910.                 r               register
  3911.                                 ccr,a,b,d,e,x,y,z,s
  3912.         
  3913.                 ,x              zero offset register indexed addressing
  3914.                 ,x8
  3915.                 ,x16
  3916.         
  3917.                 offset,x        register indexed addressing
  3918.  
  3919.  
  3920.         AS6816 ASSEMBLER                                        PAGE G-2
  3921.         6816 INSTRUCTION SET
  3922.  
  3923.  
  3924.                                      0 <= offset <= 255   ---  8-bit
  3925.                                 -32768 <= offset <= -1    --- 16-bit
  3926.                                    256 <= offset <= 32767 --- 16-bit
  3927.                                 (external definition of offset
  3928.                                  uses 16-bit mode)
  3929.         
  3930.                 offset,x8       unsigned 8-bit offset indexed addressing
  3931.                 offset,x16      signed 16-bit offset indexed addressing
  3932.         
  3933.                 e,x             accumulator offset indexed addressing
  3934.         
  3935.                 ext             extended addressing
  3936.         
  3937.                 bank            64K bank number (jmp / jsr)
  3938.  
  3939.         The  terms data, label, offset, bank, and ext may all be expres-
  3940.         sions.  
  3941.  
  3942.            Note  that  not all addressing modes are valid with every in-
  3943.         struction, refer to the 6816 technical data for valid modes.  
  3944.  
  3945.  
  3946.         G.2.1  Inherent Instructions 
  3947.  
  3948.                 aba             abx             aby             abz
  3949.                 ace             aced            ade             adx
  3950.                 ady             adz             aex             aey
  3951.                 aez             bgnd            cba             daa
  3952.                 ediv            edivs           emul            emuls
  3953.                 fdiv            fmuls           idiv            ldhi
  3954.                 lpstop          mul             nop             psha
  3955.                 pshb            pshmac          pula            pulb
  3956.                 pulmac          rtr             rts             sba
  3957.                 sde             sted            swi             sxt
  3958.                 tab             tap             tba             tbek
  3959.                 tbsk            tbxk            tbyk            tbzk
  3960.                 tde             tdmsk           tdp             ted
  3961.                 tedm            tekb            tem             tmer
  3962.                 tmet            tmxed           tpa             tpd
  3963.                 tskb            tsx             tsy             tsz
  3964.                 txkb            txs             txy             txz
  3965.                 tykb            tys             tyx             tyz
  3966.                 tzkb            tzs             tzx             tzy
  3967.                 wai             xgab            xgde            xgdx
  3968.                 xgdy            xgdz            xgex            xgey
  3969.                 xgez
  3970.  
  3971.  
  3972.         AS6816 ASSEMBLER                                        PAGE G-3
  3973.         6816 INSTRUCTION SET
  3974.  
  3975.  
  3976.         G.2.2  Push/Pull Multiple Register Instructions 
  3977.  
  3978.                 pshm    r,...           pulm    r,...
  3979.  
  3980.  
  3981.         G.2.3  Short Branch Instructions 
  3982.  
  3983.                 bcc     label           bcs     label
  3984.                 beq     label           bge     label
  3985.                 bgt     label           bhi     label
  3986.                 bhis    label           bhs     label
  3987.                 ble     label           blo     label
  3988.                 blos    label           bls     label
  3989.                 blt     label           bmi     label
  3990.                 bne     label           bpl     label
  3991.                 bra     label           brn     label
  3992.                 bvc     label           bvs     label
  3993.                 bsr     label
  3994.  
  3995.  
  3996.         G.2.4  Long Branch Instructions 
  3997.  
  3998.                 lbcc    label           lbcs    label
  3999.                 lbeq    label           lbge    label
  4000.                 lbgt    label           lbhi    label
  4001.                 lbhis   label           lbhs    label
  4002.                 lble    label           lblo    label
  4003.                 lblos   label           lbls    label
  4004.                 lblt    label           lbmi    label
  4005.                 lbne    label           lbpl    label
  4006.                 lbra    label           lbrn    label
  4007.                 lbvc    label           lbvs    label
  4008.                 lbsr    label
  4009.  
  4010.  
  4011.         G.2.5  Bit Manipulation Instructions 
  4012.  
  4013.                 bclr    [],#data
  4014.                 bset    [],#data
  4015.         
  4016.                 brclr   [],#data,label
  4017.                 brset   [],#data,label
  4018.  
  4019.  
  4020.         AS6816 ASSEMBLER                                        PAGE G-4
  4021.         6816 INSTRUCTION SET
  4022.  
  4023.  
  4024.         G.2.6  Single Operand Instructions 
  4025.  
  4026.                 asla            aslb            asld            asle
  4027.                 asl     []      aslw    []                      aslm
  4028.         
  4029.                 asra            asrb            asrd            asre
  4030.                 asr     []      asrw    []                      asrm
  4031.         
  4032.                 clra            clrb            clrd            clre
  4033.                 clr     []      clrw    []                      clrm
  4034.         
  4035.                 coma            comb            comd            come
  4036.                 com     []      comw    []
  4037.         
  4038.                 deca            decb
  4039.                 dec     []      decw    []
  4040.         
  4041.                 inca            incb
  4042.                 inc     []      incw    []
  4043.         
  4044.                 lsla            lslb            lsld            lsle
  4045.                 lsl     []      lslw    []                      lslm
  4046.         
  4047.                 lsra            lsrb            lsrd            lsre
  4048.                 lsr     []      lsrw    []
  4049.         
  4050.                 nega            negb            negd            nege
  4051.                 neg     []      negw    []
  4052.         
  4053.                 rola            rolb            rold            role
  4054.                 rol     []      rolw    []
  4055.         
  4056.                 rora            rorb            rord            rore
  4057.                 ror     []      rorw    []
  4058.         
  4059.                 tsta            tstb            tsta            tste
  4060.                 tst     []      tstw    []
  4061.  
  4062.  
  4063.         AS6816 ASSEMBLER                                        PAGE G-5
  4064.         6816 INSTRUCTION SET
  4065.  
  4066.  
  4067.         G.2.7  Double Operand Instructions 
  4068.  
  4069.                 adca    []      adcb    []      adcd    []      adce
  4070.                 []
  4071.         
  4072.                 adda    []      addb    []      addd    []      adde
  4073.                 []
  4074.         
  4075.                 anda    []      andb    []      andd    []      ande
  4076.                 []
  4077.         
  4078.                 bita    []      bitb    []
  4079.         
  4080.                 cmpa    []      cmpb    []      cpd     []      cpe
  4081.                 []
  4082.         
  4083.                 eora    []      eorb    []      eord    []      eore
  4084.                 []
  4085.         
  4086.                 ldaa    []      ldab    []      ldd     []      lde
  4087.                 []
  4088.         
  4089.                 oraa    []      orab    []      ord     []      ore
  4090.                 []
  4091.         
  4092.                 sbca    []      sbcb    []      sbcd    []      sbce
  4093.                 []
  4094.         
  4095.                 staa    []      stab    []      std     []      ste
  4096.                 []
  4097.         
  4098.                 suba    []      subb    []      subd    []      sube
  4099.                 []
  4100.  
  4101.  
  4102.         G.2.8  Index/Stack Register Instructions 
  4103.  
  4104.                 cps     []              cpx     []
  4105.                 cpy     []              cpz     []
  4106.         
  4107.                 lds     []              ldx     []
  4108.                 ldy     []              ldz     []
  4109.         
  4110.                 sts     []              stx     []
  4111.                 sty     []              stz     []
  4112.  
  4113.  
  4114.         AS6816 ASSEMBLER                                        PAGE G-6
  4115.         6816 INSTRUCTION SET
  4116.  
  4117.  
  4118.         G.2.9  Jump and Jump to Subroutine Instructions 
  4119.  
  4120.                 jmp     bank,[]         jsr     bank,[]
  4121.  
  4122.  
  4123.         G.2.10  Condition Code Register Instructions 
  4124.  
  4125.                 andp    #data           orp     #data
  4126.  
  4127.  
  4128.         G.2.11  Multiply and Accumulate Instructions 
  4129.  
  4130.                 mac     #data           rmac    #data
  4131.                 mac     #xo,#yo         rmac    #xo,#yo
  4132.  
  4133.  
  4134.  
  4135.  
  4136.  
  4137.  
  4138.  
  4139.  
  4140.  
  4141.  
  4142.  
  4143.  
  4144.  
  4145.  
  4146.                                    APPENDIX H
  4147.  
  4148.                                 AS8085 ASSEMBLER
  4149.  
  4150.  
  4151.  
  4152.  
  4153.  
  4154.         H.1  8085 REGISTER SET 
  4155.  
  4156.         The  following  is  a  list  of  the 8080/8085 registers used by
  4157.         AS8085:  
  4158.  
  4159.                 a,b,c,d,e,h,l   -       8-bit accumulators
  4160.                 m               -       memory through (hl)
  4161.                 sp              -       stack pointer
  4162.                 psw             -       status word
  4163.  
  4164.  
  4165.         H.2  8085 INSTRUCTION SET 
  4166.  
  4167.  
  4168.            The  following tables list all 8080/8085 mnemonics recognized
  4169.         by the AS8085  assembler.   The  following  list  specifies  the
  4170.         format for each addressing mode supported by AS8085:  
  4171.  
  4172.                 #data           immediate data
  4173.                                 byte or word data
  4174.         
  4175.                 r,r1,r2         register or register pair
  4176.                                 psw,a,b,c,d,e,h,l
  4177.                                 bc,de,hl,sp,pc
  4178.         
  4179.                 m               memory address using (hl)
  4180.         
  4181.                 addr            direct memory addressing
  4182.         
  4183.                 label           call or jump label
  4184.  
  4185.         The terms data, m, addr, and label may be expressions.  
  4186.  
  4187.            Note  that  not all addressing modes are valid with every in-
  4188.         struction, refer to  the  8080/8085  technical  data  for  valid
  4189.         modes.  
  4190.  
  4191.  
  4192.         AS8085 ASSEMBLER                                        PAGE H-2
  4193.         8085 INSTRUCTION SET
  4194.  
  4195.  
  4196.         H.2.1  Inherent Instructions 
  4197.  
  4198.                 cma             cmc
  4199.                 daa             di
  4200.                 ei              hlt
  4201.                 nop             pchl
  4202.                 ral             rar
  4203.                 ret             rim
  4204.                 rrc             rlc
  4205.                 sim             sphl
  4206.                 stc             xchg
  4207.                 xthl
  4208.  
  4209.  
  4210.         H.2.2  Register/Memory/Immediate Instructions 
  4211.  
  4212.                 adc     r       adc     m       aci     #data
  4213.                 add     r       add     m       adi     #data
  4214.                 ana     r       ana     m       ani     #data
  4215.                 cmp     r       cmp     m       cpi     #data
  4216.                 ora     r       ora     m       ori     #data
  4217.                 sbb     r       sbb     m       sbi     #data
  4218.                 sub     r       sub     m       sui     #data
  4219.                 xra     r       xra     m       xri     #data
  4220.  
  4221.  
  4222.         H.2.3  Call and Return Instructions 
  4223.  
  4224.                 cc      label           rc
  4225.                 cm      label           rm
  4226.                 cnc     label           rnc
  4227.                 cnz     label           rnz
  4228.                 cp      label           rp
  4229.                 cpe     label           rpe
  4230.                 cpo     label           rpo
  4231.                 cz      label           rz
  4232.                 call    label
  4233.  
  4234.  
  4235.         H.2.4  Jump Instructions 
  4236.  
  4237.                 jc      label
  4238.                 jm      label
  4239.                 jnc     label
  4240.                 jnz     label
  4241.                 jp      label
  4242.                 jpe     label
  4243.                 jpo     label
  4244.                 jz      label
  4245.                 jmp     label
  4246.  
  4247.  
  4248.         AS8085 ASSEMBLER                                        PAGE H-3
  4249.         8085 INSTRUCTION SET
  4250.  
  4251.  
  4252.         H.2.5  Input/Output/Reset Instructions 
  4253.  
  4254.                 in      data
  4255.                 out     data
  4256.                 rst     data
  4257.  
  4258.  
  4259.         H.2.6  Move Instructions 
  4260.  
  4261.                 mov     r1,r2
  4262.                 mov     r,m
  4263.                 mov     m,r
  4264.         
  4265.                 mvi     r,#data
  4266.                 mvi     m,#data
  4267.  
  4268.  
  4269.         H.2.7  Other Instructions 
  4270.  
  4271.                 dcr     r               dcr     m
  4272.                 inr     r               inr     m
  4273.         
  4274.                 dad     r               dcx     r
  4275.                 inx     r               ldax    r
  4276.                 pop     r               push    r
  4277.                 stax    r
  4278.         
  4279.                 lda     addr            lhld    addr
  4280.                 shld    addr            sta     addr
  4281.         
  4282.                 lxi     r,#data
  4283.  
  4284.  
  4285.  
  4286.  
  4287.  
  4288.  
  4289.  
  4290.  
  4291.  
  4292.  
  4293.  
  4294.  
  4295.  
  4296.  
  4297.                                    APPENDIX I
  4298.  
  4299.                                  ASZ80 ASSEMBLER
  4300.  
  4301.  
  4302.  
  4303.  
  4304.  
  4305.         I.1  .hd64 DIRECTIVE 
  4306.  
  4307.         Format:  
  4308.  
  4309.                 .hd64 
  4310.  
  4311.         The  .hd64  directive enables processing of the HD64180 specific
  4312.         mnemonics not included in  the  Z80  instruction  set.   HD64180
  4313.         mnemonics  encountered  without  the  .hd64  directive  will  be
  4314.         flagged with an 'o' error.  
  4315.  
  4316.  
  4317.         I.2  Z80 REGISTER SET AND CONDITIONS 
  4318.  
  4319.  
  4320.            The following is a complete list of register designations and
  4321.         condition mnemonics:  
  4322.  
  4323.                 byte registers  -       a,b,c,d,e,h,l,i,r
  4324.                 register pairs  -       af,af',bc,de,hl
  4325.                 word registers  -       pc,sp,ix,iy
  4326.         
  4327.                 C -     carry bit set
  4328.                 M -     sign bit set
  4329.                 NC -    carry bit clear
  4330.                 NZ -    zero bit clear
  4331.                 P -     sign bit clear
  4332.                 PE -    parity even
  4333.                 PO -    parity odd
  4334.                 Z -     zero bit set
  4335.  
  4336.  
  4337.  
  4338.  
  4339.         ASZ80 ASSEMBLER                                         PAGE I-2
  4340.         Z80 INSTRUCTION SET
  4341.  
  4342.  
  4343.         I.3  Z80 INSTRUCTION SET 
  4344.  
  4345.  
  4346.            The  following  tables  list all Z80/HD64180 mnemonics recog-
  4347.         nized by the ASZ80 assembler.  The designation []  refers  to  a
  4348.         required addressing mode argument.  The following list specifies
  4349.         the format for each addressing mode supported by ASZ80:  
  4350.  
  4351.                 #data           immediate data
  4352.                                 byte or word data
  4353.         
  4354.                 n               byte value
  4355.         
  4356.                 rg              a byte register
  4357.                                 a,b,c,d,e,h,l
  4358.         
  4359.                 rp              a register pair
  4360.                                 bc,de,hl
  4361.         
  4362.                 (hl)            implied addressing or
  4363.                                 register indirect addressing
  4364.         
  4365.                 (label)         direct addressing
  4366.         
  4367.                 offset(ix)      indexed addressing with
  4368.                                 an offset
  4369.         
  4370.                 label           call/jmp/jr label
  4371.  
  4372.         The  terms  data,  dir,  offset, and ext may all be expressions.
  4373.         The terms dir and offset are not allowed to be  external  refer-
  4374.         ences.  
  4375.  
  4376.            Note  that  not all addressing modes are valid with every in-
  4377.         struction, refer to the Z80/HD64180  technical  data  for  valid
  4378.         modes.  
  4379.  
  4380.  
  4381.         ASZ80 ASSEMBLER                                         PAGE I-3
  4382.         Z80 INSTRUCTION SET
  4383.  
  4384.  
  4385.         I.3.1  Inherent Instructions 
  4386.  
  4387.                 ccf             cpd
  4388.                 cpdr            cpi
  4389.                 cpir            cpl
  4390.                 daa             di
  4391.                 ei              exx
  4392.                 halt            neg
  4393.                 nop             reti
  4394.                 retn            rla
  4395.                 rlca            rld
  4396.                 rra             rrca
  4397.                 rrd             scf
  4398.  
  4399.  
  4400.         I.3.2  Implicit Operand Instructions 
  4401.  
  4402.                 adc     a,[]            adc     []
  4403.                 add     a,[]            add     []
  4404.                 and     a,[]            and     []
  4405.                 cp      a,[]            cp      []
  4406.                 dec     a,[]            dec     []
  4407.                 inc     a,[]            inc     []
  4408.                 or      a,[]            or      []
  4409.                 rl      a,[]            rl      []
  4410.                 rlc     a,[]            rlc     []
  4411.                 rr      a,[]            rr      []
  4412.                 rrc     a,[]            rrc     []
  4413.                 sbc     a,[]            sbc     []
  4414.                 sla     a,[]            sla     []
  4415.                 sra     a,[]            sra     []
  4416.                 srl     a,[]            srl     []
  4417.                 sub     a,[]            sub     []
  4418.                 xor     a,[]            xor     []
  4419.  
  4420.  
  4421.         ASZ80 ASSEMBLER                                         PAGE I-4
  4422.         Z80 INSTRUCTION SET
  4423.  
  4424.  
  4425.         I.3.3  Load Instruction 
  4426.  
  4427.                 ld      rg,[]           ld      [],rg
  4428.                 ld      (bc),a          ld      a,(bc)
  4429.                 ld      (de),a          ld      a,(de)
  4430.                 ld      (label),a       ld      a,(label)
  4431.                 ld      (label),rp      ld      rp,(label)
  4432.                 ld      i,a             ld      r,a
  4433.                 ld      a,i             ld      a,r
  4434.                 ld      sp,hl           ld      sp,ix
  4435.                 ld      sp,iy           ld      rp,#data
  4436.         
  4437.                 ldd                     lddr
  4438.                 ldi                     ldir
  4439.  
  4440.  
  4441.         I.3.4  Call/Return Instructions 
  4442.  
  4443.                 call    C,label         ret     C
  4444.                 call    M,label         ret     M
  4445.                 call    NC,label        ret     NC
  4446.                 call    NZ,label        ret     NZ
  4447.                 call    P,label         ret     P
  4448.                 call    PE,label        ret     PE
  4449.                 call    PO,label        ret     PO
  4450.                 call    Z,label         ret     Z
  4451.                 call    label           ret
  4452.  
  4453.  
  4454.         I.3.5  Jump and Jump to Subroutine Instructions 
  4455.  
  4456.                 jp      C,label         jp      M,label
  4457.                 jp      NC,label        jp      NZ,label
  4458.                 jp      P,label         jp      PE,label
  4459.                 jp      PO,label        jp      Z,label
  4460.         
  4461.                 jp      (hl)            jp      (ix)
  4462.                 jp      (iy)            jp      label
  4463.         
  4464.                 djnz    label
  4465.         
  4466.                 jr      C,label         jr      NC,label
  4467.                 jr      NZ,label        jr      Z,label
  4468.                 jr      label
  4469.  
  4470.  
  4471.         ASZ80 ASSEMBLER                                         PAGE I-5
  4472.         Z80 INSTRUCTION SET
  4473.  
  4474.  
  4475.         I.3.6  Bit Manipulation Instructions 
  4476.  
  4477.                 bit     n,[]
  4478.                 res     n,[]
  4479.                 set     n,[]
  4480.  
  4481.  
  4482.         I.3.7  Interrupt Mode and Reset Instructions 
  4483.  
  4484.                 im      n
  4485.                 im      n
  4486.                 im      n
  4487.                 rst     n
  4488.  
  4489.  
  4490.         I.3.8  Input and Output Instructions 
  4491.  
  4492.                 in      a,(n)           in      rg,(c)
  4493.                 ind                     indr
  4494.                 ini                     inir
  4495.         
  4496.                 out     (n),a           out     (c),rg
  4497.                 outd                    otdr
  4498.                 outi                    otir
  4499.  
  4500.  
  4501.         I.3.9  Register Pair Instructions 
  4502.  
  4503.                 add     hl,rp           add     ix,rp
  4504.                 add     iy,rp
  4505.         
  4506.                 adc     hl,rp           sbc     hl,rp
  4507.         
  4508.                 ex      (sp),hl         ex      (sp),ix
  4509.                 ex      (sp),iy
  4510.                 ex      de,hl
  4511.                 ex      af,af'
  4512.         
  4513.                 push    rp              pop     rp
  4514.  
  4515.  
  4516.         ASZ80 ASSEMBLER                                         PAGE I-6
  4517.         Z80 INSTRUCTION SET
  4518.  
  4519.  
  4520.         I.3.10  HD64180 Specific Instructions 
  4521.  
  4522.                 in0     rg,(n)
  4523.                 out0    (n),rg
  4524.         
  4525.                 otdm                    otdmr
  4526.                 otim                    otimr
  4527.         
  4528.                 mlt     bc              mlt     de
  4529.                 mlt     hl              mlt     sp
  4530.         
  4531.                 slp
  4532.         
  4533.                 tst     a
  4534.                 tstio   #data
  4535.