Page 2 of 2

Re: Opcode: BXLE

PostPosted: Sun Nov 20, 2011 4:34 am
by RISCCISCInstSet
I think I'm making proper sense of this opcode. Thanks everybody for their help. :mrgreen:

Re: Opcode: BXLE

PostPosted: Mon Nov 21, 2011 6:37 am
by steve-myers
Not very many people use BXLE/BXH. Let's see what you've learned.
         LA    0,1
         LA    1,avalue  Or something equivalent
         BXLE  0,0,*
Hint: this loop does terminate. What is in register 0 when the loop terminates. I actually used this in a production program.

Re: Opcode: BXLE

PostPosted: Wed Mar 20, 2013 12:55 pm
by bobguo
steve-myers wrote:Not very many people use BXLE/BXH. Let's see what you've learned.
         LA    0,1
         LA    1,avalue  Or something equivalent
         BXLE  0,0,*
Hint: this loop does terminate. What is in register 0 when the loop terminates. I actually used this in a production program.



i know how to use BXLE, but i would like to catch what's mean, can somebody explain these three lines? Thx.

Re: Opcode: BXLE

PostPosted: Wed Mar 20, 2013 4:35 pm
by steve-myers
bobguo wrote:... i know how to use BXLE, but i would like to catch what's mean, can somebody explain these three lines? Thx.
If you know how to use BXLE - which I doubt - and you understand the previous example, you should have no trouble with this example. Try changing the second line to

LA 1,5

Get out your "Principles of Operation" and work through the 4 times the BXLE instruction will execute. Remember that the * in the BXLE is the current location, so the first 3 times the instruction executes it will "branch" to itself. Remember the formal name of the instruction is "branch on index low or equal." Change the word "index" to "value," or in the earlier example, "address," and you will have it.

I sort of suspect "index" was used in the name to sort of fool people using the 704/709/7040/7090/7094 computers that immediately preceded the System/360 computers. Most of the time when I use BXLE or BXH I have addresses in first operand and the compare register.

Re: Opcode: BXLE

PostPosted: Wed Mar 20, 2013 8:44 pm
by bobguo
         LA    0,1
         LA    1,5
         BXLE  0,0,*


After the 1st time was executed:
R0=2 and it jumps to itself

After the 2nd time was executed:
R0=4 and it jumps to itself too

After the 3rd time was executed:
R0=8 and it jumps to the next instruction

"Hint: this loop does terminate. What is in register 0 when the loop terminates. I actually used this in a production program."

i puzzled why writing this codes? what's the purpose?

Re: Opcode: BXLE

PostPosted: Wed Mar 20, 2013 9:03 pm
by enrico-sorichetti
i puzzled why writing this codes? what's the purpose?


the problem/puzzle to be solved is ..

given
F(x1) = y1
F(x2) = y2
F(x3) = y3
F(x4) = y4
...
F(xn) = yn


and You can easyily determine the xN and yN running the code a few times

describe the function F

not that complicated :mrgreen:

Re: Opcode: BXLE

PostPosted: Wed Mar 20, 2013 9:32 pm
by steve-myers
What are 2, 4, and 8? What are the next values? Actually, I didn't show the whole code.

LA 0,1
LA 1,5
BXLE 0,0,*
SRA 0,1

I stole the idea from an Algol function in Communications of the ACM from the 1950s. In C it would be

for ( i = 1; i <= 5; i = i + i);
i = i >> 1;