On Mon, 26 Feb 2024 at 09:48, David Eisenberg <[email protected]> wrote: [...]
> The reason I'm generating the CLC in a macro is because the macro is doing > much more than this. There are various macro keyword parameters that I > haven't bothered showing here, and lots of analysis going on with the > comparands before I generate the CLC. I genuinely believe that showing all > those things here would only serve to complicate my question. > If you are already analyzing the operands in detail, surely adding enough code to figure out how to put a length in the right place shouldn't be too hard. Then you can generate exactly the instruction you want that lists the way you want. I've worked with a structured macro set developed by me former employer over many years (long predating IBM's HLASM set), and over those years I've wavered over how "smart" such macros should be. It's really nice to be able to write something like DoIf op1,EQ,op2 and have it generate an appropriate compare instruction no matter if op1 and/or op2 are registers (32 or 64 bit), labels on DS/DC, literals, or symbols using qualified USINGs (e.g. OLD.FIELD3). But it's virtually impossible to make this work for everything, and the macro code gets ever trickier. It also starts to rely on coding conventions - for instance that the assembler type and even the program type attributes be set for not just register names but storage definitions (how else does the macro know that R5 means 32-bit register 5 and G5 means 64-bit register 5? The IBM macros, in contrast, do none of this - the programmer supplies the compare instruction and the macros just manage the flow control. Thus they are almost completely general, but less powerful. And they can't automatically improve the generated code when a new instruction comes along. OTOH inventing a macro set that turns assembler into a high(er) level language is a fools game; just use C or PL/X or whatever. Unless... you are updating existing code where the more powerful macros can be very nice. Well I digress, but once you are into parsing operands using the macro language, you might as well do the whole job. Tony H.
