April 1, 1981 CP Conventions CP Coding Conventions
The following are coding conventions used by CP modules. This
information should prove helpful if you debug, modify, or update CP.
1. FORMAT: 1 10 16
contents
Labels Op Code
Operands
31, 36, 41, etc. Comments (see Item 2)
2. COMMENT: Approximately 75 percent of the source code contains comments.
sections of code performing distinct functions are separated from
each other by a comment section. 3.. CONSTANTS: Constants follow the executable code and precede the copy files
and/or macros that contain DSECTs or system equates. Constants are
defined in a section followed by a section containing initialized
working storage, followed by working storage. Each of these
sections is identified by a comment. Wherever possible for a
module that is greater than a page, constants and working storage
are within the same page in Which they are referenced. 4. No proqram modifies its own instructions during execution.
5. No program uses its own unlabeled instructions as data.
6. REGISTER USAGE: For CP, in general ]ggi§ier 6
7
8 10 11
12
13 14 15 RCHBLOK, VCHBLOK RCUBLOK, VCUBLOK RDEVBLOK, VDEVBLOK IOBLOK VMBLOK Base register for modules
called via SVC SAVEAREA for modules
called via SVC Peturn linkage for modules
called via BALR
Base address for modules
called via BALR
For Virtual-to-Real address translation ]ggj&ig!: 1
2 Virtual address
Feal address . Part 2. Control Program (CP) 211
Page of GC20-1807-7 As Updated April 1, 1981 by TNL GN25-0829
7. When describing an area of storage in mainline code, a copy file,
or a macro, DSECT is issued containing DS instructions.
8. Meaningful names are used instead of self-defining terms: for
example, 5,X'02',C'I' to represent a quantity (absolute address,
displacement, length, register, etc.). All labels, displacements,
and values are symbolic. All bits should be symbolic and defined
by an equate (EOU) listing. For example: VMSTATUS EOU X'02' To set a bit, use: 01 BYTE, BIT
where BYTE = name of field, BIT is an EOU symbol.
To reset a bit, use:
NI BYTE,255-BIT To set multiple bits, use: 01 BYTE,BIT1+BIT2 etc.
All registers are referred to as: RO, R1, ••• , R15.
All lengths of fields or control blocks are symbolic, that is,
length of VMBLOK is: VMBLOKSZ EQU *-VMBLOK 9. Avoid absolute relative addressing in branches and data references,
(that is, location counter value (*) or symbolic label plus or
minus a self-defining term used to form a displacement). 10. When usinq a sinqle operation to reference multiple values, specify
each value referenced, for example: LM R2,R4,CONT SET R2=CON1 SET R3=CON2 SET R4=CON3 CON1 CON2 CON3 DC F'1'
DC F'2'
DC F
I
3
1
11. Do not use PRINT NOGEN or PRINT OFF in source code.
212 IBM VM/370 System programmer's Guide
Previous Page Next Page