I don't remember that manual having so many errors.  It worked for me when
I developed this kind of thing years ago.

LLH is the modern way to load an unsigned halfword, although it may be too
new for some old hardware.

sas

On Wed, Nov 6, 2019 at 1:25 PM Jonathan Scott <jonathan_sc...@vnet.ibm.com>
wrote:

> Ref:  Your note of Wed, 6 Nov 2019 18:06:46 +0000
>
> >  LA 1,1(0)
> >  ST 1,AXNUM
> >  ...
> >  L 4,AXVAL
> >  ETDEF TYPE=SET...
> > .
> > the work areas are:
> > AXL   DS 0F  AXLIST
> > AXNUM DS H   Number of AXs Requested
> > AXVAL DS H   Returned AX (OR EAX)
>
> Hmmm, this definitely needs a Readers Comment Form, please.
>
> The code should store a value of 1 into the first halfword of
> the AXRES parameter list.  It could do that using LHI and STH,
> or LA instead of LHI to do it the old way.  Specifying a base of
> zero has no effect, as it is how the instruction would assemble
> anyway.
>
> An EAX value is an unsigned 16-bit value, so to be safe the code
> should then pick up the EAX value neither with L (wrong) nor LH
> but by clearing a register and using ICM with a mask of B'0011'
> to load it into the low two bytes before using that register as
> an input to ETDEF.  If LH is used instead, there is in theory a
> risk that if the first bit of the EAX is set then the high half
> of the register will be 1s instead of 0s, making the EAX value
> invalid.
>
> So this is what I would use for those instructions:
>
>    LHI 1,1
>    STH 1,AXNUM
>    ...
>    XR  4,4
>    ICM 4,B'0011',AXVAL
>    ETDEF TYPE=SET...
>
> Jonathan Scott, HLASM
> IBM Hursley, UK
>


-- 
sas

Reply via email to