MAC SELECT construct by Mr. Emmanuel ROCHE, France
--------------------
Ok. As usual, it started innocently. While searching for something else, I saw a mention of Henry Ledgard, the author of the classic "Programming Proverbs". This man wrote only a handful of books, but I find them much more interesting than others (and
well written). There is also the famous "The emperor with no clothes" article, published in the "Commun. ACM" in 2001. "Nothing new under the Sun", alas!
I made a search. Curiously, Wikipedia has no page on him. I found a Web page listing some of his books... in Germany!
https://dblp.org/pid/26/6957.html
It is there that I found mention of "A Genealogy of Control Structures", an article that I had not read. 36 pages later, my interest in "Control Structures" was revived. Now, it happens that, 6 weeks ago, there was a thread, in the comp.os.cpm Newsgroup,
about SEQIO.LIB, a library of macros that was published in the "CP/M MAC Macro Assembler" manual, starting in 1977. And I remembered that this manual happens to contain on "Program Control Structures" Section...
As usual, I have no idea where my stuff is, so I searched on the Internet if someone had uploaded the MAC manual. I found the 1980 version, that I downloaded, then printed the pages of the Section.
As Bohn & Jacopini demonstrated in 1966(!), everything that can be programmed can be reduced to only 3 "control structures":
1) sequence of instructions (LET... LET...)
2) controled iteration (FOR-NEXT)
3) case selection (IF-THEN-ELSE)
https://en.wikipedia.org/wiki/Structured_program_theorem
Depending on their domains, some Programming Languages have more specialized control structures but, to be "universal", a PL must have, one way or another, at least those 3 control constructs.
So, the MAC manual contains:
1) WHEN-ENDW (conditional grouping)
2) controlled iteration (DO-ENDDO)
3) case selection (SELECT-ENDSEL)
(a sequence of ASM instructions should be obvious)
allowing one to produce Intel 8080 assembly languages with those high-level control constructs. Very educational. Nothing like that can be found in MicroShit manuals. You can feel that Gary Kildall was a Teacher of Computer Science.
Ok. Now, how to recreate those macros? At my age, with my sight, it would be a pain in the Accumulator to retype the source codes. I searched inside my computer, and found one directory named "MAC Macros". One less work to do. I found them unreadable
since they are written in upper case only. (When Gary Kildall created Digital Research, he complained that he had heard the ASR-33 Teletype during 2 years at the Naval Postgraduate School of Monterey, California! Since CP/M first booted in April 1974 and
he created DRI in 1976, he was right.) So, I edited the files to be more readable. Now, time for a test.
I assembled the first example program. No problem, except that the messages displayed on the screen were in upper case, when the source file was in lower case. But this gives an "Old Style" to the programs.
I continued. No problem, until I arrived to SELECT, the last construct.
After 30+ years of assembly programming, I could not escape the fact the hex columns of the PRN files were 3 bytes away from the published PRN files! All the other ASM files had produced the same PRN files as the MAC manual, but not this one!?!
I wondered: "Maybe they changed something in this 1980 revision?" So, I searched for the 1977 version, and found it on BitSavers. However, impossible to find a difference!
So, I made another search among the files of my Internet computer, and found a ZIP file containing the MAC macros. When I used it (I mean: SELECT.LIB), it produced the PRN files of the manual! Haaaaa!... (the programmer's national anthem). All I had to
do, now, was to find the difference. Which is: one line was missing in this version, which has been present since 1977 in the MAC manual. So, apparently, this file was a copy of the MAC macros made circa 1976, when Digital Research was launched, and
religiously preserved ever since then.
I think that I am a little bit knowledgeable about CP/M and its utilities, but I have never heard of this bug. So, in case someone else understands what I write, here are the "bugs" that I found in the MAC manual:
MAC Section 9.3 errata
----------------------
Page 117, second paragraph from the bottom of the page:
"Upon encountering [THE] an ENDW statement in the source program, ..."
Page 123, third paragraph from the bottom of the page:
(...) the CR-LF on each i[N]teration, ..."
Page 128, bottom of SELECT macro:
select var
selnext ;; Automatically select case 0
ENDM
Page 134, bottom of Figure 51:
WRITE <so I^'^'m going back^!>
Of course, if you use SELECT with the SELNEXT line, the 3 listings of Figure 50 will no longer correspond with the ones of the MAC manual. Apparently, I am the first person to notice this in the last 44 years. This must be progress? (Re-read the "Emperor"
article.)
Yours Sincerely,
Mr. Emmanuel Roche, France
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)