home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / MBUG / MBUG078.ARC / ZASMB.DOC < prev    next >
Text File  |  1979-12-31  |  34KB  |  829 lines

  1.  
  2.                                      "zasmb"
  3.  
  4.  
  5.                              A Zilog mnemonic assembler
  6.  
  7.  
  8.                                 (C) P.F Ridler 1984
  9.  
  10.  
  11.               Permission is granted, without fee, for non-commercial
  12.                     private or educational use of this program.
  13.  
  14.  
  15.                        Use for purposes other than the above
  16.                          may be arranged by agreement with
  17.  
  18.  
  19.                                     P.F Ridler,
  20.                                     4, Lewisam Ave.,
  21.                                     Chisipite,
  22.                                     Zimbabwe.
  23.  
  24.  
  25.  
  26.           0.0  Contents.
  27.           --------------
  28.  
  29.                   0.0   Contents.
  30.                   0.1   Introduction.
  31.                   0.2   General remarks on the capabilites of "zasmb".
  32.                   1.0   Getting started.  How to use the assembler.
  33.                   2.0   Assembly language.
  34.                   2.1     The character set.
  35.                   2.2     Statements.
  36.                   2.2.1     Labels.
  37.                   2.2.2     Operators.
  38.                   2.2.2.1     Pseudo-operators.
  39.                   2.2.3     Operands.
  40.                   2.2.4     Comments.
  41.                   3.0   Error messages.
  42.           3.1     Error recovery.
  43.                   4.0   Options.
  44.                   5.0   Detail of pseudo-operators.
  45.                   6.0   Known bugs.
  46.                   7.0   Files on this disc.
  47.                   8.0   Expression syntax.
  48.  
  49.  
  50.           0.1  Introduction.
  51.           ------------------
  52.  
  53.                   "zasmb"  is  a vanilla  flavoured  assembler for machines
  54.           based on  the  Z80  microprocessor.     It   does   not   produce
  55.           relocatable  code,  it  does not handle macro-instructions and it
  56.           does not have any fancy operators.  It does have  the  capability
  57.           to  read  source statements from more than one file, it does have
  58.           conditional assembly facilities and it is both  fast  and  cheap.
  59.           It has been used by its author over several years for very simple
  60.       jobs and for     assembling complex programs  such as compilers and
  61.       has not been found wanting.
  62.  
  63.                   The  main requirement for producing relocatable code goes
  64.           this way.  "I have a very large program which  I  am  writing  in
  65.           parts.   Why should I constantly reassemble those parts which are
  66.           are already written and tested?  If they are partially  assembled
  67.           in  relocatable  form  then  I can save time by just linking them
  68.           into the piece of the program which I am currently testing".
  69.  
  70.                   There are some very valid counter arguments.   Assemblers
  71.           are no  longer as slow as they were.  The time "zasmb" takes to
  72.           assemble a source program of 3500 lines  to  an  executable  code
  73.           file is  about 30 seconds using a ram disc emulator.  There is no
  74.           linking time at all.  To try to  save  time  over  this  sort  of
  75.           performance is hardly worthwhile.
  76.  
  77.                   When  a  program  is  in  the process of being written in
  78.           parts it is very seldom that one  part  is  really  finished  and
  79.           tested;   the  process is iterative and usually a major change in
  80.           one part will involve minor changes to other  parts,  which  then
  81.           have to  be  reassembled.  There are such routines as those which
  82.           display a  message  or  open  a  file,  which  will  not  require
  83.           amendment  but  these should be stored in a library, and this can
  84.           be done whether they are in relocatable or source code form.
  85.  
  86.                   The  matter  of  macro-instructions  is  another   matter
  87.           altogether.  There  are  people who are very fond of macros:  the
  88.           author is  not  one  of  them.    Their  main  use  is  for   the
  89.           development  of  pseudo-languages,  and for this purpose they are
  90.           vital if no compiler-compiler is available.  They can  also  save
  91.           a  little  typeing effort if several similar subroutines are used
  92.           in the same program, but here there  is  a  danger  in  that  the
  93.           programmer  may  try  to tailor the program to suit the available
  94.           macros rather than writing code to suit  the  problem  which  the
  95.           program is to solve.
  96.  
  97.                   "zasmb"  is  sufficiently  fast  that  relocatable   code
  98.           offers little or no advantage in speed and it can,  by  using  an
  99.           "include" statement, use source code segments from a library.
  100.  
  101.                   "zasmb"  is  an  assembler for the Zilog/Mostek Z80-CPU
  102.           microprocessor.  It is designed to run under the  CP/M  operating
  103.           system from  Digital  Research.    On  a Z80 microprocessor based
  104.           system.   "zasmb"  will  run  in  a  32K  CP/M  system  but  will
  105.           accommodate  larger  programs  in  more  memory up to the maximum
  106.           of 64k bytes addressable by a Z80 system.
  107.  
  108.                   "zasmb"  assembles at over  7000 lines per  minute  using
  109.           a 4MHz  Z80-based  machine  with a solid state disc emulator.  It
  110.           could probably be made to perform  faster  if  the  source  input
  111.           routines  were  improved,  but it is thought that the improvement
  112.           which might be obtained would not justify the effort involved.
  113.  
  114.                   "zasmb"  reads a source  (.Z80) file produced by  a  text
  115.           editor and  produces an object code (.COM) file.  and an optional
  116.           listing (.LST) file.
  117.  
  118.  
  119.           1.  Getting started.
  120.           --------------------
  121.  
  122.                   To  use  "zasmb"  a  source  file  having  a  file  type
  123.           (extension)  ".Z80"  must be prepared in Zilog mnemonics and this
  124.           is assembled by issuing the CP/M command
  125.  
  126.                                   zasmb <d>:<name>
  127.  
  128.                                                           where <d> is  the
  129.           letter  of  drive  on which the source file resides and <name> is
  130.           the name of the .Z80 source file.
  131.  
  132.                   The  input  file must have an extension of ".Z80" and the
  133.           output file will have an extension of ".COM" if  it  is  created.
  134.           A  .COM  file  will not be produced if there are errors signalled
  135.           during assembly.  A .LST file will be created if  the  "list  on"
  136.           statement  has  been  included  in  the  program  irrespective of
  137.           whether there are errors in the  program  or  not.    Even  if  a
  138.           listing is not requested any errors that occur will be listed.
  139.  
  140.  
  141.  
  142.           2.  Assembly language.
  143.           ----------------------
  144.  
  145.                   The assembly language mnemonics  used  by  "zasmb"  are
  146.           those in the Zilog manual.
  147.  
  148.  
  149.           2.1  Character set.
  150.           -------------------
  151.  
  152.                   The  character  set  recognised by the assembler consists
  153.           of
  154.                   the letters:  abcdefghijklmnopqrstuvwxyz
  155.                                 ABCDEFGHIJKLMNOPQRSTUVWXYZ
  156.                                 @_
  157.  
  158.                   the digits:   0123456789
  159.  
  160.            and    the special
  161.                   characters:   + - |  * / &
  162.  
  163.                   The assembler does  not  distinguish  between  upper  and
  164.           lower  case  versions  of  the  same character except within text
  165.           strings.
  166.  
  167.                   Text strings may contain any of the printable  characters
  168.           in the ASCII set.
  169.  
  170.  
  171.           2.2 Statements.
  172.           ---------------
  173.  
  174.                   The form of an input statement is:
  175.  
  176.               [label[:]] [operator [expression [,expression]]] [;[text]]
  177.  
  178.           where the  fields  in  braces  are optional.  If all the optional
  179.           fields are omitted a blank line results, which is  acceptable  to
  180.           the assembler.
  181.  
  182.                   Between  the fields any number of blank or tab characters
  183.           may be present but within fields other than <text> there  may  be
  184.           no <space> or <tab> characters.
  185.  
  186.                   The  length  of  an  input  statement  is  limited  to 80
  187.           characters.
  188.  
  189.                   The assembler  recognises  four  fields  in  a  statement
  190.           (line).  These are:
  191.  
  192.                           labels,
  193.                           operators,
  194.                           operands,
  195.                           comments.
  196.  
  197.                   Any  two  fields  must be separated from each other by at
  198.           least one space or <tab> character.
  199.  
  200.  
  201.           2.2.1 Labels.
  202.           -------------
  203.  
  204.                   Labels must start in the first column of a line  and  may
  205.           consist of  up  to  7 characters.  (The number of characters in a
  206.           label may be increased by  altering  the  constant  "mxnmch"  and
  207.           reassembling.)  The  first  character  of a name must be a letter
  208.           but subsequent characters may be either letters or digits.
  209.  
  210.                   The symbols "_" and "@" are regarded as letters  and  may
  211.           be included in labels.
  212.  
  213.                   Upper  case  and  lower  case  letters are interpreted as
  214.           being identical except when included in text strings.
  215.  
  216.                   A label must start with a letter in column  0.    It  may
  217.           consists  of  from 1 to 7 characters and digits, and, optionally,
  218.           it may be followded by a colon, with no space  between  the  last
  219.           character and  the  colon.   The maximum number of characters was
  220.           chosen to  be  compatible  with  the  normal  tabulation  columns
  221.           0,8,16 etc.     and  is  not  a  fundamental  limitation  in  the
  222.           assembler program.  A few  minor  changes  to  the  progam  would
  223.           allow names to be longer.
  224.  
  225.                   The   following   labels   are   reserved   for  the  Z80
  226.           registers:
  227.                           a,b,c,d,e,f,h,l,i,r,af,bc,de,hl,ix,iy,sp
  228.  
  229.  
  230.           2.2.2  Operators.
  231.           -----------------
  232.  
  233.                   The  operator,  if  present,  must  be separated from the
  234.           label (or ":")  by at least one <tab> or <space> character.   The
  235.           operators  are those  from  the  Zilog mnemonic set together with
  236.           some pseudo-operators which are in common use.
  237.  
  238.               The complete set of operators is:
  239.  
  240.                           add adc and
  241.                           bit
  242.                           call ccf cp cpl cpi cpir cpd cpdr
  243.                           daa dec di djnz
  244.                           ei ex exx
  245.                           halt
  246.                           im0 im1 im2
  247.                           in ini inir ind indr inc
  248.                           jp jr ld ldi ldir ldd lddr
  249.                           neg nop
  250.                           or out outi otir outd otdr
  251.                           push pop
  252.                           res ret reti retn rst rlca rla rrca
  253.                           rra rlc rl rrc rr rld rrd
  254.                           scf set sub sbc sla sra srl
  255.                           xor
  256.  
  257.  
  258.       The Z80 manual gives the forms
  259.  
  260.                           or a
  261.                           cp const
  262.  
  263.       which are inconsistent with the form
  264.  
  265.                           add a,b
  266.  
  267.           "zasmb" allows the forms
  268.  
  269.                           or a,a
  270.                           cp a,const for the sake of consistency.
  271.  
  272.           The manual is also unclear whether  the  interrupt  mode  command
  273.           should be
  274.                           im 0 or im0
  275.  
  276.           so  that  the forms "im0", "im1" and "im2" have been used because
  277.           they are easier to implement.
  278.  
  279.  
  280.  
  281.           2.2.2.1  Pseudo-operators.
  282.           --------------------------
  283.  
  284.                   The set  of  processor  operators  is  augmented  by  the
  285.           assembler instuctions:
  286.  
  287.                           equ    db    dw    ds   list  include
  288.                                 defb  defw  defs         read
  289.  
  290.                           org   forg  end    if   endif
  291.  
  292.           where  the  forms  on  the  second line are alternatives to those
  293.           above them.
  294.  
  295.                   For a description of the individual pseudo-operators  see
  296.           Section 5.
  297.  
  298.  
  299.           2.2.3 Operands.
  300.           -------------
  301.  
  302.                   The operand field of a statement may contain none, one or
  303.           two operands.  If  there is more than one operand,  they must  be
  304.           separated by a comma.
  305.  
  306.                   Operands comprise one of the following forms:
  307.  
  308.                                   a number,
  309.                                   a label,
  310.                                   the program counter "$",
  311.                                   a string,
  312.                                   an expression composed of the above.
  313.  
  314.  
  315.                   For  a  description  of  the  syntax  of  expressions see
  316.           Section 8.
  317.  
  318.  
  319.           2.2.4 Comments.
  320.           -------------
  321.  
  322.                   A comment consists of a semi-colon folllowed by  optional
  323.           explanatory text.    It must be the last ( or the only ) field on
  324.           a line, and may not continue beyond the end of the line.
  325.  
  326.  
  327.  
  328.           3.0  Error messages.
  329.           --------------------
  330.  
  331.           Errors detected  during assembly are always  displayed on
  332.       the console and  are entered into a .LST file even if the  source
  333.       file does not include a "list on" statement.
  334.  
  335.           The following text is a copy of the list file of a program
  336.       which has errors in it.
  337.  
  338.  
  339.          0                            list on
  340.          1                  ;
  341.          2                  ;
  342.     A    3  0100  78                   ld         a,bc
  343.                                          ^ Argument error
  344.     U    4  0101  2A0000               ld         hl,(abc)
  345.                                             ^ Undefined name
  346.     X    5  0104  79                   ld         a,c,
  347.                                          ^ Extra character ","
  348.     A    6  0105  61626364             db         'abcdef
  349.                   6566
  350.                                   ^ Argument error
  351.          7                  ;
  352.          8                  ;
  353.          9  010B            
  354.     
  355.  
  356.             Column 0 holds a single letter abbreviation of the error
  357.       message  while  underneath  the erroneous line there is an arrow
  358.       pointing to the approximate  position of the error followed by a
  359.       fuller  error  message.   If  the  "list on"  statement were not
  360.       present in source file,  then there a .LST file would  still  be
  361.       generated but only those lines which have errors would be listed
  362.       together with their error messages.
  363.  
  364.  
  365.       3.1  Error recovery.
  366.       --------------------
  367.  
  368.           When the assembler encounters an error it  display on the
  369.       console, below the error message, the additional message
  370.  
  371.             Edit, Continue or Quit? (E|C|Q)
  372.  
  373.       The "C" and "Q" replies are obvious but the "E" is not.   If the
  374.       "Edit"  option is  exercised the  assembler writes into the CP/M
  375.       CCP buffer the command line
  376.  
  377.             zedit d:name.z80
  378.  
  379.                        followed by the row and column
  380.       numbers of the position of the error and then jumps to the base
  381.       of the CCP, which is not  overwritten  by  the assembler.  This
  382.       invokes  the  editor  and  positions  the  cursor  at the error
  383.       position.  This facility must  be disabled if the user's editor
  384.       will not respond to line and column  arguments.
  385.  
  386.            Disabling the communication with the editor is done by
  387.       changing  the statement
  388.  
  389.             edit    equ    true
  390.  
  391.       near the beginning of "zasmb.z80" to
  392.  
  393.             edit    equ    false
  394.  
  395.       The effect will be to make the "E" reply the same as "C"
  396.  
  397.       This feature of the assembler has been found to speed up assembly
  398.       language program  development  considerably.   For further detail
  399.       see the file "comments.pfr".
  400.  
  401.  
  402.  
  403.           4.  Options.
  404.           ------------
  405.  
  406.                   There is only one option.  This is the Intel "Hex" option.
  407.       If  the  command  line  has  the  token  "hex"  ("h" will suffice)
  408.       following the filename as in
  409.  
  410.             zasmb d:name hex
  411.  
  412.                           an "Intel hex" code file will
  413.       be generated instead of an executable .COM file.   This file will
  414.       have the extension .HEX  and  must  be  loaded into  memory using
  415.       either "DDT" or "zload".
  416.  
  417.  
  418.       5.0  Pseudo-operators.
  419.       ----------------------
  420.  
  421.           "zasmb"  has a number of assembler  directives or "pseudo-
  422.       -operators.   Most of these  occur in other assemblers except  for
  423.       "forg"  the "false origin"  directive.  These pseudo-operators are
  424.        described in detail in the sections following.
  425.  
  426.  
  427.           5.1  db (or defb)
  428.           ------------------
  429.  
  430.                   This  pseudo-operator  defines  a  byte  or a sequence of
  431.           bytes to have the values  calculated  from  the  list  following.
  432.           Obviously,  each  item in the list must have a value in the range
  433.           0..FFH and it is left to the programmer to ensure  that  this  is
  434.           so.
  435.  
  436.                   The form of the statement is :
  437.  
  438.                       [label] db <expression list> [comment]
  439.  
  440.                   It  reserves  and  initialises  one  or more bytes to the
  441.           sequence of values given by the  expression  list.    The  label,
  442.           although  usual,  is  optional  and the expression list is one or
  443.           more expressions separated by commas.  There is no limit  on  the
  444.           length  of  the  expression  list except that imposed by the line
  445.           length of 80 characters.
  446.  
  447.                   A  string  may  be  used  as  a  shorthand  form  of   an
  448.           expression  list,  when all the items in the list would otherwise
  449.           be character expressions.
  450.  
  451.                   However, while string expressions may be composed of  any
  452.           number  of  characters, other expressions must evaluate to values
  453.           which will fit into a one byte storage element.
  454.  
  455.  
  456.               e.g.  string  db      'abcdef',cr,lf
  457.                     junk    db      -10H,+13,2345   ;illegal (2345 too big)
  458.  
  459.  
  460.           5.2  dw (or defw).
  461.           ------------------
  462.  
  463.                   This pseudo-operator defines a word  (two bytes) or words
  464.       to have the values calculated from the list following.  Each item
  465.       in the list  must have a value  which will  fit into one word but
  466.       unlike the "db" statement strings are not allowed.  It is left to
  467.       the programmer to ensure that this is so.
  468.  
  469.                   The form of the statement is :
  470.  
  471.                   [label] dw <expression list> [comment]
  472.  
  473.                   It  reserves  and  initialises  one  or more words to the
  474.           sequence of values given by the  expression  list.    The  label,
  475.           although  usual,  is  optional  and the expression list is one or
  476.           more expressions separated by commas.  There is no limit  on  the
  477.           length  of  the  expression  list except that imposed by the line
  478.           length of 80 characters.
  479.  
  480.  
  481.           5.3  ds  (or defw).
  482.           -------------------
  483.  
  484.                   This  pseudo-operator  reserves  a  sequence  of  memory
  485.       locations for future use.
  486.  
  487.                   The form of the statement is :
  488.  
  489.                       [label] ds <expression> [comment]
  490.  
  491.                   It reserves, but does not initialise, the number of bytes
  492.       given by the result of the expression. The label, although usual,
  493.       is optional.
  494.  
  495.  
  496.           5.4  equ.
  497.           ---------
  498.  
  499.                   This  pseudo-operator defines a name  (label) to represent
  500.       a constant value.  
  501.  
  502.                       label equ <expression> [comment]
  503.  
  504.           defines the label to have the (constant) value of the  expression
  505.           following.   The expression must evaluate to a value in the range
  506.           0..FFFFH so as not to exceed  the 2-byte  storage  space  allowed
  507.           for it in the symbol table.  Strings are not allowed.
  508.  
  509.  
  510.                   e.g.  lf      equ     10              ;decimal value
  511.                         cr      equ     0DH             ;hex value
  512.                         string  equ     'abcdef'        ;illegal
  513.  
  514.  
  515.           5.5  include (or read).
  516.           -----------------------
  517.  
  518.                   The "include" statement allows source language statements
  519.           to be read  from a file other than the original  source file.  It
  520.           takes the form:
  521.  
  522.                         [label]   include <d>:<name>.<typ>    [comment]
  523.           or            [label]   read    <d>:<name>.<typ>    [comment]
  524.  
  525.                                 where  <d>   is a valid disc drive letter,
  526.                                       <name> is a valid CP/M file name,
  527.                                  and  <typ>  is a valid CP/M file type.
  528.  
  529.                   The  supplementary  source  file  must  obviously contain
  530.           valid assembly language statements but must not contain an  "end"
  531.           statement  unless this is meant to be the last line of the entire
  532.           program.
  533.  
  534.                   The optional label may be  included,  but  it  is  rather
  535.           pointless, if not dangerous.
  536.  
  537.                  "include" files may be nested to a depth of 4.    This can
  538.       be altered easily.
  539.  
  540.  
  541.           5.6  if.
  542.           --------
  543.  
  544.                   An  "if"  statement signals the start of statements which
  545.           are to be conditionally assembled.  It has the form:
  546.  
  547.                           [label] if expression [comment]
  548.  
  549.                   The expression should have only the  values  <true>  (=1)
  550.           or <false>  (=0).    If  it has any value other than 1 it will be
  551.           taken to have the value <false>.
  552.  
  553.                   When the expression is "true"  the  lines  following  the
  554.           "if"  statement  will  be assembled in the normal manner until an
  555.           "endif" statement is encountered.
  556.  
  557.                   If the  expression  following  the  "if"  has  the  value
  558.           <false>  the  source  lines following it will be ignored until an
  559.           "endif" statement is encountered,  after  which  normal  assembly
  560.           will be  resumed.    The  list  file,  if  any,  will contain the
  561.           ignored lines, but they will  have  no  operation  codes  entered
  562.           against them.
  563.  
  564.  
  565.           5.7  endif.
  566.           -----------
  567.  
  568.                   This  statment  signals  the  end  of  a  section  of the
  569.           program which is to be conditionally assembled.    It  takes  the
  570.           form
  571.  
  572.                           [label] endif [comment]
  573.  
  574.                   It will always cause normal assembly to resume.
  575.  
  576.  
  577.           5.8  list
  578.           ----------
  579.  
  580.                   This  pseudo-operator takes one or other of the arguments
  581.           "on" or "off".  If the  argument  is  "on",  a  listing  file  is
  582.           created on  the  disc  on  which  the  source file resides.  This
  583.           listing file continues until the end of  the  assembly  or  until
  584.           another "list" operator with the argument "off" is encountered.
  585.  
  586.                   At  the  start of an assembly the list file is considered
  587.           to be turned "off" and will remain so until a "list on" statement
  588.       is encountered.
  589.  
  590.                   The "list" operator turns the  assembler  output  listing
  591.           file on or off.
  592.  
  593.                       [label]    list on       ;turns on the listing file
  594.  
  595.                       [label]    list off      ;turns off the listing file
  596.  
  597.  
  598.                   The  list file has the same name as the assembly language
  599.           source  file  but the  type (extension) is  changed to ".LST". It
  600.           will thus be on the same disc as the source file.
  601.  
  602.                   If  the  list  file  is  already  "on", further "list on"
  603.           commands will  have  no  effect  and  similarly  for  "list  off"
  604.           commands.
  605.  
  606.                   When  the  list  file  is  turned  on,  a file is created
  607.           containing the following information:
  608.  
  609.                  the number of each line,
  610.                  the program counter value at the start of the instruction,
  611.                  the code generated by the assembler for the statement,
  612.                  the text of the satement itself.
  613.  
  614.                   If the statement preceded by the line  number  etc.    is
  615.           longer  than 80 characters it is truncated to fit on an 80 column
  616.           line.  An example of the contents of a list file follows.
  617.  
  618.  
  619.                1                                list on
  620.                2                  ;
  621.                3        (0000)    label         equ     0
  622.                4        (0001)    true          equ     1
  623.           O    5  0100            false         eqq     0
  624.                                                   ^ ***** Op-code error *****
  625.                6                  ;
  626.                7        (0001)    debugs        equ     true
  627.                8                  ;
  628.                9                  ;
  629.               10  0100                          org     100H
  630.               11                  ;
  631.               12  0100  (0010)    aaaa          ds      10H
  632.               13  0110                          if      debugs
  633.               14  0110  3E0A                    ld      a,10
  634.               15  0112  61626364                db      'abcd'
  635.               16  0117  0600                    ld      b,0
  636.               17  0119  3620                    ld      (hl),' '
  637.               18  011B  (0010)    bbbb          ds      10H
  638.               19  012B                          endif
  639.               20  012B  3E00      cccc          ld      a,0
  640.               21                  ;
  641.               22  012D                          end
  642.  
  643.  
  644.           5.9   org.
  645.           ----------
  646.  
  647.                   This statement defines the starting address  (origin)  of
  648.           any section of the program.  It has the form:
  649.  
  650.                           [label] org expression [comment]
  651.  
  652.                                                         and the expression,
  653.           which  must  have  a  value  in  the  range  0..FFFFH  gives  the
  654.           starting address of the section of program.
  655.  
  656.                   A  program  may  have more than one "org" statement but a
  657.           new origin may not be less than the current value of the  program
  658.           counter, i.e. the program counter must not be driven backwards.
  659.  
  660.  
  661.                           org 100H
  662.                            .  .
  663.                            .  .
  664.                            .  .
  665.                           org 1000H
  666.                            .  .
  667.                            .  .
  668.                            .  .
  669.                           org 800H     ;illegal, ( < previous pc )
  670.  
  671.  
  672.           5.10  forg.
  673.           -----------
  674.  
  675.                   This pseudo-operator   defines  a  "false  origin".    It
  676.           allows code to be  generated  which  will  be  executed  at  some
  677.           address other  than  that  at  which  it  is  assembled.   It was
  678.           included so that a loader could be included in a version  of  the
  679.           CP/M CCP  which  had  its'  origin at 100H.  The loader was to be
  680.           included in this file but was to be transferred to  E000H  before
  681.           it was  executed.  If it had had an origin of E000H then the file
  682.           would have been more than 60k long.
  683.  
  684.                   This statement defines the starting address  (origin)  of
  685.           a section of the program.  It has the form:
  686.  
  687.                           [label] forg expression [comment]
  688.  
  689.                                                         and the expression,
  690.           which  must  have  a  value  in  the  range  0..FFFFH,  gives the
  691.           starting address of the following section of program.
  692.  
  693.                           The  "forg" address is nullified by another "org"
  694.           pseudo-operator.
  695.  
  696.  
  697.  
  698.           6.0  Known bugs.
  699.           ----------------
  700.  
  701.                   Latest revision:       1 Mar 1986
  702.  
  703.                   no check on expression size.
  704.                   some (ix+d) forms are not checked properly.
  705.  
  706.                   If further bugs are discovered please notify the  author,
  707.           preferably  with  the  fix,  giving the source code producing the
  708.           bug and as much other relevant information as possible.
  709.  
  710.  
  711.           7.0  Files on this disc.
  712.           ------------------------
  713.  
  714.            z80asmb.z80 the main source code file for the assembler
  715.            z80asmb.z81 an "included" source code file for the assembler
  716.            z80asmb.z82 an "included" source code file for the assembler
  717.            z80asmb.com an executable file of the assembler
  718.            z80asmb.doc this file
  719.  
  720.  
  721.  
  722.           8.0  Expression syntax.
  723.           -----------------------
  724.  
  725.                   Expressions follow the syntax diagrams below:
  726.  
  727.  
  728.            expression
  729.                |
  730.                |
  731.                |----------------------- string -----------------
  732.                |                        |
  733.                 ---------------- arithmetic expression --------------------->>
  734.  
  735.  
  736.  
  737.            arithmetic expression
  738.                   |                  --- "|" ---
  739.                   |                |--- "~? ---|
  740.                   |                |--- "-" ---|
  741.                   |                |--- "+" ---|
  742.                   |---- "-" ------        |        |
  743.                   |---- "+" ------|--- term ------- term ---
  744.                    ---- "~" ------        |
  745.                                                  --------------------------->>
  746.  
  747.  
  748.                 term
  749.                   |          ----- "&" -----
  750.                   |         |----- "\" -----|
  751.                   |         |----- "/" -----|
  752.                   |         |----- "*" -----|
  753.                   |          |         |
  754.                    ------------------- factor ------------------------------>>
  755.  
  756.  
  757.                factor
  758.                   |
  759.                   |------------- "'" -- character -- "'" ---------------
  760.                   |                            |
  761.                   |----------------------- name ------------------------|
  762.                   |                            |
  763.                   |---------------------- number -----------------------|
  764.                   |                            |
  765.                   |----------------------- "$" -------------------------|
  766.                   |                            |
  767.                    ----- "[" ---- arithmetic expression ---- "]" ----------->>
  768.  
  769.  
  770.                number
  771.                   |        -------------
  772.                   |       |         |
  773.                    ------------ digit ------------------ "H" -----
  774.                                                   |----- "B" -----|
  775.                                                   |----- "D" -----|
  776.                                                    ------------------------->>
  777.  
  778.  
  779.                 name
  780.                   |
  781.                   |              ---- digit ----
  782.                   |             |---- letter ---|
  783.                   |             |         |
  784.                    ---- letter --------------------------------------------->>
  785.  
  786.  
  787.  
  788.                string
  789.                   |               ---------------
  790.                   |              |          |
  791.                    --- "'" -- character ----- character ----- "'" ---------->>
  792.  
  793.  
  794.  
  795.                    The arithmetic operators are:
  796.  
  797.                           monadic operators:
  798.  
  799.                           "+" no effect
  800.                           "-" 2's complementation
  801.                           "~" 1's complementation
  802.  
  803.  
  804.                           dyadic operators
  805.  
  806.                           "+" addition
  807.                           "-" subtraction
  808.                           "~" exclusive OR
  809.                           "|" inclusive OR
  810.  
  811.                           "*" multiplication
  812.                           "/" division
  813.                           "\" modulus
  814.                           "&" AND
  815.  
  816.  
  817.                   The multiplicative operators * / \ and & take  precedence
  818.       over the  additive  operators  +  - ~  and  |  but  if  operators
  819.       are of equal precedence then  evaluation is from left to right in
  820.       the statement.  Expressions within  brackets are  evaluated first
  821.       and  may  be  nested  to  any  reasonable  degree,  the innermost
  822.       expressions being evaluated first.
  823.  
  824.  
  825.  
  826.                     ------------------- end -------------------
  827.  
  828.  
  829.