You can avoid the extra register with a table of 8 OI instructions.
-- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 ________________________________________ From: IBM Mainframe Assembler List <[email protected]> on behalf of Charles Mills <[email protected]> Sent: Thursday, May 20, 2021 12:28 PM To: [email protected] Subject: Re: Macro to set a bit string Thinking about this a little, it is non-trivial. There is AFAIK -- someone will correct me if I am wrong -- no single-byte-or-register-to-storage nor an or-under-mask instruction analogous to STC or ICM, so you need to use an executed OI. Then you need three registers. I will use Rx, Ry and Rz in the example below. Rx and Ry must be an even-odd register pair. Assume the bit number in base 0 starts out in Rx. Shift Rx right double 3 bits. That gives you the byte offset in Rx and the bit offset in the high 3 bits of Ry. Then shift Ry right 29 bits so the count is in the low bits. Load X'80' into Rz. Shift it right by the count in Ry (possibly zero). Add the target array address to Rx with LA. EX Rz an OI 0(Rx),0 instruction. Logic is the same for setting a bit off. Substitute X'7F' for X'80' and NI for OI. You need to consider whether the macro is to be AMODE 31 or 64. Charles -----Original Message----- From: IBM Mainframe Assembler List [mailto:[email protected]] On Behalf Of Charles Mills Sent: Thursday, May 20, 2021 8:35 AM To: [email protected] Subject: Re: Macro to set a bit string I have thought about writing such a thing -- actually a bit test, but the logic is similar -- but I did not do it, and the immediate need for me has now passed. Not real tricky. Someone on this list who writes assembler more on a day-to-day basis than I do should be able to whip out a prototype in no time. Charles -----Original Message----- From: IBM Mainframe Assembler List [mailto:[email protected]] On Behalf Of João Reginato Sent: Thursday, May 20, 2021 8:15 AM To: [email protected] Subject: Macro to set a bit string Importance: Low Hi everyone Does somebody have a macro to set a bit string on/off? I made one but I think it could be better due to performance reasons. Note: the bit index should be passed thru a register, not a value. I mean something like below using the TBIT macro to set on the bit 12 of ARRAY: LA R1,12 TBIT ON,ARRAY,(R1)
