Groups | Search | Server Info | Login | Register
Groups > comp.lang.asm370 > #35
| From | Fritz Wuehler <fritz@spamexpire-201207.rodent.frell.theremailer.net> |
|---|---|
| Newsgroups | comp.lang.asm370 |
| Subject | Re: "Using" statement? |
| References | <4ff70320$0$1212$607ed4bc@cv.net> |
| Message-ID | <098c6635e3c48b6726e4fb3341133b56@msgid.frell.theremailer.net> (permalink) |
| Date | 2012-07-12 07:31 +0200 |
| Organization | Frell Anonymous Remailer |
John W Kennedy <jwkenne@attglobal.net> wrote: > On 2012-07-06 13:52:45 +0000, hancock4@bbs.cpcn.com said: > > > Many assembler programs begin with a USING * statement. Could someone > > explain it? > > > > Thanks. > > "USING *" is actually obsolete in properly written z/Architecture code > that segregates code from data and uses only branch-relative > instructions, USING is not obsolete in any serious code, whether or not it is properly-written, reentrant, etc. If you are considering "USING *" a special case then I'll go further than you and say USING * is never required, use a label. You need to understand USING to get addressability to system control blocks and other DSECTs regardless of whether you have the branch relative and immediate facility. And you need it to understand 99.999% of the code that already exists that does use USING. USING associates a user-defined base register to be used by the assembler in generating references to the area. Check bitsavers.org for the Assembly language course book and you will get a good explanation of all this. In fact, without understanding USING you can never read or write IBM assembler code. > general register r has the address of * in it. In primitive S/360 code, > you might have: > > BALR 12,0 > USING *,12 You also need to do this in certain other types of programs that have no standard method of entry. > Under the usual operating systems, a routine is entered by BALR 14,15, > so GR15 will always have the address of the routine loaded in it, so > you can begin with > > USING *,15 Not true of SVCs and certain other system extension routines. And you don't need a USING for *,15 anyway, you should load your chosen base register with the contents of R15 and then the next issue you mentioned: > Of course, you must be careful to have > > USING something else > DROP 15 > > soon after since GR15 will usually quickly be reused. becomes irrelevant. > But, as I say, if you are writing code expressly for z/Architecture, > and use only the Branch Relative family of instructions, and put all > your data in a separate CSECT or DSECT (or PSECT), you do not need a > base register for your code CSECT. That's why the Branch Relative > instructions were invented -- so that you have one more general > register to use for other purposes. This is fine advice for "Hello, World!" programs but for any real programming you will need to understand base addressing and DSECTs and the assembler USING directive since they are foundations of IBM assembler. And you will need to understand USING if you are ever going to need to read, understand and maintain the gigantic body of code written because virtually none of that code uses the branch relative and immediate facility, not vendor code and not IBM code. Compilers will use it increasingly, but it is uncommon to patch compiled code unless you work for one of 3 compiler vendors targeting z/OS (one of those is IBM). If you want to code in assembler you need to code like an assembler programmer.
Back to comp.lang.asm370 | Previous | Next — Previous in thread | Next in thread | Find similar
"Using" statement? hancock4@bbs.cpcn.com - 2012-07-06 06:52 -0700
Re: "Using" statement? John W Kennedy <jwkenne@attglobal.net> - 2012-07-06 11:24 -0400
Re: "Using" statement? hancock4@bbs.cpcn.com - 2012-07-06 10:15 -0700
Re: "Using" statement? Fritz Wuehler <fritz@spamexpire-201207.rodent.frell.theremailer.net> - 2012-07-12 07:31 +0200
Re: "Using" statement? John W Kennedy <jwkenne@attglobal.net> - 2012-07-12 22:09 -0400
Re: "Using" statement? Pete Nelson <plnelsonoma@yahoo.com> - 2012-07-12 08:36 -0700
Re: "Using" statement? John W Kennedy <jwkenne@attglobal.net> - 2012-07-12 22:13 -0400
Re: "Using" statement? Fritz Wuehler <fritz@spamexpire-201207.rodent.frell.theremailer.net> - 2012-07-13 14:12 +0200
Re: "Using" statement? John W Kennedy <jwkenne@attglobal.net> - 2012-07-13 13:57 -0400
Re: "Using" statement? Anonymous <noreply@breaka.net> - 2012-07-15 05:54 -0400
Re: "Using" statement? - JEmebius <jemebius@xs4all.nl> - 2012-07-30 22:09 +0100
Re: "Using" statement? -- JEmebius <jemebius@xs4all.nl> - 2012-07-30 22:13 +0100
Re: "Using" statement? --- JEmebius <jemebius@xs4all.nl> - 2012-07-30 22:19 +0100
Re: "Using" statement? --- woodag@trap.ozemail.com.au (Andy Wood) - 2012-07-31 06:22 +0000
Re: "Using" statement? --- reply JEmebius <jemebius@xs4all.nl> - 2012-08-01 02:44 +0100
Re: "Using" statement? - Fritz Wuehler <fritz@spamexpire-201207.rodent.frell.theremailer.net> - 2012-07-31 20:46 +0200
Re: "Using" statement? - reply JEmebius <jemebius@xs4all.nl> - 2012-08-01 03:10 +0100
Re: "Using" statement? - reply Fritz Wuehler <fritz@spamexpire-201208.rodent.frell.theremailer.net> - 2012-08-07 16:36 +0200
Re: "Using" statement? - reply Nomen Nescio <nobody@dizum.com> - 2012-08-07 21:33 +0200
Re: "Using" statement? - reply Clark F Morris <cfmpublic@ns.sympatico.ca> - 2012-08-07 18:13 -0300
Re: "Using" statement? - "Michel Castelein" <arcis@advalvas.be.without.this.no.spam.tail> - 2012-08-03 11:13 +0200
Re: "Using" statement? - Anonymous <nobody@remailer.paranoici.org> - 2012-08-03 13:05 +0000
Re: "Using" statement? - Allodoxaphobia <knock_yourself_out@example.net> - 2012-08-03 13:29 +0000
Re: "Using" statement? - WAB JEmebius <jemebius@xs4all.nl> - 2012-08-04 00:03 +0100
Re: "Using" statement? - WAB Allodoxaphobia <knock_yourself_out@example.net> - 2012-08-04 03:14 +0000
Re: "Using" statement? - Nomen Nescio <nobody@dizum.com> - 2012-08-06 15:15 +0200
Re: "Using" statement? alistair.j.l.maclean@gmail.com - 2012-08-19 05:58 -0700
Re: "Using" statement? John W Kennedy <jwkenne@attglobal.net> - 2012-08-19 13:15 -0400
Re: "Using" statement? Nomen Nescio <nobody@dizum.com> - 2012-08-19 22:20 +0200
Re: "Using" statement? John W Kennedy <jwkenne@attglobal.net> - 2012-08-19 18:30 -0400
csiph-web