IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

BC(BRANCH ON CONDITION) INSTRUCTION IN Assembler


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vinayknj

New User


Joined: 26 May 2008
Posts: 50
Location: Bangalore

PostPosted: Tue May 10, 2011 12:31 pm
Reply with quote

Hi,

I couldn't understand how BC instruction works.

Ex: I want to Branch to the address 6050 if CC is 0 or 1.

Reg 10 contains 00 00 50 00
Reg 11 contains 00 00 10 00

Instruction
BC 12, X'50'(11,10)

A mask of 12 in Dec means that there are ones in instruction bits 8 and 9, zeros in 10 and 11. So branching takes place if Condition Code is 0 or 1.

I could see the above example for BC instruction.

Can anyone explain how X'C' (12 in Dec) means ones in bits 8 and 9??? Thanks
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Tue May 10, 2011 12:35 pm
Reply with quote

See the answers in your previous TM(Test Under Mask) instruction in assembler topic.

Too lazy to read the manual, huh?
Back to top
View user's profile Send private message
vinayknj

New User


Joined: 26 May 2008
Posts: 50
Location: Bangalore

PostPosted: Tue May 10, 2011 1:00 pm
Reply with quote

The example I have mentioned is from the Manual 'zArchitecture_Principles_of_operation' itself.

I didn't understand the explanation and the example given in the manaul.

Hence I have posted here if anyone has better understanding of this instruction.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue May 10, 2011 1:21 pm
Reply with quote

seems clear to me
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DZ9ZR003/5.1.2?SHELF=DZ9ZBK03&DT=20040504121320

and
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DZ9ZR003/7.5.12?SHELF=DZ9ZBK03&DT=20040504121320

and meditate on the bits offset of the M1
Back to top
View user's profile Send private message
vinayknj

New User


Joined: 26 May 2008
Posts: 50
Location: Bangalore

PostPosted: Tue May 10, 2011 1:33 pm
Reply with quote

Hi Enrico,

Can you explain me the below table from the link you have given above?

___________ _____________ __________
| | Instruction | Mask |
| Condition | Bit No. of | Position |
| Code | Mask | Value |
|_________|_________________ | __________|
| 0 | 8 | 8 |
| 1 | 9 | 4 |
| 2 | 10 | 2 |
| 3 | 11 | 1 |
|___________|_____________|__________|
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue May 10, 2011 1:40 pm
Reply with quote

take an hex digit C in this case
use its binary representation 1100
overlay the four bits at the M1 mask location
and You will readily see the the ones in Your mask will occupy bits 8 and 9 of the instruction
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Tue May 10, 2011 1:55 pm
Reply with quote

vinayknj wrote:
The example I have mentioned is from the Manual 'zArchitecture_Principles_of_operation' itself.

I didn't understand the explanation and the example given in the manaul.

Hence I have posted here if anyone has better understanding of this instruction.


If you should have stated its a sample from the POP you dont understand, i wouldnt have answered the way i did.
Beside that a Google on branch on condition gave me this site :
csc.colstate.edu/woolbright/BC.HTM
and this one :
www.bixoft.nl/english/opcd/bc.htm
and of course some more hits.

And because im lazy, i always used the BNE, BE, BZ etc. instructions, so i didnt have to remember all those bit masks.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue May 10, 2011 2:04 pm
Reply with quote

Quote:
Can anyone explain how X'C' (12 in Dec) means ones in bits 8 and 9??? Thanks


that' s the question I was trying to answer icon_biggrin.gif
Back to top
View user's profile Send private message
vinayknj

New User


Joined: 26 May 2008
Posts: 50
Location: Bangalore

PostPosted: Tue May 10, 2011 3:07 pm
Reply with quote

Thanks Enrico and Peter.

I think I have understood. Please confirm if am right

Ex: IF Mask is given as B'pos1 pos2 pos3 pos4', I.E. in the mask if pos1 has value '1' then CC must be '0' for the branch to happen. if pos2 has '1' then CC must be '1', if pos3 has '1' then CC must be 2 and finally pos4 is '1' then CC must be 3 for the branch to take place.

Hope my understanding is correct. Thanks
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Build dataset list with properties us... PL/I & Assembler 4
No new posts Finding Assembler programs PL/I & Assembler 5
No new posts How Can I Recall a Migrated Data Set ... PL/I & Assembler 3
No new posts step by step trace 4 ISPF dialog call... TSO/ISPF 17
No new posts Getting SOC4 while calling a Cobol DB... PL/I & Assembler 4
Search our Forums:

Back to Top