Clarification on USING instruction
Author |
Message |
Goobs #1 / 9
|
 Clarification on USING instruction
I am going through an existing source: .... L 11,16 USING CVT,11 ADDRESS CVT L 10,CVTASVT USING ASVT,10 ADDRESS ASVT <------------X USING ASCB,7 ADDRESS ASCB <------------Y L 9,ASVTMAXU LOAD MAX NO. OF ASCB'S LA 8,ASVTENTY LOAD ASCB IN USE MARKER .... There are two consecutive USING stmts ( X & Y). What is the purpose of the second using instrn(Y)? Why base reg is changed to from R10 to R7 in consecutive two lines? And why R7 is not loaded with ASCB addr? I was interpreting like this: 1. Load CVT addr in R11 2. Use R11 as Base Reg and CVT as base addr 3. Load R10 with the contents of location CVTASVT 4. Use R10 as Base reg and ASVT as base addr 5. Use R7 as Base reg and ASCB as base addr ... TIA.
|
Wed, 25 Jul 2001 03:00:00 GMT |
|
 |
s.. #2 / 9
|
 Clarification on USING instruction
A USING statement is a statement to the Assembler that, when an appropriate symbol is used, the the conditions implied by the USING statement are true. Many programmers prefer to block their USING statements in one place, rather than spread them out.
Quote: >I am going through an existing source: >..... > L 11,16 > USING CVT,11 ADDRESS CVT > L 10,CVTASVT > USING ASVT,10 ADDRESS ASVT <------------X > USING ASCB,7 ADDRESS ASCB <------------Y > L 9,ASVTMAXU LOAD MAX NO. OF ASCB'S > LA 8,ASVTENTY LOAD ASCB IN USE MARKER >..... >There are two consecutive USING stmts ( X & Y). What is the purpose of the >second using instrn(Y)? Why base reg is changed to from R10 to R7 in >consecutive >two lines? And why R7 is not loaded with ASCB addr? I was interpreting like >this: >1. Load CVT addr in R11 >2. Use R11 as Base Reg and CVT as base addr >3. Load R10 with the contents of location CVTASVT >4. Use R10 as Base reg and ASVT as base addr >5. Use R7 as Base reg and ASCB as base addr >.... >TIA.
-- Steve Myers The E-mail addresses in this message are private property. Any use of them to send unsolicited E-mail messages of a commerical nature will be considered trespassing, and the originator of the message will be sued in small claims court in Camden County, New Jersey, for the maximum penalty allowed by law.
|
Wed, 25 Jul 2001 03:00:00 GMT |
|
 |
Seymour #3 / 9
|
 Clarification on USING instruction
Quote:
> Many programmers prefer to block their USING statements in one place, > rather than spread them out.
It's good for job security <g, d & r>. Seriously, putting a USING physically before the code that establishes addressability is, IMHO, a very dangerous practice. Somebody making a quick change is liable to add code that relies on the addressability, and the assembler will cheerfully generate incorrect code, as requested. Quote: > -- Steve Myers
-- Shmuel (Seymour J.) Metz Reply to host nsf (dot) gov, user smetz
|
Fri, 27 Jul 2001 03:00:00 GMT |
|
 |
s.. #4 / 9
|
 Clarification on USING instruction
I did not say whether the practice is good or bad. I just said many people block their USINGs.
Quote:
[snip] >It's good for job security <g, d & r>. Seriously, putting a USING physically >before the code that establishes addressability is, IMHO, a very dangerous >practice. Somebody making a quick change is liable to add code that relies on the >addressability, and the assembler will cheerfully generate incorrect code, as >requested. >-- >Shmuel (Seymour J.) Metz >Reply to host nsf (dot) gov, user smetz
-- Steve Myers The E-mail addresses in this message are private property. Any use of them to send unsolicited E-mail messages of a commerical nature will be considered trespassing, and the originator of the message will be sued in small claims court in Camden County, New Jersey, for the maximum penalty allowed by law.
|
Fri, 27 Jul 2001 03:00:00 GMT |
|
 |
fred #5 / 9
|
 Clarification on USING instruction
Quote:
> I am going through an existing source: > .... > L 11,16 > USING CVT,11 ADDRESS CVT > L 10,CVTASVT > USING ASVT,10 ADDRESS ASVT <------------X > USING ASCB,7 ADDRESS ASCB <------------Y > L 9,ASVTMAXU LOAD MAX NO. OF ASCB'S > LA 8,ASVTENTY LOAD ASCB IN USE MARKER > ....
Forgive me if I am insulting your intelligence, but from the above I get the impression that you believe that the PROGRAM base register is changing with each USING statement. This is most certainly NOT the case. From the code you listed we cannot tell which register is used for the program base. A more literal interpretation of the above instructions would be: 1. Load the constant value 16 into register 11. 2. Tell the assembler to use register 11 as the base for any addresses relative to the start of the CVT. 3. Load register 10 with the value found at the offset CVTASVT from register 11. i.e. L 10,CVTASVT-CVT(11). 4. Tell the assembler to use register 10 as the base for any addresses relative to the start of the ASVT. 5. Tell the assembler to use register 7 as the base for any addresses relative to the start of the ASCB. (you are correct to be curious here, as no value has been loaded into register 7, so "USING" it could cause problems). In any event NO register has been assigned as the program base and, given the code snippet you posted, none is required: there are no CSECT relative instructions here so the code is completely reentrant.
|
Fri, 27 Jul 2001 03:00:00 GMT |
|
 |
Goobs #6 / 9
|
 Clarification on USING instruction
Quote:
>Forgive me if I am insulting your intelligence, but from the above
No, absolutely not. Sometimes, I don't get very clear idea from ibm manuals. Thanks to all of you for your responses. <snip>
|
Sat, 28 Jul 2001 03:00:00 GMT |
|
 |
gla.. #7 / 9
|
 Clarification on USING instruction
Quote:
>>Forgive me if I am insulting your intelligence, but from the above >No, absolutely not. Sometimes, I don't get very clear idea from ibm manuals. >Thanks to all of you for your responses. ><snip>
I may get my hands slapped for this, but what the heck. :*) If you find a ambiguous section in an IBM manual, or can suggest a better way of explaining something, then please send in a Reader Comment Form (RCF). The worst that can happen is that it'll be rejected. But, in my experience, most of the publications writers are very receptive to RCFs and will try to improve any manual which has a problem (It's not an overnight process, so you'll have to wait until the next revision of the manual to see any changes.). Be as specific as possible. It helps if you can suggest a possible improvement (e.g., Page 63 of SC54-3210-01 would explain this better if it said...), rather than saying "This manual isn't very good.". Dave P.S. Standard Disclaimer: I work for them, but I don't speak for them. I have no connection with any of the publications groups within the company, with the exception of having sent in RCF forms in the past.
|
Sat, 28 Jul 2001 03:00:00 GMT |
|
 |
John Chas #8 / 9
|
 Clarification on USING instruction
Quote:
> > I am going through an existing source: > > .... > > L 11,16 > > USING CVT,11 ADDRESS CVT > > L 10,CVTASVT > > USING ASVT,10 ADDRESS ASVT <------------X > > USING ASCB,7 ADDRESS ASCB <------------Y > > L 9,ASVTMAXU LOAD MAX NO. OF ASCB'S > > LA 8,ASVTENTY LOAD ASCB IN USE MARKER > > .... > Forgive me if I am insulting your intelligence, but from the above > I get the impression that you believe that the PROGRAM base register > is changing with each USING statement. This is most certainly NOT > the case. From the code you listed we cannot tell which register is > used for the program base. A more literal interpretation of the > above instructions would be: > 1. Load the constant value 16 into register 11.
Haste makes waste. I'm sure you meant to say, "Load the contents of storage at offset +16 from address zero into register 11." Quote: > 2. Tell the assembler to use register 11 as the base for any > addresses relative to the start of the CVT. > 3. Load register 10 with the value found at the offset CVTASVT from > register 11. i.e. L 10,CVTASVT-CVT(11). > 4. Tell the assembler to use register 10 as the base for any > addresses relative to the start of the ASVT. > 5. Tell the assembler to use register 7 as the base for any > addresses relative to the start of the ASCB. (you are correct > to be curious here, as no value has been loaded into register > 7, so "USING" it could cause problems). > In any event NO register has been assigned as the program base and, > given the code snippet you posted, none is required: there are no > CSECT relative instructions here so the code is completely reentrant.
-jc-
|
Sun, 29 Jul 2001 03:00:00 GMT |
|
 |
Bruce A Blac #9 / 9
|
 Clarification on USING instruction
Agreed. I have had very good luck with RCFs, most of my suggested changes eventually end up in print. But your input will be most effective if you suggest what the change should be (at least in general terms). Quote:
> If you find a ambiguous section in an IBM manual, or can suggest a > better way of explaining something, then please send in a Reader > Comment Form (RCF).
|
Wed, 01 Aug 2001 03:00:00 GMT |
|
|
|