John Ehrman had an MVC2 macro using this concept. Uses the length of OP2

On February 26, 2024 3:44:17 PM GMT+02:00, Seymour J Metz <sme...@gmu.edu> 
wrote:
>Why? What are you trying to solve by wrappng the MVC in a macro?
>
>         MVC   0(2),0
>         ORG   *-4
>         DC    S(&OP1)
>         DC    S(&OP2)
>
>but, again, why?
>
>--
>Shmuel (Seymour J.) Metz
>http://mason.gmu.edu/~smetz3
>עַם יִשְׂרָאֵל חַי
>נֵ֣צַח יִשְׂרָאֵ֔ל לֹ֥א יְשַׁקֵּ֖ר
>
>________________________________________
>From: IBM Mainframe Assembler List <ASSEMBLER-LIST@LISTSERV.UGA.EDU> on behalf 
>of David Eisenberg <deisenbe...@optonline.net>
>Sent: Monday, February 26, 2024 8:22 AM
>To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
>Subject: Macro parameters: parsing a relocatable address
>
>I’m seeking some guidance if anyone is able to help. I’d like to write a macro 
>like this:
>
>&NAME    MYCLC &FIELD1,&FIELD2
>
>in which both &FIELD1 and &FIELD2 are relocatable addresses. It’s &FIELD1 that 
>is of particular interest to me. &FIELD1 might be expressed as a hard-coded 
>displacement and base register, or a relocatable symbol… or it could be an 
>absolute symbol equivalent to a displacement, followed by a base register… 
>etc. I.e., it could be any valid relocatable address syntax. What &FIELD1 will 
>*not* have is an *explicit length.* The macro parameters will specify valid 
>relocatable addresses, and nothing more.
>
>My question: I’d like the MYCLC macro to generate a CLC instruction in which 
>the two parameters are compared to each other for a constant length of 2. So 
>far, the only ways I can think of to do this are:
>
>1. Parse &FIELD1 to figure out how the relocatable address is expressed, and 
>insert an explicit length of 2 to generate a valid CLC first operand. I would 
>do it that way, but (unless I'm missing something) it seems quite complex to 
>code.
>2. Generate this DC statement: DC X’D501’,S(&FIELD1,&FIELD2) . This seems to 
>work, but it’s a bit unattractive in a PRINT GEN (and it looks a bit odd in 
>the assembly listing, because the assembler doesn't treat it like a machine 
>instruction in the object code on the left side of the listing).
>
>I’m wondering if anyone can suggest a reasonable way to code option 1 above. 
>Can the macro assembler give me any help in parsing &FIELD1 so that I can 
>transform that parameter to insert an explicit length, regardless of how 
>&FIELD1 is expressed? Or is there some other approach that I haven’t 
>considered at all? Or should I just go with option 2 above?
>
>Please note that I don’t want the macro to generate more than one machine 
>instruction. One way or another, I just want the macro to generate a CLC for a 
>length of 2. (And I really do want the CLC located in the macro as opposed to 
>open code, because the macro does some analysis on the comparands prior to 
>generating the CLC.)
>
>Any advice would be appreciated... thank you!
>
>David

Reply via email to