Browse Prior Art Database

# Algorithm for Boundary Alignment

IP.com Disclosure Number: IPCOM000076503D
Original Publication Date: 1972-Mar-01
Included in the Prior Art Database: 2005-Feb-24
Document File: 2 page(s) / 13K

IBM

## Related People

Duffie, CAP: AUTHOR [+2]

## Abstract

The described algorithm provides a method of boundary alignment, by which an assembler program calculates the number of bytes of padding required to align an instruction or a constant on a specified boundary.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 53% of the total text.

Page 1 of 2

Algorithm for Boundary Alignment

The described algorithm provides a method of boundary alignment, by which an assembler program calculates the number of bytes of padding required to align an instruction or a constant on a specified boundary.

When a programmer wishes to align an instruction or constant on a word boundary other than one of those provided by either a CNOP instruction or a DS instruction with a zero duplication factor, it is necessary to know the value of the location counter and the precise length of the padding required to force the desired alignment. This procedure results in frequent programmer errors. In the algorithm outlined below, the assembler program controls calculation of the length of the padding, thereby relieving the programmer of this responsibility and eliminating one potential source of error. PADLEN EQU BDY*(1+(*-CSNAM-1)/BDY)-(*-CSNAM) DS (PADLEN)X.

Where: BDY is an absolute expression equal to the boundary on which alignment is to occur (e.g., 256) and CSNAM is the label appearing on the control section's CSECT statement. (Note that this technique is not valid if the assembly begins with a START card whose operand is other than zero (0).

The expression BDY*(1+---) is the length of the sum of the next whole number of BDY increments in the assembly above the location counter address less one, (*-1), and the expression (*-CSNAM) is the length of the control section up to the location counter address (*).

Thus, it is easily seen that the difference of these two terms yields the desired length of padding.

In order to force alignment i...