home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 405.lha / Z8_CrossAsm / z8ca.doc < prev    next >
Text File  |  1990-06-05  |  6KB  |  209 lines

  1. ;
  2. ; z8ca.doc
  3. ;
  4. ; Brief Documentation for operation of the z8 Cross Assembler.
  5. ;
  6. ;  Copyright (C) 1990 R.Bush. All rights reserved.
  7. ;
  8. ;  This program is freely distributable as long as this copyright notice
  9. ;  is retained. It intended for personal, non-commercial use.  
  10. ;
  11. ; Version 1.2
  12. ;
  13. ; Updates from original 1989 release:
  14. ;
  15. ; The following enhancements/fixes incorporated into this version:
  16.     1) allow symbols to be case sensitive.
  17.     2) allow math operations on defs.
  18.     3) fixed bug in Intel Hex file output.
  19.     4) added sorted symbol table option.
  20.     5) enabled 'DS' (define storage) pseudo op.
  21.     6) Bug fixed in 'DB' evaluation which prevented spaces after
  22.        pseudo op.
  23.  
  24. Invoking the assembler:
  25. -----------------------
  26.  
  27.   z8ca [filename] <opt1> <opt2> <opt3>
  28.  
  29.    -- [filename]
  30.       Required. automatically supplies .asm
  31.       extension and creates .hex file as output.
  32.  
  33.    -- <opt1>
  34.    -i -- Creates Intel format .hex output file.
  35.    -m -- Creates Motorola format .hex output file. (Default)
  36.    -z -- Creates special z8 format .hex output file
  37.      the use of which is explained later..
  38.  
  39.    If none of the above options are specified the
  40.    assembler defaults to Motorola .hex output.
  41.  
  42.    -- <opt2>
  43.    -l -- Enable the generation of program listing.
  44.  
  45.    -- <opt3>
  46.    -s -- Enable sorted symbol table listing.
  47.  
  48. Examples:
  49.  
  50.     z8ca serial
  51.     -- assembles the file serial.asm. Note: do not
  52.        supply the '.asm' extension as the assembler
  53.        will do it for you.  The file 'serial.hex'
  54.        is created in the default Motorola hex format.
  55.  
  56.     z8ca serial -i -l -s
  57.     -- assembles the file serial.asm. The file 'serial.hex'
  58.        is created in the Intel hex format. The listing of the
  59.        assembled program appears on the default output (terminal)
  60.        along with a listing of the sorted symbol table.
  61.  
  62.  
  63. Labels, radix specifiers, etc..
  64. -------------------------------
  65.  
  66.    Source code may be in upper or lower case.
  67.  
  68.    Any comment lines should start with a semi-colon.
  69.    e.g.
  70.    ;This is a comment..
  71.  
  72.    All labels must start with an alpha character and end with a colon. No
  73.    limit on the length of a label. Labels must start in the first column of
  74.    text..
  75.  
  76.    e.g. TEST01:   EQU   $0a 
  77.  
  78.    Note: Remember that the assembler is case sensitive for labels.
  79.          'TEST' and 'test' are recognized as two seperate labels.
  80.  
  81.    The following radix specifiers are allowed:
  82.    $ = hex
  83.    % = binary
  84.    0 thru 9 = decimal
  85.    ' = ascii literal
  86.  
  87.    e.g.    ld   r1,#$0a        ;the '#' means literal (immediate) data
  88.        ld   r1,#123
  89.        ld   r1,#%01101010
  90.        ld    r1,#'a'         ;ascii literal..
  91.  
  92.  
  93.    Simple math and logical operators allowed. (no parentheses please!!)
  94.    Evaluation occurs in order of appearance only.. No spaces are allowed
  95.    between operators and operands.
  96.  
  97.    +,-,*,/
  98.    & -- logical and
  99.    | -- logical or
  100.  
  101.    e.g.
  102.     test:    equ    $0a
  103.         ld    r1,#test+2*5/3
  104.             ld    r1,#test|$80
  105.  
  106.  
  107. z8 notes:
  108. ---------
  109.    All address modes supported.
  110.  
  111.    #   ---  Specifies immediate data.
  112.         e.g.  ld   r1,#10
  113.  
  114.    rx  ---  Specifies working register where 'x' in the range 0 thru 15.
  115.         e.g.  ld   r1,r12
  116.  
  117.    r:xxx -  Specifies an absolute register where 'x' in the range 0 thru
  118.         255. The colon operator is used to specify an absolute register. 
  119.         e.g.  ld   r1,r:242
  120.           ld   r2,r:$30
  121.  
  122.    rr  --   Specifies register pair.
  123.         e.g.  incw  rr2        ;working register pair
  124.           decw  rr:2       ;absolute register pair
  125.  
  126.    @r   --  Specifies indirect register.
  127.         e.g.  ld    r1,@r2     ;working indirect register
  128.           ld    r1,@r:48   ;absolute indirect register
  129.  
  130.    @rr  --  Specifies indirect register pair.
  131.         e.g   ldc   r1,@rr2    ;working indirect register pair
  132.           call  @rr:2      ;absolute indirect register pair
  133.  
  134.    !x  ---  Specifies hi or low portion of 16 bit operand where 'x' = 'h'
  135.         for hi-order bits and 'x' = 'l' for low order bits. This is
  136.         normally used to load register pairs with an address.
  137.             e.g.  ld    r2,message!h
  138.           ld    r3,message!l  ;loads reg. pair r2,r3 with address of
  139.                       ;message..
  140.             message:  db  'Hello World!!'
  141.  
  142.    ()  ---  Indexed addressing for ld instruction.
  143.             In the following example assume r5 = 1, r2 = 255.
  144.             e.g.  ld    r:40(r5),r2  ;load register 40+r5 (reg 41) with 255.
  145.           ld    r2,r:40(r5)  ;load r2 with content of r:41
  146.             Note: The base register for indirect addressing must be an
  147.           absolute register (r:40 in the examples). The remaining
  148.           registers used in forming the instruction (r2 and r5 in the
  149.           examples) must be working registers.
  150.  
  151. ------------------------------------------------------------------------------
  152.  
  153. Pseudo-ops.
  154. -----------
  155.  
  156.    Six Pseudo-ops are supported: ORG, EQU, DEF, DB, DW, and DS.
  157.  
  158.    ORG  --- Set program counter (origin).
  159.         e.g.
  160.         org $0800
  161.         Sets program to originate at 0800 hex.
  162.  
  163.    EQU  --- Allows a label to be equated to a value.
  164.         e.g.
  165.         test:  equ  $0a
  166.         Equates the label 'test' to the value 0a hex.
  167.  
  168.    DEF  --- Define. Similar to the 'C' language #define statement. This
  169.             will do a text substitution for the defined text.
  170.         e.g.
  171.               def      rp    r:253
  172.           push    rp
  173.           pop   rp
  174.         Substitutes 'r:253' for the text 'rp'. This is normally used
  175.             to allow the use of an ascii name for a special z8 register.
  176.  
  177.    DB   --- Define byte.
  178.         e.g.
  179.         test:    db    'text',$0a,$0d,00,%00010001
  180.  
  181.    DW   --- Define word (16 bit).
  182.         e.g.
  183.         rest:    dw    test,$1faf,0,$0100
  184.  
  185.    DS   --- Define Storage
  186.             e.g.
  187.             buffer:    ds    32
  188.         
  189.         Note: DS only reserves memory. The net effect is of the above
  190.                   example is to advance the program counter 32 bytes.
  191.         
  192. Error Messages:
  193. ---------------
  194.    I have made an attempt to supply meaningful error messages. Any error
  195.    should terminate the assembly and list the line number in error. If the
  196.    error message doesn't make much sense, well.., I said I made an ATTEMPT..
  197.  
  198. z8 .hex format output
  199. ----------------------
  200.    This is a special format file suitable for use with the supplied program
  201.    'download.bas'. It allows the user to load programs created by this 
  202.    assembler to a z8-Basic controller via an RS-232 link and a user supplied
  203.    terminal program.
  204.    See the file 'amiga.doc' for a more detailed explanation..
  205.  
  206.  
  207. ******** End of file ********
  208.