Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

I wish you humans would leave me alone.


devel / comp.os.cpm / MAC SELECT construct

SubjectAuthor
* MAC SELECT constructMr. Emmanuel Roche, France
`* Re: MAC SELECT constructMartin
 +- Re: MAC SELECT constructMartin
 `* Re: MAC SELECT constructMr. Emmanuel Roche, France
  `* Re: MAC SELECT constructMartin
   `* Re: MAC SELECT constructMr. Emmanuel Roche, France
    +- Re: MAC SELECT constructdxforth
    `* Re: MAC SELECT constructMr. Emmanuel Roche, France
     `- Re: MAC SELECT constructMr. Emmanuel Roche, France

1
MAC SELECT construct

<9b70f7ec-973b-49d4-93f7-35db2b36c752n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2871&group=comp.os.cpm#2871

  copy link   Newsgroups: comp.os.cpm
X-Received: by 2002:a05:620a:4622:: with SMTP id br34mr817241qkb.352.1636233272041;
Sat, 06 Nov 2021 14:14:32 -0700 (PDT)
X-Received: by 2002:a05:6808:f12:: with SMTP id m18mr30249066oiw.166.1636233271808;
Sat, 06 Nov 2021 14:14:31 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.cpm
Date: Sat, 6 Nov 2021 14:14:31 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=109.214.132.201; posting-account=wGrAFgoAAAD-mx3Qns29BnQYgMHAHksE
NNTP-Posting-Host: 109.214.132.201
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9b70f7ec-973b-49d4-93f7-35db2b36c752n@googlegroups.com>
Subject: MAC SELECT construct
From: roche...@laposte.net (Mr. Emmanuel Roche, France)
Injection-Date: Sat, 06 Nov 2021 21:14:32 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 119
 by: Mr. Emmanuel Roche, - Sat, 6 Nov 2021 21:14 UTC

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

Re: MAC SELECT construct

<sm8l3e$1ee8$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2873&group=comp.os.cpm#2873

  copy link   Newsgroups: comp.os.cpm
Path: i2pn2.org!i2pn.org!aioe.org!z5/59CWsyA9v+dyZd5Px4A.user.46.165.242.75.POSTED!not-for-mail
From: this.is....@so.its.invalid (Martin)
Newsgroups: comp.os.cpm
Subject: Re: MAC SELECT construct
Date: Sun, 07 Nov 2021 14:41:53 +0100
Organization: Aioe.org NNTP Server
Message-ID: <sm8l3e$1ee8$1@gioia.aioe.org>
References: <9b70f7ec-973b-49d4-93f7-35db2b36c752n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="47560"; posting-host="z5/59CWsyA9v+dyZd5Px4A.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:20.0) Gecko/20100101 SeaMonkey/2.17.1
X-Notice: Filtered by postfilter v. 0.9.2
 by: Martin - Sun, 7 Nov 2021 13:41 UTC

Am 11/06/2021 10:14 PM, Mr. Emmanuel Roche, France schrieb:
> MAC SELECT construct by Mr. Emmanuel ROCHE, France
> --------------------

[...]

> 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,

The correct version of the macro *is* the newer one without the SELNEXT line.

> 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

This line above was *removed* in the fixed version.

> 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.)
>

And if we are at it, here are real *BUGS* !!!

First a test progam "compbug.asm" to show the problem.
It compares the correct "LEQ" with the buggy "GTR" Macro.

===== 8< =====
maclib compbug

bdos equ 0005h
arg1 equ 005dh
arg2 equ 006dh

org 100h

mvi e,'1'
lda arg1
leq ,arg2,xleqa
dcr e
xleqa:

mvi d,'0'
lda arg1
gtr ,arg2,xgtra
inr d
xgtra:

xchg
shld msg1

mvi c,9
lxi d,msg1
call 5

ret

msg1: ds 2
db 0dh,0ah,'$'
===== 8< =====

Compile...

B>mac compbug.aaa
CP/M MACRO ASSEM 2.0
0133
002H USE FACTOR
END OF ASSEMBLY

B>load compbug

FIRST ADDRESS 0100
LAST ADDRESS 0132
BYTES READ 0031
RECORDS WRITTEN 01

Execute with different values...

B>compbug 2 1
00

B>compbug 2 2
10

B>compbug 2 3
11

Doesn't look very right ???

Both "COMPARE.LUB" (Page 107, Figure 41) and
"NCOMPARE.LIB" (Page 112, Figure 43a) are at fault:

Replace the lines
DCR A
JNC TL
with
JNZ TL

1) Macro "GTR" in "COMPARE.LUB"

Fixed version:
===== 8< =====
; GTR MACRO X,Y,TL
;; X GREATER THAN Y TEST
LOCAL FL ;;FALSE LABEL
TEST? X,Y
JC FL
JNZ TL
FL: ENDM
===== 8< =====

2) Macro "GTR" in "NCOMPARE.LUB"

Fixed version:
===== 8< =====
; GTR MACRO X,Y,TL,FL
;; X GREATER THAN Y TEST
IF NUL TL
LEQ X,Y,FL
ELSE
LOCAL GFL ;;FALSE LABEL
TEST? X,Y
JC GFL
JNZ TL
GFL: ENDM
===== 8< =====

3) Macro "LEQ" in "NCOMPARE.LIB" has another BUG:

The line
GEQ X,Y,FL
should be replaced with
GTR X,Y,FL

The fixed version:
===== 8< =====
; LEQ MACRO X,Y,TL,FL
;; X LESS THAN OR EQUAL TO Y TEST
IF NUL TL
GTR X,Y,FL
ELSE
LSS X,Y,TL
JZ TL
ENDM
===== 8< =====

> Yours Sincerely,
> Mr. Emmanuel Roche, France
>

Have fun!
Martin

Re: MAC SELECT construct

<sm8m0n$1qss$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2874&group=comp.os.cpm#2874

  copy link   Newsgroups: comp.os.cpm
Path: i2pn2.org!i2pn.org!aioe.org!z5/59CWsyA9v+dyZd5Px4A.user.46.165.242.75.POSTED!not-for-mail
From: this.is....@so.its.invalid (Martin)
Newsgroups: comp.os.cpm
Subject: Re: MAC SELECT construct
Date: Sun, 07 Nov 2021 14:57:30 +0100
Organization: Aioe.org NNTP Server
Message-ID: <sm8m0n$1qss$1@gioia.aioe.org>
References: <9b70f7ec-973b-49d4-93f7-35db2b36c752n@googlegroups.com> <sm8l3e$1ee8$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="60316"; posting-host="z5/59CWsyA9v+dyZd5Px4A.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:20.0) Gecko/20100101 SeaMonkey/2.17.1
X-Notice: Filtered by postfilter v. 0.9.2
 by: Martin - Sun, 7 Nov 2021 13:57 UTC

Am 11/07/2021 02:41 PM, Martin schrieb:
> And if we are at it, here are real *BUGS* !!!
>
> First a test progam "compbug.asm" to show the problem.
> It compares the correct "LEQ" with the buggy "GTR" Macro.
>
> ===== 8< =====
> maclib compbug
>
> bdos equ 0005h
> arg1 equ 005dh
> arg2 equ 006dh
>
> org 100h
>
> mvi e,'1'
> lda arg1
> leq ,arg2,xleqa
> dcr e
> xleqa:
>
> mvi d,'0'
> lda arg1
> gtr ,arg2,xgtra
> inr d
> xgtra:
>
> xchg
> shld msg1
>
> mvi c,9
> lxi d,msg1
> call 5
>
> ret
>
> msg1: ds 2
> db 0dh,0ah,'$'
> ===== 8< =====
>

Ooops!

While testing, I renamed the buggy "COMPARE.LIB" to "COMPBUG.LIB".
You likely didn't, so please change "maclib compbug" back to "maclib compare".

Martin

Re: MAC SELECT construct

<b255a2d4-e982-40e7-b125-d4e36d0e5aaan@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2877&group=comp.os.cpm#2877

  copy link   Newsgroups: comp.os.cpm
X-Received: by 2002:a05:622a:288:: with SMTP id z8mr36712996qtw.75.1636297766398; Sun, 07 Nov 2021 07:09:26 -0800 (PST)
X-Received: by 2002:aca:f182:: with SMTP id p124mr32807759oih.168.1636297766209; Sun, 07 Nov 2021 07:09:26 -0800 (PST)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!tr1.eu1.usenetexpress.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.cpm
Date: Sun, 7 Nov 2021 07:09:26 -0800 (PST)
In-Reply-To: <sm8l3e$1ee8$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=109.214.181.87; posting-account=wGrAFgoAAAD-mx3Qns29BnQYgMHAHksE
NNTP-Posting-Host: 109.214.181.87
References: <9b70f7ec-973b-49d4-93f7-35db2b36c752n@googlegroups.com> <sm8l3e$1ee8$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b255a2d4-e982-40e7-b125-d4e36d0e5aaan@googlegroups.com>
Subject: Re: MAC SELECT construct
From: roche...@laposte.net (Mr. Emmanuel Roche, France)
Injection-Date: Sun, 07 Nov 2021 15:09:26 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 18
 by: Mr. Emmanuel Roche, - Sun, 7 Nov 2021 15:09 UTC

"Martin" <this.is.usenet@so.its.invalid> wrote:

> The correct version of the macro *is* the newer one without the SELNEXT line.

? The MAC manual was published in 1977, then revised in 1980. In both versions, we find the following remark:

"At the end of the redefined SELECT macro, SELNEXT is invoked automatically to delimit the first case in the SELECT group (otherwise SELECT would have to be followed immediately by SELNEXT in the user program to generate the proper labels)."

So, it seems quite surprising that nobody at DRI would have noticed that the SELNEXT line was... er, redundant?

Also, why would later versions of the WHEN library contain this line, while only one copy found so far (presumed to be the oldest one) contains it?

At least, the MAC manual documents this line.

(Regarding your bugs, tomorrow, I am busy. So, I will investigate them later. Also, it would be more logical to use the SIMPIO library. Macros exist to make more high level assembly language programs, so why not use them?)

Yours Sincerely,
Mr. Emmanuel Roche, France

Re: MAC SELECT construct

<smbsnk$1rsh$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2880&group=comp.os.cpm#2880

  copy link   Newsgroups: comp.os.cpm
Path: i2pn2.org!i2pn.org!aioe.org!1hkK2eRHAAQSF7yownBZXw.user.46.165.242.75.POSTED!not-for-mail
From: this.is....@so.its.invalid (Martin)
Newsgroups: comp.os.cpm
Subject: Re: MAC SELECT construct
Date: Mon, 08 Nov 2021 20:10:29 +0100
Organization: Aioe.org NNTP Server
Message-ID: <smbsnk$1rsh$1@gioia.aioe.org>
References: <9b70f7ec-973b-49d4-93f7-35db2b36c752n@googlegroups.com> <sm8l3e$1ee8$1@gioia.aioe.org> <b255a2d4-e982-40e7-b125-d4e36d0e5aaan@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="61329"; posting-host="1hkK2eRHAAQSF7yownBZXw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:20.0) Gecko/20100101 SeaMonkey/2.17.1
X-Notice: Filtered by postfilter v. 0.9.2
 by: Martin - Mon, 8 Nov 2021 19:10 UTC

Am 11/07/2021 04:09 PM, Mr. Emmanuel Roche, France schrieb:
> "Martin" <this.is.usenet@so.its.invalid> wrote:
>
>> The correct version of the macro *is* the newer one without the SELNEXT line.
>
> ? The MAC manual was published in 1977, then revised in 1980. In both versions, we find the following remark:
>
> "At the end of the redefined SELECT macro, SELNEXT is invoked automatically to delimit the first case in the SELECT group (otherwise SELECT would have to be followed immediately by SELNEXT in the user program to generate the proper labels)."
>
> So, it seems quite surprising that nobody at DRI would have noticed that the SELNEXT line was... er, redundant?
>
> Also, why would later versions of the WHEN library contain this line, while only one copy found so far (presumed to be the oldest one) contains it?
>
> At least, the MAC manual documents this line.
>
> (Regarding your bugs, tomorrow, I am busy. So, I will investigate them later. Also, it would be more logical to use the SIMPIO library. Macros exist to make more high level assembly language programs, so why not use them?)
>
> Yours Sincerely,
> Mr. Emmanuel Roche, France
>

Ahhhh! :-)
Finally, I see it!

The SELNEXT was not added or removed,
it was moved into the redefined SELECT Macro!

The buggy version in the manual from 1977 only works
*THE FIRST TIME*!

The SELNEXT is only invoked in the original SELECT,
the redefined SELECT does not contain the SELNEXT anymore.

[...]
XCHG ;;READY BRANCH ADDRESS IN HL
PCHL ;;GONE TO THE PROPER CASE
ECNT SET 0 ;;ELEMENT COUNTER RESET
ENDM
;; INVOKE REDEFINED SELECT THE FIRST TIME
SELECT VAR
SELNEXT ;;AUTOMATICALLY SELECT CASE 0
ENDM
[...]

In the correct version of SELECT.LIB inside
<http://www.retroarchive.org/cpm/archive/unofficial/download/mac-b.zip>
SELNEXT is invoked *EVERY TIME* the redefined SELECT Macro is used.

This is the correct version, comparing the output of the sample program
at page 130 with both versions of SELECT.LIB shows it clearly.

[...]
XCHG ;;READY BRANCH ADDRESS IN HL
PCHL ;;GONE TO THE PROPER CASE
ECNT SET 0 ;;ELEMENT COUNTER RESET
SELNEXT ;;SELECT CASE 0
ENDM
;; INVOKE REDEFINED SELECT THE FIRST TIME
SELECT VAR
ENDM
[...]

Martin

Re: MAC SELECT construct

<2afb3bbd-70b9-4ec9-9580-96b199a448c1n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2881&group=comp.os.cpm#2881

  copy link   Newsgroups: comp.os.cpm
X-Received: by 2002:a05:620a:d96:: with SMTP id q22mr1784348qkl.219.1636406018735;
Mon, 08 Nov 2021 13:13:38 -0800 (PST)
X-Received: by 2002:a05:6830:348c:: with SMTP id c12mr1611491otu.261.1636406018444;
Mon, 08 Nov 2021 13:13:38 -0800 (PST)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.cpm
Date: Mon, 8 Nov 2021 13:13:38 -0800 (PST)
In-Reply-To: <smbsnk$1rsh$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=86.199.0.6; posting-account=wGrAFgoAAAD-mx3Qns29BnQYgMHAHksE
NNTP-Posting-Host: 86.199.0.6
References: <9b70f7ec-973b-49d4-93f7-35db2b36c752n@googlegroups.com>
<sm8l3e$1ee8$1@gioia.aioe.org> <b255a2d4-e982-40e7-b125-d4e36d0e5aaan@googlegroups.com>
<smbsnk$1rsh$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2afb3bbd-70b9-4ec9-9580-96b199a448c1n@googlegroups.com>
Subject: Re: MAC SELECT construct
From: roche...@laposte.net (Mr. Emmanuel Roche, France)
Injection-Date: Mon, 08 Nov 2021 21:13:38 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3262
 by: Mr. Emmanuel Roche, - Mon, 8 Nov 2021 21:13 UTC

I wrote: "As usual, it started innocently." Hahaha! Indeed! I have been wondering all day long how to prove the good functioning of macros.

Along the way, I found:

1) The ASM file of Figure 44A and the PRN file of Figure 44B should have the following lines indented one way or another, to show the generated code:

GTR x,%'z',NoTran
lda x
ani 0101$1111b ; Clear lower case bit
sta x ; Store back to X

2) The pseudo-code between Figure 49b and Figure 50a should have the following 2 lines:

LDA id
LXI H,SelV0

3) I have had a little bit of difficulty understanding what "Martin" was trying to say. In short, the macro SELECT must contain one SELNEXT line. The problem is that, since 1977, the MAC manual was showing it in the wrong place in the SELECT macro! So, the good code is:

ecnt SET 0 ;; Element counter reset
selnext ;; Select CASE 0
ENDM
;; Invoke redefined SELECT the first time
select var
ENDM

(In English: the SELNEXT in *INSIDE* the firs ENDM, not before the second ENDM.)

As usual, being a programmer, I prefer that the code do the talking.

I think that the following is reasonable proof that this SELECT construct works:

A>fig51

SAMPLE CONTROL STRUCTURES
TYPE SINGLE CHARACTERS FROM
A TO D, I'LL STOP ON D
TYPE A CHARACTER: e
BAD CHARACTER
TYPE A CHARACTER: a
YOU SELECTED CASE A
TYPE A CHARACTER: b
YOU SELECTED CASE B
TYPE A CHARACTER: c
YOU SELECTED CASE C
TYPE A CHARACTER: d
YOU SELECTED CASE D
SO I'M GOING BACK!
A>

4) As you may have seen, macros are funny. So, I have more questions.

- Anybody knows how to change WRITE so that it does not convert all the strings to upper case?

- Anybody has a working FOR-NEXT construct?

- Anybody has an IF-THEN-ELSE construct? (Since these are "keywords" of MAC, one way would be to use the French words SI-ALORS-SINON. The closing ENDIF would then be ENDSI.)

Yours Sincerely,
Mr. Emmanuel Roche, France

Re: MAC SELECT construct

<smcs5p$1a81$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2883&group=comp.os.cpm#2883

  copy link   Newsgroups: comp.os.cpm
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.os.cpm
Subject: Re: MAC SELECT construct
Date: Tue, 9 Nov 2021 15:07:22 +1100
Organization: Aioe.org NNTP Server
Message-ID: <smcs5p$1a81$1@gioia.aioe.org>
References: <9b70f7ec-973b-49d4-93f7-35db2b36c752n@googlegroups.com>
<sm8l3e$1ee8$1@gioia.aioe.org>
<b255a2d4-e982-40e7-b125-d4e36d0e5aaan@googlegroups.com>
<smbsnk$1rsh$1@gioia.aioe.org>
<2afb3bbd-70b9-4ec9-9580-96b199a448c1n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="43265"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.3.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Tue, 9 Nov 2021 04:07 UTC

On 9/11/2021 08:13, Mr. Emmanuel Roche, France wrote:
> ...
> 4) As you may have seen, macros are funny. So, I have more questions.
>
> - Anybody knows how to change WRITE so that it does not convert all the strings to upper case?
>
> - Anybody has a working FOR-NEXT construct?
>
> - Anybody has an IF-THEN-ELSE construct? (Since these are "keywords" of MAC, one way would be to use the French words SI-ALORS-SINON. The closing ENDIF would then be ENDSI.)

Perhaps it's just me but simulating HLL control structures in asm
adds a level of abstraction I can do without. This after seeing
Forth do exactly that and me struggling to remember what conditional
jump it was actually compiling. OTOH SEQIO.LIB is worth learning
because it's a mini-application and not just a clever alternate way
of doing something. YMMV

Re: MAC SELECT construct

<037cf21c-6ac4-4394-bc1e-c292066c985cn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2886&group=comp.os.cpm#2886

  copy link   Newsgroups: comp.os.cpm
X-Received: by 2002:ad4:57d2:: with SMTP id y18mr2349065qvx.48.1636582519291;
Wed, 10 Nov 2021 14:15:19 -0800 (PST)
X-Received: by 2002:a05:6830:1be4:: with SMTP id k4mr2079265otb.101.1636582519062;
Wed, 10 Nov 2021 14:15:19 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.cpm
Date: Wed, 10 Nov 2021 14:15:18 -0800 (PST)
In-Reply-To: <2afb3bbd-70b9-4ec9-9580-96b199a448c1n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=109.214.201.238; posting-account=wGrAFgoAAAD-mx3Qns29BnQYgMHAHksE
NNTP-Posting-Host: 109.214.201.238
References: <9b70f7ec-973b-49d4-93f7-35db2b36c752n@googlegroups.com>
<sm8l3e$1ee8$1@gioia.aioe.org> <b255a2d4-e982-40e7-b125-d4e36d0e5aaan@googlegroups.com>
<smbsnk$1rsh$1@gioia.aioe.org> <2afb3bbd-70b9-4ec9-9580-96b199a448c1n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <037cf21c-6ac4-4394-bc1e-c292066c985cn@googlegroups.com>
Subject: Re: MAC SELECT construct
From: roche...@laposte.net (Mr. Emmanuel Roche, France)
Injection-Date: Wed, 10 Nov 2021 22:15:19 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 24
 by: Mr. Emmanuel Roche, - Wed, 10 Nov 2021 22:15 UTC

"As usual, it started innocently." This must be the understatement of the week.

An "Old Timer" of the comp.os.cpm Newsgroup, who has not published anything for years, sent me his collection of macros. Unfortunately, they mostly come from the MAC manual.

However, when browsing them, I had a shock. The statements of the IF-ELSE-ENDM constructs were *INDENTED*! I could not believe my eyes! When I program in high-level languages, I do this automatically, and when I retyped the libraries, I just rewrote them in lower case, and did not, for some reason, indent them!

Since the NCOMPARE library contains at least 6 macros with IF-ELSE-ENDM constructs, indenting them change dramatically the appearance of the library! Ole, you are a genius!

It is incredible what a well-placed TAB can do.

Finally, you may have remarked that the comments, at the beginning of Figure 51, says that the program will stop on the "Z" character, while it uses "D"...

Yours Sincerely,
Mr. Emmanuel Roche, France

Re: MAC SELECT construct

<a38fd55e-9870-459e-8697-5a45f34a43edn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=2889&group=comp.os.cpm#2889

  copy link   Newsgroups: comp.os.cpm
X-Received: by 2002:a37:654f:: with SMTP id z76mr7570052qkb.224.1636653589221;
Thu, 11 Nov 2021 09:59:49 -0800 (PST)
X-Received: by 2002:aca:dfd7:: with SMTP id w206mr7658923oig.73.1636653588979;
Thu, 11 Nov 2021 09:59:48 -0800 (PST)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!newsreader4.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.cpm
Date: Thu, 11 Nov 2021 09:59:48 -0800 (PST)
In-Reply-To: <037cf21c-6ac4-4394-bc1e-c292066c985cn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=86.199.50.13; posting-account=wGrAFgoAAAD-mx3Qns29BnQYgMHAHksE
NNTP-Posting-Host: 86.199.50.13
References: <9b70f7ec-973b-49d4-93f7-35db2b36c752n@googlegroups.com>
<sm8l3e$1ee8$1@gioia.aioe.org> <b255a2d4-e982-40e7-b125-d4e36d0e5aaan@googlegroups.com>
<smbsnk$1rsh$1@gioia.aioe.org> <2afb3bbd-70b9-4ec9-9580-96b199a448c1n@googlegroups.com>
<037cf21c-6ac4-4394-bc1e-c292066c985cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a38fd55e-9870-459e-8697-5a45f34a43edn@googlegroups.com>
Subject: Re: MAC SELECT construct
From: roche...@laposte.net (Mr. Emmanuel Roche, France)
Injection-Date: Thu, 11 Nov 2021 17:59:49 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2944
 by: Mr. Emmanuel Roche, - Thu, 11 Nov 2021 17:59 UTC

I think that I have answered the question:

> Anybody knows how to change WRITE so that it does not convert all the strings to upper case?

if I judge by what the programs say:

A>fig42

Type a character from A to D: e
Not an A, B, C, or D
Type a character from A to D: a
You typed an A
Type a character from A to D: b
You typed a B
Type a character from A to D: c
You typed a C
Type a character from A to D: d
You typed a D
Bye
A>fig44

Type a character from A to D: e
Not an A, B, C, or D
Type a character from A to D: a
You typed an A
Type a character from A to D: b
You typed a B
Type a character from A to D: c
You typed a C
Type a character from A to D: d
You typed a D
Bye
A>fig46

Type a character from A to D: e
Not an A, B, C, or D
Type a character from A to D: a
You typed an A
Type a character from A to D: b
You typed a B
Type a character from A to D: c
You typed a C
Type a character from A to D: d
You typed a D
Bye
A>fig48

Type the stop character: e
Type a character: a
You typed an A
Type a character: b
Not an A
Type a character: c
Not an A
Type a character: d
Not an A
Type a character: e
Not an A
Stop character
Bye
(...)
A>fig51

Sample control structures
Type single characters from
A to D, I will stop on D.
Type a character: e
Bad character
Type a character: a
You selected case A
Type a character: b
You selected case B
Type a character: c
You selected case C
Type a character: d
You selected case D
So I am going back.
A>That's All, Folks!

Yours Sincerely,
Mr. Emmanuel Roche, France

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor