Use of ICM 
Author Message
 Use of ICM

Consider this code

L    8,ADCON1
LH   9,LENGTH1
L    2,ADCON2
LR   3,9
ICM  2,X'40'
MVCL 2,8

What is the ICM doing and why would an applications programmer want to
use it?

--

Bob Cochran
I am a student of Linux, Java, database and web development.





Thu, 21 Aug 2003 11:34:28 GMT  
 Use of ICM
The ICM isn't coded properly... ICM requires 3 operands... register, mask,
and one byte of data.

I think the INTENTION if this code is to set the pad character for the MVCL
to x'40' .

I thinkwhat they meant to do is something like...

ICM R2,B'1000',=C' '

I like to use the B-Type constants for the ICM/STCM because it's so obvious
which byte of the register is affected.

--
---
Don Russell



Quote:
> Consider this code

> L    8,ADCON1
> LH   9,LENGTH1
> L    2,ADCON2
> LR   3,9
> ICM  2,X'40'
> MVCL 2,8

> What is the ICM doing and why would an applications programmer want to
> use it?

> --

> Bob Cochran
> I am a student of Linux, Java, database and web development.






Thu, 21 Aug 2003 12:09:27 GMT  
 Use of ICM
See my previous reply about the use of ICM.... but you're right, it's not
much use (even if it were coded correctly) because the two operands for the
MVCL have the same length. Padding won't apply.

--
---
Don Russell



Quote:
> Consider this code

> L    8,ADCON1
> LH   9,LENGTH1
> L    2,ADCON2
> LR   3,9
> ICM  2,X'40'
> MVCL 2,8

> What is the ICM doing and why would an applications programmer want to
> use it?

> --

> Bob Cochran
> I am a student of Linux, Java, database and web development.






Thu, 21 Aug 2003 12:11:38 GMT  
 Use of ICM
Don,

Thanks for correcting my coding of the ICM and for your comments.

Quote:

> The ICM isn't coded properly... ICM requires 3 operands... register, mask,
> and one byte of data.

> I think the INTENTION if this code is to set the pad character for the MVCL
> to x'40' .

Don, thanks for correcting my coding of the ICM and your comments.
Quote:

> I thinkwhat they meant to do is something like...

> ICM R2,B'1000',=C' '

> I like to use the B-Type constants for the ICM/STCM because it's so obvious
> which byte of the register is affected.

> --
> ---
> Don Russell



> > Consider this code

> > L    8,ADCON1
> > LH   9,LENGTH1
> > L    2,ADCON2
> > LR   3,9
> > ICM  2,X'40'
> > MVCL 2,8

> > What is the ICM doing and why would an applications programmer want to
> > use it?

> > --

> > Bob Cochran
> > I am a student of Linux, Java, database and web development.






Thu, 21 Aug 2003 13:41:00 GMT  
 Use of ICM

Quote:
> Consider this code

> L    8,ADCON1
> LH   9,LENGTH1
> L    2,ADCON2
> LR   3,9
> ICM  2,X'40'
> MVCL 2,8

and besides it is the wrong reg, the pad byte goes in the high byte of
the source length (aka register 9) ... only 24 bits are used in the
source and destination length registers.

one might also do a SR 9,9 and an icm,b'0011',length1 with a branch.

so possibly (if there were any chance of source length being less than
destination length).

icm  8,b'1111',adcon1
bz   error
icm  2,b'1111',adcon2
bz   error
sr   9,9
icm  9,b'0011',length1
bz   error
lr   3,9
icm  9,b'1000',=c' '
mvcl 2,8

--



Thu, 21 Aug 2003 13:56:49 GMT  
 Use of ICM

Quote:

> icm  8,b'1111',adcon1
> bz   error
> icm  2,b'1111',adcon2
> bz   error
> sr   9,9
> icm  9,b'0011',length1
> bz   error
> lr   3,9
> icm  9,b'1000',=c' '
> mvcl 2,8

as an aside, questions like this posted to comp.arch are treated as if
somebody is trying to get their homework done for them ...

random recent refs:
http://www.garlic.com/~lynn/2001.html#70
http://www.garlic.com/~lynn/2001b.html#38
http://www.garlic.com/~lynn/2001c.html#11
http://www.garlic.com/~lynn/2001c.html#10

--



Thu, 21 Aug 2003 14:04:13 GMT  
 Use of ICM
I definately prefer
    LH R9,Length1
instead of the sr/icm pair.. though I would use the icm if the spec called
for a possible length exceeding 32K (otherwise the sign-extension bites you
:-)

I also don't agree with length1 of zero being an error.... I use that often
to initialize areas with x'00' or c' ' etc.

But yes, ICM r,B'1111',adcon1 illustrates the "conspicuous in it's absence"
LT instruction (load and test) :-)

--
---
Don Russell



Quote:

> > icm  8,b'1111',adcon1
> > bz   error
> > icm  2,b'1111',adcon2
> > bz   error
> > sr   9,9
> > icm  9,b'0011',length1
> > bz   error
> > lr   3,9
> > icm  9,b'1000',=c' '
> > mvcl 2,8

> as an aside, questions like this posted to comp.arch are treated as if
> somebody is trying to get their homework done for them ...

> random recent refs:
> http://www.garlic.com/~lynn/2001.html#70
> http://www.garlic.com/~lynn/2001b.html#38
> http://www.garlic.com/~lynn/2001c.html#11
> http://www.garlic.com/~lynn/2001c.html#10

> --




Thu, 21 Aug 2003 15:34:32 GMT  
 Use of ICM
I've used ICM to test for a valid storage address (aligned or unaligned
fullword), the presence of a terminal (in CICS) or to load a pad character
in an MVCL sending register:

            ICM    Rx,B'1111',STGADDR
            BNZ    ADDRISOK

            ICM    Rx,B'1111',EIBTRMID
            BZ      NOTERMID

            ICM    Rx,B'1000',=X'40'

            (CC doesn't really matter in this case)

For testing for data presence, it saves you a LOAD (L) instruction followed
by an LTR instruction as everything is done in the one instruction.

HTH,

Bill



Quote:
> Consider this code

> L    8,ADCON1
> LH   9,LENGTH1
> L    2,ADCON2
> LR   3,9
> ICM  2,X'40'
> MVCL 2,8

> What is the ICM doing and why would an applications programmer want to
> use it?

> --

> Bob Cochran
> I am a student of Linux, Java, database and web development.






Thu, 21 Aug 2003 21:02:28 GMT  
 Use of ICM
Yes, I agree with that, I was just thinking in general, and in line with the
original example.

--
---
Don Russell

Quote:
> IMO, in the Wheeler's example, since length1 is also the output length,
> not doing the MVCL if length1 = 0 is OK.

> -- Steve Myers



> >I definately prefer
> >    LH R9,Length1
> >instead of the sr/icm pair.. though I would use the icm if the spec
called
> >for a possible length exceeding 32K (otherwise the sign-extension bites
you
> >:-)

> >I also don't agree with length1 of zero being an error.... I use that
often
> >to initialize areas with x'00' or c' ' etc.

> >But yes, ICM r,B'1111',adcon1 illustrates the "conspicuous in it's
absence"
> >LT instruction (load and test) :-)

> >--
> >---
> >Don Russell




> >> > icm  8,b'1111',adcon1
> >> > bz   error
> >> > icm  2,b'1111',adcon2
> >> > bz   error
> >> > sr   9,9
> >> > icm  9,b'0011',length1
> >> > bz   error
> >> > lr   3,9
> >> > icm  9,b'1000',=c' '
> >> > mvcl 2,8

> >> as an aside, questions like this posted to comp.arch are treated as if
> >> somebody is trying to get their homework done for them ...

> >> random recent refs:
> >> http://www.garlic.com/~lynn/2001.html#70
> >> http://www.garlic.com/~lynn/2001b.html#38
> >> http://www.garlic.com/~lynn/2001c.html#11
> >> http://www.garlic.com/~lynn/2001c.html#10

> >> --




Fri, 22 Aug 2003 12:42:33 GMT  
 Use of ICM


Quote:
> Consider this code

> L    8,ADCON1
> LH   9,LENGTH1
> L    2,ADCON2
> LR   3,9
> ICM  2,X'40'
> MVCL 2,8

> What is the ICM doing and why would an applications programmer want to
> use it?

Definitely not coded properly, as Don R points out in another reply.
Essentially, the MVCL takes two sets of two even/odd register pairs. The set
on the left is the target and has the form:
 Reven = address of target
 Rodd = length of target

The set on the right has this form:
 Reven = Address of source
 Rodd = length of source

The only difference is that the "Rodd" of the source reg has its high order
byte set to some value which will be used as a fill character should the
length of the source run down to zero before the target.

Additionally, fields that are legitimately moved cannot overlap. IE:
Propagation of a character(s) is not permitted with MVCL. (That's the
MVI/MVC +1 combination)

Finally, you can zero both of the source registers with the result being the
target field set to binary zeros. If it's a big area, then it's a good
instruction to use. If it's less than 257, then an XC or MVI/MVC combination
would be faster.

Hope this helps...
BB



Fri, 22 Aug 2003 13:51:31 GMT  
 Use of ICM
Good description of MVCL with a slight, but important error:

MVCL operands may indeed overlap, but not destructively.
That means that source bytes must not be stored into before
they are fetched from, or more precisely: The leftmost target
byte must not be part of the source field except that it may
coincide with the leftmost source byte.

The ICM instruction is used to load from one to all four bytes
into a register (affected bytes selected according to a mask)
from storage while setting the condition code.

It is quite useful when there is a need to load one, two or three
bytes into a register while leaving the remaining byte(s)
unchanged, it was also useful as an alternative to the Load
fullword instruction which required alignment (early
architectures) when alignment could not be certain, and finally
it can be useful in some cases when condition code setting is
needed.

regards Sven


Quote:


> > Consider this code

> > L    8,ADCON1
> > LH   9,LENGTH1
> > L    2,ADCON2
> > LR   3,9
> > ICM  2,X'40'
> > MVCL 2,8

> > What is the ICM doing and why would an applications programmer want to
> > use it?

> Definitely not coded properly, as Don R points out in another reply.
> Essentially, the MVCL takes two sets of two even/odd register pairs. The
set
> on the left is the target and has the form:
>  Reven = address of target
>  Rodd = length of target

> The set on the right has this form:
>  Reven = Address of source
>  Rodd = length of source

> The only difference is that the "Rodd" of the source reg has its high
order
> byte set to some value which will be used as a fill character should the
> length of the source run down to zero before the target.

> Additionally, fields that are legitimately moved cannot overlap. IE:
> Propagation of a character(s) is not permitted with MVCL. (That's the
> MVI/MVC +1 combination)

> Finally, you can zero both of the source registers with the result being
the
> target field set to binary zeros. If it's a big area, then it's a good
> instruction to use. If it's less than 257, then an XC or MVI/MVC
combination
> would be faster.

> Hope this helps...
> BB



Fri, 22 Aug 2003 16:16:46 GMT  
 Use of ICM
One minor error in the description.  If the source length is 0, then
the source address is not used at all, and need not be 0.

-- Steve Myers


[snip]

Quote:

>Finally, you can zero both of the source registers with the result being the
>target field set to binary zeros. If it's a big area, then it's a good
>instruction to use. If it's less than 257, then an XC or MVI/MVC combination
>would be faster.

>Hope this helps...
>BB



Fri, 22 Aug 2003 17:42:42 GMT  
 Use of ICM


Quote:
> Good description of MVCL with a slight, but important error:

> MVCL operands may indeed overlap, but not destructively.
> That means that source bytes must not be stored into before
> they are fetched from, or more precisely: The leftmost target
> byte must not be part of the source field except that it may
> coincide with the leftmost source byte.

And Meyers spat forth:

Quote:
> One minor error in the description.  If the source length is 0, then
> the source address is not used at all, and need not be 0.

> -- Steve Myers

Geezus !!! You guys are brutal !!!


Sun, 24 Aug 2003 09:33:57 GMT  
 
 [ 13 post ] 

 Relevant Pages 

1. ICM & STCM

2. ICM, STCM, CLM - Off-Topic.

3. ICM - Set Condition Code?

4. L/LTR vs ICM

5. ICM vs. L and LTR

6. ICM vs. L and LTR

7. Ever heard of ICM REXX?

8. Killing yourself with Virtual Storage (was ICM - Set Condition code?)

9. using and active using range

10. Application Name using ODBC connection using Visualage

11. RE Issuing using Using OCX in Clarion :)

12. Urgent!!Oracle9i:using ODBC, I am noy able to link to my database tables using Access

 

 
Powered by phpBB® Forum Software