View previous topic :: View next topic |
Author |
Message |
karunkallore Beginner
Joined: 11 Dec 2004 Posts: 103 Topics: 39
|
Posted: Fri Feb 25, 2005 10:16 pm Post subject: Help In a concept- STCM |
|
|
Dear friends,
Can you please help me to understand concept which i found in QW in mainframe regarding STCM:-
1) in STCM V1R2 version documentation
Instruction Format: STCM R1,M3,D2(B2) Operation Code (Hex): BE
Examples: STCM R8,B'1010',0(R4) STORE FIRST AND THIRD
BYTES OF R8 INTO 2
BYTES AT ADDRESS IN R4
STCM R9,2,SWITCH STORE THIRD BYTE OF R9
AT LABEL "SWITCH"
2) in STCM V1R2 version documentation
Instruction Format: STCM R1,M3,D2(B2) Operation Code (Hex): BE
Examples: STCM R8,B'1010',0(R4) STORE FOURTH AND SIXTH
BYTES OF R8 INTO 2
BYTES AT ADDRESS IN R4
STCM R9,2,SWITCH STORE SIXTH BYTE OF R9
AT LABEL "SWITCH"
STCM R2,15,0(R3) STORE ALL FOUR OF THE
RIGHTMOST BYTES IN R2 AT
THE ADDRESS IN R3
Bit in Mask Byte from Register
1000 byte 4 (bits 32-39)
0100 byte 5 (bits 40-47)
0010 byte 6 (bits 48-55)
0001 byte 7 (bits 56-63)
Now these two versions are taking bytes from the Register in different ways. In One it is from first and third byte of R8. Is the first and Third from Right or left. In Second it is fourth and sixth byte of R8 . Is it from left or right ? Do they consider R9 also ? If so then in Second description what about "STCM R9,2,SWITCH ".
Also can any one please explain the following ;-
If i see a 64 bit ie 8 byte data and i have it is R8 and R9 and if i print it on or see it on a console it will be like this :-
R8 R9
XXXXXXXX YYYYYYYY
X--> a nibble
Y-->a nibble
So here
R8 R9
XXXXXXXX YYYYYYYY--> is this Y 16^0
and The X at the extreme left 16^15
or is it the other way round that is
R8 R9
XXXXXXXX YYYYYYYY--> is this Y 16^15
and The x at the extreme left 16^0
Here ^ Denotes POWER
Please guide to clear this concept. Also please guide me nay soft copy of materials where assembler on mainframe is written in a simple fashion.
Thanks in advance,
Karun |
|
Back to top |
|
|
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Fri Feb 25, 2005 10:46 pm Post subject: |
|
|
I suspect that the difference in the instruction behaviour is when the machine is in 31 bit vs 64 bit mode. In 64 bit mode, the register is 64 bits (16 nibbles). In 31 bit mode, the register is 32 bits (8 nibbles). Your 1st xxxxxxxx yyyyyyy description is correct. That is why byte 6 & 8 in a 64 bit register is the same as bytes 2 and 4 in a 32 bit one. |
|
Back to top |
|
|
karunkallore Beginner
Joined: 11 Dec 2004 Posts: 103 Topics: 39
|
Posted: Fri Feb 25, 2005 11:00 pm Post subject: A little more please... |
|
|
Hi,
Can you please explain a little more please. I am a bit confused at the explanation in the Version 1 and 2 i find in Mainframe. I got your concept of 32 bit Vs 64 bit. Still in that case we never can access 0 to 3 bytes in 64 bit mode.
Thanks in advance,
Karun |
|
Back to top |
|
|
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Fri Feb 25, 2005 11:30 pm Post subject: |
|
|
I'm sure that there are other instrictions that can do it. I haven't done any 64 bit assembler programming yet, but I know that the instruction set is very flexible regarding access to the full 64 bits in a register. But STCM is an established instruction which should work the same way in either 32 or 64 bit mode. If you load a number (a word) into the register, STCM should operate on the least (?) significant part of that number. At least that is what I would suspect. |
|
Back to top |
|
|
MikeBaker Beginner
Joined: 04 May 2004 Posts: 96 Topics: 9
|
Posted: Mon Feb 28, 2005 10:42 pm Post subject: |
|
|
When you count the bits inside a byte, you go (count) from right to left. And so on for a fullword/doubleword.
The example with R9 is just another way of writing STCM R9,B'0010',SWITCH, where 'SWITCH' is the name of some variable (not shown here).
You can access bytes 0-3 through using the new instruction STCMH, which is a bit strange , seeing as this was actually the old way of doing things with a STCM.
As for your "to power of" business, sorry but that's too hard for me. |
|
Back to top |
|
|
karunkallore Beginner
Joined: 11 Dec 2004 Posts: 103 Topics: 39
|
Posted: Thu Mar 10, 2005 8:14 pm Post subject: Thank you all for the response..!! |
|
|
Thank you all for the response..!! |
|
Back to top |
|
|
|
|