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

Working of EX instruction and TM instruction


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: Fri Apr 13, 2007 10:42 am
Reply with quote

In a code fragment as below

EX R1,LABEL
BNO END
.
.
.

LABEL TM SWITCH1,X''00'
.
.
.
SWITCH1 DC XL1'00'

As per the processing of EX , the R1 takes in some value whose rightmost byte is used as a modifier .But with reference to the target instruction ( TM ) in our case , how will the R1 influence its processing ?

2) If we execute the LABEL in isolation , then the condition code will always be 00 .Right ??
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 Apr 13, 2007 10:57 am
Reply with quote

I'd guess that R1 becomes the mask.
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Thu Apr 19, 2007 5:51 pm
Reply with quote

Hi There !

Sorry, the TM instruction doesn't influence content of R1. In the Example R1 is used for the EX instruction. So it only has to keep the correct length for the desired instruction. In this case zero because TM is a one-byte instruction. TM compares one byte with a direct-value. Only the brach-code is set.

One could also have coded:

L R1,=A(Byte) ...adress of Field
TM 0(R1),240 ...is it numeric
BO XYZ ...yes it is

For example TRT influences R1 and R2.

Regards, UmeySan
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 Apr 19, 2007 6:02 pm
Reply with quote

UmeySan,
The bits 24-31 of the register are ORed with bits 8-15 of the instruction, which normally is the length bits, but for the TM they are the immediate operand.
himanshupant had it right about R1 influencing the TM.
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Fri Apr 20, 2007 3:54 am
Reply with quote

I'm sorry but this is A total waste of coding, when you could have just
tested the field.

TM SWITCH1,X'00'
BNO END
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 Apr 20, 2007 4:45 am
Reply with quote

Yup, but we often write things more elegant than what we inherit. . . icon_smile.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: Sat Apr 21, 2007 8:55 pm
Reply with quote

The

TM SWITCH1,X'00'
BNO END

will never branch to end since there is no mask to test agains.

As far as the original question about how the R1 will influence the instructions, the answer is:

The low order byte of the R1 is temporarely OR'ed to the second byte of the TM during the execute. The TM instruction is not changed.
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 Apr 21, 2007 10:08 pm
Reply with quote

Hello,

Are you sure about this
Quote:
TM SWITCH1,X'00'
BNO END

will never branch to end since there is no mask to test agains.


Is BNO a "branch not one" (i believe it is)? This
Quote:
TM instructions are commonly followed by a branch instruction. The most common ones are:

BZ branch if all bits tested are ZERO

BO branch if all bits tested are ONE

BM branch if tested bits are MIXED

BNZ branch if tested bits are NOT ZERO

BNO branch if tested bits are NOT ONE

BNM branch if tested bits are NOT MIXED
is from an old reference.

Each time a TM is executed the "condition code" is set.

Quote:
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.


As was posted in another recent topic, the mask may be created dynamically before the TM is executed. . .
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 22, 2007 12:24 am
Reply with quote

Sorry you are right. Since no bits exist in the mask, you can never have a mask result with any one bit in it.
The BNO will always be taken.
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 22, 2007 1:34 am
Reply with quote

I'm just curious if this line
Code:
LABEL TM SWITCH1,X''00'
is modified before the code posted in the fragment above is invoked.

Having a label on the TM and having it EXed is one way to indicate the code is being modified at run-time.
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Mon Apr 23, 2007 7:56 pm
Reply with quote

They would have had to modifed somewheres else in the code.
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Fri Apr 27, 2007 6:35 pm
Reply with quote

Hi there !

I think that the original question is a real philosophical question.

Fact ist, that the TM instruction has no affect on both operands. Only the branchcode is set.
The original code ist: TM D1(B1),I2


Another fact is that the EX instruction has two different effects.

EX with Register-0 doesn't change anything, it only executes the command at that label.

EX with an other Register, 1-15, modifies that command.
Therefore the second byte of the objectcode is disjunctioned (OR) with the almost rigth byte of the register which is coded in the EX instruction.
This now modified instruction is executed. After the execution this command is reset to its original value.

So you normaly use the EX to modify the length of a mvc,clc,pack,ap or sp instruction.


Also I acknowledge Mickeydusaor, it's a waste of coding. It sucks.

For example TRT influences R1 and R2.
R1 = adress of actual byte.
R2 = content of table

Regards & nice sunny weekend
UmeySan
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 PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
No new posts ICETOOL with JOINKEY for Big record l... DFSORT/ICETOOL 12
No new posts JCL JOB Cancel/Purge Not Working JCL & VSAM 6
No new posts OMVS Shell Script not working properly. All Other Mainframe Topics 1
Search our Forums:

Back to Top