explicit operands -- syntax help - ASM x86 ASM 370
This is a discussion on explicit operands -- syntax help - ASM x86 ASM 370 ; I'm really new to this s/370 asm.
very few resources about s/370
cuz it's not as popular as x86,of
which I can get help almost immediaetly.
my question concerns
instruction format and how to use the
yellow card reference.
eg.
...
-
explicit operands -- syntax help
I'm really new to this s/370 asm.
very few resources about s/370
cuz it's not as popular as x86,of
which I can get help almost immediaetly.
my question concerns
instruction format and how to use the
yellow card reference.
eg.
LA r1,d2 (x2,b2)
ok i understand that
r1=some reg
d2 = displacement from the base reg ,b2
b2 = base register ,ie. ptr to location entry point(retrieved from PSW)
x2 = index
what I dont get is how to use explicit operands
so far we are taught to just used fixed-length
fields...
like TABLE ds 0cl10
dc cl5'Mark '
dc cl5'Bill '
and then use LA
like
LA 3,TABLE
cool, but how do I reference TABLE ???
what parts of explicit can I leave out?
The Teacher is like moving so fast and
none of us can keep up-- we all have little
tribal meets where we rage cuz there is
'no help'-- the rest of the lab are all
COBOL and cics--clueless.
Thanks 
-
Re: explicit operands -- syntax help
In article <8708a167.0403011736.2669a496@posting.google.com>,
v3ct0r99@hotmail.com (v3ct0r99) wrote:
> I'm really new to this s/370 asm.
> very few resources about s/370
> cuz it's not as popular as x86,of
> which I can get help almost immediaetly.
> my question concerns
> instruction format and how to use the
> yellow card reference.
> eg.
> LA r1,d2 (x2,b2)
> ok i understand that
> r1=some reg
> d2 = displacement from the base reg ,b2
> b2 = base register ,ie. ptr to location entry point(retrieved from PSW)
> x2 = index
>
> what I dont get is how to use explicit operands
> so far we are taught to just used fixed-length
> fields...
> like TABLE ds 0cl10
> dc cl5'Mark '
> dc cl5'Bill '
> and then use LA
> like
> LA 3,TABLE
> cool, but how do I reference TABLE ???
> what parts of explicit can I leave out?
> The Teacher is like moving so fast and
> none of us can keep up-- we all have little
> tribal meets where we rage cuz there is
> 'no help'-- the rest of the lab are all
> COBOL and cics--clueless.
> Thanks 
You would do something like:
LA 4,TABLE put base of table into R4
LA 3,0(0,4) put address of "Mark" into R3
LA 3,15(0,4) put address of "Bill" into R3
Or even a loop:
Table EQU *
DC CL15'Mark'
Table_Ent EQU *
Table_Ent_Sz EQU (Table_Ent-Table)
DC CL15'Bill'
Table_Ents EQU (*-Table)/Table_Ent_Sz
...
LA 3,Table start of table
LA 4,Table_Ents # of table entries
LA 5,Table_Ent_Sz size of each entry
myLoop equ *
MVC someName,0(0,3) move name from table to somename
LA 3,0(5,3) bump addr up by index of table size
BCT 4,myLoop dec(4), if not 0, loop
This little loop will bump through the table moving a name to
"someName", then point to the next entry, then check to see if the end
of table is reached and fall through if it has.
-
Re: explicit operands -- syntax help
"v3ct0r99" <v3ct0r99@hotmail.com> wrote in message
news:8708a167.0403011736.2669a496@posting.google.com...
> I'm really new to this s/370 asm.
> very few resources about s/370
> cuz it's not as popular as x86,of
> which I can get help almost immediaetly.
> my question concerns
> instruction format and how to use the
> yellow card reference.
> eg.
> LA r1,d2 (x2,b2)
> ok i understand that
> r1=some reg
> d2 = displacement from the base reg ,b2
> b2 = base register ,ie. ptr to location entry point(retrieved from PSW)
> x2 = index
>
> what I dont get is how to use explicit operands
> so far we are taught to just used fixed-length
> fields...
> like TABLE ds 0cl10
> dc cl5'Mark '
> dc cl5'Bill '
> and then use LA
> like
> LA 3,TABLE
> cool, but how do I reference TABLE ???
> what parts of explicit can I leave out?
> The Teacher is like moving so fast and
> none of us can keep up-- we all have little
> tribal meets where we rage cuz there is
> 'no help'-- the rest of the lab are all
> COBOL and cics--clueless.
> Thanks 
Maybe this is a bit premature for your course but
a wiser construct here would be to use the symbolic
features of the assembler as much as possible:
TABENTL EQU 5
TABLE EQU *
DC CL(TABENTL)'Mark'
DC CL(TABENTL)'Bill'
TABENTN EQU (*-TABLE)/TABENTL
You can now easily modify the characteristics of the
table by changing just the EQU value for TABENTL
and/or the number of entries.
Addressing:
LA R3,TABLE points to the first element in TABLE
......
LA R3,TABENTL(R3) bump to the next element in TABLE
You must code some means to limit a scan so you do not
continue outside the table, this is best done using one of the
operations: BXLE, BXH, BCT or BCTR.
or if you want to address one of the elements directly:
LA R3,index of the desired element in TABLE
MH R3,=Y(TABENTL)
LA R3,TABLE(R3)
Regards Sven
-
Re: explicit operands -- syntax help
You said you were really new, so I'm going to interpret your question a
little differently.
I think you want to know how to refer to TABLE so that something like LA
R3,TABLE works.
The answer is that the Assembler knows about TABLE and does the d2(x2,b2)
"under the covers" for you.
You have a DC which declares TABLE. Your code has a base register. Normal
convention is for the first base register to be R12, but that is just a
convention. The assembler computes the displacement of TABLE for you so
that you just code LA R3,TABLE and the assembler knows the base and
displacement from there.
For example, at the top of your code, you probably have something like
this:
*
***********************************************************************
* MVS/CMS STANDARD SAVEAREA, LINAKAGE AND ADDRESSABILITY CODE
***********************************************************************
*
STM 14,12,12(13) SAVE CALLING REG 14-12 IN CALLING SAVE
BALR 12,0 LOAD BASE REGISTER
USING *,12 ASSIGN BASE REG & USING VALUE
ST 13,SAVEAREA+4 SAVE CALLERS REG 13 IN MY SAVE
LA 0,SAVEAREA GET MY SAVEAREA ADDR IN A REG
ST 0,8(13) STORE MY SAVE ADDR IN CALLING SAVEAREA
LR 13,0 PUT MY SAVEAREA ADDR IN REG 13
That makes R12 the base register for the CSECT. If TABLE is declared within
the CSECT, it has a displacement from the value in R12. You can see the
displacement of everything in your code in the Assembler listing.
If TABLE were declared in a DSECT, then when you get storage for the DSECT,
you would store the address of that storage in a register, and do a USING
for the DSECT, and the displacement value for TABLE will be computed from
the DSECT's base register.
Is that what you were asking?
--Roger Bolan
"v3ct0r99" <v3ct0r99@hotmail.com> wrote in message
news:8708a167.0403011736.2669a496@posting.google.com...
> I'm really new to this s/370 asm.
> very few resources about s/370
> cuz it's not as popular as x86,of
> which I can get help almost immediaetly.
> my question concerns
> instruction format and how to use the
> yellow card reference.
> eg.
> LA r1,d2 (x2,b2)
> ok i understand that
> r1=some reg
> d2 = displacement from the base reg ,b2
> b2 = base register ,ie. ptr to location entry point(retrieved from PSW)
> x2 = index
>
> what I dont get is how to use explicit operands
> so far we are taught to just used fixed-length
> fields...
> like TABLE ds 0cl10
> dc cl5'Mark '
> dc cl5'Bill '
> and then use LA
> like
> LA 3,TABLE
> cool, but how do I reference TABLE ???
> what parts of explicit can I leave out?
> The Teacher is like moving so fast and
> none of us can keep up-- we all have little
> tribal meets where we rage cuz there is
> 'no help'-- the rest of the lab are all
> COBOL and cics--clueless.
> Thanks 
-
Re: explicit operands -- syntax help
Yeah, thanks everyone--
I just want to understand
what base,disp,index is
and how it's used.
I feel like I'll more power to
manipulate my data in a more
efficient way.
offbeat:
The teacher said he wont
show us everything
cuz he knows many of us
are hackers and will find
our own way into the system.
Next month I'm taking a
security clinic which will
feature z/os\Linux
security tools and techniques.
From what I have been told
gaining supervisor mode
on mainframe is
almost impossible to
attain.
Sounds like a good
challenge 
later...
"Roger Bolan" <rbolan@netscape.net> wrote in message news:<c2274v$e7s$1@ausnews.austin.ibm.com>...
> You said you were really new, so I'm going to interpret your question a
> little differently.
> I think you want to know how to refer to TABLE so that something like LA
> R3,TABLE works.
>
> The answer is that the Assembler knows about TABLE and does the d2(x2,b2)
> "under the covers" for you.
> You have a DC which declares TABLE. Your code has a base register. Normal
> convention is for the first base register to be R12, but that is just a
> convention. The assembler computes the displacement of TABLE for you so
> that you just code LA R3,TABLE and the assembler knows the base and
> displacement from there.
>
> For example, at the top of your code, you probably have something like
> this:
> *
> ***********************************************************************
> * MVS/CMS STANDARD SAVEAREA, LINAKAGE AND ADDRESSABILITY CODE
> ***********************************************************************
> *
> STM 14,12,12(13) SAVE CALLING REG 14-12 IN CALLING SAVE
> BALR 12,0 LOAD BASE REGISTER
> USING *,12 ASSIGN BASE REG & USING VALUE
> ST 13,SAVEAREA+4 SAVE CALLERS REG 13 IN MY SAVE
> LA 0,SAVEAREA GET MY SAVEAREA ADDR IN A REG
> ST 0,8(13) STORE MY SAVE ADDR IN CALLING SAVEAREA
> LR 13,0 PUT MY SAVEAREA ADDR IN REG 13
>
> That makes R12 the base register for the CSECT. If TABLE is declared within
> the CSECT, it has a displacement from the value in R12. You can see the
> displacement of everything in your code in the Assembler listing.
>
> If TABLE were declared in a DSECT, then when you get storage for the DSECT,
> you would store the address of that storage in a register, and do a USING
> for the DSECT, and the displacement value for TABLE will be computed from
> the DSECT's base register.
>
> Is that what you were asking?
>
> --Roger Bolan
>
> "v3ct0r99" <v3ct0r99@hotmail.com> wrote in message
> news:8708a167.0403011736.2669a496@posting.google.com...
> > I'm really new to this s/370 asm.
> > very few resources about s/370
> > cuz it's not as popular as x86,of
> > which I can get help almost immediaetly.
> > my question concerns
> > instruction format and how to use the
> > yellow card reference.
> > eg.
> > LA r1,d2 (x2,b2)
> > ok i understand that
> > r1=some reg
> > d2 = displacement from the base reg ,b2
> > b2 = base register ,ie. ptr to location entry point(retrieved from PSW)
> > x2 = index
> >
> > what I dont get is how to use explicit operands
> > so far we are taught to just used fixed-length
> > fields...
> > like TABLE ds 0cl10
> > dc cl5'Mark '
> > dc cl5'Bill '
> > and then use LA
> > like
> > LA 3,TABLE
> > cool, but how do I reference TABLE ???
> > what parts of explicit can I leave out?
> > The Teacher is like moving so fast and
> > none of us can keep up-- we all have little
> > tribal meets where we rage cuz there is
> > 'no help'-- the rest of the lab are all
> > COBOL and cics--clueless.
> > Thanks 
-
Re: explicit operands -- syntax help
>>
The teacher said he wont show us everything cuz he knows many of us are hackers
and will find our own way into the system.
>>
While attending OS/360 Internals at the IBM Ed Center, several decades ago
(say, three), the instructors always get questions like this. Always.
Turns out there were so many holes in OS/360's security that is was a piece of
cake.
I even came up with an OS/360 simulation for the SVS and MVS MODESET macro.
The easiest method of attack was SVC 58 (FREEDBUF), but there were many other
methods.
Including the infamous SVC 0 (EXCP/XDAP) STARTIO appendage, which appendage
could actually be specified as an EP using IDENTIFY, viz. IDENTIFY EP=( ... ),
NAME=IGG019.. (the user series of appendages, although implied by the G and Y
series manuals, did NOT need to be followed).
Since EXCP/XDAP is a Type 1 SVC, the SVCOLD PSW could be modified within the
SIO appendage to turn on/turn off any desired bits, and then a SUPPRESS return
could be taken, thereby causing the NSI after the SVC 0 (X'0D00') instruction
to be in whatever state and key the programmer desired.
Still, the SVC 58 method was the easiest as the DEB/DCB, which was a parameter
to the SVC, could be coded "inline".
Plus, the SVC 58 method worked on PCP, MFT and MVT.
(IDENTIFY requires MVT, IIRC, as IDENTIFY, ATTACH, DETACH, etcetera, are
MVT-only features).
-
Re: explicit operands -- syntax help
On 1 Mar 2004 17:36:48 -0800, v3ct0r99@hotmail.com (v3ct0r99) wrote:
>I'm really new to this s/370 asm.
>very few resources about s/370
>cuz it's not as popular as x86,of
>which I can get help almost immediaetly.
>my question concerns
>instruction format and how to use the
>yellow card reference.
>eg.
>LA r1,d2 (x2,b2)
>ok i understand that
>r1=some reg
>d2 = displacement from the base reg ,b2
>b2 = base register ,ie. ptr to location entry point(retrieved from PSW)
>x2 = index
Not quite.
LA is a two operand instruction. r1 is the first operand and
designates the target (where the result of the operation will be
stored). For this instruction, the target is a register.
d2(x2,b2) is the second operand. In this case, it is an address
and that address is the data that will be stored in the first operand.
The address is computed at execution time by adding the contents of b2
(which is a register) with the contents of x2 (also a register) with
the value d2. The contents of b2 and x2 are unchanged (unless either
is the same register as r1). If either b2 or x2 is 0, that register
does not participate in the address calculation.
The PSW does not figure into the discussion at all.
>
>what I dont get is how to use explicit operands
>so far we are taught to just used fixed-length
>fields...
>like TABLE ds 0cl10
> dc cl5'Mark '
> dc cl5'Bill '
>and then use LA
>like
>LA 3,TABLE
>cool, but how do I reference TABLE ???
>what parts of explicit can I leave out?
Your instruction above placed the address of TABLE into register 3.
(This address is a relocatable value meaning it depends on where your
program is loaded in memory.) You could then code an explicit operand
like
LA 3,1(,3)
which would have the effect of incrementing the register by 1. You
could code the instruction as
LA 3,1(3)
which has the exact same effect but uses 3 as an index instead of a
base. You can also code
LA 3,1
which will compute the absolute (non-relocatable) address 1 and store
it in register 3.
<<Remove the del for email>>
-
Re: explicit operands -- syntax help
Barry Schwarz <schwarzb@deloz.net> wrote in message news:<c25uep$toi$0@216.39.134.44>...
> On 1 Mar 2004 17:36:48 -0800, v3ct0r99@hotmail.com (v3ct0r99) wrote:
>
> <Snip-snip>
>
> The PSW does not figure into the discussion at all.
>
> <Snip-snip>
Not entirely true: the amode bits in the PSW will determine
how many bits of the base and index registers will participate
in the address calculation: 24, 31 or all 64. This also is
the number of bits stored in the destination register (operand 1)
with an appropriate number of zero bits appended on the left:
40, 33 or zero, respectively. That is: overflow and/or
garbage in high-order bits will be ignored. Whether or not
this is acceptable depends upon your program.
If it is not, you should use some variant of the ADD
instruction. E.g. A, AR, AGR, AG, etc.
You might consider a visit to http://www.hlasm.com for
assembler code samples, macro code samples, and other
tidbits of information, programming styles, etc.
Abe Kornelis.
=============
-
Re: explicit operands -- syntax help
On 4 Mar 2004 01:12:34 -0800 a.kornelis@pinkroccade.com (Abe Kornelis) wrote:
:>Barry Schwarz <schwarzb@deloz.net> wrote in message news:<c25uep$toi$0@216.39.134.44>...
:>> On 1 Mar 2004 17:36:48 -0800, v3ct0r99@hotmail.com (v3ct0r99) wrote:
:>> <Snip-snip>
:>> The PSW does not figure into the discussion at all.
:>> <Snip-snip>
:>Not entirely true: the amode bits in the PSW will determine
:>how many bits of the base and index registers will participate
:>in the address calculation: 24, 31 or all 64. This also is
:>the number of bits stored in the destination register (operand 1)
:>with an appropriate number of zero bits appended on the left:
:>40, 33 or zero, respectively.
LA will never put 40 or 33 zeroes on the left.
If in 24 bit mode, 0-31 are not touched, 32-39 are set to zero and the
truncated result is placed in 40-63.
If in 31 bit more, 0-31 are not touched, 32 is set to zero and the truncated
result is placed in 33-63.
If in 64 bit mode, all 64 bits will be set to the truncated result.
:> That is: overflow and/or
:>garbage in high-order bits will be ignored. Whether or not
:>this is acceptable depends upon your program.
:>If it is not, you should use some variant of the ADD
:>instruction. E.g. A, AR, AGR, AG, etc.
:>You might consider a visit to http://www.hlasm.com for
:>assembler code samples, macro code samples, and other
:>tidbits of information, programming styles, etc.
--
Binyamin Dissen <bdissen@dissensoftware.com>
http://www.dissensoftware.com
Director, Dissen Software, Bar & Grill - Israel
-
Re: explicit operands -- syntax help
Binyamin Dissen <postingid@dissensoftware.com> wrote in message news:<amde40p2g92k0vnjhq2a0drp2g63pd16i3@4ax.com>...
> <snip>
> LA will never put 40 or 33 zeroes on the left.
>
> If in 24 bit mode, 0-31 are not touched, 32-39 are set to zero and the
> truncated result is placed in 40-63.
>
> If in 31 bit more, 0-31 are not touched, 32 is set to zero and the truncated
> result is placed in 33-63.
>
> If in 64 bit mode, all 64 bits will be set to the truncated result.
> <snip>
Binyamin,
you are entirely correct. I'm sorry to have caused confusion.
Abe.
Similar Threads
-
By Application Development in forum DOTNET
Replies: 2
Last Post: 07-20-2007, 08:18 AM
-
By Application Development in forum DOTNET
Replies: 1
Last Post: 07-16-2007, 05:25 PM
-
By Application Development in forum XML SOAP
Replies: 9
Last Post: 05-01-2006, 07:43 AM
-
By Application Development in forum XML SOAP
Replies: 6
Last Post: 08-30-2005, 10:09 AM