Of course, as fate would have it, I spotted a bug just after I posted.
The SLR R2,R2 has to be inside the loop:

         ICM   R3,8,BYTE
         LHI   R1,8
         LHI   R0,X'F0'
LOOP     SLR   R2,R2
         SLDL  R4,8
         SLDL  R2,1
         OR    R5,R2
         OR    R5,R0
         BCT   R1,LOOP
         STM   R4,R5,RESULT


At 07:05 PM 12/13/2007, I wrote:
  

>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

----------------------------------------------------------------------
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

Reply via email to