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

Functioning of TM in assembler


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

New User


Joined: 21 Mar 2007
Posts: 46
Location: India

PostPosted: Thu Mar 29, 2007 4:40 pm
Reply with quote

I have the below statement

TM SWITCH,X'00'

In the above case what would be the condition code set to after the TM for assuming

1) SWITCH is all zeros
2) SWITCH is all Ones
3) SWITCH is mixed zeros and ones.

For any other mask i.e. one not having zeroes , the IBM manual says the condition code is

0 all selected bits are zero
1 selected bits are mixed
2 not used!
3 all selected bits are one


but for the above case when the mask itself is zeroes , no bit would be selected .So how will the instruction behave ?
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Mar 29, 2007 6:53 pm
Reply with quote

I guess that the cc wouldn't change....
Checking my POP shows "0 Selected bits all-zero; mask is all-zero".
Good guess Bill... icon_lol.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Mar 30, 2007 12:45 am
Reply with quote

Hello,

Test under Mask (TM) assumes that you are looking for an "on" condition in one or more of the tested bits.

If you don't want to test for at least one bit on, there is no need to issue the TM.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Mar 30, 2007 1:21 am
Reply with quote

Is TM an EXecutable instruction?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Mar 30, 2007 1:43 am
Reply with quote

Hi Bill,

Yes, it is a way to test bit patterns. The machine code is x'91' (no i've not memorized the op-codes icon_smile.gif ).
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Mar 30, 2007 1:59 am
Reply with quote

No, I mean is it and instruction that you can EX, overlaying the bit pattern part of the instruction like you can when you EX a MVC and overlay the length?
Back to top
View user's profile Send private message
himanshupant

New User


Joined: 21 Mar 2007
Posts: 46
Location: India

PostPosted: Fri Mar 30, 2007 9:40 am
Reply with quote

I agree Dick that with the test mask x'00' no bit would be tested .But the case I am pointing out has occured in a production code.So I was wondering that it might be changing the condition code somehow , because after this TM there is a BNO condition.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Mar 31, 2007 12:35 am
Reply with quote

Hello,

Without having the code to experiment with, my guess is that you have a rather elaborate unconditional branch. . .

Bill, i'm not sure if it can be EXed or not.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sat Mar 31, 2007 2:33 am
Reply with quote

Hi !

quoting from the esa/390 principles of operations


Quote:

TM D1(B1),I2 [SI]

|'91' | I2 | B1 | D1


A mask is used to select bits of the first operand, and the result is
indicated in the condition code.

The byte of immediate data, I2, is used as an eight-bit mask. The bits of the mask are made to correspond one for one with the bits of the byte in storage designated by the first-operand address.


A mask bit of one indicates that the storage bit is to be tested. When the mask bit is zero, the storage bit is ignored. When all storage bits thus selected are zero, condition code 0 is set. Condition code 0 is also set when the mask is all zeros. When the selected bits are all ones, condition code 3 is set; otherwise, condition code 1 is set.

Access exceptions associated with the storage operand are recognized for one byte even when the mask is all zeros.

Resulting Condition Code:

0
Selected bits all zeros; or mask bits all zeros
1
Selected bits mixed zeros and ones
2
--
3
Selected bits all ones

Program Exceptions:
* Access (fetch, operand 1)


The POP is clear.....
what manual were You reading which raised Your doubts?

And YES, the TM can be the object of an EX instruction

regards

e.s
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Sat Mar 31, 2007 2:38 am
Reply with quote

Hi back,
enrico-sorichetti wrote:
And YES, the TM can be the object of an EX instruction
Thanks, I kinda thought that from the original description....

Bill
Back to top
View user's profile Send private message
bengtpelle

New User


Joined: 28 Aug 2006
Posts: 24
Location: St. Petersburg, FL

PostPosted: Sat Mar 31, 2007 11:50 pm
Reply with quote

I do not think that you got the full picture. From reading above, I noticed that you had a BNO after the TM for X'00".
This BNO is useless and it will never be executed.
It is true that the TM can be executed, however if it is, the BNO should be placed after the EX instruction, not after the TM.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Apr 01, 2007 12:32 am
Reply with quote

Hello,

In the initial post and the follow up from himanshupant, there was no EX mentioned.

The EX discussion was (thinking out loud here) wondering if the TM might be configured on the fly rather than always use the x'00' mask.

Why would the BNO "never be executed"? I believe it will be executed every time thru the code and will always do the same thing - as mentioned earlier, "a rather elaborate unconditional branch". . . . icon_smile.gif
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Sun Apr 01, 2007 12:35 am
Reply with quote

bengtpelle wrote:
I noticed that you had a BNO after the TM for X'00".
This BNO is useless and it will never be executed.
That bring up another old trick, XI/NI to chane the bit settings.... icon_wink.gif
Back to top
View user's profile Send private message
bengtpelle

New User


Joined: 28 Aug 2006
Posts: 24
Location: St. Petersburg, FL

PostPosted: Sun Apr 01, 2007 12:59 am
Reply with quote

XI, NI would work.
To figure that out, there should be a label on the TM instruction.
A dump could tell us if the TM was modified.

Here is a totaly unrelated idea....
Have you ever tried to Execute a BALR instruction????
Quite facinating thought on program flow.
I have used it to protect program logic from debugging.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Sun Apr 01, 2007 1:19 am
Reply with quote

Nasty.....But we don't code that way anymore, do we.... icon_lol.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Apr 01, 2007 1:24 am
Reply with quote

Hello,

Whatever does
Quote:
I have used it to protect program logic from debugging.
really mean?

As posted, it says there is code that should not be subjected to debugging. Not a concept i'm familiar with. . .

If it means that you are trying to conceal what the code actually does, that is a very bad practice.

If i,ve misunderstood, my apologies.
Back to top
View user's profile Send private message
bengtpelle

New User


Joined: 28 Aug 2006
Posts: 24
Location: St. Petersburg, FL

PostPosted: Sun Apr 01, 2007 1:33 am
Reply with quote

No we don't, but I wish we could.
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