Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

BC(BRANCH ON CONDITION) INSTRUCTION IN Assembler

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
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    Post subject: BC(BRANCH ON CONDITION) INSTRUCTION IN Assembler
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: 2431
Location: Netherlands, Amstelveen

PostPosted: Tue May 10, 2011 12:35 pm    Post subject:
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    Post subject: Reply to: BC(BRANCH ON CONDITION) INSTRUCTION IN Assembler
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10232
Location: italy

PostPosted: Tue May 10, 2011 1:21 pm    Post subject: Reply to: BC(BRANCH ON CONDITION) INSTRUCTION IN Assembler
Reply with quote

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

and
http://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    Post subject: BC(BRANCH ON CONDITION) INSTRUCTION IN Assembler
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10232
Location: italy

PostPosted: Tue May 10, 2011 1:40 pm    Post subject: Reply to: BC(BRANCH ON CONDITION) INSTRUCTION IN Assembler
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: 2431
Location: Netherlands, Amstelveen

PostPosted: Tue May 10, 2011 1:55 pm    Post subject: Re: Reply to: BC(BRANCH ON CONDITION) INSTRUCTION IN Assembl
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 :
http://csc.colstate.edu/woolbright/BC.HTM
and this one :
http://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

Global Moderator


Joined: 14 Mar 2007
Posts: 10232
Location: italy

PostPosted: Tue May 10, 2011 2:04 pm    Post subject: Reply to: BC(BRANCH ON CONDITION) INSTRUCTION IN Assembler
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    Post subject: BC(BRANCH ON CONDITION) INSTRUCTION IN Assembler
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    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Joinkeys with condition scdinesh DFSORT/ICETOOL 10 Tue Feb 14, 2017 12:20 am
No new posts A not very Christmassy PL/I tale, wit... prino PL/I & Assembler 3 Mon Dec 26, 2016 1:01 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts Online Assembler Program Starting point Aditya.Srivastava PL/I & Assembler 4 Fri Jul 08, 2016 6:48 pm
No new posts INCLUDE condition questions van bui DFSORT/ICETOOL 1 Thu Jun 30, 2016 9:52 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us