Assembler super techie question 
Author Message
 Assembler super techie question

Quote:



> >Hi --

> >         LA    0,1
> >         L     1,=A(12345)
> >         BXLE  0,0,*
> >         DC    H'0'

> >1)  Will the BXLE instruction ever break out of the loop?
> Yes, if the word at 12345 < x'10000000' but not otherwise.

> >2)  What will be the contents of registers 0 and 1 if the BXLE
> >    breaks out of the loop and the program ABENDs?
> Whatever ABEND routine you have on the system will trash them in the course of producing a dump. At the actual time of the exit from the loop, r1 still has whatever was loaded from 12345 and r0=the smallest power of 2 that is greater than both f'1' and the contents of r1

> >Assume addressability and LTORGs are OK.  In otherwords, the L
> >instruction will actually load the value into register 1, and the BXLE will
> >actually loop to itself, as the code appears to imply.

> I wrote just such a loop in '74 (except that I wasn't using r0 & r1) as part of the prolog to a binary search routine. I still think of it as the best example of an Assembler language "pun". Unfortunately, I haven't found too many people with whom to share the humor.

> --
> -----------------------------------------------------------

> -----------------------------------------------------------

  L  1,=A(12345) is going to put 12345 into R1, not the contents of
address 12345.  I suspect the loop will always break.

Bob.



Sun, 06 Feb 2000 03:00:00 GMT  
 Assembler super techie question

Hi --

         LA    0,1
         L     1,=A(12345)
         BXLE  0,0,*
         DC    H'0'

1)  Will the BXLE instruction ever break out of the loop?
2)  What will be the contents of registers 0 and 1 if the BXLE
    breaks out of the loop and the program ABENDs?

Assume addressability and LTORGs are OK.  In otherwords, the L
instruction will actually load the value into register 1, and the
BXLE will actually loop to itself, as the code appears to imply.

-- Steve Myers

The E-mail addresses in this message are private property.  Any use of them
to  send  unsolicited  E-mail  messages  of  a  commerical  nature  will be
considered trespassing,  and the originator of the message will be  sued in
small claims court in Camden County,  New Jersey,  for the  maximum penalty
allowed by law.



Sun, 06 Feb 2000 03:00:00 GMT  
 Assembler super techie question



Quote:
>Hi --
>         LA    0,1
>         L     1,=A(12345)
>         BXLE  0,0,*
>         DC    H'0'
>1)  Will the BXLE instruction ever break out of the loop?

Yes, if the word at 12345 < x'10000000' but not otherwise.

Quote:
>2)  What will be the contents of registers 0 and 1 if the BXLE
>    breaks out of the loop and the program ABENDs?

Whatever ABEND routine you have on the system will trash them in the course of producing a dump. At the actual time of the exit from the loop, r1 still has whatever was loaded from 12345 and r0=the smallest power of 2 that is greater than both f'1' and the contents of r1

Quote:
>Assume addressability and LTORGs are OK.  In otherwords, the L
>instruction will actually load the value into register 1, and the BXLE will
>actually loop to itself, as the code appears to imply.

I wrote just such a loop in '74 (except that I wasn't using r0 & r1) as part of the prolog to a binary search routine. I still think of it as the best example of an Assembler language "pun". Unfortunately, I haven't found too many people with whom to share the humor.

--
-----------------------------------------------------------

-----------------------------------------------------------



Sun, 06 Feb 2000 03:00:00 GMT  
 Assembler super techie question

Quote:

> Hi --

>          LA    0,1
>          L     1,=A(12345)
>          BXLE  0,0,*
>          DC    H'0'

> 1)  Will the BXLE instruction ever break out of the loop?
> 2)  What will be the contents of registers 0 and 1 if the BXLE
>     breaks out of the loop and the program ABENDs?

> Assume addressability and LTORGs are OK.  In otherwords, the L
> instruction will actually load the value into register 1, and the
> BXLE will actually loop to itself, as the code appears to imply.

> -- Steve Myers

(snip)

Steve, your code fragment runs, falls out of the loop & abends (S0C1 on
the HW of zero, of course). R1 still contains the 12,345 (x'3039') from
the Load instruction, and R0 contains 16,384 (x'4000') from the looping.

Bill



Mon, 07 Feb 2000 03:00:00 GMT  
 Assembler super techie question

Bill --

Dead on!

-- Steve Myers

The E-mail addresses in this message are private property.  Any use of them
to  send  unsolicited  E-mail  messages  of  a  commerical  nature  will be
considered trespassing,  and the originator of the message will be  sued in
small claims court in Camden County,  New Jersey,  for the  maximum penalty
allowed by law.



Mon, 07 Feb 2000 03:00:00 GMT  
 Assembler super techie question


Quote:
>Hi --

>         LA    0,1
>         L     1,=A(12345)
>         BXLE  0,0,*
>         DC    H'0'

[snip]

Here's a real-world example of something similar that I wrote a few months
ago.  BXH is used instead of BXLE, but it's the same idea in using the
same even register is as both operands to do a doubling operation:

FunDecode DS    0H                                                  A01
         SPACE ,                                                    A01
         PUSH USING                Save current USING status        A01
         L     R10,UniBase-*(,R15) Setup standard addressability    A01
         USING TTWA,R1             Map Task-WorkArea                A01

         USING SpecPack,R4         Establish DSECT relationship     A01
         SR    R2,R2               Get function code from ...       A01
         IC    R2,SpPkFunct        ... specification packet         A01
         LA    R3,FunMaxIdx        Get maximum valid table offset   A01
         AR    R2,R2               Get 2, and then 4 times function A01
         BXH   R2,R2,ErrInvFunc    ... code value for use as index  A01+
                                   Valid Function Code specified?   A01+
                                   No ==> Return error to caller    A01
         L     R15,FunTable(R2)    Get Function Handler's address   A01
         BR    R15                 ==> Enter handler for function   A01
         POP   USING               Restore original USING status    A01

Cheers,
==============  ,,   ========================================


                 -'#  IBMMAIL(USRWNZEN) --> MVS (work)
==============  ###  ========================================  
"People who write subsystems use a lot of four-letter words."



Mon, 14 Feb 2000 03:00:00 GMT  
 Assembler super techie question

Quote:
>[snip]
>FunDecode DS    0H                                                  A01
>         SPACE ,                                                    A01
>         PUSH USING                Save current USING status        A01
>         L     R10,UniBase-*(,R15) Setup standard addressability    A01
>         USING TTWA,R1             Map Task-WorkArea                A01

>         USING SpecPack,R4         Establish DSECT relationship     A01
>         SR    R2,R2               Get function code from ...       A01
>         IC    R2,SpPkFunct        ... specification packet         A01
>         LA    R3,FunMaxIdx        Get maximum valid table offset   A01
>         AR    R2,R2               Get 2, and then 4 times function A01
>         BXH   R2,R2,ErrInvFunc    ... code value for use as index  A01+
>                                   Valid Function Code specified?   A01+
>                                   No ==> Return error to caller    A01
>         L     R15,FunTable(R2)    Get Function Handler's address   A01
>         BR    R15                 ==> Enter handler for function   A01
>         POP   USING               Restore original USING status    A01
>[snip]

Oh, I like that!

-- Steve Myers

The E-mail addresses in this message are private property.  Any use of them
to  send  unsolicited  E-mail  messages  of  a  commerical  nature  will be
considered trespassing,  and the originator of the message will be  sued in
small claims court in Camden County,  New Jersey,  for the  maximum penalty
allowed by law.



Mon, 14 Feb 2000 03:00:00 GMT  
 Assembler super techie question



Quote:

> >Hi --

> >         LA    0,1
> >         L     1,=A(12345)
> >         BXLE  0,0,*
> >         DC    H'0'

> [snip]
> Here's a real-world example of something similar that I wrote a few months
> ago.  BXH is used instead of BXLE, but it's the same idea in using the same
> even register is as both operands to do a doubling operation:
> FunDecode DS    0H                                                  A01
>          SPACE ,                                                    A01
>          PUSH USING                Save current USING status        A01
>          L     R10,UniBase-*(,R15) Setup standard addressability    A01
>          USING TTWA,R1             Map Task-WorkArea                A01

>          USING SpecPack,R4         Establish DSECT relationship     A01
>          SR    R2,R2               Get function code from ...       A01
>          IC    R2,SpPkFunct        ... specification packet         A01
>          LA    R3,FunMaxIdx        Get maximum valid table offset   A01
>          AR    R2,R2               Get 2, and then 4 times function A01
>          BXH   R2,R2,ErrInvFunc    ... code value for use as index  A01+
>                                    Valid Function Code specified?   A01+
>                                    No ==> Return error to caller    A01
>          L     R15,FunTable(R2)    Get Function Handler's address   A01
>          BR    R15                 ==> Enter handler for function   A01
>          POP   USING               Restore original USING status    A01

Beg to differ; not with your code but with the point of similarity to the
first snippet of code. What's interesting about "bxle 0,0,*" is not so much
the double reference to r0 but, rather the "*". For the 360/70/90
architecture, this is the only possible one-instruction loop that actually
performs a *useful* (albeit specialized) computation.

"bc whatever,*" either doesn't branch or branches endlessly and doesn't
compute anything.

"bct Rx,*" simply wastes some time before "computing" zero in Rx (hardly a
useful result); semantically equivalent to "sr Rx,Rx" but slower.

Finally, all the flavors of branch with some sort of linkage either loop
endlessly or exhaust the address space's resources and cause a program
exception.

The original example for "bxle 0,0,*", because of the unfortunate use of a
*constant* in r1, tends to both trivialize the example and distract from the
possible *usefulness* of the "loop". A good optimizing assembler (if there
were such a beast) could substitute the semantically equivalent:
   lm r0,r1,=a(16384,12345)
   dc h'0'
which is neither interesting nor a useful "computation".

However, in the general case (where r1 contains *some* value "x" [where 0 < x
< 2**30]),
    la       r0,1
    bxle    r0,r0,*

computes (rather economically) the least power of two that is greater than
"x".

--
-----------------------------------------------------------

-----------------------------------------------------------



Wed, 16 Feb 2000 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. IMS Super Techie Question

2. Super-techie question

3. some questions of a techie nature

4. makefiel.vc techie question

5. Super Tagging and Super Invoice

6. super super ?

7. Techie Tip of the Month - Adding a Simple Web Server Interface

8. "super" question for language experts

9. Super novice question..

10. Newbie question on super

11. Super QBE question

12. Super Invoice Template Question

 

 
Powered by phpBB® Forum Software