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
 

 

Functioning of TM in assembler

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
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    Post subject: Functioning of TM in assembler
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: 3158
Location: Tucson AZ

PostPosted: Thu Mar 29, 2007 6:53 pm    Post subject:
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

Site Director


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

PostPosted: Fri Mar 30, 2007 12:45 am    Post subject:
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: 3158
Location: Tucson AZ

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

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

Site Director


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

PostPosted: Fri Mar 30, 2007 1:43 am    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Fri Mar 30, 2007 1:59 am    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Sat Mar 31, 2007 12:35 am    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Sat Mar 31, 2007 2:33 am    Post subject: Re: Functioning of TM in assembler
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: 3158
Location: Tucson AZ

PostPosted: Sat Mar 31, 2007 2:38 am    Post subject: Re: Functioning of TM in assembler
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    Post subject: Another comment on the TM
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

Site Director


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

PostPosted: Sun Apr 01, 2007 12:32 am    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Sun Apr 01, 2007 12:35 am    Post subject: Re: Another comment on the TM
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    Post subject:
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: 3158
Location: Tucson AZ

PostPosted: Sun Apr 01, 2007 1:19 am    Post subject:
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

Site Director


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

PostPosted: Sun Apr 01, 2007 1:24 am    Post subject:
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    Post subject:
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    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 Online Assembler Program Starting point Aditya.Srivastava PL/I & Assembler 4 Fri Jul 08, 2016 6:48 pm
This topic is locked: you cannot edit posts or make replies. MVS Assembler profiles for Pune Locat... shailesh_do Mainframe Jobs 0 Mon Feb 22, 2016 6:21 pm
No new posts ASRA abend calling Assembler from CICS surya8 PL/I & Assembler 13 Thu Sep 10, 2015 7:50 pm
No new posts Is Enterprise PL/I v4.2 compatible wi... sundarkudos PL/I & Assembler 2 Wed Aug 19, 2015 11:15 pm
No new posts Assembler Code to check normal retur... amitc23 PL/I & Assembler 6 Mon Aug 17, 2015 3:52 pm


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