home *** CD-ROM | disk | FTP | other *** search
/ MacGames Sampler / PHT MacGames Bundle.iso / MacSource Folder / Samples from the CD / Assembly / Mac68k / MANUAL / MAN8.DOC < prev    next >
Encoding:
Text File  |  1985-08-11  |  11.8 KB  |  461 lines  |  [TEXT/Anon]

  1.  
  2. MAC.68K
  3.  
  4.  
  5.  
  6.                                LOCAL                               LOCAL                               LOCAL
  7.  
  8.  
  9.  
  10.   PURPOSE         To define unique names for use within a macro
  11.                definition.
  12.  
  13.  
  14.  
  15.   FORMAT               LOCAL  symbol1,symbol2,...symbolN
  16.  
  17.  
  18.  
  19.   DESCRIPTION     LOCAL must immediately follow the MACRO or MACROL
  20.                pseudo op. It contains a list of symbols that are to
  21.                be used only within the macro body. During macro
  22.                expansion, local symbols are replaced with a symbol
  23.                name of ..hhhh where hhhh is a hex number starting at
  24.                0000 and being incremented by one each time a local
  25.                symbol is generated. By generating unique names for
  26.                each macro call, a macro may use internal location
  27.                symbols or EQUs and not produce duplicate name errors
  28.                if called more than once.  Local symbols do not appear
  29.                in the symbol table and are not cross referenced.
  30.  
  31.  
  32.  
  33.   EXAMPLE      ZEROUT  MACRO   LOCATION,COUNT
  34.                        LOCAL   LOOP,EXIT
  35.                        MOVE    #COUNT,D0
  36.                        BLE.S   EXIT
  37.                        LEA     LOCATION,A0
  38.                LOOP    CLR.B   (A0)+
  39.                        DBF     D0,LOOP
  40.                EXIT    DS      0
  41.                        ENDM
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                               -45-                              MAC.68K
  64.                                                                 MAC.68K
  65.  
  66.  
  67.                                MACRO                               MACRO                               MACRO
  68.  
  69.  
  70.  
  71.   PURPOSE         To define a macro.
  72.  
  73.  
  74.  
  75.   FORMAT     macroname  MACRO  parameter1,parameter2,...parameterN
  76.  
  77.  
  78.  
  79.   DESCRIPTION     MACRO is followed by a block of code terminated by
  80.                an ENDM.  This block of code, called the macro body,
  81.                is saved and may be inserted into the program assembly
  82.                at any future point by using the macro name as an
  83.                operation code.
  84.  
  85.                    A macro may be defined with 0 to 127 formal
  86.                parameters.  The parameters are listed in the operand
  87.                field of the MACRO statement and are separated by
  88.                commas. A parameter may be any valid symbol name.
  89.                These parameters may appear in any instruction field
  90.                within the body of the macro. At macro call time, when
  91.                the macro name is used as an operation code, the
  92.                operand field contains its own list of actual
  93.                parameters separated by commas. The first actual
  94.                parameter is substituted for all occurances of the
  95.                first formal parameter in the macro body, the second
  96.                actual parameter is substituted for all appearances of
  97.                the second formal parameter, and so on.  The resulting
  98.                block of code, called the macro expansion, is inserted
  99.                into the assembly immediately following the macro
  100.                call.
  101.  
  102.                    Local symbols and macro parameters are recognized
  103.                in the macro body if they are delimited by:
  104.                  space  +  -  *  /  (  )  &  ,  =  "
  105.  
  106.                    Any actual macro parameter may be placed in
  107.                parenthesis. This is especially useful for passing
  108.                special characters such as commas or spaces. An actual
  109.                parameter may be null. Its macro body substitution
  110.                will also be null.
  111.  
  112.                    A symbol in the location field of a MACRO call is
  113.                assigned a permanent value equal to the location
  114.                counter prior to the macro expansion.
  115.  
  116.                    Macro expansions may contain calls to other macros
  117.                or even to the same macro.  A limit of 5 nested macro
  118.                calls is allowed.
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125. MAC.68K                                  -46-
  126. MAC.68K
  127.  
  128.  
  129.   EXAMPLES
  130.  
  131.         definition               call                 expansion
  132.  
  133.  
  134.   TEST  MACRO                    TEST                   null
  135.         ENDM
  136.  
  137.  
  138.  
  139.   ADD3  MACRO  P1,P2,P3          ADD3 7,8,9            MOVE  7,D1
  140.         MOVE   P1,D1                                   ADD   8,D1
  141.         ADD    P2,D1                                   ADD   9,D1
  142.         ADD    P3,D1
  143.         ENDM
  144.  
  145.  
  146.  
  147.   CADD  MACRO  P1,P2,P3          CADD 4,5              MOVE  4,D1
  148.         LOCAL  JTAG                                    IFS   NE,*5**,1
  149.         MOVE   P1,D1                                   ADD   5,D1
  150.         IFS    NE,*P2**,1                              IFS   EQ,***
  151.         ADD    P2,D1                                   BRA.S ..0000
  152.         IFS    EQ,*P3**                                OR    $FFFE,D1
  153.         BRA.S  JTAG                            ..0000  DS    0
  154.         ELSE
  155.         ADD    P3,D1             CADD 4,,6             MOVE  4,D1
  156.         ENDC                                           IFS   NE,***,1
  157.         OR     #$FFFE,D1                               IFS   EQ,*6**
  158.   JTAG  DS     0                                       ELSE
  159.         ENDM                                           ADD   6,D1
  160.                                                        OR    #$FFFFE,D0
  161.                                                ..0001  DS    0
  162.  
  163.  
  164.  
  165.  
  166.  
  167.                                MACROL                               MACROL                               MACROL
  168.  
  169.  
  170.  
  171.   PURPOSE         To define a macro.
  172.  
  173.  
  174.  
  175.   FORMAT     macroname  MACROL parameter1,parameter2,...parameterN
  176.  
  177.  
  178.  
  179.   DESCRIPTION     MACROL is similiar to macro except that on the
  180.                MACROL call the location field is treated as call
  181.                parameter 1 instead of as a location field symbol.
  182.                (See example for STRLEN)
  183.  
  184.  
  185.  
  186.  
  187.                               -47-                              MAC.68K
  188.                                                                 MAC.68K
  189.  
  190.  
  191.                                 MAX                                MAX                                MAX
  192.  
  193.  
  194.  
  195.   PURPOSE         To generate a redefinable symbol equal to the
  196.                largest value from the expression list in the operand
  197.                field.
  198.  
  199.  
  200.  
  201.   FORMAT     symbol    MAX    expression1,expression2,...expressionN
  202.  
  203.  
  204.  
  205.   DESCRIPTION     MAX evaluates the expressions in the operand list
  206.                and assigns the largest value found to the redefinable
  207.                symbol in the location field. All symbols used in the
  208.                expressions must be previously defined. If any errors
  209.                are encountered the symbol is not (re)defined.
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.                                 MIN                                MIN                                MIN
  217.  
  218.  
  219.   PURPOSE         To generate a redefinable symbol equal to the
  220.                smallest value from the expression list in the operand
  221.                field.
  222.  
  223.  
  224.  
  225.   FORMAT     symbol    MIN    expression1,expression2,...expressionN
  226.  
  227.  
  228.  
  229.   DESCRIPTION     MIN evaluates the expressions in the operand list
  230.                and assigns the smallest value found to the
  231.                redefinable symbol in the location field. All symbols
  232.                used in the expressions must be previously defined. If
  233.                any errors are encountered the symbol is not
  234.                (re)defined.
  235.  
  236.  
  237.  
  238.   EXAMPLES     FOO     MAX     PAGESIZE,80
  239.                BAZ     MIN     LENGTH1,LENGTH2,LENGTH3
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249. MAC.68K                                  -48-
  250. MAC.68K
  251.  
  252.  
  253.                                MODULE                               MODULE                               MODULE
  254.  
  255.  
  256.  
  257.   PURPOSE         To indicate a MAC.68K module assembly. The object
  258.                file is generated with a .MOD file extension.
  259.  
  260.  
  261.  
  262.   FORMAT               MODULE
  263.  
  264.  
  265.  
  266.   DESCRIPTION     MODULE is an initialization directive. It must
  267.                appear after the IDENT card but before any
  268.                noninitialization operation codes. MODULE generates
  269.                the .MOD files used with INCLUDEH.
  270.  
  271.                    A module may contain CPU instructions and/or data.
  272.                It differs from an included text file in that the
  273.                module is assembled prior to its use and is converted
  274.                from text into actual machine code. The default origin
  275.                address for a module is $0 and there is no associated
  276.                load address. Because it may be called anywhere within
  277.                another program, a module should use relative
  278.                addressing and avoid absolute addressing. A module may
  279.                not use DATA or BSS segments.
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.                               -49-                              MAC.68K
  312.                                                                 MAC.68K
  313.  
  314.  
  315.                                NOREF                               NOREF                               NOREF
  316.  
  317.  
  318.   PURPOSE         To disable cross references for specified symbols.
  319.  
  320.  
  321.   FORMAT               NOREF  symbol1,symbol2,...symbolN
  322.  
  323.  
  324.   DESCRIPTION     NOREF turns off cross referencing for the specified
  325.                symbols. Symbols in the NOREF list must be already
  326.                defined.
  327.  
  328.  
  329.   EXAMPLE              NOREF   TAG,TAG1
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.                                OFFSET                               OFFSET                               OFFSET
  338.  
  339.  
  340.   PURPOSE         To change the assembly to an offset segment.
  341.  
  342.  
  343.   FORMAT               OFFSET  expression
  344.  
  345.  
  346.   DESCRIPTION     OFFSET switches the assembly to a null segment. It
  347.                is useful for defining symbols with values relative
  348.                (offset) to the start of a table or buffer. Any type
  349.                of instruction, data, or reservation op code may be
  350.                used. Only the symbols in an offset segment are
  351.                retained, any code, data, or reservation locations do
  352.                not appear in the object file.
  353.  
  354.                    The default starting offset address is zero. If
  355.                expression is used, the value of the expression
  356.                becomes the starting address for this offset segment.
  357.                An offset segment, like any other segment, is
  358.                terminated when the assembly is switched to another
  359.                segment with a BSS, DATA, TEXT, SECTION, or END card.
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373. MAC.68K                                  -50-
  374. MAC.68K
  375.  
  376.  
  377.                                OPSYN                               OPSYN                               OPSYN
  378.  
  379.  
  380.  
  381.   PURPOSE         To equate a new operation code to an existing operation
  382.                code, pseudo operation code, or macro name.
  383.  
  384.  
  385.  
  386.   FORMAT     newname   OPSYN  opname
  387.  
  388.  
  389.  
  390.   DESCRIPTION     OPSYN equates a new operation code, newname , to an
  391.                existing operation name. This new name is independent
  392.                of the existing name and is not affected by any later
  393.                redefinition or PURGE of the existing name.
  394.  
  395.  
  396.  
  397.   EXAMPLE      REPT    OPSYN   DUP
  398.                EJECT   OPSYN   PAGE
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.                               -51-                              MAC.68K 
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.                               -51-