OC will not work for arrays greater than 256 bytes -----Mensagem original----- De: IBM Mainframe Assembler List <[email protected]> Em nome de Charles Mills Enviada em: quinta-feira, 20 de maio de 2021 17:33 Para: [email protected] Assunto: Re: Macro to set a bit string
The BitPos table is clever. You could use that with an OC and get rid of the EX. No need to XR any of those registers. LAY and SRL 29 will clear R2 and R3, and high order bits are irrelevant to EX. It also occurred to me that if one could tolerate the storage reference (no alteration) 3 bytes beyond the target byte one could use O (Or register to storage) and avoid EX. Charles -----Original Message----- From: IBM Mainframe Assembler List [mailto:[email protected]] On Behalf Of Mike Hochee Sent: Thursday, May 20, 2021 12:58 PM To: [email protected] Subject: Re: Macro to set a bit string Hi João, The following (and it may have probs, as it was not tested), simply turns on the nth bit within an array. It could be changed to turn off the bit or perform some other bit boolean operation. You shouldn't need to iterate through array bytes or bits, as that would certainly slow things down. I tried to follow Charles' suggestions, but it is very rough and needs checks for out of bounds conditions, array size considerations, etc.. HTH, Mike * XR R2,R2 XR R3,R3 XR R4,R4 * LAY R2,12 <=== Input bit to turn on (rel to 0) SRDL R2,3 /8 to get bytes to bypass SRL R3,29 shift remainder into pos 61-63 IC R4,BitPos(R3) Prime R4 w/OI immediate value LA R5,BitArray(R2) A(target byte) in BitArray EX R4,OrBit Sets selected bit on * OrBit OI 0(R5),x'00' Set selected bit on in BitArray * BitArray DC XL256'00' MaxBits EQU L'BitArray*8 Max bits in array (rel to 0) * BitPos EQU * Ident bit in target byte Bit_0 DC BL1'10000000' Bit_1 DC BL1'01000000' Bit_2 DC BL1'00100000' Bit_3 DC BL1'00010000' Bit_4 DC BL1'00001000' Bit_5 DC BL1'00000100' Bit_6 DC BL1'00000010' Bit_7 DC BL1'00000001' *
