ASM-11(1)                    Retro Project Manual                    ASM-11(1)


NAME
       asm-11 - simple assembler for MACRO-11 style PDP-11 code

SYNOPSIS
       asm-11 [OPTION]...  FILE...
       asm-11 --help

DESCRIPTION
       asm-11  is  a  simple assembler for MACRO-11 style PDP-11 code that di-
       rectly generates a load module for an absolute  loader.  It  is  mainly
       used to compile test bench code or other small bare-metal programs into
       a loadable format.

       asm-11 accepts a subset of the MACRO-11 language and generates an abso-
       lute binary in the formats
         - lda-11(5): the DEC standard absolute binary format, can be directly
           used with the paper tape  loader.   Activated  with  the  --lda  or
           --olda options.
         - cof-11(5):  a custom format that contains the full symbol table and
           the absolute binary. Very useful when access to the symbol table is
           needed,  for example in test bench codes.  Activated with the --cof
           or --ocof options.
         - lsm-11(5): very simple word wise 'addr:data'  memory  dump.  Useful
           when  used in combination with some w11 tools, e.g. dasm-11.  Acti-
           vated with the --lsm or --olsm options.

       asm-11 can create a listing in a format very close to that generated by
       the MACRO-11 assembler.  Activated with the --lst or --olst options.

       asm-11 provides many basic assembler directives

         .ascii    stores ascii string
         .asciz    stores ascii string with trailing zero
         .asect    absolute program section (current default, dummy imp)
         .blkb     allocate bytes of storage
         .blkw     allocate words of storage
         .byte     store bytes of data
         .end      end of source
         .endc     end of .if conditional block
         .endm     end of macro
         .endr     end of .rept repeat block
         .error    raise error
         .even     ensure word aligment
         .include  include another source file
         .if       assembles block if condition is met
         .iff      assembles block if condition tests false
         .ift      assembles block if condition tests true
         .iftf     assembles block regardless of condition
         .list     minimal support for cnd,me,meb
         .nlist    minimal support for cnd,me,meb
         .macro    starts macro defintion (subset)
         .mcall    load macro definitions
         .mdelete  delete macro definitions
         .mexit    terminate macro or .rept expansion
         .narg     number of macro arguments
         .nchr     calculate string length
         .ntype    evaluate addressing mode
         .odd      align to odd byte address
         .print    insert output into listing
         .rept     starts repeat block definition
         .word     store words of data

       and thus restricted macro support and no psect support.

   Differences between asm-11 and MACRO-11
         - only single .asect supported, no .psect support
         - assembler stops with error code 'S' when '.' exceeds 160000
         - registers must be named r0,..,r5,sp,pc
         - the %n notation and register expressions are not supported
         - labeled assignment statements cause a 'Q' error (MACRO-11 accepts)
         - the .emt and .trap instruction must have the trap number specified
         - a .macro definition must end with .endm (.endr not accepted)
         - a .rept block must end with .endr (.endm not accepted)
         - macros: the \ operator accepts only symbols, no expressions
         - a .if dif/idn doesn't work with blank arguments
         - a .if df/ndf sees opcodes as defined (MACRO-11 doesn't)
         - a .if df/ndf sees register names as undefined (MACRO-11 doesn't)
         - error codes on invail statements differ, especially 'A' and 'Q'
         - the .(n)list acts only on cnd, me and meb, ignores other values
         - the .(n)list default is cnd=0,me=0,meb=1 (MACRO-11 cnd=1,meb=0)
         - the following directives are not supported: .cross, .csect, .dsabl,
           .enabl, .flt2, .flt4, .globl, .ident, .iif, .irp, .irpc,  .library,
           .limit,  .nocross,  .packed,  .page,  .psect, .rad50, .radix, .rem,
           .restore, .save, .sbttl, .title, .weak

   Design goal for directive support
       The following directives will be added in future releases

         .flt2     store 32 bit float
         .flt4     store 64 bit float


OPTIONS
       -I path
              adds path to the .include search path.  The default search  path
              is  '.'   plus  $RETROBASE/tools/asm-11 if RETROBASE is defined.
              Each -I adds path after '.'.  -I can be given multiple times und
              must have a single path name.

       -L path
              adds  path to the .library search path used by the .mcall direc-
              tive.  The default search  path  is  $RETROBASE/tools/asm-11  if
              RETROBASE  is  defined.  -L can be given multiple times und must
              have a single path name.

       -E     write .include processed code to stdout and stop after 1st pass.
              No  other  outputs  are created, options like --lst are ignored.
              Useful for the generation of self-contained macro files that are
              free of .include and .mcall directives and thus free of external
              references.  Was inspired by the -E option of gcc(1).

       -M     write rules to stdout suitable for make(1) describing the depen-
              dencies  of generated .lda and .lst files from the source files.
              Outputs for .lda and .lst targets one rule per input or included
              file.   Only useful when FILE is not '-'. Was inspired by the -M
              option of gcc(1).

       --lst  create listing with a default file name built from the  basename
              of the last FILE plus a .lst extension.  If FILE is '-' the out-
              put is written to stdout.

       --olst=fnam
              create a listing and write it to file fnam.  If fnam is '-'  the
              listing is written to stdout.

       --lda  create absolute loader output in lda-11(5) format with a default
              file name built from the basename of the last FILE plus  a  .lda
              extension.  If FILE is '-' the output is written to stdout.


       --olda=fnam
              create  absolute  loader output in lda-11(5) format and write it
              to file fnam.  If fnam is '-' the compound output is written  to
              stdout.

       --cof  create  compound  output in cof-11(5) format with a default file
              name built from the basename of the last FILE plus a .cof exten-
              sion.  If FILE is '-' the output is written to stdout.

       --ocof=fnam
              create  compound output in cof-11(5) format and write it to file
              fnam.  If fnam is '-' the compound output is written to  stdout.
              If  both  --olst=-  and  --ocof=- and are specified, the listing
              output comes first, followed by the compound output.

       --lsm  create lsmem style memory dump in lsm-11(5) format  with  a  de-
              fault  file name built from the basename of the last FILE plus a
              .lsm extension.  If FILE is '-' the output is written to stdout.

       --olsm=fnam
              create lsmem style memory dump in lsm-11(5) format and write  it
              to  file fnam.  If fnam is '-' the compound output is written to
              stdout.

       -list opt
              is equivalent to a '.list opt' directive at the beginning of the
              code.   Supported  values  for  opt  are  'cnd', 'me' and 'meb'.
              Startup default is 'cnd' and 'me' disabled  and  'meb'  enabled.
              -list can be given multiple times.

       -nlist opt
              is  equivalent  to  a '.nlist opt' directive at the beginning of
              the code.  -nlist can be given multiple times.   -nlist  options
              are processed after -list options.

       -help  print full help text and exit.

OPTIONS FOR DEBUG
       --tpass1
              trace line context in pass 1.

       --tpass2
              trace line context in pass 2.

       --dsym1
              dump psect and ust tables after pass 1.

       --dsym2
              dump psect and ust tables after pass 2.

       --ttoken
              trace tokenizer.

       --tparse
              trace parser.

       --temit
              trace code emit.

       --tout trace output file write.

ENVIRONMENT
       RETROBASE
              If defined adds an include path to the asm-11 standard library.

EXIT STATUS
       If files can't be opened or an assembler error is detected an exit sta-
       tus 1 is returned.


EXAMPLES
   Direct usage
       asm-11 -lst -lda test.mac
           Compiles test.mac and creates listing file  test.lst  and  absolute
           loader file test.lda.

       asm-11 --olst=- --ocof=- -
           Reads  the input from stdin and writes a listing followed by a com-
           pound output to stdout. This usage style is convenient  when  inte-
           grating asm-11 with other tools.

   Embedded usage
       from ti_w11 command line
           The  -e  option of the ti_w11 command uses asm-11 to compile a .mac
           source file and load the binary in either a w11 design on  an  FGPA
           or a test bench. Example
             ti_w11 -n4d -e $RETROBASE/tools/mcode/dl11/dl11echo.mac

       from ti_w11 command prompt
           The  lsasm subcommand of a CPU object uses asm-11 to compile a .mac
           source file, load the binary, and capture the listing and the  sym-
           bol table.

             cpu0 ldasm -file "test.mac" -sym sym -lst lst
             cpu0 cp stapc $sym(...end)

           compiles  test.mac  and  leaves the listing in Tcl variable sym and
           the symbol table in Tcl array lst. If the code  specified  a  start
           address via a .end directive it can be accessed via $sym(...end).

             cpu0 ldasm -lst lst -sym sym {
               ... MACRO-11 code ...
             }

           compiles  and  loads  a  code  snippet  embedded in the Tcl script.
           Again, the symbol table in Tcl array  lst.   This  usage  style  is
           heavily  used  in  test benches.  The direct and easy access to the
           symbol table allows a very tight interaction between the  verifica-
           tion  code  in  the  test bench and the code executed on the target
           system.

SEE ALSO
       asm-11_expect(1),   ti_w11(1),   dasm-11(1),   lda-11(5),    cof-11(5),
       lsm-11(5)


AUTHOR
       Walter F.J. Mueller <W.F.J.Mueller@gsi.de>


Retro Project                     2023-01-27                         ASM-11(1)
 
Generated: 2023-02-09
Generated by man2html V0.26
page hit count: ?E00
Valid CSS Valid XHTML 1.0 Strict