< 360 Assembly

A comment in 360 Assembly is a portion of text that is not processed by the assembler and is used by the programmer to add a description to the code. There are three forms of comments, line comments, code comments and macro comments.

Line Comments

If a line begins with one (or more) asterisks ("*), the rest of the line is treated as a comment

Examples: 

* This is a comment line because it begins with an asterisk
**** This is a comment line also
************************************************
*     This is a comment 'box'                  *
************************************************

Caution: The assembler uses a line beginning with *PROCESS to optionally set certain options if a *PROCESS line appears as the first line in the source file.

Code Comments

After a valid 360 instruction, after a single blank, everything else on the line is treated as a comment. For the purpose of this example it is assumed that R14 is equated to 14, R15 is equated to 15 etc., to provide cross reference - see EQU Assembler pseudo-instruction)

* some typical assembler instructions showing comments to the right
        L     R15,=A(MOVE)                    Load sub-routine address into R15                   
        BALR  R14,R15                         Go to the sub-routine ===>
*                                             ....return here with return code in R15
*
*****************************************
*  Move the input to output             *
*****************************************
MOVE    EQU   *                               Start of a sub-routine called "Move"
        USING *,R15                           Tell the assembler reg. 15 points to
*                                             this address 
        MVC   OUTPUT,INPUT                    Move the input to the output area 
        SR    R15,R15                         Clear register contents (set Return code = 0)
        BR    R14                             return to caller
        DROP  R15                             Tell assembler we are no longer using
*                                             register 15 and resume using previous register
*
TABLE   DC    C'ABCDEFGHIJKLMNOPQRSTUVWXYZ'   Table of letters of the alphabet
INPUT   DS    Cl80                            Input area
OUTPUT  DS    Cl80                            Output area

A comment - line or code - is not printed when it appears in a macro if PRINT NOGEN has been used. It is also not printed if it appears after a PRINT OFF statement has been issued.

Note: If a code comment is to be specified on a macro instruction where no arguments are to be passed to the macro, it is recommended that a space, a comma, and another space precede the comment to prevent the first word from being interpreted as an argument to the macro.

Macro Comments

Macro comments are used for commenting macros (but can be used outside of macros in mainline program code), and are not listed on the program listing. They are the same as code comments, only they begin with ".*" instead of "*".

.* This comment will never be listed
* This comment will be listed if not following PRINT OFF or PRINT NOGEN (if in a macro)
 
360 Assembler Pseudo Instructions
Address Related ADATA CNOP DROP EQU LOCTR LTORG ORG USING
Code Related ALIAS AMODE CATTR COM CSECT CXD DSECT DXD END ENTRY EXTRN OPSYN RMODE RSECT START WXTRN XATTR
Data Related CCW CCW0 CCW1 DC DS
Conditional Assembly and Macro related ACTR AGO AIF AINSERT ANOP AREAD COPY GBLA / GBLB / GBLC LCLA / LCLB / LCLC MACRO MEND MEXIT MNOTE SETA / SETB / SETC
Listing, output and source related Comments *PROCESS ACONTROL EJECT END EXITCTL ICTL ISEQ POP PRINT PUNCH PUSH REPRO SPACE TITLE
 
360 Assembly Language
360 Family Introduction · Basic FAQ · 360 Family · 360 Architecture
360 Instruction Set 360 Instructions · Branch Instructions · Data Transfer Instructions · Control Flow Instructions · Arithmetic Instructions · Logic Instructions · Shift and Rotate Instructions · Other Instructions
Syntaxes and Assemblers 360 Assemblers· Pseudo Instructions
Instruction Extensions Floating Point · High-Level Languages
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.