I got the text of this "article", but in such an unusual way, that I want to
thank publicly Don T* for what he did. Read his report:
"My public library has a very old microfiche copies of SP&E.
Unfortunately, the viewer/printer for these is equally old,
and the quality of the result was barely readable. When I
then put this on the scanner to send you an image, it was
completely unreadable. Since it was only a page, I squinted
my eyes, and read it well enough to type it in for you."
Too bad there is no more "Don T*" on the comp.os.cpm Newsgroup... I can
appreciate what he did, since I am old and very near-sighted. Now for the
- "SIMULATING HIGH-LEVEL CONTROL STRUCTURES IN ASSEMBLY LANGUAGE"
"Short Communication" in "Software -- Practice and Experience",
Vol.10, pp.949-950 (1980)
(Edited by Emmanuel ROCHE.)
In a recent paper (Ref.1), Welch has described a set of macros
which can be used in an assembly language (MACRO-11) to give it
the appearance of possessing high-level control structures.
These macros encourage structured programming within assembly
language, and thus simplify programming and improve readability.
The purpose of this note is to point out that this same concept
can be extended to include iterative, conditional and case
statements and procedures, and to allow complex as well as
The following are typical program fragments expressed in the
MACRO-11 assembly language, with the help of the macro package
STRUCT, which has been in use at Queen's University since 1977.
Each of the lines shown is a macro call, and each fragment
carries out the obvious action. The structures may be nested
within one another as desired.
(1) procedure fred global
fred r1, #5, x, y
(2) while p .ne. q
(3) if x .ge. #1
and x .le. #100
until r4 .le. #7
or 4(r3) .eq. 2(r5)
or 4(r3) .eq. z
(5) case n of
Example (1) shows a procedure declaration and a call. During
execution of the procedure the parameters will be found on the
machine stack. A variant uses the general registers of the PDP-
11 subroutine entry, and in-line parameters.
Example (2) includes a simple condition. Variants allow for the
comparison of bytes as well as words, and for the testing of
single operands and condition codes. All of the relations
provided by the PDP-11 conditional branches are available.
Examples (3) and (4) show multiple conditions (the term 'Boolean
expression' is avoided because the system is not general,
conditions of 'AND' and 'OR' are not allowed). The 'AND' macro
also serves as a loop exit: 'exit if condition false'.
Examples (5) and (6) illustrate the two types of case statement
with single and double parameter. The former is implemented by a
jump table, the latter by a sequence of jump tables.
The generated code is no longer than that produced by 'hand'
coding. The occational branch might be eliminated (for example,
in the sequence endif endwhile) but only at the expense of
creating poorly structured code.
A similar package can be implemented within any assembly
language having certain minimal macro facilities, principally
the ability to construct labels of the form fxd123 in which the
integer part is the value of an assembly variable, and the
availability during assembly time of a stack. The later is
simulated in MACRO-11 by assembly variables of the form just
A full description is available from the author (Ref.2).
- "Structured programming in macro assembly languages"
"Software -- Practice andExperience, Vol.8, No.3, pp.371-376 (1978)
- "STRUCT79: A Macro Package to Simulate High-Level Control
Structures in MACRO-11"
Technical Report 1979 #88
Department of Computing and Information Science