I have a program in MACRO-11 and I have retained just
the essential aspects related to my question. That portion
of the program is at the bottom.
I have unsuccessfully attempted to isolate the first 5 characters
of STRING in the MACRO ABC, but I have been unsuccessful.
Concatenation is possible along with checking individual characters
of the argument, but there does not seem to be support for
changing the last character from "T" to "2" as in my example.
If that were possible, I could always use "ABC WRKTXT"
and check to determine if "WRKTX2" was a defined STRING
name at which point the MACRO ABC would automatically use:
: Mov #WRKTX2,-(SP)
without the necessity of providing the explicit STRING name
of WRKTX2 to be used WITHIN the conditional A$. It
is essential that the address of the STRING be placed on the
stack when the text is in the .PSect TX2. Sometimes, the
text must remain in .PSect TXT, so that is why ABC has
the additional code to detect the last character of STRING.
As I have shown, it is possible to determine if the 6th character
of the STRING name is a :"2", but I don't seem to be able to
strip off the 6th character of the name from STRING and
replace it with a "2". At that point, it would be possible, still
within the MACRO ABC, to test to see if the STRING name
for which the 6th character has been replaced by a "2" exists
and use the second form of ABC.
Thank you in advance for any suggestions?
Jerome Fine
=============================
.IIf NDF A$,A$ = 0
.IIf NDF A$,A$ = 1
.MACRO ABC STRING
..STRI = 0
...STR = 0
.IRPC ..STR.,<STRING>
...STR = ...STR+1
.If EQ ...STR-6
.If IDN ..STR.,<2>
..STRI = 1
.EndC;IDN ..STR.,<2>
.EndC;EQ ...STR-6
.EndR;.IRPC
.If EQ ..STRI
Mov #STRING,R0
.IfF;EQ ..STRI
Mov #STRING,-(SP)
.EndC;EQ ..STRI
.ENDM ABC
.If EQ A$
.PSect TXT RW,D
WRKTXT: .Ascii /Work/
.IfF;EQ A$
.PSect TX2 RW,D
WRKTX2: .Ascii /Work/
.EndC;EQ A$
.PSect Code RW,I
.If EQ A$
ABC WRKTXT
.IfF;EQ A$
ABC WRKTX2
.EndC;EQ A$
.End