




                                  LDM 106

                            DOC #130-380-007-00










                                 SUPER-MAC
                              REFERENCE GUIDE
                                VERSION 51





     SUPER-MAC                                                  Page 2



                                                       COPYRIGHT   (C)
     1975


     DIGITAL EQUIPMENT CORPORATION


     The information in this document is  subject  to  change  without
     notice  and  should  not  be construed as a commitment by Digital
     Equipment Corporation.  Digital Equipment Corporation assumes  no
     responsibility for any errors that may appear in this manual.

     The software described in  this  document  is  furnished  to  the
     purchaser under a license for use on a single computer system and
     can be copied (with inclusion of DIGITAL's copyright notice) only
     for  use  in  such system, except as may otherwise be provided in
     writing by DIGITAL.

     Digital Equipment Corporation assumes no responsibility  for  the
     use  or  reliability  of  its  software  on equipment that is not
     supplied by DIGITAL.



     Since the appearance of SUPER-MAC in the public domain,  numerous
     enhancements  have been made which improve both the applicability
     and  portability  of  SUPER-MAC   source   code.    During   this
     enhancement  process,  every  effort  has  been  made to maintain
     compatibility for source code generated under earlier versions of
     SUPER-MAC.


     This manual documents SUPER-MAC VERSION 51.



     ARTHUR P.  GAUGHAN, JR.  19-MAR-80

     SUPER-MAC                                                  Page 3



                                 CONTENTS



     1.1  Introduction


     1.2  Assignment Statement

          LET, LETB


     1.3  Conditional Statements

     1.3.1 Condition Execution Statements

               IF

               IFB

               AND

               ANDB

               OR

               ORB

               ELSE

               ON.ERROR

               ON.NOERROR

               LEAVE

               GOTO

               THEN

     1.3.2 Loop Control Statements

               FOR

               REPEAT

               UNTIL

               UNTILB

               THRU


     SUPER-MAC                                                  Page 4



               WHILE

               WHILEB

               $$END

     1.4  Miscellaneous Statements

               BEGIN/END

               $CALL

               CALLG

               $RETURN

               POP, POPB

               PUSH, PUSHB

               JUMPTO

               CASE, CASEB

               PROCEDURE

               ENTRYPOINT

               PROBE, PROBEB

               BEGINMODULE


     1.5  Error Messages


     SUPER-MAC                                                  Page 5



     1.1  Introduction

     SUPER-MAC is a set of structured programming macros  that  allows
     programs  to  be  written  in  a  high  level,  easily understood
     language.  It is assumed that the user is familiar with macros in
     general and with MACRO-11 in particular.

     The language statements and clauses within this guide are divided
     into   three   categories:    Assignment  statement,  Conditional
     statements  and  Miscellaneous   statements.    The   Conditional
     category  of  statements  is  further  divided  into  Conditional
     Execution type statements and Loop Control statements.

     There are three branch type statements:  LEAVE, GOTO and  JUMPTO.
     The  LEAVE  and  GOTO  statements are cased special branches used
     with the IF statement.  They  are,  therefore,  included  in  the
     Conditional  category.   The  JUMPTO statement is included in the
     Miscellaneous category.

     As a general rule, most SUPER-MAC statements can  be  single-line
     statements   or   multiple-line  (nested)  block  statements.   A
     single-line statement must be completed on one source  line;   no
     continuation lines are allowed.  Single-line statements should be
     as short and simple as possible.  Comments may also  be  included
     on  a source line.  All the general rules, conditions, etc., that
     govern MACRO-11 also govern SUPER-MAC.  Spacing on a source  line
     is  very  important.  The elements should be separated by a comma
     or a space.  Tabs should never be used for spacing.  For example:
     The expression A+B is interpreted differently than A + B.

     All the conditional statements can be  written  as  multiple-line
     nested  blocks.   Each  level  of  nesting within a block must be
     terminated with an  associated  END  statement.   Each  level  of
     nesting should be indented two spaces.

     User written macros or  assembly  language  instructions  may  be
     included  in  a  program  if desired.  As a debugging aid, if the
     symbol LST$$ is defined, it will cause generated code and  labels
     to  be  listed.   All  programs  must  begin  with the macro call
     SMACIT.  This call initializes SUPER-MAC and .MCALLs all  of  the
     SUPER-MAC  macros  and  any  associated  primitives.   This guide
     contains examples of all statements.  In nested  block  examples,
     the  END  statements  associated  with a particular statement are
     noted.  When an example includes assembly language  instructions,
     that  instance is pointed out.  A list of possible error codes is
     included  as  well  as  an  assembled  listing  of  some  typical
     examples.   All  legal PDP-11 source and destination operands are
     legal in SUPER-MAC.



     1.2  Assignment Statement


     SUPER-MAC                                                  Page 6



     LET and LETB are the  only  assignment  statements  contained  in
     SUPER-MAC.

     LET(B) STATEMENT

     The LET(B) statement is an arithmetic assignment  or  replacement
     statement.

     The form of the statement is:

               LET(B) [Destination] <assignment operator> expression
                   [Operand   ]

     expression is in the form:

               (unary  operator)  operand  (binary  operator   operand
     binary operator...)

     Where:

               (     ) means optional

                                   NOTE

     Care must be taken in the construction  of  a  LET(B)  statement.
     Some  constructions  (where the destination operand type modifies
     the register used on the formation of  the  destination  address)
     appear  to be what the programmer desired, but the assembler will
     generate code that is different from the intent.

     Example:

          The statement

               LET (R5)+ := R1 + R2

          will generate the code MOV R1,(R5)+
                              ADD R2,(R5)+

          not the desired     MOV R1,(R5)
                              ADD R2,(R5)+

     In order to get the desired result, the following construction is
     necessary:

     LET (R5) := R1           ;MOV R1,(R5)
     LET (R5)+ := (R5)+ + R2  ;ADD R2,(R5)+

     SUPER-MAC recognizes  all  the  special  characters  accepted  by
     MACRO-11   as  well  as  some  additional  assignment/replacement
     characters.  The additional assignment or replacement  characters
     are listed below:


     SUPER-MAC                                                  Page 7



               :=             ;This is an assignment or replacement
                              ;character that implies WORD movement.

     Example:

          LET R0 := .PSTPT

     Moves the WORD represented by .PSTPT into R0.

               :B=            ;This is an assignment or replacement
                              ;character that implies BYTE movement.

     Example:

          LET R0 :B= @.PSTPT is equivalent to LETB R0 := @.PSTPT

     In either case, the BYTE that is pointed to by .PSTPT is moved to
     R0.

     SUPER-MAC has some special operators that are used  for  bit  set
     and bit clear operations.  The operators are listed below:

     BIT CLEAR OPERATORS      INSTRUCTION GENERATED

     CLEARED.BY                BIC(B)

     OFF.BY                    BIC(B)

     NAND                      BIC(B)

     Either can be used since they produce the same code.

     BIT SET OPERATORS        INSTRUCTION GENERATED

     SET.BY                   BIS(B)

     ON.BY                    BIS(B)

     OR                       BIS(B)

     Either one can be used since they produce the same code.

     Examples:

     LET T.FLAG(R2) := T.FLAG(R2) SET.BY #TP.ENB

     LET T.FLAG(R2) := T.FLAG(R2) OFF.BY #TP.ENB

     LET $SYSCL := $SYSCL OFF.BY #CL.NER

     LET (R2) := (R2) NAND R1

     SUPER-MAC accepts all the symbols recognized  by  MACRO-11.   The

     SUPER-MAC                                                  Page 8



     special symbols utilized by SUPER-MAC are listed below:

     SYMBOL                   DESCRIPTION

     CARRY                    C BIT (carry bit)

     PUSH                     Keyword for pushing on to stack

     POP                      Keyword for popping off of stack.

     TOP                      Keyword for top of stack.

     GLOBAL                   Keyword for generating a global
                              entry point.

     LOCAL                    Keyword for generating a local
                              entry point.

     SAVREG                   Keyword for saving R0-R5 upon
                              entry into a PROCEDURE

     The legal binary operators for use in SUPER-MAC are described  in
     Table  1-1.   Table  1-1  shows  the  relationships  that  can be
     established between expression terms through the  use  of  binary
     operators  and  also shows the machine instruction generated when
     the macro is assembled.


                                 Table 1-1
                          Legal Binary Operators

       BINARY                    EXPLANATION        EXAMPLE   MACHINE
     OPERATION                                       INSTRUCTION

          +  Addition            A + B                  ADD
          -  Subtraction         A - B                  SUB
          *  Multiplication      R0 * #2                MUL
          /  Division            R0 / #2                DIV
     L.SHIFT Arithmetic
             Left Shift          R0 L.SHIFT 1*          ASL
     R.SHIFT Arithmetic
             Right Shift         R0 R.SHIFT 1*          ASR
     L.ROTATE Left Rotate        R0 L.ROTATE 1*         ROL
     R.ROTATE Right Rotate       R0 R.ROTATE 1*         ROR
     SHIFT   Shift
             Arithmetically      R0 SHIFT #2            ASH
     C.SHIFT Arithmetic Shift
             Combined            R0 C.SHIFT #3          ASHC
     XOR     Exclusive OR        A XOR R5               XOR
     NAND    Not AND             (R2) NAND R1           BIC
     OFF.BY                      (R2) OFF.BY R1         BIC
     CLEARED.BY                  (R2) CLEARED.BY R1     BIC
     SET.BY  Inclusive OR        (R2) SET.BY R1         BIS

     SUPER-MAC                                                  Page 9



     ON.BY                       (R2) ON.BY R1          BIS
     OR                          (R2) OR R1             BIS


     * = Number designates the number  of  times  the  instruction  is
     repeated;  i.e., the number of shifts.

     The legal unary operators are:

             -                   Negation               NEG
             NOT                 Complement             COM

     If the assignment operator in a LET  statement  is  not  a  legal
     SUPER-MAC operator, an error message will be generated.

     Examples:

     LET (R2) := (R2) - #1              ;This generates DEC (R2)

     LET (R2) := (R2) - #01             ;This generates SUB #01,(R2)

     LET (R2) := (R2) OR R1

     LET R2 := #0                         ;This generates CLR R2

     LET R2 := R1

     LET T.VAL(R2) := $VAL2

     LET R0 := R0 L.SHIFT 3

     LET R1 := R1 + #1                  ;This generates an INC R1

     LET R1 := R1 + #01                 ;This generates an ADD #01,R1

     LET R0 := R0 + CARRY               ;This generates on ADC R0


     1.3  Conditional Statements

     This  category  of  SUPER-MAC  statements  is   subdivided   into
     Condition Execution statements and Loop Control statements.



     1.3.1  Condition Execution Statements

     IF STATEMENT
     IFB STATEMENT

     An IF  statement  causes  a  conditional  transfer  or  statement
     execution.  The IFB statement forces a byte operation.


     SUPER-MAC                                                 Page 10



     IF  statements  can  be  either  a  single-line  statement  or  a
     multiple-line (block) statement.  The single-line statement takes
     the form:

          IF <TEST> [GOTO ]   SUPER-MAC statement
                    [LEAVE]
                    [THEN ]

     The test portion of the IF statement takes the form:

                    [CC]
                    [CS]
                    [EQ]
                    [GE]
                    [GT]
                    [HI]
     Source         [HIS] Destination
     Operand        [LE] Operand
                    [LO]
                    [LOS]
                    [LT]
                    [MI]
                    [NE]
                    [PL]
                    [VC]
                    [VS]

     (Note:  these are the MACRO-11 branch  instructions  without  the
     "B".  GE not BGE.)

     A single line statement may have as many  arguments  as  desired,
     provided that all arguments can be completed on the single line.
     IF $NVAL HI #2 GOTO REJ1

     IF AND STATEMENT
     IF ANDB STATEMENT

     The AND statement is a logical conjunction.   The  expression  is
     true  if, and only if, both A and B are true.  The ANDB statement
     forces a byte operation.  AND can only be used with the IF.   The
     form is:

          A AND B

     Example:

          IF (R2) EQ (R1) AND 2(R2) EQ 2(R1) THEN $RETURN NOERROR

     IF OR STATEMENT
     IF ORB STATEMENT

     The OR statement is a logical  disjunction.   The  expression  is
     true  if,  and  only if, either A or B, or both is true.  The ORB

     SUPER-MAC                                                 Page 11



     statement forces a byte operation.  The OR can only be used  with
     an IF statement.  The form of the OR is:

          A OR B

     Example:

          IF A EQ #0 OR A NE C THEN LET A := D

     The block IF statement requires an END and takes the form:

          IF...........
            coding
           .
           .
           .
           .
           .
             coding
          END

     Example:

          IF A EQ #0
               LET $VAL2 := T.VAL(R2)
          END

     ELSE CLAUSE

     The ELSE clause is only used with an IF block.  Used in any other
     statement,  an  error message will be generated.  ELSE must stand
     on its own line with no arguments.

     Example:

     IF RESULT IS EQ
       LET $VAL2 := T.VAL(R2)
     ELSE
       LET $VAL1 := R2 + #T.VAL
     END

     Multiple IF statements can  be  nested.   Each  multiple-line  IF
     statement within the nest requires an END.

     Example:

     IF .PNUMH EQ #0
       LET $NVAL := $NVAL + #1
       IF $NVAL LOS #2
         IF RESULT IS EQ
           LET $VAL2 := .PNUMB
         ELSE
           LET $VAL1 := .PNUMB

     SUPER-MAC                                                 Page 12



         END
       END
     END
     Special cases of the IF statement perform bit  tests.   One  case
     tests  to  determine if the bit(s) are SET and the other tests to
     determine if the bit(s) are CLEAR.

     Examples:

          IF A SET.IN B THEN...  or IF A ON.IN B THEN...
          IF A OFF.IN B THEN...  or IF A CLEARED.IN B THEN...

     Another special case IF statement is a test for zero.

     Example:

          IF A GT #0 THEN...

     A third special case is a test of current condition code setting.
     This is indicated by RESULT IS.

     Example:

          IF RESULT IS EQ THEN...



     ON.ERROR STATEMENT
     ON.NOERROR STATEMENT

     Both of these statements are  special  case  IF  statements  that
     check  the  condition of the C bit.  The ON.ERROR statement tests
     to determine if the C bit is set and  the  ON.NOERROR  statements
     tests  to  determine  if  the  C bit is cleared.  Both statements
     require an END statement if a multiple line procedure is required
     to  rectify  the problem indicated by the condition of the C bit.
     Both statements result in an IF RESULT IS type statement.

     Examples:

     ON.ERROR
       IF #CL.NER OFF.IN $SYSCL
         $CALL $MGOUT
       END
       $POSYM
       CLC                    ;Macro instruction
     ELSE
       $POSYM
       CLC
     END

     ON.ERROR LEAVE SETBLK


     SUPER-MAC                                                 Page 13



     ON.ERROR
       PUSH #STSPT
       $CALL $FCSYM
       POP TOP
       ON.ERROR
         LET 16(SP) := 16(SP) + #2
       END
     END

     ON.ERROR
       LET PUSH := T.VAL(R2)
       $CALL $RPREG
       $CALL @(SP)+
       $CALL $SPREG
     END

     ON.NOERROR THEN LET T.FLAG(R2) := T.FLAG(R2)



     LEAVE STATEMENT
     GOTO STATEMENT

     These statements  are  similar  in  that  they  transfer  program
     control  from  one point to another point.  Their use and purpose
     are different.

     The LEAVE statement is used when it is necessary to transfer  out
     of a program block or loop due to some condition within the block
     or loop that can be tested.  The test is usually made with an  IF
     expression.

     Example:

     BEGIN ALPHA
          .
          .
          .
       IF RESULT IS NE LEAVE ALPHA
          .
          .
          .
     END ALPHA

     In this example, the result of a previous action is  tested.   If
     the result does not equal zero, program control is transferred to
     the expression that follows the END.

     WHILE A NE B
          .
          .
         coding
     IF C EQ #0 LEAVE LOOP

     SUPER-MAC                                                 Page 14



          .
          .
     coding
     END <WHILE LOOP>

     In this example, if C is equal to zero, the LEAVE will generate a
     branch or a jump outside of the WHILE loop.

     The GOTO statement also creates  a  branch  or  jump  instruction
     depending  on  the range.  The target of the BRJ macroinstruction
     is the value of the symbolic name given by the  programmer.   The
     form is:

          GOTO name

     Examples:

          GOTO SETCM

          IF A EQ B GOTO SETCM

     Program control transfers to a routine labelled SETCM.



     THEN CLAUSE

     The THEN clause is used in  conjunction  with  other  statements.
     The  first  statement  performs  a  designated  action  and  THEN
     performs a second action.  The THEN clause  takes  the  following
     form:

          THEN arguments

     Example:

          IF (R2) EQ (R1) AND (R2) EQ 2(R1) THEN $RETURN NOERROR



     1.3.2  Loop Control Statements

     FOR and FOR.ABS STATEMENTS

     The FOR statement is a means of controlling loop  execution  used
     to  change the value of an operand by a designated amount until a
     set limit is reached.  The FOR statement is  used  with  the  TO,
     DOWNTO and BY statements.  The form of the FOR statement is:

          FOR operand [TO    ] limit [BY increment (optional)]
                 [DOWNTO]
          END


     SUPER-MAC                                                 Page 15



     The default condition of the increment is one.   The  conditional
     branch  instruction  which  controls  the  loop  will be a signed
     branch when using FOR and an unsigned branch when using  FOR.ABS.
     The  FOR  statement  must  contain  an  END  statement unless the
     statement is a single-line entry followed by  a  THEN  statement.
     The THEN statement must be followed by arguments:

     Example 1:

     FOR A := B TO C BY D
          .
          .
        coding
     END  .

     This example causes B to be moved to A, D is added  to  A  and  A
     compared  with  C.   If  the  comparison  fails, the loop process
     continues until the comparison passes.  The FOR  statement  is  a
     WORD operation statement only.

     FOR A := B DOWNTO C BY D
          .
          .
        coding
     END

     This examples causes B to be moved to A, D is subtracted  from  A
     and  A  is compared with C.  If the comparison fails, the process
     continues until the comparison passes.

     Example 2:

          FOR R0 := R1 TO R2 THEN LET R4 := R4 / #2

     This example causes the contents of R1 to be moved  to  R0.   The
     contents  of R4 are divided by two and R0 is incremented.  R0 and
     R2 are compared.  If the comparison fails, the process  continues
     until the comparison passes.

     Example 3:

     FOR R0 := R1 DOWNTO R2
     LET R4 := R4 * #2
     END
     This causes the contents  of  R1  to  be  moved  to  R0.   R4  is
     multiplied  by two and R0 is decremented.  The contents of R0 and
     R2 are compared.  If the comparison fails, the process  continues
     until the comparison passes.

          Note well:  FOR and FOR.ABS implement loop control by an INC
     and  TST  at  the  bottom  of  the loop.  The loop will always be
     executed at least once and in order  to  cause  the  loop  to  be
     executed 10 times, the statements:

     SUPER-MAC                                                 Page 16



          FOR A := #0 TO #10.
           or
          FOR A := #1 TO #11.

     must be used rather than the expected

          FOR A := #1 TO #10.



     REPEAT STATEMENT
     UNTIL STATEMENT
     UNTILB STATEMENT

     The REPEAT statement causes a procedure to be  repeated  until  a
     specified  condition  is  met.  The REPEAT statement executes the
     procedures, tests the specified condition and  stops  the  repeat
     loop when the desired condition is met.  REPEAT statements can be
     single-line  statement  or   multiple   line   statements.    The
     single-line REPEAT takes the form:

          REPEAT UNTIL condition

     Example:

          REPEAT UNTIL (R0)+ EQ (R1)+

     This example can  best  be  illustrated  by  examination  of  the
     assembly  code  generated.  The assembler generated the following
     code:

          B1:;;;;;;
               CMP (R0)+,(R1)+
               BEQ E1
               BRJ B1 ;BRJ IS A MACROINSTRUCTION
          E1:;;;;;;

     As can be seen the comparison is repeated until it  passes,  then
     the action stops.

     There are two types  of  multiple-line  REPEAT  statements.   The
     first  type  repeats  a  procedure until a specified condition is
     met.  The second type is an infinite repeat (repeat loop) and  is
     termiated by an END statement.

     Examples:

          REPEAT
               $CALL C,<R0,R2>
          UNTIL R4 NE R0

     The next examples contains a LEAVE statement and was coded within
     a BEGIN block.

     SUPER-MAC                                                 Page 17



     BEGIN ALPHA
          .
          .
          .
     REPEAT
       $CALL F <FOO,BAR>
       IF RESULT IS NE LEAVE ALPHA
          .
          .
     END <REPEAT LOOP>
          .
          .
     END ALPHA

     The UNTIL statement can only be used within a  REPEAT  statement.
     The UNTIL statement defines the condition(s) that stop the REPEAT
     from looping.  The UNTILB forces  a  byte  operation.   An  error
     message  will  be generated if UNTIL is used in a statement other
     than a REPEAT.

     THRU STATEMENT

     The THRU statement is used to control loops.  The statement  must
     contain an END statement.

     The THRU statement generates an SOB  (subtract  one  and  branch)
     macroinstruction.  The statement takes the form:

          THRU arguments
          END

     The first argument must be a register or an expression (LET) with
     a  register  as  the destination.  If the first argument is not a
     register, an error  message  will  be  generated.   The  register
     contains  a number that represents the number of times the action
     must loop.

     Example 1:

          IF R2 HI # 6 THEN LET R2 := #6
          THRU R2
               MOVB (R0)+,(R1)+ ;Note macro instruction
          END

     In this example, R2 contains an integer between 1  and  6.   Each
     time  the  MOVB instruction is executed, the SOB macroinstruction
     subtracts one from the contents of R2.  When R2 becomes zero, the
     loop is left.

     WHILE STATEMENT
     WHILEB STATEMENT

     The  WHILE  statement  establishes  a  condition   that   permits

     SUPER-MAC                                                 Page 18



     (controls)   action  from  other  statements.   As  long  as  the
     condition exists, the action(s) will be permitted.  The  form  of
     the statement is:

     WHILE condition
       coding
          .
          .
          .
       coding
     END

     The WHILEB statement forces a byte operation.

     Example:

     LET R5 := (R4)+                    ;Get start addr of table
     WHILE R5 LO (R4)
       $CALL DTBL                       ;Go display entry
       LET R5 := R5 + #S.SYCT           ;Get next entry
     END

     $$END STATEMENT

     The $$END statement supplies  an  END  if  those  statements  are
     missing  within nested blocks.  The $$END prints a message on the
     assembly listing for the missing END(S).  The user  should  check
     the  source  code to determine if the assembled code will execute
     as intended.  $$END is intended for the detection of user "error"
     (i.e., missing END) conditions.



     1.4  Miscellaneous Statements

     BEGIN/END STATEMENT

     The BEGIN/END statement provides a mechanism for escaping from  a
     routine  in  case  some  problem  develops.   The  block  of code
     associated with the BEGIN statement is terminated  with  the  END
     statement.  The statement takes the form:

     BEGIN name                         ;Begins a contiguous block
                                        ;of code known as 'name'
     IF RESULT ... LEAVE name           ;A conditional method of
                                        ;escape
                                        ;from 'name'. The branch
                                        ;pointer points to END name.
     ON.ERROR LEAVE name                ;Another method of escape
     END name                           ;End of block.

     Following are two examples of the BEGIN/END statement:


     SUPER-MAC                                                 Page 19



     Example 1:

     BEGIN SETBLK
       $PHSYM                           ;PUSH symbols (macro call)
       $CALL $SCHLT                     ;Search table.
       ON.ERROR
         LET...
         $CALL...
         ON.ERROR LEAVE SETBLK          ;Escape if C bit set.
         IF...
          LET...
         ELSE
          LET...
         END
         LET...
         LET...
         LET...
       END                              ;END of ON.ERROR
       LET
       $POSYM                           ;POP of symbols (macro call)
       RETURN
     END SETBLK                         ;END of SETBLK

Example 2:

     BEGIN ALPHA
            IF...GT...B THEN $CALL...   ;One line IF statement
            REPEAT UNTIL...             ;One line REPEAT
            REPEAT                      ;Multiple line REPEAT

              $CALL...
            UNTIL...EQ...               ;Terminate condition
            $CALL
            REPEAT                      ;REPEAT loop

            $CALL...
            IF RESULT...LEAVE ALPHA     ;One line IF and a LEAVE

            WHILE...IS...THEN...
            END <REPEAT LOOP>           ;End of the REPEAT loop
     end ALPHA                          ;End of the Alpha block

     SUPER-MAC                                                 Page 20



     $CALL Statement

     The $CALL statement is used to transfer control (via  a  JSR  PC)
     from  one  program  unit to another.  It may also be used to pass
     parameters in the registers (R0-R5) between those program  units.
     Upon  completion  of  the  call,  execution  is  returned  to the
     statement following the $CALL.  The form of the  $CALL  statement
     is:

          $CALL NAME <ARGS>

     NAME is the symbolic name of the program unit  being  called  and
     ARGS  are  parameters.   ARGS  is optional and if used must be in
     brackets.  If ARGS is used without  brackets,  an  error  message
     will  be  generated.   The  ARGS  may  have  six parameters.  The
     position of the parameters within the ARGS brackets indicate  the
     register  that  will contain that particular parameter.  Register
     designations are from left to right, with R0 as  the  first.   If
     more  than  6  parameters are included, a warning message will be
     generated.

     Examples:

     $CALL $SCHLT <#$DYNTB,R1>

     $CALL $FLSYM

     $CALL DTBL

     $CALL F <FOO,BAR>

     In the last example, FOO is moved to R0, BAR is moved to R1 and a
     JSR  PC  is  generated to F.  In the next example, #X is moved to
     R0, #Y is moved to R1, Z is moved to R2 and the JSR PC is to E.

          $CALL E <#X,#Y,Z>

     When macros are nested, ARGS must  have  multiple  brackets,  for
     example:

          IF A EQ B THEN $CALL C <<<R0,#D>>>

     The example shown uses one bracket pair for each  statement,  one
     pair for the IF, one for the THEN and one for the $CALL.

     CALLG Statement

     The CALLG statement (call with  general  arguments)  is  used  to
     transfer  control  from  one  program unit to another and to pass
     parameters  to  that  program  unit  via  a  FORTRAN   compatible
     parameter  block.   The  parameter  block is built at runtime and
     follows the FORTRAN convention  for  null  arguments  (c.f.   the
     FORTRAN  IV and FORTRAN IV+ USER'S GUIDE) and the argument count.

     SUPER-MAC                                                 Page 21



     General purpose register R5 is first saved, used to point to  the
     head  of  the  parameter  block on the call out of line, and then
     restored upon return.  No other registers are used/preserved - it
     is   the  user's  responsibility  to  save/restore  registers  as
     necessary.  The CALLG  statement  may  be  used  to  call  either
     FORTRAN  library routines which expect an R5 call or any MACRO-11
     subroutine which is FORTRAN  callable.   N.B.!!!   in  either  of
     these cases care must be used in formatting the parameter list in
     the CALLG statement to ensure that "CALL  BY  NAME"  is  employed
     rather  than "CALL BY VALUE".  In most cases this will mean using
     immediate mode addresing (mode 2 - register 7) in  the  parameter
     list.  However, the requirement simply stated is as follows:  The
     parameter list must be a list of "ADDRESSES" of arguments  rather
     than  the  arguments themselves!  The CALLG statement may also be
     used to call non-FORTRAN compatible MACRO-11 subroutines in which
     case  the  resolution  of  the  "CALL BY NAME " - "CALL BY VALUE"
     conflict is at the discretion of the programmer.   In  all  calls
     the nesting rules described for $CALL apply.

     Examples:

     CALLG SPLAT        ;NO ARGUMENTS - USE ONLY FOR FORTRAN-TYPE
                          ;COMPATIBILITY, ELSE USE $CALL OR CALL

     CALLG SPLAT <#ARG1,,#ARG3>

     CALLG SPLAT <#ARG1,,R0,,STIPL>

     $RETURN Statement

     The $RETURN statement is used to return control from a subprogram
     unit  to the calling program unit.  The statement allows a return
     with status, with a register or both.  The  statement  takes  the
     form:

          $RETURN STA,REG

     Examples:                Machine Instructions

     $RETURN WITH R5          RTS R5

     $RETURN ERROR R2         SEC
                              RTS R2

     $RETURN NOERROR R5       CLC
                              RTS R5

     $RETURN ERROR            SEC
                              RTS PC

     $RETURN NOERROR          CLC
                              RTS PC


     SUPER-MAC                                                 Page 22



     $RETURN STAT R5          MOVB STAT,-(SP)
                              ROLB (SP)+
                              RTS R5

     $RETURN R4               MOVB R4,-(SP)
                              ROLB (SP)+
                              RTS PC

     $RETURN ,R5              RTS R5


     POP Statement

     The POP statement is used for POPping WORD data  off  the  stack.
     The statement takes the form:

          POP P1,P2,P3,...P10

     The argument(s) (P1,P2...) can  be  any  legal  destination  WORD
     operand  or  they may be TOP in which case the TOP (word) element
     on the stack is POPped into never-never land.

     Example:                 Generated Code

          POP R0,R4           MOV (SP)+,R0
                              MOV (SP)+,R4

          POP R0,TOP          MOV (SP)+,R0
                              MOV (SP),(SP)+

     The  user  will  note  that  since  MOV  instructions  are   used
     throughout, the CARRY bit is preserved across all POPs.



     POPB Statement

     The POPB statement provides a similar facility for BYTE  data  as
     that  provided  by  POP.   The  argument(s) (P1,P2...) can be any
     legal destination BYTE operand.  However, they may  NOT  be  TOP.
     The  POPBed  byte  is always the low-order byte on the top of the
     stack.  Remember, each BYTE POPBed from the stack  actually  pops
     one WORD from the top of the stack.



     PUSH Statement

     The PUSH statement provides a method for pushing WORD data on  to
     the stack.  The statement takes the form:

          PUSH P1,P2,P3...P10


     SUPER-MAC                                                 Page 23



     The argument(s) P1,P2...) can be any legal source WORD operand.

     Example:                 Generated Code

          PUSH R4,R0          MOV R4,-(SP)
                              MOV R0,-(SP)



     PUSHB Statement

     The PUSHB statement provides a method for pushing  BYTE  data  on
     the  stack.   The  argument(s) (P1,P2...) can be any legal source
     BYTE operand.  The PUSHBed operand always occupies the  low-order
     byte  on the top of the stack with the high-order byte on the top
     of  the  stack  CLEAR.   Remember,  each  BYTE  PUSHBed  actually
     reserves one WORD on the stack.



     JUMPTO Statement

     The JUMPTO statement creates  a  BRJ  macroinstruction  with  the
     pointer pointing to a symbolic name given by the programmer.  The
     form is:

          JUMPTO name



     CASE(B) Statement

     CASE(B) are statement(s) that will issue a call to  a  subroutine
     that  can  be selected by a variable.  CASE(B) must be terminated
     by an END statement.  The form of the CASE(B) statement is:

     CASE(B) variable

     Routine 0
     Routine 1
     Routine 2
     Routine 3
        .
        .
     Routine n
     END

     where:  variable is 0,1,2,3...n

     The selector variable can be  any  legal  BYTE  (CASEB)  or  WORD
     (CASE) operand that contains the desired number or it can be TOP.
     TOP signifies either the low-order BYTE (CASEB) or WORD (CASE) on
     the top of the stack.  If TOP is used, the TOP word/byte entry on

     SUPER-MAC                                                 Page 24



     the stack is altered.

     Example:

     LET R0 := #2
     CASE R0             or        CASE #2
       ADDVAL
       SUBVAL
       ORVAL

     END

     Upon completion of the CASE(B) (END), control will be transferred
     to  the  ORVAL  subroutine.   When  ORVAL has finished, i.e., has
     executed a  $RETURN,  execution  will  resume  at  the  statement
     following  the  END.   The programmer must be careful to validate
     the range of the variable for use  with  the  CASE(B)  statement.
     (Note:  CASE(B) does not generate PIC position independent code).

     PROCEDURE Statement

     PROCEDURE  is  a  statement  which  allows  the   programmer   to
     implicitly  establish  an  entry  point  label  for  a subroutine
     (procedure).  The form of the PROCEDURE statement is:

     PROCEDURE NAME,TYPE,SAVE

     where NAME is any legal MACRO-11 label.   TYPE  may  be  assigned
     either  the  keyword LOCAL or GLOBAL.  If TYPE is unspecified the
     default is LOCAL.  If  TYPE  is  unrecognizable  the  default  is
     GLOBAL.   SAVE  may  be assigned the keyword SAVREG in which case
     R0-R5 are saved/restored upon entry/exit.  If SAVE is unspecified
     or unrecognized, registers 0-5 are not saved/restored.

     ENTRYPOINT Statement

     ENTRYPOINT  is  a  statement  which  allows  the  programmer   to
     implicitly  establish  an  alternate  entry  point  label  for  a
     procedure.  The form of the ENTRYPOINT statement is:

     ENTRYPOINT NAME,TYPE

     where NAME is any legal MACRO-11 label.   TYPE  may  be  assigned
     either  the  keyword LOCAL or GLOBAL.  If TYPE is unspecified the
     default is LOCAL.  If  type  is  unrecognizable  the  default  is
     GLOBAL.

     PROBE and PROBEB Statement

     PROBE and PROBEB enable the programmer to generate an in line TST
     or  TSTB  instruction  and  thus set up the condition codes for a
     subsequent IF RESULT IS ...  conditional test.


     SUPER-MAC                                                 Page 25



     BEGINMODULE Statement

     BEGINMODULE enables a programmer to format a module and track its
     history.   In addition, the BRIDGEPORT-TEXTRON software copyright
     notice will be appended to the source history.  The form is:

     BEGINMODULE NAME,IDENT,DATE




     SUPER-MAC                                                 Page 26



     1.5  Error Messages

     Listed below are some of the error messages generated by
      SUPER-MAC.

     STACK UNDERFLOW!!!

     IF SYNTAX ERROR --- IS

     ELSE SEEN IN OTHER THAN IF BLOCK

     UNTIL SEEN IN OTHER THAN REPEAT BLOCK

     PROCEDURE NAME NOT SPECIFIED

     ENTRYPOINT NAME NOT SPECIFIED

     UNRECOGNIZED 'TYPE' KEYWORD - DEFAULT TO GLOBAL

     UNRECOGNIZED 'SAVE' KEYWORD - REGISTERS NOT SAVED

     --- MUST BE A REGISTER

     --- STRANGE SUPER-MAC STACK VALUE

     --- ...ARGS MUST BE WITHIN <>

     --- NOT A LEGAL ASSIGNMENT OPERATOR

     6 ARG MAX (R0-R5)

     --- NOT A LEGAL OPERATOR


     SUPER-MAC                                                 Page 27
INDEX



     $$END statement 18

     $CALL statement 20

     $RETURN statement 21


     AND(B) 10

     ASSIGNMENT statement 5


     BEGIN/END statement 18

     BEGINMODULE statements 25

     BINARY OPERATORS 8

     BIT TESTS 12


     CALLG statement 20

     CASE(B) statement 23

     CONDITIONAL statements 9


     ELSE clause 11

     ENTRYPOINT statement 24

     ERROR MESSAGES 26


     FOR and FOR.ABS statements 14


     GOTO statement 14


     IF STATEMENT 9

     IFB statement 9

     INTRODUCTION 5


     JUMPTO statement 23



     SUPER-MAC                                                 Page 28
INDEX


     LEAVE statement 13

     LET(B) statement 6

     LOOP CONTROL statements 14


     MISCELLANEOUS statements 18


     ON.ERROR statement 12

     ON.NOERROR statement 12

     OR(B) 10


     POP statement 22

     POPB statement 22

     PROBE and PROBEB statement 24

     PROCEDURE statement 24

     PUSH statement 22

     PUSHB statement 23


     REPEAT statement 16


     THEN clause 14

     THRU statement 17


     UNARY OPERATORS 9

     UNTIL statement 17


     WHILE statement 17

     WHILEB statement 18

