Not quite. -4096 is an absolute term, and has no relation to the
CSect in which it appears. This means that any implied address
with an absolute value is tested against the USING statement to
see if a valid displacement can be derived. Since -4=-4096+4092
(as others have pointed out), the assembler generates the LA
instruction with displacement 4092=X'FFC'.

The documentatin in the HLASM Language Reference is incomplete,
and will be updated to clarify this point.
John Ehrman
    (------------------ Referenced Note Follows --------------------)
Date: 9 September 2010, 19:37:22 EDT

At 14:13 -0400 on 09/09/2010, Thomas David Rivers wrote about Re:
Negative displacements

>NEGDISP  CSECT
>  USING -4096,R1
>  LA    R3,-4(R2)
>  LA    R3,-4(,R2)
>
>I wonder why HLASM allows the negative displacement?
>The HLASM documentation (HLASM V1R6 Language Reference manual)
>for an "Ordinary USING" indicates:
>
>    base
>      specifies a base address, which can be a relocatable
>      or an absolute expression. The value of the expression
>      must lie between 0 and 2**31-1.
>
>and -4096 doesn't lie in that range...

Yes it does. ASMH is treating the "USING -4096,R1" as "USING
NEGDISP-4096,R1" (ie: The 4096 bytes before the start of the CSECT).
Thus when you ask for -4 it is referencing NEGDISP-4 which is covered
by R1. The problem is that it is not flagging the -4(,2) case since
there is no access to that area via R2.

Reply via email to