Okay, this is absolutely my last cut at this. (I've got other things to do ;-) .) The thing that bothered me in the last iteration was the STC inside the loop -- too many storage references. Here's a solution that is very similar to Bob Rutledge's that I like much better because it performs a total of only two storage references (the ICM and the final STM):
LHI R0,X'F0' LHI R1,8 SLR R2,R2 ICM R3,8,BYTE LOOP SLDL R4,8 SLDL R2,1 OR R5,R2 OR R5,R0 BCT R1,LOOP STM R4,R5,RESULT * BYTE DC B'01110101' Sample input DS 0D RESULT DS CL8 Output 34 Instructions 0 Literals 1 Input Area 8 Output Area 43 Total Bytes 10 Total Instructions At 09:21 PM 12/12/2007, I wrote: >I didn't originally think of doing the AND and OR inside the loop, >but based on the reduction in storage references, I think this >might be even faster, albeit more instructions: > > LHI R1,8 > LHI R4,X'F0' > IC R2,BYTE >LOOP LHI R3,X'01' > NR R3,R2 > OR R3,R4 > STC R3,RESULT-1(R1) > SRL R2,1 > BCT R1,LOOP >* >BYTE DC B'01110101' Sample input >RESULT DS CL8 Output > > 32 Instructions > 0 Literals > 1 Input Area > 8 Output Area > > 41 Total Bytes > 9 Total Instructions ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html